From 8960194f456d87febd621e6d49ea5f3f6eb0d9ba Mon Sep 17 00:00:00 2001 From: weronika-kurczyna <117282008+weronika-kurczyna@users.noreply.github.com> Date: Tue, 17 Oct 2023 10:16:47 +0200 Subject: [PATCH 01/21] update list gift card transactions --- Changelog.md | 2 + ...VOUCHERS-API-List-Voucher-Transactions.md} | 4 +- reference/OpenAPI.json | 154564 +++++++-------- 3 files changed, 77251 insertions(+), 77319 deletions(-) rename docs/reference-docs/{VOUCHERS-API-List-Gift-Card-Transactions.md => VOUCHERS-API-List-Voucher-Transactions.md} (85%) diff --git a/Changelog.md b/Changelog.md index da4deaaf3..addb76030 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,7 @@ # Changelog +# 20231017 +- Vouchers - List Gift Card Transactions (**GET** `/vouchers/{code}/transactions`) renamed to List Voucher Transactions ## 20231012 - Product Collections diff --git a/docs/reference-docs/VOUCHERS-API-List-Gift-Card-Transactions.md b/docs/reference-docs/VOUCHERS-API-List-Voucher-Transactions.md similarity index 85% rename from docs/reference-docs/VOUCHERS-API-List-Gift-Card-Transactions.md rename to docs/reference-docs/VOUCHERS-API-List-Voucher-Transactions.md index 0c0946408..d9c3268fd 100644 --- a/docs/reference-docs/VOUCHERS-API-List-Gift-Card-Transactions.md +++ b/docs/reference-docs/VOUCHERS-API-List-Voucher-Transactions.md @@ -1,8 +1,8 @@ --- -title: List Gift Card Transactions +title: List Voucher Transactions type: endpoint categorySlug: voucherify-api -slug: list-gift-card-transactions +slug: list-voucher-transactions parentDocSlug: vouchers-api hidden: false order: 11 diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index dae42e817..98178cc31 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -3890,8 +3890,8 @@ } } }, - "1_res_vouchers_code_transactions": { - "title": "Get Gift Card Transactions Response Body", + "vouchers_list_transactions_response_body": { + "title": "Get Voucher Transactions Response Body", "type": "object", "description": "List of voucher transactions", "properties": { @@ -3909,36 +3909,58 @@ "type": "array", "description": "A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object.", "items": { - "$ref": "#/components/schemas/1_obj_gift_card_transaction_object" + "$ref": "#/components/schemas/voucher_transaction" } }, "has_more": { "type": "boolean", "description": "As query results are always limited (by the limit parameter), the `has_more` flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results." } - } + }, + "required": [ + "object", + "data_ref", + "data", + "has_more" + ] + }, + "voucher_transaction": { + "title": "Voucher Transaction", + "description": "Voucher transaction object", + "oneOf": [ + { + "$ref": "#/components/schemas/gift_card_transaction", + "x-stoplight": { + "id": "z5j73encc7u23" + } + }, + { + "$ref": "#/components/schemas/LoyaltyCardTransaction", + "x-stoplight": { + "id": "57gaoie3qn3il" + } + } + ] }, - "1_obj_gift_card_transaction_object": { - "title": "Gift Card Transaction Object", + "gift_card_transaction": { + "title": "Gift Card Transaction", "description": "Gift card transaction object", - "anyOf": [ + "allOf": [ { - "$ref": "#/components/schemas/1_obj_gift_card_transaction_object_redemption" + "$ref": "#/components/schemas/gift_card_transaction_identity" }, { - "$ref": "#/components/schemas/1_obj_gift_card_transaction_object_refund" + "$ref": "#/components/schemas/gift_card_transaction_base" }, { - "$ref": "#/components/schemas/1_obj_gift_card_transaction_object_addition" + "$ref": "#/components/schemas/gift_card_transaction_response_data" }, { - "$ref": "#/components/schemas/1_obj_gift_card_transaction_object_removal" + "$ref": "#/components/schemas/gift_card_transaction_details" } ] }, - "1_obj_gift_card_transaction_object_redemption": { - "title": "Redemption", - "description": "When credits are used to pay for an order.", + "gift_card_transaction_identity": { "type": "object", "properties": { "id": { @@ -3947,169 +3969,110 @@ "example": "vtx_0c9dccc4d5813e71bd" }, "source_id": { - "type": "string", + "type": [ + "string", + "null" + ], "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is `null`." - }, + } + }, + "required": [ + "id", + "source_id" + ], + "title": "Gift Card Transaction Base" + }, + "gift_card_transaction_base": { + "type": "object", + "properties": { "voucher_id": { "type": "string", "description": "Unique voucher ID.", "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" }, "campaign_id": { - "type": "string", + "type": [ + "string", + "null" + ], "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaing that generates bulk codes.", "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" }, - "source": { - "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is `null`.", - "enum": [ - "voucherify-web-ui", - "API" - ] - }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred. In case of a redemption, this value is `null`." - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "CREDITS_REDEMPTION", - "enum": [ - "CREDITS_REDEMPTION" - ] - }, - "details": { - "type": "object", - "description": "Contains the detailed information about the transaction.", - "properties": { - "balance": { - "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", - "properties": { - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "gift_voucher" - }, - "total": { - "type": "integer", - "description": "Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "amount": { - "type": "integer", - "description": "The amount being used up by the redemption. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, - "balance": { - "type": "integer", - "description": "The credit balance on the gift card after the amount is subtracted from the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "related_object": { - "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "type": { - "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" - } - } - } - } - }, - "order": { - "type": "object", - "description": "Contains information about the original order.", - "properties": { - "id": { - "type": "string", - "description": "Unique order ID.", - "example": "ord_jj5EzDxDOd2xFPsAJJ18IaZK" - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - } - } - }, - "redemption": { - "type": "object", - "description": "Contains information about the original redemption.", - "properties": { - "id": { - "type": "string", - "description": "Unique redemption ID.", - "example": "r_0c94ed583fcafc31c1" - } - } - } - } - }, "related_transaction_id": { - "type": "string", + "type": [ + "string", + "null" + ], "description": "This field is `null` in the case of gift voucher transactions." }, + "reason": { + "type": [ + "string", + "null" + ], + "description": "Reason why the transaction occurred. In case of a redemption, this value is `null`." + } + }, + "required": [ + "voucher_id", + "campaign_id", + "related_transaction_id", + "reason" + ], + "title": "Gift Card Transaction Base" + }, + "gift_card_transaction_response_data": { + "type": "object", + "title": "Gift Card Transaction Response Data", + "properties": { "created_at": { "type": "string", "format": "date-time", "example": "2022-02-25T13:32:08.734Z", "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." } - } + }, + "required": [ + "created_at" + ] }, - "1_obj_gift_card_transaction_object_refund": { - "title": "Refund", - "description": "When funds are credited back to a card through a redemption rollback.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption rollback, this value is `null`." + "gift_card_transaction_details": { + "title": "Gift Card Transaction Details", + "anyOf": [ + { + "$ref": "#/components/schemas/gift_card_transaction_redemption_details" }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + { + "$ref": "#/components/schemas/gift_card_transaction_refund_details" }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaing that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + { + "$ref": "#/components/schemas/gift_card_transaction_addition_details" }, + { + "$ref": "#/components/schemas/gift_card_transaction_removal_details" + } + ], + "type": "object" + }, + "gift_card_transaction_redemption_details": { + "title": "Redemption", + "description": "When credits are used to pay for an order.", + "type": "object", + "properties": { "source": { "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption rollback, this value is `null`.", + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is `null`.", "enum": [ "voucherify-web-ui", "API" ] }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred. In case of a redemption rollback, this value is `null`." - }, "type": { "type": "string", "description": "Type of transaction.", - "default": "CREDITS_REFUND", + "default": "CREDITS_REDEMPTION", "enum": [ - "CREDITS_REFUND" + "CREDITS_REDEMPTION" ] }, "details": { @@ -4131,7 +4094,7 @@ }, "amount": { "type": "integer", - "description": "The amount being returned. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + "description": "The amount being used up by the redemption. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." }, "object": { "type": "string", @@ -4140,7 +4103,7 @@ }, "balance": { "type": "integer", - "description": "The credit balance on the gift card after the amount is added back to the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + "description": "The credit balance on the gift card after the amount is subtracted from the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." }, "related_object": { "type": "object", @@ -4185,2342 +4148,1369 @@ "example": "r_0c94ed583fcafc31c1" } } - }, - "rollback": { - "type": "object", - "description": "Contains information about the redemption rollback.", - "properties": { - "id": { - "type": "string", - "description": "Unique redemption rollback ID.", - "example": "rr_0c94edbb8d0bef5d9e" + } + } + } + }, + "gift_card_transaction_refund_details": { + "title": "Refund", + "description": "When funds are credited back to a card through a redemption rollback.", + "type": "object", + "properties": { + "source": { + "type": "string", + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption rollback, this value is `null`.", + "enum": [ + "voucherify-web-ui", + "API" + ] + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "CREDITS_REFUND", + "enum": [ + "CREDITS_REFUND" + ] + }, + "details": { + "type": "object", + "description": "Contains the detailed information about the transaction.", + "properties": { + "balance": { + "type": "object", + "description": "Contains information on how the balance was affected by the transaction.", + "properties": { + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "gift_voucher" + }, + "total": { + "type": "integer", + "description": "Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "amount": { + "type": "integer", + "description": "The amount being returned. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON.", + "default": "balance" + }, + "balance": { + "type": "integer", + "description": "The credit balance on the gift card after the amount is added back to the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "related_object": { + "type": "object", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "type": { + "type": "string", + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" + } + } + } + } + }, + "order": { + "type": "object", + "description": "Contains information about the original order.", + "properties": { + "id": { + "type": "string", + "description": "Unique order ID.", + "example": "ord_jj5EzDxDOd2xFPsAJJ18IaZK" + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + } + } + }, + "redemption": { + "type": "object", + "description": "Contains information about the original redemption.", + "properties": { + "id": { + "type": "string", + "description": "Unique redemption ID.", + "example": "r_0c94ed583fcafc31c1" + } + } + }, + "rollback": { + "type": "object", + "description": "Contains information about the redemption rollback.", + "properties": { + "id": { + "type": "string", + "description": "Unique redemption rollback ID.", + "example": "rr_0c94edbb8d0bef5d9e" + } } } } } }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of gift voucher transactions." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." - } - } - }, - "1_obj_gift_card_transaction_object_addition": { - "title": "Addition", - "description": "When funds are deposited to a gift card.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaing that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "source": { - "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", - "enum": [ - "voucherify-web-ui", - "API" - ] - }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred." - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "CREDITS_ADDITION", - "enum": [ - "CREDITS_ADDITION" - ] - }, - "details": { + "gift_card_transaction_addition_details": { + "title": "Addition", + "description": "When funds are deposited to a gift card.", "type": "object", - "description": "Contains the detailed information about the transaction.", "properties": { - "balance": { + "source": { + "type": "string", + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", + "enum": [ + "voucherify-web-ui", + "API" + ] + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "CREDITS_ADDITION", + "enum": [ + "CREDITS_ADDITION" + ] + }, + "details": { "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", + "description": "Contains the detailed information about the transaction.", "properties": { - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "gift_voucher" - }, - "total": { - "type": "integer", - "description": "Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "amount": { - "type": "integer", - "description": "The amount being added. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, "balance": { - "type": "integer", - "description": "The credit balance on the gift card after the amount is added to the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "related_object": { "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "description": "Contains information on how the balance was affected by the transaction.", "properties": { - "id": { + "type": { "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "gift_voucher" }, - "type": { + "total": { + "type": "integer", + "description": "Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "amount": { + "type": "integer", + "description": "The amount being added. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "object": { "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" + "description": "The type of object represented by the JSON.", + "default": "balance" + }, + "balance": { + "type": "integer", + "description": "The credit balance on the gift card after the amount is added to the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "related_object": { + "type": "object", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "type": { + "type": "string", + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" + } + } } } } } + }, + "related_transaction_id": { + "type": "string", + "description": "This field is `null` in the case of gift voucher transactions." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." } } }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of gift voucher transactions." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." - } - } - }, - "1_obj_gift_card_transaction_object_removal": { - "title": "Removal", - "description": "When funds are removed from a gift card.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaing that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "source": { - "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", - "enum": [ - "voucherify-web-ui", - "API" - ] - }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred." - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "CREDITS_REMOVAL", - "enum": [ - "CREDITS_REMOVAL" - ] - }, - "details": { + "gift_card_transaction_removal_details": { + "title": "Removal", + "description": "When funds are removed from a gift card.", "type": "object", - "description": "Contains the detailed information about the transaction.", "properties": { - "balance": { + "source": { + "type": "string", + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", + "enum": [ + "voucherify-web-ui", + "API" + ] + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "CREDITS_REMOVAL", + "enum": [ + "CREDITS_REMOVAL" + ] + }, + "details": { "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", + "description": "Contains the detailed information about the transaction.", "properties": { - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "gift_voucher" - }, - "total": { - "type": "integer", - "description": "Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "amount": { - "type": "integer", - "description": "The amount being subtracted. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, "balance": { - "type": "integer", - "description": "The credit balance on the gift card after the amount is subtracted from the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "related_object": { "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "description": "Contains information on how the balance was affected by the transaction.", "properties": { - "id": { + "type": { "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "gift_voucher" }, - "type": { + "total": { + "type": "integer", + "description": "Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "amount": { + "type": "integer", + "description": "The amount being subtracted. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "object": { "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" + "description": "The type of object represented by the JSON.", + "default": "balance" + }, + "balance": { + "type": "integer", + "description": "The credit balance on the gift card after the amount is subtracted from the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "related_object": { + "type": "object", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "type": { + "type": "string", + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" + } + } } } } } } - } - }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of gift voucher transactions." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." - } - } - }, - "1_req_create_gift_card_transactions_export": { - "type": "object", - "title": "Create Gift Card Transactions Export Request Body", - "description": "Request body schema for **POST** `/vouchers/transactions/export`.", - "properties": { - "parameters": { - "$ref": "#/components/schemas/1_obj_export_gift_card_transactions", - "description": "Contains the parameters that define the data to be exported." - } - } - }, - "1_obj_export_gift_card_transactions": { - "description": "List of available fields and filters that can be exported with a gift card transactions export along with the sorting order of the returned data.", - "title": "Export Transactions", - "type": "object", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "-created_at", - "created_at" - ] - }, - "fields": { - "type": "array", - "enum": [ - [ - "id", - "type", - "source_id", - "reason", - "balance", - "amount", - "created_at", - "voucher_id", - "campaign_id", - "source", - "details" - ] - ], - "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
- `CREDITS_ADDITION`
- `CREDITS_REFUND`
- `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |", - "items": { - "type": "string" - } - } - } - }, - "1_obj_export_transactions_object": { - "title": "Export Object", - "type": "object", - "description": "This is an object representing an export. \n\n Using this endpoint, you can export [gift card transactions](ref:list-gift-card-transactions) as a CSV file. This functionality works asynchronously and comes down to the following steps: \n* create an export object and return its `id` so you can track its `status`\n* trigger a CSV file generation, change the status to `SCHEDULED`\n* when the generation is over, store the file in S3 and change the `status` to `DONE`\n* now you can (ref:download-export) it\n\nWith `parameters` you can select which `fields` will be exported. An export request will almost always result in a single file being generated by the system. However, when your volume of data is large, the system may split the results into multiple chunks.", - "properties": { - "id": { - "type": "string", - "description": "Unique export ID.", - "example": "exp_FFfp9o7daWuJqJCKp5xqqli4" - }, - "object": { - "type": "string", - "default": "export", - "description": "The type of object being represented. This object stores information about the `export`." - }, - "created_at": { - "type": "string", - "example": "2022-04-28T11:23:20.922Z", - "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format.", - "format": "date-time" - }, - "status": { - "type": "string", - "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.", - "enum": [ - "SCHEDULED", - "IN_PROGRESS", - "DONE", - "ERROR" - ] - }, - "channel": { - "type": "string", - "description": "The channel through which the export was triggered.", - "default": "API" - }, - "exported_object": { - "type": "string", - "description": "The type of exported object.", - "default": "voucher_transactions" - }, - "parameters": { - "$ref": "#/components/schemas/16_obj_export_gift_card_transactions" - }, - "result": { - "type": "object", - "description": "Contains the URL of the CSV file.", - "properties": { - "url": { - "type": "string", - "description": "URL of the CSV file location. It contains the `token` used for authorization in the [Download export](ref:download-export) method." - } - } - }, - "user_id": { - "type": "string", - "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the `channel` value is `WEBSITE`.", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH" - } - } - }, - "1_req_vouchers_import": { - "title": "Import Vouchers Request Body", - "type": "array", - "description": "Request body schema for **POST** `/vouchers/import`.", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/1_obj_vouchers_import_gift_voucher" }, - { - "$ref": "#/components/schemas/1_obj_vouchers_import_discount_voucher" - } - ] - } - }, - "1_obj_vouchers_import_gift_voucher": { - "title": "Import Gift Voucher", - "type": "object", - "description": "Object model for gift voucher object being imported.", - "properties": { - "code": { - "type": "string", - "description": "Value representing the imported code." - }, - "category": { - "type": "string", - "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the [List Vouchers](ref:list-vouchers) endpoint." - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" - }, - "type": { - "type": "string", - "description": "Represents the voucher type. ", - "default": "GIFT_VOUCHER" - }, - "gift": { - "type": "object", - "properties": { - "amount": { - "type": "string", - "description": "Total gift card income. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + "1_req_create_gift_card_transactions_export": { + "type": "object", + "title": "Create Gift Card Transactions Export Request Body", + "description": "Request body schema for **POST** `/vouchers/transactions/export`.", + "properties": { + "parameters": { + "$ref": "#/components/schemas/1_obj_export_gift_card_transactions", + "description": "Contains the parameters that define the data to be exported." + } } }, - "required": [ - "amount" - ] - }, - "start_date": { - "type": "string", - "description": "Activation timestamp in ISO 8601 format. Voucher is *inactive before* this date. Start date defines when the code starts to be active.\nAllowed date formats are:\n- YYYY-MM-DD\n- YYYY-MM-DDTHH\n- YYYY-MM-DDTHH:mm\n- YYYY-MM-DDTHH:mm:ss\n- YYYY-MM-DDTHH:mm:ssZ\n- YYYY-MM-DDTHH:mm:ss.SSSZ", - "format": "date-time", - "example": "2020-12-28T12:49:16.272Z" - }, - "expiration_date": { - "type": "string", - "description": "Expiration date defines when the code expires. Expiration timestamp in ISO 8601 format. Voucher is *inactive after* this date.\nAllowed date formats are:\n- YYYY-MM-DD\n- YYYY-MM-DDTHH\n- YYYY-MM-DDTHH:mm\n- YYYY-MM-DDTHH:mm:ss\n- YYYY-MM-DDTHH:mm:ssZ\n- YYYY-MM-DDTHH:mm:ss.SSSZ", - "format": "date-time", - "example": "2053-12-28T12:49:16.272Z" - }, - "redemption": { - "type": "object", - "description": "Stores the quantity of redemptions that can be applied to the voucher.", - "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited.", - "example": 10 + "1_obj_export_gift_card_transactions": { + "description": "List of available fields and filters that can be exported with a gift card transactions export along with the sorting order of the returned data.", + "title": "Export Transactions", + "type": "object", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "-created_at", + "created_at" + ] + }, + "fields": { + "type": "array", + "enum": [ + [ + "id", + "type", + "source_id", + "reason", + "balance", + "amount", + "created_at", + "voucher_id", + "campaign_id", + "source", + "details" + ] + ], + "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
- `CREDITS_ADDITION`
- `CREDITS_REFUND`
- `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |", + "items": { + "type": "string" + } + } } - } - }, - "additional_info": { - "type": "string", - "description": "An optional field to keep any extra textual information about the code such as a code description and details." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - } - }, - "required": [ - "code" - ] - }, - "1_obj_vouchers_import_discount_voucher": { - "title": "Import Discount Voucher", - "type": "object", - "description": "Object model for discount voucher object being imported.", - "properties": { - "code": { - "type": "string", - "description": "Value representing the imported code." - }, - "category": { - "type": "string", - "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the [List Vouchers](ref:list-vouchers) endpoint." - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" - }, - "type": { - "type": "string", - "description": "Represents the voucher type.", - "default": "DISCOUNT_VOUCHER" - }, - "discount": { - "anyOf": [ - { - "$ref": "#/components/schemas/1_obj_vouchers_import_discount_amount" - }, - { - "$ref": "#/components/schemas/1_obj_vouchers_import_discount_percentage" - }, - { - "$ref": "#/components/schemas/1_obj_vouchers_import_discount_fixed" - }, - { - "$ref": "#/components/schemas/1_obj_vouchers_import_discount_unit_one" - }, - { - "$ref": "#/components/schemas/1_obj_vouchers_import_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/1_obj_vouchers_import_discount_shipping" + }, + "1_obj_export_transactions_object": { + "title": "Export Object", + "type": "object", + "description": "This is an object representing an export. \n\n Using this endpoint, you can export [gift card transactions](ref:list-gift-card-transactions) as a CSV file. This functionality works asynchronously and comes down to the following steps: \n* create an export object and return its `id` so you can track its `status`\n* trigger a CSV file generation, change the status to `SCHEDULED`\n* when the generation is over, store the file in S3 and change the `status` to `DONE`\n* now you can (ref:download-export) it\n\nWith `parameters` you can select which `fields` will be exported. An export request will almost always result in a single file being generated by the system. However, when your volume of data is large, the system may split the results into multiple chunks.", + "properties": { + "id": { + "type": "string", + "description": "Unique export ID.", + "example": "exp_FFfp9o7daWuJqJCKp5xqqli4" + }, + "object": { + "type": "string", + "default": "export", + "description": "The type of object being represented. This object stores information about the `export`." + }, + "created_at": { + "type": "string", + "example": "2022-04-28T11:23:20.922Z", + "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format.", + "format": "date-time" + }, + "status": { + "type": "string", + "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.", + "enum": [ + "SCHEDULED", + "IN_PROGRESS", + "DONE", + "ERROR" + ] + }, + "channel": { + "type": "string", + "description": "The channel through which the export was triggered.", + "default": "API" + }, + "exported_object": { + "type": "string", + "description": "The type of exported object.", + "default": "voucher_transactions" + }, + "parameters": { + "$ref": "#/components/schemas/16_obj_export_gift_card_transactions" + }, + "result": { + "type": "object", + "description": "Contains the URL of the CSV file.", + "properties": { + "url": { + "type": "string", + "description": "URL of the CSV file location. It contains the `token` used for authorization in the [Download export](ref:download-export) method." + } + } + }, + "user_id": { + "type": "string", + "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the `channel` value is `WEBSITE`.", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH" + } } - ] - }, - "start_date": { - "type": "string", - "description": "Activation timestamp in ISO 8601 format. Voucher is *inactive before* this date. Start date defines when the code starts to be active.\nAllowed formats of dates are:\n- YYYY-MM-DD\n- YYYY-MM-DDTHH\n- YYYY-MM-DDTHH:mm\n- YYYY-MM-DDTHH:mm:ss\n- YYYY-MM-DDTHH:mm:ssZ\n- YYYY-MM-DDTHH:mm:ss.SSSZ", - "format": "date-time", - "example": "2020-12-28T12:49:16.272Z" - }, - "expiration_date": { - "type": "string", - "description": "Expiration date defines when the code expires. Expiration timestamp in ISO 8601 format. Voucher is *inactive after* this date.\nAllowed formats of dates are:\n- YYYY-MM-DD\n- YYYY-MM-DDTHH\n- YYYY-MM-DDTHH:mm\n- YYYY-MM-DDTHH:mm:ss\n- YYYY-MM-DDTHH:mm:ssZ\n- YYYY-MM-DDTHH:mm:ss.SSSZ", - "format": "date-time", - "example": "2053-12-28T12:49:16.272Z" - }, - "redemption": { - "type": "object", - "description": "Stores the quantity of redemptions that can be applied to the voucher.", - "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited.", - "example": 10 + }, + "1_req_vouchers_import": { + "title": "Import Vouchers Request Body", + "type": "array", + "description": "Request body schema for **POST** `/vouchers/import`.", + "items": { + "anyOf": [ + { + "$ref": "#/components/schemas/1_obj_vouchers_import_gift_voucher" + }, + { + "$ref": "#/components/schemas/1_obj_vouchers_import_discount_voucher" + } + ] } - } - }, - "additional_info": { - "type": "string", - "description": "An optional field to keep any extra textual information about the code such as a code description and details." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - } - }, - "required": [ - "code" - ] - }, - "1_req_vouchers_importCSV": { - "type": "object", - "title": "Import Vouchers by CSV Request Body", - "description": "Request body schema for `vouchers/importCSV`.", - "format": "binary", - "properties": { - "file": { - "type": "string", - "format": "binary", - "description": "The property name 'file' will be used for the file path." - } - } - }, - "1_res_vouchers_qualification": { - "title": "Vouchers Qualification Response Body", - "type": "object", - "description": "Response body schema for vouchers/qualification", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. Default is `list`." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of qualified vouchers." - }, - "data": { - "type": "array", - "description": "Array of qualified vouchers.", - "items": { - "allOf": [ - { - "$ref": "#/components/schemas/1_obj_voucher_object" + }, + "1_obj_vouchers_import_gift_voucher": { + "title": "Import Gift Voucher", + "type": "object", + "description": "Object model for gift voucher object being imported.", + "properties": { + "code": { + "type": "string", + "description": "Value representing the imported code." }, - { - "$ref": "#/components/schemas/1_res_obj_vouchers_qualification_applicable_to" + "category": { + "type": "string", + "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the [List Vouchers](ref:list-vouchers) endpoint." }, - { - "$ref": "#/components/schemas/1_res_obj_vouchers_qualification_inapplicable_to" + "active": { + "type": "boolean", + "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" + }, + "type": { + "type": "string", + "description": "Represents the voucher type. ", + "default": "GIFT_VOUCHER" + }, + "gift": { + "type": "object", + "properties": { + "amount": { + "type": "string", + "description": "Total gift card income. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + } + }, + "required": [ + "amount" + ] + }, + "start_date": { + "type": "string", + "description": "Activation timestamp in ISO 8601 format. Voucher is *inactive before* this date. Start date defines when the code starts to be active.\nAllowed date formats are:\n- YYYY-MM-DD\n- YYYY-MM-DDTHH\n- YYYY-MM-DDTHH:mm\n- YYYY-MM-DDTHH:mm:ss\n- YYYY-MM-DDTHH:mm:ssZ\n- YYYY-MM-DDTHH:mm:ss.SSSZ", + "format": "date-time", + "example": "2020-12-28T12:49:16.272Z" + }, + "expiration_date": { + "type": "string", + "description": "Expiration date defines when the code expires. Expiration timestamp in ISO 8601 format. Voucher is *inactive after* this date.\nAllowed date formats are:\n- YYYY-MM-DD\n- YYYY-MM-DDTHH\n- YYYY-MM-DDTHH:mm\n- YYYY-MM-DDTHH:mm:ss\n- YYYY-MM-DDTHH:mm:ssZ\n- YYYY-MM-DDTHH:mm:ss.SSSZ", + "format": "date-time", + "example": "2053-12-28T12:49:16.272Z" + }, + "redemption": { + "type": "object", + "description": "Stores the quantity of redemptions that can be applied to the voucher.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited.", + "example": 10 + } + } + }, + "additional_info": { + "type": "string", + "description": "An optional field to keep any extra textual information about the code such as a code description and details." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." } + }, + "required": [ + "code" ] - } - }, - "total": { - "type": "integer", - "example": 37, - "description": "Total valid and active vouchers matching the qualification criteria in given context. " - }, - "id": { - "type": "string", - "example": "qfl_nAMVLoxIqSLh9O6YmfoAXRPG", - "description": "Unique qualification ID." - }, - "created_at": { - "type": "string", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the qualification was created in ISO 8601 format.", - "format": "date-time" - }, - "tracking_id": { - "type": "string", - "description": "Hashed customer source ID." - } - } - }, - "1_res_obj_vouchers_qualification_applicable_to": { - "title": "ApplicableToObject", - "type": "object", - "description": "", - "properties": { - "applicable_to": { - "$ref": "#/components/schemas/6_res_applicable_to_object" - } - } - }, - "1_res_obj_vouchers_qualification_inapplicable_to": { - "title": "InapplicableToObject", - "type": "object", - "properties": { - "inapplicable_to": { - "$ref": "#/components/schemas/6_res_inapplicable_to_object" - } - } - }, - "1_req_vouchers_bulk_async": { - "title": "Vouchers Bulk Async Request Body", - "type": "array", - "description": "Array of objects each containing the code to be updated and the metadata object containing the key/value pairs to be updated.", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "Unique voucher code." }, - "metadata": { + "1_obj_vouchers_import_discount_voucher": { + "title": "Import Discount Voucher", "type": "object", - "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - } - } - } - }, - "1_req_vouchers_qualification": { - "title": "Vouchers Qualification Request Body", - "type": "object", - "description": "Request body schema for /vouchers/qualification.", - "properties": { - "customer": { - "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_customer" - }, - "order": { - "type": "object", - "description": "Tracks purchase transactions. You can send the order in the request body to check against vouchers requiring specific order validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", - "properties": { - "id": { - "type": "string", - "description": "The ID of an existing order in Voucherify's system that will be linked to the redemption of this request. This ID was assigned by the Voucherify API. You can send the order id in the request body to check against vouchers requiring specific order validation rules to be satisfied.", - "example": "ord_gqj1QYW2j2A1E3Ula2YjdPf4" - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of an integration between multiple systems. It can be an order ID from a CRM system, database or 3rd-party service." - }, - "amount": { - "type": "integer", - "minimum": 0, - "description": "Pre-discount order amount represents the total amount of order items' amounts (sum of each item's `amount` property). You can send the total order amount or the amount of each item individually in the request body to check against vouchers requiring specific total order amount validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order volume_ → _Total amount_ \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "items": { - "type": "array", - "description": "List of Order Items constituting the order. Order items can be defined either by `product_id` or `sku_id`. For every item, you must define the quantity.", - "items": { + "description": "Object model for discount voucher object being imported.", + "properties": { + "code": { + "type": "string", + "description": "Value representing the imported code." + }, + "category": { + "type": "string", + "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the [List Vouchers](ref:list-vouchers) endpoint." + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" + }, + "type": { + "type": "string", + "description": "Represents the voucher type.", + "default": "DISCOUNT_VOUCHER" + }, + "discount": { "anyOf": [ { - "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_product" + "$ref": "#/components/schemas/1_obj_vouchers_import_discount_amount" }, { - "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_sku" + "$ref": "#/components/schemas/1_obj_vouchers_import_discount_percentage" }, { - "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_product_using_product_id" + "$ref": "#/components/schemas/1_obj_vouchers_import_discount_fixed" }, { - "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_product_using_source_id" + "$ref": "#/components/schemas/1_obj_vouchers_import_discount_unit_one" + }, + { + "$ref": "#/components/schemas/1_obj_vouchers_import_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/1_obj_vouchers_import_discount_shipping" } ] + }, + "start_date": { + "type": "string", + "description": "Activation timestamp in ISO 8601 format. Voucher is *inactive before* this date. Start date defines when the code starts to be active.\nAllowed formats of dates are:\n- YYYY-MM-DD\n- YYYY-MM-DDTHH\n- YYYY-MM-DDTHH:mm\n- YYYY-MM-DDTHH:mm:ss\n- YYYY-MM-DDTHH:mm:ssZ\n- YYYY-MM-DDTHH:mm:ss.SSSZ", + "format": "date-time", + "example": "2020-12-28T12:49:16.272Z" + }, + "expiration_date": { + "type": "string", + "description": "Expiration date defines when the code expires. Expiration timestamp in ISO 8601 format. Voucher is *inactive after* this date.\nAllowed formats of dates are:\n- YYYY-MM-DD\n- YYYY-MM-DDTHH\n- YYYY-MM-DDTHH:mm\n- YYYY-MM-DDTHH:mm:ss\n- YYYY-MM-DDTHH:mm:ssZ\n- YYYY-MM-DDTHH:mm:ss.SSSZ", + "format": "date-time", + "example": "2053-12-28T12:49:16.272Z" + }, + "redemption": { + "type": "object", + "description": "Stores the quantity of redemptions that can be applied to the voucher.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited.", + "example": 10 + } + } + }, + "additional_info": { + "type": "string", + "description": "An optional field to keep any extra textual information about the code such as a code description and details." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." } }, - "customer": { - "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_customer" - }, - "referrer": { - "description": "The person who referred the customer to make the order.", - "type": "object" - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order** metadata validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Order metadata satisfy_ or _Basic Builder_ → _Attributes match_ → _ORDER METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." + "required": [ + "code" + ] + }, + "1_req_vouchers_importCSV": { + "type": "object", + "title": "Import Vouchers by CSV Request Body", + "description": "Request body schema for `vouchers/importCSV`.", + "format": "binary", + "properties": { + "file": { + "type": "string", + "format": "binary", + "description": "The property name 'file' will be used for the file path." + } } - } - }, - "reward": { - "type": "object", - "properties": { - "points": { - "type": "integer" - }, - "assignment_id": { - "type": "string" - }, - "id": { - "type": "string" + }, + "1_res_vouchers_qualification": { + "title": "Vouchers Qualification Response Body", + "type": "object", + "description": "Response body schema for vouchers/qualification", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. Default is `list`." + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of qualified vouchers." + }, + "data": { + "type": "array", + "description": "Array of qualified vouchers.", + "items": { + "allOf": [ + { + "$ref": "#/components/schemas/1_obj_voucher_object" + }, + { + "$ref": "#/components/schemas/1_res_obj_vouchers_qualification_applicable_to" + }, + { + "$ref": "#/components/schemas/1_res_obj_vouchers_qualification_inapplicable_to" + } + ] + } + }, + "total": { + "type": "integer", + "example": 37, + "description": "Total valid and active vouchers matching the qualification criteria in given context. " + }, + "id": { + "type": "string", + "example": "qfl_nAMVLoxIqSLh9O6YmfoAXRPG", + "description": "Unique qualification ID." + }, + "created_at": { + "type": "string", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the qualification was created in ISO 8601 format.", + "format": "date-time" + }, + "tracking_id": { + "type": "string", + "description": "Hashed customer source ID." + } } - } - }, - "metadata": { - "type": "object", - "description": "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 qualification runs against rules that are defined through the [Create Validation Rules](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." - } - } - }, - "1_req_obj_vouchers_qualification_customer": { - "title": "Customer Object", - "type": "object", - "description": "This object stores customer details. You can send this object in the request body to check against vouchers requiring specific customer validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](https://docs.voucherify.io/reference/create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Audience_ → _Customer segment_ or _Basic Builder_ → _Customer Activity_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). ", - "properties": { - "id": { - "type": "string", - "description": "The ID of an existing customer that will be linked to the redemption in this request. This ID was assigned by the Voucherify API.", - "example": "cust_J1CDUdbqn5Exva8ASWk1Fq0j" - }, - "source_id": { - "type": "string", - "description": "A unique customer identifier. This is a tracking identifier of a user that is validating a voucher. The `source_id` is built based on your internal id (e.g., email, database ID). If you also pass a customer ID, the source ID will be ignored. Otherwise, if you do not pass a customer ID, the source ID you provide must either be a token, like the one returned in the original voucher validation method done by a specific customer, or a string identifying the customer (e.g., email, database ID, CRM ID).", - "example": "firstname.lastname@mycompany.com" - }, - "name": { - "type": "string", - "description": "First and Last Name. You can send the name in the request body to check against vouchers requiring specific name validation rules to be satisfied.", - "example": "FirstName LastName" - }, - "email": { - "type": "string", - "description": "You can send the email in the request body to check against vouchers requiring specific email validation rules to be satisfied.", - "example": "firstname.lastname@mycompany.com" - }, - "phone": { - "type": "string", - "minLength": 1, - "maxLength": 30, - "pattern": "^[-+.() 0-9]", - "description": "You can send the phone in the request body to check against vouchers requiring specific phone validation rules to be satisfied." - }, - "address": { - "type": "object", - "additionalProperties": false, - "description": "A set of key/value pairs which describes the address. You can send the address in the request body to check against vouchers requiring specific address validation rules to be satisfied.", - "properties": { - "city": { - "type": "string", - "description": "You can send the city in the request body to check against vouchers requiring specific city validation rules to be satisfied.", - "example": "New York" - }, - "country": { - "type": "string", - "description": "You can send the country in the request body to check against vouchers requiring specific country validation rules to be satisfied.", - "example": "United States of America" - }, - "postal_code": { - "type": "string", - "description": "You can send the postal code in the request body to check against vouchers requiring specific postal code validation rules to be satisfied.", - "example": "10001" - }, - "state": { - "type": "string", - "description": "You can send the state in the request body to check against vouchers requiring specific state validation rules to be satisfied.", - "example": "NY" + }, + "1_res_obj_vouchers_qualification_applicable_to": { + "title": "ApplicableToObject", + "type": "object", + "description": "", + "properties": { + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" + } } - } - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **customer** metadata validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Audience_ → _Customer metadata satisfy_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "birthdate": { - "type": "string", - "example": "2022-01-01", - "format": "date", - "description": "You can send the birthdate in the request body to check against vouchers requiring specific birthdate validation rules to be satisfied." - } - } - }, - "1_req_obj_vouchers_qualification_product": { - "title": "Product Item", - "type": "object", - "description": "Schema model for a product item. You can send this object in the request body to check against vouchers requiring specific product validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", - "properties": { - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system. __Requires__ the `related_object` property to be defined. \n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on Source Id filters_ . [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", - "example": "product_1234" - }, - "product_id": { - "type": "string", - "description": "A unique identifier that represents the product and is assigned by Voucherify.", - "example": "prod_0a9f9aeddb019a42db" - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`). You can send the total item amount to check against vouchers requiring specific order amount validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order volume_ → _Total amount_. The qualification adds the individual amounts of the items and checks whether the sum meets the limits set by the _Total amount_. Additionally, another rule checked is one that is defined in _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Subtotal of matched items_. \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.\n", - "example": 10000 - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart. \n\nThe qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. Another validation rule against which the qualification does the checks is defined in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Quantity of matched items_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", - "example": 1 - }, - "price": { - "type": "integer", - "description": "Unit price of an item. [This is not true in the case of using sourceid what was the case that this happened.]This `price` property takes precedence. If you provide a value at this level, then a price property defined once again in the `related_object` will be ignored. If this property will not be defined here, then the `price` property in the `related_object` will be used in the qualification.\n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Unit Price of any matching order line_ and also _Order Volume_ → _Price of each item/Price of any item_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).\n\n Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order line item** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Metadata of matched items_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "related_object": { - "type": "string", - "enum": [ - "product" - ], - "description": "A reference to the object containing details of the related product. __Required__ when sending `source_id` in payload." - }, - "product": { - "type": "object", - "description": "An object containing details of the related product. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", - "properties": { - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "product_1234" - }, - "name": { - "type": "string", - "description": "Product name.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on name filters_.", - "example": "Phone" - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - } - } - } - } - }, - "1_req_obj_vouchers_qualification_product_using_product_id": { - "title": "Product Item using product_id", - "type": "object", - "description": "Schema model for a product item sent using the `product_id`. \n\nYou can send this object in the request body to check against vouchers requiring specific product validation rules to be satisfied. \nThe qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", - "properties": { - "product_id": { - "type": "string", - "description": "A unique identifier that represents the product and is assigned by Voucherify.", - "example": "prod_0a9f9aeddb019a42db" - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`). You can send the total item amount to check against vouchers requiring specific order amount validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order volume_ → _Total amount_. The qualification adds the individual amounts of the items and checks whether the sum meets the limits set by the _Total amount_. Additionally, another rule checked is one that is defined in _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Subtotal of matched items_. \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.\n", - "example": 10000 - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart. \n\nThe qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. Another validation rule against which the qualification does the checks is defined in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Quantity of matched items_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", - "example": 1 - }, - "price": { - "type": "integer", - "description": "Unit price of an item. [This is not true in the case of using sourceid what was the case that this happened.]This `price` property takes precedence. If you provide a value at this level, then a price property defined once again in the `related_object` will be ignored. If this property will not be defined here, then the `price` property in the `related_object` will be used in the qualification.\n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Unit Price of any matching order line_ and also _Order Volume_ → _Price of each item/Price of any item_. Even if this price is explicitly provided, it will not override the `price` when running qualifications against _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select/create a product collection filtered by a Price_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).\n\n Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order line item** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Metadata of matched items_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "product": { - "type": "object", - "description": "An object containing details of the related product. These details will be used for qualification on top of details already stored in the system.", - "properties": { - "name": { - "type": "string", - "description": "Product name.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on name filters_.", - "example": "Phone" - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - } - } - } - } - }, - "1_req_obj_vouchers_qualification_product_using_source_id": { - "title": "Product Item using source_id", - "type": "object", - "description": "Schema model for a product item. You can send this object in the request body to check against vouchers requiring specific product validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", - "properties": { - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system. __Requires__ the `related_object` property to be defined. \n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on Source Id filters_ . [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", - "example": "product_1234" - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`). You can send the total item amount to check against vouchers requiring specific order amount validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order volume_ → _Total amount_. The qualification adds the individual amounts of the items and checks whether the sum meets the limits set by the _Total amount_. Additionally, another rule checked is one that is defined in _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Subtotal of matched items_. \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.\n", - "example": 10000 - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart. \n\nThe qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. Another validation rule against which the qualification does the checks is defined in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Quantity of matched items_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", - "example": 1 - }, - "price": { - "type": "integer", - "description": "Unit price of an item. [This is not true in the case of using sourceid what was the case that this happened.]This `price` property takes precedence. If you provide a value at this level, then a price property defined once again in the `related_object` will be ignored. If this property will not be defined here, then the `price` property in the `related_object` will be used in the qualification.\n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Unit Price of any matching order line_ and also _Order Volume_ → _Price of each item/Price of any item_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).\n\n Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order line item** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Metadata of matched items_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "related_object": { - "type": "string", - "enum": [ - "product" - ], - "description": "A reference to the object containing details of the related product. __Required__ when sending `source_id` in payload." - }, - "product": { - "type": "object", - "description": "An object containing details of the related product. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", - "properties": { - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "product_1234" - }, - "name": { - "type": "string", - "description": "Product name.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on name filters_.", - "example": "Phone" - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - } - } - } - }, - "required": [ - "source_id", - "related_object" - ] - }, - "1_req_obj_vouchers_qualification_product-copy-2-use-for-other-objects-as-reference": { - "title": "Product Item", - "type": "object", - "description": "Schema model for a product item. You can send this object in the request body to check against vouchers requiring specific product validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", - "properties": { - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system. __Requires__ the `related_object` property to be defined. \n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on Source Id filters_ . [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", - "example": "product_1234" - }, - "product_id": { - "type": "string", - "description": "A unique identifier that represents the product and is assigned by Voucherify.", - "example": "prod_0a9f9aeddb019a42db" - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`). You can send the total item amount to check against vouchers requiring specific order amount validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order volume_ → _Total amount_. The qualification adds the individual amounts of the items and checks whether the sum meets the limits set by the _Total amount_. Additionally, another rule checked is one that is defined in _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Subtotal of matched items_. \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.\n", - "example": 10000 - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart. \n\nThe qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. Another validation rule against which the qualification does the checks is defined in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Quantity of matched items_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", - "example": 1 - }, - "price": { - "type": "integer", - "description": "Unit price of an item. [This is not true in the case of using sourceid what was the case that this happened.]This `price` property takes precedence. If you provide a value at this level, then a price property defined once again in the `related_object` will be ignored. If this property will not be defined here, then the `price` property in the `related_object` will be used in the qualification.\n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Unit Price of any matching order line_ and also _Order Volume_ → _Price of each item/Price of any item_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).\n\n Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order line item** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Metadata of matched items_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "related_object": { - "type": "string", - "enum": [ - "product" - ], - "description": "A reference to the object containing details of the related product. __Required__ when sending `source_id` in payload." - }, - "product": { - "type": [ - "object", - "null" - ], - "description": "An object containing details of the related product. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", - "properties": { - "source_id": { - "type": [ - "string", - "null" - ], - "description": "A unique product identifier from your inventory system.", - "example": "product_1234" - }, - "name": { - "type": [ - "string", - "null" - ], - "description": "Product name.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on name filters_.", - "example": "Phone" - }, - "price": { - "type": [ - "integer", - "null" - ], - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { - "type": [ - "object", - "null" - ], - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "override": { - "type": [ - "boolean", - "null" - ], - "description": "The override is used to store the product in the system. If product does not exist, it will be created with the use of `source_id`." - } - } - } - } - }, - "1_req_obj_vouchers_qualification_sku": { - "title": "SKU Item", - "type": "object", - "description": "Schema model for a SKU item.", - "properties": { - "source_id": { - "type": "string", - "description": "A unique sku identifier from your inventory system. __Requires__ the `related_object` property to be defined. \n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on Source Id filters_ . [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", - "example": "product_1234" - }, - "sku_id": { - "type": "string", - "example": "sku_0a41e31c7b41c28358", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "amount": { - "type": "integer", - "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item.[I'm not sure what this means here, it's from the original docs]", - "example": 10000 - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart. The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", - "example": 1 - }, - "related_object": { - "type": "string", - "enum": [ - "product", - "sku" - ], - "description": "A reference to the object containing details of the related product/sku. __Required__ when sending `source_id` in payload." - }, - "product": { - "type": "object", - "description": "An object containing details of the related product. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", - "properties": { - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "product_1234" - }, - "name": { - "type": "string", - "description": "Product name.", - "example": "Phone" - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "1_res_obj_vouchers_qualification_inapplicable_to": { + "title": "InapplicableToObject", + "type": "object", + "properties": { + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" + } } - } - }, - "sku": { - "type": "object", - "description": "An object containing details of the related SKU. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", - "properties": { - "source_id": { - "type": "string", - "description": "A unique SKU identifier from your inventory system.", - "example": "sku_1234" - }, - "sku": { - "type": "string", - "description": "SKU name.", - "example": "iPhone 12" - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { + }, + "1_req_vouchers_bulk_async": { + "title": "Vouchers Bulk Async Request Body", + "type": "array", + "description": "Array of objects each containing the code to be updated and the metadata object containing the key/value pairs to be updated.", + "items": { "type": "object", - "description": "A set of custom key/value pairs that you can attach to a SKU." - } - } - } - } - }, - "1_req_obj_vouchers_qualification_sku-copy-2_forfuturereference": { - "title": "SKU Item", - "type": "object", - "description": "Schema model for a SKU item.", - "properties": { - "source_id": { - "type": [ - "string", - "null" - ], - "description": "A unique sku identifier from your inventory system. __Requires__ the `related_object` property to be defined. \n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on Source Id filters_ . [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", - "example": "product_1234" - }, - "sku_id": { - "type": [ - "string", - "null" - ], - "example": "sku_0a41e31c7b41c28358", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "amount": { - "type": [ - "integer", - "null" - ], - "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item.[I'm not sure what this means here, it's from the original docs]", - "example": 10000 - }, - "quantity": { - "type": [ - "integer", - "null" - ], - "description": "Quantity of the item in the cart. The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", - "example": 1 - }, - "related_object": { - "type": [ - "string", - "null" - ], - "enum": [ - "product", - "sku" - ], - "description": "A reference to the object containing details of the related product/sku. __Required__ when sending `source_id` in payload." - }, - "product": { - "type": [ - "object", - "null" - ], - "description": "An object containing details of the related product. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", - "properties": { - "source_id": { - "type": [ - "string", - "null" - ], - "description": "A unique product identifier from your inventory system.", - "example": "product_1234" - }, - "name": { - "type": [ - "string", - "null" - ], - "description": "Product name.", - "example": "Phone" - }, - "price": { - "type": [ - "integer", - "null" - ], - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { - "type": [ - "object", - "null" - ], - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "override": { - "type": [ - "boolean", - "null" - ], - "description": "The override is used to store the product in the system. If the product does not exist, it will be created with the use of `source_id`." - } - } - }, - "sku": { - "type": [ - "object", - "null" - ], - "description": "An object containing details of the related SKU. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", - "properties": { - "source_id": { - "type": [ - "string", - "null" - ], - "description": "A unique SKU identifier from your inventory system.", - "example": "sku_1234" - }, - "sku": { - "type": [ - "string", - "null" - ], - "description": "SKU name.", - "example": "iPhone 12" - }, - "price": { - "type": [ - "integer", - "null" - ], - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { - "type": [ - "object", - "null" - ], - "description": "A set of custom key/value pairs that you can attach to a SKU." - }, - "override": { - "type": [ - "boolean", - "null" - ], - "description": "The override is used once the product should be stored in system. If sku does not exist, it will be created with the use of `source_id`. If a SKU does not exist, it's required to set `product_id` that it belongs to." - } - } - } - } - }, - "1_req_obj_vouchers_qualification_sku-copy": { - "title": "SKU Item", - "type": "object", - "description": "Schema model for a SKU item.", - "properties": { - "id": { - "type": [ - "string", - "null" - ] - }, - "source_id": { - "type": [ - "string", - "null" - ], - "description": "The merchant’s product/SKU ID (if it is different from the Voucherify product/SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce, a database or a 3rd-party service." - }, - "product_id": { - "type": [ - "string", - "null" - ] - }, - "related_object": { - "type": [ - "string", - "null" - ], - "enum": [ - "product", - "sku" - ] - }, - "amount": { - "type": [ - "integer", - "null" - ], - "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item.[I'm not sure what this means here, it's from the original docs]" - }, - "quantity": { - "type": [ - "integer", - "null" - ], - "description": "Quantity of the item in the cart." - }, - "price": { - "type": [ - "integer", - "null" - ], - "description": "Unit price of an item" - }, - "sku": { - "type": [ - "object", - "null" - ], - "description": "An object containing details of the related SKU. These details will be used for validation and redemption processes on top of details already stored in the system.", - "properties": { - "id": { - "type": [ - "string", - "null" - ] - }, - "source_id": { - "type": [ - "string", - "null" - ] - }, - "sku": { - "type": [ - "string", - "null" - ] - }, - "price": { - "type": [ - "integer", - "null" - ] - }, - "metadata": { - "type": [ - "object", - "null" - ] - }, - "override": { - "type": [ - "boolean", - "null" - ], - "description": "The override is used once the product should be stored in system. If sku does not exist it will be created with the use of `source_id`. If sku does not exists it's required to set `product_id` that it belongs to." - } - } - } - } - }, - "1_req_vouchers_qualification_copy_for_reverting_changes": { - "title": "Vouchers Qualification Request Body", - "type": "object", - "description": "Request body schema for /vouchers/qualification.", - "properties": { - "customer": { - "type": [ - "object", - "null" - ], - "description": "This object stores customer details. You can send this object in the request body to check against vouchers requiring specific customer validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Audience_ → _Customer segment_ or _Basic Builder_ → _Customer Activity_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). ", - "properties": { - "id": { - "type": "string", - "description": "The ID of an existing customer that will be linked to the redemption in this request. This ID was assigned by the Voucherify API.", - "example": "cust_J1CDUdbqn5Exva8ASWk1Fq0j" - }, - "source_id": { - "type": [ - "string", - "null" - ], - "description": "A unique customer identifier. This is a tracking identifier of a user that is validating a voucher. The `source_id` is built based on your internal id (e.g., email, database ID). If you also pass a customer ID, the source ID will be ignored. Otherwise, if you do not pass a customer ID, the source ID you provide must either be a token, like the one returned in the original voucher validation method done by a specific customer, or a string identifying the customer (e.g., email, database ID, CRM ID).", - "example": "firstname.lastname@mycompany.com" - }, - "name": { - "type": [ - "string", - "null" - ], - "description": "First and Last Name. You can send the name in the request body to check against vouchers requiring specific name validation rules to be satisfied.", - "example": "FirstName LastName" - }, - "email": { - "type": [ - "string", - "null" - ], - "description": "You can send the email in the request body to check against vouchers requiring specific email validation rules to be satisfied.", - "example": "firstname.lastname@mycompany.com" - }, - "phone": { - "type": [ - "string", - "null" - ], - "minLength": 1, - "maxLength": 30, - "pattern": "^[-+.() 0-9]", - "description": "You can send the phone in the request body to check against vouchers requiring specific phone validation rules to be satisfied." - }, - "address": { - "type": [ - "object", - "null" - ], - "additionalProperties": false, - "description": "A set of key/value pairs which describes the address. You can send the address in the request body to check against vouchers requiring specific address validation rules to be satisfied.", "properties": { - "city": { - "type": [ - "string", - "null" - ], - "description": "You can send the city in the request body to check against vouchers requiring specific city validation rules to be satisfied.", - "example": "New York" - }, - "country": { - "type": [ - "string", - "null" - ], - "description": "You can send the country in the request body to check against vouchers requiring specific country validation rules to be satisfied.", - "example": "United States of America" - }, - "postal_code": { - "type": [ - "string", - "null" - ], - "description": "You can send the postal code in the request body to check against vouchers requiring specific postal code validation rules to be satisfied.", - "example": "10001" + "code": { + "type": "string", + "description": "Unique voucher code." }, - "state": { - "type": [ - "string", - "null" - ], - "description": "You can send the state in the request body to check against vouchers requiring specific state validation rules to be satisfied.", - "example": "NY" + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." } } - }, - "metadata": { - "type": [ - "object", - "null" - ], - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **customer** metadata validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Audience_ → _Customer metadata satisfy_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "birthdate": { - "type": [ - "string", - "null" - ], - "format": "date", - "description": "You can send the birthdate in the request body to check against vouchers requiring specific birthdate validation rules to be satisfied, i.e. `YYYY-MM-DD`." } - } - }, - "order": { - "type": [ - "object", - "null" - ], - "description": "Tracks purchase transactions. You can send the order in the request body to check against vouchers requiring specific order validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", - "properties": { - "id": { - "type": [ - "string", - "null" - ], - "description": "The ID of an existing order in Voucherify's system that will be linked to the redemption of this request. This ID was assigned by the Voucherify API. You can send the order id in the request body to check against vouchers requiring specific order validation rules to be satisfied.", - "example": "ord_gqj1QYW2j2A1E3Ula2YjdPf4" - }, - "source_id": { - "type": [ - "string", - "null" - ], - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of an integration between multiple systems. It can be an order ID from a CRM system, database or 3rd-party service." - }, - "amount": { - "type": [ - "integer", - "null" - ], - "minimum": 0, - "description": "Pre-discount order amount represents the total amount of order items' amounts (sum of each item's `amount` property). You can send the amount in the request body to check against vouchers requiring specific order amount validation rules to be satisfied. \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "items": { - "type": "array", - "description": "List of Order Items constituting the order. Order items can be defined either by `product_id` or `sku_id`. For every item, you must define the quantity. Read more about the [order item object] (hyperlink the Order Item Object).\n", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_product" + }, + "1_req_vouchers_qualification": { + "title": "Vouchers Qualification Request Body", + "type": "object", + "description": "Request body schema for /vouchers/qualification.", + "properties": { + "customer": { + "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_customer" + }, + "order": { + "type": "object", + "description": "Tracks purchase transactions. You can send the order in the request body to check against vouchers requiring specific order validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", + "properties": { + "id": { + "type": "string", + "description": "The ID of an existing order in Voucherify's system that will be linked to the redemption of this request. This ID was assigned by the Voucherify API. You can send the order id in the request body to check against vouchers requiring specific order validation rules to be satisfied.", + "example": "ord_gqj1QYW2j2A1E3Ula2YjdPf4" }, - { - "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_sku" + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of an integration between multiple systems. It can be an order ID from a CRM system, database or 3rd-party service." + }, + "amount": { + "type": "integer", + "minimum": 0, + "description": "Pre-discount order amount represents the total amount of order items' amounts (sum of each item's `amount` property). You can send the total order amount or the amount of each item individually in the request body to check against vouchers requiring specific total order amount validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order volume_ → _Total amount_ \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "items": { + "type": "array", + "description": "List of Order Items constituting the order. Order items can be defined either by `product_id` or `sku_id`. For every item, you must define the quantity.", + "items": { + "anyOf": [ + { + "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_product" + }, + { + "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_sku" + }, + { + "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_product_using_product_id" + }, + { + "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_product_using_source_id" + } + ] + } + }, + "customer": { + "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_customer" + }, + "referrer": { + "description": "The person who referred the customer to make the order.", + "type": "object" + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order** metadata validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Order metadata satisfy_ or _Basic Builder_ → _Attributes match_ → _ORDER METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." } - ] + } + }, + "reward": { + "type": "object", + "properties": { + "points": { + "type": "integer" + }, + "assignment_id": { + "type": "string" + }, + "id": { + "type": "string" + } + } + }, + "metadata": { + "type": "object", + "description": "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 qualification runs against rules that are defined through the [Create Validation Rules](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." } - }, - "customer": { - "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_customer" - }, - "referrer": { - "description": "The person who referred the customer to make the order.", - "type": [ - "object", - "null" - ] - }, - "metadata": { - "type": [ - "string", - "null" - ], - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order** metadata validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Order metadata satisfy_ or _Basic Builder_ → _Attributes match_ → _ORDER METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - } - } - }, - "reward": { - "type": [ - "object", - "null" - ], - "properties": { - "points": { - "type": [ - "number", - "null" - ] - }, - "assignment_id": { - "type": [ - "string", - "null" - ] - }, - "id": { - "type": [ - "string", - "null" - ] } - } - }, - "metadata": { - "type": [ - "object", - "null" - ], - "description": "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 qualification runs against rules that are defined through the [Create Validation Rules](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." - } - } - }, - "1_req_obj_vouchers_qualification_product-copy": { - "title": "Product Item", - "type": "object", - "description": "Schema model for a product item.", - "properties": { - "id": { - "type": [ - "string", - "null" - ] - }, - "source_id": { - "type": [ - "string", - "null" - ], - "description": "Product/SKU reference ID" - }, - "product_id": { - "type": [ - "string", - "null" - ] - }, - "sku_id": { - "type": [ - "string", - "null" - ] - }, - "related_object": { - "type": [ - "string", - "null" - ], - "enum": [ - "product", - "sku" - ] - }, - "amount": { - "type": [ - "integer", - "null" - ], - "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item." - }, - "quantity": { - "type": [ - "integer", - "null" - ], - "description": "Quantity of the item in the cart." - }, - "price": { - "type": [ - "integer", - "null" - ], - "description": "Unit price of an item" - }, - "product": { - "type": [ - "object", - "null" - ], - "description": "An object containing details of the related product. These details will be used for validation and redemption processes on top of details already stored in the system.", - "properties": { - "id": { - "type": [ - "string", - "null" - ] - }, - "source_id": { - "type": [ - "string", - "null" - ] - }, - "name": { - "type": [ - "string", - "null" - ] - }, - "price": { - "type": [ - "integer", - "null" - ] - }, - "metadata": { - "type": [ - "object", - "null" - ] - }, - "override": { - "type": [ - "boolean", - "null" - ] + }, + "1_req_obj_vouchers_qualification_customer": { + "title": "Customer Object", + "type": "object", + "description": "This object stores customer details. You can send this object in the request body to check against vouchers requiring specific customer validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](https://docs.voucherify.io/reference/create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Audience_ → _Customer segment_ or _Basic Builder_ → _Customer Activity_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). ", + "properties": { + "id": { + "type": "string", + "description": "The ID of an existing customer that will be linked to the redemption in this request. This ID was assigned by the Voucherify API.", + "example": "cust_J1CDUdbqn5Exva8ASWk1Fq0j" + }, + "source_id": { + "type": "string", + "description": "A unique customer identifier. This is a tracking identifier of a user that is validating a voucher. The `source_id` is built based on your internal id (e.g., email, database ID). If you also pass a customer ID, the source ID will be ignored. Otherwise, if you do not pass a customer ID, the source ID you provide must either be a token, like the one returned in the original voucher validation method done by a specific customer, or a string identifying the customer (e.g., email, database ID, CRM ID).", + "example": "firstname.lastname@mycompany.com" + }, + "name": { + "type": "string", + "description": "First and Last Name. You can send the name in the request body to check against vouchers requiring specific name validation rules to be satisfied.", + "example": "FirstName LastName" + }, + "email": { + "type": "string", + "description": "You can send the email in the request body to check against vouchers requiring specific email validation rules to be satisfied.", + "example": "firstname.lastname@mycompany.com" + }, + "phone": { + "type": "string", + "minLength": 1, + "maxLength": 30, + "pattern": "^[-+.() 0-9]", + "description": "You can send the phone in the request body to check against vouchers requiring specific phone validation rules to be satisfied." + }, + "address": { + "type": "object", + "additionalProperties": false, + "description": "A set of key/value pairs which describes the address. You can send the address in the request body to check against vouchers requiring specific address validation rules to be satisfied.", + "properties": { + "city": { + "type": "string", + "description": "You can send the city in the request body to check against vouchers requiring specific city validation rules to be satisfied.", + "example": "New York" + }, + "country": { + "type": "string", + "description": "You can send the country in the request body to check against vouchers requiring specific country validation rules to be satisfied.", + "example": "United States of America" + }, + "postal_code": { + "type": "string", + "description": "You can send the postal code in the request body to check against vouchers requiring specific postal code validation rules to be satisfied.", + "example": "10001" + }, + "state": { + "type": "string", + "description": "You can send the state in the request body to check against vouchers requiring specific state validation rules to be satisfied.", + "example": "NY" + } + } + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **customer** metadata validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Audience_ → _Customer metadata satisfy_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "birthdate": { + "type": "string", + "example": "2022-01-01", + "format": "date", + "description": "You can send the birthdate in the request body to check against vouchers requiring specific birthdate validation rules to be satisfied." + } } - } - }, - "sku": { - "type": [ - "object", - "null" - ], - "description": "An object containing details of the related SKU. These details will be used for validation and redemption processes on top of details already stored in the system.", - "properties": { - "id": { - "type": [ - "string", - "null" - ] - }, - "source_id": { - "type": [ - "string", - "null" - ] - }, - "sku": { - "type": [ - "string", - "null" - ] - }, - "price": { - "type": [ - "string", - "null" - ] - }, - "metadata": { - "type": [ - "object", - "null" - ] - }, - "override": { - "type": [ - "boolean", - "null" - ], - "description": "The override is used once the product should be stored in system. If sku does not exists it will be created with the use of `source_id`. If sku does not exists it's required to set `product_id` that it belongs to." + }, + "1_req_obj_vouchers_qualification_product": { + "title": "Product Item", + "type": "object", + "description": "Schema model for a product item. You can send this object in the request body to check against vouchers requiring specific product validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", + "properties": { + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system. __Requires__ the `related_object` property to be defined. \n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on Source Id filters_ . [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", + "example": "product_1234" + }, + "product_id": { + "type": "string", + "description": "A unique identifier that represents the product and is assigned by Voucherify.", + "example": "prod_0a9f9aeddb019a42db" + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`). You can send the total item amount to check against vouchers requiring specific order amount validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order volume_ → _Total amount_. The qualification adds the individual amounts of the items and checks whether the sum meets the limits set by the _Total amount_. Additionally, another rule checked is one that is defined in _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Subtotal of matched items_. \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.\n", + "example": 10000 + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart. \n\nThe qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. Another validation rule against which the qualification does the checks is defined in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Quantity of matched items_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", + "example": 1 + }, + "price": { + "type": "integer", + "description": "Unit price of an item. [This is not true in the case of using sourceid what was the case that this happened.]This `price` property takes precedence. If you provide a value at this level, then a price property defined once again in the `related_object` will be ignored. If this property will not be defined here, then the `price` property in the `related_object` will be used in the qualification.\n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Unit Price of any matching order line_ and also _Order Volume_ → _Price of each item/Price of any item_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).\n\n Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order line item** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Metadata of matched items_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "related_object": { + "type": "string", + "enum": [ + "product" + ], + "description": "A reference to the object containing details of the related product. __Required__ when sending `source_id` in payload." + }, + "product": { + "type": "object", + "description": "An object containing details of the related product. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", + "properties": { + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "product_1234" + }, + "name": { + "type": "string", + "description": "Product name.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on name filters_.", + "example": "Phone" + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." + } + } + } } - } - } - } - }, - "1_req_vouchers_qualification-prepforcampaignqualification": { - "title": "RequestBodyVouchersQualification", - "type": "object", - "description": "Request body schema for /vouchers/qualification.", - "properties": { - "customer": { - "type": [ - "object", - "null" - ], - "description": "This object stores customer details.", - "properties": { - "id": { - "type": "string", - "description": "The ID of an existing customer that will be linked to the redemption in this request. Assigned by the Voucherify API, identifies the customer.", - "example": "cust_J1CDUdbqn5Exva8ASWk1Fq0j" - }, - "source_id": { - "type": [ - "string", - "null" - ], - "description": "A unique customer identifier. You can provide your own (e.g. CRM id) or use the one returned by Voucherify, see tracking_id from Validate Voucher (client-side). A tracking identifier of a user that validate a voucher. It is build based on your internal id (e.g., email, database ID). If you also pass a customer ID, the source ID will be ignored. Otherwise, if you do not pass a customer ID, the source ID you provide must either be a token, like the ones returned in origin voucher validation method done by specific customer, or a string identifying customer (e.g., email, database ID, CRM ID)." - }, - "name": { - "type": [ - "string", - "null" - ], - "description": "First and Last Name" - }, - "email": { - "type": [ - "string", - "null" - ] - }, - "phone": { - "type": [ - "string", - "null" - ], - "minLength": 1, - "maxLength": 30, - "pattern": "^[-+.() 0-9]" - }, - "address": { - "type": [ - "object", - "null" - ], - "additionalProperties": false, - "description": "A set of key/value pairs which describes the address.", - "properties": { - "city": { - "type": [ - "string", - "null" - ] - }, - "country": { - "type": [ - "string", - "null" - ] - }, - "postal_code": { - "type": [ - "string", - "null" - ] - }, - "state": { - "type": [ - "string", - "null" - ] + }, + "1_req_obj_vouchers_qualification_product_using_product_id": { + "title": "Product Item using product_id", + "type": "object", + "description": "Schema model for a product item sent using the `product_id`. \n\nYou can send this object in the request body to check against vouchers requiring specific product validation rules to be satisfied. \nThe qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", + "properties": { + "product_id": { + "type": "string", + "description": "A unique identifier that represents the product and is assigned by Voucherify.", + "example": "prod_0a9f9aeddb019a42db" + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`). You can send the total item amount to check against vouchers requiring specific order amount validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order volume_ → _Total amount_. The qualification adds the individual amounts of the items and checks whether the sum meets the limits set by the _Total amount_. Additionally, another rule checked is one that is defined in _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Subtotal of matched items_. \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.\n", + "example": 10000 + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart. \n\nThe qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. Another validation rule against which the qualification does the checks is defined in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Quantity of matched items_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", + "example": 1 + }, + "price": { + "type": "integer", + "description": "Unit price of an item. [This is not true in the case of using sourceid what was the case that this happened.]This `price` property takes precedence. If you provide a value at this level, then a price property defined once again in the `related_object` will be ignored. If this property will not be defined here, then the `price` property in the `related_object` will be used in the qualification.\n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Unit Price of any matching order line_ and also _Order Volume_ → _Price of each item/Price of any item_. Even if this price is explicitly provided, it will not override the `price` when running qualifications against _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select/create a product collection filtered by a Price_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).\n\n Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order line item** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Metadata of matched items_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "product": { + "type": "object", + "description": "An object containing details of the related product. These details will be used for qualification on top of details already stored in the system.", + "properties": { + "name": { + "type": "string", + "description": "Product name.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on name filters_.", + "example": "Phone" + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." + } } } - }, - "metadata": { - "type": [ - "object", - "null" - ], - "description": "A set of key/value pairs that you can attach to a customer object for segment building. It can be useful for storing additional information about the customer in a structured format." - }, - "birthdate": { - "type": [ - "string", - "null" - ], - "description": "Customer's birthdate, i.e. `YYYY-MM-DD`.", - "format": "date" } - } - }, - "order": { - "type": [ - "object", - "null" - ], - "description": "Tracks purchase transactions.", - "properties": { - "id": { - "type": [ - "string", - "null" - ], - "description": "The ID of an existing order that will be linked to redemption in this request." - }, - "status": { - "type": [ - "string", - "null" - ], - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULFILLED" - ] - }, - "source_id": { - "type": [ - "string", - "null" - ], - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - }, - "amount": { - "type": [ - "integer", - "null" - ], - "minimum": 0, - "description": "Represents a total amount of order items (sum of item.amount)\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "discount_amount": { - "type": [ - "integer", - "null" - ], - "minimum": 0, - "description": "Summarize all discounts applied to the order inlcuding discounts applied to particular order line items and discounts applied to the whole cart.\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "1_req_obj_vouchers_qualification_product_using_source_id": { + "title": "Product Item using source_id", + "type": "object", + "description": "Schema model for a product item. You can send this object in the request body to check against vouchers requiring specific product validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", + "properties": { + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system. __Requires__ the `related_object` property to be defined. \n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on Source Id filters_ . [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", + "example": "product_1234" + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`). You can send the total item amount to check against vouchers requiring specific order amount validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order volume_ → _Total amount_. The qualification adds the individual amounts of the items and checks whether the sum meets the limits set by the _Total amount_. Additionally, another rule checked is one that is defined in _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Subtotal of matched items_. \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.\n", + "example": 10000 + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart. \n\nThe qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. Another validation rule against which the qualification does the checks is defined in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Quantity of matched items_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", + "example": 1 + }, + "price": { + "type": "integer", + "description": "Unit price of an item. [This is not true in the case of using sourceid what was the case that this happened.]This `price` property takes precedence. If you provide a value at this level, then a price property defined once again in the `related_object` will be ignored. If this property will not be defined here, then the `price` property in the `related_object` will be used in the qualification.\n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Unit Price of any matching order line_ and also _Order Volume_ → _Price of each item/Price of any item_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).\n\n Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order line item** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Metadata of matched items_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "related_object": { + "type": "string", + "enum": [ + "product" + ], + "description": "A reference to the object containing details of the related product. __Required__ when sending `source_id` in payload." + }, + "product": { + "type": "object", + "description": "An object containing details of the related product. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", + "properties": { + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "product_1234" + }, + "name": { + "type": "string", + "description": "Product name.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on name filters_.", + "example": "Phone" + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." + } + } + } }, - "items": { - "type": "array", - "description": "List of Order Items constituting the order. Order items can be defined either by product_id or sku_id. Along with every item you must define quantity.A list of Order Items that have been applied to the order. hyperlink the Order Items to another object.\n", - "items": { + "required": [ + "source_id", + "related_object" + ] + }, + "1_req_obj_vouchers_qualification_product-copy-2-use-for-other-objects-as-reference": { + "title": "Product Item", + "type": "object", + "description": "Schema model for a product item. You can send this object in the request body to check against vouchers requiring specific product validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", + "properties": { + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system. __Requires__ the `related_object` property to be defined. \n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on Source Id filters_ . [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", + "example": "product_1234" + }, + "product_id": { + "type": "string", + "description": "A unique identifier that represents the product and is assigned by Voucherify.", + "example": "prod_0a9f9aeddb019a42db" + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`). You can send the total item amount to check against vouchers requiring specific order amount validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order volume_ → _Total amount_. The qualification adds the individual amounts of the items and checks whether the sum meets the limits set by the _Total amount_. Additionally, another rule checked is one that is defined in _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Subtotal of matched items_. \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.\n", + "example": 10000 + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart. \n\nThe qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. Another validation rule against which the qualification does the checks is defined in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Quantity of matched items_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", + "example": 1 + }, + "price": { + "type": "integer", + "description": "Unit price of an item. [This is not true in the case of using sourceid what was the case that this happened.]This `price` property takes precedence. If you provide a value at this level, then a price property defined once again in the `related_object` will be ignored. If this property will not be defined here, then the `price` property in the `related_object` will be used in the qualification.\n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Unit Price of any matching order line_ and also _Order Volume_ → _Price of each item/Price of any item_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).\n\n Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order line item** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Metadata of matched items_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "related_object": { + "type": "string", + "enum": [ + "product" + ], + "description": "A reference to the object containing details of the related product. __Required__ when sending `source_id` in payload." + }, + "product": { "type": [ "object", "null" ], + "description": "An object containing details of the related product. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", "properties": { - "id": { - "type": [ - "string", - "null" - ] - }, "source_id": { "type": [ "string", "null" ], - "description": "Product/SKU reference ID" + "description": "A unique product identifier from your inventory system.", + "example": "product_1234" }, - "product_id": { + "name": { "type": [ "string", "null" - ] + ], + "description": "Product name.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on name filters_.", + "example": "Phone" }, - "sku_id": { + "price": { "type": [ - "string", + "integer", "null" - ] + ], + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 }, - "related_object": { + "metadata": { "type": [ - "string", + "object", "null" ], - "enum": [ - "product", - "sku" - ], - "description": "Allowed values: `product`, `sku`" + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." }, - "amount": { + "override": { "type": [ - "integer", + "boolean", "null" ], - "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item." + "description": "The override is used to store the product in the system. If product does not exist, it will be created with the use of `source_id`." + } + } + } + } + }, + "1_req_obj_vouchers_qualification_sku": { + "title": "SKU Item", + "type": "object", + "description": "Schema model for a SKU item.", + "properties": { + "source_id": { + "type": "string", + "description": "A unique sku identifier from your inventory system. __Requires__ the `related_object` property to be defined. \n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on Source Id filters_ . [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", + "example": "product_1234" + }, + "sku_id": { + "type": "string", + "example": "sku_0a41e31c7b41c28358", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "amount": { + "type": "integer", + "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item.[I'm not sure what this means here, it's from the original docs]", + "example": 10000 + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart. The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", + "example": 1 + }, + "related_object": { + "type": "string", + "enum": [ + "product", + "sku" + ], + "description": "A reference to the object containing details of the related product/sku. __Required__ when sending `source_id` in payload." + }, + "product": { + "type": "object", + "description": "An object containing details of the related product. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", + "properties": { + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "product_1234" }, - "discount_amount": { + "name": { + "type": "string", + "description": "Product name.", + "example": "Phone" + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." + } + } + }, + "sku": { + "type": "object", + "description": "An object containing details of the related SKU. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", + "properties": { + "source_id": { + "type": "string", + "description": "A unique SKU identifier from your inventory system.", + "example": "sku_1234" + }, + "sku": { + "type": "string", + "description": "SKU name.", + "example": "iPhone 12" + }, + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to a SKU." + } + } + } + } + }, + "1_req_obj_vouchers_qualification_sku-copy-2_forfuturereference": { + "title": "SKU Item", + "type": "object", + "description": "Schema model for a SKU item.", + "properties": { + "source_id": { + "type": [ + "string", + "null" + ], + "description": "A unique sku identifier from your inventory system. __Requires__ the `related_object` property to be defined. \n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on Source Id filters_ . [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", + "example": "product_1234" + }, + "sku_id": { + "type": [ + "string", + "null" + ], + "example": "sku_0a41e31c7b41c28358", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "amount": { + "type": [ + "integer", + "null" + ], + "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item.[I'm not sure what this means here, it's from the original docs]", + "example": 10000 + }, + "quantity": { + "type": [ + "integer", + "null" + ], + "description": "Quantity of the item in the cart. The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", + "example": 1 + }, + "related_object": { + "type": [ + "string", + "null" + ], + "enum": [ + "product", + "sku" + ], + "description": "A reference to the object containing details of the related product/sku. __Required__ when sending `source_id` in payload." + }, + "product": { + "type": [ + "object", + "null" + ], + "description": "An object containing details of the related product. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", + "properties": { + "source_id": { "type": [ - "integer", + "string", "null" ], - "description": "Represents total amount of the discount applied to order line items\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "description": "A unique product identifier from your inventory system.", + "example": "product_1234" }, - "quantity": { + "name": { "type": [ - "integer", + "string", "null" - ] + ], + "description": "Product name.", + "example": "Phone" }, - "discount_quantity": { + "price": { "type": [ "integer", "null" ], - "description": "number of items being discounted\t" + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "metadata": { + "type": [ + "object", + "null" + ], + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "override": { + "type": [ + "boolean", + "null" + ], + "description": "The override is used to store the product in the system. If the product does not exist, it will be created with the use of `source_id`." + } + } + }, + "sku": { + "type": [ + "object", + "null" + ], + "description": "An object containing details of the related SKU. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", + "properties": { + "source_id": { + "type": [ + "string", + "null" + ], + "description": "A unique SKU identifier from your inventory system.", + "example": "sku_1234" + }, + "sku": { + "type": [ + "string", + "null" + ], + "description": "SKU name.", + "example": "iPhone 12" }, "price": { "type": [ "integer", "null" ], - "description": "Unit price of an item" + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 }, - "product": { + "metadata": { "type": [ "object", "null" ], - "description": "An object containing details of related product. Those details will be used for validation and redemption processes on top of details already stored in system.", - "properties": { - "id": { - "type": [ - "string", - "null" - ] - }, - "source_id": { - "type": [ - "string", - "null" - ] - }, - "name": { - "type": [ - "string", - "null" - ] - }, - "price": { - "type": [ - "null", - "integer" - ] - }, - "metadata": { - "type": [ - "object", - "null" - ] - }, - "override": { - "type": [ - "boolean", - "null" - ], - "description": "The `override` is used once the product should be stored in system. If product does not exists it will be created with the use of `source_id`." - } - } + "description": "A set of custom key/value pairs that you can attach to a SKU." }, - "sku": { + "override": { "type": [ - "object", + "boolean", "null" ], - "description": "An object containing details of related SKU. Those details will be used for validation and redemption processes on top of details already stored in system.", - "properties": { - "id": { - "type": [ - "string", - "null" - ] - }, - "source_id": { - "type": [ - "string", - "null" - ] - }, - "sku": { - "type": [ - "string", - "null" - ] - }, - "price": { - "type": [ - "string", - "null" - ] - }, - "metadata": { - "type": [ - "object", - "null" - ] - }, - "override": { - "type": [ - "boolean", - "null" - ], - "description": "The override is used once the product should be stored in system. If sku does not exists it will be created with the use of `source_id`. If sku does not exists it's required to set `product_id` that it belongs to." - } - } + "description": "The override is used once the product should be stored in system. If sku does not exist, it will be created with the use of `source_id`. If a SKU does not exist, it's required to set `product_id` that it belongs to." } } } - }, - "customer": { - "type": [ - "object", - "null" - ], - "description": "The customer used for the order." - }, - "referrer": { - "description": "The person who referred the customer to make the order.", - "type": [ - "object", - "null" - ] - }, - "metadata": { - "type": [ - "string", - "null" - ] - } - } - }, - "reward": { - "type": [ - "object", - "null" - ], - "properties": { - "points": { - "type": [ - "number", - "null" - ] - }, - "assignment_id": { - "type": [ - "string", - "null" - ] - }, - "id": { - "type": [ - "string", - "null" - ] - } - } - }, - "metadata": { - "type": [ - "object", - "null" - ], - "description": "Metadata can be a string, number, boolean, date, datetime, image_url, object, geopoint, unknown. | related objects: campaign, voucher, publication, redemption, product, customer, order, order_item, loyalty_tier, promotion_tier." - } - } - }, - "1_req_vouchers_qualification-copy": { - "title": "RequestBodyVouchersQualification", - "type": "object", - "description": "Request body schema for /vouchers/qualification.", - "properties": { - "customer": { - "type": [ - "object", - "null" - ], - "description": "This object stores customer details.", - "properties": { - "id": { - "type": "string", - "description": "The ID of an existing customer that will be linked to the redemption in this request. Assigned by the Voucherify API, identifies the customer.", - "example": "cust_J1CDUdbqn5Exva8ASWk1Fq0j" - }, - "source_id": { - "type": [ - "string", - "null" - ], - "description": "A unique customer identifier. You can provide your own (e.g. CRM id) or use the one returned by Voucherify, see tracking_id from Validate Voucher (client-side). A tracking identifier of a user that validate a voucher. It is build based on your internal id (e.g., email, database ID). If you also pass a customer ID, the source ID will be ignored. Otherwise, if you do not pass a customer ID, the source ID you provide must either be a token, like the ones returned in origin voucher validation method done by specific customer, or a string identifying customer (e.g., email, database ID, CRM ID)." - }, - "name": { - "type": [ - "string", - "null" - ], - "description": "First and Last Name" - }, - "description": { - "type": [ - "string", - "null" - ], - "description": "An arbitrary string that you can attach to a customer object. It is displayed alongside a customer in the dashboard.\t" - }, - "email": { - "type": [ - "string", - "null" - ] - }, - "phone": { - "type": [ - "string", - "null" - ] - }, - "address": { - "type": [ - "object", - "null" - ], - "additionalProperties": false, - "description": "A set of key/value pairs which describes the address.", - "properties": { - "city": { - "type": [ - "string", - "null" - ] - }, - "country": { - "type": [ - "string", - "null" - ] - }, - "line_1": { - "type": [ - "string", - "null" - ] - }, - "line_2": { - "type": [ - "string", - "null" - ] - }, - "postal_code": { - "type": [ - "string", - "null" - ] - }, - "state": { - "type": [ - "string", - "null" - ] - } - } - }, - "metadata": { - "type": [ - "object", - "null" - ], - "description": "A set of key/value pairs that you can attach to a customer object for segment building. It can be useful for storing additional information about the customer in a structured format." - }, - "email_unsubscribed": { - "type": [ - "boolean", - "null" - ] - }, - "birthday": { - "type": [ - "string", - "null" - ], - "description": "Customer's birthdate.", - "format": "date", - "example": "2022-03-07" - }, - "birthdate": { - "type": [ - "string", - "null" - ], - "description": "Customer's birthdate", - "example": "2022-03-07", - "format": "date" - }, - "customer_landing_page": { - "type": [ - "object", - "null" - ], - "properties": { - "custom_event": { - "type": [ - "object", - "null" - ] - }, - "consents": { - "type": [ - "object", - "null" - ] - }, - "publication_id": { - "type": [ - "string", - "null" - ] - }, - "voucher_code": { - "type": [ - "string", - "null" - ] - } - } - }, - "created_at": { - "type": "string" } - } - }, - "order": { - "type": [ - "object", - "null" - ], - "description": "Tracks purchase transactions.", - "properties": { - "id": { - "type": [ - "string", - "null" - ], - "description": "The ID of an existing order that will be linked to redemption in this request." - }, - "status": { - "type": [ - "string", - "null" - ], - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULFILLED" - ] - }, - "source_id": { - "type": [ - "string", - "null" - ], - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - }, - "amount": { - "type": [ - "integer", - "null" - ], - "minimum": 0, - "description": "Represents a total amount of order items (sum of item.amount)\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "discount_amount": { - "type": [ - "integer", - "null" - ], - "minimum": 0, - "description": "Summarize all discounts applied to the order inlcuding discounts applied to particular order line items and discounts applied to the whole cart.\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "items": { - "type": "array", - "description": "List of Order Items constituting the order. Order items can be defined either by product_id or sku_id. Along with every item you must define quantity.A list of Order Items that have been applied to the order. hyperlink the Order Items to another object.\n", - "items": { + }, + "1_req_obj_vouchers_qualification_sku-copy": { + "title": "SKU Item", + "type": "object", + "description": "Schema model for a SKU item.", + "properties": { + "id": { + "type": [ + "string", + "null" + ] + }, + "source_id": { + "type": [ + "string", + "null" + ], + "description": "The merchant’s product/SKU ID (if it is different from the Voucherify product/SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce, a database or a 3rd-party service." + }, + "product_id": { + "type": [ + "string", + "null" + ] + }, + "related_object": { + "type": [ + "string", + "null" + ], + "enum": [ + "product", + "sku" + ] + }, + "amount": { + "type": [ + "integer", + "null" + ], + "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item.[I'm not sure what this means here, it's from the original docs]" + }, + "quantity": { + "type": [ + "integer", + "null" + ], + "description": "Quantity of the item in the cart." + }, + "price": { + "type": [ + "integer", + "null" + ], + "description": "Unit price of an item" + }, + "sku": { "type": [ "object", "null" ], + "description": "An object containing details of the related SKU. These details will be used for validation and redemption processes on top of details already stored in the system.", "properties": { "id": { "type": [ @@ -6532,56608 +5522,43533 @@ "type": [ "string", "null" - ], - "description": "Product/SKU reference ID" + ] }, - "product_id": { + "sku": { "type": [ "string", "null" ] }, - "sku_id": { + "price": { "type": [ - "string", + "integer", "null" ] }, - "related_object": { + "metadata": { "type": [ - "string", + "object", "null" - ], - "enum": [ - "product", - "sku" - ], - "description": "Allowed values: `product`, `sku`" + ] }, - "amount": { + "override": { "type": [ - "integer", + "boolean", "null" ], - "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item." + "description": "The override is used once the product should be stored in system. If sku does not exist it will be created with the use of `source_id`. If sku does not exists it's required to set `product_id` that it belongs to." + } + } + } + } + }, + "1_req_vouchers_qualification_copy_for_reverting_changes": { + "title": "Vouchers Qualification Request Body", + "type": "object", + "description": "Request body schema for /vouchers/qualification.", + "properties": { + "customer": { + "type": [ + "object", + "null" + ], + "description": "This object stores customer details. You can send this object in the request body to check against vouchers requiring specific customer validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Audience_ → _Customer segment_ or _Basic Builder_ → _Customer Activity_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). ", + "properties": { + "id": { + "type": "string", + "description": "The ID of an existing customer that will be linked to the redemption in this request. This ID was assigned by the Voucherify API.", + "example": "cust_J1CDUdbqn5Exva8ASWk1Fq0j" }, - "discount_amount": { + "source_id": { "type": [ - "integer", + "string", "null" ], - "description": "Represents total amount of the discount applied to order line items\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "description": "A unique customer identifier. This is a tracking identifier of a user that is validating a voucher. The `source_id` is built based on your internal id (e.g., email, database ID). If you also pass a customer ID, the source ID will be ignored. Otherwise, if you do not pass a customer ID, the source ID you provide must either be a token, like the one returned in the original voucher validation method done by a specific customer, or a string identifying the customer (e.g., email, database ID, CRM ID).", + "example": "firstname.lastname@mycompany.com" }, - "quantity": { + "name": { "type": [ - "integer", + "string", "null" - ] + ], + "description": "First and Last Name. You can send the name in the request body to check against vouchers requiring specific name validation rules to be satisfied.", + "example": "FirstName LastName" }, - "discount_quantity": { + "email": { "type": [ - "integer", + "string", "null" ], - "description": "number of items being discounted\t" + "description": "You can send the email in the request body to check against vouchers requiring specific email validation rules to be satisfied.", + "example": "firstname.lastname@mycompany.com" }, - "price": { + "phone": { "type": [ - "integer", + "string", "null" ], - "description": "Unit price of an item" + "minLength": 1, + "maxLength": 30, + "pattern": "^[-+.() 0-9]", + "description": "You can send the phone in the request body to check against vouchers requiring specific phone validation rules to be satisfied." }, - "product": { + "address": { "type": [ "object", "null" ], - "description": "An object containing details of related product. Those details will be used for validation and redemption processes on top of details already stored in system.", + "additionalProperties": false, + "description": "A set of key/value pairs which describes the address. You can send the address in the request body to check against vouchers requiring specific address validation rules to be satisfied.", "properties": { - "id": { + "city": { "type": [ "string", "null" - ] + ], + "description": "You can send the city in the request body to check against vouchers requiring specific city validation rules to be satisfied.", + "example": "New York" }, - "source_id": { + "country": { "type": [ "string", "null" - ] + ], + "description": "You can send the country in the request body to check against vouchers requiring specific country validation rules to be satisfied.", + "example": "United States of America" }, - "name": { + "postal_code": { "type": [ "string", "null" - ] - }, - "price": { - "type": [ - "null", - "integer" - ] - }, - "metadata": { - "type": [ - "object", - "null" - ] + ], + "description": "You can send the postal code in the request body to check against vouchers requiring specific postal code validation rules to be satisfied.", + "example": "10001" }, - "override": { + "state": { "type": [ - "boolean", + "string", "null" ], - "description": "The `override` is used once the product should be stored in system. If product does not exists it will be created with the use of `source_id`." + "description": "You can send the state in the request body to check against vouchers requiring specific state validation rules to be satisfied.", + "example": "NY" } } }, - "sku": { + "metadata": { "type": [ "object", "null" ], - "description": "An object containing details of related SKU. Those details will be used for validation and redemption processes on top of details already stored in system.", - "properties": { - "id": { - "type": [ - "string", - "null" - ] - }, - "source_id": { - "type": [ - "string", - "null" - ] - }, - "sku": { - "type": [ - "string", - "null" - ] - }, - "price": { - "type": [ - "string", - "null" - ] - }, - "metadata": { - "type": [ - "object", - "null" - ] - }, - "override": { - "type": [ - "boolean", - "null" - ], - "description": "The override is used once the product should be stored in system. If sku does not exists it will be created with the use of `source_id`. If sku does not exists it's required to set `product_id` that it belongs to." - } + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **customer** metadata validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Audience_ → _Customer metadata satisfy_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "birthdate": { + "type": [ + "string", + "null" + ], + "format": "date", + "description": "You can send the birthdate in the request body to check against vouchers requiring specific birthdate validation rules to be satisfied, i.e. `YYYY-MM-DD`." + } + } + }, + "order": { + "type": [ + "object", + "null" + ], + "description": "Tracks purchase transactions. You can send the order in the request body to check against vouchers requiring specific order validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", + "properties": { + "id": { + "type": [ + "string", + "null" + ], + "description": "The ID of an existing order in Voucherify's system that will be linked to the redemption of this request. This ID was assigned by the Voucherify API. You can send the order id in the request body to check against vouchers requiring specific order validation rules to be satisfied.", + "example": "ord_gqj1QYW2j2A1E3Ula2YjdPf4" + }, + "source_id": { + "type": [ + "string", + "null" + ], + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of an integration between multiple systems. It can be an order ID from a CRM system, database or 3rd-party service." + }, + "amount": { + "type": [ + "integer", + "null" + ], + "minimum": 0, + "description": "Pre-discount order amount represents the total amount of order items' amounts (sum of each item's `amount` property). You can send the amount in the request body to check against vouchers requiring specific order amount validation rules to be satisfied. \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "items": { + "type": "array", + "description": "List of Order Items constituting the order. Order items can be defined either by `product_id` or `sku_id`. For every item, you must define the quantity. Read more about the [order item object] (hyperlink the Order Item Object).\n", + "items": { + "anyOf": [ + { + "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_product" + }, + { + "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_sku" + } + ] } + }, + "customer": { + "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_customer" + }, + "referrer": { + "description": "The person who referred the customer to make the order.", + "type": [ + "object", + "null" + ] + }, + "metadata": { + "type": [ + "string", + "null" + ], + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order** metadata validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Order metadata satisfy_ or _Basic Builder_ → _Attributes match_ → _ORDER METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." + } + } + }, + "reward": { + "type": [ + "object", + "null" + ], + "properties": { + "points": { + "type": [ + "number", + "null" + ] + }, + "assignment_id": { + "type": [ + "string", + "null" + ] + }, + "id": { + "type": [ + "string", + "null" + ] } } + }, + "metadata": { + "type": [ + "object", + "null" + ], + "description": "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 qualification runs against rules that are defined through the [Create Validation Rules](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." } - }, - "customer": { - "type": [ - "object", - "null" - ], - "description": "The customer used for the order." - }, - "referrer": { - "description": "The person who referred the customer to make the order.", - "type": [ - "object", - "null" - ] - }, - "metadata": { - "type": [ - "string", - "null" - ] } - } - }, - "reward": { - "type": [ - "object", - "null" - ], - "properties": { - "points": { - "type": [ - "number", - "null" - ] - }, - "assignment_id": { - "type": [ - "string", - "null" - ] - }, - "id": { - "type": [ - "string", - "null" - ] - } - } - }, - "metadata": { - "type": [ - "object", - "null" - ], - "description": "Metadata can be a string, number, boolean, date, datetime, image_url, object, geopoint, unknown. | related objects: campaign, voucher, publication, redemption, product, customer, order, order_item, loyalty_tier, promotion_tier." - }, - "gift": { - "type": [ - "object", - "null" - ], - "properties": { - "credits": { - "type": [ - "number", - "null" - ] - } - } - }, - "session": { - "type": [ - "object", - "null" - ], - "properties": { - "key": { - "type": [ - "string", - "null" - ], - "description": "Unique session identifier assigned by the Voucherify API." - }, - "type": { - "type": [ - "string", - "null" - ], - "enum": [ - "COUNT_PER_CUSTOMER", - "ORDER", - "LOCK" - ], - "description": "The type of session. Required to establish a new session. \n\n`LOCK`: Locks the following parameters within the session:\n\n- redemption quantity by 1\n- redemption gift credits specified with the requests\n- redemption loyalty points specified with the request" - }, - "ttl": { - "type": [ - "number", - "null" - ], - "description": "Value for the period of time that the session is active. Units for this parameter are defined by `session.ttl_unit`." - }, - "ttl_unit": { - "type": [ - "string", - "null" - ], - "enum": [ - "DAYS", - "HOURS", - "MICROSECONDS", - "MILLISECONDS", - "MINUTES", - "NANOSECONDS", - "SECONDS" - ], - "description": "Defines the type of unit in which the session time is counted." - } - } - }, - "tracking_id": { - "type": [ - "string", - "null" - ], - "maxLength": 2500, - "example": "track_fxEMFisanb7t4l96X8WKcemyGNPnHpGM3KTfUsqZGCOx/p57/J2+Yw==", - "description": "A tracking identifier of a user that validated a voucher. Identifier generated during voucher validation. This is a hashed customer source ID." - } - } - }, - "1_req_obj_vouchers_qualification_order": { - "title": "OrderObject", - "type": "object", - "properties": { - "id": { - "type": "string" - } - } - }, - "1_req_obj_vouchers_qualification_reward": { - "title": "RewardObject", - "type": "object", - "properties": { - "id": { - "type": "string" - } - } - }, - "0_obj_metadata": { - "title": "MetadataObject", - "type": "object", - "properties": { - "id": { - "type": "string" - } - } - }, - "res_empty_json": { - "type": "object", - "description": "Schema model for an empty json.", - "title": "Empty JSON", - "examples": [ - {} - ] - }, - "2_obj_campaign_object": { - "type": "object", - "title": "Campaign Object", - "description": "This is an object representing a campaign.", - "x-tags": [ - "CAMPAIGNS API" - ], - "properties": { - "id": { - "type": "string", - "description": "Unique campaign ID, assigned by Voucherify.", - "example": "camp_f7fBbQxUuTN7dI7tGOo5XMDA" - }, - "name": { - "type": "string", - "description": "Campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "campaign_type": { - "type": "string", - "enum": [ - "LOYALTY_PROGRAM", - "GIFT_VOUCHERS", - "DISCOUNT_COUPONS", - "PROMOTION", - "REFERRAL_PROGRAM", - "LUCKY_DRAW" - ], - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria \n- `STATIC`: vouchers need to be manually published", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "voucher": { - "anyOf": [ - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" - }, - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_GIFT_CARD" - }, - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_LOYALTY_CARD" - } - ] - }, - "auto_join": { - "type": "boolean", - "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2021-12-01T08:00:50.038Z", - "description": "Timestamp representing the date and time when the campaign was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-09-20T09:18:19.623Z", - "description": "Timestamp representing the date and time when the voucher was updated in ISO 8601 format." - }, - "category": { - "type": "string", - "description": "Unique category name." - }, - "creation_status": { - "type": "string", - "enum": [ - "DONE", - "IN_PROGRESS", - "FAILED", - "DRAFT", - "MODIFYING" - ], - "description": "Indicates the status of the campaign creation." - }, - "vouchers_generation_status": { - "type": "string", - "description": "Indicates the status of the campaign's vouchers.", - "enum": [ - "DONE", - "IN_PROGRESS", - "FAILED", - "DRAFT" - ] - }, - "protected": { - "type": "boolean", - "description": "Indicates whether the resource can be deleted." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to.", - "example": "cat_0b688929a2476386a7" - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object" - }, - "object": { - "type": "string", - "default": "campaign", - "description": "The type of object represented by JSON. This object stores information about the campaign." - }, - "referral_program": { - "type": "object", - "description": "Defines the referee reward and the way a referral is triggered. Context: `REFERRAL_PROGRAM`.", - "properties": { - "conversion_event_type": { - "type": "string", - "enum": [ - "redemption", - "custom_event" - ], - "description": "How a referral is triggered." - }, - "custom_event": { - "type": "object", - "description": "Contains details about the custom event.", - "properties": { - "id": { - "type": "string", - "example": "ms_fi47Dcu5T0m3v3nT5ch3ma", - "description": "Unique custom event ID." - }, - "name": { - "type": "string", - "description": "Custom event name." + }, + "1_req_obj_vouchers_qualification_product-copy": { + "title": "Product Item", + "type": "object", + "description": "Schema model for a product item.", + "properties": { + "id": { + "type": [ + "string", + "null" + ] + }, + "source_id": { + "type": [ + "string", + "null" + ], + "description": "Product/SKU reference ID" + }, + "product_id": { + "type": [ + "string", + "null" + ] + }, + "sku_id": { + "type": [ + "string", + "null" + ] + }, + "related_object": { + "type": [ + "string", + "null" + ], + "enum": [ + "product", + "sku" + ] + }, + "amount": { + "type": [ + "integer", + "null" + ], + "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item." + }, + "quantity": { + "type": [ + "integer", + "null" + ], + "description": "Quantity of the item in the cart." + }, + "price": { + "type": [ + "integer", + "null" + ], + "description": "Unit price of an item" + }, + "product": { + "type": [ + "object", + "null" + ], + "description": "An object containing details of the related product. These details will be used for validation and redemption processes on top of details already stored in the system.", + "properties": { + "id": { + "type": [ + "string", + "null" + ] + }, + "source_id": { + "type": [ + "string", + "null" + ] + }, + "name": { + "type": [ + "string", + "null" + ] + }, + "price": { + "type": [ + "integer", + "null" + ] + }, + "metadata": { + "type": [ + "object", + "null" + ] + }, + "override": { + "type": [ + "boolean", + "null" + ] + } } - } - }, - "referee_reward": { - "type": "object", - "description": "Defines the referee reward.", - "properties": { - "related_object_parent": { - "type": "object", - "description": "Details of the resource from which the reward originates.", - "properties": { - "id": { - "type": "string", - "description": "Unique ID of the reward source." - }, - "name": { - "type": "string", - "description": "Name of the reward source." - }, - "object": { - "type": "string", - "description": "Type of resource represented by the source of the reward." - } + }, + "sku": { + "type": [ + "object", + "null" + ], + "description": "An object containing details of the related SKU. These details will be used for validation and redemption processes on top of details already stored in the system.", + "properties": { + "id": { + "type": [ + "string", + "null" + ] + }, + "source_id": { + "type": [ + "string", + "null" + ] + }, + "sku": { + "type": [ + "string", + "null" + ] + }, + "price": { + "type": [ + "string", + "null" + ] + }, + "metadata": { + "type": [ + "object", + "null" + ] + }, + "override": { + "type": [ + "boolean", + "null" + ], + "description": "The override is used once the product should be stored in system. If sku does not exists it will be created with the use of `source_id`. If sku does not exists it's required to set `product_id` that it belongs to." } - }, - "type": { - "type": "string", - "description": "Type of reward.", - "enum": [ - "LOYALTY_CARD", - "GIFT_VOUCHER" - ] - }, - "amount": { - "type": "string", - "description": "The number of `points` to add to a loyalty card or `credits` to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." } } } - } - }, - "promotion": { - "$ref": "#/components/schemas/3_res_list_promotion_tiers_from_campaign" - }, - "loyalty_tiers_expiration": { - "type": "object", - "description": "Defines the expiration mechanism for loyalty tiers.", - "anyOf": [ - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance" - }, - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_points_in_period" - } - ] - } - } - }, - "2_loyalty_tiers_expiration_balance": { - "title": "Balance", - "type": "object", - "description": "Defines the Balance expiration mechanism for loyalty tiers.", - "properties": { - "qualification_type": { - "type": "string", - "enum": [ - "BALANCE" - ], - "description": "Tier qualification. \n\n`BALANCE`: Points balance is based on the customer's current points balance. Customers qualify for the tier if their points balance is in the points range of the tier." - }, - "start_date": { - "type": "object", - "description": "Defines the conditions for the start date of the tier.", - "properties": { - "type": { - "type": "string", - "enum": [ - "IMMEDIATE" - ], - "description": "What triggers the tier to be valid for a customer. \n`IMMEDIATE`: After reaching the minimum required points." - } - } - }, - "expiration_date": { - "description": "Defines the conditions for the expiration date of a tier.", - "anyOf": [ - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance_expiration_date_balance_drop" - }, - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance_expiration_date_custom" - } - ] - } - } - }, - "2_loyalty_tiers_expiration_balance_expiration_date_balance_drop": { - "title": "Balance Drop", - "type": "object", - "description": "Defines the conditions for the expiration date of a tier based on a pure balance drop.", - "properties": { - "type": { - "type": "string", - "enum": [ - "BALANCE_DROP" - ], - "description": "What triggers the tier to expire for a customer. \n`BALANCE_DROP`: Tier expires when the points balance drops below the required range of the tier." - } - } - }, - "2_loyalty_tiers_expiration_balance_expiration_date_custom": { - "title": "Custom", - "type": "object", - "description": "Defines the custom conditions for the expiration date of a tier.", - "properties": { - "type": { - "type": "string", - "enum": [ - "CUSTOM" - ], - "description": "What triggers the tier to expire for a customer. \n`CUSTOM`: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier." - }, - "extend": { - "type": "string", - "description": "Defines the amount of time the tier will remain active in ISO 8601 format. The expiration date counter starts at the moment when the customer reaches the minimum required points that are required to be in the tier. For example, a tier with a duration of P3M will be valid for a duration of 3 months." - }, - "rounding": { - "description": "Defines the rounding mechanism for tier expiration.", - "anyOf": [ - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_expiration_date_rounding_default_options" - }, - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_expiration_date_rounding_custom" - } - ] - } - } - }, - "2_loyalty_tiers_expiration_expiration_date_rounding_default_options": { - "title": "Calendar Periods", - "type": "object", - "description": "Defines the rounding mechanism for tier expiration based on a list of available time periods.", - "properties": { - "type": { - "type": "string", - "enum": [ - "MONTH", - "QUARTER", - "HALF_YEAR", - "YEAR" - ], - "description": "Period to which the expiration will be rounded to. \n- `MONTH`: The expiration date will be rounded to the end of the month. \n- `QUARTER`: The expiration date will be rounded to the end of the quarter. \n- `HALF_YEAR`: The expiration date will be rounded to the half year. \n- `YEAR`: The expiration date will be rounded to the end of the year." - }, - "strategy": { - "type": "string", - "description": "Which portion of the given period should the rounding be applied to.", - "enum": [ - "END" - ] - } - } - }, - "2_loyalty_tiers_expiration_expiration_date_rounding_custom": { - "title": "Specific Month", - "type": "object", - "description": "Defines the custom rounding mechanism for tier expiration.", - "properties": { - "type": { - "type": "string", - "enum": [ - "CUSTOM" - ], - "description": "This mechanism describes a custom rounding for the expiration date." - }, - "strategy": { - "type": "string", - "description": "Which portion of the given period should the rounding be applied to.", - "enum": [ - "END" - ] - }, - "unit": { - "type": "string", - "description": "Defines the type of unit of time in which the rounding period is counted.", - "enum": [ - "MONTH" - ] - }, - "value": { - "type": "integer", - "description": "Value for the unit of time that the rounding applies to. Units for this parameter are defined by the `rounding.unit` parameter. \n- `0`: January\n- `1`: February\n- `2`: March\n- `3`: April\n- `4`: May\n- `5`: June\n- `6`: July\n- `7`: August\n- `8`: September\n- `9`: October\n- `10`: November\n- `11`: December" - } - } - }, - "2_loyalty_tiers_expiration_points_in_period": { - "title": "Points in Period", - "type": "object", - "description": "Defines the Points in Period expiration mechanism for loyalty tiers.", - "properties": { - "qualification_type": { - "type": "string", - "enum": [ - "POINTS_IN_PERIOD" - ], - "description": "Tier qualification. \n\n`POINTS_IN_PERIOD`: A customer qualifies for the tier only if the sum of the accumulated points in a **defined time interval** reaches the tier threshold." - }, - "qualification_period": { - "type": "string", - "description": "Customers can qualify for the tier if they collected enough points in a given time period. So, in addition to the customer having to reach a points range, they also need to have collected the points within a set time period. \n\n| **Period** | **Definition** |\n|:---|:---|\n| **Calendar Month** | Points collected in one calendar month
January, February, March, etc. |\n| **Calendar Quarter** | Points collected in the quarter
- January - March
- April - June
- July - September
- October - December |\n| **Calendar Half-year** | Points collected in the half-year
- January - June
- July - December |\n| **Calendar Year** | Points collected in one calendar year
January - December |", - "enum": [ - "MONTH", - "QUARTER", - "HALF_YEAR", - "YEAR" - ] - }, - "start_date": { - "type": "object", - "description": "Defines the conditions for the start date of the tier.", - "properties": { - "type": { - "type": "string", - "enum": [ - "IMMEDIATE", - "NEXT_PERIOD" - ], - "description": "What triggers the tier to be valid for a customer. \n`IMMEDIATE`: After reaching the minimum required points. \n`NEXT_PERIOD`: When the next qualification period starts." - } - } - }, - "expiration_date": { - "type": "object", - "description": "Defines the conditions for the expiration date of a tier.", - "properties": { - "type": { - "type": "string", - "enum": [ - "END_OF_PERIOD", - "END_OF_NEXT_PERIOD" - ], - "description": "What triggers the tier to expire for a customer. \n`END_OF_PERIOD`: Expire tier at the end of the period. \n`END_OF_NEXT_PERIOD`: Expire tier at the end of the next period." - }, - "extend": { - "type": "string", - "description": "Extend the expiration by adding extra months or days in ISO 8601 format. The tier will remain active even though it reaches its expiration time period. For example, a tier with a duration of `P3M` will be valid for an additional duration of 3 months and a tier with a duration of `P1D` will be valid for an additional duration of 1 day." - } - } - } - } - }, - "2_req_create_campaign": { - "title": "Create Campaign Request Body", - "description": "Request body schema for **POST** `/campaigns`.", - "oneOf": [ - { - "$ref": "#/components/schemas/2_req_create_campaign_discount_voucher" - }, - { - "$ref": "#/components/schemas/2_req_create_campaign_loyalty" - }, - { - "$ref": "#/components/schemas/2_req_create_campaign_gift" - }, - { - "$ref": "#/components/schemas/2_req_create_campaign_promotion" - }, - { - "$ref": "#/components/schemas/2_req_create_campaign_referral" - } - ] - }, - "2_req_create_campaign_discount_voucher": { - "type": "object", - "title": "Discount Campaign", - "description": "Request body schema for creating a discount voucher campaign using **POST** `/campaigns`.", - "properties": { - "name": { - "type": "string", - "description": "Campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "campaign_type": { - "type": "string", - "default": "DISCOUNT_COUPONS", - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign (size of campaign)." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "voucher": { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" - } - } - }, - "2_req_create_campaign_loyalty": { - "type": "object", - "title": "Loyalty Campaign", - "description": "Request body schema for creating a loyalty campaign using **POST** `/campaigns`.", - "properties": { - "name": { - "type": "string", - "description": "Campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "campaign_type": { - "type": "string", - "default": "LOYALTY_PROGRAM", - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "auto_join": { - "type": "boolean", - "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. CONTEXT: `LOYALTY_PROGRAM`." - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign (size of campaign)." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "voucher": { - "$ref": "#/components/schemas/2_req_campaign_object_voucher_object_LOYALTY_CARD" - } - } - }, - "2_req_create_campaign_gift": { - "type": "object", - "title": "Gift Card campaign", - "description": "Request body schema for creating a gift card campaign using **POST** `/campaigns`.", - "properties": { - "name": { - "type": "string", - "description": "Campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "campaign_type": { - "type": "string", - "default": "GIFT_VOUCHERS", - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign (size of campaign)." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "voucher": { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_GIFT_CARD" - } - } - }, - "2_req_create_campaign_referral": { - "type": "object", - "title": "Referral Campaign", - "description": "Request body schema for creating a referral campaign using **POST** `/campaigns`.", - "properties": { - "name": { - "type": "string", - "description": "Campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "campaign_type": { - "type": "string", - "default": "REFERRAL_PROGRAM", - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign (size of campaign)." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "voucher": { - "anyOf": [ - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" - }, - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_GIFT_CARD" - }, - { - "$ref": "#/components/schemas/2_req_campaign_object_voucher_object_LOYALTY_CARD" - } - ] - }, - "referral_program": { - "description": "Defines the referee reward and the way a referral is triggered. Context: `REFERRAL_PROGRAM`.", - "type": "object", - "properties": { - "conversion_event_type": { - "type": "string", - "enum": [ - "redemption", - "custom_event" - ], - "description": "Define how a referral is triggered." - }, - "custom_event": { - "type": "object", - "description": "Contains details about the custom event.", - "properties": { - "id": { - "type": "string", - "example": "ms_Ll9enAm2BCN0M1s4VxWobLFM", - "description": "Unique custom event ID." - }, - "name": { - "type": "string", - "description": "Custom event name." + }, + "1_req_vouchers_qualification-prepforcampaignqualification": { + "title": "RequestBodyVouchersQualification", + "type": "object", + "description": "Request body schema for /vouchers/qualification.", + "properties": { + "customer": { + "type": [ + "object", + "null" + ], + "description": "This object stores customer details.", + "properties": { + "id": { + "type": "string", + "description": "The ID of an existing customer that will be linked to the redemption in this request. Assigned by the Voucherify API, identifies the customer.", + "example": "cust_J1CDUdbqn5Exva8ASWk1Fq0j" + }, + "source_id": { + "type": [ + "string", + "null" + ], + "description": "A unique customer identifier. You can provide your own (e.g. CRM id) or use the one returned by Voucherify, see tracking_id from Validate Voucher (client-side). A tracking identifier of a user that validate a voucher. It is build based on your internal id (e.g., email, database ID). If you also pass a customer ID, the source ID will be ignored. Otherwise, if you do not pass a customer ID, the source ID you provide must either be a token, like the ones returned in origin voucher validation method done by specific customer, or a string identifying customer (e.g., email, database ID, CRM ID)." + }, + "name": { + "type": [ + "string", + "null" + ], + "description": "First and Last Name" + }, + "email": { + "type": [ + "string", + "null" + ] + }, + "phone": { + "type": [ + "string", + "null" + ], + "minLength": 1, + "maxLength": 30, + "pattern": "^[-+.() 0-9]" + }, + "address": { + "type": [ + "object", + "null" + ], + "additionalProperties": false, + "description": "A set of key/value pairs which describes the address.", + "properties": { + "city": { + "type": [ + "string", + "null" + ] + }, + "country": { + "type": [ + "string", + "null" + ] + }, + "postal_code": { + "type": [ + "string", + "null" + ] + }, + "state": { + "type": [ + "string", + "null" + ] + } + } + }, + "metadata": { + "type": [ + "object", + "null" + ], + "description": "A set of key/value pairs that you can attach to a customer object for segment building. It can be useful for storing additional information about the customer in a structured format." + }, + "birthdate": { + "type": [ + "string", + "null" + ], + "description": "Customer's birthdate, i.e. `YYYY-MM-DD`.", + "format": "date" + } } - } - }, - "referee_reward": { - "type": "object", - "description": "Defines the referee reward.", - "properties": { - "related_object_parent": { - "type": "object", - "description": "Details of the resource from which the reward originates.", - "properties": { - "id": { - "type": "string", - "example": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", - "description": "Unique ID of the reward source." - }, - "name": { - "type": "string", - "description": "Name of the reward source." - }, - "object": { - "type": "string", - "enum": [ - "CAMPAIGN" + }, + "order": { + "type": [ + "object", + "null" + ], + "description": "Tracks purchase transactions.", + "properties": { + "id": { + "type": [ + "string", + "null" + ], + "description": "The ID of an existing order that will be linked to redemption in this request." + }, + "status": { + "type": [ + "string", + "null" + ], + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULFILLED" + ] + }, + "source_id": { + "type": [ + "string", + "null" + ], + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + }, + "amount": { + "type": [ + "integer", + "null" + ], + "minimum": 0, + "description": "Represents a total amount of order items (sum of item.amount)\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "discount_amount": { + "type": [ + "integer", + "null" + ], + "minimum": 0, + "description": "Summarize all discounts applied to the order inlcuding discounts applied to particular order line items and discounts applied to the whole cart.\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "items": { + "type": "array", + "description": "List of Order Items constituting the order. Order items can be defined either by product_id or sku_id. Along with every item you must define quantity.A list of Order Items that have been applied to the order. hyperlink the Order Items to another object.\n", + "items": { + "type": [ + "object", + "null" ], - "description": "Type of resource represented by the source of the reward." + "properties": { + "id": { + "type": [ + "string", + "null" + ] + }, + "source_id": { + "type": [ + "string", + "null" + ], + "description": "Product/SKU reference ID" + }, + "product_id": { + "type": [ + "string", + "null" + ] + }, + "sku_id": { + "type": [ + "string", + "null" + ] + }, + "related_object": { + "type": [ + "string", + "null" + ], + "enum": [ + "product", + "sku" + ], + "description": "Allowed values: `product`, `sku`" + }, + "amount": { + "type": [ + "integer", + "null" + ], + "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item." + }, + "discount_amount": { + "type": [ + "integer", + "null" + ], + "description": "Represents total amount of the discount applied to order line items\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "quantity": { + "type": [ + "integer", + "null" + ] + }, + "discount_quantity": { + "type": [ + "integer", + "null" + ], + "description": "number of items being discounted\t" + }, + "price": { + "type": [ + "integer", + "null" + ], + "description": "Unit price of an item" + }, + "product": { + "type": [ + "object", + "null" + ], + "description": "An object containing details of related product. Those details will be used for validation and redemption processes on top of details already stored in system.", + "properties": { + "id": { + "type": [ + "string", + "null" + ] + }, + "source_id": { + "type": [ + "string", + "null" + ] + }, + "name": { + "type": [ + "string", + "null" + ] + }, + "price": { + "type": [ + "null", + "integer" + ] + }, + "metadata": { + "type": [ + "object", + "null" + ] + }, + "override": { + "type": [ + "boolean", + "null" + ], + "description": "The `override` is used once the product should be stored in system. If product does not exists it will be created with the use of `source_id`." + } + } + }, + "sku": { + "type": [ + "object", + "null" + ], + "description": "An object containing details of related SKU. Those details will be used for validation and redemption processes on top of details already stored in system.", + "properties": { + "id": { + "type": [ + "string", + "null" + ] + }, + "source_id": { + "type": [ + "string", + "null" + ] + }, + "sku": { + "type": [ + "string", + "null" + ] + }, + "price": { + "type": [ + "string", + "null" + ] + }, + "metadata": { + "type": [ + "object", + "null" + ] + }, + "override": { + "type": [ + "boolean", + "null" + ], + "description": "The override is used once the product should be stored in system. If sku does not exists it will be created with the use of `source_id`. If sku does not exists it's required to set `product_id` that it belongs to." + } + } + } + } } + }, + "customer": { + "type": [ + "object", + "null" + ], + "description": "The customer used for the order." + }, + "referrer": { + "description": "The person who referred the customer to make the order.", + "type": [ + "object", + "null" + ] + }, + "metadata": { + "type": [ + "string", + "null" + ] + } + } + }, + "reward": { + "type": [ + "object", + "null" + ], + "properties": { + "points": { + "type": [ + "number", + "null" + ] + }, + "assignment_id": { + "type": [ + "string", + "null" + ] + }, + "id": { + "type": [ + "string", + "null" + ] } - }, - "type": { - "type": "string", - "enum": [ - "LOYALTY_CARD", - "GIFT_VOUCHER" - ], - "description": "Type of reward." - }, - "amount": { - "type": "string", - "description": "Define the number of `points` to add to a loyalty card or `credits` to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." } + }, + "metadata": { + "type": [ + "object", + "null" + ], + "description": "Metadata can be a string, number, boolean, date, datetime, image_url, object, geopoint, unknown. | related objects: campaign, voucher, publication, redemption, product, customer, order, order_item, loyalty_tier, promotion_tier." } } - } - } - } - }, - "2_req_create_campaign_promotion": { - "type": "object", - "title": "Promotion", - "description": "Request body schema for creating a promotions campaign using **POST** `/campaigns`.", - "properties": { - "name": { - "type": "string", - "description": "Campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "campaign_type": { - "type": "string", - "default": "PROMOTION", - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign (size of campaign)." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "promotion": { - "type": "object", - "description": "Define the promotion tiers within the campaign.", - "properties": { - "tiers": { - "type": "array", - "items": { - "$ref": "#/components/schemas/3_req_add_promotion_tier_to_campaign" - } - } - } - } - } - }, - "2_req_update_campaign": { - "type": "object", - "title": "Update Campaign Request Body", - "description": "Request body schema for **PUT** `/campaigns/{campaignId}`.", - "properties": { - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "auto_join": { - "type": "boolean", - "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter or the `category` parameter.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id` parameter." - } - } - }, - "2_req_add_vouchers_to_campaign": { - "type": "object", - "title": "Add Vouchers to Campaign Request Body", - "description": "Request body schema for **POST** `/campaigns/{campaignId}/vouchers`.", - "properties": { - "category_id": { - "type": "string", - "description": "Unique category ID that you would like to assign to the voucher.", - "example": "cat_0b688929a2476386a7" - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - }, - "redemption": { - "type": "object", - "description": "Stores the quantity of redemptions that can be applied to the voucher.", - "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited." - } - } - }, - "additional_info": { - "type": "string", - "description": "An optional field to keep any extra textual information about the code such as a code description and details." - }, - "code_config": { - "type": "object", - "description": "Defines code's pattern (prefix, suffix, length, charset, etc). ", - "properties": { - "length": { - "type": "string", - "description": "Number of characters in a generated code (excluding prefix and postfix)." - }, - "charset": { - "type": "string", - "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" - }, - "prefix": { - "type": "string", - "description": "A text appended before the code." - }, - "postfix": { - "type": "string", - "description": "A text appended after the code." - }, - "pattern": { - "type": "string", - "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." - } - } - } - } - }, - "2_req_add_vouchers_with_specific_code_to_campaign": { - "type": "object", - "title": "Add Vouchers with Specific Code to Campaign Request Body", - "description": "Request body schema for **POST** `/campaigns/{campaignId}/vouchers/{code}`.", - "properties": { - "category_id": { - "type": "string", - "description": "Unique category ID that you would like to assign to the voucher.", - "example": "cat_0b688929a2476386a7" - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - }, - "redemption": { - "type": "object", - "description": "Stores the quantity of redemptions that can be applied to the voucher.", - "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited." - } - } - }, - "additional_info": { - "type": "string", - "description": "An optional field to keep any extra textual information about the code such as a code description and details." - } - } - }, - "2_req_import_vouchers_to_campaign": { - "type": "array", - "title": "Import Vouchers to Campaign Request Body", - "description": "Request body schema for **POST** `/campaigns/{campaignId}/import`.", - "items": { - "$ref": "#/components/schemas/2_obj_import_vouchers_to_campaign_object" - } - }, - "2_obj_import_vouchers_to_campaign_object": { - "type": "object", - "title": "Import Vouchers to Campaign", - "description": "Import Vouchers to Campaign", - "properties": { - "code": { - "type": "string", - "description": "Unique custom voucher code." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that you would like to assign to the voucher. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - }, - "redemption": { - "type": "object", - "description": "Stores the quantity of redemptions that can be applied to the voucher.", - "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited." - } - } - }, - "additional_info": { - "type": "string", - "description": "An optional field to keep any extra textual information about the code such as a code description and details." - }, - "loyalty_card": { - "type": "object", - "description": " Assign an initial points balance for a loyalty card. Context: `LOYALTY_PROGRAM`.", - "properties": { - "points": { - "type": "integer", - "description": "The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card." - } - } - }, - "gift": { - "type": "object", - "description": "Assign an initial cash balance for a gift card. Context: `GIFT_VOUCHERS`.", - "properties": { - "amount": { - "type": "integer", - "description": "The cash balance to assign to the gift card. This is the current gift card balance." - } - } - } - }, - "required": [ - "code" - ] - }, - "2_req_examine_qualification": { - "type": "object", - "title": "Examine Qualification Request Body", - "description": "Request body schema for **POST** `/campaigns/qualification`.", - "examples": [], - "properties": { - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" - }, - { - "$ref": "#/components/schemas/10_req_create_order" - } - ], - "description": "Order information. This object enables you to pass purchase transaction data. Read what properties you can use in the [Order object](ref:get-order)." - } - } - }, - "2_res_examine_qualification": { - "type": "object", - "title": "Examine Qualification Response Body", - "description": "Response body schema for **POST** `/campaigns/qualification`.", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about campaigns in a dictionary.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of campaign objects.", - "default": "data" - }, - "data": { - "type": "array", - "description": "Contains array of campaign objects.", - "items": { - "$ref": "#/components/schemas/2_obj_campaign_object_campaigns_qualification" - } - }, - "total": { - "type": "integer", - "description": "Total valid and active campaigns matching the qualification criteria in given context." - }, - "id": { - "type": "string", - "description": "Unique qualification ID.", - "example": "qfl_dNZ3gWfKVNa8Zw15hn30uqdU" - }, - "created_at": { - "type": "string", - "format": "datetime", - "description": "Timestamp representing the date and time when the qualification was created in ISO 8601 format.", - "example": "2023-04-04T13:13:03.119Z" - }, - "tracking_id": { - "type": "string", - "description": "Hashed customer source ID." - } - } - }, - "2_obj_campaign_object_campaigns_qualification": { - "type": "object", - "title": "Campaign Object", - "description": "This is an object representing a campaign.", - "properties": { - "id": { - "type": "string", - "description": "Unique campaign ID, assigned by Voucherify.", - "example": "camp_f7fBbQxUuTN7dI7tGOo5XMDA" - }, - "name": { - "type": "string", - "description": "Campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "campaign_type": { - "type": "string", - "enum": [ - "GIFT_VOUCHERS", - "DISCOUNT_COUPONS", - "REFERRAL_PROGRAM" - ], - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria \n- `STATIC`: vouchers need to be manually published", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "voucher": { - "anyOf": [ - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" - }, - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_GIFT_CARD" - }, - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_LOYALTY_CARD" - } - ] - }, - "auto_join": { - "type": "boolean", - "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2021-12-01T08:00:50.038Z", - "description": "Timestamp representing the date and time when the campaign was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-09-20T09:18:19.623Z", - "description": "Timestamp representing the date and time when the voucher was updated in ISO 8601 format." - }, - "category": { - "type": "string", - "description": "Unique category name." - }, - "creation_status": { - "type": "string", - "enum": [ - "DONE", - "IN_PROGRESS", - "FAILED", - "DRAFT", - "MODIFYING" - ], - "description": "Indicates the status of the campaign creation." - }, - "vouchers_generation_status": { - "type": "string", - "description": "Indicates the status of the campaign's vouchers.", - "enum": [ - "DONE", - "IN_PROGRESS", - "FAILED", - "DRAFT" - ] - }, - "protected": { - "type": "boolean", - "description": "Indicates whether the resource can be deleted." - }, - "validation_rules_assignments": { - "type": "object", - "description": "Stores information about validation rules assigned to the campaign.", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented is by default `list`.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of validation rule assignments.", - "default": "data" - }, - "data": { - "type": "array", - "description": "Array of validation rule assignment objects. Each validation rule assignment object contains details about the rule.", - "items": { - "type": "object", + }, + "1_req_vouchers_qualification-copy": { + "title": "RequestBodyVouchersQualification", + "type": "object", + "description": "Request body schema for /vouchers/qualification.", + "properties": { + "customer": { + "type": [ + "object", + "null" + ], + "description": "This object stores customer details.", "properties": { "id": { "type": "string", - "example": "asgm_N7t39epaQR2SkQcW", - "description": "Assigned by the Voucherify API, identifies the validation rule assignment." + "description": "The ID of an existing customer that will be linked to the redemption in this request. Assigned by the Voucherify API, identifies the customer.", + "example": "cust_J1CDUdbqn5Exva8ASWk1Fq0j" }, - "rule_id": { - "type": "string", - "example": "val_ssbxf1L9aKri", - "description": "Assigned by the Voucherify API, identifies the validation rule." + "source_id": { + "type": [ + "string", + "null" + ], + "description": "A unique customer identifier. You can provide your own (e.g. CRM id) or use the one returned by Voucherify, see tracking_id from Validate Voucher (client-side). A tracking identifier of a user that validate a voucher. It is build based on your internal id (e.g., email, database ID). If you also pass a customer ID, the source ID will be ignored. Otherwise, if you do not pass a customer ID, the source ID you provide must either be a token, like the ones returned in origin voucher validation method done by specific customer, or a string identifying customer (e.g., email, database ID, CRM ID)." }, - "related_object_id": { - "type": "string", - "example": "camp_AaP9MC1Y0GpBII84UTIuasvb", - "description": "ID of the object from which the rule originates." + "name": { + "type": [ + "string", + "null" + ], + "description": "First and Last Name" }, - "related_object_type": { - "type": "string", - "example": "campaign", - "description": "Which object does the rule originate from: the `voucher` itself or inherited from its parent `campaign`." + "description": { + "type": [ + "string", + "null" + ], + "description": "An arbitrary string that you can attach to a customer object. It is displayed alongside a customer in the dashboard.\t" }, - "created_at": { - "type": "string", - "example": "2022-02-14T15:12:06.817Z", - "description": "Timestamp representing the date and time when the validation rule was created in ISO 8601 format.", - "format": "date-time" + "email": { + "type": [ + "string", + "null" + ] }, - "object": { - "type": "string", - "default": "validation_rules_assignment", - "description": "The type of resource represented by the object. Default is `validation_rules_assignment`." + "phone": { + "type": [ + "string", + "null" + ] }, - "rule": { - "type": "object", - "description": "Describes the details of the rule." - } - } - } - }, - "total": { - "type": "integer", - "description": "Total number of validation rules assigned to the campaign." - } - } - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to.", - "example": "cat_0b688929a2476386a7" - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object" - }, - "object": { - "type": "string", - "default": "campaign", - "description": "The type of object represented by JSON. This object stores information about the campaign." - }, - "referral_program": { - "type": "object", - "description": "Defines the referee reward and the way a referral is triggered. Context: `REFERRAL_PROGRAM`.", - "properties": { - "conversion_event_type": { - "type": "string", - "enum": [ - "redemption", - "custom_event" - ], - "description": "How a referral is triggered." - }, - "custom_event": { - "type": "object", - "description": "Contains details about the custom event.", - "properties": { - "id": { - "type": "string", - "example": "ms_fi47Dcu5T0m3v3nT5ch3ma", - "description": "Unique custom event ID." - }, - "name": { - "type": "string", - "description": "Custom event name." - } - } - }, - "referee_reward": { - "type": "object", - "description": "Defines the referee reward.", - "properties": { - "related_object_parent": { - "type": "object", - "description": "Details of the resource from which the reward originates.", - "properties": { - "id": { - "type": "string", - "description": "Unique ID of the reward source." - }, - "name": { - "type": "string", - "description": "Name of the reward source." - }, - "object": { - "type": "string", - "description": "Type of resource represented by the source of the reward." - } - } - }, - "type": { - "type": "string", - "description": "Type of reward.", - "enum": [ - "LOYALTY_CARD", - "GIFT_VOUCHER" - ] - }, - "amount": { - "type": "string", - "description": "The number of `points` to add to a loyalty card or `credits` to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + "address": { + "type": [ + "object", + "null" + ], + "additionalProperties": false, + "description": "A set of key/value pairs which describes the address.", + "properties": { + "city": { + "type": [ + "string", + "null" + ] + }, + "country": { + "type": [ + "string", + "null" + ] + }, + "line_1": { + "type": [ + "string", + "null" + ] + }, + "line_2": { + "type": [ + "string", + "null" + ] + }, + "postal_code": { + "type": [ + "string", + "null" + ] + }, + "state": { + "type": [ + "string", + "null" + ] + } + } + }, + "metadata": { + "type": [ + "object", + "null" + ], + "description": "A set of key/value pairs that you can attach to a customer object for segment building. It can be useful for storing additional information about the customer in a structured format." + }, + "email_unsubscribed": { + "type": [ + "boolean", + "null" + ] + }, + "birthday": { + "type": [ + "string", + "null" + ], + "description": "Customer's birthdate.", + "format": "date", + "example": "2022-03-07" + }, + "birthdate": { + "type": [ + "string", + "null" + ], + "description": "Customer's birthdate", + "example": "2022-03-07", + "format": "date" + }, + "customer_landing_page": { + "type": [ + "object", + "null" + ], + "properties": { + "custom_event": { + "type": [ + "object", + "null" + ] + }, + "consents": { + "type": [ + "object", + "null" + ] + }, + "publication_id": { + "type": [ + "string", + "null" + ] + }, + "voucher_code": { + "type": [ + "string", + "null" + ] + } + } + }, + "created_at": { + "type": "string" + } + } + }, + "order": { + "type": [ + "object", + "null" + ], + "description": "Tracks purchase transactions.", + "properties": { + "id": { + "type": [ + "string", + "null" + ], + "description": "The ID of an existing order that will be linked to redemption in this request." + }, + "status": { + "type": [ + "string", + "null" + ], + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULFILLED" + ] + }, + "source_id": { + "type": [ + "string", + "null" + ], + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + }, + "amount": { + "type": [ + "integer", + "null" + ], + "minimum": 0, + "description": "Represents a total amount of order items (sum of item.amount)\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "discount_amount": { + "type": [ + "integer", + "null" + ], + "minimum": 0, + "description": "Summarize all discounts applied to the order inlcuding discounts applied to particular order line items and discounts applied to the whole cart.\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "items": { + "type": "array", + "description": "List of Order Items constituting the order. Order items can be defined either by product_id or sku_id. Along with every item you must define quantity.A list of Order Items that have been applied to the order. hyperlink the Order Items to another object.\n", + "items": { + "type": [ + "object", + "null" + ], + "properties": { + "id": { + "type": [ + "string", + "null" + ] + }, + "source_id": { + "type": [ + "string", + "null" + ], + "description": "Product/SKU reference ID" + }, + "product_id": { + "type": [ + "string", + "null" + ] + }, + "sku_id": { + "type": [ + "string", + "null" + ] + }, + "related_object": { + "type": [ + "string", + "null" + ], + "enum": [ + "product", + "sku" + ], + "description": "Allowed values: `product`, `sku`" + }, + "amount": { + "type": [ + "integer", + "null" + ], + "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item." + }, + "discount_amount": { + "type": [ + "integer", + "null" + ], + "description": "Represents total amount of the discount applied to order line items\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "quantity": { + "type": [ + "integer", + "null" + ] + }, + "discount_quantity": { + "type": [ + "integer", + "null" + ], + "description": "number of items being discounted\t" + }, + "price": { + "type": [ + "integer", + "null" + ], + "description": "Unit price of an item" + }, + "product": { + "type": [ + "object", + "null" + ], + "description": "An object containing details of related product. Those details will be used for validation and redemption processes on top of details already stored in system.", + "properties": { + "id": { + "type": [ + "string", + "null" + ] + }, + "source_id": { + "type": [ + "string", + "null" + ] + }, + "name": { + "type": [ + "string", + "null" + ] + }, + "price": { + "type": [ + "null", + "integer" + ] + }, + "metadata": { + "type": [ + "object", + "null" + ] + }, + "override": { + "type": [ + "boolean", + "null" + ], + "description": "The `override` is used once the product should be stored in system. If product does not exists it will be created with the use of `source_id`." + } + } + }, + "sku": { + "type": [ + "object", + "null" + ], + "description": "An object containing details of related SKU. Those details will be used for validation and redemption processes on top of details already stored in system.", + "properties": { + "id": { + "type": [ + "string", + "null" + ] + }, + "source_id": { + "type": [ + "string", + "null" + ] + }, + "sku": { + "type": [ + "string", + "null" + ] + }, + "price": { + "type": [ + "string", + "null" + ] + }, + "metadata": { + "type": [ + "object", + "null" + ] + }, + "override": { + "type": [ + "boolean", + "null" + ], + "description": "The override is used once the product should be stored in system. If sku does not exists it will be created with the use of `source_id`. If sku does not exists it's required to set `product_id` that it belongs to." + } + } + } + } + } + }, + "customer": { + "type": [ + "object", + "null" + ], + "description": "The customer used for the order." + }, + "referrer": { + "description": "The person who referred the customer to make the order.", + "type": [ + "object", + "null" + ] + }, + "metadata": { + "type": [ + "string", + "null" + ] + } + } + }, + "reward": { + "type": [ + "object", + "null" + ], + "properties": { + "points": { + "type": [ + "number", + "null" + ] + }, + "assignment_id": { + "type": [ + "string", + "null" + ] + }, + "id": { + "type": [ + "string", + "null" + ] + } + } + }, + "metadata": { + "type": [ + "object", + "null" + ], + "description": "Metadata can be a string, number, boolean, date, datetime, image_url, object, geopoint, unknown. | related objects: campaign, voucher, publication, redemption, product, customer, order, order_item, loyalty_tier, promotion_tier." + }, + "gift": { + "type": [ + "object", + "null" + ], + "properties": { + "credits": { + "type": [ + "number", + "null" + ] + } + } + }, + "session": { + "type": [ + "object", + "null" + ], + "properties": { + "key": { + "type": [ + "string", + "null" + ], + "description": "Unique session identifier assigned by the Voucherify API." + }, + "type": { + "type": [ + "string", + "null" + ], + "enum": [ + "COUNT_PER_CUSTOMER", + "ORDER", + "LOCK" + ], + "description": "The type of session. Required to establish a new session. \n\n`LOCK`: Locks the following parameters within the session:\n\n- redemption quantity by 1\n- redemption gift credits specified with the requests\n- redemption loyalty points specified with the request" + }, + "ttl": { + "type": [ + "number", + "null" + ], + "description": "Value for the period of time that the session is active. Units for this parameter are defined by `session.ttl_unit`." + }, + "ttl_unit": { + "type": [ + "string", + "null" + ], + "enum": [ + "DAYS", + "HOURS", + "MICROSECONDS", + "MILLISECONDS", + "MINUTES", + "NANOSECONDS", + "SECONDS" + ], + "description": "Defines the type of unit in which the session time is counted." + } } + }, + "tracking_id": { + "type": [ + "string", + "null" + ], + "maxLength": 2500, + "example": "track_fxEMFisanb7t4l96X8WKcemyGNPnHpGM3KTfUsqZGCOx/p57/J2+Yw==", + "description": "A tracking identifier of a user that validated a voucher. Identifier generated during voucher validation. This is a hashed customer source ID." } } - } - } - } - }, - "2_res_list_campaigns": { - "type": "object", - "description": "Schema model for **GET** `/campaigns`.", - "title": "List Campaigns Response Body", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about campaigns in a dictionary.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of campaign objects.", - "default": "campaigns" - }, - "campaigns": { - "type": "array", - "description": "Contains array of campaign objects.", - "items": { - "$ref": "#/components/schemas/2_obj_campaign_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of campaigns." - } - } - }, - "2_obj_campaign_object_voucher_object_DISCOUNT": { - "type": "object", - "description": "Schema model for a discount voucher.", - "title": "Discount Voucher", - "properties": { - "type": { - "type": "string", - "default": "DISCOUNT_VOUCHER", - "description": "Type of voucher." - }, - "discount": { - "oneOf": [ - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" - } - ], - "description": "Defines the voucher discount type and details." - }, - "redemption": { - "type": "object", - "description": "Defines the redemption limits on vouchers.", - "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited." - } - } - }, - "code_config": { - "type": "object", - "description": "Defines code's pattern (prefix, suffix, length, charset, etc). ", - "properties": { - "length": { - "type": "string", - "description": "Number of characters in a generated code (excluding prefix and postfix)." - }, - "charset": { - "type": "string", - "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" - }, - "prefix": { - "type": "string", - "description": "A text appended before the code." - }, - "postfix": { - "type": "string", - "description": "A text appended after the code." - }, - "pattern": { - "type": "string", - "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." - } - } - }, - "is_referral_code": { - "type": "boolean", - "description": "Indicates whether the voucher is a referral code; this is `true` for campaign type `REFERRAL_PROGRAM`." - } - } - }, - "2_obj_campaign_object_voucher_object_GIFT_CARD": { - "type": "object", - "description": "Schema model for a gift card.", - "title": "Gift Card", - "properties": { - "type": { - "type": "string", - "default": "GIFT_VOUCHER", - "description": "Type of voucher." - }, - "gift": { - "description": "Defines the gift card details.", - "type": "object", - "properties": { - "amount": { - "type": "integer", - "description": "Initial gift card income to be applied to the gift card at voucher generation. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "effect": { - "type": "string", - "description": "Defines how the credits are applied to the customer's order.", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS" - ] - } - } - }, - "redemption": { - "type": "object", - "description": "Defines the redemption limits on vouchers.", - "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited." - } - } - }, - "code_config": { - "type": "object", - "description": "Defines code's pattern (prefix, suffix, length, charset, etc). ", - "properties": { - "length": { - "type": "string", - "description": "Number of characters in a generated code (excluding prefix and postfix)." - }, - "charset": { - "type": "string", - "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" - }, - "prefix": { - "type": "string", - "description": "A text appended before the code." - }, - "postfix": { - "type": "string", - "description": "A text appended after the code." - }, - "pattern": { - "type": "string", - "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." + }, + "1_req_obj_vouchers_qualification_order": { + "title": "OrderObject", + "type": "object", + "properties": { + "id": { + "type": "string" + } } - } - }, - "is_referral_code": { - "type": "boolean", - "description": "Indicates whether the voucher is a referral code; this is `true` for campaign type `REFERRAL_PROGRAM`." - } - } - }, - "2_obj_campaign_object_voucher_object_LOYALTY_CARD": { - "type": "object", - "description": "Schema model for a loyalty card.", - "title": "Loyalty Card", - "properties": { - "type": { - "type": "string", - "default": "LOYALTY_CARD", - "description": "Type of voucher." - }, - "loyalty_card": { - "description": "Defines the loyalty card details.", - "type": "object", - "properties": { - "points": { - "type": "integer", - "description": "Initial loyalty card income in points to be applied to the loyalty card at voucher generation." - }, - "expiration_rules": { - "type": "object", - "description": "Defines point expiration rules.", - "properties": { - "period_type": { - "type": "string", - "enum": [ - "MONTH" - ], - "description": "The expiration period." - }, - "period_value": { - "type": "integer", - "description": "How many periods should pass before the expiration occurs." - }, - "rounding_type": { - "type": "string", - "enum": [ - "END_OF_MONTH", - "END_OF_QUARTER", - "END_OF_HALF_YEAR", - "END_OF_YEAR", - "PARTICULAR_MONTH" - ], - "description": "Round up expiration till the end of the given period type." - } + }, + "1_req_obj_vouchers_qualification_reward": { + "title": "RewardObject", + "type": "object", + "properties": { + "id": { + "type": "string" } } - } - }, - "redemption": { - "type": "object", - "description": "Defines the redemption limits on vouchers.", - "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + }, + "0_obj_metadata": { + "title": "MetadataObject", + "type": "object", + "properties": { + "id": { + "type": "string" + } } - } - }, - "code_config": { - "type": "object", - "description": "Defines code's pattern (prefix, suffix, length, charset, etc). ", - "properties": { - "length": { - "type": "string", - "description": "Number of characters in a generated code (excluding prefix and postfix)." - }, - "charset": { - "type": "string", - "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" - }, - "prefix": { - "type": "string", - "description": "A text appended before the code." - }, - "postfix": { - "type": "string", - "description": "A text appended after the code." - }, - "pattern": { - "type": "string", - "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." - } - } - }, - "is_referral_code": { - "type": "boolean", - "description": "Indicates whether the voucher is a referral code; this is `true` for campaign type `REFERRAL_PROGRAM`." - } - } - }, - "2_req_campaign_object_voucher_object_LOYALTY_CARD": { - "type": "object", - "description": "Schema model for a loyalty card.", - "title": "Loyalty Card", - "properties": { - "type": { - "type": "string", - "default": "LOYALTY_CARD", - "description": "Type of voucher." - }, - "loyalty_card": { - "description": "Defines the loyalty card details.", - "type": "object", - "properties": { - "points": { - "type": "integer", - "description": "Initial loyalty card income in points to be applied to the loyalty card at voucher generation." - }, - "expiration_rules": { - "type": "object", - "description": "Defines point expiration rules.", - "properties": { - "period_type": { - "type": "string", - "enum": [ - "MONTH" - ], - "description": "The expiration period." - }, - "period_value": { - "type": "integer", - "description": "How many periods should pass before the expiration occurs." - }, - "rounding_type": { - "type": "string", - "enum": [ - "END_OF_MONTH", - "END_OF_QUARTER", - "END_OF_HALF_YEAR", - "END_OF_YEAR", - "PARTICULAR_MONTH" - ], - "description": "Round up expiration till the end of the given period type." + }, + "res_empty_json": { + "type": "object", + "description": "Schema model for an empty json.", + "title": "Empty JSON", + "examples": [ + {} + ] + }, + "2_obj_campaign_object": { + "type": "object", + "title": "Campaign Object", + "description": "This is an object representing a campaign.", + "x-tags": [ + "CAMPAIGNS API" + ], + "properties": { + "id": { + "type": "string", + "description": "Unique campaign ID, assigned by Voucherify.", + "example": "camp_f7fBbQxUuTN7dI7tGOo5XMDA" + }, + "name": { + "type": "string", + "description": "Campaign name." + }, + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "campaign_type": { + "type": "string", + "enum": [ + "LOYALTY_PROGRAM", + "GIFT_VOUCHERS", + "DISCOUNT_COUPONS", + "PROMOTION", + "REFERRAL_PROGRAM", + "LUCKY_DRAW" + ], + "description": "Type of campaign." + }, + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria \n- `STATIC`: vouchers need to be manually published", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + }, + "voucher": { + "anyOf": [ + { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" + }, + { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_GIFT_CARD" + }, + { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_LOYALTY_CARD" + } + ] + }, + "auto_join": { + "type": "boolean", + "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "use_voucher_metadata_schema": { + "type": "boolean", + "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + } } - } - } - } - }, - "redemption": { - "type": "object", - "description": "Defines the redemption limits on vouchers.", - "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited." - } - } - }, - "code_config": { - "type": "object", - "description": "Defines code's pattern (prefix, suffix, length, charset, etc). ", - "properties": { - "length": { - "type": "string", - "description": "Number of characters in a generated code (excluding prefix and postfix)." - }, - "charset": { - "type": "string", - "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" - }, - "prefix": { - "type": "string", - "description": "A text appended before the code." - }, - "postfix": { - "type": "string", - "description": "A text appended after the code." - }, - "pattern": { - "type": "string", - "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." - } - } - } - } - }, - "3_obj_promotion_tier_object": { - "type": "object", - "description": "This is an object representing a promotion tier. Promotion tiers are always assigned to a campaign and cannot be used standalone.", - "title": "Promotion Tier Object", - "x-tags": [ - "PROMOTIONS API" - ], - "properties": { - "id": { - "type": "string", - "example": "promo_63fYCt81Aw0h7lzyRkrGZh9p", - "description": "Unique promotion tier ID." - }, - "created_at": { - "type": "string", - "example": "2021-12-15T11:34:01.333Z", - "format": "date-time", - "description": "Timestamp representing the date and time when the promotion tier was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "example": "2022-02-09T09:20:05.603Z", - "format": "date-time", - "description": "Timestamp representing the date and time when the promotion tier was updated in ISO 8601 format." - }, - "name": { - "type": "string", - "description": "Name of the promotion tier." - }, - "banner": { - "type": "string", - "description": "Text to be displayed to your customers on your website." - }, - "action": { - "type": "object", - "description": "Contains details about the discount applied by the promotion tier.", - "properties": { - "discount": { - "anyOf": [ - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" } - ], - "description": "The type of discount that will be applied to a customer's order." + }, + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "vouchers_count": { + "type": "integer", + "description": "Total number of unique vouchers in campaign." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2021-12-01T08:00:50.038Z", + "description": "Timestamp representing the date and time when the campaign was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-09-20T09:18:19.623Z", + "description": "Timestamp representing the date and time when the voucher was updated in ISO 8601 format." + }, + "category": { + "type": "string", + "description": "Unique category name." + }, + "creation_status": { + "type": "string", + "enum": [ + "DONE", + "IN_PROGRESS", + "FAILED", + "DRAFT", + "MODIFYING" + ], + "description": "Indicates the status of the campaign creation." + }, + "vouchers_generation_status": { + "type": "string", + "description": "Indicates the status of the campaign's vouchers.", + "enum": [ + "DONE", + "IN_PROGRESS", + "FAILED", + "DRAFT" + ] + }, + "protected": { + "type": "boolean", + "description": "Indicates whether the resource can be deleted." + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to.", + "example": "cat_0b688929a2476386a7" + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" + }, + "object": { + "type": "string", + "default": "campaign", + "description": "The type of object represented by JSON. This object stores information about the campaign." + }, + "referral_program": { + "type": "object", + "description": "Defines the referee reward and the way a referral is triggered. Context: `REFERRAL_PROGRAM`.", + "properties": { + "conversion_event_type": { + "type": "string", + "enum": [ + "redemption", + "custom_event" + ], + "description": "How a referral is triggered." + }, + "custom_event": { + "type": "object", + "description": "Contains details about the custom event.", + "properties": { + "id": { + "type": "string", + "example": "ms_fi47Dcu5T0m3v3nT5ch3ma", + "description": "Unique custom event ID." + }, + "name": { + "type": "string", + "description": "Custom event name." + } + } + }, + "referee_reward": { + "type": "object", + "description": "Defines the referee reward.", + "properties": { + "related_object_parent": { + "type": "object", + "description": "Details of the resource from which the reward originates.", + "properties": { + "id": { + "type": "string", + "description": "Unique ID of the reward source." + }, + "name": { + "type": "string", + "description": "Name of the reward source." + }, + "object": { + "type": "string", + "description": "Type of resource represented by the source of the reward." + } + } + }, + "type": { + "type": "string", + "description": "Type of reward.", + "enum": [ + "LOYALTY_CARD", + "GIFT_VOUCHER" + ] + }, + "amount": { + "type": "string", + "description": "The number of `points` to add to a loyalty card or `credits` to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + } + } + } + } + }, + "promotion": { + "$ref": "#/components/schemas/3_res_list_promotion_tiers_from_campaign" + }, + "loyalty_tiers_expiration": { + "type": "object", + "description": "Defines the expiration mechanism for loyalty tiers.", + "anyOf": [ + { + "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance" + }, + { + "$ref": "#/components/schemas/2_loyalty_tiers_expiration_points_in_period" + } + ] + } } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." - }, - "hierarchy": { - "type": "integer", - "description": "The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy." - }, - "campaign": { - "type": "object", - "description": "Contains details about promotion tier's parent campaign.", - "properties": { - "id": { - "type": "string", - "description": "Unique campaign ID." - }, - "start_date": { - "type": "string", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "format": "date-time", - "example": "2022-09-22T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + }, + "2_loyalty_tiers_expiration_balance": { + "title": "Balance", + "type": "object", + "description": "Defines the Balance expiration mechanism for loyalty tiers.", + "properties": { + "qualification_type": { + "type": "string", + "enum": [ + "BALANCE" + ], + "description": "Tier qualification. \n\n`BALANCE`: Points balance is based on the customer's current points balance. Customers qualify for the tier if their points balance is in the points range of the tier." + }, + "start_date": { + "type": "object", + "description": "Defines the conditions for the start date of the tier.", + "properties": { + "type": { + "type": "string", + "enum": [ + "IMMEDIATE" + ], + "description": "What triggers the tier to be valid for a customer. \n`IMMEDIATE`: After reaching the minimum required points." + } } + }, + "expiration_date": { + "description": "Defines the conditions for the expiration date of a tier.", + "anyOf": [ + { + "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance_expiration_date_balance_drop" + }, + { + "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance_expiration_date_custom" + } + ] } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" + } + }, + "2_loyalty_tiers_expiration_balance_expiration_date_balance_drop": { + "title": "Balance Drop", + "type": "object", + "description": "Defines the conditions for the expiration date of a tier based on a pure balance drop.", + "properties": { + "type": { + "type": "string", + "enum": [ + "BALANCE_DROP" + ], + "description": "What triggers the tier to expire for a customer. \n`BALANCE_DROP`: Tier expires when the points balance drops below the required range of the tier." } - }, - "active": { - "type": "boolean", - "description": "A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" - }, - "category_id": { - "type": "string", - "example": "cat_0b688929a2476386a6", - "description": "Unique category ID that this campaign belongs to." - }, - "object": { - "type": "string", - "description": "The type of object represented by the campaign object. This object stores information about the campaign.", - "default": "campaign" } - } - }, - "campaign_id": { - "type": "string", - "description": "Promotion tier's parent campaign's unique ID." - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* promotion tier\n- `false` indicates an *inactive* promotion tier" - }, - "start_date": { - "type": "string", - "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ", - "format": "date-time", - "example": "2022-09-23T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ", - "format": "date-time", - "example": "2022-09-26T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the promotion tier is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a promotion tier with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the promotion tier will be active in ISO 8601 format. For example, a promotion tier with a `duration` of `P1D` will be valid for a duration of one day." + }, + "2_loyalty_tiers_expiration_balance_expiration_date_custom": { + "title": "Custom", + "type": "object", + "description": "Defines the custom conditions for the expiration date of a tier.", + "properties": { + "type": { + "type": "string", + "enum": [ + "CUSTOM" + ], + "description": "What triggers the tier to expire for a customer. \n`CUSTOM`: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier." + }, + "extend": { + "type": "string", + "description": "Defines the amount of time the tier will remain active in ISO 8601 format. The expiration date counter starts at the moment when the customer reaches the minimum required points that are required to be in the tier. For example, a tier with a duration of P3M will be valid for a duration of 3 months." + }, + "rounding": { + "description": "Defines the rounding mechanism for tier expiration.", + "anyOf": [ + { + "$ref": "#/components/schemas/2_loyalty_tiers_expiration_expiration_date_rounding_default_options" + }, + { + "$ref": "#/components/schemas/2_loyalty_tiers_expiration_expiration_date_rounding_custom" + } + ] + } } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the promotion tier is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "summary": { - "type": "object", - "description": "Contains statistics about promotion tier redemptions and orders.", - "properties": { - "redemptions": { - "type": "object", - "description": "Contains statistics about promotion tier redemptions.", - "properties": { - "total_redeemed": { - "type": "integer", - "description": "Number of times the promotion tier was redeemed." - } + }, + "2_loyalty_tiers_expiration_expiration_date_rounding_default_options": { + "title": "Calendar Periods", + "type": "object", + "description": "Defines the rounding mechanism for tier expiration based on a list of available time periods.", + "properties": { + "type": { + "type": "string", + "enum": [ + "MONTH", + "QUARTER", + "HALF_YEAR", + "YEAR" + ], + "description": "Period to which the expiration will be rounded to. \n- `MONTH`: The expiration date will be rounded to the end of the month. \n- `QUARTER`: The expiration date will be rounded to the end of the quarter. \n- `HALF_YEAR`: The expiration date will be rounded to the half year. \n- `YEAR`: The expiration date will be rounded to the end of the year." + }, + "strategy": { + "type": "string", + "description": "Which portion of the given period should the rounding be applied to.", + "enum": [ + "END" + ] } - }, - "orders": { - "type": "object", - "description": "Contains statistics about orders related to the promotion tier.", - "properties": { - "total_amount": { - "type": "integer", - "description": "Sum of order totals." - }, - "total_discount_amount": { - "type": "integer", - "description": "Sum of total discount applied using the promotion tier." - } + } + }, + "2_loyalty_tiers_expiration_expiration_date_rounding_custom": { + "title": "Specific Month", + "type": "object", + "description": "Defines the custom rounding mechanism for tier expiration.", + "properties": { + "type": { + "type": "string", + "enum": [ + "CUSTOM" + ], + "description": "This mechanism describes a custom rounding for the expiration date." + }, + "strategy": { + "type": "string", + "description": "Which portion of the given period should the rounding be applied to.", + "enum": [ + "END" + ] + }, + "unit": { + "type": "string", + "description": "Defines the type of unit of time in which the rounding period is counted.", + "enum": [ + "MONTH" + ] + }, + "value": { + "type": "integer", + "description": "Value for the unit of time that the rounding applies to. Units for this parameter are defined by the `rounding.unit` parameter. \n- `0`: January\n- `1`: February\n- `2`: March\n- `3`: April\n- `4`: May\n- `5`: June\n- `6`: July\n- `7`: August\n- `8`: September\n- `9`: October\n- `10`: November\n- `11`: December" } } - } - }, - "object": { - "type": "string", - "default": "promotion_tier", - "description": "The type of object represented by JSON. This object stores information about the promotion tier." - }, - "validation_rule_assignments": { - "$ref": "#/components/schemas/13_res_validation-rules_validationRuleId_assignments" - }, - "category_id": { - "type": "string", - "description": "Promotion tier category ID.", - "example": "cat_0c9da30e7116ba6bba" - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object", - "description": "Details about the category assigned to the promotion tier." - } - } - }, - "3_req_add_promotion_tier_to_campaign": { - "type": "object", - "description": "Request body schema for creating a promotion tier within a campaign in **POST** `/promotions/{campaignId}/tiers`.", - "title": "Add Promotion Tier to Campaign Request Body", - "properties": { - "name": { - "type": "string", - "description": "Name of the promotion tier." - }, - "banner": { - "type": "string", - "description": "Text to be displayed to your customers on your website.\t" - }, - "action": { - "type": "object", - "description": "Contains details about the discount applied by the promotion tier.", - "properties": { - "discount": { - "anyOf": [ - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" + }, + "2_loyalty_tiers_expiration_points_in_period": { + "title": "Points in Period", + "type": "object", + "description": "Defines the Points in Period expiration mechanism for loyalty tiers.", + "properties": { + "qualification_type": { + "type": "string", + "enum": [ + "POINTS_IN_PERIOD" + ], + "description": "Tier qualification. \n\n`POINTS_IN_PERIOD`: A customer qualifies for the tier only if the sum of the accumulated points in a **defined time interval** reaches the tier threshold." + }, + "qualification_period": { + "type": "string", + "description": "Customers can qualify for the tier if they collected enough points in a given time period. So, in addition to the customer having to reach a points range, they also need to have collected the points within a set time period. \n\n| **Period** | **Definition** |\n|:---|:---|\n| **Calendar Month** | Points collected in one calendar month
January, February, March, etc. |\n| **Calendar Quarter** | Points collected in the quarter
- January - March
- April - June
- July - September
- October - December |\n| **Calendar Half-year** | Points collected in the half-year
- January - June
- July - December |\n| **Calendar Year** | Points collected in one calendar year
January - December |", + "enum": [ + "MONTH", + "QUARTER", + "HALF_YEAR", + "YEAR" + ] + }, + "start_date": { + "type": "object", + "description": "Defines the conditions for the start date of the tier.", + "properties": { + "type": { + "type": "string", + "enum": [ + "IMMEDIATE", + "NEXT_PERIOD" + ], + "description": "What triggers the tier to be valid for a customer. \n`IMMEDIATE`: After reaching the minimum required points. \n`NEXT_PERIOD`: When the next qualification period starts." + } } - ], - "description": "The type of discount that will be applied to a customer's order." + }, + "expiration_date": { + "type": "object", + "description": "Defines the conditions for the expiration date of a tier.", + "properties": { + "type": { + "type": "string", + "enum": [ + "END_OF_PERIOD", + "END_OF_NEXT_PERIOD" + ], + "description": "What triggers the tier to expire for a customer. \n`END_OF_PERIOD`: Expire tier at the end of the period. \n`END_OF_NEXT_PERIOD`: Expire tier at the end of the next period." + }, + "extend": { + "type": "string", + "description": "Extend the expiration by adding extra months or days in ISO 8601 format. The tier will remain active even though it reaches its expiration time period. For example, a tier with a duration of `P3M` will be valid for an additional duration of 3 months and a tier with a duration of `P1D` will be valid for an additional duration of 1 day." + } + } + } } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* promotion tier\n- `false` indicates an *inactive* promotion tier" - }, - "start_date": { - "type": "string", - "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ", - "format": "date-time", - "example": "2022-09-23T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ", - "format": "date-time", - "example": "2022-09-26T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the promotion tier is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a promotion tier with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the promotion tier will be active in ISO 8601 format. For example, a promotion tier with a `duration` of `P1D` will be valid for a duration of one day." + }, + "2_req_create_campaign": { + "title": "Create Campaign Request Body", + "description": "Request body schema for **POST** `/campaigns`.", + "oneOf": [ + { + "$ref": "#/components/schemas/2_req_create_campaign_discount_voucher" + }, + { + "$ref": "#/components/schemas/2_req_create_campaign_loyalty" + }, + { + "$ref": "#/components/schemas/2_req_create_campaign_gift" + }, + { + "$ref": "#/components/schemas/2_req_create_campaign_promotion" + }, + { + "$ref": "#/components/schemas/2_req_create_campaign_referral" + } + ] + }, + "2_req_create_campaign_discount_voucher": { + "type": "object", + "title": "Discount Campaign", + "description": "Request body schema for creating a discount voucher campaign using **POST** `/campaigns`.", + "properties": { + "name": { + "type": "string", + "description": "Campaign name." + }, + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "campaign_type": { + "type": "string", + "default": "DISCOUNT_COUPONS", + "description": "Type of campaign." + }, + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "use_voucher_metadata_schema": { + "type": "boolean", + "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." + }, + "vouchers_count": { + "type": "integer", + "description": "Total number of unique vouchers in campaign (size of campaign)." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", + "example": "cat_0b688929a2476386a7" + }, + "category": { + "type": "string", + "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + }, + "voucher": { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" + } } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the promotion tier is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "validation_rules": { - "type": "array", - "description": "Array containing the ID of the validation rule associated with the promotion tier.", - "items": { - "type": "string" - } - }, - "category": { - "type": "string", - "description": "Assign category to the promotion tier." - }, - "category_id": { - "type": "string", - "description": "Instead of using the category name, you can alternatively assign a new category to a promotion tier using a unique category ID, i.e. `cat_0c9da30e7116ba6bba`.", - "example": "cat_0c9da30e7116ba6bba" - } - } - }, - "3_req_update_promotion_tier": { - "type": "object", - "description": "Request body schema for updating a promotion tier within a campaign in **POST** `/promotions/tiers/{promotionTierId}`.", - "title": "Update Promotion Tier Request Body", - "properties": { - "name": { - "type": "string", - "description": "Name of the promotion tier." - }, - "banner": { - "type": "string", - "description": "Text to be displayed to your customers on your website.\t" - }, - "action": { - "type": "object", - "description": "Contains details about the discount applied by the promotion tier.", - "properties": { - "discount": { - "anyOf": [ - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" + }, + "2_req_create_campaign_loyalty": { + "type": "object", + "title": "Loyalty Campaign", + "description": "Request body schema for creating a loyalty campaign using **POST** `/campaigns`.", + "properties": { + "name": { + "type": "string", + "description": "Campaign name." + }, + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "campaign_type": { + "type": "string", + "default": "LOYALTY_PROGRAM", + "description": "Type of campaign." + }, + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + }, + "auto_join": { + "type": "boolean", + "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. CONTEXT: `LOYALTY_PROGRAM`." + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "use_voucher_metadata_schema": { + "type": "boolean", + "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." + }, + "vouchers_count": { + "type": "integer", + "description": "Total number of unique vouchers in campaign (size of campaign)." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + } } - ], - "description": "The type of discount that will be applied to a customer's order." + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", + "example": "cat_0b688929a2476386a7" + }, + "category": { + "type": "string", + "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + }, + "voucher": { + "$ref": "#/components/schemas/2_req_campaign_object_voucher_object_LOYALTY_CARD" + } } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." - }, - "start_date": { - "type": "string", - "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ", - "format": "date-time", - "example": "2022-09-23T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ", - "format": "date-time", - "example": "2022-09-26T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the promotion tier is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a promotion tier with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the promotion tier will be active in ISO 8601 format. For example, a promotion tier with a `duration` of `P1D` will be valid for a duration of one day." + }, + "2_req_create_campaign_gift": { + "type": "object", + "title": "Gift Card campaign", + "description": "Request body schema for creating a gift card campaign using **POST** `/campaigns`.", + "properties": { + "name": { + "type": "string", + "description": "Campaign name." + }, + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "campaign_type": { + "type": "string", + "default": "GIFT_VOUCHERS", + "description": "Type of campaign." + }, + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "use_voucher_metadata_schema": { + "type": "boolean", + "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." + }, + "vouchers_count": { + "type": "integer", + "description": "Total number of unique vouchers in campaign (size of campaign)." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", + "example": "cat_0b688929a2476386a7" + }, + "category": { + "type": "string", + "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + }, + "voucher": { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_GIFT_CARD" + } } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the promotion tier is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "hierarchy": { - "type": "integer", - "description": "The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. If you update a hierarchy of a promotion tier, then the remaining promotion tier hierarchies will be recalculated." - }, - "category": { - "type": "string", - "description": "Assign a new or update the promotion tier's category." - }, - "category_id": { - "type": "string", - "description": "Instead of using the category name, you can alternatively assign a new category to a promotion tier using a unique category ID, i.e. `cat_0c9da30e7116ba6bba`.", - "example": "cat_0c9da30e7116ba6bba" - } - } - }, - "3_res_list_promotion_tiers": { - "type": "object", - "description": "Promotion Tiers", - "title": "Promotion Tiers", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about promotion tiers in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "tiers", - "description": "Identifies the name of the attribute that contains the array of promotion tier objects." - }, - "tiers": { - "type": "array", - "description": "Contains array of promotion tier objects.", - "items": { - "$ref": "#/components/schemas/3_obj_promotion_tier_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of promotion tiers." - } - } - }, - "3_res_list_promotion_stacks": { - "type": "object", - "description": "Promotion Stacks", - "title": "Promotion Stacks", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about promotion stacks in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of promotion stack objects." - }, - "data": { - "type": "array", - "description": "Contains array of promotion stack objects.", - "items": { - "$ref": "#/components/schemas/3_obj_promotion_stack_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of promotion stacks." - } - } - }, - "3_obj_promotion_stack_object": { - "type": "object", - "title": "Promotion Stack Object", - "description": "Model schema for a promotion stack.", - "properties": { - "id": { - "type": "string", - "example": "stack_p0WhtyyDU95crobleMpRabhH", - "description": "Unique promotion stack ID." - }, - "name": { - "type": "string", - "description": "Promotion stack name." - }, - "created_at": { - "type": "string", - "example": "2022-09-22T13:03:25.740Z", - "format": "date-time", - "description": "Timestamp representing the date and time when the promotion stack was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "example": "2022-09-23T07:59:44.172Z", - "format": "date-time", - "description": "Timestamp representing the date and time when the promotion stack was updated in ISO 8601 format." - }, - "campaign_id": { - "type": "string", - "example": "camp_99HUWI53bVyLzPN1Fg5TBLWX", - "description": "Promotion stack's parent campaign's unique ID." - }, - "object": { - "type": "string", - "default": "promotion_stack", - "description": "The type of object represented by JSON. This object stores information about the promotion tier." - }, - "tiers": { - "type": "object", - "description": "Contains the tier configuration.", - "properties": { - "ids": { - "type": "array", - "description": "Contains the list of tiers in a pre-defined sequence.", - "items": { - "type": "string" + }, + "2_req_create_campaign_referral": { + "type": "object", + "title": "Referral Campaign", + "description": "Request body schema for creating a referral campaign using **POST** `/campaigns`.", + "properties": { + "name": { + "type": "string", + "description": "Campaign name." + }, + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "campaign_type": { + "type": "string", + "default": "REFERRAL_PROGRAM", + "description": "Type of campaign." + }, + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "use_voucher_metadata_schema": { + "type": "boolean", + "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." + }, + "vouchers_count": { + "type": "integer", + "description": "Total number of unique vouchers in campaign (size of campaign)." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", + "example": "cat_0b688929a2476386a7" + }, + "category": { + "type": "string", + "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + }, + "voucher": { + "anyOf": [ + { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" + }, + { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_GIFT_CARD" + }, + { + "$ref": "#/components/schemas/2_req_campaign_object_voucher_object_LOYALTY_CARD" + } + ] + }, + "referral_program": { + "description": "Defines the referee reward and the way a referral is triggered. Context: `REFERRAL_PROGRAM`.", + "type": "object", + "properties": { + "conversion_event_type": { + "type": "string", + "enum": [ + "redemption", + "custom_event" + ], + "description": "Define how a referral is triggered." + }, + "custom_event": { + "type": "object", + "description": "Contains details about the custom event.", + "properties": { + "id": { + "type": "string", + "example": "ms_Ll9enAm2BCN0M1s4VxWobLFM", + "description": "Unique custom event ID." + }, + "name": { + "type": "string", + "description": "Custom event name." + } + } + }, + "referee_reward": { + "type": "object", + "description": "Defines the referee reward.", + "properties": { + "related_object_parent": { + "type": "object", + "description": "Details of the resource from which the reward originates.", + "properties": { + "id": { + "type": "string", + "example": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", + "description": "Unique ID of the reward source." + }, + "name": { + "type": "string", + "description": "Name of the reward source." + }, + "object": { + "type": "string", + "enum": [ + "CAMPAIGN" + ], + "description": "Type of resource represented by the source of the reward." + } + } + }, + "type": { + "type": "string", + "enum": [ + "LOYALTY_CARD", + "GIFT_VOUCHER" + ], + "description": "Type of reward." + }, + "amount": { + "type": "string", + "description": "Define the number of `points` to add to a loyalty card or `credits` to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + } + } + } + } } - }, - "hierarchy_mode": { - "type": "string", - "default": "MANUAL" } - } - }, - "category_id": { - "type": "string", - "description": "Promotion stack category ID.", - "example": "cat_0c9da30e7116ba6bba" - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object", - "description": "Details about the category assigned to the promotion stack." - } - } - }, - "3_req_create_promotion_stack": { - "type": "object", - "title": "Create Promotion Stack Request Body", - "description": "Model schema for a creating a promotion stack using **POST** `/promotions/{campaignId}/stacks`.", - "properties": { - "name": { - "type": "string", - "description": "Promotion stack name." - }, - "tiers": { - "type": "object", - "description": "Contains the tier configuration.", - "properties": { - "ids": { - "type": "array", - "description": "Contains the list of tiers in a pre-defined sequence.", - "items": { - "type": "string" + }, + "2_req_create_campaign_promotion": { + "type": "object", + "title": "Promotion", + "description": "Request body schema for creating a promotions campaign using **POST** `/campaigns`.", + "properties": { + "name": { + "type": "string", + "description": "Campaign name." + }, + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "campaign_type": { + "type": "string", + "default": "PROMOTION", + "description": "Type of campaign." + }, + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "use_voucher_metadata_schema": { + "type": "boolean", + "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." + }, + "vouchers_count": { + "type": "integer", + "description": "Total number of unique vouchers in campaign (size of campaign)." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", + "example": "cat_0b688929a2476386a7" + }, + "category": { + "type": "string", + "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + }, + "promotion": { + "type": "object", + "description": "Define the promotion tiers within the campaign.", + "properties": { + "tiers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/3_req_add_promotion_tier_to_campaign" + } + } + } } - }, - "hierarchy_mode": { - "type": "string", - "example": "MANUAL" } - } - }, - "category": { - "type": "string", - "description": "Assign a category." - }, - "category_id": { - "type": "string", - "description": "Instead of using the category name, you can alternatively assign a new category to a promotion stack using a unique category ID, i.e. `cat_0c9da30e7116ba6bba`.", - "example": "cat_0c9da30e7116ba6bba" - } - } - }, - "3_res_list_promotion_tiers_from_campaign": { - "type": "object", - "description": "Promotion Tiers", - "title": "Promotion Tiers", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about promotion tiers in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "tiers", - "description": "Identifies the name of the attribute that contains the array of promotion tier objects." - }, - "tiers": { - "type": "array", - "description": "Contains array of promotion tier objects.", - "items": { - "$ref": "#/components/schemas/3_obj_promotion_tier_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of promotion tiers." - }, - "has_more": { - "type": "boolean", - "description": "As query results are always limited (by the limit parameter), the `has_more` flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results." - } - } - }, - "4_obj_reward_object": { - "title": "Reward Object", - "type": "object", - "description": "This is an object representing a reward.", - "x-tags": [ - "REWARDS API" - ], - "properties": { - "id": { - "type": "string", - "example": "rew_nIy4gHpQHle2c3pNMwuj7G6j", - "description": "Unique reward ID, assigned by Voucherify." - }, - "name": { - "type": "string", - "description": "Reward name." - }, - "type": { - "type": "string", - "enum": [ - "CAMPAIGN", - "COIN", - "MATERIAL" - ], - "description": "Reward type." - }, - "parameters": { - "oneOf": [ - { - "$ref": "#/components/schemas/4_obj_reward_object_parameters_CAMPAIGN" - }, - { - "$ref": "#/components/schemas/4_obj_reward_object_parameters_COIN" - }, - { - "$ref": "#/components/schemas/4_obj_reward_object_parameters_MATERIAL" - } - ], - "description": "Defines how the reward is generated." - }, - "stock": { - "type": "integer", - "description": "Configurable for **material rewards**. The number of units of the product that you want to share as reward." - }, - "redeemed": { - "type": "integer", - "description": "Defines the number of already invoked (successful) reward redemptions.\t" - }, - "attributes": { - "type": "object", - "description": "These properties are configurable for **material rewards**.", - "properties": { - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file." - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a material reward." - } - } - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the reward was created in ISO 8601 format.", - "example": "2022-08-11T14:49:22.586Z", - "format": "date-time" - }, - "updated_at": { - "type": [ - "string", - "null" - ], - "description": "Timestamp representing the date and time when the reward was updated in ISO 8601 format.", - "example": "2022-08-11T16:01:34.885Z", - "format": "date-time" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." - }, - "object": { - "type": "string", - "default": "reward", - "description": "The type of object represented by the JSON. This object stores information about the reward." - } - } - }, - "4_obj_reward_object_parameters_CAMPAIGN": { - "title": "Digital", - "type": "object", - "description": "These are parameters representing a digital (CAMPAIGN) reward. These can be in the form of discount coupons, gift card credits, or loyalty point credits.", - "properties": { - "campaign": { - "description": "Objects stores information about the campaign related to the reward.", - "anyOf": [ - { - "$ref": "#/components/schemas/4_obj_reward_object_parameters_CAMPAIGN_DISCOUNT_COUPONS" - }, - { - "$ref": "#/components/schemas/4_obj_reward_object_parameters_CAMPAIGN_GIFT_VOUCHERS" - }, - { - "$ref": "#/components/schemas/4_obj_reward_object_parameters_CAMPAIGN_LOYALTY_PROGRAM" - } - ] - } - } - }, - "4_obj_reward_object_parameters_CAMPAIGN_DISCOUNT_COUPONS": { - "title": "Discount Coupons", - "type": "object", - "description": "These are parameters representing a discount coupon, which is a subset of a Digital (CAMPAIGN) reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique campaign ID, assigned by Voucherify.", - "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" - }, - "type": { - "type": "string", - "description": "Campaign type.", - "default": "DISCOUNT_COUPONS" - } - } - }, - "4_obj_reward_object_parameters_CAMPAIGN_GIFT_VOUCHERS": { - "title": "Gift Vouchers", - "type": "object", - "description": "These are parameters representing a gift voucher, which is a subset of a Digital (CAMPAIGN) reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique campaign ID, assigned by Voucherify.", - "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" - }, - "balance": { - "type": "integer", - "description": "The incremental amout to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "type": { - "type": "string", - "description": "Campaign type.", - "default": "GIFT_VOUCHERS" - } - } - }, - "4_obj_reward_object_parameters_CAMPAIGN_LOYALTY_PROGRAM": { - "title": "Points on loyalty card", - "type": "object", - "description": "These are parameters representing points on a loyalty card, which is a subset of a Digital (CAMPAIGN) reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique campaign ID, assigned by Voucherify.", - "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" - }, - "balance": { - "type": "integer", - "description": "The incremental points to be added to the current balance on the loyalty card." - }, - "type": { - "type": "string", - "description": "Campaign type.", - "default": "LOYALTY_PROGRAM" - } - } - }, - "4_obj_reward_object_parameters_COIN": { - "title": "Pay with Points", - "type": "object", - "description": "These are parameters representing a Pay with Points (COIN) reward. ", - "properties": { - "coin": { - "type": "object", - "description": "Defines the ratio by mapping the number of loyalty points in `points_ratio` to a predefined cash amount in `exchange_ratio`.", - "properties": { - "exchange_ratio": { - "type": "integer", - "description": "The cash equivalent of the points defined in the `points_ratio` property." - }, - "points_ratio": { - "type": "integer", - "description": "The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property." - } - } - } - } - }, - "4_obj_reward_object_parameters_MATERIAL": { - "title": "Material", - "type": "object", - "description": "These are parameters representing products as a (MATERIAL) reward.", - "properties": { - "product": { - "type": "object", - "description": "Contains information about the product given as a reward.", - "properties": { - "id": { - "type": "string", - "example": "prod_0b7d7dfb05cbe5c616", - "description": "Unique product ID, assigned by Voucherify. " - }, - "sku_id": { - "type": [ - "string", - "null" - ], - "description": "Unique SKU ID, assigned by Voucherify, of the SKU given as a reward.", - "example": "sku_0b7d7dfb090be5c619" - } - } - } - } - }, - "4_req_create_reward": { - "title": "Create Reward Request Body", - "description": "Request body schema for **POST** `/rewards`.", - "anyOf": [ - { - "$ref": "#/components/schemas/4_req_create_reward_CAMPAIGN" - }, - { - "$ref": "#/components/schemas/4_req_create_reward_MATERIAL" - }, - { - "$ref": "#/components/schemas/4_req_create_reward_COIN" - } - ] - }, - "4_req_create_reward-copy": { - "title": "Create Reward Request Body", - "type": "object", - "description": "Request body schema for **POST** `/rewards`.", - "properties": { - "name": { - "type": "string", - "description": "Reward name." - }, - "type": { - "type": "string", - "enum": [ - "CAMPAIGN", - "COIN", - "MATERIAL" - ], - "description": "Reward type." - }, - "parameters": { - "oneOf": [ - { - "$ref": "#/components/schemas/4_req_reward_parameters_COIN" - }, - { - "$ref": "#/components/schemas/4_req_reward_parameters_MATERIAL" - }, - { - "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN" + }, + "2_req_update_campaign": { + "type": "object", + "title": "Update Campaign Request Body", + "description": "Request body schema for **PUT** `/campaigns/{campaignId}`.", + "properties": { + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + }, + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "auto_join": { + "type": "boolean", + "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to. Either pass this parameter or the `category` parameter.", + "example": "cat_0b688929a2476386a7" + }, + "category": { + "type": "string", + "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id` parameter." + } } - ], - "description": "Defines how the reward is generated." - }, - "stock": { - "type": "integer", - "description": "Configurable for material rewards. The number of units of the product that you want to share as a reward." - }, - "attributes": { - "type": "object", - "description": "These properties are configurable for material rewards.", - "properties": { - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file." - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a material reward." + }, + "2_req_add_vouchers_to_campaign": { + "type": "object", + "title": "Add Vouchers to Campaign Request Body", + "description": "Request body schema for **POST** `/campaigns/{campaignId}/vouchers`.", + "properties": { + "category_id": { + "type": "string", + "description": "Unique category ID that you would like to assign to the voucher.", + "example": "cat_0b688929a2476386a7" + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + }, + "redemption": { + "type": "object", + "description": "Stores the quantity of redemptions that can be applied to the voucher.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } + }, + "additional_info": { + "type": "string", + "description": "An optional field to keep any extra textual information about the code such as a code description and details." + }, + "code_config": { + "type": "object", + "description": "Defines code's pattern (prefix, suffix, length, charset, etc). ", + "properties": { + "length": { + "type": "string", + "description": "Number of characters in a generated code (excluding prefix and postfix)." + }, + "charset": { + "type": "string", + "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" + }, + "prefix": { + "type": "string", + "description": "A text appended before the code." + }, + "postfix": { + "type": "string", + "description": "A text appended after the code." + }, + "pattern": { + "type": "string", + "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." + } + } + } } - } - }, - "metadata": { - "type": "string", - "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." - } - } - }, - "4_req_create_reward_CAMPAIGN": { - "title": "Digital Reward", - "type": "object", - "description": "Request body schema for creating a digital reward using **POST** `/rewards`.", - "properties": { - "name": { - "type": "string", - "description": "Reward name." - }, - "type": { - "type": "string", - "enum": [ - "CAMPAIGN" - ], - "description": "Reward type." - }, - "parameters": { - "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN" - }, - "metadata": { - "type": "string", - "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." - } - } - }, - "4_req_create_reward_COIN": { - "title": "Pay with Points Reward", - "type": "object", - "description": "Request body schema for creating a pay with points reward using **POST** `/rewards`.", - "properties": { - "name": { - "type": "string", - "description": "Reward name." - }, - "type": { - "type": "string", - "enum": [ - "COIN" - ], - "description": "Reward type." - }, - "parameters": { - "$ref": "#/components/schemas/4_req_reward_parameters_COIN" - }, - "metadata": { - "type": "string", - "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." - } - } - }, - "4_req_create_reward_MATERIAL": { - "title": "Material Reward", - "type": "object", - "description": "Request body schema to create a material reward using\n **POST** `/rewards`.", - "properties": { - "name": { - "type": "string", - "description": "Reward name." - }, - "type": { - "type": "string", - "enum": [ - "MATERIAL" - ], - "description": "Reward type." - }, - "parameters": { - "$ref": "#/components/schemas/4_req_reward_parameters_MATERIAL" - }, - "stock": { - "type": "integer", - "description": "The number of units of the product that you want to share as a reward." - }, - "attributes": { - "type": "object", - "description": "These properties are configurable for material rewards.", - "properties": { - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file." - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a material reward." + }, + "2_req_add_vouchers_with_specific_code_to_campaign": { + "type": "object", + "title": "Add Vouchers with Specific Code to Campaign Request Body", + "description": "Request body schema for **POST** `/campaigns/{campaignId}/vouchers/{code}`.", + "properties": { + "category_id": { + "type": "string", + "description": "Unique category ID that you would like to assign to the voucher.", + "example": "cat_0b688929a2476386a7" + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + }, + "redemption": { + "type": "object", + "description": "Stores the quantity of redemptions that can be applied to the voucher.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } + }, + "additional_info": { + "type": "string", + "description": "An optional field to keep any extra textual information about the code such as a code description and details." + } } - } - }, - "metadata": { - "type": "string", - "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." - } - } - }, - "4_req_update_reward": { - "title": "Update Reward Request Body", - "description": "Request body schema for **PUT** `/rewards/{rewardId}`.", - "anyOf": [ - { - "$ref": "#/components/schemas/4_req_update_reward_CAMPAIGN" - }, - { - "$ref": "#/components/schemas/4_req_update_reward_COIN" - }, - { - "$ref": "#/components/schemas/4_req_update_reward_MATERIAL" - } - ] - }, - "4_req_update_reward-copy": { - "title": "Update Reward Request Body", - "type": "object", - "description": "Request body schema for **PUT** `/rewards/{rewardId}`.", - "properties": { - "name": { - "type": "string", - "description": "Reward name." - }, - "parameters": { - "oneOf": [ - { - "$ref": "#/components/schemas/4_req_reward_parameters_COIN" - }, - { - "$ref": "#/components/schemas/4_req_reward_parameters_MATERIAL" - }, - { - "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN" + }, + "2_req_import_vouchers_to_campaign": { + "type": "array", + "title": "Import Vouchers to Campaign Request Body", + "description": "Request body schema for **POST** `/campaigns/{campaignId}/import`.", + "items": { + "$ref": "#/components/schemas/2_obj_import_vouchers_to_campaign_object" } - ], - "description": "Defines how the reward is generated." - }, - "stock": { - "type": "integer", - "description": "Configurable for material rewards. The number of units of the product that you want to share as a reward." - }, - "attributes": { - "type": "object", - "description": "These properties are configurable for material rewards.", - "properties": { - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file." + }, + "2_obj_import_vouchers_to_campaign_object": { + "type": "object", + "title": "Import Vouchers to Campaign", + "description": "Import Vouchers to Campaign", + "properties": { + "code": { + "type": "string", + "description": "Unique custom voucher code." + }, + "category_id": { + "type": "string", + "description": "Unique category ID that you would like to assign to the voucher. Either pass this parameter OR the `category`.", + "example": "cat_0b688929a2476386a7" + }, + "category": { + "type": "string", + "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + }, + "redemption": { + "type": "object", + "description": "Stores the quantity of redemptions that can be applied to the voucher.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } + }, + "additional_info": { + "type": "string", + "description": "An optional field to keep any extra textual information about the code such as a code description and details." + }, + "loyalty_card": { + "type": "object", + "description": " Assign an initial points balance for a loyalty card. Context: `LOYALTY_PROGRAM`.", + "properties": { + "points": { + "type": "integer", + "description": "The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card." + } + } + }, + "gift": { + "type": "object", + "description": "Assign an initial cash balance for a gift card. Context: `GIFT_VOUCHERS`.", + "properties": { + "amount": { + "type": "integer", + "description": "The cash balance to assign to the gift card. This is the current gift card balance." + } + } + } }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a material reward." + "required": [ + "code" + ] + }, + "2_req_examine_qualification": { + "type": "object", + "title": "Examine Qualification Request Body", + "description": "Request body schema for **POST** `/campaigns/qualification`.", + "examples": [], + "properties": { + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" + } + ], + "description": "Order information. This object enables you to pass purchase transaction data. Read what properties you can use in the [Order object](ref:get-order)." + } } - } - }, - "metadata": { - "type": "string", - "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." - } - } - }, - "4_req_update_reward_CAMPAIGN": { - "title": "Digital Reward", - "type": "object", - "description": "Request body schema for updating a digital reward using **PUT** `/rewards/{rewardId}`.", - "properties": { - "name": { - "type": "string", - "description": "Reward name." - }, - "parameters": { - "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN" - }, - "metadata": { - "type": "string", - "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." - } - } - }, - "4_req_update_reward_COIN": { - "title": "Pay with Points Reward", - "type": "object", - "description": "Request body schema for updating a pay with points reward using **PUT** `/rewards/{rewardId}`.", - "properties": { - "name": { - "type": "string", - "description": "Reward name." - }, - "parameters": { - "$ref": "#/components/schemas/4_req_reward_parameters_COIN" - }, - "metadata": { - "type": "string", - "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." - } - } - }, - "4_req_update_reward_MATERIAL": { - "title": "Material Reward", - "type": "object", - "description": "Request body schema for updating a material reward using **PUT** `/rewards/{rewardId}`.", - "properties": { - "name": { - "type": "string", - "description": "Reward name." - }, - "parameters": { - "$ref": "#/components/schemas/4_req_reward_parameters_MATERIAL" - }, - "stock": { - "type": "integer", - "description": "The number of units of the product that you want to share as a reward." - }, - "attributes": { - "type": "object", - "description": "These properties are configurable for material rewards.", - "properties": { - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file." - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a material reward." + }, + "2_res_examine_qualification": { + "type": "object", + "title": "Examine Qualification Response Body", + "description": "Response body schema for **POST** `/campaigns/qualification`.", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about campaigns in a dictionary.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of campaign objects.", + "default": "data" + }, + "data": { + "type": "array", + "description": "Contains array of campaign objects.", + "items": { + "$ref": "#/components/schemas/2_obj_campaign_object_campaigns_qualification" + } + }, + "total": { + "type": "integer", + "description": "Total valid and active campaigns matching the qualification criteria in given context." + }, + "id": { + "type": "string", + "description": "Unique qualification ID.", + "example": "qfl_dNZ3gWfKVNa8Zw15hn30uqdU" + }, + "created_at": { + "type": "string", + "format": "datetime", + "description": "Timestamp representing the date and time when the qualification was created in ISO 8601 format.", + "example": "2023-04-04T13:13:03.119Z" + }, + "tracking_id": { + "type": "string", + "description": "Hashed customer source ID." + } } - } - }, - "metadata": { - "type": "string", - "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." - } - } - }, - "4_req_reward_parameters_CAMPAIGN_LOYALTY_PROGRAM": { - "title": "Points on loyalty card", - "type": "object", - "description": "Configure a reward that adds points to a loyalty card. This type of reward is a subset of a Digital (CAMPAIGN) reward.", - "properties": { - "id": { - "type": "string", - "description": "Assign the reward to the campaign that contains the loyalty cards that will be replenished by the reward. Provide the unique campaign ID, assigned by Voucherify.", - "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" - }, - "balance": { - "type": "integer", - "description": "The incremental points to be added to the current balance on the loyalty card." - } - } - }, - "4_req_reward_parameters_CAMPAIGN_GIFT_VOUCHERS": { - "title": "Gift Vouchers", - "type": "object", - "description": "Configure a reward that adds cash to a gift card. This type of reward is a subset of a Digital (CAMPAIGN) reward.", - "properties": { - "id": { - "type": "string", - "description": "Assign the reward to the campaign that contains the gift cards that will be replenished by the reward. Provide the unique campaign ID, assigned by Voucherify.", - "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" - }, - "balance": { - "type": "integer", - "description": "The incremental amout to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - } - } - }, - "4_req_reward_parameters_CAMPAIGN_DISCOUNT_COUPONS": { - "title": "Discount Coupons", - "type": "object", - "description": "Configure a reward that provides a discount coupon. This type of reward is a subset of a Digital (CAMPAIGN) reward.", - "properties": { - "id": { - "type": "string", - "description": "Assign the reward to the campaign that contains the vouchers that will be the source of the reward. Provide the unique campaign ID, assigned by Voucherify.", - "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" - } - } - }, - "4_req_reward_parameters_CAMPAIGN": { - "title": "Digital Reward", - "type": "object", - "description": "Configure a digital (CAMPAIGN) reward. These can be in the form of discount coupons, gift card credits, or loyalty point credits.", - "properties": { - "campaign": { - "description": "Objects stores information about the campaign related to the reward.", - "anyOf": [ - { - "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN_LOYALTY_PROGRAM" - }, - { - "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN_GIFT_VOUCHERS" - }, - { - "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN_DISCOUNT_COUPONS" - } - ] - } - } - }, - "4_req_reward_parameters_MATERIAL": { - "title": "Material Reward", - "type": "object", - "description": "Configure parameters representing products as a (MATERIAL) reward.", - "properties": { - "product": { - "type": "object", - "description": "Define the product given as a reward.", - "properties": { - "id": { - "type": "string", - "example": "prod_0b7d7dfb05cbe5c616", - "description": "Unique product ID, assigned by Voucherify, given as a reward." - }, - "sku_id": { - "type": [ - "string", - "null" - ], - "description": "Unique SKU ID, assigned by Voucherify, of the SKU given as a reward.", - "example": "sku_0b7d7dfb090be5c619" + }, + "2_obj_campaign_object_campaigns_qualification": { + "type": "object", + "title": "Campaign Object", + "description": "This is an object representing a campaign.", + "properties": { + "id": { + "type": "string", + "description": "Unique campaign ID, assigned by Voucherify.", + "example": "camp_f7fBbQxUuTN7dI7tGOo5XMDA" + }, + "name": { + "type": "string", + "description": "Campaign name." + }, + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "campaign_type": { + "type": "string", + "enum": [ + "GIFT_VOUCHERS", + "DISCOUNT_COUPONS", + "REFERRAL_PROGRAM" + ], + "description": "Type of campaign." + }, + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria \n- `STATIC`: vouchers need to be manually published", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + }, + "voucher": { + "anyOf": [ + { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" + }, + { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_GIFT_CARD" + }, + { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_LOYALTY_CARD" + } + ] + }, + "auto_join": { + "type": "boolean", + "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "use_voucher_metadata_schema": { + "type": "boolean", + "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "vouchers_count": { + "type": "integer", + "description": "Total number of unique vouchers in campaign." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2021-12-01T08:00:50.038Z", + "description": "Timestamp representing the date and time when the campaign was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-09-20T09:18:19.623Z", + "description": "Timestamp representing the date and time when the voucher was updated in ISO 8601 format." + }, + "category": { + "type": "string", + "description": "Unique category name." + }, + "creation_status": { + "type": "string", + "enum": [ + "DONE", + "IN_PROGRESS", + "FAILED", + "DRAFT", + "MODIFYING" + ], + "description": "Indicates the status of the campaign creation." + }, + "vouchers_generation_status": { + "type": "string", + "description": "Indicates the status of the campaign's vouchers.", + "enum": [ + "DONE", + "IN_PROGRESS", + "FAILED", + "DRAFT" + ] + }, + "protected": { + "type": "boolean", + "description": "Indicates whether the resource can be deleted." + }, + "validation_rules_assignments": { + "type": "object", + "description": "Stores information about validation rules assigned to the campaign.", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented is by default `list`.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of validation rule assignments.", + "default": "data" + }, + "data": { + "type": "array", + "description": "Array of validation rule assignment objects. Each validation rule assignment object contains details about the rule.", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "asgm_N7t39epaQR2SkQcW", + "description": "Assigned by the Voucherify API, identifies the validation rule assignment." + }, + "rule_id": { + "type": "string", + "example": "val_ssbxf1L9aKri", + "description": "Assigned by the Voucherify API, identifies the validation rule." + }, + "related_object_id": { + "type": "string", + "example": "camp_AaP9MC1Y0GpBII84UTIuasvb", + "description": "ID of the object from which the rule originates." + }, + "related_object_type": { + "type": "string", + "example": "campaign", + "description": "Which object does the rule originate from: the `voucher` itself or inherited from its parent `campaign`." + }, + "created_at": { + "type": "string", + "example": "2022-02-14T15:12:06.817Z", + "description": "Timestamp representing the date and time when the validation rule was created in ISO 8601 format.", + "format": "date-time" + }, + "object": { + "type": "string", + "default": "validation_rules_assignment", + "description": "The type of resource represented by the object. Default is `validation_rules_assignment`." + }, + "rule": { + "type": "object", + "description": "Describes the details of the rule." + } + } + } + }, + "total": { + "type": "integer", + "description": "Total number of validation rules assigned to the campaign." + } + } + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to.", + "example": "cat_0b688929a2476386a7" + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" + }, + "object": { + "type": "string", + "default": "campaign", + "description": "The type of object represented by JSON. This object stores information about the campaign." + }, + "referral_program": { + "type": "object", + "description": "Defines the referee reward and the way a referral is triggered. Context: `REFERRAL_PROGRAM`.", + "properties": { + "conversion_event_type": { + "type": "string", + "enum": [ + "redemption", + "custom_event" + ], + "description": "How a referral is triggered." + }, + "custom_event": { + "type": "object", + "description": "Contains details about the custom event.", + "properties": { + "id": { + "type": "string", + "example": "ms_fi47Dcu5T0m3v3nT5ch3ma", + "description": "Unique custom event ID." + }, + "name": { + "type": "string", + "description": "Custom event name." + } + } + }, + "referee_reward": { + "type": "object", + "description": "Defines the referee reward.", + "properties": { + "related_object_parent": { + "type": "object", + "description": "Details of the resource from which the reward originates.", + "properties": { + "id": { + "type": "string", + "description": "Unique ID of the reward source." + }, + "name": { + "type": "string", + "description": "Name of the reward source." + }, + "object": { + "type": "string", + "description": "Type of resource represented by the source of the reward." + } + } + }, + "type": { + "type": "string", + "description": "Type of reward.", + "enum": [ + "LOYALTY_CARD", + "GIFT_VOUCHER" + ] + }, + "amount": { + "type": "string", + "description": "The number of `points` to add to a loyalty card or `credits` to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + } + } + } + } + } } - } - } - } - }, - "4_req_reward_parameters_COIN": { - "title": "Pay with Points Reward", - "type": "object", - "description": "Configure parameters representing a Pay with Points (COIN) reward. ", - "properties": { - "coin": { - "type": "object", - "description": "Define the ratio by mapping the number of loyalty points in `points_ratio` to a predefined cash amount in `exchange_ratio`.", - "properties": { - "exchange_ratio": { - "type": [ - "string", - "integer" - ], - "description": "The cash equivalent of the points defined in the `points_ratio` property." - }, - "points_ratio": { - "type": [ - "string", - "integer" - ], - "description": "The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property." + }, + "2_res_list_campaigns": { + "type": "object", + "description": "Schema model for **GET** `/campaigns`.", + "title": "List Campaigns Response Body", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about campaigns in a dictionary.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of campaign objects.", + "default": "campaigns" + }, + "campaigns": { + "type": "array", + "description": "Contains array of campaign objects.", + "items": { + "$ref": "#/components/schemas/2_obj_campaign_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of campaigns." + } } - } - } - } - }, - "4_res_list_rewards": { - "type": "object", - "description": "Response body schema for **GET** `/rewards`.", - "title": "List Rewards Response Body", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about rewards in a dictionary.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of rewards.", - "default": "data" - }, - "data": { - "type": "array", - "description": "Contains array of reward objects.", - "items": { - "$ref": "#/components/schemas/4_obj_reward_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of rewards." - } - } - }, - "4_obj_reward_assignment_object": { - "title": "Reward Assignment Object", - "type": "object", - "description": "This is an object representing a reward assignment.", - "x-tags": [ - "REWARDS API" - ], - "properties": { - "id": { - "type": "string", - "example": "rewa_PbIRoMXpwe5QhobW4JKu0VjH", - "description": "Unique reward assignment ID, assigned by Voucherify." - }, - "reward_id": { - "type": "string", - "description": "Associated reward ID.", - "example": "rew_C7wS9eHFDN4CIbXI5PpLSkGY" - }, - "related_object_id": { - "type": "string", - "description": "Related object ID to which the reward was assigned.", - "example": "camp_wciTvaOfYmAa3EmIIW3QpXXZ" - }, - "related_object_type": { - "type": "string", - "description": "Related object type to which the reward was assigned.", - "example": "campaign" - }, - "parameters": { - "description": "Defines the cost of the reward.", - "type": "object", - "properties": { - "loyalty": { - "type": "object", - "description": "Defines the equivalent points value of the reward.", - "properties": { - "points": { - "type": "integer", - "description": "The number of points required to redeem the reward." + }, + "2_obj_campaign_object_voucher_object_DISCOUNT": { + "type": "object", + "description": "Schema model for a discount voucher.", + "title": "Discount Voucher", + "properties": { + "type": { + "type": "string", + "default": "DISCOUNT_VOUCHER", + "description": "Type of voucher." + }, + "discount": { + "oneOf": [ + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" + } + ], + "description": "Defines the voucher discount type and details." + }, + "redemption": { + "type": "object", + "description": "Defines the redemption limits on vouchers.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } + }, + "code_config": { + "type": "object", + "description": "Defines code's pattern (prefix, suffix, length, charset, etc). ", + "properties": { + "length": { + "type": "string", + "description": "Number of characters in a generated code (excluding prefix and postfix)." + }, + "charset": { + "type": "string", + "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" + }, + "prefix": { + "type": "string", + "description": "A text appended before the code." + }, + "postfix": { + "type": "string", + "description": "A text appended after the code." + }, + "pattern": { + "type": "string", + "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." + } } + }, + "is_referral_code": { + "type": "boolean", + "description": "Indicates whether the voucher is a referral code; this is `true` for campaign type `REFERRAL_PROGRAM`." } } - } - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the reward assignment was created in ISO 8601 format.", - "example": "2022-08-11T14:49:22.586Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format.", - "example": "2022-08-11T16:01:34.885Z", - "format": "date-time" - }, - "object": { - "type": "string", - "default": "reward_assignment", - "description": "The type of object represented by the JSON. This object stores information about the reward assignment." - } - } - }, - "4_res_list_reward_assignments": { - "type": "object", - "description": "Response body schema for **GET** `/rewards/{rewardID}/assignments`.", - "title": "List Reward Assignments Response Body", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about reward assignments in a dictionary.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of reward assignments.", - "default": "data" - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of reward assignments." - } - } - }, - "4_req_update_reward_assignment": { - "type": "object", - "description": "Request body schema for **PUT** `/rewards/{rewardID}/assignments/{assignmentID}`.", - "title": "Update Reward Assignment Request Body", - "properties": { - "parameters": { - "type": "object", - "description": "Defines the cost of the reward.", - "properties": { - "loyalty": { - "type": "object", - "description": "Defines the equivalent points value of the reward.", - "properties": { - "points": { - "type": "integer", - "description": "Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed." + }, + "2_obj_campaign_object_voucher_object_GIFT_CARD": { + "type": "object", + "description": "Schema model for a gift card.", + "title": "Gift Card", + "properties": { + "type": { + "type": "string", + "default": "GIFT_VOUCHER", + "description": "Type of voucher." + }, + "gift": { + "description": "Defines the gift card details.", + "type": "object", + "properties": { + "amount": { + "type": "integer", + "description": "Initial gift card income to be applied to the gift card at voucher generation. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "effect": { + "type": "string", + "description": "Defines how the credits are applied to the customer's order.", + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS" + ] + } + } + }, + "redemption": { + "type": "object", + "description": "Defines the redemption limits on vouchers.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } + }, + "code_config": { + "type": "object", + "description": "Defines code's pattern (prefix, suffix, length, charset, etc). ", + "properties": { + "length": { + "type": "string", + "description": "Number of characters in a generated code (excluding prefix and postfix)." + }, + "charset": { + "type": "string", + "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" + }, + "prefix": { + "type": "string", + "description": "A text appended before the code." + }, + "postfix": { + "type": "string", + "description": "A text appended after the code." + }, + "pattern": { + "type": "string", + "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." + } } + }, + "is_referral_code": { + "type": "boolean", + "description": "Indicates whether the voucher is a referral code; this is `true` for campaign type `REFERRAL_PROGRAM`." } } - } - } - } - }, - "4_req_create_reward_assignment": { - "type": "object", - "description": "Request body schema for **POST** `/rewards/{rewardID}/assignments`.", - "title": "Create Reward Assignment Request Body", - "properties": { - "campaign": { - "type": "string", - "description": "The campaign ID of the campaign to which the reward is to be assigned." - }, - "parameters": { - "type": "object", - "description": "Defines the cost of the reward.", - "required": [ - "loyalty" - ], - "properties": { - "loyalty": { - "type": "object", - "description": "Defines the equivalent points value of the reward.", - "properties": { - "points": { - "type": "integer", - "description": "Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed." + }, + "2_obj_campaign_object_voucher_object_LOYALTY_CARD": { + "type": "object", + "description": "Schema model for a loyalty card.", + "title": "Loyalty Card", + "properties": { + "type": { + "type": "string", + "default": "LOYALTY_CARD", + "description": "Type of voucher." + }, + "loyalty_card": { + "description": "Defines the loyalty card details.", + "type": "object", + "properties": { + "points": { + "type": "integer", + "description": "Initial loyalty card income in points to be applied to the loyalty card at voucher generation." + }, + "expiration_rules": { + "type": "object", + "description": "Defines point expiration rules.", + "properties": { + "period_type": { + "type": "string", + "enum": [ + "MONTH" + ], + "description": "The expiration period." + }, + "period_value": { + "type": "integer", + "description": "How many periods should pass before the expiration occurs." + }, + "rounding_type": { + "type": "string", + "enum": [ + "END_OF_MONTH", + "END_OF_QUARTER", + "END_OF_HALF_YEAR", + "END_OF_YEAR", + "PARTICULAR_MONTH" + ], + "description": "Round up expiration till the end of the given period type." + } + } + } + } + }, + "redemption": { + "type": "object", + "description": "Defines the redemption limits on vouchers.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } + }, + "code_config": { + "type": "object", + "description": "Defines code's pattern (prefix, suffix, length, charset, etc). ", + "properties": { + "length": { + "type": "string", + "description": "Number of characters in a generated code (excluding prefix and postfix)." + }, + "charset": { + "type": "string", + "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" + }, + "prefix": { + "type": "string", + "description": "A text appended before the code." + }, + "postfix": { + "type": "string", + "description": "A text appended after the code." + }, + "pattern": { + "type": "string", + "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." + } } + }, + "is_referral_code": { + "type": "boolean", + "description": "Indicates whether the voucher is a referral code; this is `true` for campaign type `REFERRAL_PROGRAM`." } } - } - } - }, - "required": [ - "campaign", - "parameters" - ] - }, - "5_obj_publication_object": { - "title": "Publication Object", - "type": "object", - "description": "This is an object representing a publication. ", - "x-tags": [ - "PUBLICATIONS API" - ], - "properties": { - "id": { - "type": "string", - "example": "pub_BbjAXnmm8e0SIm3zG8qvvFCP0KuLywtp", - "description": "Unique publication ID, assigned by Voucherify." - }, - "object": { - "type": "string", - "default": "publication", - "description": "The type of object represented by the JSON. This object stores information about the publication." - }, - "created_at": { - "type": "string", - "example": "2022-09-23T09:57:00.434Z", - "description": "Timestamp representing the date and time when the publication was created in ISO 8601 format.", - "format": "date-time" - }, - "customer_id": { - "type": "string", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "description": "Unique customer ID of the customer receiving the publication." - }, - "tracking_id": { - "type": "string", - "description": "Customer's `source_id`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." - }, - "channel": { - "type": "string", - "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", - "enum": [ - "voucherify-website", - "Dashboard", - "Automation", - "API", - "Braze", - "Reward", - "SMS", - "Email", - "Activecampaign", - "Webhook", - "Intercom", - "Mailchimp", - "Shopify" - ] - }, - "source_id": { - "type": "string", - "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. " - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Status of the publication attempt." - }, - "customer": { - "type": "object", - "description": "Contains information about the customer to whom the publication was directed.", - "properties": { - "id": { - "type": "string", - "description": "Unique customer ID, assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's name." - }, - "email": { - "type": "string", - "description": "Customer's email." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs attached to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments." - }, - "object": { - "type": "string", - "default": "customer", - "description": "The type of object represented by the JSON. This object stores information about the customer." + }, + "2_req_campaign_object_voucher_object_LOYALTY_CARD": { + "type": "object", + "description": "Schema model for a loyalty card.", + "title": "Loyalty Card", + "properties": { + "type": { + "type": "string", + "default": "LOYALTY_CARD", + "description": "Type of voucher." + }, + "loyalty_card": { + "description": "Defines the loyalty card details.", + "type": "object", + "properties": { + "points": { + "type": "integer", + "description": "Initial loyalty card income in points to be applied to the loyalty card at voucher generation." + }, + "expiration_rules": { + "type": "object", + "description": "Defines point expiration rules.", + "properties": { + "period_type": { + "type": "string", + "enum": [ + "MONTH" + ], + "description": "The expiration period." + }, + "period_value": { + "type": "integer", + "description": "How many periods should pass before the expiration occurs." + }, + "rounding_type": { + "type": "string", + "enum": [ + "END_OF_MONTH", + "END_OF_QUARTER", + "END_OF_HALF_YEAR", + "END_OF_YEAR", + "PARTICULAR_MONTH" + ], + "description": "Round up expiration till the end of the given period type." + } + } + } + } + }, + "redemption": { + "type": "object", + "description": "Defines the redemption limits on vouchers.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } + }, + "code_config": { + "type": "object", + "description": "Defines code's pattern (prefix, suffix, length, charset, etc). ", + "properties": { + "length": { + "type": "string", + "description": "Number of characters in a generated code (excluding prefix and postfix)." + }, + "charset": { + "type": "string", + "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" + }, + "prefix": { + "type": "string", + "description": "A text appended before the code." + }, + "postfix": { + "type": "string", + "description": "A text appended after the code." + }, + "pattern": { + "type": "string", + "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." + } + } + } } - } - }, - "voucher": { - "description": "Contains information about the voucher being published.", - "anyOf": [ - { - "$ref": "#/components/schemas/5_obj_publication_object_discount" - }, - { - "$ref": "#/components/schemas/5_obj_publication_object_loyalty_card" - }, - { - "$ref": "#/components/schemas/5_obj_publication_object_gift_card" + }, + "3_obj_promotion_tier_object": { + "type": "object", + "description": "This is an object representing a promotion tier. Promotion tiers are always assigned to a campaign and cannot be used standalone.", + "title": "Promotion Tier Object", + "x-tags": [ + "PROMOTIONS API" + ], + "properties": { + "id": { + "type": "string", + "example": "promo_63fYCt81Aw0h7lzyRkrGZh9p", + "description": "Unique promotion tier ID." + }, + "created_at": { + "type": "string", + "example": "2021-12-15T11:34:01.333Z", + "format": "date-time", + "description": "Timestamp representing the date and time when the promotion tier was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "example": "2022-02-09T09:20:05.603Z", + "format": "date-time", + "description": "Timestamp representing the date and time when the promotion tier was updated in ISO 8601 format." + }, + "name": { + "type": "string", + "description": "Name of the promotion tier." + }, + "banner": { + "type": "string", + "description": "Text to be displayed to your customers on your website." + }, + "action": { + "type": "object", + "description": "Contains details about the discount applied by the promotion tier.", + "properties": { + "discount": { + "anyOf": [ + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" + } + ], + "description": "The type of discount that will be applied to a customer's order." + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." + }, + "hierarchy": { + "type": "integer", + "description": "The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy." + }, + "campaign": { + "type": "object", + "description": "Contains details about promotion tier's parent campaign.", + "properties": { + "id": { + "type": "string", + "description": "Unique campaign ID." + }, + "start_date": { + "type": "string", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "format": "date-time", + "example": "2022-09-22T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "active": { + "type": "boolean", + "description": "A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" + }, + "category_id": { + "type": "string", + "example": "cat_0b688929a2476386a6", + "description": "Unique category ID that this campaign belongs to." + }, + "object": { + "type": "string", + "description": "The type of object represented by the campaign object. This object stores information about the campaign.", + "default": "campaign" + } + } + }, + "campaign_id": { + "type": "string", + "description": "Promotion tier's parent campaign's unique ID." + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* promotion tier\n- `false` indicates an *inactive* promotion tier" + }, + "start_date": { + "type": "string", + "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ", + "format": "date-time", + "example": "2022-09-23T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ", + "format": "date-time", + "example": "2022-09-26T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the promotion tier is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a promotion tier with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the promotion tier will be active in ISO 8601 format. For example, a promotion tier with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the promotion tier is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "summary": { + "type": "object", + "description": "Contains statistics about promotion tier redemptions and orders.", + "properties": { + "redemptions": { + "type": "object", + "description": "Contains statistics about promotion tier redemptions.", + "properties": { + "total_redeemed": { + "type": "integer", + "description": "Number of times the promotion tier was redeemed." + } + } + }, + "orders": { + "type": "object", + "description": "Contains statistics about orders related to the promotion tier.", + "properties": { + "total_amount": { + "type": "integer", + "description": "Sum of order totals." + }, + "total_discount_amount": { + "type": "integer", + "description": "Sum of total discount applied using the promotion tier." + } + } + } + } + }, + "object": { + "type": "string", + "default": "promotion_tier", + "description": "The type of object represented by JSON. This object stores information about the promotion tier." + }, + "validation_rule_assignments": { + "$ref": "#/components/schemas/13_res_validation-rules_validationRuleId_assignments" + }, + "category_id": { + "type": "string", + "description": "Promotion tier category ID.", + "example": "cat_0c9da30e7116ba6bba" + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object", + "description": "Details about the category assigned to the promotion tier." + } } - ] - }, - "vouchers_id": { - "type": "array", - "description": "Contains the unique internal voucher ID that was assigned by Voucherify.", - "items": { - "type": "string", - "example": "[ v_Bw3qWZWv47yb1Onra8F2LlFI1enLakfA ]" - } - } - } - }, - "5_req_create_publication_standalone_voucher": { - "title": "Standalone Voucher", - "type": "object", - "description": "Create publication for standalone voucher.", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. " - }, - "channel": { - "type": "string", - "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", - "enum": [ - "voucherify-website", - "Dashboard", - "Automation", - "API", - "Braze", - "Reward", - "SMS", - "Email", - "Activecampaign", - "Webhook", - "Intercom", - "Mailchimp", - "Shopify" - ] - }, - "customer": { - "description": "Contains information about the customer to whom the publication was directed.", - "anyOf": [ - { - "$ref": "#/components/schemas/5_res_create_publication_customer_id" - }, - { - "$ref": "#/components/schemas/5_res_create_publication_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" + }, + "3_req_add_promotion_tier_to_campaign": { + "type": "object", + "description": "Request body schema for creating a promotion tier within a campaign in **POST** `/promotions/{campaignId}/tiers`.", + "title": "Add Promotion Tier to Campaign Request Body", + "properties": { + "name": { + "type": "string", + "description": "Name of the promotion tier." + }, + "banner": { + "type": "string", + "description": "Text to be displayed to your customers on your website.\t" + }, + "action": { + "type": "object", + "description": "Contains details about the discount applied by the promotion tier.", + "properties": { + "discount": { + "anyOf": [ + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" + } + ], + "description": "The type of discount that will be applied to a customer's order." + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* promotion tier\n- `false` indicates an *inactive* promotion tier" + }, + "start_date": { + "type": "string", + "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ", + "format": "date-time", + "example": "2022-09-23T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ", + "format": "date-time", + "example": "2022-09-26T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the promotion tier is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a promotion tier with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the promotion tier will be active in ISO 8601 format. For example, a promotion tier with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the promotion tier is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "validation_rules": { + "type": "array", + "description": "Array containing the ID of the validation rule associated with the promotion tier.", + "items": { + "type": "string" + } + }, + "category": { + "type": "string", + "description": "Assign category to the promotion tier." + }, + "category_id": { + "type": "string", + "description": "Instead of using the category name, you can alternatively assign a new category to a promotion tier using a unique category ID, i.e. `cat_0c9da30e7116ba6bba`.", + "example": "cat_0c9da30e7116ba6bba" + } } - ] - }, - "voucher": { - "description": "Code of voucher being published.", - "type": "string" - }, - "campaign": { - "type": "string", - "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." - } - } - }, - "5_req_create_publication_from_campaign": { - "title": "Voucher from Campaign", - "description": "Create a publication for a voucher from a campaign.", - "oneOf": [ - { - "$ref": "#/components/schemas/5_req_create_publication_from_campaign_auto_update" - }, - { - "$ref": "#/components/schemas/5_req_create_publication_from_campaign_one_specific_voucher" - }, - { - "$ref": "#/components/schemas/5_req_create_publication_from_campaign_multiple_vouchers" - } - ] - }, - "5_req_create_publication_from_campaign_auto_update": { - "title": "Voucher from Auto-Update Campaign", - "type": "object", - "description": "Create a publication for a voucher from an auto-update campaign. It will choose the next available voucher.", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. " - }, - "channel": { - "type": "string", - "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", - "enum": [ - "voucherify-website", - "Dashboard", - "Automation", - "API", - "Braze", - "Reward", - "SMS", - "Email", - "Activecampaign", - "Webhook", - "Intercom", - "Mailchimp", - "Shopify" - ] - }, - "customer": { - "description": "Contains information about the customer to whom the publication was directed.", - "anyOf": [ - { - "$ref": "#/components/schemas/5_res_create_publication_customer_id" - }, - { - "$ref": "#/components/schemas/5_res_create_publication_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" + }, + "3_req_update_promotion_tier": { + "type": "object", + "description": "Request body schema for updating a promotion tier within a campaign in **POST** `/promotions/tiers/{promotionTierId}`.", + "title": "Update Promotion Tier Request Body", + "properties": { + "name": { + "type": "string", + "description": "Name of the promotion tier." + }, + "banner": { + "type": "string", + "description": "Text to be displayed to your customers on your website.\t" + }, + "action": { + "type": "object", + "description": "Contains details about the discount applied by the promotion tier.", + "properties": { + "discount": { + "anyOf": [ + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" + } + ], + "description": "The type of discount that will be applied to a customer's order." + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." + }, + "start_date": { + "type": "string", + "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ", + "format": "date-time", + "example": "2022-09-23T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ", + "format": "date-time", + "example": "2022-09-26T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the promotion tier is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a promotion tier with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the promotion tier will be active in ISO 8601 format. For example, a promotion tier with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the promotion tier is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "hierarchy": { + "type": "integer", + "description": "The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. If you update a hierarchy of a promotion tier, then the remaining promotion tier hierarchies will be recalculated." + }, + "category": { + "type": "string", + "description": "Assign a new or update the promotion tier's category." + }, + "category_id": { + "type": "string", + "description": "Instead of using the category name, you can alternatively assign a new category to a promotion tier using a unique category ID, i.e. `cat_0c9da30e7116ba6bba`.", + "example": "cat_0c9da30e7116ba6bba" + } } - ] - }, - "campaign": { - "type": "string", - "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." - } - } - }, - "5_req_create_publication_from_campaign_one_specific_voucher": { - "title": "Voucher from Campaign", - "type": "object", - "description": "Create a publication for a specific voucher code from a campaign.", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service." - }, - "channel": { - "type": "string", - "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", - "enum": [ - "voucherify-website", - "Dashboard", - "Automation", - "API", - "Braze", - "Reward", - "SMS", - "Email", - "Activecampaign", - "Webhook", - "Intercom", - "Mailchimp", - "Shopify" - ] - }, - "customer": { - "description": "Contains information about the customer to whom the publication was directed.", - "anyOf": [ - { - "$ref": "#/components/schemas/5_res_create_publication_customer_id" - }, - { - "$ref": "#/components/schemas/5_res_create_publication_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" + }, + "3_res_list_promotion_tiers": { + "type": "object", + "description": "Promotion Tiers", + "title": "Promotion Tiers", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about promotion tiers in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "tiers", + "description": "Identifies the name of the attribute that contains the array of promotion tier objects." + }, + "tiers": { + "type": "array", + "description": "Contains array of promotion tier objects.", + "items": { + "$ref": "#/components/schemas/3_obj_promotion_tier_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of promotion tiers." + } } - ] - }, - "voucher": { - "description": "Code of voucher being published.", - "type": "string" - }, - "campaign": { - "type": "string", - "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." - } - } - }, - "5_req_create_publication_from_campaign_multiple_vouchers": { - "title": "Vouchers from Campaign", - "type": "object", - "description": "Create a publication of multiple vouchers from a campaign.", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. " - }, - "channel": { - "type": "string", - "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", - "enum": [ - "voucherify-website", - "Dashboard", - "Automation", - "API", - "Braze", - "Reward", - "SMS", - "Email", - "Activecampaign", - "Webhook", - "Intercom", - "Mailchimp", - "Shopify" - ] - }, - "customer": { - "description": "Contains information about the customer to whom the publication was directed.", - "anyOf": [ - { - "$ref": "#/components/schemas/5_res_create_publication_customer_id" - }, - { - "$ref": "#/components/schemas/5_res_create_publication_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" + }, + "3_res_list_promotion_stacks": { + "type": "object", + "description": "Promotion Stacks", + "title": "Promotion Stacks", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about promotion stacks in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of promotion stack objects." + }, + "data": { + "type": "array", + "description": "Contains array of promotion stack objects.", + "items": { + "$ref": "#/components/schemas/3_obj_promotion_stack_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of promotion stacks." + } } - ] - }, - "voucher": { - "description": "Code of voucher being published.", - "type": "string" - }, - "campaign": { - "type": "object", - "description": "Contains name of source campaign and number of vouchers to be published.", - "properties": { - "name": { - "type": "string", - "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`." - }, - "count": { - "type": "string", - "description": "Number of vouchers to be published to customer." + }, + "3_obj_promotion_stack_object": { + "type": "object", + "title": "Promotion Stack Object", + "description": "Model schema for a promotion stack.", + "properties": { + "id": { + "type": "string", + "example": "stack_p0WhtyyDU95crobleMpRabhH", + "description": "Unique promotion stack ID." + }, + "name": { + "type": "string", + "description": "Promotion stack name." + }, + "created_at": { + "type": "string", + "example": "2022-09-22T13:03:25.740Z", + "format": "date-time", + "description": "Timestamp representing the date and time when the promotion stack was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "example": "2022-09-23T07:59:44.172Z", + "format": "date-time", + "description": "Timestamp representing the date and time when the promotion stack was updated in ISO 8601 format." + }, + "campaign_id": { + "type": "string", + "example": "camp_99HUWI53bVyLzPN1Fg5TBLWX", + "description": "Promotion stack's parent campaign's unique ID." + }, + "object": { + "type": "string", + "default": "promotion_stack", + "description": "The type of object represented by JSON. This object stores information about the promotion tier." + }, + "tiers": { + "type": "object", + "description": "Contains the tier configuration.", + "properties": { + "ids": { + "type": "array", + "description": "Contains the list of tiers in a pre-defined sequence.", + "items": { + "type": "string" + } + }, + "hierarchy_mode": { + "type": "string", + "default": "MANUAL" + } + } + }, + "category_id": { + "type": "string", + "description": "Promotion stack category ID.", + "example": "cat_0c9da30e7116ba6bba" + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object", + "description": "Details about the category assigned to the promotion stack." + } } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." - } - } - }, - "5_req_create_publication": { - "title": "Create Publication Request Body", - "description": "Request body schema for publishing a voucher.", - "oneOf": [ - { - "$ref": "#/components/schemas/5_req_create_publication_standalone_voucher" - }, - { - "$ref": "#/components/schemas/5_req_create_publication_from_campaign" - } - ] - }, - "5_res_create_publication": { - "title": "Create Publication Response Body", - "type": "object", - "description": "Response schema model for publishing a voucher to a specific customer.", - "properties": { - "id": { - "type": "string", - "example": "pub_BbjAXnmm8e0SIm3zG8qvvFCP0KuLywtp", - "description": "Unique publication ID, assigned by Voucherify." - }, - "object": { - "type": "string", - "default": "publication", - "description": "The type of object represented by the JSON. This object stores information about the `publication`." - }, - "created_at": { - "type": "string", - "example": "2022-09-23T09:57:00.434Z", - "description": "Timestamp representing the date and time when the publication was created in ISO 8601 format.", - "format": "date-time" - }, - "customer_id": { - "type": "string", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "description": "Unique customer ID of the customer receiving the publication." - }, - "tracking_id": { - "type": "string", - "description": "Customer's `source_id`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." - }, - "channel": { - "type": "string", - "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", - "enum": [ - "voucherify-website", - "Dashboard", - "Automation", - "API", - "Braze", - "Reward", - "SMS", - "Email", - "Activecampaign", - "Webhook", - "Intercom", - "Mailchimp", - "Shopify" - ] - }, - "source_id": { - "type": "string", - "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. " - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Status of the publication attempt." - }, - "customer": { - "description": "Contains information about the customer to whom the publication was directed.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique customer ID, assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's name." - }, - "email": { - "type": "string", - "description": "Customer's email." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs attached to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments." - }, - "object": { - "type": "string", - "default": "customer", - "description": "The type of object represented by the JSON. This object stores information about the `customer`." + }, + "3_req_create_promotion_stack": { + "type": "object", + "title": "Create Promotion Stack Request Body", + "description": "Model schema for a creating a promotion stack using **POST** `/promotions/{campaignId}/stacks`.", + "properties": { + "name": { + "type": "string", + "description": "Promotion stack name." + }, + "tiers": { + "type": "object", + "description": "Contains the tier configuration.", + "properties": { + "ids": { + "type": "array", + "description": "Contains the list of tiers in a pre-defined sequence.", + "items": { + "type": "string" + } + }, + "hierarchy_mode": { + "type": "string", + "example": "MANUAL" + } + } + }, + "category": { + "type": "string", + "description": "Assign a category." + }, + "category_id": { + "type": "string", + "description": "Instead of using the category name, you can alternatively assign a new category to a promotion stack using a unique category ID, i.e. `cat_0c9da30e7116ba6bba`.", + "example": "cat_0c9da30e7116ba6bba" + } } - } - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object" - }, - "vouchers_id": { - "type": "array", - "description": "Contains the unique internal voucher ID that was assigned by Voucherify.", - "items": { - "type": "string", - "example": "[ v_Bw3qWZWv47yb1Onra8F2LlFI1enLakfA ]" - } - } - } - }, - "5_req_create_publication_campaign_id": { - "title": "Campaign ID", - "type": "object", - "description": "Campaign's unique ID assigned by Voucherify.", - "properties": { - "id": { - "type": "string", - "example": "camp_7AZCZeF1VvD6EHC5anAMtvcK", - "description": "Unique campaign ID, assigned by Voucherify." - } - } - }, - "5_req_create_publication_campaign_name": { - "title": "Campaign's name", - "type": "object", - "description": "Campaign's name.", - "properties": { - "name": { - "type": "string", - "example": "Summer Campaign", - "description": "Campaign's name." - } - } - }, - "5_req_create_publication_campaign": { - "title": "Campaign's name or ID", - "type": "string", - "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`. " - }, - "5_res_create_publication_customer_id": { - "title": "Customer ID", - "type": "object", - "description": "Customer's unique ID assigned by Voucherify.", - "properties": { - "id": { - "type": "string", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "description": "Unique customer ID, assigned by Voucherify." - } - } - }, - "5_res_create_publication_customer_source_id": { - "title": "Customer's Source ID", - "type": "object", - "description": "The merchant’s customer ID.", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - } - } - }, - "5_req_create_publication_customer": { - "title": "Source ID or Unique Customer ID", - "type": "string", - "description": "Customer's unique ID assigned by Voucherify, i.e. `cust_eWgXlBBiY6THFRJwX45Iakv4`, or the merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "5_obj_publication_object_discount": { - "title": "Discount Voucher", - "type": "object", - "description": "This is an object representing a publication of a discount voucher. ", - "properties": { - "code": { - "type": "string", - "description": "Voucher code." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the voucher.", - "default": "voucher" - }, - "campaign": { - "type": "string", - "description": "Name of voucher's parent campaign." - }, - "discount": { - "anyOf": [ - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" + }, + "3_res_list_promotion_tiers_from_campaign": { + "type": "object", + "description": "Promotion Tiers", + "title": "Promotion Tiers", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about promotion tiers in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "tiers", + "description": "Identifies the name of the attribute that contains the array of promotion tier objects." + }, + "tiers": { + "type": "array", + "description": "Contains array of promotion tier objects.", + "items": { + "$ref": "#/components/schemas/3_obj_promotion_tier_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of promotion tiers." + }, + "has_more": { + "type": "boolean", + "description": "As query results are always limited (by the limit parameter), the `has_more` flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results." + } } - ] - }, - "is_referral_code": { - "type": "boolean", - "description": "Whether this voucher is a referral code." - } - } - }, - "5_obj_publication_object_loyalty_card": { - "title": "Loyalty Card", - "type": "object", - "description": "This is an object representing a publication of a loyalty card. ", - "properties": { - "code": { - "type": "string", - "description": "Voucher code." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the voucher.", - "default": "voucher" - }, - "campaign": { - "type": "string", - "description": "Name of voucher's parent campaign." - }, - "loyalty_card": { - "type": "object", - "description": "Contains information about the loyalty card being published.", - "properties": { - "points": { - "type": "integer", - "description": "The incremental points to be added to the loyalty card as the initial balance on the card." - }, - "balance": { - "type": "integer", - "description": "The points balance after the incremental points are added to the loyalty card." + }, + "4_obj_reward_object": { + "title": "Reward Object", + "type": "object", + "description": "This is an object representing a reward.", + "x-tags": [ + "REWARDS API" + ], + "properties": { + "id": { + "type": "string", + "example": "rew_nIy4gHpQHle2c3pNMwuj7G6j", + "description": "Unique reward ID, assigned by Voucherify." + }, + "name": { + "type": "string", + "description": "Reward name." + }, + "type": { + "type": "string", + "enum": [ + "CAMPAIGN", + "COIN", + "MATERIAL" + ], + "description": "Reward type." + }, + "parameters": { + "oneOf": [ + { + "$ref": "#/components/schemas/4_obj_reward_object_parameters_CAMPAIGN" + }, + { + "$ref": "#/components/schemas/4_obj_reward_object_parameters_COIN" + }, + { + "$ref": "#/components/schemas/4_obj_reward_object_parameters_MATERIAL" + } + ], + "description": "Defines how the reward is generated." + }, + "stock": { + "type": "integer", + "description": "Configurable for **material rewards**. The number of units of the product that you want to share as reward." + }, + "redeemed": { + "type": "integer", + "description": "Defines the number of already invoked (successful) reward redemptions.\t" + }, + "attributes": { + "type": "object", + "description": "These properties are configurable for **material rewards**.", + "properties": { + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file." + }, + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a material reward." + } + } + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the reward was created in ISO 8601 format.", + "example": "2022-08-11T14:49:22.586Z", + "format": "date-time" + }, + "updated_at": { + "type": [ + "string", + "null" + ], + "description": "Timestamp representing the date and time when the reward was updated in ISO 8601 format.", + "example": "2022-08-11T16:01:34.885Z", + "format": "date-time" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." + }, + "object": { + "type": "string", + "default": "reward", + "description": "The type of object represented by the JSON. This object stores information about the reward." + } } - } - }, - "is_referral_code": { - "type": "boolean", - "description": "Whether this voucher is a referral code." - } - } - }, - "5_obj_publication_object_gift_card": { - "title": "Gift Card", - "type": "object", - "description": "This is an object representing a publication of a gift card. ", - "properties": { - "code": { - "type": "string", - "description": "Voucher code." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the voucher.", - "default": "voucher" - }, - "campaign": { - "type": "string", - "description": "Name of voucher's parent campaign." - }, - "gift": { - "type": "object", - "description": "Contains information about the gift card being published.", - "properties": { - "amount": { - "type": "integer", - "description": "The incremental amount to be added as the initial balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "balance": { - "type": "integer", - "description": "The credit balance on the gift card after the initial incremental amount is added to the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS" - ], - "description": "How the credits are applied to the customer's order." + }, + "4_obj_reward_object_parameters_CAMPAIGN": { + "title": "Digital", + "type": "object", + "description": "These are parameters representing a digital (CAMPAIGN) reward. These can be in the form of discount coupons, gift card credits, or loyalty point credits.", + "properties": { + "campaign": { + "description": "Objects stores information about the campaign related to the reward.", + "anyOf": [ + { + "$ref": "#/components/schemas/4_obj_reward_object_parameters_CAMPAIGN_DISCOUNT_COUPONS" + }, + { + "$ref": "#/components/schemas/4_obj_reward_object_parameters_CAMPAIGN_GIFT_VOUCHERS" + }, + { + "$ref": "#/components/schemas/4_obj_reward_object_parameters_CAMPAIGN_LOYALTY_PROGRAM" + } + ] + } } - } - }, - "is_referral_code": { - "type": "boolean", - "description": "Whether this voucher is a referral code." - } - } - }, - "5_res_list_publications": { - "type": "object", - "description": "Response body schema for listing publications using **GET** `/publications`.", - "title": "List Publications Response Body", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about publications in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "publications", - "description": "Identifies the name of the attribute that contains the array of publications." - }, - "publications": { - "type": "array", - "description": "Contains array of publication objects.", - "items": { - "$ref": "#/components/schemas/5_obj_publication_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of publications." - } - } - }, - "6_obj_validation_object": { - "title": "Validation Object", - "description": "This is an object representing a validation.", - "x-tags": [ - "VALIDATIONS API" - ], - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_code" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_gift_card" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_loyalty_card" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_false" - }, - { - "$ref": "#/components/schemas/6_res_validate_promotion_object" - } - ] - }, - "6_req_validate_voucher": { - "title": "Validate Voucher Request Body", - "description": "Request schema model for validating a voucher using **POST** `/vouchers/{code}/validate`.", - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_discount_code" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_gift_card" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_loyalty_card" - } - ] - }, - "6_req_validate_voucher_customer_id": { - "title": "Customer ID", - "description": "You can pass the unique customer ID that was assigned by Voucherify.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The ID of an existing customer that will be linked to redemption in this request.", - "example": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" - } - } - }, - "6_req_rollback_redemption_customer_id": { - "title": "Customer ID", - "description": "You can pass the unique customer ID that was assigned by Voucherify.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The ID of an existing customer that will be linked to redemption rollback in this request.", - "example": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" - } - } - }, - "6_req_validate_voucher_customer_id_string": { - "type": "string", - "title": "Customer ID", - "description": "You can pass the unique customer ID that was assigned by Voucherify.", - "example": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" - }, - "6_req_validate_voucher_customer_source_id": { - "title": "Customer Source ID", - "description": "You can send the source ID that you used to create the customer in Voucherify.", - "type": "object", - "properties": { - "source_id": { - "type": "string", - "description": "A unique identifier of a customer that validates a voucher. It can be a customer ID or email from a CRM system, database or 3rd-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored." - } - } - }, - "6_req_rollback_redemption_customer_source_id": { - "title": "Customer Source ID", - "description": "You can send the source ID that you used to create the customer in Voucherify.", - "type": "object", - "properties": { - "source_id": { - "type": "string", - "description": "A unique identifier of a customer that redeemed a resource. It can be a customer ID or email from a CRM system, database or 3rd-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored." - } - } - }, - "6_req_validate_voucher_order_id": { - "title": "Order ID", - "description": "You can pass the unique order ID that was assigned by Voucherify.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request." - } - } - }, - "6_req_validate_voucher_order_source_id": { - "title": "Order Source ID", - "description": "You can send the source ID that you used to create the order in Voucherify.", - "type": "object", - "properties": { - "source_id": { - "type": "string", - "description": "Unique source ID of an existing order that will be linked to the redemption of this request." - } - } - }, - "6_req_rollback_redemption_order_id": { - "title": "Order ID", - "description": "You can pass the unique order ID that was assigned by Voucherify.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique ID assigned by Voucherify of an existing order that will be linked to the redemption rollback of this request." - }, - "status": { - "type": "string", - "description": "After a redemption rollback, Voucherify will default the order status to `CANCELED`. You can set the order status to one of the other options: `CREATED`, `PAID`, `FULFILLED`.", - "enum": [ - "CREATED", - "PAID", - "FULFILLED" - ] - } - } - }, - "6_req_rollback_redemption_order_source_id": { - "title": "Order Source ID", - "description": "You can send the source ID that you used to create the order in Voucherify.", - "type": "object", - "properties": { - "source_id": { - "type": "string", - "description": "Unique source ID of an existing order that will be linked to the redemption rollback of this request." - }, - "status": { - "type": "string", - "description": "After a redemption rollback, Voucherify will default the order status to `CANCELED`. You can set the order status to one of the other options: `CREATED`, `PAID`, `FULFILLED`.", - "enum": [ - "CREATED", - "PAID", - "FULFILLED" - ] - } - } - }, - "6_req_validate_voucher_discount_code": { - "title": "Discount Code", - "type": "object", - "description": "Request schema model for validating a discount code voucher using **POST** `/vouchers/{code}/validate`.", - "properties": { - "session": { - "$ref": "#/components/schemas/6_req_session_lock_discount_code" - }, - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" + }, + "4_obj_reward_object_parameters_CAMPAIGN_DISCOUNT_COUPONS": { + "title": "Discount Coupons", + "type": "object", + "description": "These are parameters representing a discount coupon, which is a subset of a Digital (CAMPAIGN) reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique campaign ID, assigned by Voucherify.", + "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" + }, + "type": { + "type": "string", + "description": "Campaign type.", + "default": "DISCOUNT_COUPONS" + } } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" - }, - { - "$ref": "#/components/schemas/10_req_create_order" + }, + "4_obj_reward_object_parameters_CAMPAIGN_GIFT_VOUCHERS": { + "title": "Gift Vouchers", + "type": "object", + "description": "These are parameters representing a gift voucher, which is a subset of a Digital (CAMPAIGN) reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique campaign ID, assigned by Voucherify.", + "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" + }, + "balance": { + "type": "integer", + "description": "The incremental amout to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "type": { + "type": "string", + "description": "Campaign type.", + "default": "GIFT_VOUCHERS" + } } - ], - "description": "Order information." - }, - "metadata": { - "type": "object", - "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." - } - } - }, - "6_req_validate_voucher_gift_card": { - "title": "Gift Card", - "type": "object", - "description": "Request schema model for validating a gift card voucher using **POST** `/vouchers/{code}/validate`.", - "properties": { - "session": { - "$ref": "#/components/schemas/6_req_session_lock_gift_card" - }, - "gift": { - "type": "object", - "description": "Contains information on the number of gift card credits that the customer wants to apply to the order.", - "properties": { - "credits": { - "type": "integer", - "description": "The number of credits that the user wants to use from the gift card to fulfil the order. The value of credits cannot be higher than the current balance on the gift card. If the user gives more points than he has on the gift card, the application will return an error code in response. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "4_obj_reward_object_parameters_CAMPAIGN_LOYALTY_PROGRAM": { + "title": "Points on loyalty card", + "type": "object", + "description": "These are parameters representing points on a loyalty card, which is a subset of a Digital (CAMPAIGN) reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique campaign ID, assigned by Voucherify.", + "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" + }, + "balance": { + "type": "integer", + "description": "The incremental points to be added to the current balance on the loyalty card." + }, + "type": { + "type": "string", + "description": "Campaign type.", + "default": "LOYALTY_PROGRAM" + } } - } - }, - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" + }, + "4_obj_reward_object_parameters_COIN": { + "title": "Pay with Points", + "type": "object", + "description": "These are parameters representing a Pay with Points (COIN) reward. ", + "properties": { + "coin": { + "type": "object", + "description": "Defines the ratio by mapping the number of loyalty points in `points_ratio` to a predefined cash amount in `exchange_ratio`.", + "properties": { + "exchange_ratio": { + "type": "integer", + "description": "The cash equivalent of the points defined in the `points_ratio` property." + }, + "points_ratio": { + "type": "integer", + "description": "The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property." + } + } + } } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" - }, - { - "$ref": "#/components/schemas/10_req_create_order" + }, + "4_obj_reward_object_parameters_MATERIAL": { + "title": "Material", + "type": "object", + "description": "These are parameters representing products as a (MATERIAL) reward.", + "properties": { + "product": { + "type": "object", + "description": "Contains information about the product given as a reward.", + "properties": { + "id": { + "type": "string", + "example": "prod_0b7d7dfb05cbe5c616", + "description": "Unique product ID, assigned by Voucherify. " + }, + "sku_id": { + "type": [ + "string", + "null" + ], + "description": "Unique SKU ID, assigned by Voucherify, of the SKU given as a reward.", + "example": "sku_0b7d7dfb090be5c619" + } + } + } } - ], - "description": "Order information." - }, - "metadata": { - "type": "object", - "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." - } - } - }, - "6_req_validate_voucher_loyalty_card": { - "title": "Loyalty Card", - "type": "object", - "description": "Request schema model for validating a loyalty card voucher using **POST** `/vouchers/{code}/validate`.", - "properties": { - "session": { - "$ref": "#/components/schemas/6_req_session_lock_loyalty_card" - }, - "reward": { - "type": "object", - "description": "Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward." - }, - "points": { - "type": "integer", - "description": "The number of loyalty points that the user wants to spend in order to fulfill the order. The number of points cannot be higher than the current balance on the loyalty card. If the user gives more points than he/she has on the loyalty card, the application will return an error code in response." + }, + "4_req_create_reward": { + "title": "Create Reward Request Body", + "description": "Request body schema for **POST** `/rewards`.", + "anyOf": [ + { + "$ref": "#/components/schemas/4_req_create_reward_CAMPAIGN" + }, + { + "$ref": "#/components/schemas/4_req_create_reward_MATERIAL" + }, + { + "$ref": "#/components/schemas/4_req_create_reward_COIN" + } + ] + }, + "4_req_create_reward-copy": { + "title": "Create Reward Request Body", + "type": "object", + "description": "Request body schema for **POST** `/rewards`.", + "properties": { + "name": { + "type": "string", + "description": "Reward name." + }, + "type": { + "type": "string", + "enum": [ + "CAMPAIGN", + "COIN", + "MATERIAL" + ], + "description": "Reward type." + }, + "parameters": { + "oneOf": [ + { + "$ref": "#/components/schemas/4_req_reward_parameters_COIN" + }, + { + "$ref": "#/components/schemas/4_req_reward_parameters_MATERIAL" + }, + { + "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN" + } + ], + "description": "Defines how the reward is generated." + }, + "stock": { + "type": "integer", + "description": "Configurable for material rewards. The number of units of the product that you want to share as a reward." + }, + "attributes": { + "type": "object", + "description": "These properties are configurable for material rewards.", + "properties": { + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file." + }, + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a material reward." + } + } + }, + "metadata": { + "type": "string", + "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." + } } - } - }, - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" + }, + "4_req_create_reward_CAMPAIGN": { + "title": "Digital Reward", + "type": "object", + "description": "Request body schema for creating a digital reward using **POST** `/rewards`.", + "properties": { + "name": { + "type": "string", + "description": "Reward name." + }, + "type": { + "type": "string", + "enum": [ + "CAMPAIGN" + ], + "description": "Reward type." + }, + "parameters": { + "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN" + }, + "metadata": { + "type": "string", + "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." + } } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" - }, - { - "$ref": "#/components/schemas/10_req_create_order" + }, + "4_req_create_reward_COIN": { + "title": "Pay with Points Reward", + "type": "object", + "description": "Request body schema for creating a pay with points reward using **POST** `/rewards`.", + "properties": { + "name": { + "type": "string", + "description": "Reward name." + }, + "type": { + "type": "string", + "enum": [ + "COIN" + ], + "description": "Reward type." + }, + "parameters": { + "$ref": "#/components/schemas/4_req_reward_parameters_COIN" + }, + "metadata": { + "type": "string", + "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." + } } - ], - "description": "Order information." - }, - "metadata": { - "type": "object", - "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." - } - } - }, - "6_req_validate_voucher_unpublished_discount_code": { - "title": "Unpublished Discount Code", - "type": "object", - "description": "Request schema model for validating a voucher using **POST** `/vouchers/{code}/validate`.", - "properties": { - "session": { - "type": "string" - } - } - }, - "6_req_session_lock_discount_code": { - "title": "Discount Code Session Lock", - "type": "object", - "description": "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](doc:locking-validation-session).", - "properties": { - "type": { - "type": "string", - "description": "This parameter is **required** to establish a new session. The session locks the redemption **quantity** by 1.", - "enum": [ - "LOCK" - ] - }, - "key": { - "type": "string", - "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", - "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" - }, - "ttl_unit": { - "type": "string", - "description": "Defines the type of unit in which the session time is counted.", - "enum": [ - "HOURS", - "DAYS", - "MINUTES", - "SECONDS", - "MILLISECONDS", - "MICROSECONDS", - "NANOSECONDS" - ] - }, - "ttl": { - "type": "integer", - "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." - } - } - }, - "6_req_session_lock_gift_card": { - "title": "Gift Card Session Lock", - "type": "object", - "description": "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](doc:locking-validation-session).", - "properties": { - "type": { - "type": "string", - "description": "This parameter is **required** to establish a new session. The session locks the redemption **quantity** by 1 and the redemption **gift credits** specified within the request.", - "enum": [ - "LOCK" - ] - }, - "key": { - "type": "string", - "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", - "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" - }, - "ttl_unit": { - "type": "string", - "description": "Defines the type of unit in which the session time is counted.", - "enum": [ - "HOURS", - "DAYS", - "MINUTES", - "SECONDS", - "MILLISECONDS", - "MICROSECONDS", - "NANOSECONDS" - ] - }, - "ttl": { - "type": "integer", - "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." - } - } - }, - "6_req_session_lock_loyalty_card": { - "title": "Loyalty Card Session Lock", - "type": "object", - "description": "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](doc:locking-validation-session).", - "properties": { - "type": { - "type": "string", - "description": "This parameter is **required** to establish a new session. The session locks the redemption **quantity** by 1 and the redemption **loyalty points** specified within the request.", - "enum": [ - "LOCK" - ] - }, - "key": { - "type": "string", - "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", - "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" - }, - "ttl_unit": { - "type": "string", - "description": "Defines the type of unit in which the session time is counted.", - "enum": [ - "HOURS", - "DAYS", - "MINUTES", - "SECONDS", - "MILLISECONDS", - "MICROSECONDS", - "NANOSECONDS" - ] - }, - "ttl": { - "type": "integer", - "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." - } - } - }, - "6_res_session_lock_discount_voucher": { - "title": "Session Lock", - "type": "object", - "description": "Schema model for `session` lock object. The session object contains information about the session key that was used to establish a session between multiple parallel validation and redemption requests.", - "properties": { - "type": { - "type": "string", - "description": "This session locks the redemption **quantity** by 1.", - "default": "LOCK" - }, - "key": { - "type": "string", - "description": "The session unique ID assigned by Voucherify or your own unique session ID. ", - "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" - }, - "ttl_unit": { - "type": "string", - "description": "Defines the type of unit in which the session time is counted.", - "enum": [ - "HOURS", - "DAYS", - "MINUTES", - "SECONDS", - "MILLISECONDS", - "MICROSECONDS", - "NANOSECONDS" - ] - }, - "ttl": { - "type": "integer", - "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." - } - } - }, - "6_res_session_lock_gift_card": { - "title": "Session Lock", - "type": "object", - "description": "Schema model for `session` lock object. The session object contains information about the session key that was used to establish a session between multiple parallel validation and redemption requests.", - "properties": { - "type": { - "type": "string", - "description": "This session locks the redemption **quantity** by 1 and the redemption **gift credits** specified within the request.", - "default": "LOCK" - }, - "key": { - "type": "string", - "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", - "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" - }, - "ttl_unit": { - "type": "string", - "description": "Defines the type of unit in which the session time is counted.", - "enum": [ - "HOURS", - "DAYS", - "MINUTES", - "SECONDS", - "MILLISECONDS", - "MICROSECONDS", - "NANOSECONDS" - ] - }, - "ttl": { - "type": "integer", - "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." - } - } - }, - "6_res_session_lock_loyalty_card": { - "title": "Session Lock", - "type": "object", - "description": "Schema model for `session` lock object. The session object contains information about the session key that was used to establish a session between multiple parallel validation and redemption requests.", - "properties": { - "type": { - "type": "string", - "description": "This session locks the redemption **quantity** by 1 and the redemption **loyalty points** specified within the request.", - "default": "LOCK" - }, - "key": { - "type": "string", - "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", - "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" - }, - "ttl_unit": { - "type": "string", - "description": "Defines the type of unit in which the session time is counted.", - "enum": [ - "HOURS", - "DAYS", - "MINUTES", - "SECONDS", - "MILLISECONDS", - "MICROSECONDS", - "NANOSECONDS" - ] - }, - "ttl": { - "type": "integer", - "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." - } - } - }, - "6_res_validate_voucher_false": { - "type": "object", - "title": "Not Valid", - "description": "Response schema for a voucher that is not valid.", - "examples": [ - { - "valid": false, - "reason": "voucher is disabled", - "error": { - "message": "Voucher has been disabled and is not active anymore." }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "code": "WFf5XAUc", - "metadata": {} - }, - { - "valid": false, - "reason": "Customer must be a holder of a loyalty card.", - "error": { - "message": "You are not the right person." + "4_req_create_reward_MATERIAL": { + "title": "Material Reward", + "type": "object", + "description": "Request body schema to create a material reward using\n **POST** `/rewards`.", + "properties": { + "name": { + "type": "string", + "description": "Reward name." + }, + "type": { + "type": "string", + "enum": [ + "MATERIAL" + ], + "description": "Reward type." + }, + "parameters": { + "$ref": "#/components/schemas/4_req_reward_parameters_MATERIAL" + }, + "stock": { + "type": "integer", + "description": "The number of units of the product that you want to share as a reward." + }, + "attributes": { + "type": "object", + "description": "These properties are configurable for material rewards.", + "properties": { + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file." + }, + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a material reward." + } + } + }, + "metadata": { + "type": "string", + "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." + } + } }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "code": "3TCjkel8", - "metadata": {} - }, - { - "valid": false, - "reason": "loyalty card points exceeded", - "error": { - "message": "You need more loyalty points to be able to redeem a reward." + "4_req_update_reward": { + "title": "Update Reward Request Body", + "description": "Request body schema for **PUT** `/rewards/{rewardId}`.", + "anyOf": [ + { + "$ref": "#/components/schemas/4_req_update_reward_CAMPAIGN" + }, + { + "$ref": "#/components/schemas/4_req_update_reward_COIN" + }, + { + "$ref": "#/components/schemas/4_req_update_reward_MATERIAL" + } + ] }, - "tracking_id": "track_QjgJ4Z5Gv10OpRCXZM8cMIOPCB1PNuli", - "code": "pfeDMTsj", - "metadata": {} - }, - { - "valid": false, - "reason": "order does not match validation rules", - "error": { - "code": 400, - "key": "order_rules_violated", - "message": "order does not match validation rules", - "details": "Loyalty Card cannot be redeemed because of violated validation rules: val_RU9fm8GiQaRT", - "request_id": "v-0bcbde194f1305ad88" - }, - "tracking_id": "track_QjgJ4Z5Gv10OpRCXZM8cMIOPCB1PNuli", - "code": "pfeDMTsj", - "metadata": {} - } - ], - "properties": { - "valid": { - "type": "boolean", - "default": false, - "description": "Indicates whether the voucher is valid within the context of the parameters provided in the request body." - }, - "reason": { - "type": "string", - "description": "System generated cause for the voucher being invalid in the context of the provided parameters." - }, - "error": { - "type": "object", - "description": "Detailed failure cause for the invalid voucher if the reason has a translation defined in the Dashboard → Project Settings → Error Messages.", - "properties": { - "message": { - "type": "string", - "description": "Customized error message." + "4_req_update_reward-copy": { + "title": "Update Reward Request Body", + "type": "object", + "description": "Request body schema for **PUT** `/rewards/{rewardId}`.", + "properties": { + "name": { + "type": "string", + "description": "Reward name." + }, + "parameters": { + "oneOf": [ + { + "$ref": "#/components/schemas/4_req_reward_parameters_COIN" + }, + { + "$ref": "#/components/schemas/4_req_reward_parameters_MATERIAL" + }, + { + "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN" + } + ], + "description": "Defines how the reward is generated." + }, + "stock": { + "type": "integer", + "description": "Configurable for material rewards. The number of units of the product that you want to share as a reward." + }, + "attributes": { + "type": "object", + "description": "These properties are configurable for material rewards.", + "properties": { + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file." + }, + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a material reward." + } + } + }, + "metadata": { + "type": "string", + "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." + } } - } - }, - "tracking_id": { - "type": "string", - "description": "Hashed customer source ID." - }, - "code": { - "type": "string", - "description": "Voucher code." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - } - } - }, - "6_res_validate_voucher_discount_amount": { - "title": "Amount Discount", - "type": "object", - "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", - "properties": { - "type": { - "type": "string", - "default": "AMOUNT", - "description": "Defines the type of voucher." - }, - "effect": { - "type": "string", - "description": "Defines how the discount is applied to the customer's order.", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS", - "APPLY_TO_ITEMS_PROPORTIONALLY", - "APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY", - "APPLY_TO_ITEMS_BY_QUANTITY" - ] - }, - "amount_off": { - "type": "integer", - "description": "Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. " - } - } - }, - "6_res_validate_voucher_discount_percent": { - "title": "Percent Discount", - "type": "object", - "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", - "properties": { - "type": { - "type": "string", - "default": "PERCENT", - "description": "Defines the type of voucher." - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS" - ], - "description": "Defines how the discount is applied to the customer's order." - }, - "percent_off": { - "type": "integer", - "description": "The percent discount that the customer will receive." - }, - "amount_limit": { - "type": "integer", - "description": "Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600." - }, - "is_dynamic": { - "type": "boolean", - "description": "Flag indicating whether the discount was calculated using a formula." - } - } - }, - "6_res_validate_voucher_discount_fixed": { - "title": "Fixed Discount", - "type": "object", - "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value. A fixed discounts sets a fixed total on cart or item(s) and then calculates the discount to apply.", - "properties": { - "type": { - "type": "string", - "default": "FIXED", - "description": "Type of discount." - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS" - ], - "description": "Defines how the discount is applied to the customer's order. \n \n| **Effect** | **Definition** |\n|---|---|\n| **APPLY_TO_ORDER** | Sets the order total amount to the value of the fixed amount. The discount value is calculated during the redemption as it's a difference between the total amount of the customer's order and the fixed amount. |\n| **APPLY_TO_ITEMS** | Sets a new price on items. The total discount amount is calculated during the redemption and it's a difference between the initial item price and the fixed amount. |" - }, - "fixed_amount": { - "type": "integer", - "description": "Set a fixed valued for an order total or price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. In case of the fixed amount being calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value." - } - } - }, - "6_res_validate_voucher_discount_unit": { - "title": "Unit Discount, single item", - "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", - "oneOf": [ - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_product" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_sku" - } - ] - }, - "6_res_validate_voucher_discount_unit_product": { - "title": "Unit Discount, Product", - "type": "object", - "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", - "properties": { - "type": { - "type": "string", - "default": "UNIT", - "description": "Discount type." - }, - "effect": { - "type": "string", - "enum": [ - "ADD_MISSING_ITEMS", - "ADD_NEW_ITEMS" - ], - "description": "Defines how the unit is added to the customer's order." - }, - "unit_off": { - "type": "integer", - "description": "Number of units to be granted a full value discount." - }, - "unit_type": { - "type": "string", - "example": "prod_0a9f9ab4ab019a42d5", - "description": "The product deemed as free, chosen from product inventory (e.g. time, items)." - }, - "product": { - "type": "object", - "description": "Contains information about the product.", - "properties": { - "id": { - "type": "string", - "description": "Unique product ID, assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "Product's source ID." - }, - "name": { - "type": "string", - "description": "Product name." + }, + "4_req_update_reward_CAMPAIGN": { + "title": "Digital Reward", + "type": "object", + "description": "Request body schema for updating a digital reward using **PUT** `/rewards/{rewardId}`.", + "properties": { + "name": { + "type": "string", + "description": "Reward name." + }, + "parameters": { + "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN" + }, + "metadata": { + "type": "string", + "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." + } } - } - } - } - }, - "6_res_validate_voucher_discount_unit_sku": { - "title": "Unit Discount, SKU", - "type": "object", - "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", - "properties": { - "type": { - "type": "string", - "default": "UNIT", - "description": "Discount type." - }, - "effect": { - "type": "string", - "enum": [ - "ADD_MISSING_ITEMS", - "ADD_NEW_ITEMS" - ], - "description": "Defines how the unit is added to the customer's order." - }, - "unit_off": { - "type": "integer", - "description": "Number of units to be granted a full value discount." - }, - "unit_type": { - "type": "string", - "example": "sku_0bae3b28f610fd0da1", - "description": "The product variant deemed as free, chosen from product inventory (e.g. time, items)." - }, - "sku": { - "type": "object", - "description": "Contains information about the SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_0bae3b28f610fd0da1", - "description": "Unique SKU ID, assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "Product variant's source ID." - }, - "sku": { - "type": "string", - "description": "Product varient's name." + }, + "4_req_update_reward_COIN": { + "title": "Pay with Points Reward", + "type": "object", + "description": "Request body schema for updating a pay with points reward using **PUT** `/rewards/{rewardId}`.", + "properties": { + "name": { + "type": "string", + "description": "Reward name." + }, + "parameters": { + "$ref": "#/components/schemas/4_req_reward_parameters_COIN" + }, + "metadata": { + "type": "string", + "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." + } } - } - }, - "product": { - "type": "object", - "description": "Contains information about the parent product.", - "properties": { - "id": { - "type": "string", - "description": "Unique parent product ID, assigned by Voucherify.", - "example": "prod_0bae2dc5a090fd0184" - }, - "source_id": { - "type": "string", - "description": "Source ID of parent product." - }, - "name": { - "type": "string", - "description": "Name of parent product." + }, + "4_req_update_reward_MATERIAL": { + "title": "Material Reward", + "type": "object", + "description": "Request body schema for updating a material reward using **PUT** `/rewards/{rewardId}`.", + "properties": { + "name": { + "type": "string", + "description": "Reward name." + }, + "parameters": { + "$ref": "#/components/schemas/4_req_reward_parameters_MATERIAL" + }, + "stock": { + "type": "integer", + "description": "The number of units of the product that you want to share as a reward." + }, + "attributes": { + "type": "object", + "description": "These properties are configurable for material rewards.", + "properties": { + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file." + }, + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a material reward." + } + } + }, + "metadata": { + "type": "string", + "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." + } } - } - } - } - }, - "6_res_validate_voucher_discount_unit_multiple": { - "title": "Unit Discount, multiple items", - "type": "object", - "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", - "properties": { - "type": { - "type": "string", - "default": "UNIT", - "description": "Discount type." - }, - "effect": { - "type": "string", - "default": "ADD_MANY_ITEMS", - "description": "Defines how the discount is applied to the customer's order." - }, - "units": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_product_multiple" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_sku_multiple" + }, + "4_req_reward_parameters_CAMPAIGN_LOYALTY_PROGRAM": { + "title": "Points on loyalty card", + "type": "object", + "description": "Configure a reward that adds points to a loyalty card. This type of reward is a subset of a Digital (CAMPAIGN) reward.", + "properties": { + "id": { + "type": "string", + "description": "Assign the reward to the campaign that contains the loyalty cards that will be replenished by the reward. Provide the unique campaign ID, assigned by Voucherify.", + "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" + }, + "balance": { + "type": "integer", + "description": "The incremental points to be added to the current balance on the loyalty card." + } } - ] - } - } - }, - "6_res_validate_voucher_discount_unit_product_multiple": { - "title": "Product Item", - "type": "object", - "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", - "properties": { - "effect": { - "type": "string", - "enum": [ - "ADD_MISSING_ITEMS", - "ADD_NEW_ITEMS" - ], - "description": "Defines how the unit is added to the customer's order." - }, - "unit_off": { - "type": "integer", - "description": "Number of units to be granted a full value discount." - }, - "unit_type": { - "type": "string", - "example": "prod_0a9f9ab4ab019a42d5", - "description": "The product deemed as free, chosen from product inventory (e.g. time, items)." - }, - "product": { - "type": "object", - "description": "Contains information about the product.", - "properties": { - "id": { - "type": "string", - "description": "Unique product ID, assigned by Voucherify.", - "example": "prod_0a9f9ab4ab019a42d5" - }, - "source_id": { - "type": "string", - "description": "Product's source ID." - }, - "name": { - "type": "string", - "description": "Product name." - } - } - } - } - }, - "6_res_validate_voucher_discount_unit_sku_multiple": { - "title": "SKU Item", - "type": "object", - "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", - "properties": { - "effect": { - "type": "string", - "enum": [ - "ADD_MISSING_ITEMS", - "ADD_NEW_ITEMS" - ], - "description": "Defines how the unit is added to the customer's order." - }, - "unit_off": { - "type": "integer", - "description": "Number of units to be granted a full value discount." - }, - "unit_type": { - "type": "string", - "example": "sku_0bae3b28f610fd0da1", - "description": "The product variant deemed as free, chosen from product inventory (e.g. time, items)." - }, - "sku": { - "type": "object", - "description": "Contains information about the SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_0bae3b28f610fd0da1", - "description": "Unique SKU ID, assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "Product variant's source ID." - }, - "sku": { - "type": "string", - "description": "Product varient's name." - } - } - }, - "product": { - "type": "object", - "description": "Contains information about the parent product.", - "properties": { - "id": { - "type": "string", - "description": "Unique parent product ID, assigned by Voucherify.", - "example": "prod_0b7d7dfb05cbe5c616" - }, - "source_id": { - "type": "string", - "description": "Source ID of parent product." - }, - "name": { - "type": "string", - "description": "Name of parent product." + }, + "4_req_reward_parameters_CAMPAIGN_GIFT_VOUCHERS": { + "title": "Gift Vouchers", + "type": "object", + "description": "Configure a reward that adds cash to a gift card. This type of reward is a subset of a Digital (CAMPAIGN) reward.", + "properties": { + "id": { + "type": "string", + "description": "Assign the reward to the campaign that contains the gift cards that will be replenished by the reward. Provide the unique campaign ID, assigned by Voucherify.", + "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" + }, + "balance": { + "type": "integer", + "description": "The incremental amout to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + } } - } - } - } - }, - "6_res_validate_voucher_discount_shipping": { - "title": "Shipping Discount", - "type": "object", - "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", - "properties": { - "type": { - "type": "string", - "default": "UNIT", - "description": "Discount type." - }, - "effect": { - "type": "string", - "description": "Defines how the unit is added to the customer's order.", - "default": "ADD_MISSING_ITEMS" - }, - "unit_off": { - "type": "integer", - "description": "Number of units to be granted a full value discount.", - "default": 1 - }, - "unit_type": { - "type": "string", - "description": "The shipping \"product\" deemed as free.", - "default": "prod_5h1pp1ng" - }, - "product": { - "type": "object", - "description": "Contains information about the shipping \"product\".", - "properties": { - "id": { - "type": "string", - "description": "Unique shipping \"product\" ID, assigned by Voucherify.", - "default": "prod_5h1pp1ng" - }, - "source_id": { - "type": "string", - "description": "\"Product's\" source ID.", - "default": "5h1pp1ng" - }, - "name": { - "type": "string", - "description": "\"Product\" name.", - "default": "Shipping" + }, + "4_req_reward_parameters_CAMPAIGN_DISCOUNT_COUPONS": { + "title": "Discount Coupons", + "type": "object", + "description": "Configure a reward that provides a discount coupon. This type of reward is a subset of a Digital (CAMPAIGN) reward.", + "properties": { + "id": { + "type": "string", + "description": "Assign the reward to the campaign that contains the vouchers that will be the source of the reward. Provide the unique campaign ID, assigned by Voucherify.", + "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" + } } - } - } - } - }, - "6_res_validate_voucher": { - "title": "Valid", - "description": "Response schema model for validating a voucher using **POST** `/vouchers/{code}/validate`.", - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_code" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_gift_card" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_loyalty_card" - } - ] - }, - "6_res_validate_voucher_discount_code": { - "type": "object", - "title": "Valid - Discount Code", - "description": "Response schema model for validating a discount code using **POST** `/vouchers/{code}/validate`.", - "properties": { - "valid": { - "type": "boolean", - "description": "Indicates whether the voucher is valid within the context of the parameters provided in the request body." - }, - "applicable_to": { - "$ref": "#/components/schemas/6_res_applicable_to_object" - }, - "inapplicable_to": { - "$ref": "#/components/schemas/6_res_inapplicable_to_object" - }, - "tracking_id": { - "type": "string", - "description": "Hashed customer source ID." - }, - "order": { - "$ref": "#/components/schemas/6_obj_order_object" - }, - "code": { - "type": "string", - "description": "Voucher code." - }, - "discount": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_amount" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_percent" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_fixed" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_shipping" + }, + "4_req_reward_parameters_CAMPAIGN": { + "title": "Digital Reward", + "type": "object", + "description": "Configure a digital (CAMPAIGN) reward. These can be in the form of discount coupons, gift card credits, or loyalty point credits.", + "properties": { + "campaign": { + "description": "Objects stores information about the campaign related to the reward.", + "anyOf": [ + { + "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN_LOYALTY_PROGRAM" + }, + { + "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN_GIFT_VOUCHERS" + }, + { + "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN_DISCOUNT_COUPONS" + } + ] + } } - ], - "description": "Contains information about the discount to be applied to the order." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - }, - "start_date": { - "type": "string", - "format": "date-time", - "example": "2022-10-04T00:00:00.000Z", - "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is _inactive_ before this date." - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-10-31T00:00:00.000Z", - "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is _inactive_ after this date." - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "example": "camp_W8DJVd8J0btqXT6FBwn7BSkC", - "description": "Voucher's parent campaign's unique ID." - }, - "session": { - "$ref": "#/components/schemas/6_res_session_lock_discount_voucher" - } - } - }, - "6_res_validate_voucher_gift_card": { - "type": "object", - "title": "Valid - Gift Card", - "description": "Response schema model for validating a gift card using **POST** `/vouchers/{code}/validate`.", - "properties": { - "valid": { - "type": "boolean", - "description": "Indicates whether the voucher is valid within the context of the parameters provided in the request body." - }, - "applicable_to": { - "$ref": "#/components/schemas/6_res_applicable_to_object" - }, - "inapplicable_to": { - "$ref": "#/components/schemas/6_res_inapplicable_to_object" - }, - "tracking_id": { - "type": "string", - "description": "Hashed customer source ID." - }, - "order": { - "$ref": "#/components/schemas/6_obj_order_object" - }, - "code": { - "type": "string", - "description": "Voucher code." - }, - "gift": { - "type": "object", - "description": "Contains current gift card balance information.", - "properties": { - "amount": { - "type": "integer", - "description": "Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "balance": { - "type": "integer", - "description": "Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS" - ], - "description": "Defines how the credits are applied to the customer's order." + }, + "4_req_reward_parameters_MATERIAL": { + "title": "Material Reward", + "type": "object", + "description": "Configure parameters representing products as a (MATERIAL) reward.", + "properties": { + "product": { + "type": "object", + "description": "Define the product given as a reward.", + "properties": { + "id": { + "type": "string", + "example": "prod_0b7d7dfb05cbe5c616", + "description": "Unique product ID, assigned by Voucherify, given as a reward." + }, + "sku_id": { + "type": [ + "string", + "null" + ], + "description": "Unique SKU ID, assigned by Voucherify, of the SKU given as a reward.", + "example": "sku_0b7d7dfb090be5c619" + } + } + } } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - }, - "start_date": { - "type": "string", - "format": "date-time", - "example": "2022-10-04T00:00:00.000Z", - "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is _inactive_ before this date." - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-10-31T00:00:00.000Z", - "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is _inactive_ after this date." - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "example": "camp_W8DJVd8J0btqXT6FBwn7BSkC", - "description": "Voucher's parent campaign's unique ID." - }, - "session": { - "$ref": "#/components/schemas/6_res_session_lock_gift_card" - } - } - }, - "6_res_validate_voucher_loyalty_card": { - "type": "object", - "title": "Valid - Loyalty Card", - "description": "Response schema model for validating a loyalty card using **POST** `/vouchers/{code}/validate`.", - "properties": { - "valid": { - "type": "boolean", - "description": "Indicates whether the voucher is valid within the context of the parameters provided in the request body." - }, - "applicable_to": { - "$ref": "#/components/schemas/6_res_applicable_to_object" - }, - "inapplicable_to": { - "$ref": "#/components/schemas/6_res_inapplicable_to_object" - }, - "tracking_id": { - "type": "string", - "description": "Hashed customer source ID." - }, - "order": { - "$ref": "#/components/schemas/6_obj_order_object_apply_to_order" - }, - "code": { - "type": "string", - "description": "Voucher code." - }, - "loyalty": { - "type": "object", - "description": "Contains the cost of reward in points.", - "properties": { - "points_cost": { - "type": "integer", - "description": "Number of points that wlil be deducted from loyaty card for the associated reward." + }, + "4_req_reward_parameters_COIN": { + "title": "Pay with Points Reward", + "type": "object", + "description": "Configure parameters representing a Pay with Points (COIN) reward. ", + "properties": { + "coin": { + "type": "object", + "description": "Define the ratio by mapping the number of loyalty points in `points_ratio` to a predefined cash amount in `exchange_ratio`.", + "properties": { + "exchange_ratio": { + "type": [ + "string", + "integer" + ], + "description": "The cash equivalent of the points defined in the `points_ratio` property." + }, + "points_ratio": { + "type": [ + "string", + "integer" + ], + "description": "The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property." + } + } + } } - } - }, - "reward": { - "type": "object", - "description": "Contains information about the reward that is being validated.", - "properties": { - "id": { - "type": "string", - "description": "Unique reward ID assigned by Voucherify.", - "example": "rew_Crmu3hu2FKZWZIML59AeAs1n" - }, - "assignment_id": { - "type": "string", - "example": "rewa_xZr6Ks0j5AHeMRVdELmpI9sc", - "description": "Unique reward assignment ID assigned by Voucherify." - }, - "points": { - "type": "integer", - "description": "Number of points applied to the reward." + }, + "4_res_list_rewards": { + "type": "object", + "description": "Response body schema for **GET** `/rewards`.", + "title": "List Rewards Response Body", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about rewards in a dictionary.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of rewards.", + "default": "data" + }, + "data": { + "type": "array", + "description": "Contains array of reward objects.", + "items": { + "$ref": "#/components/schemas/4_obj_reward_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of rewards." + } } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - }, - "start_date": { - "type": "string", - "format": "date-time", - "example": "2022-10-04T00:00:00.000Z", - "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is _inactive_ before this date." - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-10-31T00:00:00.000Z", - "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is _inactive_ after this date." - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "example": "camp_W8DJVd8J0btqXT6FBwn7BSkC", - "description": "Voucher's parent campaign's unique ID." - }, - "session": { - "$ref": "#/components/schemas/6_res_session_lock_loyalty_card" - } - } - }, - "6_res_applicable_to_object": { - "title": "Included Items", - "type": "object", - "description": "Contains list of items that qualify in the scope of the discount. These are definitions of included products, SKUs, and product collections. These can be discounted.", - "properties": { - "data": { - "type": "array", - "description": "Contains array of items to which the discount can apply.", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_product_collection" + }, + "4_obj_reward_assignment_object": { + "title": "Reward Assignment Object", + "type": "object", + "description": "This is an object representing a reward assignment.", + "x-tags": [ + "REWARDS API" + ], + "properties": { + "id": { + "type": "string", + "example": "rewa_PbIRoMXpwe5QhobW4JKu0VjH", + "description": "Unique reward assignment ID, assigned by Voucherify." }, - { - "$ref": "#/components/schemas/6_res_product_collection_unit" + "reward_id": { + "type": "string", + "description": "Associated reward ID.", + "example": "rew_C7wS9eHFDN4CIbXI5PpLSkGY" }, - { - "$ref": "#/components/schemas/6_res_product_collection_fixed_amount" + "related_object_id": { + "type": "string", + "description": "Related object ID to which the reward was assigned.", + "example": "camp_wciTvaOfYmAa3EmIIW3QpXXZ" }, - { - "$ref": "#/components/schemas/6_res_product" + "related_object_type": { + "type": "string", + "description": "Related object type to which the reward was assigned.", + "example": "campaign" }, - { - "$ref": "#/components/schemas/6_res_product_unit" + "parameters": { + "description": "Defines the cost of the reward.", + "type": "object", + "properties": { + "loyalty": { + "type": "object", + "description": "Defines the equivalent points value of the reward.", + "properties": { + "points": { + "type": "integer", + "description": "The number of points required to redeem the reward." + } + } + } + } }, - { - "$ref": "#/components/schemas/6_res_product_fixed_amount" + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the reward assignment was created in ISO 8601 format.", + "example": "2022-08-11T14:49:22.586Z", + "format": "date-time" }, - { - "$ref": "#/components/schemas/6_res_sku" + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format.", + "example": "2022-08-11T16:01:34.885Z", + "format": "date-time" }, - { - "$ref": "#/components/schemas/6_res_sku_unit" + "object": { + "type": "string", + "default": "reward_assignment", + "description": "The type of object represented by the JSON. This object stores information about the reward assignment." + } + } + }, + "4_res_list_reward_assignments": { + "type": "object", + "description": "Response body schema for **GET** `/rewards/{rewardID}/assignments`.", + "title": "List Reward Assignments Response Body", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about reward assignments in a dictionary.", + "default": "list" }, - { - "$ref": "#/components/schemas/6_res_sku_unit_fixed_amount" + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of reward assignments.", + "default": "data" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/4_obj_reward_assignment_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of reward assignments." + } + } + }, + "4_req_update_reward_assignment": { + "type": "object", + "description": "Request body schema for **PUT** `/rewards/{rewardID}/assignments/{assignmentID}`.", + "title": "Update Reward Assignment Request Body", + "properties": { + "parameters": { + "type": "object", + "description": "Defines the cost of the reward.", + "properties": { + "loyalty": { + "type": "object", + "description": "Defines the equivalent points value of the reward.", + "properties": { + "points": { + "type": "integer", + "description": "Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed." + } + } + } + } + } + } + }, + "4_req_create_reward_assignment": { + "type": "object", + "description": "Request body schema for **POST** `/rewards/{rewardID}/assignments`.", + "title": "Create Reward Assignment Request Body", + "properties": { + "campaign": { + "type": "string", + "description": "The campaign ID of the campaign to which the reward is to be assigned." + }, + "parameters": { + "type": "object", + "description": "Defines the cost of the reward.", + "required": [ + "loyalty" + ], + "properties": { + "loyalty": { + "type": "object", + "description": "Defines the equivalent points value of the reward.", + "properties": { + "points": { + "type": "integer", + "description": "Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed." + } + } + } + } } + }, + "required": [ + "campaign", + "parameters" ] - } - }, - "total": { - "type": "integer", - "description": "Total number of objects defining included products, SKUs, or product collections." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of included objects." - }, - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about included products, SKUs, or product collections in a dictionary." - } - } - }, - "6_res_inapplicable_to_object": { - "title": "Excluded Items", - "type": "object", - "description": "Contains list of items that **do not** qualify in the scope of the discount. These are definitions of excluded products, SKUs, and product collections. These **CANNOT** be discounted.", - "properties": { - "data": { - "description": "Contains array of items to which the discount cannot apply.", - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_product_collection_excluded" + }, + "5_obj_publication_object": { + "title": "Publication Object", + "type": "object", + "description": "This is an object representing a publication. ", + "x-tags": [ + "PUBLICATIONS API" + ], + "properties": { + "id": { + "type": "string", + "example": "pub_BbjAXnmm8e0SIm3zG8qvvFCP0KuLywtp", + "description": "Unique publication ID, assigned by Voucherify." }, - { - "$ref": "#/components/schemas/6_res_product_excluded" + "object": { + "type": "string", + "default": "publication", + "description": "The type of object represented by the JSON. This object stores information about the publication." }, - { - "$ref": "#/components/schemas/6_res_sku_excluded" + "created_at": { + "type": "string", + "example": "2022-09-23T09:57:00.434Z", + "description": "Timestamp representing the date and time when the publication was created in ISO 8601 format.", + "format": "date-time" + }, + "customer_id": { + "type": "string", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "description": "Unique customer ID of the customer receiving the publication." + }, + "tracking_id": { + "type": "string", + "description": "Customer's `source_id`." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." + }, + "channel": { + "type": "string", + "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", + "enum": [ + "voucherify-website", + "Dashboard", + "Automation", + "API", + "Braze", + "Reward", + "SMS", + "Email", + "Activecampaign", + "Webhook", + "Intercom", + "Mailchimp", + "Shopify" + ] + }, + "source_id": { + "type": "string", + "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. " + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Status of the publication attempt." + }, + "customer": { + "type": "object", + "description": "Contains information about the customer to whom the publication was directed.", + "properties": { + "id": { + "type": "string", + "description": "Unique customer ID, assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's name." + }, + "email": { + "type": "string", + "description": "Customer's email." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs attached to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments." + }, + "object": { + "type": "string", + "default": "customer", + "description": "The type of object represented by the JSON. This object stores information about the customer." + } + } + }, + "voucher": { + "description": "Contains information about the voucher being published.", + "anyOf": [ + { + "$ref": "#/components/schemas/5_obj_publication_object_discount" + }, + { + "$ref": "#/components/schemas/5_obj_publication_object_loyalty_card" + }, + { + "$ref": "#/components/schemas/5_obj_publication_object_gift_card" + } + ] + }, + "vouchers_id": { + "type": "array", + "description": "Contains the unique internal voucher ID that was assigned by Voucherify.", + "items": { + "type": "string", + "example": "[ v_Bw3qWZWv47yb1Onra8F2LlFI1enLakfA ]" + } + } + } + }, + "5_req_create_publication_standalone_voucher": { + "title": "Standalone Voucher", + "type": "object", + "description": "Create publication for standalone voucher.", + "properties": { + "source_id": { + "type": "string", + "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. " + }, + "channel": { + "type": "string", + "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", + "enum": [ + "voucherify-website", + "Dashboard", + "Automation", + "API", + "Braze", + "Reward", + "SMS", + "Email", + "Activecampaign", + "Webhook", + "Intercom", + "Mailchimp", + "Shopify" + ] + }, + "customer": { + "description": "Contains information about the customer to whom the publication was directed.", + "anyOf": [ + { + "$ref": "#/components/schemas/5_res_create_publication_customer_id" + }, + { + "$ref": "#/components/schemas/5_res_create_publication_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ] + }, + "voucher": { + "description": "Code of voucher being published.", + "type": "string" + }, + "campaign": { + "type": "string", + "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." + } + } + }, + "5_req_create_publication_from_campaign": { + "title": "Voucher from Campaign", + "description": "Create a publication for a voucher from a campaign.", + "oneOf": [ + { + "$ref": "#/components/schemas/5_req_create_publication_from_campaign_auto_update" + }, + { + "$ref": "#/components/schemas/5_req_create_publication_from_campaign_one_specific_voucher" + }, + { + "$ref": "#/components/schemas/5_req_create_publication_from_campaign_multiple_vouchers" } ] - } - }, - "total": { - "type": "integer", - "description": "Total number of objects defining excluded products, SKUs, or product collections." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of excluded objects." - }, - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about excluded products, SKUs, or product collections in a dictionary." - } - } - }, - "6_res_product_collection": { - "title": "Product Collection", - "type": "object", - "description": "Contains definition for a product collection.", - "properties": { - "object": { - "type": "string", - "default": "products_collection", - "description": "This object stores information about the product collection." - }, - "id": { - "type": "string", - "example": "pc_4ndRXAsTOzwSdHcQcxf489uU", - "description": "Unique product collection ID assigned by Voucherify." - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Defines how the discount is applied to the customer's order." - } - } - }, - "6_res_product_collection_unit": { - "title": "Product Collection for Unit Discount", - "type": "object", - "description": "Contains definition for a product collection.", - "properties": { - "object": { - "type": "string", - "default": "products_collection", - "description": "This object stores information about the product collection." - }, - "id": { - "type": "string", - "example": "pc_4ndRXAsTOzwSdHcQcxf489uU", - "description": "Unique product collection ID assigned by Voucherify." - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Defines how the discount is applied to the customer's order." - }, - "quantity_limit": { - "type": "integer", - "description": "The maximum number of units allowed to be discounted per order line item." - }, - "aggregated_quantity_limit": { - "type": "integer", - "description": "The maximum number of units allowed to be discounted combined across all matched order line items." - } - } - }, - "6_res_product_collection_fixed_amount": { - "title": "Product Collection for Fixed Amount Discount", - "type": "object", - "description": "Contains definition for a product collection.", - "properties": { - "object": { - "type": "string", - "default": "products_collection", - "description": "This object stores information about the product collection." - }, - "id": { - "type": "string", - "example": "pc_4ndRXAsTOzwSdHcQcxf489uU", - "description": "Unique product collection ID assigned by Voucherify." - }, - "strict": { - "type": "boolean" - }, - "price": { - "type": "integer", - "description": "New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the `price_formula` parameter is present in the fixed price definition, this value becomes the **fallback value**. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price." - }, - "price_formula": { - "type": "string", - "description": "Formula used to calculate the discounted price of an item.", - "example": "\"IF(ORDER_AMOUNT > 300;ORDER_ITEM_PRICE * 0.8;ORDER_ITEM_PRICE)" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Defines how the discount is applied to the customer's order." - } - } - }, - "6_res_product_collection_excluded": { - "title": "Product Collection", - "type": "object", - "description": "Contains definition for a product collection.", - "properties": { - "object": { - "type": "string", - "default": "products_collection", - "description": "This object stores information about the product collection." - }, - "id": { - "type": "string", - "example": "pc_4ndRXAsTOzwSdHcQcxf489uU", - "description": "Unique product collection ID assigned by Voucherify." - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY" - ], - "description": "Defines how the discount is applied to the customer's order." - } - } - }, - "6_res_sku": { - "title": "SKU", - "type": "object", - "description": "Contains definition for a product variant.", - "properties": { - "object": { - "type": "string", - "default": "sku", - "description": "This object stores information about the product variant." - }, - "id": { - "type": "string", - "description": "Unique SKU ID assigned by Voucherify.", - "example": "sku_0b7d7dfb090be5c619" - }, - "source_id": { - "type": "string", - "description": "The source ID from your inventory system." - }, - "product_id": { - "type": "string", - "description": "Parent product's unique ID assigned by Voucherify." - }, - "product_source_id": { - "type": "string", - "description": "Parent product's source ID from your inventory system." - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Defines how the discount is applied to the customer's order." - } - } - }, - "6_res_sku_unit": { - "title": "SKU for Unit Discount", - "type": "object", - "description": "Contains definition for a product variant.", - "properties": { - "object": { - "type": "string", - "default": "sku", - "description": "This object stores information about the product variant." - }, - "id": { - "type": "string", - "description": "Unique SKU ID assigned by Voucherify.", - "example": "sku_0b7d7dfb090be5c619" - }, - "source_id": { - "type": "string", - "description": "The source ID from your inventory system." - }, - "product_id": { - "type": "string", - "description": "Parent product's unique ID assigned by Voucherify." - }, - "product_source_id": { - "type": "string", - "description": "Parent product's source ID from your inventory system." - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Defines how the discount is applied to the customer's order." - }, - "quantity_limit": { - "type": "integer", - "description": "The maximum number of units allowed to be discounted per order line item." - }, - "aggregated_quantity_limit": { - "type": "integer", - "description": "The maximum number of units allowed to be discounted combined across all matched order line items." - } - } - }, - "6_res_sku_unit_fixed_amount": { - "title": "SKU for Amount Discount", - "type": "object", - "description": "Contains definition for a product variant.", - "properties": { - "object": { - "type": "string", - "default": "sku", - "description": "This object stores information about the product variant." - }, - "id": { - "type": "string", - "description": "Unique SKU ID assigned by Voucherify.", - "example": "sku_0b7d7dfb090be5c619" - }, - "source_id": { - "type": "string", - "description": "The source ID from your inventory system." - }, - "product_id": { - "type": "string", - "description": "Parent product's unique ID assigned by Voucherify." - }, - "product_source_id": { - "type": "string", - "description": "Parent product's source ID from your inventory system." - }, - "strict": { - "type": "boolean" - }, - "price": { - "type": "integer", - "description": "New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the `price_formula` parameter is present in the fixed price definition, this value becomes the **fallback value**. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price." - }, - "price_formula": { - "type": "string", - "description": "Formula used to calculate the discounted price of an item.", - "example": "IF(ORDER_AMOUNT > 200;ORDER_ITEM_PRICE * 0.2;6)" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Defines how the discount is applied to the customer's order." - } - } - }, - "6_res_sku_excluded": { - "title": "SKU", - "type": "object", - "description": "Contains definition for a product variant.", - "properties": { - "object": { - "type": "string", - "default": "sku", - "description": "This object stores information about the product variant." - }, - "id": { - "type": "string", - "description": "Unique SKU ID assigned by Voucherify.", - "example": "sku_0b7d7dfb090be5c619" - }, - "source_id": { - "type": "string", - "description": "The source ID from your inventory system." - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY" - ], - "description": "Defines how the discount is applied to the customer's order." - } - } - }, - "6_res_product": { - "title": "Product", - "type": "object", - "description": "Contains definition for a product.", - "properties": { - "object": { - "type": "string", - "default": "product", - "description": "This object stores information about the product." - }, - "id": { - "type": "string", - "description": "Unique product ID assigned by Voucherify.", - "example": "prod_0bae2dc5a090fd0184" - }, - "source_id": { - "type": "string", - "description": "The product ID from your inventory system." - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Defines how the discount is applied to the customer's order." - } - } - }, - "6_res_product_unit": { - "title": "Product for Unit Discount", - "type": "object", - "description": "Contains definition for a product.", - "properties": { - "object": { - "type": "string", - "default": "product", - "description": "This object stores information about the product." - }, - "id": { - "type": "string", - "description": "Unique product ID assigned by Voucherify.", - "example": "prod_0bae2dc5a090fd0184" - }, - "source_id": { - "type": "string", - "description": "The product ID from your inventory system." - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Defines how the discount is applied to the customer's order." - }, - "quantity_limit": { - "type": "integer", - "description": "The maximum number of units allowed to be discounted per order line item." - }, - "aggregated_quantity_limit": { - "type": "integer", - "description": "The maximum number of units allowed to be discounted combined across all matched order line items." - } - } - }, - "6_res_product_fixed_amount": { - "title": "Product for Fixed Amount Discount", - "type": "object", - "description": "Contains definition for a product.", - "properties": { - "object": { - "type": "string", - "default": "product", - "description": "This object stores information about the product." - }, - "id": { - "type": "string", - "description": "Unique product ID assigned by Voucherify.", - "example": "prod_0bae2dc5a090fd0184" - }, - "source_id": { - "type": "string", - "description": "The product ID from your inventory system." - }, - "strict": { - "type": "boolean" - }, - "price": { - "type": "integer", - "description": "New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the `price_formula` parameter is present in the fixed price definition, this value becomes the **fallback value**. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price." - }, - "price_formula": { - "type": "string", - "description": "Formula used to calculate the discounted price of an item.", - "example": "IF(ORDER_AMOUNT > 300;ORDER_ITEM_PRICE * 0.8;ORDER_ITEM_PRICE)" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Defines how the discount is applied to the customer's order." - } - } - }, - "6_res_product_excluded": { - "title": "Product", - "type": "object", - "description": "Contains definition for a product.", - "properties": { - "object": { - "type": "string", - "default": "product", - "description": "This product stores information about the product." - }, - "id": { - "type": "string", - "description": "Unique product ID assigned by Voucherify.", - "example": "prod_0bae2dc5a090fd0184" - }, - "source_id": { - "type": "string", - "description": "The product ID from your inventory system." - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY" - ], - "description": "Defines how the discount is applied to the customer's order." - } - } - }, - "6_obj_order_object": { - "title": "Order object", - "description": "This is an object representing an order with calculated discounts applied using the voucher code.", - "oneOf": [ - { - "$ref": "#/components/schemas/6_obj_order_object_apply_to_order" - }, - { - "$ref": "#/components/schemas/6_obj_order_object_apply_to_items" - } - ] - }, - "6_obj_order_object_apply_to_order": { - "type": "object", - "title": "Order object - Effect: Apply to order", - "description": "This is an object representing an order with calculated discounts applied using the voucher code.", - "properties": { - "id": { - "type": "string", - "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", - "description": "Unique order ID, assigned by Voucherify. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:40:48.705Z", - "description": "Timestamp representing the date and time when the order was created in ISO 8601 format. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:47:20.760Z", - "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." - }, - "status": { - "type": "string", - "description": "Order status. This parameter is returned if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body or if you send the request body parameter when defining an order in the request body. This parameter can be passed but it's not required for validation at all. It's used in the redemption process. Normally after the redemption is done, the order is automatically to a `PAID` status. To avoid such default behaviour, the user can pass any of the other status options and it will be set the order status after the redemption instead of the default `PAID`.", - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULFILLED" - ] - }, - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "discount_amount": { - "type": "integer", - "description": "Sum of all order-level discounts applied to the order." - }, - "total_discount_amount": { - "type": "integer", - "description": "Sum of all order-level discounts." - }, - "total_amount": { - "type": "integer", - "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" - }, - "applied_discount_amount": { - "type": "integer", - "description": "This field shows the order-level discount applied." - }, - "total_applied_discount_amount": { - "type": "integer", - "description": "This field sums up all order-level discounts applied to the order." - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", - "items": { + }, + "5_req_create_publication_from_campaign_auto_update": { + "title": "Voucher from Auto-Update Campaign", "type": "object", + "description": "Create a publication for a voucher from an auto-update campaign. It will choose the next available voucher.", "properties": { - "object": { + "source_id": { "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." + "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. " }, - "product_id": { + "channel": { "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." + "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", + "enum": [ + "voucherify-website", + "Dashboard", + "Automation", + "API", + "Braze", + "Reward", + "SMS", + "Email", + "Activecampaign", + "Webhook", + "Intercom", + "Mailchimp", + "Shopify" + ] }, - "sku_id": { + "customer": { + "description": "Contains information about the customer to whom the publication was directed.", + "anyOf": [ + { + "$ref": "#/components/schemas/5_res_create_publication_customer_id" + }, + { + "$ref": "#/components/schemas/5_res_create_publication_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ] + }, + "campaign": { "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`." }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." + } + } + }, + "5_req_create_publication_from_campaign_one_specific_voucher": { + "title": "Voucher from Campaign", + "type": "object", + "description": "Create a publication for a specific voucher code from a campaign.", + "properties": { + "source_id": { + "type": "string", + "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service." }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + "channel": { + "type": "string", + "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", + "enum": [ + "voucherify-website", + "Dashboard", + "Automation", + "API", + "Braze", + "Reward", + "SMS", + "Email", + "Activecampaign", + "Webhook", + "Intercom", + "Mailchimp", + "Shopify" + ] }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "customer": { + "description": "Contains information about the customer to whom the publication was directed.", + "anyOf": [ + { + "$ref": "#/components/schemas/5_res_create_publication_customer_id" + }, + { + "$ref": "#/components/schemas/5_res_create_publication_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ] }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" + "voucher": { + "description": "Code of voucher being published.", + "type": "string" }, - "product": { + "campaign": { + "type": "string", + "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`." + }, + "metadata": { "type": "object", - "description": "This object stores more information about the related product.", - "properties": { - "id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." + "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." + } + } + }, + "5_req_create_publication_from_campaign_multiple_vouchers": { + "title": "Vouchers from Campaign", + "type": "object", + "description": "Create a publication of multiple vouchers from a campaign.", + "properties": { + "source_id": { + "type": "string", + "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. " + }, + "channel": { + "type": "string", + "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", + "enum": [ + "voucherify-website", + "Dashboard", + "Automation", + "API", + "Braze", + "Reward", + "SMS", + "Email", + "Activecampaign", + "Webhook", + "Intercom", + "Mailchimp", + "Shopify" + ] + }, + "customer": { + "description": "Contains information about the customer to whom the publication was directed.", + "anyOf": [ + { + "$ref": "#/components/schemas/5_res_create_publication_customer_id" }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" + { + "$ref": "#/components/schemas/5_res_create_publication_customer_source_id" }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ] + }, + "voucher": { + "description": "Code of voucher being published.", + "type": "string" + }, + "campaign": { + "type": "object", + "description": "Contains name of source campaign and number of vouchers to be published.", + "properties": { "name": { "type": "string", - "example": "Brewing System", - "description": "Product name." + "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`." }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "count": { + "type": "string", + "description": "Number of vouchers to be published to customer." } } }, - "sku": { + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." + } + } + }, + "5_req_create_publication": { + "title": "Create Publication Request Body", + "description": "Request body schema for publishing a voucher.", + "oneOf": [ + { + "$ref": "#/components/schemas/5_req_create_publication_standalone_voucher" + }, + { + "$ref": "#/components/schemas/5_req_create_publication_from_campaign" + } + ] + }, + "5_res_create_publication": { + "title": "Create Publication Response Body", + "type": "object", + "description": "Response schema model for publishing a voucher to a specific customer.", + "properties": { + "id": { + "type": "string", + "example": "pub_BbjAXnmm8e0SIm3zG8qvvFCP0KuLywtp", + "description": "Unique publication ID, assigned by Voucherify." + }, + "object": { + "type": "string", + "default": "publication", + "description": "The type of object represented by the JSON. This object stores information about the `publication`." + }, + "created_at": { + "type": "string", + "example": "2022-09-23T09:57:00.434Z", + "description": "Timestamp representing the date and time when the publication was created in ISO 8601 format.", + "format": "date-time" + }, + "customer_id": { + "type": "string", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "description": "Unique customer ID of the customer receiving the publication." + }, + "tracking_id": { + "type": "string", + "description": "Customer's `source_id`." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." + }, + "channel": { + "type": "string", + "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", + "enum": [ + "voucherify-website", + "Dashboard", + "Automation", + "API", + "Braze", + "Reward", + "SMS", + "Email", + "Activecampaign", + "Webhook", + "Intercom", + "Mailchimp", + "Shopify" + ] + }, + "source_id": { + "type": "string", + "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. " + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Status of the publication attempt." + }, + "customer": { + "description": "Contains information about the customer to whom the publication was directed.", "type": "object", - "description": "This object stores more information about the related SKU.", "properties": { "id": { "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + "description": "Unique customer ID, assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" }, - "source_id": { + "name": { "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." + "description": "Customer's name." }, - "sku": { + "email": { "type": "string", - "description": "SKU name." + "description": "Customer's email." }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs attached to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments." + }, + "object": { + "type": "string", + "default": "customer", + "description": "The type of object represented by the JSON. This object stores information about the `customer`." } } + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object" + }, + "vouchers_id": { + "type": "array", + "description": "Contains the unique internal voucher ID that was assigned by Voucherify.", + "items": { + "type": "string", + "example": "[ v_Bw3qWZWv47yb1Onra8F2LlFI1enLakfA ]" + } } } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "customer": { - "type": "object", - "description": "Object containing information about the customer that is making the purchase.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique customer ID of the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `customer` object." + }, + "5_req_create_publication_campaign_id": { + "title": "Campaign ID", + "type": "object", + "description": "Campaign's unique ID assigned by Voucherify.", + "properties": { + "id": { + "type": "string", + "example": "camp_7AZCZeF1VvD6EHC5anAMtvcK", + "description": "Unique campaign ID, assigned by Voucherify." + } } - } - }, - "referrer": { - "type": "object", - "description": "Object containing information about the referrer.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique referrer ID, who referred the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `referrer` object." + }, + "5_req_create_publication_campaign_name": { + "title": "Campaign's name", + "type": "object", + "description": "Campaign's name.", + "properties": { + "name": { + "type": "string", + "example": "Summer Campaign", + "description": "Campaign's name." + } } - } - }, - "customer_id": { - "type": "string", - "description": "Unique customer ID of the customer making the purchase.", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" - }, - "referrer_id": { - "type": "string", - "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "description": "Unique referrer ID." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - } - } - }, - "6_obj_order_object_apply_to_items": { - "type": "object", - "title": "Order object - Effect: Apply to items", - "description": "This is an object representing an order with calculated discounts applied using the voucher code.", - "properties": { - "id": { - "type": "string", - "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", - "description": "Unique order ID, assigned by Voucherify. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:40:48.705Z", - "description": "Timestamp representing the date and time when the order was created in ISO 8601 format. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:47:20.760Z", - "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." - }, - "status": { - "type": "string", - "description": "Order status. This parameter is returned if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body or if you send the request body parameter when defining an order in the request body. This parameter can be passed but it's not required for validation at all. It's used in the redemption process. Normally after the redemption is done, the order is automatically to a `PAID` status. To avoid such default behaviour, the user can pass any of the other status options and it will be set the order status after the redemption instead of the default `PAID`.", - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULFILLED" - ] - }, - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "items_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied. \n`sum(items, i => i.discount_amount)`" - }, - "total_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied." - }, - "total_amount": { - "type": "integer", - "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" - }, - "items_applied_discount_amount": { - "type": "integer", - "description": "Product-specifc discounts applied to all the items." - }, - "total_applied_discount_amount": { - "type": "integer", - "description": "Product-specific discounts applied in the order." - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", - "items": { + }, + "5_req_create_publication_campaign": { + "title": "Campaign's name or ID", + "type": "string", + "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`. " + }, + "5_res_create_publication_customer_id": { + "title": "Customer ID", "type": "object", + "description": "Customer's unique ID assigned by Voucherify.", "properties": { - "object": { + "id": { "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." - }, - "product_id": { + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "description": "Unique customer ID, assigned by Voucherify." + } + } + }, + "5_res_create_publication_customer_source_id": { + "title": "Customer's Source ID", + "type": "object", + "description": "The merchant’s customer ID.", + "properties": { + "source_id": { "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "sku_id": { + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + } + } + }, + "5_req_create_publication_customer": { + "title": "Source ID or Unique Customer ID", + "type": "string", + "description": "Customer's unique ID assigned by Voucherify, i.e. `cust_eWgXlBBiY6THFRJwX45Iakv4`, or the merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "5_obj_publication_object_discount": { + "title": "Discount Voucher", + "type": "object", + "description": "This is an object representing a publication of a discount voucher. ", + "properties": { + "code": { "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + "description": "Voucher code." }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the voucher.", + "default": "voucher" }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + "campaign": { + "type": "string", + "description": "Name of voucher's parent campaign." }, - "discount_amount": { - "type": "integer", - "description": "The item-level discount applied to the item." + "discount": { + "anyOf": [ + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" + } + ] }, - "applied_discount_amount": { - "type": "integer", - "description": "The item-level discount applied to the item." + "is_referral_code": { + "type": "boolean", + "description": "Whether this voucher is a referral code." + } + } + }, + "5_obj_publication_object_loyalty_card": { + "title": "Loyalty Card", + "type": "object", + "description": "This is an object representing a publication of a loyalty card. ", + "properties": { + "code": { + "type": "string", + "description": "Voucher code." }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the voucher.", + "default": "voucher" }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" + "campaign": { + "type": "string", + "description": "Name of voucher's parent campaign." }, - "product": { + "loyalty_card": { "type": "object", - "description": "This object stores more information about the related product.", + "description": "Contains information about the loyalty card being published.", "properties": { - "id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" - }, - "name": { - "type": "string", - "example": "Brewing System", - "description": "Product name." + "points": { + "type": "integer", + "description": "The incremental points to be added to the loyalty card as the initial balance on the card." }, - "price": { + "balance": { "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "description": "The points balance after the incremental points are added to the loyalty card." } } }, - "sku": { + "is_referral_code": { + "type": "boolean", + "description": "Whether this voucher is a referral code." + } + } + }, + "5_obj_publication_object_gift_card": { + "title": "Gift Card", + "type": "object", + "description": "This is an object representing a publication of a gift card. ", + "properties": { + "code": { + "type": "string", + "description": "Voucher code." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the voucher.", + "default": "voucher" + }, + "campaign": { + "type": "string", + "description": "Name of voucher's parent campaign." + }, + "gift": { "type": "object", - "description": "This object stores more information about the related SKU.", + "description": "Contains information about the gift card being published.", "properties": { - "id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + "amount": { + "type": "integer", + "description": "The incremental amount to be added as the initial balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." + "balance": { + "type": "integer", + "description": "The credit balance on the gift card after the initial incremental amount is added to the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." }, - "sku": { + "effect": { "type": "string", - "description": "SKU name." - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS" + ], + "description": "How the credits are applied to the customer's order." } } + }, + "is_referral_code": { + "type": "boolean", + "description": "Whether this voucher is a referral code." } } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "customer": { - "type": "object", - "description": "Object containing information about the customer that is making the purchase.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique customer ID of the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `customer` object." + }, + "5_res_list_publications": { + "type": "object", + "description": "Response body schema for listing publications using **GET** `/publications`.", + "title": "List Publications Response Body", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about publications in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "publications", + "description": "Identifies the name of the attribute that contains the array of publications." + }, + "publications": { + "type": "array", + "description": "Contains array of publication objects.", + "items": { + "$ref": "#/components/schemas/5_obj_publication_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of publications." + } } - } - }, - "referrer": { - "type": "object", - "description": "Object containing information about the referrer.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique referrer ID, who referred the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `referrer` object." + }, + "6_obj_validation_object": { + "title": "Validation Object", + "description": "This is an object representing a validation.", + "x-tags": [ + "VALIDATIONS API" + ], + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_code" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_gift_card" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_loyalty_card" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_false" + }, + { + "$ref": "#/components/schemas/6_res_validate_promotion_object" + } + ] + }, + "6_req_validate_voucher": { + "title": "Validate Voucher Request Body", + "description": "Request schema model for validating a voucher using **POST** `/vouchers/{code}/validate`.", + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_discount_code" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_gift_card" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_loyalty_card" + } + ] + }, + "6_req_validate_voucher_customer_id": { + "title": "Customer ID", + "description": "You can pass the unique customer ID that was assigned by Voucherify.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The ID of an existing customer that will be linked to redemption in this request.", + "example": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" + } } - } - }, - "customer_id": { - "type": "string", - "description": "Unique customer ID of the customer making the purchase.", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" - }, - "referrer_id": { - "type": "string", - "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "description": "Unique referrer ID." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - } - } - }, - "6_query_validate_voucher_client_side_orders_order_item": { - "type": "object", - "title": "Order Item", - "description": "This object represents an order line item.", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s product/SKU ID (if it is different from the Voucherify product/SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service." - }, - "related_object": { - "type": "string", - "description": "Used along with the `source_id` property, can be set to either `sku` or `product`." - }, - "product_id": { - "type": "string", - "description": "A unique product ID assigned by Voucherify.", - "example": "prod_0a7e62db1fca8322a2" - }, - "sku_id": { - "type": "string", - "description": "A unique SKU ID assigned by Voucherify.", - "example": "sku_0a41e31c7b41c28358" - }, - "quantity": { - "type": "string", - "description": "The quantity of the particular item in the cart." - }, - "price": { - "type": "string", - "description": "The unit price of the item." - }, - "amount": { - "type": "string", - "description": "The total amount of the order item (`price` * `quantity`)." - } - } - }, - "6_req_validate_promotion": { - "title": "Validate Promotion Request Body", - "type": "object", - "description": "Request schema model for validating a promotion using **POST** `/promotions/validation`.", - "properties": { - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" + }, + "6_req_rollback_redemption_customer_id": { + "title": "Customer ID", + "description": "You can pass the unique customer ID that was assigned by Voucherify.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The ID of an existing customer that will be linked to redemption rollback in this request.", + "example": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" + } } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" - }, - { - "$ref": "#/components/schemas/10_req_create_order" + }, + "6_req_validate_voucher_customer_id_string": { + "type": "string", + "title": "Customer ID", + "description": "You can pass the unique customer ID that was assigned by Voucherify.", + "example": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" + }, + "6_req_validate_voucher_customer_source_id": { + "title": "Customer Source ID", + "description": "You can send the source ID that you used to create the customer in Voucherify.", + "type": "object", + "properties": { + "source_id": { + "type": "string", + "description": "A unique identifier of a customer that validates a voucher. It can be a customer ID or email from a CRM system, database or 3rd-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored." + } } - ], - "description": "Order information." - }, - "metadata": { - "type": "object", - "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "options": { - "type": "object", - "description": "Configure parameters returned in the response.", - "properties": { - "expand": { - "type": "array", - "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. Add `category` as a string in the array to include a `categories` object in the response.", - "items": { + }, + "6_req_rollback_redemption_customer_source_id": { + "title": "Customer Source ID", + "description": "You can send the source ID that you used to create the customer in Voucherify.", + "type": "object", + "properties": { + "source_id": { "type": "string", - "enum": [ - "category" - ], - "example": "category" + "description": "A unique identifier of a customer that redeemed a resource. It can be a customer ID or email from a CRM system, database or 3rd-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored." } } - } - } - } - }, - "6_res_validate_promotion": { - "title": "Validate Promotion Response Body", - "type": "object", - "description": "Response schema model for validating a promotion using **POST** `/promotions/validation`.", - "properties": { - "valid": { - "type": "boolean", - "description": "Indicates whether the promotion is valid within the context of the parameters provided in the request body and filters in the query parameters." - }, - "tracking_id": { - "type": "string", - "description": "Hashed customer source ID." - }, - "promotions": { - "type": "array", - "description": "Contains an array of promotion tier objects.", - "items": { - "$ref": "#/components/schemas/6_res_validate_promotion_object" - } - } - } - }, - "6_res_validate_promotion_object": { - "title": "Validate Promotion", - "type": "object", - "description": "Validate Promotion", - "properties": { - "valid": { - "type": "string", - "description": "Indicates whether the promotion is valid within the context of the parameters provided in the request body and filters in the query parameters." - }, - "applicable_to": { - "$ref": "#/components/schemas/6_res_applicable_to_object" - }, - "inapplicable_to": { - "$ref": "#/components/schemas/6_res_inapplicable_to_object" - }, - "tracking_id": { - "type": "string", - "description": "Hashed customer source ID." - }, - "order": { - "$ref": "#/components/schemas/6_obj_order_object" - }, - "id": { - "type": "string", - "example": "promo_4TqHr24boFISDrcOHSlfAxwm", - "description": "Unique promotion tier ID." - }, - "name": { - "type": "string", - "description": "Custom promotion tier name." - }, - "banner": { - "type": "string", - "description": "Text to be displayed to your customers on your website.", - "example": "Get 45% off items" - }, - "discount": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_amount" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_percent" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_fixed" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_shipping" + }, + "6_req_validate_voucher_order_id": { + "title": "Order ID", + "description": "You can pass the unique order ID that was assigned by Voucherify.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request." + } } - ], - "description": "Contains information about the discount to be applied to the order." - }, - "start_date": { - "type": "string", - "format": "date-time", - "example": "2022-11-02T00:00:00.000Z", - "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Campaign is *inactive* before this date." - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-11-04T00:00:00.000Z", - "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive* after this date." - }, - "campaign": { - "type": "object", - "properties": { - "id": { - "type": "string", - "example": "camp_h8RyP6FV94F3Ev2odP24j5p1", - "description": "Unique promotion tier ID." - }, - "start_date": { - "type": "string", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive* before this date.", - "example": "2022-11-01T00:00:00.000Z", - "format": "date-time" - }, - "expiration_date": { - "type": "string", - "description": "Activation timestamp defines when the campaign expires in ISO 8601 format. Promotion tier is *inactive* after this date.", - "example": "2022-11-30T00:00:00.000Z", - "format": "date-time" - }, - "active": { - "type": "boolean", - "description": "A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object" - }, - "object": { - "type": "string", - "default": "campaign", - "description": "The type of object represented by the campaign object. This object stores information about the campaign." + }, + "6_req_validate_voucher_order_source_id": { + "title": "Order Source ID", + "description": "You can send the source ID that you used to create the order in Voucherify.", + "type": "object", + "properties": { + "source_id": { + "type": "string", + "description": "Unique source ID of an existing order that will be linked to the redemption of this request." + } } - } - }, - "hierarchy": { - "type": "integer", - "description": "The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy." - }, - "discount_amount": { - "type": "integer", - "description": "The calculated discount amount based on the discount type and effect." - }, - "applied_discount_amount": { - "type": "integer", - "description": "The effective discount amount that would be applied to the order." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." - }, - "object": { - "type": "string", - "default": "promotion_tier", - "description": "The type of object represented by JSON. This object stores information about the promotion tier." - }, - "category_id": { - "type": "string", - "description": "Promotion tier category ID.", - "example": "cat_0c9da30e7116ba6bba" - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object", - "description": "Details about the category assigned to the promotion tier." - } - } - }, - "6_req_validate_promotion_tier": { - "title": "Validate Promotion Tier Request Body", - "type": "object", - "description": "Request schema model for validating a promotion using **POST** `/promotions/tiers/{tierId}/validation`.", - "properties": { - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" + }, + "6_req_rollback_redemption_order_id": { + "title": "Order ID", + "description": "You can pass the unique order ID that was assigned by Voucherify.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique ID assigned by Voucherify of an existing order that will be linked to the redemption rollback of this request." + }, + "status": { + "type": "string", + "description": "After a redemption rollback, Voucherify will default the order status to `CANCELED`. You can set the order status to one of the other options: `CREATED`, `PAID`, `FULFILLED`.", + "enum": [ + "CREATED", + "PAID", + "FULFILLED" + ] + } } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" - }, - { - "$ref": "#/components/schemas/10_req_create_order" + }, + "6_req_rollback_redemption_order_source_id": { + "title": "Order Source ID", + "description": "You can send the source ID that you used to create the order in Voucherify.", + "type": "object", + "properties": { + "source_id": { + "type": "string", + "description": "Unique source ID of an existing order that will be linked to the redemption rollback of this request." + }, + "status": { + "type": "string", + "description": "After a redemption rollback, Voucherify will default the order status to `CANCELED`. You can set the order status to one of the other options: `CREATED`, `PAID`, `FULFILLED`.", + "enum": [ + "CREATED", + "PAID", + "FULFILLED" + ] + } } - ], - "description": "Order information." - }, - "metadata": { - "type": "object", - "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." - } - } - }, - "6_res_validate_promotion_tier": { - "title": "Validate Promotion Tier Response Body", - "description": "Response schema model for validating a promotion using **POST** `/promotions/tiers/{tierId}/validation`.", - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_promotion_tier_true" - }, - { - "$ref": "#/components/schemas/6_res_validate_promotion_tier_false" - } - ] - }, - "6_res_validate_promotion_tier_true": { - "title": "Promotion Tier Valid", - "type": "object", - "description": "Response schema model for valid promotion tier when validating a promotion using **POST** `/promotions/tiers/{tierId}/validation`.", - "properties": { - "valid": { - "type": "string", - "description": "Indicates whether the promotion is valid within the context of the parameters provided in the request body and filters in the query parameters." - }, - "applicable_to": { - "$ref": "#/components/schemas/6_res_applicable_to_object" - }, - "inapplicable_to": { - "$ref": "#/components/schemas/6_res_inapplicable_to_object" - }, - "tracking_id": { - "type": "string", - "description": "Hashed customer source ID." - }, - "order": { - "$ref": "#/components/schemas/6_obj_order_object" - }, - "id": { - "type": "string", - "example": "promo_4TqHr24boFISDrcOHSlfAxwm", - "description": "Unique promotion tier ID." - }, - "name": { - "type": "string", - "description": "Custom promotion tier name." - }, - "banner": { - "type": "string", - "description": "Text to be displayed to your customers on your website.", - "example": "Get 45% off items" - }, - "discount": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_amount" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_percent" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_fixed" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_shipping" - } - ], - "description": "Contains information about the discount to be applied to the order." - }, - "start_date": { - "type": "string", - "format": "date-time", - "example": "2022-11-02T00:00:00.000Z", - "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Campaign is *inactive* before this date." - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-11-04T00:00:00.000Z", - "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive* after this date." - }, - "campaign": { - "type": "object", - "properties": { - "id": { - "type": "string", - "example": "camp_h8RyP6FV94F3Ev2odP24j5p1", - "description": "Unique promotion tier ID." - }, - "start_date": { - "type": "string", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive* before this date.", - "example": "2022-11-01T00:00:00.000Z", - "format": "date-time" - }, - "expiration_date": { - "type": "string", - "description": "Activation timestamp defines when the campaign expires in ISO 8601 format. Promotion tier is *inactive* after this date.", - "example": "2022-11-30T00:00:00.000Z", - "format": "date-time" - }, - "active": { - "type": "boolean", - "description": "A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object" - }, - "object": { - "type": "string", - "default": "campaign", - "description": "The type of object represented by the campaign object. This object stores information about the campaign." - } - } - }, - "hierarchy": { - "type": "integer", - "description": "The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy." - }, - "discount_amount": { - "type": "integer", - "description": "The calculated discount amount based on the discount type and effect." - }, - "applied_discount_amount": { - "type": "integer", - "description": "The effective discount amount that would be applied to the order." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." - }, - "object": { - "type": "string", - "default": "promotion_tier", - "description": "The type of object represented by JSON. This object stores information about the promotion tier." - } - } - }, - "6_res_validate_promotion_tier_false": { - "type": "object", - "description": "Response schema model for a non-valid promotion tier when validating a promotion using **POST** `/promotions/tiers/{tierId}/validation`.", - "title": "Promotion Tier Not Valid", - "properties": { - "valid": { - "type": "boolean", - "description": "Response schema for a voucher that is not valid." - }, - "reason": { - "type": "string", - "description": "System generated cause for the voucher being invalid in the context of the provided parameters." - }, - "error": { - "description": "Detailed failure cause for the invalid voucher if the reason has a translation defined in the Dashboard → Project Settings → Error Messages.", - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_promotion_tier_false_custom_message" - }, - { - "$ref": "#/components/schemas/e_error_no_translation" - } - ] - }, - "tracking_id": { - "type": "string", - "description": "Hashed customer source ID." - }, - "id": { - "type": "string", - "example": "promo_ByIIAHC1Mz9ouJsitzAWsush", - "description": "Promotion tier ID." - }, - "name": { - "type": "string", - "description": "Custom promotion tier name." - }, - "banner": { - "type": "string", - "description": "Text to be displayed to your customers on your website.", - "example": "Get 25% off" - }, - "discount": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_amount" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_percent" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_fixed" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_shipping" - } - ], - "description": "Contains information about the discount to be applied to the order." - }, - "start_date": { - "type": "string", - "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Campaign is *inactive* before this date.", - "format": "date-time", - "example": "2022-11-02T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive* after this date.", - "format": "date-time", - "example": "2022-11-04T00:00:00.000Z" - }, - "campaign": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique promotion tier ID." - }, - "start_date": { - "type": "string", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive* before this date.", - "format": "date-time", - "example": "2022-11-01T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign expires in ISO 8601 format. Promotion tier is *inactive* after this date.", - "example": "2022-11-30T00:00:00.000Z" - }, - "active": { - "type": "boolean", - "description": "A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" - }, - "object": { - "type": "string", - "description": "The type of object represented by the campaign object. This object stores information about the campaign.", - "default": "campaign" - } - } - }, - "hierarchy": { - "type": "integer", - "description": "The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." - }, - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about the promotion tier.", - "default": "promotion_tier" - } - } - }, - "6_res_validate_promotion_tier_false_custom_message": { - "type": "object", - "description": "Custom Error Message", - "title": "Custom Message", - "properties": { - "message": { - "type": "string", - "description": "Customized error message." - } - } - }, - "19_req_session_lock": { - "title": "Session Lock", - "type": "object", - "description": "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](doc:locking-validation-session).", - "properties": { - "type": { - "type": "string", - "description": "This parameter is **required** to establish a new session. The session locks the redemption **quantity** by 1 and the redemption **gift credits** and **loyalty points** specified within the request.", - "enum": [ - "LOCK" - ] - }, - "key": { - "type": "string", - "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", - "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" - }, - "ttl_unit": { - "type": "string", - "description": "Defines the type of unit in which the session time is counted.", - "enum": [ - "HOURS", - "DAYS", - "MINUTES", - "SECONDS", - "MILLISECONDS", - "MICROSECONDS", - "NANOSECONDS" - ] - }, - "ttl": { - "type": "integer", - "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." - } - } - }, - "19_res_session_lock": { - "title": "Session Lock", - "type": "object", - "description": "Schema model for `session` lock object. The session object contains information about the session key that was used to establish a session between multiple parallel validation and redemption requests.", - "properties": { - "type": { - "type": "string", - "description": "This session locks the redemption **quantity** by 1.", - "default": "LOCK" - }, - "key": { - "type": "string", - "description": "The session unique ID assigned by Voucherify or your own unique session ID.", - "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" - }, - "ttl_unit": { - "type": "string", - "description": "Defines the type of unit in which the session time is counted.", - "enum": [ - "HOURS", - "DAYS", - "MINUTES", - "SECONDS", - "MILLISECONDS", - "MICROSECONDS", - "NANOSECONDS" - ] - }, - "ttl": { - "type": "integer", - "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." - } - } - }, - "19_obj_order_object_rollback_stacked": { - "title": "Order object", - "description": "This is an object representing an order that was rolled back for a stacked redemption.", - "properties": { - "id": { - "type": "string", - "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", - "description": "Unique order ID, assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:40:48.705Z", - "description": "Timestamp representing the date and time when the order was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:47:20.760Z", - "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format." - }, - "status": { - "type": "string", - "description": "Order status.", - "enum": [ - "CANCELED" - ] - }, - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "total_amount": { - "type": "integer", - "description": "Order amount after undoing all the discounts through the rollback redemption." - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order.", - "items": { + }, + "6_req_validate_voucher_discount_code": { + "title": "Discount Code", "type": "object", + "description": "Request schema model for validating a discount code voucher using **POST** `/vouchers/{code}/validate`.", "properties": { - "object": { - "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." + "session": { + "$ref": "#/components/schemas/6_req_session_lock_discount_code" }, - "product_id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." }, - "sku_id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" + } + ], + "description": "Order information." }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." + "metadata": { + "type": "object", + "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + } + } + }, + "6_req_validate_voucher_gift_card": { + "title": "Gift Card", + "type": "object", + "description": "Request schema model for validating a gift card voucher using **POST** `/vouchers/{code}/validate`.", + "properties": { + "session": { + "$ref": "#/components/schemas/6_req_session_lock_gift_card" }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + "gift": { + "type": "object", + "description": "Contains information on the number of gift card credits that the customer wants to apply to the order.", + "properties": { + "credits": { + "type": "integer", + "description": "The number of credits that the user wants to use from the gift card to fulfil the order. The value of credits cannot be higher than the current balance on the gift card. If the user gives more points than he has on the gift card, the application will return an error code in response. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the removing an item-level discount." + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" + } + ], + "description": "Order information." }, - "product": { + "metadata": { "type": "object", - "description": "This object stores more information about the related product.", + "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + } + } + }, + "6_req_validate_voucher_loyalty_card": { + "title": "Loyalty Card", + "type": "object", + "description": "Request schema model for validating a loyalty card voucher using **POST** `/vouchers/{code}/validate`.", + "properties": { + "session": { + "$ref": "#/components/schemas/6_req_session_lock_loyalty_card" + }, + "reward": { + "type": "object", + "description": "Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward.", "properties": { "id": { "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" - }, - "name": { - "type": "string", - "example": "Brewing System", - "description": "Product name." + "description": "Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward." }, - "price": { + "points": { "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "description": "The number of loyalty points that the user wants to spend in order to fulfill the order. The number of points cannot be higher than the current balance on the loyalty card. If the user gives more points than he/she has on the loyalty card, the application will return an error code in response." } } }, - "sku": { - "type": "object", - "description": "This object stores more information about the related SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" }, - "sku": { - "type": "string", - "description": "SKU name." + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" } - } + ], + "description": "Order information." + }, + "metadata": { + "type": "object", + "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." } } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "customer": { - "type": "object", - "description": "Object containing information about the customer that is making the purchase.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique customer ID of the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `customer` object." - } - } - }, - "referrer": { - "type": "object", - "description": "Object containing information about the referrer.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique referrer ID, who referred the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `referrer` object." - } - } - }, - "customer_id": { - "type": "string", - "description": "Unique customer ID of the customer making the purchase.", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" - }, - "referrer_id": { - "type": "string", - "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "description": "Unique referrer ID." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - }, - "redemptions": { - "description": "Lists details related to the redemption and redemption rollback.", - "properties": { - "redemption_ID": { - "type": "object", - "description": "The property name is the unique redemption ID; i.e. `r_0ba186c4824e4881e1`. This object contains information about the redemption rollback of incentives.", - "properties": { - "date": { - "type": "string", - "description": "Timestamp representing the date and time when the redemption was created in ISO 8601 format.", - "example": "2022-09-02T17:06:56.649Z", - "format": "date-time" - }, - "rollback_id": { - "type": "string", - "description": "Unique ID of the redemption rollback.", - "example": "rr_0c63c84eb78ee0a6c0" - }, - "rollback_date": { - "type": "string", - "description": "Timestamp representing the date and tiem when the redemption rollback was created in ISO 8601 format.", - "example": "2023-01-31T14:18:37.150Z", - "format": "date-time" - }, - "related_object_type": { - "type": "string", - "description": "The source of the redemption is a `redemption` because this rollback is in the context of a stacked redemption.", - "enum": [ - "redemption" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique ID of the parent redemption.", - "example": "r_0ba186c4824e4881e1" - }, - "stacked": { - "type": "array", - "description": "Lists the stacked redemption IDs in the initial redemption request.", - "items": { - "type": "string" - } - }, - "rollback_stacked": { - "type": "array", - "description": "Lists the rollback redemption IDs of the particular child redemptions.", - "items": { - "type": "string" - } - } + }, + "6_req_validate_voucher_unpublished_discount_code": { + "title": "Unpublished Discount Code", + "type": "object", + "description": "Request schema model for validating a voucher using **POST** `/vouchers/{code}/validate`.", + "properties": { + "session": { + "type": "string" } } - } - } - } - }, - "19_obj_order_object_rollback_stacked_per_redemption_apply_to_order": { - "title": "Order object", - "description": "This is an object representing an order that was rolled back for a stacked redemption.", - "properties": { - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "total_amount": { - "type": "integer", - "description": "Order amount after undoing all the discounts through the rollback redemption." - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order.", - "items": { + }, + "6_req_session_lock_discount_code": { + "title": "Discount Code Session Lock", "type": "object", + "description": "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](doc:locking-validation-session).", "properties": { - "object": { + "type": { "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." + "description": "This parameter is **required** to establish a new session. The session locks the redemption **quantity** by 1.", + "enum": [ + "LOCK" + ] }, - "product_id": { + "key": { "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." + "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", + "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" }, - "sku_id": { + "ttl_unit": { "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + "description": "Defines the type of unit in which the session time is counted.", + "enum": [ + "HOURS", + "DAYS", + "MINUTES", + "SECONDS", + "MILLISECONDS", + "MICROSECONDS", + "NANOSECONDS" + ] }, - "price": { + "ttl": { "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." } } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - } - } - }, - "19_obj_order_object_rollback_stacked_per_redemption_apply_to_items": { - "title": "Order object", - "description": "This is an object representing an order that was rolled back for a stacked redemption.", - "properties": { - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "items_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied to the order.`" - }, - "total_discount_amount": { - "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied to the order." - }, - "total_amount": { - "type": "integer", - "description": "Order amount after undoing all the discounts through the rollback redemption." - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order.", - "items": { + }, + "6_req_session_lock_gift_card": { + "title": "Gift Card Session Lock", "type": "object", + "description": "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](doc:locking-validation-session).", "properties": { - "object": { + "type": { "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." + "description": "This parameter is **required** to establish a new session. The session locks the redemption **quantity** by 1 and the redemption **gift credits** specified within the request.", + "enum": [ + "LOCK" + ] }, - "product_id": { + "key": { "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." + "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", + "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" }, - "sku_id": { + "ttl_unit": { "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + "description": "Defines the type of unit in which the session time is counted.", + "enum": [ + "HOURS", + "DAYS", + "MINUTES", + "SECONDS", + "MILLISECONDS", + "MICROSECONDS", + "NANOSECONDS" + ] }, - "quantity": { + "ttl": { "type": "integer", - "description": "Quantity of the item in the cart." + "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." + } + } + }, + "6_req_session_lock_loyalty_card": { + "title": "Loyalty Card Session Lock", + "type": "object", + "description": "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](doc:locking-validation-session).", + "properties": { + "type": { + "type": "string", + "description": "This parameter is **required** to establish a new session. The session locks the redemption **quantity** by 1 and the redemption **loyalty points** specified within the request.", + "enum": [ + "LOCK" + ] }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + "key": { + "type": "string", + "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", + "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "ttl_unit": { + "type": "string", + "description": "Defines the type of unit in which the session time is counted.", + "enum": [ + "HOURS", + "DAYS", + "MINUTES", + "SECONDS", + "MILLISECONDS", + "MICROSECONDS", + "NANOSECONDS" + ] }, - "subtotal_amount": { + "ttl": { "type": "integer", - "description": "Final order item amount after the removing an item-level discount." + "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." } } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - } - } - }, - "19_req_redeemables_gift_card": { - "title": "Gift Card", - "type": "object", - "description": "Redeem a gift card.", - "properties": { - "id": { - "type": "string", - "description": "Unique gift card code." - }, - "object": { - "type": "string", - "description": "Type of object, i.e. `voucher`.", - "default": "voucher" - }, - "gift": { - "type": "object", - "description": "Contains information on the number of gift card credits that the customer wants to apply to the order.", - "properties": { - "credits": { - "type": "integer", - "description": "The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "6_res_session_lock_discount_voucher": { + "title": "Session Lock", + "type": "object", + "description": "Schema model for `session` lock object. The session object contains information about the session key that was used to establish a session between multiple parallel validation and redemption requests.", + "properties": { + "type": { + "type": "string", + "description": "This session locks the redemption **quantity** by 1.", + "default": "LOCK" + }, + "key": { + "type": "string", + "description": "The session unique ID assigned by Voucherify or your own unique session ID. ", + "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" + }, + "ttl_unit": { + "type": "string", + "description": "Defines the type of unit in which the session time is counted.", + "enum": [ + "HOURS", + "DAYS", + "MINUTES", + "SECONDS", + "MILLISECONDS", + "MICROSECONDS", + "NANOSECONDS" + ] + }, + "ttl": { + "type": "integer", + "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." + } } - } - } - }, - "required": [ - "object", - "id" - ] - }, - "19_req_redeemables_loyalty_card": { - "title": "Loyalty Card", - "type": "object", - "description": "Redeem a loyalty card.", - "properties": { - "id": { - "type": "string", - "description": "Unique loyalty card code." - }, - "object": { - "type": "string", - "description": "Type of object, i.e. `voucher`.", - "default": "voucher" - }, - "reward": { - "type": "object", - "description": "Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward.", - "example": "rew_EPx1hCTpqzF0HW1z9NKckZH4" - }, - "points": { - "type": "integer", - "description": "The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card." + }, + "6_res_session_lock_gift_card": { + "title": "Session Lock", + "type": "object", + "description": "Schema model for `session` lock object. The session object contains information about the session key that was used to establish a session between multiple parallel validation and redemption requests.", + "properties": { + "type": { + "type": "string", + "description": "This session locks the redemption **quantity** by 1 and the redemption **gift credits** specified within the request.", + "default": "LOCK" + }, + "key": { + "type": "string", + "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", + "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" + }, + "ttl_unit": { + "type": "string", + "description": "Defines the type of unit in which the session time is counted.", + "enum": [ + "HOURS", + "DAYS", + "MINUTES", + "SECONDS", + "MILLISECONDS", + "MICROSECONDS", + "NANOSECONDS" + ] + }, + "ttl": { + "type": "integer", + "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." + } } - } - } - }, - "required": [ - "object", - "id", - "reward" - ] - }, - "19_req_redeemables_discount_referral_promotion_tier_promotion_stack": { - "title": "Discount code, referral code, promotion tier, promotion stack", - "type": "object", - "description": "Redeem a discount code, referral code, promotion tier, or promotion stack.", - "properties": { - "object": { - "type": "string", - "description": "Redeemable object type.", - "enum": [ - "voucher", - "promotion_tier", - "promotion_stack" - ], - "default": "voucher" - }, - "id": { - "type": "string", - "description": "Redeemable code or unique ID such as: \n- discount code, referral code: `DiscountCode100`, `v_6ZPI2BLMtpc6zz8pQVjQgxJH3D4ac3ZT` \n- promotion tier: `promo_Mwy9XpA0TLctSGriM5kum0qp` \n- promotion stack: `stack_KxSD0GahLUg9ULB6TseGfUHJ` " - } - }, - "required": [ - "object", - "id" - ] - }, - "19_req_redemptions": { - "title": "Redeem Stackable Discounts Request Body", - "type": "object", - "description": "This data model represents the request body for redeeming multiple incentives.", - "properties": { - "options": { - "type": "object", - "description": "Configure parameters returned in the response.", - "properties": { - "expand": { - "type": "array", - "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. \n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redemption object.
- Metadata not included for each discount type. |\n| [\"order\", \"redemption\"] | - Returns redemption object `metadata`.
- Order data with calculated discounts are listed in each child redemption object. |\n| [\"redeemable\", \"redemption\"] | - Returns each discount type's `metadata` in each child redemption object.
- Returns redemption object `metadata`. |\n| [\"redemption\"] | - Returns redemption object `metadata`. |\n| [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object
- Returns redemption object `metadata`.
- Returns an expanded `categories` object, showing details about the category. |", - "items": { + }, + "6_res_session_lock_loyalty_card": { + "title": "Session Lock", + "type": "object", + "description": "Schema model for `session` lock object. The session object contains information about the session key that was used to establish a session between multiple parallel validation and redemption requests.", + "properties": { + "type": { + "type": "string", + "description": "This session locks the redemption **quantity** by 1 and the redemption **loyalty points** specified within the request.", + "default": "LOCK" + }, + "key": { "type": "string", + "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", + "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" + }, + "ttl_unit": { + "type": "string", + "description": "Defines the type of unit in which the session time is counted.", "enum": [ - "order", - "redemption", - "redeemable", - "category" + "HOURS", + "DAYS", + "MINUTES", + "SECONDS", + "MILLISECONDS", + "MICROSECONDS", + "NANOSECONDS" ] + }, + "ttl": { + "type": "integer", + "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." } } - } - }, - "redeemables": { - "type": "array", - "minItems": 1, - "maxItems": 5, - "description": "An array of redeemables. You can combine `voucher`(s) and `promotion_tier`(s). Alternatively, send one unique`promotion_stack` in the array.", - "items": { - "anyOf": [ + }, + "6_res_validate_voucher_false": { + "type": "object", + "title": "Not Valid", + "description": "Response schema for a voucher that is not valid.", + "examples": [ + { + "valid": false, + "reason": "voucher is disabled", + "error": { + "message": "Voucher has been disabled and is not active anymore." + }, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", + "code": "WFf5XAUc", + "metadata": {} + }, { - "$ref": "#/components/schemas/19_req_redeemables_discount_referral_promotion_tier_promotion_stack" + "valid": false, + "reason": "Customer must be a holder of a loyalty card.", + "error": { + "message": "You are not the right person." + }, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", + "code": "3TCjkel8", + "metadata": {} }, { - "$ref": "#/components/schemas/19_req_redeemables_gift_card" + "valid": false, + "reason": "loyalty card points exceeded", + "error": { + "message": "You need more loyalty points to be able to redeem a reward." + }, + "tracking_id": "track_QjgJ4Z5Gv10OpRCXZM8cMIOPCB1PNuli", + "code": "pfeDMTsj", + "metadata": {} }, { - "$ref": "#/components/schemas/19_req_redeemables_loyalty_card" + "valid": false, + "reason": "order does not match validation rules", + "error": { + "code": 400, + "key": "order_rules_violated", + "message": "order does not match validation rules", + "details": "Loyalty Card cannot be redeemed because of violated validation rules: val_RU9fm8GiQaRT", + "request_id": "v-0bcbde194f1305ad88" + }, + "tracking_id": "track_QjgJ4Z5Gv10OpRCXZM8cMIOPCB1PNuli", + "code": "pfeDMTsj", + "metadata": {} + } + ], + "properties": { + "valid": { + "type": "boolean", + "default": false, + "description": "Indicates whether the voucher is valid within the context of the parameters provided in the request body." + }, + "reason": { + "type": "string", + "description": "System generated cause for the voucher being invalid in the context of the provided parameters." + }, + "error": { + "type": "object", + "description": "Detailed failure cause for the invalid voucher if the reason has a translation defined in the Dashboard → Project Settings → Error Messages.", + "properties": { + "message": { + "type": "string", + "description": "Customized error message." + } + } + }, + "tracking_id": { + "type": "string", + "description": "Hashed customer source ID." + }, + "code": { + "type": "string", + "description": "Voucher code." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." } - ] - } - }, - "session": { - "$ref": "#/components/schemas/19_req_session_lock" - }, - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" - }, - { - "$ref": "#/components/schemas/10_req_create_order" } - ], - "description": "Order information. This object enables you to pass purchase transaction data. Read what properties you can use in the [Order object](ref:get-order)." - }, - "metadata": { - "type": "object", - "description": "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." - } - }, - "required": [ - "redeemables" - ] - }, - "19_req_validations": { - "title": "Validate Stackable Discounts Request Body", - "type": "object", - "description": "This data model represents the request body for the `/validations` endpoint.", - "properties": { - "options": { - "type": "object", - "description": "Configure parameters returned in the response.", - "properties": { - "expand": { - "type": "array", - "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. \n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redeemable object.
- Metadata not included for each discount type. |\n| [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. |\n| [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
- Includes `metadata` for each discount type. |\n| [\"category\"] | - Returns an expanded `categories` object, showing details about the category. |", - "items": { + }, + "6_res_validate_voucher_discount_amount": { + "title": "Amount Discount", + "type": "object", + "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", + "properties": { + "type": { + "type": "string", + "default": "AMOUNT", + "description": "Defines the type of voucher." + }, + "effect": { "type": "string", + "description": "Defines how the discount is applied to the customer's order.", "enum": [ - "order", - "redemption", - "redeemable", - "category" + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS", + "APPLY_TO_ITEMS_PROPORTIONALLY", + "APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY", + "APPLY_TO_ITEMS_BY_QUANTITY" ] + }, + "amount_off": { + "type": "integer", + "description": "Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. " } } - } - }, - "redeemables": { - "type": "array", - "minItems": 1, - "maxItems": 5, - "description": "An array of redeemables. You can combine `voucher`(s) and `promotion_tier`(s). Alternatively, send one unique`promotion_stack` in the array.", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/19_req_redeemables_discount_referral_promotion_tier_promotion_stack" + }, + "6_res_validate_voucher_discount_percent": { + "title": "Percent Discount", + "type": "object", + "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", + "properties": { + "type": { + "type": "string", + "default": "PERCENT", + "description": "Defines the type of voucher." + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS" + ], + "description": "Defines how the discount is applied to the customer's order." + }, + "percent_off": { + "type": "integer", + "description": "The percent discount that the customer will receive." + }, + "amount_limit": { + "type": "integer", + "description": "Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600." + }, + "is_dynamic": { + "type": "boolean", + "description": "Flag indicating whether the discount was calculated using a formula." + } + } + }, + "6_res_validate_voucher_discount_fixed": { + "title": "Fixed Discount", + "type": "object", + "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value. A fixed discounts sets a fixed total on cart or item(s) and then calculates the discount to apply.", + "properties": { + "type": { + "type": "string", + "default": "FIXED", + "description": "Type of discount." + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS" + ], + "description": "Defines how the discount is applied to the customer's order. \n \n| **Effect** | **Definition** |\n|---|---|\n| **APPLY_TO_ORDER** | Sets the order total amount to the value of the fixed amount. The discount value is calculated during the redemption as it's a difference between the total amount of the customer's order and the fixed amount. |\n| **APPLY_TO_ITEMS** | Sets a new price on items. The total discount amount is calculated during the redemption and it's a difference between the initial item price and the fixed amount. |" }, + "fixed_amount": { + "type": "integer", + "description": "Set a fixed valued for an order total or price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. In case of the fixed amount being calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value." + } + } + }, + "6_res_validate_voucher_discount_unit": { + "title": "Unit Discount, single item", + "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", + "oneOf": [ { - "$ref": "#/components/schemas/19_req_redeemables_gift_card" + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_product" }, { - "$ref": "#/components/schemas/19_req_redeemables_loyalty_card" + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_sku" } ] - } - }, - "session": { - "$ref": "#/components/schemas/19_req_session_lock" - }, - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" - }, - { - "$ref": "#/components/schemas/10_req_create_order" - } - ], - "description": "Order information. This object enables you to pass purchase transaction data. Read what properties you can use in the [Order object](ref:get-order)." - }, - "metadata": { - "type": "object", - "description": "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." - } - }, - "required": [ - "redeemables" - ] - }, - "19_res_validations": { - "title": "Validate Stackable Discounts Response Body", - "description": "Response body schema for POST `/validations`.", - "oneOf": [ - { - "$ref": "#/components/schemas/19_res_validations-true" - }, - { - "$ref": "#/components/schemas/19_res_validations-false" - } - ] - }, - "19_res_validations-false": { - "type": "object", - "title": "False", - "description": "Response body schema for POST `/validations`.", - "properties": { - "valid": { - "type": "boolean", - "description": "The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable.", - "default": false - }, - "redeemables": { - "type": "array", - "description": "Lists validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"`.", - "items": { + }, + "6_res_validate_voucher_discount_unit_product": { + "title": "Unit Discount, Product", "type": "object", + "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", "properties": { - "status": { + "type": { + "type": "string", + "default": "UNIT", + "description": "Discount type." + }, + "effect": { "type": "string", "enum": [ - "APPLICABLE", - "INAPPLICABLE", - "SKIPPED" + "ADD_MISSING_ITEMS", + "ADD_NEW_ITEMS" ], - "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules. `SKIPPED` indicates that the validation stopped once it identified at least one unapplicable redeemable and did not continue to validate the given redeemable." + "description": "Defines how the unit is added to the customer's order." }, - "id": { + "unit_off": { + "type": "integer", + "description": "Number of units to be granted a full value discount." + }, + "unit_type": { "type": "string", - "description": "Redeemable ID, i.e. the voucher code." + "example": "prod_0a9f9ab4ab019a42d5", + "description": "The product deemed as free, chosen from product inventory (e.g. time, items)." }, - "object": { + "product": { + "type": "object", + "description": "Contains information about the product.", + "properties": { + "id": { + "type": "string", + "description": "Unique product ID, assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "Product's source ID." + }, + "name": { + "type": "string", + "description": "Product name." + } + } + } + } + }, + "6_res_validate_voucher_discount_unit_sku": { + "title": "Unit Discount, SKU", + "type": "object", + "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", + "properties": { + "type": { + "type": "string", + "default": "UNIT", + "description": "Discount type." + }, + "effect": { "type": "string", - "description": "Redeemable's object type.", "enum": [ - "voucher", - "promotion_tier", - "promotion_stack" - ] + "ADD_MISSING_ITEMS", + "ADD_NEW_ITEMS" + ], + "description": "Defines how the unit is added to the customer's order." }, - "result": { + "unit_off": { + "type": "integer", + "description": "Number of units to be granted a full value discount." + }, + "unit_type": { + "type": "string", + "example": "sku_0bae3b28f610fd0da1", + "description": "The product variant deemed as free, chosen from product inventory (e.g. time, items)." + }, + "sku": { "type": "object", - "description": "Provides details for an inapplicable redeemable.", + "description": "Contains information about the SKU.", "properties": { - "error": { - "$ref": "#/components/schemas/e_error" + "id": { + "type": "string", + "example": "sku_0bae3b28f610fd0da1", + "description": "Unique SKU ID, assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "Product variant's source ID." + }, + "sku": { + "type": "string", + "description": "Product varient's name." } } }, - "metadata": { + "product": { "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object" + "description": "Contains information about the parent product.", + "properties": { + "id": { + "type": "string", + "description": "Unique parent product ID, assigned by Voucherify.", + "example": "prod_0bae2dc5a090fd0184" + }, + "source_id": { + "type": "string", + "description": "Source ID of parent product." + }, + "name": { + "type": "string", + "description": "Name of parent product." + } + } } } - } - }, - "tracking_id": { - "type": "string", - "example": "track_VAVo1/z+G2GI2LPw==", - "description": "Hashed customer source ID." - } - } - }, - "19_res_validations_redeemables_discount_voucher": { - "type": "object", - "description": "Response schema model for validating a discount code.", - "title": "Discount Voucher", - "properties": { - "status": { - "type": "string", - "enum": [ - "APPLICABLE" - ], - "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." - }, - "id": { - "type": "string", - "description": "Redeemable ID, i.e. the voucher code." - }, - "object": { - "type": "string", - "description": "Redeemable's object type.", - "enum": [ - "voucher" - ] - }, - "order": { - "$ref": "#/components/schemas/19_obj_order_object_validation_res_per_redeemable" - }, - "applicable_to": { - "$ref": "#/components/schemas/6_res_applicable_to_object" - }, - "inapplicable_to": { - "$ref": "#/components/schemas/6_res_inapplicable_to_object" - }, - "result": { - "description": "Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable.", - "$ref": "#/components/schemas/19_obj_validations-true_result_voucher_code" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object" - } - } - }, - "19_res_validations_redeemables_gift_card": { - "type": "object", - "description": "Response schema model for validating a gift card.", - "title": "Gift Card", - "properties": { - "status": { - "type": "string", - "enum": [ - "APPLICABLE" - ], - "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." - }, - "id": { - "type": "string", - "description": "Redeemable ID, i.e. the gift card code." - }, - "object": { - "type": "string", - "description": "Redeemable's object type.", - "enum": [ - "voucher" - ] - }, - "applicable_to": { - "$ref": "#/components/schemas/6_res_applicable_to_object" - }, - "inapplicable_to": { - "$ref": "#/components/schemas/6_res_inapplicable_to_object" - }, - "result": { - "description": "Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable.", - "$ref": "#/components/schemas/19_obj_validations-true_result_gift_card" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object" - } - } - }, - "19_res_validations_redeemables_loyalty_card": { - "type": "object", - "description": "Response schema model for validating a loyalty card.", - "title": "Loyalty Card", - "properties": { - "status": { - "type": "string", - "enum": [ - "APPLICABLE" - ], - "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." - }, - "id": { - "type": "string", - "description": "Redeemable ID, i.e. the loyalty card code." - }, - "object": { - "type": "string", - "description": "Redeemable's object type.", - "enum": [ - "voucher" - ] - }, - "applicable_to": { - "$ref": "#/components/schemas/6_res_applicable_to_object" - }, - "inapplicable_to": { - "$ref": "#/components/schemas/6_res_inapplicable_to_object" - }, - "result": { - "description": "Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable.", - "$ref": "#/components/schemas/19_obj_validations-true_result_loyalty_card" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object" - } - } - }, - "19_res_validations_redeemables_promotion_tier": { - "type": "object", - "description": "Response schema model for validating a promotion tier.", - "title": "Promotion Tier", - "properties": { - "status": { - "type": "string", - "enum": [ - "APPLICABLE" - ], - "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." - }, - "id": { - "type": "string", - "description": "Redeemable ID, i.e. the promotion tier ID." - }, - "object": { - "type": "string", - "description": "Redeemable's object type.", - "enum": [ - "promotion_tier" - ] - }, - "applicable_to": { - "$ref": "#/components/schemas/6_res_applicable_to_object" - }, - "inapplicable_to": { - "$ref": "#/components/schemas/6_res_inapplicable_to_object" - }, - "result": { - "description": "Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable.", - "$ref": "#/components/schemas/19_obj_validations-true_result_promotion_tier" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object" - } - } - }, - "19_res_validations_redeemables_promotion_stack": { - "type": "object", - "description": "Response schema model for validating a promotion stack.", - "title": "Promotion Stack", - "properties": { - "status": { - "type": "string", - "enum": [ - "APPLICABLE" - ], - "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." - }, - "id": { - "type": "string", - "description": "Redeemable ID, i.e. the promotion stack ID." - }, - "object": { - "type": "string", - "description": "Redeemable's object type.", - "enum": [ - "promotion_stack" - ] - }, - "applicable_to": { - "$ref": "#/components/schemas/6_res_applicable_to_object" - }, - "inapplicable_to": { - "$ref": "#/components/schemas/6_res_inapplicable_to_object" - }, - "result": { - "description": "Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable.", - "$ref": "#/components/schemas/19_obj_validations-true_result_promotion_stack" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object" - } - } - }, - "19_res_validations-true": { - "type": "object", - "title": "True", - "description": "Response body schema for POST `/validations`.", - "properties": { - "valid": { - "type": "boolean", - "description": "The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable.", - "default": true - }, - "redeemables": { - "type": "array", - "description": "Lists validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"`.", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/19_res_validations_redeemables_discount_voucher" - }, - { - "$ref": "#/components/schemas/19_res_validations_redeemables_gift_card" - }, - { - "$ref": "#/components/schemas/19_res_validations_redeemables_loyalty_card" + }, + "6_res_validate_voucher_discount_unit_multiple": { + "title": "Unit Discount, multiple items", + "type": "object", + "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", + "properties": { + "type": { + "type": "string", + "default": "UNIT", + "description": "Discount type." }, - { - "$ref": "#/components/schemas/19_res_validations_redeemables_promotion_tier" + "effect": { + "type": "string", + "default": "ADD_MANY_ITEMS", + "description": "Defines how the discount is applied to the customer's order." }, - { - "$ref": "#/components/schemas/19_res_validations_redeemables_promotion_stack" + "units": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_product_multiple" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_sku_multiple" + } + ] } - ] - } - }, - "order": { - "$ref": "#/components/schemas/19_obj_order_object_validation_res" - }, - "tracking_id": { - "type": "string", - "example": "track_VAVo1/z+G2GI2LPw==", - "description": "Hashed customer source ID." - }, - "session": { - "$ref": "#/components/schemas/19_res_session_lock" - } - } - }, - "19_obj_validations-true_result_voucher_code": { - "type": "object", - "title": "Coupon Code", - "description": "This is a `result` object representing the results for a coupon code.", - "properties": { - "discount": { - "description": "Discount details about the type of discount to be applied for the redeemable.", - "oneOf": [ - { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_amount" - }, - { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_amount_dynamic" - }, - { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_percentage" - }, - { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_percentage_dynamic" - }, - { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_fixed_order" - }, - { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_fixed_items" - }, - { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_unit_one" - }, - { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_shipping" - } - ] - } - } - }, - "19_obj_voucher_object_discount_amount": { - "title": "Static Amount", - "type": "object", - "description": "Amount discount type based on a static value.", - "properties": { - "type": { - "type": "string", - "default": "AMOUNT", - "description": "Applies an amount discount." - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS", - "APPLY_TO_ITEMS_PROPORTIONALLY", - "APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY", - "APPLY_TO_ITEMS_BY_QUANTITY" - ], - "description": "Defines how the discount is applied to the customer's order." - }, - "amount_off": { - "type": "integer", - "example": 100, - "description": "Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000." - }, - "is_dynamic": { - "type": "boolean", - "description": "Flag indicating whether the discount amount is based on a formula that dynamically calculates the discount.", - "enum": [ - false - ] - } - } - }, - "19_obj_voucher_object_discount_amount_dynamic": { - "title": "Dynamic Amount", - "type": "object", - "description": "Amount discount type based on a formula.", - "properties": { - "type": { - "type": "string", - "default": "AMOUNT", - "description": "Applies an amount discount." - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS", - "APPLY_TO_ITEMS_PROPORTIONALLY", - "APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY", - "APPLY_TO_ITEMS_BY_QUANTITY" - ], - "description": "Defines how the discount is applied to the customer's order." - }, - "is_dynamic": { - "type": "boolean", - "description": "Flag indicating whether the discount amount is based on a formula that dynamically calculates the discount.", - "enum": [ - true - ] - } - } - }, - "19_obj_voucher_object_discount_percentage": { - "title": "Percentage", - "type": "object", - "description": "Percentage discount type applied to an order (static or dynamic) or a percentage discount type applied to items (static).", - "properties": { - "type": { - "type": "string", - "default": "PERCENT", - "description": "Applies a percentage discount." - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS" - ], - "description": "Defines how the discount is applied to the customer's order." - }, - "percent_off": { - "type": "integer", - "description": "Percent taken off the subtotal amount. In case of the percent being calculated by the formula and applied to the order level, i.e. the `is_dynamic` parameter is `true`, this value becomes a dynamically calculated value that varies based on the formula.", - "minimum": 0, - "maximum": 100 - }, - "amount_limit": { - "type": "string", - "description": "Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600." - }, - "is_dynamic": { - "type": "boolean", - "description": "Flag indicating whether the discount percentage is based on a formula that dynamically calculates the discount.", - "enum": [ - false, - true - ] - } - } - }, - "19_obj_voucher_object_discount_percentage_dynamic": { - "title": "Dynamic Percentage for Items", - "type": "object", - "description": "Percentage discount type applied to items and based on a formula (dynamic).", - "properties": { - "type": { - "type": "string", - "default": "PERCENT", - "description": "Applies a percentage discount." - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS" - ], - "description": "Defines how the discount is applied to the customer's order." - }, - "amount_limit": { - "type": "string", - "description": "Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600." - }, - "is_dynamic": { - "type": "boolean", - "description": "Flag indicating whether the discount percentage is based on a formula that dynamically calculates the discount.", - "enum": [ - true - ] - } - } - }, - "19_obj_voucher_object_discount_fixed_order": { - "title": "Fixed Order Amount", - "description": "Fixed discount type for an order.", - "type": "object", - "properties": { - "type": { - "type": "string", - "default": "FIXED", - "description": "Sets a fixed total on the cart and then calculates the discount to apply." - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_ORDER" - ], - "description": "\n| **Effect** | **Definition** |\n|:---|:---|\n| **APPLY_TO_ORDER** | Sets the order total amount to the value of the fixed amount. The discount value is calculated dynamically during the redemption as it's a difference between the total amount of the customer's order and the fixed amount. For example, if the fixed amount is set to equal $10 and the order amount equals $25, then the calculated discount will be $15. |" - }, - "fixed_amount": { - "type": "integer", - "description": "Set a fixed valued for an order total. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000.", - "example": 1000 - }, - "is_dynamic": { - "type": "boolean", - "description": "Flag indicating whether the fixed amount is based on a formula that dynamically calculates the fixed amount.", - "enum": [ - false, - true - ] - } - } - }, - "19_obj_voucher_object_discount_fixed_items": { - "title": "New Prices for Items", - "description": "Fixed discount type for item(s).", - "type": "object", - "properties": { - "type": { - "type": "string", - "default": "FIXED", - "description": "Sets a new item price and then calculates the discount to apply." - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_ITEMS" - ], - "description": "\n| **Effect** | **Definition** |\n|:---|:---|\n| **APPLY_TO_ITEMS** | Sets a new price on items. The total discount amount is dynamically calculated during the redemption and it's a difference between the initial item price and the fixed amount. During the redemption, prices for items will change only if the new price is lower than the original price. If the new product price you set is different from the product price in a collection, then the new product price will be passed during the redemption. If a prodct is in more than one collection, the price is always changed to the lowest price. The new price for products with several SKUs will force the price change for SKUs if their original price is higher than the new price. |" - }, - "is_dynamic": { - "type": "boolean", - "description": "Flag defaults to false because each item price could be defined separately and either based on a formula that dynamically calculates the discount or based on a fixed set price.", - "enum": [ - false - ] - } - } - }, - "19_obj_voucher_object_discount_unit_one": { - "title": "Unit, single item", - "type": "object", - "description": "Single item type.", - "properties": { - "type": { - "type": "string", - "default": "UNIT", - "description": "Applies a full value discount to item(s)." - }, - "effect": { - "type": "string", - "enum": [ - "ADD_NEW_ITEMS", - "ADD_MISSING_ITEMS" - ], - "default": "ADD_MISSING_ITEMS", - "description": "Defines how the unit is added to the customer's order." - }, - "unit_off": { - "type": "number", - "description": "Number of units to be granted a full value discount. ", - "example": 1, - "format": "float" - }, - "unit_type": { - "type": "string", - "description": "The product or SKU deemed as free, chosen from the product inventory (e.g. time, items), i.e. `sku_0a3efc90375d1217e2` or `prod_s3C0nDpr0DuC7`.", - "example": "prod_f1r5Tpr0DuC7" - }, - "sku": { - "type": "object", - "description": "Defines the product details of the product or the parent product in case of an SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_0a3efc90375d1217e2", - "description": "Unique SKU ID assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "SKU source ID." - }, - "sku": { - "type": "string", - "description": "SKU name." } - } - }, - "product": { - "type": "object", - "description": "Defines the product details of the product or the parent product in case of an SKU.", - "properties": { - "id": { - "type": "string", - "example": "prod_0bc3bd76a61082e6b3", - "description": "Unique (parent) product ID assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "Product source ID." - }, - "name": { - "type": "string", - "description": "Product name." + }, + "6_res_validate_voucher_discount_unit_product_multiple": { + "title": "Product Item", + "type": "object", + "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", + "properties": { + "effect": { + "type": "string", + "enum": [ + "ADD_MISSING_ITEMS", + "ADD_NEW_ITEMS" + ], + "description": "Defines how the unit is added to the customer's order." + }, + "unit_off": { + "type": "integer", + "description": "Number of units to be granted a full value discount." + }, + "unit_type": { + "type": "string", + "example": "prod_0a9f9ab4ab019a42d5", + "description": "The product deemed as free, chosen from product inventory (e.g. time, items)." + }, + "product": { + "type": "object", + "description": "Contains information about the product.", + "properties": { + "id": { + "type": "string", + "description": "Unique product ID, assigned by Voucherify.", + "example": "prod_0a9f9ab4ab019a42d5" + }, + "source_id": { + "type": "string", + "description": "Product's source ID." + }, + "name": { + "type": "string", + "description": "Product name." + } + } + } } - } - }, - "is_dynamic": { - "type": "boolean", - "description": "Flag indicating whether the number of items is based on a formula.", - "enum": [ - false, - true - ] - } - } - }, - "19_obj_voucher_object_discount_unit_multiple": { - "title": "Unit, multiple items", - "type": "object", - "description": "Multiple item types.", - "properties": { - "type": { - "type": "string", - "description": "Applies a full value discount to item(s).", - "default": "UNIT" - }, - "effect": { - "type": "string", - "default": "ADD_MANY_ITEMS", - "description": "Defines the effect for adding multiple item types." - }, - "units": { - "type": "array", - "description": "Array of objects defining items to be offered for free. Each item type can have a different discount effect assigned.", - "items": { + }, + "6_res_validate_voucher_discount_unit_sku_multiple": { + "title": "SKU Item", "type": "object", - "description": "Object defining a unit discount.", + "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", "properties": { "effect": { "type": "string", "enum": [ - "ADD_NEW_ITEMS", - "ADD_MISSING_ITEMS" + "ADD_MISSING_ITEMS", + "ADD_NEW_ITEMS" ], "description": "Defines how the unit is added to the customer's order." }, "unit_off": { "type": "integer", - "description": "Number of units to be granted a full value discount. In case of the unit being calculated by a formula, this value is the result of the dynamic calculation.", - "example": 1 + "description": "Number of units to be granted a full value discount." }, "unit_type": { "type": "string", - "description": "The product or SKU deemed as free, chosen from the product inventory (e.g. time, items), i.e. `prod_0bc3bd76a61082e6b3` or `sku_0a3efc90701d121820`.", - "example": "prod_f1r5Tpr0DuC7" + "example": "sku_0bae3b28f610fd0da1", + "description": "The product variant deemed as free, chosen from product inventory (e.g. time, items)." }, "sku": { "type": "object", - "description": "Defines the product details of the product or the parent product in case of an SKU.", + "description": "Contains information about the SKU.", "properties": { "id": { "type": "string", - "example": "sku_0a3efc90375d1217e2", - "description": "Unique SKU ID assigned by Voucherify." + "example": "sku_0bae3b28f610fd0da1", + "description": "Unique SKU ID, assigned by Voucherify." }, "source_id": { "type": "string", - "description": "SKU source ID." + "description": "Product variant's source ID." }, "sku": { "type": "string", - "description": "SKU name." + "description": "Product varient's name." } } }, "product": { "type": "object", - "description": "Defines the product details of the product or the parent product in case of an SKU.", + "description": "Contains information about the parent product.", "properties": { "id": { "type": "string", - "example": "prod_0bc3bd76a61082e6b3", - "description": "Unique (parent) product ID assigned by Voucherify." + "description": "Unique parent product ID, assigned by Voucherify.", + "example": "prod_0b7d7dfb05cbe5c616" }, "source_id": { "type": "string", - "description": "Product source ID." + "description": "Source ID of parent product." }, "name": { "type": "string", - "description": "Product name." + "description": "Name of parent product." } } } } - } - }, - "is_dynamic": { - "type": "boolean", - "description": "Flag indicating whether the number of items is based on a formula." - } - } - }, - "19_obj_voucher_object_discount_shipping": { - "title": "Shipping", - "description": "Shipping discount type.", - "type": "object", - "properties": { - "type": { - "type": "string", - "default": "UNIT", - "description": "Applies a full value discount to item(s)." - }, - "effect": { - "type": "string", - "description": "Defines how the unit is added to the customer's order.", - "default": "ADD_MISSING_ITEMS" - }, - "unit_off": { - "type": "number", - "format": "float", - "description": "Subtracts 1 shipping item from the subtotal.", - "default": 1 - }, - "unit_type": { - "type": "string", - "description": "The shipping product deemed as free.", - "default": "prod_5h1pp1ng" - }, - "product": { - "type": "object", - "description": "Defines the product details of the shipping product.", - "properties": { - "id": { - "type": "string", - "example": "prod_5h1pp1ng", - "description": "Unique product ID assigned by Voucherify, i.e. `prod_5h1pp1ng`.", - "default": "prod_5h1pp1ng" - }, - "source_id": { - "type": "string", - "description": "Product source ID.", - "default": "5h1pp1ng", - "example": "5h1pp1ng" - }, - "name": { - "type": "string", - "description": "Product name.", - "example": "Shipping", - "default": "Shipping" - } - } - }, - "is_dynamic": { - "type": "boolean", - "description": "Flag indicating whether the number of shipping items is based on a formula.", - "default": false, - "enum": [ - false - ] - } - } - }, - "19_obj_validations-true_result_gift_card": { - "type": "object", - "title": "Gift Card", - "description": "This is a `result` object representing the results for a gift card.", - "properties": { - "gift": { - "description": "Stores the amount of gift card credits to be applied in the redemption.", - "type": "object", - "properties": { - "credits": { - "type": "integer", - "description": "Total number of gift card credits to be applied in the redemption expressed as the smallest currency unit (that is, 100 cents for $1.00)." - } - } - } - } - }, - "19_obj_validations-true_result_loyalty_card": { - "type": "object", - "title": "Loyalty Card", - "description": "This is a `result` object representing the results for a loyalty card.", - "properties": { - "loyalty_card": { - "description": "Stores the amount of loyalty card points to be applied in the redemption.", - "type": "object", - "properties": { - "points": { - "type": "integer", - "description": "Total number of loyalty points to be applied in the redemption." - } - } - } - } - }, - "19_obj_validations-true_result_promotion_tier": { - "type": "object", - "title": "Promotion Tier", - "description": "This is a `result` object representing the results for a promotion tier.", - "properties": { - "discount": { - "description": "Discount details about the type of discount to be applied for the redeemable.", - "oneOf": [ - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" - } - ] - } - } - }, - "19_obj_validations-true_result_promotion_stack": { - "type": "object", - "title": "Promotion Stack", - "description": "This is a `result` object representing the results for a promotion stack.", - "properties": { - "loyalty_card": { - "description": "Stores the amount of loyalty card points to be applied in the redemption.", - "type": "object", - "properties": { - "points": { - "type": "integer", - "description": "Total number of loyalty points to be applied in the redemption." - } - } - } - } - }, - "19_obj_order_object_validation_res": { - "type": "object", - "title": "Order", - "description": "Contains the combined effect of all redeemables taken into account on the order object properties.", - "properties": { - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "discount_amount": { - "type": "integer", - "description": "Sum of all order-level discounts applied to the order. \n`sum(redeemables.order.applied_discount_amount)`" - }, - "items_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" - }, - "total_discount_amount": { - "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`\t" - }, - "total_amount": { - "type": "integer", - "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" - }, - "applied_discount_amount": { - "type": "integer", - "description": "Sum of all order-level discounts applied in a particular request. \n`sum(redeemables.order.applied_discount_amount)`" - }, - "items_applied_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied in a particular request. \n`sum(items, i => i.applied_discount_amount)`" - }, - "total_applied_discount_amount": { - "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied in a particular request. \n`total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount`" - }, - "items": { - "type": "array", - "description": "Array of order items showing the effects of particular discounts on the item-level.", - "items": { + }, + "6_res_validate_voucher_discount_shipping": { + "title": "Shipping Discount", "type": "object", + "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", "properties": { - "object": { - "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." - }, - "product_id": { + "type": { "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." + "default": "UNIT", + "description": "Discount type." }, - "sku_id": { + "effect": { "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + "description": "Defines how the unit is added to the customer's order.", + "default": "ADD_MISSING_ITEMS" }, - "price": { + "unit_off": { "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "description": "Number of units to be granted a full value discount.", + "default": 1 }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`applied_discount_amount`" + "unit_type": { + "type": "string", + "description": "The shipping \"product\" deemed as free.", + "default": "prod_5h1pp1ng" }, "product": { "type": "object", - "description": "This object stores more information about the related product.", + "description": "Contains information about the shipping \"product\".", "properties": { "id": { "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." + "description": "Unique shipping \"product\" ID, assigned by Voucherify.", + "default": "prod_5h1pp1ng" }, "source_id": { "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" + "description": "\"Product's\" source ID.", + "default": "5h1pp1ng" }, "name": { "type": "string", - "example": "Brewing System", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "description": "\"Product\" name.", + "default": "Shipping" } } + } + } + }, + "6_res_validate_voucher": { + "title": "Valid", + "description": "Response schema model for validating a voucher using **POST** `/vouchers/{code}/validate`.", + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_code" }, - "sku": { - "type": "object", - "description": "This object stores more information about the related SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + { + "$ref": "#/components/schemas/6_res_validate_voucher_gift_card" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_loyalty_card" + } + ] + }, + "6_res_validate_voucher_discount_code": { + "type": "object", + "title": "Valid - Discount Code", + "description": "Response schema model for validating a discount code using **POST** `/vouchers/{code}/validate`.", + "properties": { + "valid": { + "type": "boolean", + "description": "Indicates whether the voucher is valid within the context of the parameters provided in the request body." + }, + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" + }, + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" + }, + "tracking_id": { + "type": "string", + "description": "Hashed customer source ID." + }, + "order": { + "$ref": "#/components/schemas/6_obj_order_object" + }, + "code": { + "type": "string", + "description": "Voucher code." + }, + "discount": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_amount" }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_percent" }, - "sku": { - "type": "string", - "description": "SKU name." + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_fixed" }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_shipping" } - } + ], + "description": "Contains information about the discount to be applied to the order." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + }, + "start_date": { + "type": "string", + "format": "date-time", + "example": "2022-10-04T00:00:00.000Z", + "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is _inactive_ before this date." + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-10-31T00:00:00.000Z", + "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is _inactive_ after this date." + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "example": "camp_W8DJVd8J0btqXT6FBwn7BSkC", + "description": "Voucher's parent campaign's unique ID." + }, + "session": { + "$ref": "#/components/schemas/6_res_session_lock_discount_voucher" } } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "customer_id": { - "type": "null" - }, - "referrer_id": { - "type": "null" - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - } - } - }, - "19_obj_order_object_validation_res_per_redeemable": { - "type": "object", - "title": "Order", - "description": "Contains the effect of each redeemable on the order and specific cart items. The amounts are consecutively built on the previous redeemable's effects, such that for each redeemable, the amounts are further reduced by the redeemable. The sequence in the request body is important because that will be the sequence the redeemables are applied one on top of the other.", - "properties": { - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "discount_amount": { - "type": "integer", - "description": "Sum of all order-level discounts applied to the order. \n`sum(redeemables.order.applied_discount_amount)`" - }, - "items_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" - }, - "total_discount_amount": { - "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`\t" - }, - "total_amount": { - "type": "integer", - "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" - }, - "applied_discount_amount": { - "type": "integer", - "description": "Sum of all order-level discounts applied in a particular request. \n`sum(redeemables.order.applied_discount_amount)`" - }, - "items_applied_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied in a particular request. \n`sum(items, i => i.applied_discount_amount)`" - }, - "total_applied_discount_amount": { - "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied in a particular request. \n`total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount`" - }, - "items": { - "type": "array", - "description": "Array of order items showing the effects of particular discounts on the item-level.", - "items": { + }, + "6_res_validate_voucher_gift_card": { "type": "object", + "title": "Valid - Gift Card", + "description": "Response schema model for validating a gift card using **POST** `/vouchers/{code}/validate`.", "properties": { - "object": { + "valid": { + "type": "boolean", + "description": "Indicates whether the voucher is valid within the context of the parameters provided in the request body." + }, + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" + }, + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" + }, + "tracking_id": { "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." + "description": "Hashed customer source ID." }, - "product_id": { + "order": { + "$ref": "#/components/schemas/6_obj_order_object" + }, + "code": { "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." + "description": "Voucher code." }, - "sku_id": { + "gift": { + "type": "object", + "description": "Contains current gift card balance information.", + "properties": { + "amount": { + "type": "integer", + "description": "Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "balance": { + "type": "integer", + "description": "Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS" + ], + "description": "Defines how the credits are applied to the customer's order." + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + }, + "start_date": { "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + "format": "date-time", + "example": "2022-10-04T00:00:00.000Z", + "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is _inactive_ before this date." }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-10-31T00:00:00.000Z", + "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is _inactive_ after this date." }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "campaign_id": { + "type": "string", + "example": "camp_W8DJVd8J0btqXT6FBwn7BSkC", + "description": "Voucher's parent campaign's unique ID." }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`applied_discount_amount`" + "session": { + "$ref": "#/components/schemas/6_res_session_lock_gift_card" + } + } + }, + "6_res_validate_voucher_loyalty_card": { + "type": "object", + "title": "Valid - Loyalty Card", + "description": "Response schema model for validating a loyalty card using **POST** `/vouchers/{code}/validate`.", + "properties": { + "valid": { + "type": "boolean", + "description": "Indicates whether the voucher is valid within the context of the parameters provided in the request body." }, - "product": { + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" + }, + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" + }, + "tracking_id": { + "type": "string", + "description": "Hashed customer source ID." + }, + "order": { + "$ref": "#/components/schemas/6_obj_order_object_apply_to_order" + }, + "code": { + "type": "string", + "description": "Voucher code." + }, + "loyalty": { "type": "object", - "description": "This object stores more information about the related product.", + "description": "Contains the cost of reward in points.", "properties": { - "id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" - }, - "name": { - "type": "string", - "example": "Brewing System", - "description": "Product name." - }, - "price": { + "points_cost": { "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "description": "Number of points that wlil be deducted from loyaty card for the associated reward." } } }, - "sku": { + "reward": { "type": "object", - "description": "This object stores more information about the related SKU.", + "description": "Contains information about the reward that is being validated.", "properties": { "id": { "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." + "description": "Unique reward ID assigned by Voucherify.", + "example": "rew_Crmu3hu2FKZWZIML59AeAs1n" }, - "sku": { + "assignment_id": { "type": "string", - "description": "SKU name." + "example": "rewa_xZr6Ks0j5AHeMRVdELmpI9sc", + "description": "Unique reward assignment ID assigned by Voucherify." }, - "price": { + "points": { "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "description": "Number of points applied to the reward." } } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + }, + "start_date": { + "type": "string", + "format": "date-time", + "example": "2022-10-04T00:00:00.000Z", + "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is _inactive_ before this date." + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-10-31T00:00:00.000Z", + "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is _inactive_ after this date." + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "example": "camp_W8DJVd8J0btqXT6FBwn7BSkC", + "description": "Voucher's parent campaign's unique ID." + }, + "session": { + "$ref": "#/components/schemas/6_res_session_lock_loyalty_card" } } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "customer_id": { - "type": "null" - }, - "referrer_id": { - "type": "null" - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - } - } - }, - "19_res_redemptions_parentRedemptionId_rollbacks": { - "type": "object", - "properties": { - "rollbacks": { - "type": "array", - "description": "Contains the rollback redemption objects of the particular incentives.", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/19_obj_redemption_rollback_object_discount_voucher_stacked" + }, + "6_res_applicable_to_object": { + "title": "Included Items", + "type": "object", + "description": "Contains list of items that qualify in the scope of the discount. These are definitions of included products, SKUs, and product collections. These can be discounted.", + "properties": { + "data": { + "type": "array", + "description": "Contains array of items to which the discount can apply.", + "items": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_product_collection" + }, + { + "$ref": "#/components/schemas/6_res_product_collection_unit" + }, + { + "$ref": "#/components/schemas/6_res_product_collection_fixed_amount" + }, + { + "$ref": "#/components/schemas/6_res_product" + }, + { + "$ref": "#/components/schemas/6_res_product_unit" + }, + { + "$ref": "#/components/schemas/6_res_product_fixed_amount" + }, + { + "$ref": "#/components/schemas/6_res_sku" + }, + { + "$ref": "#/components/schemas/6_res_sku_unit" + }, + { + "$ref": "#/components/schemas/6_res_sku_unit_fixed_amount" + } + ] + } }, - { - "$ref": "#/components/schemas/19_obj_redemption_rollback_object_loyalty_card_stacked" + "total": { + "type": "integer", + "description": "Total number of objects defining included products, SKUs, or product collections." }, - { - "$ref": "#/components/schemas/19_obj_redemption_rollback_object_gift_card_stacked" + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of included objects." }, - { - "$ref": "#/components/schemas/19_obj_redemption_rollback_object_promotion_tier_stacked" + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about included products, SKUs, or product collections in a dictionary." } - ] - } - }, - "parent_rollback": { - "type": "object", - "properties": { - "id": { - "type": "string", - "example": "rr_0c675efbc2039b83b3", - "description": "Unique redemption rollback ID." - }, - "customer_id": { - "type": "string", - "example": "cust_QszL0PS1NekVjQaHGxrbpPHu", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "description": "Hashed customer source ID.", - "example": "track_fxEMFisanb4sbl4Z4yCn" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2023-02-03T09:12:22.536Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "order": { - "type": "object", - "properties": { - "id": { - "type": "string", - "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", - "description": "Unique order ID, assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - }, - "status": { - "type": "string", - "description": "Order status.", - "enum": [ - "CANCELED" - ] - }, - "customer_id": { - "type": "string", - "description": "Unique customer ID of the customer making the purchase.", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" - }, - "referrer_id": { - "type": "string", - "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "description": "Unique referrer ID." - }, - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "total_amount": { - "type": "integer", - "description": "Order amount after undoing all the discounts through the rollback redemption." - }, + } + }, + "6_res_inapplicable_to_object": { + "title": "Excluded Items", + "type": "object", + "description": "Contains list of items that **do not** qualify in the scope of the discount. These are definitions of excluded products, SKUs, and product collections. These **CANNOT** be discounted.", + "properties": { + "data": { + "description": "Contains array of items to which the discount cannot apply.", + "type": "array", "items": { - "type": "array", - "description": "Array of order items that have been applied to the order.", - "items": { - "type": "object", - "properties": { - "object": { - "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." - }, - "product_id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "sku_id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the removing an item-level discount." - }, - "product": { - "type": "object", - "description": "This object stores more information about the related product.", - "properties": { - "id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" - }, - "name": { - "type": "string", - "example": "Brewing System", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - }, - "sku": { - "type": "object", - "description": "This object stores more information about the related SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." - }, - "sku": { - "type": "string", - "description": "SKU name." - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - } + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_product_collection_excluded" + }, + { + "$ref": "#/components/schemas/6_res_product_excluded" + }, + { + "$ref": "#/components/schemas/6_res_sku_excluded" } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." + ] } + }, + "total": { + "type": "integer", + "description": "Total number of objects defining excluded products, SKUs, or product collections." + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of excluded objects." + }, + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about excluded products, SKUs, or product collections in a dictionary." } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } + } + }, + "6_res_product_collection": { + "title": "Product Collection", + "type": "object", + "description": "Contains definition for a product collection.", + "properties": { + "object": { + "type": "string", + "default": "products_collection", + "description": "This object stores information about the product collection." + }, + "id": { + "type": "string", + "example": "pc_4ndRXAsTOzwSdHcQcxf489uU", + "description": "Unique product collection ID assigned by Voucherify." + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Defines how the discount is applied to the customer's order." } - }, - "result": { - "type": "string", - "description": "Redemption rollback result", - "enum": [ - "SUCCESS" - ] - }, - "redemption": { - "type": "string", - "example": "r_0c656311b5878a2031", - "description": "Unique redemption ID of the initial redemption." } - } - }, - "order": { - "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked" - } - }, - "description": "Response body schema for POST `/redemptions/{parentRedemptionID}/rollbacks`.", - "title": "Rollback Stackable Redemptions Response Body" - }, - "19_obj_redemption_rollback_object_discount_voucher_stacked": { - "type": "object", - "title": "Rollback Discount Voucher", - "description": "This is an object representing a redemption rollback for a discount voucher.", - "properties": { - "id": { - "type": "string", - "example": "rr_0c5eba630bc4979e70", - "description": "Unique redemption rollback ID." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "anyOf": [ - { - "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_order" - }, - { - "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_items" + }, + "6_res_product_collection_unit": { + "title": "Product Collection for Unit Discount", + "type": "object", + "description": "Contains definition for a product collection.", + "properties": { + "object": { + "type": "string", + "default": "products_collection", + "description": "This object stores information about the product collection." + }, + "id": { + "type": "string", + "example": "pc_4ndRXAsTOzwSdHcQcxf489uU", + "description": "Unique product collection ID assigned by Voucherify." + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Defines how the discount is applied to the customer's order." + }, + "quantity_limit": { + "type": "integer", + "description": "The maximum number of units allowed to be discounted per order line item." + }, + "aggregated_quantity_limit": { + "type": "integer", + "description": "The maximum number of units allowed to be discounted combined across all matched order line items." + } } - ] - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" + }, + "6_res_product_collection_fixed_amount": { + "title": "Product Collection for Fixed Amount Discount", + "type": "object", + "description": "Contains definition for a product collection.", + "properties": { + "object": { + "type": "string", + "default": "products_collection", + "description": "This object stores information about the product collection." + }, + "id": { + "type": "string", + "example": "pc_4ndRXAsTOzwSdHcQcxf489uU", + "description": "Unique product collection ID assigned by Voucherify." + }, + "strict": { + "type": "boolean" + }, + "price": { + "type": "integer", + "description": "New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the `price_formula` parameter is present in the fixed price definition, this value becomes the **fallback value**. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price." + }, + "price_formula": { + "type": "string", + "description": "Formula used to calculate the discounted price of an item.", + "example": "\"IF(ORDER_AMOUNT > 300;ORDER_ITEM_PRICE * 0.8;ORDER_ITEM_PRICE)" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Defines how the discount is applied to the customer's order." + } } - } - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "voucher": { - "type": "object", - "description": "Defines the details of the voucher.", - "properties": { - "id": { - "type": "string", - "description": "Unique voucher ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "discount": { - "oneOf": [ - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" - } - ] - }, - "type": { - "type": "string", - "description": "Indicates the voucher type.", - "enum": [ - "DISCOUNT_VOUCHER" - ] - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "description": "Unique campaign ID assigned by Voucherify.", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - }, - "is_referral_code": { - "type": "boolean", - "description": "Flag indicating whether this voucher is a referral code." + }, + "6_res_product_collection_excluded": { + "title": "Product Collection", + "type": "object", + "description": "Contains definition for a product collection.", + "properties": { + "object": { + "type": "string", + "default": "products_collection", + "description": "This object stores information about the product collection." + }, + "id": { + "type": "string", + "example": "pc_4ndRXAsTOzwSdHcQcxf489uU", + "description": "Unique product collection ID assigned by Voucherify." + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY" + ], + "description": "Defines how the discount is applied to the customer's order." + } } - } - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the original redemption." - } - } - }, - "19_obj_redemption_rollback_object_loyalty_card_stacked": { - "type": "object", - "title": "Rollback Loyalty Card Voucher", - "description": "This is an object representing a redemption rollback for a loyalty card.", - "properties": { - "id": { - "type": "string", - "example": "rr_0c5eaf4060133bf784", - "description": "Unique redemption rollback ID." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "amount": { - "type": "integer", - "description": "Number of points being returned to the loyalty card." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "anyOf": [ - { - "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_order" - }, - { - "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_items" - } - ] - }, - "reward": { - "description": "Defines the reward that was initially redeemed.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" - } - ] - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the reward.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "voucher": { - "type": "object", - "description": "Defines the details of the voucher.", - "properties": { - "id": { - "type": "string", - "description": "Unique voucher ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "loyalty_card": { - "type": "object", - "description": "Stores the number of points being added back to the loyalty card for the reward redemption rollback.", - "properties": { - "points": { - "type": "integer", - "example": 7000, - "description": "Total points incurred over lifespan of loyalty card." - }, - "balance": { - "type": "integer", - "example": 6970, - "description": "Points available for reward redemption after the redemption rollback." - } + }, + "6_res_sku": { + "title": "SKU", + "type": "object", + "description": "Contains definition for a product variant.", + "properties": { + "object": { + "type": "string", + "default": "sku", + "description": "This object stores information about the product variant." + }, + "id": { + "type": "string", + "description": "Unique SKU ID assigned by Voucherify.", + "example": "sku_0b7d7dfb090be5c619" + }, + "source_id": { + "type": "string", + "description": "The source ID from your inventory system." + }, + "product_id": { + "type": "string", + "description": "Parent product's unique ID assigned by Voucherify." + }, + "product_source_id": { + "type": "string", + "description": "Parent product's source ID from your inventory system." + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Defines how the discount is applied to the customer's order." } - }, - "type": { - "type": "string", - "description": "Indicates the voucher type.", - "enum": [ - "LOYALTY_CARD" - ] - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "description": "Unique campaign ID assigned by Voucherify.", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - }, - "is_referral_code": { - "type": "boolean", - "description": "Flag indicating whether this voucher is a referral code." - }, - "holder_id": { - "type": "string", - "description": "Unique customer ID of the loyalty card owner.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - } - } - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the original redemption." - } - } - }, - "19_obj_redemption_rollback_object_gift_card_stacked": { - "type": "object", - "title": "Rollback Gift Card", - "description": "This is an object representing a gift card redemption rollback.", - "properties": { - "id": { - "type": "string", - "example": "rr_0bc92f81a6801f9bca", - "description": "Unique redemption rollback ID." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "amount": { - "type": "integer", - "description": "The amount added back to the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "anyOf": [ - { - "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_order" - }, - { - "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_items" - } - ] - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the gift card.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" } - } - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "voucher": { - "type": "object", - "description": "Defines the details of the voucher.", - "properties": { - "id": { - "type": "string", - "description": "Unique voucher ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "gift": { - "type": "object", - "description": "Contains the balance of the gift card after credits are added back to the gift card for the redemption rollback.", - "properties": { - "amount": { - "type": "integer", - "example": 10000, - "description": "Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "balance": { - "type": "integer", - "example": 500, - "description": "Available funds after the redemption rollback credits back the amount used up during the initial redemption. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS" - ], - "description": "Defines how the credits are applied to the customer's order." - } + }, + "6_res_sku_unit": { + "title": "SKU for Unit Discount", + "type": "object", + "description": "Contains definition for a product variant.", + "properties": { + "object": { + "type": "string", + "default": "sku", + "description": "This object stores information about the product variant." + }, + "id": { + "type": "string", + "description": "Unique SKU ID assigned by Voucherify.", + "example": "sku_0b7d7dfb090be5c619" + }, + "source_id": { + "type": "string", + "description": "The source ID from your inventory system." + }, + "product_id": { + "type": "string", + "description": "Parent product's unique ID assigned by Voucherify." + }, + "product_source_id": { + "type": "string", + "description": "Parent product's source ID from your inventory system." + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Defines how the discount is applied to the customer's order." + }, + "quantity_limit": { + "type": "integer", + "description": "The maximum number of units allowed to be discounted per order line item." + }, + "aggregated_quantity_limit": { + "type": "integer", + "description": "The maximum number of units allowed to be discounted combined across all matched order line items." } - }, - "type": { - "type": "string", - "description": "Indicates the voucher type.", - "enum": [ - "GIFT_VOUCHER" - ] - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "description": "Unique campaign ID assigned by Voucherify.", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - }, - "is_referral_code": { - "type": "boolean", - "description": "Flag indicating whether this voucher is a referral code." - } - } - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the initial redemption.", - "example": "r_0c5bf3323008a35032" - } - } - }, - "19_obj_redemption_rollback_object_promotion_tier_stacked": { - "type": "object", - "title": "Promotion Tier", - "description": "This is an object representing a promotion tier redemption rollback", - "properties": { - "id": { - "type": "string", - "example": "rr_0bc92f81a6801f9bca", - "description": "Unique redemption rollback ID." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "anyOf": [ - { - "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_order" - }, - { - "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_items" - } - ] - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" } - } - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "promotion_tier": { - "type": "object", - "description": "Contains details of the promotion tier and the parent campaign.", - "properties": { - "id": { - "type": "string", - "description": "Unique promotion tier ID assigned by Voucherify.", - "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" - }, - "name": { - "type": "string", - "description": "Promotion tier name." - }, - "banner": { - "type": "string", - "description": "Text to be displayed to your customers on your website." - }, - "campaign": { - "type": "object", - "description": "Promotion tier's parent campaign.", - "properties": { - "id": { - "type": "string", - "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." - } + }, + "6_res_sku_unit_fixed_amount": { + "title": "SKU for Amount Discount", + "type": "object", + "description": "Contains definition for a product variant.", + "properties": { + "object": { + "type": "string", + "default": "sku", + "description": "This object stores information about the product variant." + }, + "id": { + "type": "string", + "description": "Unique SKU ID assigned by Voucherify.", + "example": "sku_0b7d7dfb090be5c619" + }, + "source_id": { + "type": "string", + "description": "The source ID from your inventory system." + }, + "product_id": { + "type": "string", + "description": "Parent product's unique ID assigned by Voucherify." + }, + "product_source_id": { + "type": "string", + "description": "Parent product's source ID from your inventory system." + }, + "strict": { + "type": "boolean" + }, + "price": { + "type": "integer", + "description": "New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the `price_formula` parameter is present in the fixed price definition, this value becomes the **fallback value**. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price." + }, + "price_formula": { + "type": "string", + "description": "Formula used to calculate the discounted price of an item.", + "example": "IF(ORDER_AMOUNT > 200;ORDER_ITEM_PRICE * 0.2;6)" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Defines how the discount is applied to the customer's order." } } - } - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of initial redemption." - } - } - }, - "19_res_redemptions_POST": { - "type": "object", - "title": "Stackable Redemptions Response Body", - "description": "Response body schema for POST `/redemptions`.", - "properties": { - "redemptions": { - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_discount_voucher_extended_stacked" + }, + "6_res_sku_excluded": { + "title": "SKU", + "type": "object", + "description": "Contains definition for a product variant.", + "properties": { + "object": { + "type": "string", + "default": "sku", + "description": "This object stores information about the product variant." }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_extended_stacked" + "id": { + "type": "string", + "description": "Unique SKU ID assigned by Voucherify.", + "example": "sku_0b7d7dfb090be5c619" }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_gift_card_extended_stacked" + "source_id": { + "type": "string", + "description": "The source ID from your inventory system." }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_promotion_tier_extended_stacked" + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY" + ], + "description": "Defines how the discount is applied to the customer's order." } - ] - } - }, - "parent_redemption": { - "type": "object", - "title": "Stacked Redemption", - "description": "This is an object representing a stacked redemption.", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object_stacked_redemptions" - }, - "customer": { - "type": "object", - "description": "Defines the customer making the stacked redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } + } + }, + "6_res_product": { + "title": "Product", + "type": "object", + "description": "Contains definition for a product.", + "properties": { + "object": { + "type": "string", + "default": "product", + "description": "This object stores information about the product." + }, + "id": { + "type": "string", + "description": "Unique product ID assigned by Voucherify.", + "example": "prod_0bae2dc5a090fd0184" + }, + "source_id": { + "type": "string", + "description": "The product ID from your inventory system." + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Defines how the discount is applied to the customer's order." } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.", - "enum": [ - "redemption" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. r_0c5d07222e08a34ace for a redemption." - }, - "voucher": { - "type": "null" } - } - }, - "order": { - "description": "Contains the order details associated with the redemption.", - "$ref": "#/components/schemas/7_obj_order_object_stacked_redemptions" - } - } - }, - "7_obj_order_object_rollback": { - "title": "Order object", - "description": "This is an object representing an order that was rolled back.", - "properties": { - "id": { - "type": "string", - "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", - "description": "Unique order ID, assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:40:48.705Z", - "description": "Timestamp representing the date and time when the order was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:47:20.760Z", - "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format." - }, - "status": { - "type": "string", - "description": "Order status.", - "enum": [ - "CANCELED" - ] - }, - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "total_amount": { - "type": "integer", - "description": "Order amount after undoing all the discounts through the rollback redemption." - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order.", - "items": { + }, + "6_res_product_unit": { + "title": "Product for Unit Discount", "type": "object", + "description": "Contains definition for a product.", "properties": { "object": { "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." + "default": "product", + "description": "This object stores information about the product." }, - "product_id": { + "id": { "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." + "description": "Unique product ID assigned by Voucherify.", + "example": "prod_0bae2dc5a090fd0184" }, - "sku_id": { + "source_id": { "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + "description": "The product ID from your inventory system." }, - "quantity": { + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Defines how the discount is applied to the customer's order." + }, + "quantity_limit": { "type": "integer", - "description": "Quantity of the item in the cart." + "description": "The maximum number of units allowed to be discounted per order line item." }, - "amount": { + "aggregated_quantity_limit": { "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + "description": "The maximum number of units allowed to be discounted combined across all matched order line items." + } + } + }, + "6_res_product_fixed_amount": { + "title": "Product for Fixed Amount Discount", + "type": "object", + "description": "Contains definition for a product.", + "properties": { + "object": { + "type": "string", + "default": "product", + "description": "This object stores information about the product." + }, + "id": { + "type": "string", + "description": "Unique product ID assigned by Voucherify.", + "example": "prod_0bae2dc5a090fd0184" + }, + "source_id": { + "type": "string", + "description": "The product ID from your inventory system." + }, + "strict": { + "type": "boolean" }, "price": { "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "description": "New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the `price_formula` parameter is present in the fixed price definition, this value becomes the **fallback value**. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price." }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the removing an item-level discount." + "price_formula": { + "type": "string", + "description": "Formula used to calculate the discounted price of an item.", + "example": "IF(ORDER_AMOUNT > 300;ORDER_ITEM_PRICE * 0.8;ORDER_ITEM_PRICE)" }, - "product": { - "type": "object", - "description": "This object stores more information about the related product.", - "properties": { - "id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" - }, - "name": { - "type": "string", - "example": "Brewing System", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Defines how the discount is applied to the customer's order." + } + } + }, + "6_res_product_excluded": { + "title": "Product", + "type": "object", + "description": "Contains definition for a product.", + "properties": { + "object": { + "type": "string", + "default": "product", + "description": "This product stores information about the product." }, - "sku": { - "type": "object", - "description": "This object stores more information about the related SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." - }, - "sku": { - "type": "string", - "description": "SKU name." - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } + "id": { + "type": "string", + "description": "Unique product ID assigned by Voucherify.", + "example": "prod_0bae2dc5a090fd0184" + }, + "source_id": { + "type": "string", + "description": "The product ID from your inventory system." + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY" + ], + "description": "Defines how the discount is applied to the customer's order." } } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "customer": { - "type": "object", - "description": "Object containing information about the customer that is making the purchase.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique customer ID of the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `customer` object." - } - } - }, - "referrer": { - "type": "object", - "description": "Object containing information about the referrer.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique referrer ID, who referred the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `referrer` object." - } - } - }, - "customer_id": { - "type": "string", - "description": "Unique customer ID of the customer making the purchase.", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" - }, - "referrer_id": { - "type": "string", - "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "description": "Unique referrer ID." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - }, - "redemptions": { - "description": "Lists details related to the redemption and redemption rollback.", - "properties": { - "redemption_ID": { - "type": "object", - "description": "The property name is the unique redemption ID; i.e. `r_0ba186c4824e4881e1`. This object contains information about the redemption of an incentive.", - "properties": { - "date": { - "type": "string", - "description": "Timestamp representing the date and time when the redemption was created in ISO 8601 format.", - "example": "2022-09-02T17:06:56.649Z", - "format": "date-time" - }, - "rollback_id": { - "type": "string", - "description": "Unique ID of the redemption rollback.", - "example": "rr_0c63c84eb78ee0a6c0" - }, - "rollback_date": { - "type": "string", - "description": "Timestamp representing the date and tiem when the redemption rollback was created in ISO 8601 format.", - "example": "2023-01-31T14:18:37.150Z", - "format": "date-time" - }, - "related_object_type": { - "type": "string", - "description": "The source of the incentive.", - "enum": [ - "voucher", - "promotion_tier" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique ID of the related object that defines the incentive." - }, - "related_object_parent_id": { - "type": "string", - "description": "Represent's the campaign ID of the voucher if the redemption was based on a voucher that was part of bulk codes generated within a campaign." - } + }, + "6_obj_order_object": { + "title": "Order object", + "description": "This is an object representing an order with calculated discounts applied using the voucher code.", + "oneOf": [ + { + "$ref": "#/components/schemas/6_obj_order_object_apply_to_order" + }, + { + "$ref": "#/components/schemas/6_obj_order_object_apply_to_items" } - } - } - } - } - }, - "7_obj_order_object": { - "title": "Order object", - "description": "This is an object representing an order with calculated discounts applied using the voucher code.", - "oneOf": [ - { - "$ref": "#/components/schemas/7_obj_order_object_apply_to_order" - }, - { - "$ref": "#/components/schemas/7_obj_order_object_apply_to_items" - } - ] - }, - "7_obj_order_object_apply_to_order": { - "type": "object", - "title": "Order object - Effect: Apply to order", - "description": "This is an object representing an order with calculated discounts applied using the voucher code.", - "properties": { - "id": { - "type": "string", - "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", - "description": "Unique order ID, assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:40:48.705Z", - "description": "Timestamp representing the date and time when the order was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:47:20.760Z", - "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format." - }, - "status": { - "type": "string", - "description": "Order status.", - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULFILLED" - ] - }, - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "discount_amount": { - "type": "integer", - "description": "Sum of all order-level discounts applied to the order." - }, - "total_discount_amount": { - "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`" - }, - "total_amount": { - "type": "integer", - "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" - }, - "applied_discount_amount": { - "type": "integer", - "description": "This field shows the order-level discount applied." - }, - "total_applied_discount_amount": { - "type": "integer", - "description": "This field sums up all order-level and all product-specific discounts applied in a particular request." - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", - "items": { + ] + }, + "6_obj_order_object_apply_to_order": { "type": "object", + "title": "Order object - Effect: Apply to order", + "description": "This is an object representing an order with calculated discounts applied using the voucher code.", "properties": { - "object": { + "id": { "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." + "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", + "description": "Unique order ID, assigned by Voucherify. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." }, - "product_id": { + "source_id": { "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." }, - "sku_id": { + "created_at": { "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + "format": "date-time", + "example": "2022-10-06T11:40:48.705Z", + "description": "Timestamp representing the date and time when the order was created in ISO 8601 format. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:47:20.760Z", + "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." + }, + "status": { + "type": "string", + "description": "Order status. This parameter is returned if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body or if you send the request body parameter when defining an order in the request body. This parameter can be passed but it's not required for validation at all. It's used in the redemption process. Normally after the redemption is done, the order is automatically to a `PAID` status. To avoid such default behaviour, the user can pass any of the other status options and it will be set the order status after the redemption instead of the default `PAID`.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULFILLED" + ] }, "amount": { "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + "description": "Order amount before applying any discount." }, - "price": { + "discount_amount": { "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "description": "Sum of all order-level discounts applied to the order." }, - "subtotal_amount": { + "total_discount_amount": { "type": "integer", - "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" + "description": "Sum of all order-level discounts." }, - "product": { + "total_amount": { + "type": "integer", + "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" + }, + "applied_discount_amount": { + "type": "integer", + "description": "This field shows the order-level discount applied." + }, + "total_applied_discount_amount": { + "type": "integer", + "description": "This field sums up all order-level discounts applied to the order." + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", + "items": { + "type": "object", + "properties": { + "object": { + "type": "string", + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." + }, + "product_id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "sku_id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" + }, + "product": { + "type": "object", + "description": "This object stores more information about the related product.", + "properties": { + "id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" + }, + "name": { + "type": "string", + "example": "Brewing System", + "description": "Product name." + }, + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + }, + "sku": { + "type": "object", + "description": "This object stores more information about the related SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." + }, + "sku": { + "type": "string", + "description": "SKU name." + }, + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + } + } + } + }, + "metadata": { "type": "object", - "description": "This object stores more information about the related product.", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "customer": { + "type": "object", + "description": "Object containing information about the customer that is making the purchase.", "properties": { "id": { "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique customer ID of the customer making the purchase." }, - "name": { + "object": { "type": "string", - "example": "Brewing System", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "default": "customer", + "description": "Type of object represented by the `customer` object." } } }, - "sku": { + "referrer": { "type": "object", - "description": "This object stores more information about the related SKU.", + "description": "Object containing information about the referrer.", "properties": { "id": { "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique referrer ID, who referred the customer making the purchase." }, - "sku": { + "object": { "type": "string", - "description": "SKU name." - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "default": "customer", + "description": "Type of object represented by the `referrer` object." } } + }, + "customer_id": { + "type": "string", + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" + }, + "referrer_id": { + "type": "string", + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." } } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "customer": { - "type": "object", - "description": "Object containing information about the customer that is making the purchase.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique customer ID of the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `customer` object." - } - } - }, - "referrer": { - "type": "object", - "description": "Object containing information about the referrer.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique referrer ID, who referred the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `referrer` object." - } - } - }, - "customer_id": { - "type": "string", - "description": "Unique customer ID of the customer making the purchase.", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" - }, - "referrer_id": { - "type": "string", - "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "description": "Unique referrer ID." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - }, - "redemptions": { - "description": "Lists details related to the redemption.", - "$ref": "#/components/schemas/10_obj_order_object_unstacked_redemptions" - } - } - }, - "7_obj_order_object_apply_to_items": { - "type": "object", - "title": "Order object - Effect: Apply to items", - "description": "This is an object representing an order with calculated discounts applied using the voucher code.", - "properties": { - "id": { - "type": "string", - "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", - "description": "Unique order ID, assigned by Voucherify. " - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:40:48.705Z", - "description": "Timestamp representing the date and time when the order was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:47:20.760Z", - "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format." - }, - "status": { - "type": "string", - "description": "Order status.", - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULFILLED" - ] - }, - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "items_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" - }, - "total_discount_amount": { - "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied to the order." - }, - "total_amount": { - "type": "integer", - "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" - }, - "items_applied_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied." - }, - "total_applied_discount_amount": { - "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied to the order." - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", - "items": { + }, + "6_obj_order_object_apply_to_items": { "type": "object", + "title": "Order object - Effect: Apply to items", + "description": "This is an object representing an order with calculated discounts applied using the voucher code.", "properties": { - "object": { + "id": { "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." + "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", + "description": "Unique order ID, assigned by Voucherify. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." }, - "product_id": { + "source_id": { "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." }, - "sku_id": { + "created_at": { "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + "format": "date-time", + "example": "2022-10-06T11:40:48.705Z", + "description": "Timestamp representing the date and time when the order was created in ISO 8601 format. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:47:20.760Z", + "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." + }, + "status": { + "type": "string", + "description": "Order status. This parameter is returned if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body or if you send the request body parameter when defining an order in the request body. This parameter can be passed but it's not required for validation at all. It's used in the redemption process. Normally after the redemption is done, the order is automatically to a `PAID` status. To avoid such default behaviour, the user can pass any of the other status options and it will be set the order status after the redemption instead of the default `PAID`.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULFILLED" + ] }, "amount": { "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + "description": "Order amount before applying any discount." }, - "discount_amount": { + "items_discount_amount": { "type": "integer", - "description": "The item-level discount applied to the item." + "description": "Sum of all product-specific discounts applied. \n`sum(items, i => i.discount_amount)`" }, - "applied_discount_amount": { + "total_discount_amount": { "type": "integer", - "description": "The item-level discount applied to the item." + "description": "Sum of all product-specific discounts applied." }, - "price": { + "total_amount": { "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" }, - "subtotal_amount": { + "items_applied_discount_amount": { "type": "integer", - "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" + "description": "Product-specifc discounts applied to all the items." }, - "product": { + "total_applied_discount_amount": { + "type": "integer", + "description": "Product-specific discounts applied in the order." + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", + "items": { + "type": "object", + "properties": { + "object": { + "type": "string", + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." + }, + "product_id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "sku_id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + }, + "discount_amount": { + "type": "integer", + "description": "The item-level discount applied to the item." + }, + "applied_discount_amount": { + "type": "integer", + "description": "The item-level discount applied to the item." + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" + }, + "product": { + "type": "object", + "description": "This object stores more information about the related product.", + "properties": { + "id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" + }, + "name": { + "type": "string", + "example": "Brewing System", + "description": "Product name." + }, + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + }, + "sku": { + "type": "object", + "description": "This object stores more information about the related SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." + }, + "sku": { + "type": "string", + "description": "SKU name." + }, + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + } + } + } + }, + "metadata": { "type": "object", - "description": "This object stores more information about the related product.", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "customer": { + "type": "object", + "description": "Object containing information about the customer that is making the purchase.", "properties": { "id": { "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique customer ID of the customer making the purchase." }, - "name": { + "object": { "type": "string", - "example": "Brewing System", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "default": "customer", + "description": "Type of object represented by the `customer` object." } } }, - "sku": { + "referrer": { "type": "object", - "description": "This object stores more information about the related SKU.", + "description": "Object containing information about the referrer.", "properties": { "id": { "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique referrer ID, who referred the customer making the purchase." }, - "sku": { + "object": { "type": "string", - "description": "SKU name." - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "default": "customer", + "description": "Type of object represented by the `referrer` object." } } + }, + "customer_id": { + "type": "string", + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" + }, + "referrer_id": { + "type": "string", + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." } } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "customer": { - "type": "object", - "description": "Object containing information about the customer that is making the purchase.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique customer ID of the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `customer` object." - } - } - }, - "referrer": { - "type": "object", - "description": "Object containing information about the referrer.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique referrer ID, who referred the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `referrer` object." - } - } - }, - "customer_id": { - "type": "string", - "description": "Unique customer ID of the customer making the purchase.", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" - }, - "referrer_id": { - "type": "string", - "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "description": "Unique referrer ID." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - }, - "redemptions": { - "description": "Lists details related to the redemption.", - "$ref": "#/components/schemas/10_obj_order_object_unstacked_redemptions" - } - } - }, - "7_obj_order_object_stacked_redemptions": { - "type": "object", - "title": "Order", - "description": "This is an object representing an order with calculated discounts applied using the voucher code.", - "properties": { - "id": { - "type": "string", - "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", - "description": "Unique order ID, assigned by Voucherify. " - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:40:48.705Z", - "description": "Timestamp representing the date and time when the order was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:47:20.760Z", - "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format." - }, - "status": { - "type": "string", - "description": "Order status.", - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULFILLED" - ] - }, - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "discount_amount": { - "type": "integer", - "description": "Sum of all order-level discounts applied to the order." - }, - "items_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" - }, - "total_discount_amount": { - "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`" - }, - "total_amount": { - "type": "integer", - "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" - }, - "applied_discount_amount": { - "type": "integer", - "description": "This field shows the sum of all order-level discounts applied." - }, - "items_applied_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied.\n`sum(items, i => i.applied_discount_amount)`" - }, - "total_applied_discount_amount": { - "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied to the order.\n`total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount`" - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", - "items": { + }, + "6_query_validate_voucher_client_side_orders_order_item": { "type": "object", + "title": "Order Item", + "description": "This object represents an order line item.", "properties": { - "object": { + "source_id": { "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." + "description": "The merchant’s product/SKU ID (if it is different from the Voucherify product/SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service." + }, + "related_object": { + "type": "string", + "description": "Used along with the `source_id` property, can be set to either `sku` or `product`." }, "product_id": { "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." + "description": "A unique product ID assigned by Voucherify.", + "example": "prod_0a7e62db1fca8322a2" }, "sku_id": { "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + "description": "A unique SKU ID assigned by Voucherify.", + "example": "sku_0a41e31c7b41c28358" }, "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." + "type": "string", + "description": "The quantity of the particular item in the cart." + }, + "price": { + "type": "string", + "description": "The unit price of the item." }, "amount": { + "type": "string", + "description": "The total amount of the order item (`price` * `quantity`)." + } + } + }, + "6_req_validate_promotion": { + "title": "Validate Promotion Request Body", + "type": "object", + "description": "Request schema model for validating a promotion using **POST** `/promotions/validation`.", + "properties": { + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" + } + ], + "description": "Order information." + }, + "metadata": { + "type": "object", + "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "options": { + "type": "object", + "description": "Configure parameters returned in the response.", + "properties": { + "expand": { + "type": "array", + "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. Add `category` as a string in the array to include a `categories` object in the response.", + "items": { + "type": "string", + "enum": [ + "category" + ], + "example": "category" + } + } + } + } + } + }, + "6_res_validate_promotion": { + "title": "Validate Promotion Response Body", + "type": "object", + "description": "Response schema model for validating a promotion using **POST** `/promotions/validation`.", + "properties": { + "valid": { + "type": "boolean", + "description": "Indicates whether the promotion is valid within the context of the parameters provided in the request body and filters in the query parameters." + }, + "tracking_id": { + "type": "string", + "description": "Hashed customer source ID." + }, + "promotions": { + "type": "array", + "description": "Contains an array of promotion tier objects.", + "items": { + "$ref": "#/components/schemas/6_res_validate_promotion_object" + } + } + } + }, + "6_res_validate_promotion_object": { + "title": "Validate Promotion", + "type": "object", + "description": "Validate Promotion", + "properties": { + "valid": { + "type": "string", + "description": "Indicates whether the promotion is valid within the context of the parameters provided in the request body and filters in the query parameters." + }, + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" + }, + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" + }, + "tracking_id": { + "type": "string", + "description": "Hashed customer source ID." + }, + "order": { + "$ref": "#/components/schemas/6_obj_order_object" + }, + "id": { + "type": "string", + "example": "promo_4TqHr24boFISDrcOHSlfAxwm", + "description": "Unique promotion tier ID." + }, + "name": { + "type": "string", + "description": "Custom promotion tier name." + }, + "banner": { + "type": "string", + "description": "Text to be displayed to your customers on your website.", + "example": "Get 45% off items" + }, + "discount": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_amount" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_percent" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_fixed" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_shipping" + } + ], + "description": "Contains information about the discount to be applied to the order." + }, + "start_date": { + "type": "string", + "format": "date-time", + "example": "2022-11-02T00:00:00.000Z", + "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Campaign is *inactive* before this date." + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-11-04T00:00:00.000Z", + "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive* after this date." + }, + "campaign": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "camp_h8RyP6FV94F3Ev2odP24j5p1", + "description": "Unique promotion tier ID." + }, + "start_date": { + "type": "string", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive* before this date.", + "example": "2022-11-01T00:00:00.000Z", + "format": "date-time" + }, + "expiration_date": { + "type": "string", + "description": "Activation timestamp defines when the campaign expires in ISO 8601 format. Promotion tier is *inactive* after this date.", + "example": "2022-11-30T00:00:00.000Z", + "format": "date-time" + }, + "active": { + "type": "boolean", + "description": "A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" + }, + "object": { + "type": "string", + "default": "campaign", + "description": "The type of object represented by the campaign object. This object stores information about the campaign." + } + } + }, + "hierarchy": { "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + "description": "The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy." }, "discount_amount": { "type": "integer", - "description": "The item-level discount applied to the item." + "description": "The calculated discount amount based on the discount type and effect." }, "applied_discount_amount": { "type": "integer", - "description": "The item-level discount applied to the item." + "description": "The effective discount amount that would be applied to the order." }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" + "object": { + "type": "string", + "default": "promotion_tier", + "description": "The type of object represented by JSON. This object stores information about the promotion tier." }, - "product": { + "category_id": { + "type": "string", + "description": "Promotion tier category ID.", + "example": "cat_0c9da30e7116ba6bba" + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object", + "description": "Details about the category assigned to the promotion tier." + } + } + }, + "6_req_validate_promotion_tier": { + "title": "Validate Promotion Tier Request Body", + "type": "object", + "description": "Request schema model for validating a promotion using **POST** `/promotions/tiers/{tierId}/validation`.", + "properties": { + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" + } + ], + "description": "Order information." + }, + "metadata": { + "type": "object", + "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + } + } + }, + "6_res_validate_promotion_tier": { + "title": "Validate Promotion Tier Response Body", + "description": "Response schema model for validating a promotion using **POST** `/promotions/tiers/{tierId}/validation`.", + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_promotion_tier_true" + }, + { + "$ref": "#/components/schemas/6_res_validate_promotion_tier_false" + } + ] + }, + "6_res_validate_promotion_tier_true": { + "title": "Promotion Tier Valid", + "type": "object", + "description": "Response schema model for valid promotion tier when validating a promotion using **POST** `/promotions/tiers/{tierId}/validation`.", + "properties": { + "valid": { + "type": "string", + "description": "Indicates whether the promotion is valid within the context of the parameters provided in the request body and filters in the query parameters." + }, + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" + }, + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" + }, + "tracking_id": { + "type": "string", + "description": "Hashed customer source ID." + }, + "order": { + "$ref": "#/components/schemas/6_obj_order_object" + }, + "id": { + "type": "string", + "example": "promo_4TqHr24boFISDrcOHSlfAxwm", + "description": "Unique promotion tier ID." + }, + "name": { + "type": "string", + "description": "Custom promotion tier name." + }, + "banner": { + "type": "string", + "description": "Text to be displayed to your customers on your website.", + "example": "Get 45% off items" + }, + "discount": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_amount" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_percent" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_fixed" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_shipping" + } + ], + "description": "Contains information about the discount to be applied to the order." + }, + "start_date": { + "type": "string", + "format": "date-time", + "example": "2022-11-02T00:00:00.000Z", + "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Campaign is *inactive* before this date." + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-11-04T00:00:00.000Z", + "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive* after this date." + }, + "campaign": { "type": "object", - "description": "This object stores more information about the related product.", "properties": { "id": { "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." + "example": "camp_h8RyP6FV94F3Ev2odP24j5p1", + "description": "Unique promotion tier ID." }, - "source_id": { + "start_date": { "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive* before this date.", + "example": "2022-11-01T00:00:00.000Z", + "format": "date-time" }, - "name": { + "expiration_date": { "type": "string", - "example": "Brewing System", - "description": "Product name." + "description": "Activation timestamp defines when the campaign expires in ISO 8601 format. Promotion tier is *inactive* after this date.", + "example": "2022-11-30T00:00:00.000Z", + "format": "date-time" }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "active": { + "type": "boolean", + "description": "A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" + }, + "object": { + "type": "string", + "default": "campaign", + "description": "The type of object represented by the campaign object. This object stores information about the campaign." } } }, - "sku": { + "hierarchy": { + "type": "integer", + "description": "The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy." + }, + "discount_amount": { + "type": "integer", + "description": "The calculated discount amount based on the discount type and effect." + }, + "applied_discount_amount": { + "type": "integer", + "description": "The effective discount amount that would be applied to the order." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." + }, + "object": { + "type": "string", + "default": "promotion_tier", + "description": "The type of object represented by JSON. This object stores information about the promotion tier." + } + } + }, + "6_res_validate_promotion_tier_false": { + "type": "object", + "description": "Response schema model for a non-valid promotion tier when validating a promotion using **POST** `/promotions/tiers/{tierId}/validation`.", + "title": "Promotion Tier Not Valid", + "properties": { + "valid": { + "type": "boolean", + "description": "Response schema for a voucher that is not valid." + }, + "reason": { + "type": "string", + "description": "System generated cause for the voucher being invalid in the context of the provided parameters." + }, + "error": { + "description": "Detailed failure cause for the invalid voucher if the reason has a translation defined in the Dashboard → Project Settings → Error Messages.", + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_promotion_tier_false_custom_message" + }, + { + "$ref": "#/components/schemas/e_error_no_translation" + } + ] + }, + "tracking_id": { + "type": "string", + "description": "Hashed customer source ID." + }, + "id": { + "type": "string", + "example": "promo_ByIIAHC1Mz9ouJsitzAWsush", + "description": "Promotion tier ID." + }, + "name": { + "type": "string", + "description": "Custom promotion tier name." + }, + "banner": { + "type": "string", + "description": "Text to be displayed to your customers on your website.", + "example": "Get 25% off" + }, + "discount": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_amount" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_percent" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_fixed" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_shipping" + } + ], + "description": "Contains information about the discount to be applied to the order." + }, + "start_date": { + "type": "string", + "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Campaign is *inactive* before this date.", + "format": "date-time", + "example": "2022-11-02T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive* after this date.", + "format": "date-time", + "example": "2022-11-04T00:00:00.000Z" + }, + "campaign": { "type": "object", - "description": "This object stores more information about the related SKU.", "properties": { "id": { "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + "description": "Unique promotion tier ID." }, - "source_id": { + "start_date": { "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive* before this date.", + "format": "date-time", + "example": "2022-11-01T00:00:00.000Z" }, - "sku": { + "expiration_date": { "type": "string", - "description": "SKU name." + "format": "date-time", + "description": "Activation timestamp defines when the campaign expires in ISO 8601 format. Promotion tier is *inactive* after this date.", + "example": "2022-11-30T00:00:00.000Z" }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "active": { + "type": "boolean", + "description": "A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" + }, + "object": { + "type": "string", + "description": "The type of object represented by the campaign object. This object stores information about the campaign.", + "default": "campaign" } } + }, + "hierarchy": { + "type": "integer", + "description": "The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." + }, + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about the promotion tier.", + "default": "promotion_tier" } } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "customer": { - "type": "object", - "description": "Object containing information about the customer that is making the purchase.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique customer ID of the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `customer` object." - } - } - }, - "referrer": { - "type": "object", - "description": "Object containing information about the referrer.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique referrer ID, who referred the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `referrer` object." + }, + "6_res_validate_promotion_tier_false_custom_message": { + "type": "object", + "description": "Custom Error Message", + "title": "Custom Message", + "properties": { + "message": { + "type": "string", + "description": "Customized error message." + } } - } - }, - "customer_id": { - "type": "string", - "description": "Unique customer ID of the customer making the purchase.", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" - }, - "referrer_id": { - "type": "string", - "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "description": "Unique referrer ID." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - }, - "redemptions": { - "description": "Lists details related to the redemption", - "$ref": "#/components/schemas/10_obj_order_object_stacked_redemptions" - } - } - }, - "7_obj_redemption_object": { - "title": "Redemption Object", - "description": "This is an object representing a redemption. \n\nRedemption 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 an operation a [redemption rollback](ref:rollback-redemption).", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_discount_voucher" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_gift_card" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_promotion_tier" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_stackable_discounts" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_voucher_fail" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_promotion_tier_fail" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_fail" - } - ] - }, - "7_obj_redemption_object_voucher": { - "title": "Redemption Object", - "description": "This is an object representing an attempted or successful voucher redemption.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_discount_voucher" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_gift_card" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_voucher_fail" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_rollback_object_discount_voucher" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_rollback_object_gift_card" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_rollback_object_loyalty_card" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_rollback_object_voucher_fail" - } - ] - }, - "7_obj_redemption_object_voucher_extended": { - "title": "Redemption Object", - "description": "This is an object representing an attempted or successful voucher redemption.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_discount_voucher_extended" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_extended" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_gift_card_extended" - } - ] - }, - "7_obj_redemption_object_discount_voucher_extended": { - "type": "object", - "title": "Discount Voucher", - "description": "This is an object representing a redemption. \n\nRedemption 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](rollback-redemption).", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] + }, + "19_req_session_lock": { + "title": "Session Lock", + "type": "object", + "description": "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](doc:locking-validation-session).", + "properties": { + "type": { + "type": "string", + "description": "This parameter is **required** to establish a new session. The session locks the redemption **quantity** by 1 and the redemption **gift credits** and **loyalty points** specified within the request.", + "enum": [ + "LOCK" + ] + }, + "key": { + "type": "string", + "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", + "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" + }, + "ttl_unit": { + "type": "string", + "description": "Defines the type of unit in which the session time is counted.", + "enum": [ + "HOURS", + "DAYS", + "MINUTES", + "SECONDS", + "MILLISECONDS", + "MICROSECONDS", + "NANOSECONDS" + ] + }, + "ttl": { + "type": "integer", + "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." + } } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" + }, + "19_res_session_lock": { + "title": "Session Lock", + "type": "object", + "description": "Schema model for `session` lock object. The session object contains information about the session key that was used to establish a session between multiple parallel validation and redemption requests.", + "properties": { + "type": { + "type": "string", + "description": "This session locks the redemption **quantity** by 1.", + "default": "LOCK" + }, + "key": { + "type": "string", + "description": "The session unique ID assigned by Voucherify or your own unique session ID.", + "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" + }, + "ttl_unit": { + "type": "string", + "description": "Defines the type of unit in which the session time is counted.", + "enum": [ + "HOURS", + "DAYS", + "MINUTES", + "SECONDS", + "MILLISECONDS", + "MICROSECONDS", + "NANOSECONDS" + ] + }, + "ttl": { + "type": "integer", + "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." + } } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Defines the details of the voucher being redeemed." - } - } - }, - "7_obj_redemption_object_discount_voucher_extended_stacked": { - "type": "object", - "title": "Discount Voucher", - "description": "This is an object representing a redemption.", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the parent redemption.", - "example": "r_0c656311b5878a2031" - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] + }, + "19_obj_order_object_rollback_stacked": { + "title": "Order object", + "description": "This is an object representing an order that was rolled back for a stacked redemption.", + "properties": { + "id": { + "type": "string", + "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", + "description": "Unique order ID, assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:40:48.705Z", + "description": "Timestamp representing the date and time when the order was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:47:20.760Z", + "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format." + }, + "status": { + "type": "string", + "description": "Order status.", + "enum": [ + "CANCELED" + ] + }, + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "total_amount": { + "type": "integer", + "description": "Order amount after undoing all the discounts through the rollback redemption." + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order.", + "items": { + "type": "object", + "properties": { + "object": { + "type": "string", + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." + }, + "product_id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "sku_id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the removing an item-level discount." + }, + "product": { + "type": "object", + "description": "This object stores more information about the related product.", + "properties": { + "id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" + }, + "name": { + "type": "string", + "example": "Brewing System", + "description": "Product name." + }, + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + }, + "sku": { + "type": "object", + "description": "This object stores more information about the related SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." + }, + "sku": { + "type": "string", + "description": "SKU name." + }, + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + } + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "customer": { + "type": "object", + "description": "Object containing information about the customer that is making the purchase.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique customer ID of the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `customer` object." + } + } + }, + "referrer": { + "type": "object", + "description": "Object containing information about the referrer.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique referrer ID, who referred the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `referrer` object." + } + } + }, + "customer_id": { + "type": "string", + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" + }, + "referrer_id": { + "type": "string", + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + }, + "redemptions": { + "description": "Lists details related to the redemption and redemption rollback.", + "properties": { + "redemption_ID": { + "type": "object", + "description": "The property name is the unique redemption ID; i.e. `r_0ba186c4824e4881e1`. This object contains information about the redemption rollback of incentives.", + "properties": { + "date": { + "type": "string", + "description": "Timestamp representing the date and time when the redemption was created in ISO 8601 format.", + "example": "2022-09-02T17:06:56.649Z", + "format": "date-time" + }, + "rollback_id": { + "type": "string", + "description": "Unique ID of the redemption rollback.", + "example": "rr_0c63c84eb78ee0a6c0" + }, + "rollback_date": { + "type": "string", + "description": "Timestamp representing the date and tiem when the redemption rollback was created in ISO 8601 format.", + "example": "2023-01-31T14:18:37.150Z", + "format": "date-time" + }, + "related_object_type": { + "type": "string", + "description": "The source of the redemption is a `redemption` because this rollback is in the context of a stacked redemption.", + "enum": [ + "redemption" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique ID of the parent redemption.", + "example": "r_0ba186c4824e4881e1" + }, + "stacked": { + "type": "array", + "description": "Lists the stacked redemption IDs in the initial redemption request.", + "items": { + "type": "string" + } + }, + "rollback_stacked": { + "type": "array", + "description": "Lists the rollback redemption IDs of the particular child redemptions.", + "items": { + "type": "string" + } + } + } + } + } + } } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" + }, + "19_obj_order_object_rollback_stacked_per_redemption_apply_to_order": { + "title": "Order object", + "description": "This is an object representing an order that was rolled back for a stacked redemption.", + "properties": { + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "total_amount": { + "type": "integer", + "description": "Order amount after undoing all the discounts through the rollback redemption." + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order.", + "items": { + "type": "object", + "properties": { + "object": { + "type": "string", + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." + }, + "product_id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "sku_id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + } } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Defines the details of the voucher being redeemed." - } - } - }, - "7_obj_redemption_object_loyalty_card_extended": { - "type": "object", - "title": "Loyalty Card Voucher", - "description": "This is an object representing a redemption. \n\nRedemption 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](rollback-redemption).", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the redemption.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "amount": { - "type": "integer", - "description": "Number of points being redeemed for a reward." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] + }, + "19_obj_order_object_rollback_stacked_per_redemption_apply_to_items": { + "title": "Order object", + "description": "This is an object representing an order that was rolled back for a stacked redemption.", + "properties": { + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "items_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied to the order.`" + }, + "total_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied to the order." + }, + "total_amount": { + "type": "integer", + "description": "Order amount after undoing all the discounts through the rollback redemption." + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order.", + "items": { + "type": "object", + "properties": { + "object": { + "type": "string", + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." + }, + "product_id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "sku_id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the removing an item-level discount." + } + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + } } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the reward.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "19_req_redeemables_gift_card": { + "title": "Gift Card", + "type": "object", + "description": "Redeem a gift card.", + "properties": { + "id": { + "type": "string", + "description": "Unique gift card code." + }, + "object": { + "type": "string", + "description": "Type of object, i.e. `voucher`.", + "default": "voucher" + }, + "gift": { + "type": "object", + "description": "Contains information on the number of gift card credits that the customer wants to apply to the order.", + "properties": { + "credits": { + "type": "integer", + "description": "The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + } }, - "name": { - "type": "string", - "description": "Customer's first and last name." + "required": [ + "object", + "id" + ] + }, + "19_req_redeemables_loyalty_card": { + "title": "Loyalty Card", + "type": "object", + "description": "Redeem a loyalty card.", + "properties": { + "id": { + "type": "string", + "description": "Unique loyalty card code." + }, + "object": { + "type": "string", + "description": "Type of object, i.e. `voucher`.", + "default": "voucher" + }, + "reward": { + "type": "object", + "description": "Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward.", + "example": "rew_EPx1hCTpqzF0HW1z9NKckZH4" + }, + "points": { + "type": "integer", + "description": "The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card." + } + } + } }, - "email": { - "type": "string", - "description": "Customer's email address." + "required": [ + "object", + "id", + "reward" + ] + }, + "19_req_redeemables_discount_referral_promotion_tier_promotion_stack": { + "title": "Discount code, referral code, promotion tier, promotion stack", + "type": "object", + "description": "Redeem a discount code, referral code, promotion tier, or promotion stack.", + "properties": { + "object": { + "type": "string", + "description": "Redeemable object type.", + "enum": [ + "voucher", + "promotion_tier", + "promotion_stack" + ], + "default": "voucher" + }, + "id": { + "type": "string", + "description": "Redeemable code or unique ID such as: \n- discount code, referral code: `DiscountCode100`, `v_6ZPI2BLMtpc6zz8pQVjQgxJH3D4ac3ZT` \n- promotion tier: `promo_Mwy9XpA0TLctSGriM5kum0qp` \n- promotion stack: `stack_KxSD0GahLUg9ULB6TseGfUHJ` " + } }, - "source_id": { - "type": "string", - "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + "required": [ + "object", + "id" + ] + }, + "19_req_redemptions": { + "title": "Redeem Stackable Discounts Request Body", + "type": "object", + "description": "This data model represents the request body for redeeming multiple incentives.", + "properties": { + "options": { + "type": "object", + "description": "Configure parameters returned in the response.", + "properties": { + "expand": { + "type": "array", + "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. \n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redemption object.
- Metadata not included for each discount type. |\n| [\"order\", \"redemption\"] | - Returns redemption object `metadata`.
- Order data with calculated discounts are listed in each child redemption object. |\n| [\"redeemable\", \"redemption\"] | - Returns each discount type's `metadata` in each child redemption object.
- Returns redemption object `metadata`. |\n| [\"redemption\"] | - Returns redemption object `metadata`. |\n| [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object
- Returns redemption object `metadata`.
- Returns an expanded `categories` object, showing details about the category. |", + "items": { + "type": "string", + "enum": [ + "order", + "redemption", + "redeemable", + "category" + ] + } + } + } + }, + "redeemables": { + "type": "array", + "minItems": 1, + "maxItems": 5, + "description": "An array of redeemables. You can combine `voucher`(s) and `promotion_tier`(s). Alternatively, send one unique`promotion_stack` in the array.", + "items": { + "anyOf": [ + { + "$ref": "#/components/schemas/19_req_redeemables_discount_referral_promotion_tier_promotion_stack" + }, + { + "$ref": "#/components/schemas/19_req_redeemables_gift_card" + }, + { + "$ref": "#/components/schemas/19_req_redeemables_loyalty_card" + } + ] + } + }, + "session": { + "$ref": "#/components/schemas/19_req_session_lock" + }, + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" + } + ], + "description": "Order information. This object enables you to pass purchase transaction data. Read what properties you can use in the [Order object](ref:get-order)." + }, + "metadata": { + "type": "object", + "description": "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": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + "required": [ + "redeemables" + ] + }, + "19_req_validations": { + "title": "Validate Stackable Discounts Request Body", + "type": "object", + "description": "This data model represents the request body for the `/validations` endpoint.", + "properties": { + "options": { + "type": "object", + "description": "Configure parameters returned in the response.", + "properties": { + "expand": { + "type": "array", + "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. \n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redeemable object.
- Metadata not included for each discount type. |\n| [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. |\n| [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
- Includes `metadata` for each discount type. |\n| [\"category\"] | - Returns an expanded `categories` object, showing details about the category. |", + "items": { + "type": "string", + "enum": [ + "order", + "redemption", + "redeemable", + "category" + ] + } + } + } + }, + "redeemables": { + "type": "array", + "minItems": 1, + "maxItems": 5, + "description": "An array of redeemables. You can combine `voucher`(s) and `promotion_tier`(s). Alternatively, send one unique`promotion_stack` in the array.", + "items": { + "anyOf": [ + { + "$ref": "#/components/schemas/19_req_redeemables_discount_referral_promotion_tier_promotion_stack" + }, + { + "$ref": "#/components/schemas/19_req_redeemables_gift_card" + }, + { + "$ref": "#/components/schemas/19_req_redeemables_loyalty_card" + } + ] + } + }, + "session": { + "$ref": "#/components/schemas/19_req_session_lock" + }, + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" + } + ], + "description": "Order information. This object enables you to pass purchase transaction data. Read what properties you can use in the [Order object](ref:get-order)." + }, + "metadata": { + "type": "object", + "description": "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." + } }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" + "required": [ + "redeemables" + ] + }, + "19_res_validations": { + "title": "Validate Stackable Discounts Response Body", + "description": "Response body schema for POST `/validations`.", + "oneOf": [ + { + "$ref": "#/components/schemas/19_res_validations-true" + }, + { + "$ref": "#/components/schemas/19_res_validations-false" + } + ] + }, + "19_res_validations-false": { + "type": "object", + "title": "False", + "description": "Response body schema for POST `/validations`.", + "properties": { + "valid": { + "type": "boolean", + "description": "The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable.", + "default": false + }, + "redeemables": { + "type": "array", + "description": "Lists validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"`.", + "items": { + "type": "object", + "properties": { + "status": { + "type": "string", + "enum": [ + "APPLICABLE", + "INAPPLICABLE", + "SKIPPED" + ], + "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules. `SKIPPED` indicates that the validation stopped once it identified at least one unapplicable redeemable and did not continue to validate the given redeemable." + }, + "id": { + "type": "string", + "description": "Redeemable ID, i.e. the voucher code." + }, + "object": { + "type": "string", + "description": "Redeemable's object type.", + "enum": [ + "voucher", + "promotion_tier", + "promotion_stack" + ] + }, + "result": { + "type": "object", + "description": "Provides details for an inapplicable redeemable.", + "properties": { + "error": { + "$ref": "#/components/schemas/e_error" + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" + } + } + } + }, + "tracking_id": { + "type": "string", + "example": "track_VAVo1/z+G2GI2LPw==", + "description": "Hashed customer source ID." + } } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object. i.e. `voucher`.", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Defines the details of the voucher being redeemed." - }, - "reward": { - "description": "Defines the reward being redeemed.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" + }, + "19_res_validations_redeemables_discount_voucher": { + "type": "object", + "description": "Response schema model for validating a discount code.", + "title": "Discount Voucher", + "properties": { + "status": { + "type": "string", + "enum": [ + "APPLICABLE" + ], + "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." + }, + "id": { + "type": "string", + "description": "Redeemable ID, i.e. the voucher code." + }, + "object": { + "type": "string", + "description": "Redeemable's object type.", + "enum": [ + "voucher" + ] + }, + "order": { + "$ref": "#/components/schemas/19_obj_order_object_validation_res_per_redeemable" + }, + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" + }, + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" + }, + "result": { + "description": "Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable.", + "$ref": "#/components/schemas/19_obj_validations-true_result_voucher_code" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" + } } - ] - }, - "loyalty_card": { - "type": "object", - "description": "Stores the number of points being subtracted from the loyalty card for the reward redemption.", - "properties": { - "points": { - "type": "integer", - "description": "Number of points being subtracted from the loyalty card for the reward redemption." + }, + "19_res_validations_redeemables_gift_card": { + "type": "object", + "description": "Response schema model for validating a gift card.", + "title": "Gift Card", + "properties": { + "status": { + "type": "string", + "enum": [ + "APPLICABLE" + ], + "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." + }, + "id": { + "type": "string", + "description": "Redeemable ID, i.e. the gift card code." + }, + "object": { + "type": "string", + "description": "Redeemable's object type.", + "enum": [ + "voucher" + ] + }, + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" + }, + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" + }, + "result": { + "description": "Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable.", + "$ref": "#/components/schemas/19_obj_validations-true_result_gift_card" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" + } } - } - } - } - }, - "7_obj_redemption_object_loyalty_card_extended_stacked": { - "type": "object", - "title": "Loyalty Card Voucher", - "description": "This is an object representing a redemption.", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the redemption.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "amount": { - "type": "integer", - "description": "Number of points being redeemed for a reward." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the parent redemption.", - "example": "r_0c656311b5878a2031" - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] + }, + "19_res_validations_redeemables_loyalty_card": { + "type": "object", + "description": "Response schema model for validating a loyalty card.", + "title": "Loyalty Card", + "properties": { + "status": { + "type": "string", + "enum": [ + "APPLICABLE" + ], + "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." + }, + "id": { + "type": "string", + "description": "Redeemable ID, i.e. the loyalty card code." + }, + "object": { + "type": "string", + "description": "Redeemable's object type.", + "enum": [ + "voucher" + ] + }, + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" + }, + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" + }, + "result": { + "description": "Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable.", + "$ref": "#/components/schemas/19_obj_validations-true_result_loyalty_card" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" + } } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the reward.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" + }, + "19_res_validations_redeemables_promotion_tier": { + "type": "object", + "description": "Response schema model for validating a promotion tier.", + "title": "Promotion Tier", + "properties": { + "status": { + "type": "string", + "enum": [ + "APPLICABLE" + ], + "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." + }, + "id": { + "type": "string", + "description": "Redeemable ID, i.e. the promotion tier ID." + }, + "object": { + "type": "string", + "description": "Redeemable's object type.", + "enum": [ + "promotion_tier" + ] + }, + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" + }, + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" + }, + "result": { + "description": "Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable.", + "$ref": "#/components/schemas/19_obj_validations-true_result_promotion_tier" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" + } } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object. i.e. `voucher`.", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Defines the details of the voucher being redeemed." - }, - "reward": { - "description": "Defines the reward being redeemed.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" + }, + "19_res_validations_redeemables_promotion_stack": { + "type": "object", + "description": "Response schema model for validating a promotion stack.", + "title": "Promotion Stack", + "properties": { + "status": { + "type": "string", + "enum": [ + "APPLICABLE" + ], + "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." + }, + "id": { + "type": "string", + "description": "Redeemable ID, i.e. the promotion stack ID." + }, + "object": { + "type": "string", + "description": "Redeemable's object type.", + "enum": [ + "promotion_stack" + ] + }, + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" + }, + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" + }, + "result": { + "description": "Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable.", + "$ref": "#/components/schemas/19_obj_validations-true_result_promotion_stack" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" + } } - ] - }, - "loyalty_card": { - "type": "object", - "description": "Stores the number of points being subtracted from the loyalty card for the reward redemption.", - "properties": { - "points": { - "type": "integer", - "description": "Number of points being subtracted from the loyalty card for the reward redemption." + }, + "19_res_validations-true": { + "type": "object", + "title": "True", + "description": "Response body schema for POST `/validations`.", + "properties": { + "valid": { + "type": "boolean", + "description": "The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable.", + "default": true + }, + "redeemables": { + "type": "array", + "description": "Lists validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"`.", + "items": { + "anyOf": [ + { + "$ref": "#/components/schemas/19_res_validations_redeemables_discount_voucher" + }, + { + "$ref": "#/components/schemas/19_res_validations_redeemables_gift_card" + }, + { + "$ref": "#/components/schemas/19_res_validations_redeemables_loyalty_card" + }, + { + "$ref": "#/components/schemas/19_res_validations_redeemables_promotion_tier" + }, + { + "$ref": "#/components/schemas/19_res_validations_redeemables_promotion_stack" + } + ] + } + }, + "order": { + "$ref": "#/components/schemas/19_obj_order_object_validation_res" + }, + "tracking_id": { + "type": "string", + "example": "track_VAVo1/z+G2GI2LPw==", + "description": "Hashed customer source ID." + }, + "session": { + "$ref": "#/components/schemas/19_res_session_lock" + } } - } - } - } - }, - "7_obj_redemption_object_gift_card_extended": { - "type": "object", - "title": "Gift Card", - "description": "This is an object representing a gift card redemption.", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "amount": { - "type": "integer", - "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] + }, + "19_obj_validations-true_result_voucher_code": { + "type": "object", + "title": "Coupon Code", + "description": "This is a `result` object representing the results for a coupon code.", + "properties": { + "discount": { + "description": "Discount details about the type of discount to be applied for the redeemable.", + "oneOf": [ + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_amount" + }, + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_amount_dynamic" + }, + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_percentage" + }, + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_percentage_dynamic" + }, + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_fixed_order" + }, + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_fixed_items" + }, + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_unit_one" + }, + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_shipping" + } + ] + } } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the gift card.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" + }, + "19_obj_voucher_object_discount_amount": { + "title": "Static Amount", + "type": "object", + "description": "Amount discount type based on a static value.", + "properties": { + "type": { + "type": "string", + "default": "AMOUNT", + "description": "Applies an amount discount." + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS", + "APPLY_TO_ITEMS_PROPORTIONALLY", + "APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY", + "APPLY_TO_ITEMS_BY_QUANTITY" + ], + "description": "Defines how the discount is applied to the customer's order." + }, + "amount_off": { + "type": "integer", + "example": 100, + "description": "Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000." + }, + "is_dynamic": { + "type": "boolean", + "description": "Flag indicating whether the discount amount is based on a formula that dynamically calculates the discount.", + "enum": [ + false + ] + } } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Defines the details of the voucher being redeemed." - }, - "gift": { - "type": "object", - "description": "Contains the amount being subtracted from the gift card for the redemption.", - "properties": { - "amount": { - "type": "integer", - "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." + }, + "19_obj_voucher_object_discount_amount_dynamic": { + "title": "Dynamic Amount", + "type": "object", + "description": "Amount discount type based on a formula.", + "properties": { + "type": { + "type": "string", + "default": "AMOUNT", + "description": "Applies an amount discount." + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS", + "APPLY_TO_ITEMS_PROPORTIONALLY", + "APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY", + "APPLY_TO_ITEMS_BY_QUANTITY" + ], + "description": "Defines how the discount is applied to the customer's order." + }, + "is_dynamic": { + "type": "boolean", + "description": "Flag indicating whether the discount amount is based on a formula that dynamically calculates the discount.", + "enum": [ + true + ] + } } - } - } - } - }, - "7_obj_redemption_object_gift_card_extended_stacked": { - "type": "object", - "title": "Gift Card", - "description": "This is an object representing a gift card redemption.", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "amount": { - "type": "integer", - "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the parent redemption.", - "example": "r_0c656311b5878a2031" - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] + }, + "19_obj_voucher_object_discount_percentage": { + "title": "Percentage", + "type": "object", + "description": "Percentage discount type applied to an order (static or dynamic) or a percentage discount type applied to items (static).", + "properties": { + "type": { + "type": "string", + "default": "PERCENT", + "description": "Applies a percentage discount." + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS" + ], + "description": "Defines how the discount is applied to the customer's order." + }, + "percent_off": { + "type": "integer", + "description": "Percent taken off the subtotal amount. In case of the percent being calculated by the formula and applied to the order level, i.e. the `is_dynamic` parameter is `true`, this value becomes a dynamically calculated value that varies based on the formula.", + "minimum": 0, + "maximum": 100 + }, + "amount_limit": { + "type": "string", + "description": "Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600." + }, + "is_dynamic": { + "type": "boolean", + "description": "Flag indicating whether the discount percentage is based on a formula that dynamically calculates the discount.", + "enum": [ + false, + true + ] + } } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the gift card.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" + }, + "19_obj_voucher_object_discount_percentage_dynamic": { + "title": "Dynamic Percentage for Items", + "type": "object", + "description": "Percentage discount type applied to items and based on a formula (dynamic).", + "properties": { + "type": { + "type": "string", + "default": "PERCENT", + "description": "Applies a percentage discount." + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS" + ], + "description": "Defines how the discount is applied to the customer's order." + }, + "amount_limit": { + "type": "string", + "description": "Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600." + }, + "is_dynamic": { + "type": "boolean", + "description": "Flag indicating whether the discount percentage is based on a formula that dynamically calculates the discount.", + "enum": [ + true + ] + } } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Defines the details of the voucher being redeemed." - }, - "gift": { - "type": "object", - "description": "Contains the amount being subtracted from the gift card for the redemption.", - "properties": { - "amount": { - "type": "integer", - "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." + }, + "19_obj_voucher_object_discount_fixed_order": { + "title": "Fixed Order Amount", + "description": "Fixed discount type for an order.", + "type": "object", + "properties": { + "type": { + "type": "string", + "default": "FIXED", + "description": "Sets a fixed total on the cart and then calculates the discount to apply." + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_ORDER" + ], + "description": "\n| **Effect** | **Definition** |\n|:---|:---|\n| **APPLY_TO_ORDER** | Sets the order total amount to the value of the fixed amount. The discount value is calculated dynamically during the redemption as it's a difference between the total amount of the customer's order and the fixed amount. For example, if the fixed amount is set to equal $10 and the order amount equals $25, then the calculated discount will be $15. |" + }, + "fixed_amount": { + "type": "integer", + "description": "Set a fixed valued for an order total. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000.", + "example": 1000 + }, + "is_dynamic": { + "type": "boolean", + "description": "Flag indicating whether the fixed amount is based on a formula that dynamically calculates the fixed amount.", + "enum": [ + false, + true + ] + } } - } - } - } - }, - "7_obj_rollback_redemption_object_truncated": { - "title": "Rollback Redemption Object", - "description": "This is an object representing an attempted or successful voucher or promotion tier rollback.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_rollback_object_discount_voucher" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_rollback_object_loyalty_card" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_rollback_object_gift_card" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_rollback_object_promotion_tier" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_rollback_object_voucher_fail" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_rollback_object_promotion_tier_fail" - } - ] - }, - "7_obj_rollback_redemption_object_extended": { - "title": "Rollback Redemption Object", - "description": "This is an object representing an attempted or successful voucher or promotion tier rollback.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_rollback_redemption_object_discount_voucher_extended" - }, - { - "$ref": "#/components/schemas/7_obj_rollback_redemption_object_loyalty_card_extended" - }, - { - "$ref": "#/components/schemas/7_obj_rollback_redemption_object_gift_card_extended" - }, - { - "$ref": "#/components/schemas/7_obj_rollback_redemption_object_promotion_tier_extended" - } - ] - }, - "7_obj_rollback_redemption_object_discount_voucher_extended": { - "type": "object", - "title": "Discount Voucher", - "description": "This is an object representing a redemption.", - "properties": { - "id": { - "type": "string", - "example": "rr_0bc92f81a6801f9bca", - "description": "Unique rollback redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", - "default": "redemption_rollback" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "redemption": { - "type": "string", - "description": "The unique redemption ID of the initial redemption.", - "example": "r_0c5d6689b35320059a" - }, - "reason": { - "type": "string", - "description": "The reason for the redemption rollback." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "$ref": "#/components/schemas/7_obj_order_object_rollback" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption rollback was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] + }, + "19_obj_voucher_object_discount_fixed_items": { + "title": "New Prices for Items", + "description": "Fixed discount type for item(s).", + "type": "object", + "properties": { + "type": { + "type": "string", + "default": "FIXED", + "description": "Sets a new item price and then calculates the discount to apply." + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_ITEMS" + ], + "description": "\n| **Effect** | **Definition** |\n|:---|:---|\n| **APPLY_TO_ITEMS** | Sets a new price on items. The total discount amount is dynamically calculated during the redemption and it's a difference between the initial item price and the fixed amount. During the redemption, prices for items will change only if the new price is lower than the original price. If the new product price you set is different from the product price in a collection, then the new product price will be passed during the redemption. If a prodct is in more than one collection, the price is always changed to the lowest price. The new price for products with several SKUs will force the price change for SKUs if their original price is higher than the new price. |" + }, + "is_dynamic": { + "type": "boolean", + "description": "Flag defaults to false because each item price could be defined separately and either based on a formula that dynamically calculates the discount or based on a fixed set price.", + "enum": [ + false + ] + } } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" + }, + "19_obj_voucher_object_discount_unit_one": { + "title": "Unit, single item", + "type": "object", + "description": "Single item type.", + "properties": { + "type": { + "type": "string", + "default": "UNIT", + "description": "Applies a full value discount to item(s)." + }, + "effect": { + "type": "string", + "enum": [ + "ADD_NEW_ITEMS", + "ADD_MISSING_ITEMS" + ], + "default": "ADD_MISSING_ITEMS", + "description": "Defines how the unit is added to the customer's order." + }, + "unit_off": { + "type": "number", + "description": "Number of units to be granted a full value discount. ", + "example": 1, + "format": "float" + }, + "unit_type": { + "type": "string", + "description": "The product or SKU deemed as free, chosen from the product inventory (e.g. time, items), i.e. `sku_0a3efc90375d1217e2` or `prod_s3C0nDpr0DuC7`.", + "example": "prod_f1r5Tpr0DuC7" + }, + "sku": { + "type": "object", + "description": "Defines the product details of the product or the parent product in case of an SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_0a3efc90375d1217e2", + "description": "Unique SKU ID assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "SKU source ID." + }, + "sku": { + "type": "string", + "description": "SKU name." + } + } + }, + "product": { + "type": "object", + "description": "Defines the product details of the product or the parent product in case of an SKU.", + "properties": { + "id": { + "type": "string", + "example": "prod_0bc3bd76a61082e6b3", + "description": "Unique (parent) product ID assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "Product source ID." + }, + "name": { + "type": "string", + "description": "Product name." + } + } + }, + "is_dynamic": { + "type": "boolean", + "description": "Flag indicating whether the number of items is based on a formula.", + "enum": [ + false, + true + ] + } } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Defines the details of the voucher being redeemed." - } - } - }, - "7_obj_rollback_redemption_object_loyalty_card_extended": { - "type": "object", - "title": "Loyalty Card Voucher", - "description": "This is an object representing a loyalty card rollback redemption.", - "properties": { - "id": { - "type": "string", - "example": "rr_0bc92f81a6801f9bca", - "description": "Unique redemption rollback ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", - "default": "redemption_rollback" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "amount": { - "type": "integer", - "description": "Number of points being returned to the loyalty card." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the initial redemption.", - "example": "r_0b56726b09cfb73e84" - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "$ref": "#/components/schemas/7_obj_order_object_rollback" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption rollback was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] + }, + "19_obj_voucher_object_discount_unit_multiple": { + "title": "Unit, multiple items", + "type": "object", + "description": "Multiple item types.", + "properties": { + "type": { + "type": "string", + "description": "Applies a full value discount to item(s).", + "default": "UNIT" + }, + "effect": { + "type": "string", + "default": "ADD_MANY_ITEMS", + "description": "Defines the effect for adding multiple item types." + }, + "units": { + "type": "array", + "description": "Array of objects defining items to be offered for free. Each item type can have a different discount effect assigned.", + "items": { + "type": "object", + "description": "Object defining a unit discount.", + "properties": { + "effect": { + "type": "string", + "enum": [ + "ADD_NEW_ITEMS", + "ADD_MISSING_ITEMS" + ], + "description": "Defines how the unit is added to the customer's order." + }, + "unit_off": { + "type": "integer", + "description": "Number of units to be granted a full value discount. In case of the unit being calculated by a formula, this value is the result of the dynamic calculation.", + "example": 1 + }, + "unit_type": { + "type": "string", + "description": "The product or SKU deemed as free, chosen from the product inventory (e.g. time, items), i.e. `prod_0bc3bd76a61082e6b3` or `sku_0a3efc90701d121820`.", + "example": "prod_f1r5Tpr0DuC7" + }, + "sku": { + "type": "object", + "description": "Defines the product details of the product or the parent product in case of an SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_0a3efc90375d1217e2", + "description": "Unique SKU ID assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "SKU source ID." + }, + "sku": { + "type": "string", + "description": "SKU name." + } + } + }, + "product": { + "type": "object", + "description": "Defines the product details of the product or the parent product in case of an SKU.", + "properties": { + "id": { + "type": "string", + "example": "prod_0bc3bd76a61082e6b3", + "description": "Unique (parent) product ID assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "Product source ID." + }, + "name": { + "type": "string", + "description": "Product name." + } + } + } + } + } + }, + "is_dynamic": { + "type": "boolean", + "description": "Flag indicating whether the number of items is based on a formula." + } } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the reward.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" + }, + "19_obj_voucher_object_discount_shipping": { + "title": "Shipping", + "description": "Shipping discount type.", + "type": "object", + "properties": { + "type": { + "type": "string", + "default": "UNIT", + "description": "Applies a full value discount to item(s)." + }, + "effect": { + "type": "string", + "description": "Defines how the unit is added to the customer's order.", + "default": "ADD_MISSING_ITEMS" + }, + "unit_off": { + "type": "number", + "format": "float", + "description": "Subtracts 1 shipping item from the subtotal.", + "default": 1 + }, + "unit_type": { + "type": "string", + "description": "The shipping product deemed as free.", + "default": "prod_5h1pp1ng" + }, + "product": { + "type": "object", + "description": "Defines the product details of the shipping product.", + "properties": { + "id": { + "type": "string", + "example": "prod_5h1pp1ng", + "description": "Unique product ID assigned by Voucherify, i.e. `prod_5h1pp1ng`.", + "default": "prod_5h1pp1ng" + }, + "source_id": { + "type": "string", + "description": "Product source ID.", + "default": "5h1pp1ng", + "example": "5h1pp1ng" + }, + "name": { + "type": "string", + "description": "Product name.", + "example": "Shipping", + "default": "Shipping" + } + } + }, + "is_dynamic": { + "type": "boolean", + "description": "Flag indicating whether the number of shipping items is based on a formula.", + "default": false, + "enum": [ + false + ] + } } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object. i.e. `voucher`.", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Defines the details of the voucher being redeemed." - }, - "reward": { - "description": "Defines the reward being redeemed.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" + }, + "19_obj_validations-true_result_gift_card": { + "type": "object", + "title": "Gift Card", + "description": "This is a `result` object representing the results for a gift card.", + "properties": { + "gift": { + "description": "Stores the amount of gift card credits to be applied in the redemption.", + "type": "object", + "properties": { + "credits": { + "type": "integer", + "description": "Total number of gift card credits to be applied in the redemption expressed as the smallest currency unit (that is, 100 cents for $1.00)." + } + } + } } - ] - }, - "loyalty_card": { - "type": "object", - "description": "Stores the number of points being added back to the loyalty card for the reward redemption rollback.", - "properties": { - "points": { - "type": "integer", - "description": "Number of points being returned to the loyalty card for the reward redemption rollback." + }, + "19_obj_validations-true_result_loyalty_card": { + "type": "object", + "title": "Loyalty Card", + "description": "This is a `result` object representing the results for a loyalty card.", + "properties": { + "loyalty_card": { + "description": "Stores the amount of loyalty card points to be applied in the redemption.", + "type": "object", + "properties": { + "points": { + "type": "integer", + "description": "Total number of loyalty points to be applied in the redemption." + } + } + } } - } - } - } - }, - "7_obj_rollback_redemption_object_gift_card_extended": { - "type": "object", - "title": "Gift Card", - "description": "This is an object representing a gift card rollback redemption.", - "properties": { - "id": { - "type": "string", - "example": "rr_0bc92f81a6801f9bca", - "description": "Unique redemption rollback ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", - "default": "redemption_rollback" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "amount": { - "type": "integer", - "description": "The amount credited back to the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the initial redemption.", - "example": "r_0b56726b09cfb73e84" - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "$ref": "#/components/schemas/7_obj_order_object_rollback" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption rollback was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] + }, + "19_obj_validations-true_result_promotion_tier": { + "type": "object", + "title": "Promotion Tier", + "description": "This is a `result` object representing the results for a promotion tier.", + "properties": { + "discount": { + "description": "Discount details about the type of discount to be applied for the redeemable.", + "oneOf": [ + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" + } + ] + } } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the gift card.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" + }, + "19_obj_validations-true_result_promotion_stack": { + "type": "object", + "title": "Promotion Stack", + "description": "This is a `result` object representing the results for a promotion stack.", + "properties": { + "loyalty_card": { + "description": "Stores the amount of loyalty card points to be applied in the redemption.", + "type": "object", + "properties": { + "points": { + "type": "integer", + "description": "Total number of loyalty points to be applied in the redemption." + } + } + } } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Defines the details of the voucher being redeemed." - }, - "gift": { - "type": "object", - "description": "Contains the amount being added back to the gift card for the redemption rollback.", - "properties": { - "amount": { - "type": "integer", - "description": "The amount added back on the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." - } - } - } - } - }, - "7_obj_rollback_redemption_object_promotion_tier_extended": { - "type": "object", - "title": "Promotion Tier", - "description": "This is an object representing a promotion tier rollback redemption.", - "properties": { - "id": { - "type": "string", - "example": "rr_0bc92f81a6801f9bca", - "description": "Unique redemption rollback ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the initial redemption.", - "example": "r_0b56726b09cfb73e84" - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "$ref": "#/components/schemas/7_obj_order_object_rollback" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption rollback was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the rollback redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.", - "enum": [ - "promotion_tier" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." - }, - "voucher": { - "type": "null" - }, - "promotion_tier": { - "type": "object", - "description": "Contains details of the promotion tier and the parent campaign.", - "properties": { - "id": { - "type": "string", - "description": "Unique promotion tier ID assigned by Voucherify.", - "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" - }, - "campaign": { - "type": "object", - "description": "Promotion tier's parent campaign.", - "properties": { - "id": { - "type": "string", - "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." + }, + "19_obj_order_object_validation_res": { + "type": "object", + "title": "Order", + "description": "Contains the combined effect of all redeemables taken into account on the order object properties.", + "properties": { + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "discount_amount": { + "type": "integer", + "description": "Sum of all order-level discounts applied to the order. \n`sum(redeemables.order.applied_discount_amount)`" + }, + "items_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" + }, + "total_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`\t" + }, + "total_amount": { + "type": "integer", + "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" + }, + "applied_discount_amount": { + "type": "integer", + "description": "Sum of all order-level discounts applied in a particular request. \n`sum(redeemables.order.applied_discount_amount)`" + }, + "items_applied_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied in a particular request. \n`sum(items, i => i.applied_discount_amount)`" + }, + "total_applied_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied in a particular request. \n`total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount`" + }, + "items": { + "type": "array", + "description": "Array of order items showing the effects of particular discounts on the item-level.", + "items": { + "type": "object", + "properties": { + "object": { + "type": "string", + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." + }, + "product_id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "sku_id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`applied_discount_amount`" + }, + "product": { + "type": "object", + "description": "This object stores more information about the related product.", + "properties": { + "id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" + }, + "name": { + "type": "string", + "example": "Brewing System", + "description": "Product name." + }, + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + }, + "sku": { + "type": "object", + "description": "This object stores more information about the related SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." + }, + "sku": { + "type": "string", + "description": "SKU name." + }, + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + } + } } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "customer_id": { + "type": "null" + }, + "referrer_id": { + "type": "null" + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." } } - } - } - } - }, - "7_obj_redemption_object_discount_voucher": { - "type": "object", - "title": "Discount Voucher", - "description": "This is an object representing a redemption. \n\nRedemption 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](rollback-redemption).", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the parent redemption if this particular redemption was issued through a stacked redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] + }, + "19_obj_order_object_validation_res_per_redeemable": { + "type": "object", + "title": "Order", + "description": "Contains the effect of each redeemable on the order and specific cart items. The amounts are consecutively built on the previous redeemable's effects, such that for each redeemable, the amounts are further reduced by the redeemable. The sequence in the request body is important because that will be the sequence the redeemables are applied one on top of the other.", + "properties": { + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "discount_amount": { + "type": "integer", + "description": "Sum of all order-level discounts applied to the order. \n`sum(redeemables.order.applied_discount_amount)`" + }, + "items_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" + }, + "total_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`\t" + }, + "total_amount": { + "type": "integer", + "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" + }, + "applied_discount_amount": { + "type": "integer", + "description": "Sum of all order-level discounts applied in a particular request. \n`sum(redeemables.order.applied_discount_amount)`" + }, + "items_applied_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied in a particular request. \n`sum(items, i => i.applied_discount_amount)`" + }, + "total_applied_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied in a particular request. \n`total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount`" + }, + "items": { + "type": "array", + "description": "Array of order items showing the effects of particular discounts on the item-level.", + "items": { + "type": "object", + "properties": { + "object": { + "type": "string", + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." + }, + "product_id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "sku_id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`applied_discount_amount`" + }, + "product": { + "type": "object", + "description": "This object stores more information about the related product.", + "properties": { + "id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" + }, + "name": { + "type": "string", + "example": "Brewing System", + "description": "Product name." + }, + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + }, + "sku": { + "type": "object", + "description": "This object stores more information about the related SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." + }, + "sku": { + "type": "string", + "description": "SKU name." + }, + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + } + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "customer_id": { + "type": "null" + }, + "referrer_id": { + "type": "null" + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + } } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "19_res_redemptions_parentRedemptionId_rollbacks": { + "type": "object", + "properties": { + "rollbacks": { + "type": "array", + "description": "Contains the rollback redemption objects of the particular incentives.", + "items": { + "anyOf": [ + { + "$ref": "#/components/schemas/19_obj_redemption_rollback_object_discount_voucher_stacked" + }, + { + "$ref": "#/components/schemas/19_obj_redemption_rollback_object_loyalty_card_stacked" + }, + { + "$ref": "#/components/schemas/19_obj_redemption_rollback_object_gift_card_stacked" + }, + { + "$ref": "#/components/schemas/19_obj_redemption_rollback_object_promotion_tier_stacked" + } + ] + } + }, + "parent_rollback": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "rr_0c675efbc2039b83b3", + "description": "Unique redemption rollback ID." + }, + "customer_id": { + "type": "string", + "example": "cust_QszL0PS1NekVjQaHGxrbpPHu", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "description": "Hashed customer source ID.", + "example": "track_fxEMFisanb4sbl4Z4yCn" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2023-02-03T09:12:22.536Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "order": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", + "description": "Unique order ID, assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + }, + "status": { + "type": "string", + "description": "Order status.", + "enum": [ + "CANCELED" + ] + }, + "customer_id": { + "type": "string", + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" + }, + "referrer_id": { + "type": "string", + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." + }, + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "total_amount": { + "type": "integer", + "description": "Order amount after undoing all the discounts through the rollback redemption." + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order.", + "items": { + "type": "object", + "properties": { + "object": { + "type": "string", + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." + }, + "product_id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "sku_id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the removing an item-level discount." + }, + "product": { + "type": "object", + "description": "This object stores more information about the related product.", + "properties": { + "id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" + }, + "name": { + "type": "string", + "example": "Brewing System", + "description": "Product name." + }, + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + }, + "sku": { + "type": "object", + "description": "This object stores more information about the related SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." + }, + "sku": { + "type": "string", + "description": "SKU name." + }, + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + } + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "result": { + "type": "string", + "description": "Redemption rollback result", + "enum": [ + "SUCCESS" + ] + }, + "redemption": { + "type": "string", + "example": "r_0c656311b5878a2031", + "description": "Unique redemption ID of the initial redemption." + } + } + }, + "order": { + "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked" + } }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" + "description": "Response body schema for POST `/redemptions/{parentRedemptionID}/rollbacks`.", + "title": "Rollback Stackable Redemptions Response Body" + }, + "19_obj_redemption_rollback_object_discount_voucher_stacked": { + "type": "object", + "title": "Rollback Discount Voucher", + "description": "This is an object representing a redemption rollback for a discount voucher.", + "properties": { + "id": { + "type": "string", + "example": "rr_0c5eba630bc4979e70", + "description": "Unique redemption rollback ID." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "anyOf": [ + { + "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_order" + }, + { + "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_items" + } + ] + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "voucher": { + "type": "object", + "description": "Defines the details of the voucher.", + "properties": { + "id": { + "type": "string", + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "discount": { + "oneOf": [ + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" + } + ] + }, + "type": { + "type": "string", + "description": "Indicates the voucher type.", + "enum": [ + "DISCOUNT_VOUCHER" + ] + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + }, + "is_referral_code": { + "type": "boolean", + "description": "Flag indicating whether this voucher is a referral code." + } + } + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the original redemption." + } } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "type": "object", - "description": "Defines the details of the voucher being redeemed.", - "properties": { - "id": { - "type": "string", - "description": "Unique voucher ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "description": "Unique campaign ID assigned by Voucherify.", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - } - } - } - } - }, - "7_obj_redemption_rollback_object_discount_voucher": { - "type": "object", - "title": "Rollback Discount Voucher", - "description": "This is an object representing a redemption rollback for a discount voucher.", - "properties": { - "id": { - "type": "string", - "example": "rr_0c5eba630bc4979e70", - "description": "Unique redemption rollback ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", - "default": "redemption_rollback" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the original redemption." - }, - "reason": { - "type": "string", - "description": "The reason for the redemption rollback." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "$ref": "#/components/schemas/7_obj_order_object_rollback" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption rollback was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "type": "object", - "description": "Defines the details of the voucher being redeemed.", - "properties": { - "id": { - "type": "string", - "description": "Unique voucher ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "description": "Unique campaign ID assigned by Voucherify.", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - } - } - } - } - }, - "7_obj_redemption_rollback_object_loyalty_card": { - "type": "object", - "title": "Rollback Loyalty Card Voucher", - "description": "This is an object representing a redemption rollback for a loyalty card.", - "properties": { - "id": { - "type": "string", - "example": "rr_0c5eaf4060133bf784", - "description": "Unique redemption rollback ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", - "default": "redemption_rollback" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "amount": { - "type": "integer", - "description": "Number of points being returned to the loyalty card." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the original redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "$ref": "#/components/schemas/7_obj_order_object_rollback" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption rollback was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the reward.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object. i.e. `voucher`.", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "type": "object", - "description": "Defines the details of the voucher being redeemed.", - "properties": { - "id": { - "type": "string", - "description": "Unique voucher ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "description": "Unique campaign ID assigned by Voucherify.", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - } - } - }, - "reward": { - "description": "Defines the reward that was initially redeemed.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" - } - ] - }, - "loyalty_card": { - "type": "object", - "description": "Stores the number of points being added back to the loyalty card for the reward redemption rollback.", - "properties": { - "points": { - "type": "integer", - "description": "Number of points being added back to the loyalty card for the reward redemption rollback." - } - } - } - } - }, - "7_obj_redemption_object_loyalty_card": { - "type": "object", - "title": "Loyalty Card Voucher", - "description": "This is an object representing a redemption. \n\nRedemption 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](rollback-redemption).", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the redemption.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "amount": { - "type": "integer", - "description": "Number of points being redeemed for a reward." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the parent redemption if this particular redemption was issued through a stacked redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the reward.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object. i.e. `voucher`.", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "type": "object", - "description": "Defines the details of the voucher being redeemed.", - "properties": { - "id": { - "type": "string", - "description": "Unique voucher ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "description": "Unique campaign ID assigned by Voucherify.", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - } - } - }, - "reward": { - "description": "Defines the reward being redeemed.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" - } - ] - }, - "loyalty_card": { - "type": "object", - "description": "Stores the number of points being subtracted from the loyalty card for the reward redemption.", - "properties": { - "points": { - "type": "integer", - "description": "Number of points being subtracted from the loyalty card for the reward redemption." - } - } - } - } - }, - "7_obj_redemption_object_loyalty_card_pay_with_points": { - "type": "object", - "description": "Defines the pay with points reward redeemed for the particular loyalty card.", - "properties": { - "customer": { - "type": "object", - "description": "Defines the customer redeeming the reward.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "assignment_id": { - "type": "string", - "example": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", - "description": "Unique reward assginment ID assigned by Voucherify." - }, - "id": { - "type": "string", - "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "description": "Unique reward ID assigned by Voucherify." - }, - "object": { - "type": "string", - "default": "reward", - "description": "Type of object represented is `reward`." - }, - "name": { - "type": "string", - "description": "Reward name." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the reward was created." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the reward was updated." - }, - "parameters": { - "type": "object", - "description": "These are parameters representing a Pay with Points (COIN) reward.", - "properties": { - "coin": { - "type": "object", - "description": "Defines the ratio by mapping the number of loyalty points in `points_ratio` to a predefined cash amount in `exchange_ratio`.", - "properties": { - "exchange_ratio": { - "type": "integer", - "description": "The cash equivalent of the points defined in the `points_ratio` property." - }, - "points_ratio": { - "type": "integer", - "description": "The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property." + }, + "19_obj_redemption_rollback_object_loyalty_card_stacked": { + "type": "object", + "title": "Rollback Loyalty Card Voucher", + "description": "This is an object representing a redemption rollback for a loyalty card.", + "properties": { + "id": { + "type": "string", + "example": "rr_0c5eaf4060133bf784", + "description": "Unique redemption rollback ID." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "amount": { + "type": "integer", + "description": "Number of points being returned to the loyalty card." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "anyOf": [ + { + "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_order" + }, + { + "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_items" + } + ] + }, + "reward": { + "description": "Defines the reward that was initially redeemed.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" + } + ] + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the reward.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } } - } - } - } - }, - "type": { - "type": "string", - "description": "Reward type", - "enum": [ - "COIN" - ] - } - }, - "title": "Pay with Points Reward" - }, - "7_obj_redemption_object_loyalty_card_material_product": { - "type": "object", - "description": "Defines the product material reward redeemed for the particular loyalty card.", - "properties": { - "customer": { - "type": "object", - "description": "Defines the customer redeeming the reward.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "assignment_id": { - "type": "string", - "example": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", - "description": "Unique reward assginment ID assigned by Voucherify." - }, - "product": { - "description": "Details of the product redeemed as a reward.", - "$ref": "#/components/schemas/11_obj_product_object_truncated" - }, - "id": { - "type": "string", - "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "description": "Unique reward ID assigned by Voucherify." - }, - "object": { - "type": "string", - "default": "reward", - "description": "Type of object represented is `reward`." - }, - "name": { - "type": "string", - "description": "Reward name." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the reward was created." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the reward was updated." - }, - "parameters": { - "type": "object", - "description": "These are parameters representing a material reward.", - "properties": { - "product": { - "type": "object", - "description": "Defines the product redeemed as a reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique product ID assignedy by Voucherify of the product.", - "example": "prod_0b2c2ddf35150b83bb" - }, - "sku_id": { - "type": "null" + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "voucher": { + "type": "object", + "description": "Defines the details of the voucher.", + "properties": { + "id": { + "type": "string", + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "loyalty_card": { + "type": "object", + "description": "Stores the number of points being added back to the loyalty card for the reward redemption rollback.", + "properties": { + "points": { + "type": "integer", + "example": 7000, + "description": "Total points incurred over lifespan of loyalty card." + }, + "balance": { + "type": "integer", + "example": 6970, + "description": "Points available for reward redemption after the redemption rollback." + } + } + }, + "type": { + "type": "string", + "description": "Indicates the voucher type.", + "enum": [ + "LOYALTY_CARD" + ] + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + }, + "is_referral_code": { + "type": "boolean", + "description": "Flag indicating whether this voucher is a referral code." + }, + "holder_id": { + "type": "string", + "description": "Unique customer ID of the loyalty card owner.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + } } + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the original redemption." } } - } - }, - "type": { - "type": "string", - "description": "Reward type", - "enum": [ - "MATERIAL" - ] - } - }, - "title": "Product Material Reward" - }, - "7_obj_redemption_object_loyalty_card_material_sku": { - "type": "object", - "description": "Defines the SKU material reward redeemed for the particular loyalty card.", - "properties": { - "customer": { - "type": "object", - "description": "Defines the customer redeeming the reward.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "assignment_id": { - "type": "string", - "example": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", - "description": "Unique reward assginment ID assigned by Voucherify." - }, - "product": { - "description": "Details of the SKU's parent product redeemed as a reward.", - "$ref": "#/components/schemas/11_obj_product_object_truncated" - }, - "sku": { - "description": "Details of the SKU redeemed as a reward.", - "$ref": "#/components/schemas/11_obj_sku_object" - }, - "id": { - "type": "string", - "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "description": "Unique reward ID assigned by Voucherify." - }, - "object": { - "type": "string", - "default": "reward", - "description": "Type of object represented is `reward`." - }, - "name": { - "type": "string", - "description": "Reward name." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the reward was created." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the reward was updated." - }, - "parameters": { - "type": "object", - "description": "These are parameters representing a material reward.", - "properties": { - "product": { - "type": "object", - "description": "Defines the SKU redeemed as a reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique product ID assignedy by Voucherify of the SKU's parent." - }, - "sku_id": { - "type": "string", - "description": "Unique SKU ID assigned by Voucherify of the SKU redeemed as a reward." + }, + "19_obj_redemption_rollback_object_gift_card_stacked": { + "type": "object", + "title": "Rollback Gift Card", + "description": "This is an object representing a gift card redemption rollback.", + "properties": { + "id": { + "type": "string", + "example": "rr_0bc92f81a6801f9bca", + "description": "Unique redemption rollback ID." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "amount": { + "type": "integer", + "description": "The amount added back to the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "anyOf": [ + { + "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_order" + }, + { + "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_items" + } + ] + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the gift card.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "voucher": { + "type": "object", + "description": "Defines the details of the voucher.", + "properties": { + "id": { + "type": "string", + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "gift": { + "type": "object", + "description": "Contains the balance of the gift card after credits are added back to the gift card for the redemption rollback.", + "properties": { + "amount": { + "type": "integer", + "example": 10000, + "description": "Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "balance": { + "type": "integer", + "example": 500, + "description": "Available funds after the redemption rollback credits back the amount used up during the initial redemption. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS" + ], + "description": "Defines how the credits are applied to the customer's order." + } + } + }, + "type": { + "type": "string", + "description": "Indicates the voucher type.", + "enum": [ + "GIFT_VOUCHER" + ] + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + }, + "is_referral_code": { + "type": "boolean", + "description": "Flag indicating whether this voucher is a referral code." + } } + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the initial redemption.", + "example": "r_0c5bf3323008a35032" } } - } - }, - "type": { - "type": "string", - "description": "Reward type", - "enum": [ - "MATERIAL" - ] - } - }, - "title": "SKU Material Reward" - }, - "7_obj_redemption_object_loyalty_card_digital": { - "type": "object", - "description": "Defines the digital reward redeemed for the particular loyalty card.", - "properties": { - "customer": { - "type": "object", - "description": "Defines the customer redeeming the reward.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "assignment_id": { - "type": "string", - "example": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", - "description": "Unique reward assginment ID assigned by Voucherify." - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Voucher object." - }, - "id": { - "type": "string", - "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "description": "Unique reward ID assigned by Voucherify." - }, - "object": { - "type": "string", - "default": "reward", - "description": "Type of object represented is `reward`." - }, - "name": { - "type": "string", - "description": "Reward name." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the reward was created." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the reward was updated." - }, - "parameters": { - "type": "object", - "description": "These are parameters representing a digital reward. These can be in the form of discount coupons, gift card credits, or loyalty point credits.", - "properties": { - "campaign": { - "description": "Defines the source of the digital reward.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital_discount_voucher" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital_gift_card_credits" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital_loyalty_card_points" + }, + "19_obj_redemption_rollback_object_promotion_tier_stacked": { + "type": "object", + "title": "Promotion Tier", + "description": "This is an object representing a promotion tier redemption rollback", + "properties": { + "id": { + "type": "string", + "example": "rr_0bc92f81a6801f9bca", + "description": "Unique redemption rollback ID." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "anyOf": [ + { + "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_order" + }, + { + "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_items" + } + ] + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } } - ] - } - } - }, - "type": { - "type": "string", - "description": "Reward type", - "enum": [ - "CAMPAIGN" - ] - } - }, - "title": "Digital Reward" - }, - "7_obj_redemption_object_loyalty_card_digital_discount_voucher": { - "type": "object", - "title": "Discount Voucher", - "description": "Contains information about the source of the digital reward.", - "properties": { - "id": { - "type": "string", - "example": "camp_0dJG7cCAjquzcxWmZ634bA0C", - "description": "Unique parent campaign ID of reward." - }, - "type": { - "type": "string", - "description": "Campaign type.", - "enum": [ - "DISCOUNT_COUPONS" - ] - } - } - }, - "7_obj_redemption_object_loyalty_card_digital_gift_card_credits": { - "type": "object", - "title": "Gift Card", - "description": "Contains information about the source of the digital reward.", - "properties": { - "id": { - "type": "string", - "example": "camp_0dJG7cCAjquzcxWmZ634bA0C", - "description": "Unique parent campaign ID of reward." - }, - "balance": { - "type": "integer", - "description": "The amount credited to the gift card as a reward expressed as the smallest currency unit (that is, 100 cents for $1.00)." - }, - "type": { - "type": "string", - "description": "Campaign type.", - "enum": [ - "GIFT_VOUCHERS" - ] - } - } - }, - "7_obj_redemption_object_loyalty_card_digital_loyalty_card_points": { - "type": "object", - "title": "Loyalty Card", - "description": "Contains information about the source of the digital reward.", - "properties": { - "id": { - "type": "string", - "example": "camp_0dJG7cCAjquzcxWmZ634bA0C", - "description": "Unique parent campaign ID of reward." - }, - "balance": { - "type": "integer", - "description": "The number of loyalty points that is added to the loyalty card as a reward." - }, - "type": { - "type": "string", - "description": "Campaign type.", - "enum": [ - "LOYALTY_PROGRAM" - ] - } - } - }, - "7_obj_redemption_rollback_object_gift_card": { - "type": "object", - "title": "Rollback Gift Card", - "description": "This is an object representing a gift card redemption rollback.", - "properties": { - "id": { - "type": "string", - "example": "rr_0bc92f81a6801f9bca", - "description": "Unique redemption rollback ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", - "default": "redemption_rollback" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "amount": { - "type": "integer", - "description": "The amount added back to the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the initial redemption.", - "example": "r_0c5bf3323008a35032" - }, - "reason": { - "type": "string", - "description": "The reason for the redemption rollback." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "$ref": "#/components/schemas/7_obj_order_object_rollback" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption rollback was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the gift card.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "type": "object", - "description": "Defines the details of the voucher being redeemed.", - "properties": { - "id": { - "type": "string", - "description": "Unique voucher ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "description": "Unique campaign ID assigned by Voucherify.", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - } - } - }, - "gift": { - "type": "object", - "description": "Contains the amount being adde back to the gift card for the redemption rollback", - "properties": { - "amount": { - "type": "integer", - "description": "The amount added back to the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "promotion_tier": { + "type": "object", + "description": "Contains details of the promotion tier and the parent campaign.", + "properties": { + "id": { + "type": "string", + "description": "Unique promotion tier ID assigned by Voucherify.", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" + }, + "name": { + "type": "string", + "description": "Promotion tier name." + }, + "banner": { + "type": "string", + "description": "Text to be displayed to your customers on your website." + }, + "campaign": { + "type": "object", + "description": "Promotion tier's parent campaign.", + "properties": { + "id": { + "type": "string", + "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." + } + } + } + } + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of initial redemption." + } } - } - } - } - }, - "7_obj_redemption_object_gift_card": { - "type": "object", - "title": "Gift Card", - "description": "This is an object representing a gift card redemption.", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "amount": { - "type": "integer", - "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the parent redemption if this particular redemption was issued through a stacked redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] + }, + "19_res_redemptions_POST": { + "type": "object", + "title": "Stackable Redemptions Response Body", + "description": "Response body schema for POST `/redemptions`.", + "properties": { + "redemptions": { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_discount_voucher_extended_stacked" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_extended_stacked" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_gift_card_extended_stacked" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_promotion_tier_extended_stacked" + } + ] + } + }, + "parent_redemption": { + "type": "object", + "title": "Stacked Redemption", + "description": "This is an object representing a stacked redemption.", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object_stacked_redemptions" + }, + "customer": { + "type": "object", + "description": "Defines the customer making the stacked redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.", + "enum": [ + "redemption" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. r_0c5d07222e08a34ace for a redemption." + }, + "voucher": { + "type": "null" + } + } + }, + "order": { + "description": "Contains the order details associated with the redemption.", + "$ref": "#/components/schemas/7_obj_order_object_stacked_redemptions" + } } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the gift card.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "type": "object", - "description": "Defines the details of the voucher being redeemed.", - "properties": { - "id": { - "type": "string", - "description": "Unique voucher ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "description": "Unique campaign ID assigned by Voucherify.", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - } - } - }, - "gift": { - "type": "object", - "description": "Contains the amount being subtracted from the gift card for the redemption.", - "properties": { - "amount": { - "type": "integer", - "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." - } - } - } - } - }, - "7_obj_redemption_object_voucher_fail": { - "type": "object", - "title": "Failed Voucher Redemption", - "description": "This is an object representing a failed redemption for a voucher.", - "properties": { - "id": { - "type": "string", - "example": "rf_0bbaccc96e0830ff9e", - "description": "Unique failed redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "failure_code": { - "type": "string", - "example": "customer_rules_violated", - "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." - }, - "failure_message": { - "type": "string", - "description": "If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed." - }, - "order": { - "type": "null" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |\n", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "voucher": { - "type": "object", - "description": "Defines the voucher details.", - "properties": { - "id": { - "type": "string", - "description": "Unique voucher ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "description": "Unique campaign ID assigned by Voucherify.", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - } - } - } - } - }, - "7_obj_redemption_object_promotion_tier_fail": { - "type": "object", - "title": "Failed Promotion Tier Redemption", - "description": "This is an object representing a failed redemption for a promotion tier.", - "properties": { - "id": { - "type": "string", - "example": "rf_0bbaccc96e0830ff9e", - "description": "Unique failed redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the redemption.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "failure_code": { - "type": "string", - "example": "customer_rules_violated", - "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." - }, - "failure_message": { - "type": "string", - "description": "If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed." - }, - "order": { - "type": "null" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the promotion.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n", - "enum": [ - "promotion_tier" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify.", - "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" - }, - "voucher": { - "type": "null" - }, - "promotion_tier": { - "type": "object", - "description": "Contains details about the promotion tier and it's parent campaign.", - "properties": { - "id": { - "type": "string", - "description": "Unique promotion tier ID assigned by Voucherify.", - "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" - }, - "campaign": { - "type": "object", - "description": "Promotion tier's parent campaign.", - "properties": { - "id": { - "type": "string", - "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." + }, + "7_obj_order_object_rollback": { + "title": "Order object", + "description": "This is an object representing an order that was rolled back.", + "properties": { + "id": { + "type": "string", + "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", + "description": "Unique order ID, assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:40:48.705Z", + "description": "Timestamp representing the date and time when the order was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:47:20.760Z", + "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format." + }, + "status": { + "type": "string", + "description": "Order status.", + "enum": [ + "CANCELED" + ] + }, + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "total_amount": { + "type": "integer", + "description": "Order amount after undoing all the discounts through the rollback redemption." + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order.", + "items": { + "type": "object", + "properties": { + "object": { + "type": "string", + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." + }, + "product_id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "sku_id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the removing an item-level discount." + }, + "product": { + "type": "object", + "description": "This object stores more information about the related product.", + "properties": { + "id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" + }, + "name": { + "type": "string", + "example": "Brewing System", + "description": "Product name." + }, + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + }, + "sku": { + "type": "object", + "description": "This object stores more information about the related SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." + }, + "sku": { + "type": "string", + "description": "SKU name." + }, + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + } + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "customer": { + "type": "object", + "description": "Object containing information about the customer that is making the purchase.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique customer ID of the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `customer` object." + } + } + }, + "referrer": { + "type": "object", + "description": "Object containing information about the referrer.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique referrer ID, who referred the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `referrer` object." + } + } + }, + "customer_id": { + "type": "string", + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" + }, + "referrer_id": { + "type": "string", + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + }, + "redemptions": { + "description": "Lists details related to the redemption and redemption rollback.", + "properties": { + "redemption_ID": { + "type": "object", + "description": "The property name is the unique redemption ID; i.e. `r_0ba186c4824e4881e1`. This object contains information about the redemption of an incentive.", + "properties": { + "date": { + "type": "string", + "description": "Timestamp representing the date and time when the redemption was created in ISO 8601 format.", + "example": "2022-09-02T17:06:56.649Z", + "format": "date-time" + }, + "rollback_id": { + "type": "string", + "description": "Unique ID of the redemption rollback.", + "example": "rr_0c63c84eb78ee0a6c0" + }, + "rollback_date": { + "type": "string", + "description": "Timestamp representing the date and tiem when the redemption rollback was created in ISO 8601 format.", + "example": "2023-01-31T14:18:37.150Z", + "format": "date-time" + }, + "related_object_type": { + "type": "string", + "description": "The source of the incentive.", + "enum": [ + "voucher", + "promotion_tier" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique ID of the related object that defines the incentive." + }, + "related_object_parent_id": { + "type": "string", + "description": "Represent's the campaign ID of the voucher if the redemption was based on a voucher that was part of bulk codes generated within a campaign." + } + } + } } } } - } - } - } - }, - "7_obj_redemption_object_fail": { - "type": "object", - "title": "Failed Redemption", - "description": "This is an object representing a failed redemption when a resource to be redeemed cannot be found.", - "properties": { - "id": { - "type": "string", - "example": "rf_0c4c7baf58c243af6b", - "description": "Unique failed redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the redemption.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "null", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "null", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "failure_code": { - "type": "string", - "example": "not_found", - "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." - }, - "failure_message": { - "type": "string", - "description": "If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed." - }, - "order": { - "type": "null" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] + }, + "7_obj_order_object": { + "title": "Order object", + "description": "This is an object representing an order with calculated discounts applied using the voucher code.", + "oneOf": [ + { + "$ref": "#/components/schemas/7_obj_order_object_apply_to_order" + }, + { + "$ref": "#/components/schemas/7_obj_order_object_apply_to_items" + } + ] + }, + "7_obj_order_object_apply_to_order": { + "type": "object", + "title": "Order object - Effect: Apply to order", + "description": "This is an object representing an order with calculated discounts applied using the voucher code.", + "properties": { + "id": { + "type": "string", + "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", + "description": "Unique order ID, assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:40:48.705Z", + "description": "Timestamp representing the date and time when the order was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:47:20.760Z", + "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format." + }, + "status": { + "type": "string", + "description": "Order status.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULFILLED" + ] + }, + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "discount_amount": { + "type": "integer", + "description": "Sum of all order-level discounts applied to the order." + }, + "total_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`" + }, + "total_amount": { + "type": "integer", + "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" + }, + "applied_discount_amount": { + "type": "integer", + "description": "This field shows the order-level discount applied." + }, + "total_applied_discount_amount": { + "type": "integer", + "description": "This field sums up all order-level and all product-specific discounts applied in a particular request." + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", + "items": { + "type": "object", + "properties": { + "object": { + "type": "string", + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." + }, + "product_id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "sku_id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" + }, + "product": { + "type": "object", + "description": "This object stores more information about the related product.", + "properties": { + "id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" + }, + "name": { + "type": "string", + "example": "Brewing System", + "description": "Product name." + }, + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + }, + "sku": { + "type": "object", + "description": "This object stores more information about the related SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." + }, + "sku": { + "type": "string", + "description": "SKU name." + }, + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + } + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "customer": { + "type": "object", + "description": "Object containing information about the customer that is making the purchase.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique customer ID of the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `customer` object." + } + } + }, + "referrer": { + "type": "object", + "description": "Object containing information about the referrer.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique referrer ID, who referred the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `referrer` object." + } + } + }, + "customer_id": { + "type": "string", + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" + }, + "referrer_id": { + "type": "string", + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + }, + "redemptions": { + "description": "Lists details related to the redemption.", + "$ref": "#/components/schemas/10_obj_order_object_unstacked_redemptions" + } } - } - }, - "customer": { - "type": "null" - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| redemption | Related redemption. |\n", - "enum": [ - "redemption" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify.", - "example": "rf_0c5bde8dfc0156f0e3" - }, - "voucher": { - "type": "null" - } - } - }, - "7_obj_redemption_rollback_object_voucher_fail": { - "type": "object", - "title": "Failed Voucher Redemption Rollback", - "description": "This is an object representing a failed redemption rollback for a voucher.", - "properties": { - "id": { - "type": "string", - "example": "rrf_0c63990fed133bfb88", - "description": "Unique failed redemption rollback ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", - "default": "redemption_rollback" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "redemption": { - "type": "string", - "description": "The unique redemption ID of the initial redemption.", - "example": "r_0c5d6689b35320059a" - }, - "reason": { - "type": "string", - "description": "The reason for the redemption rollback." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "failure_code": { - "type": "string", - "example": "already_rolled_back", - "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." - }, - "failure_message": { - "type": "string", - "description": "If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed." - }, - "order": { - "type": "null" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption rollback was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |\n", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "voucher": { - "type": "object", - "description": "Defines the voucher details.", - "properties": { - "id": { - "type": "string", - "description": "Unique voucher ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "description": "Unique campaign ID assigned by Voucherify.", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - } - } - } - } - }, - "7_obj_redemption_rollback_object_promotion_tier_fail": { - "type": "object", - "title": "Failed Promotion Tier Redemption Rollback", - "description": "This is an object representing a failed redemption rollback for a promotion tier.", - "properties": { - "id": { - "type": "string", - "example": "rrf_0c5eb3bd884497ed05", - "description": "Unique failed redemption rollback ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", - "default": "redemption_rollback" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "redemption": { - "type": "string", - "description": "The unique redemption ID of the initial redemption.", - "example": "r_0c5d6689b35320059a" - }, - "reason": { - "type": "string", - "description": "The reason for the redemption rollback." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "failure_code": { - "type": "string", - "example": "customer_rules_violated", - "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." - }, - "failure_message": { - "type": "string", - "description": "If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed." - }, - "order": { - "type": "null" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption rollback was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the promotion.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n", - "enum": [ - "promotion_tier" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify.", - "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" - }, - "voucher": { - "type": "null" - }, - "promotion_tier": { - "type": "object", - "description": "Contains details about the promotion tier and it's parent campaign.", - "properties": { - "id": { - "type": "string", - "description": "Unique promotion tier ID assigned by Voucherify.", - "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" - }, - "campaign": { - "type": "object", - "description": "Promotion tier's parent campaign.", - "properties": { - "id": { - "type": "string", - "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." + }, + "7_obj_order_object_apply_to_items": { + "type": "object", + "title": "Order object - Effect: Apply to items", + "description": "This is an object representing an order with calculated discounts applied using the voucher code.", + "properties": { + "id": { + "type": "string", + "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", + "description": "Unique order ID, assigned by Voucherify. " + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:40:48.705Z", + "description": "Timestamp representing the date and time when the order was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:47:20.760Z", + "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format." + }, + "status": { + "type": "string", + "description": "Order status.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULFILLED" + ] + }, + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "items_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" + }, + "total_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied to the order." + }, + "total_amount": { + "type": "integer", + "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" + }, + "items_applied_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied." + }, + "total_applied_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied to the order." + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", + "items": { + "type": "object", + "properties": { + "object": { + "type": "string", + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." + }, + "product_id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "sku_id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + }, + "discount_amount": { + "type": "integer", + "description": "The item-level discount applied to the item." + }, + "applied_discount_amount": { + "type": "integer", + "description": "The item-level discount applied to the item." + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" + }, + "product": { + "type": "object", + "description": "This object stores more information about the related product.", + "properties": { + "id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" + }, + "name": { + "type": "string", + "example": "Brewing System", + "description": "Product name." + }, + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + }, + "sku": { + "type": "object", + "description": "This object stores more information about the related SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." + }, + "sku": { + "type": "string", + "description": "SKU name." + }, + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + } + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "customer": { + "type": "object", + "description": "Object containing information about the customer that is making the purchase.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique customer ID of the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `customer` object." + } + } + }, + "referrer": { + "type": "object", + "description": "Object containing information about the referrer.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique referrer ID, who referred the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `referrer` object." + } } + }, + "customer_id": { + "type": "string", + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" + }, + "referrer_id": { + "type": "string", + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + }, + "redemptions": { + "description": "Lists details related to the redemption.", + "$ref": "#/components/schemas/10_obj_order_object_unstacked_redemptions" } } - } - } - } - }, - "7_obj_redemption_rollback_object_promotion_tier": { - "type": "object", - "title": "Promotion Tier", - "description": "This is an object representing a promotion tier redemption rollback", - "properties": { - "id": { - "type": "string", - "example": "rr_0bc92f81a6801f9bca", - "description": "Unique redemption rollback ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", - "default": "redemption_rollback" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of initial redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "$ref": "#/components/schemas/7_obj_order_object_rollback" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption rollback was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.", - "enum": [ - "promotion_tier" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." - }, - "voucher": { - "type": "null" - }, - "promotion_tier": { - "type": "object", - "description": "Contains details of the promotion tier and the parent campaign.", - "properties": { - "id": { - "type": "string", - "description": "Unique promotion tier ID assigned by Voucherify.", - "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" - }, - "campaign": { - "type": "object", - "description": "Promotion tier's parent campaign.", - "properties": { - "id": { - "type": "string", - "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." + }, + "7_obj_order_object_stacked_redemptions": { + "type": "object", + "title": "Order", + "description": "This is an object representing an order with calculated discounts applied using the voucher code.", + "properties": { + "id": { + "type": "string", + "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", + "description": "Unique order ID, assigned by Voucherify. " + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:40:48.705Z", + "description": "Timestamp representing the date and time when the order was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:47:20.760Z", + "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format." + }, + "status": { + "type": "string", + "description": "Order status.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULFILLED" + ] + }, + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "discount_amount": { + "type": "integer", + "description": "Sum of all order-level discounts applied to the order." + }, + "items_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" + }, + "total_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`" + }, + "total_amount": { + "type": "integer", + "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" + }, + "applied_discount_amount": { + "type": "integer", + "description": "This field shows the sum of all order-level discounts applied." + }, + "items_applied_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied.\n`sum(items, i => i.applied_discount_amount)`" + }, + "total_applied_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied to the order.\n`total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount`" + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", + "items": { + "type": "object", + "properties": { + "object": { + "type": "string", + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." + }, + "product_id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "sku_id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + }, + "discount_amount": { + "type": "integer", + "description": "The item-level discount applied to the item." + }, + "applied_discount_amount": { + "type": "integer", + "description": "The item-level discount applied to the item." + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" + }, + "product": { + "type": "object", + "description": "This object stores more information about the related product.", + "properties": { + "id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" + }, + "name": { + "type": "string", + "example": "Brewing System", + "description": "Product name." + }, + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + }, + "sku": { + "type": "object", + "description": "This object stores more information about the related SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." + }, + "sku": { + "type": "string", + "description": "SKU name." + }, + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + } + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "customer": { + "type": "object", + "description": "Object containing information about the customer that is making the purchase.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique customer ID of the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `customer` object." + } + } + }, + "referrer": { + "type": "object", + "description": "Object containing information about the referrer.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique referrer ID, who referred the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `referrer` object." + } } + }, + "customer_id": { + "type": "string", + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" + }, + "referrer_id": { + "type": "string", + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + }, + "redemptions": { + "description": "Lists details related to the redemption", + "$ref": "#/components/schemas/10_obj_order_object_stacked_redemptions" } } - } - } - } - }, - "7_obj_redemption_object_promotion_tier": { - "type": "object", - "title": "Promotion Tier", - "description": "This is an object representing a promotion tier redemption.", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the parent redemption if this particular redemption was issued through a stacked redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.", - "enum": [ - "promotion_tier" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." - }, - "voucher": { - "type": "null" - }, - "promotion_tier": { - "type": "object", - "description": "Contains details of the promotion tier and the parent campaign.", - "properties": { - "id": { - "type": "string", - "description": "Unique promotion tier ID assigned by Voucherify.", - "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" - }, - "campaign": { - "type": "object", - "description": "Promotion tier's parent campaign.", - "properties": { - "id": { - "type": "string", - "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." - } + }, + "7_obj_redemption_object": { + "title": "Redemption Object", + "description": "This is an object representing a redemption. \n\nRedemption 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 an operation a [redemption rollback](ref:rollback-redemption).", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_discount_voucher" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_gift_card" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_promotion_tier" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_stackable_discounts" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_voucher_fail" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_promotion_tier_fail" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_fail" } - } - } - } - } - }, - "7_obj_redemption_object_promotion_tier_extended": { - "type": "object", - "title": "Promotion Tier", - "description": "This is an object representing a promotion tier redemption.", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.", - "enum": [ - "promotion_tier" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." - }, - "voucher": { - "type": "null" - }, - "promotion_tier": { - "description": "Contains details of the promotion tier and the parent campaign.", - "$ref": "#/components/schemas/3_obj_promotion_tier_object" - } - } - }, - "7_obj_redemption_object_promotion_tier_extended_stacked": { - "type": "object", - "title": "Promotion Tier", - "description": "This is an object representing a promotion tier redemption.", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the parent redemption.", - "example": "r_0c656311b5878a2031" - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.", - "enum": [ - "promotion_tier" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." - }, - "voucher": { - "type": "null" - }, - "promotion_tier": { - "description": "Contains details of the promotion tier and the parent campaign.", - "$ref": "#/components/schemas/3_obj_promotion_tier_object" - } - } - }, - "7_obj_redemption_object_stackable_discounts": { - "type": "object", - "title": "Stacked Redemption", - "description": "This is an object representing a stacked redemption.", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object_stacked_redemptions" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer making the stacked redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.", - "enum": [ - "redemption" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. r_0c5d07222e08a34ace for a redemption." - }, - "voucher": { - "type": "null" - } - } - }, - "7_res_get_redemption": { - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object" - }, - { - "$ref": "#/components/schemas/7_obj_rollback_redemption_object_truncated" - } - ], - "title": "Get Redemption Response Body", - "description": "Response body schema for **GET** `/redemptions/{redemptionId}" - }, - "7_res_list_redemptions": { - "title": "List Redemptions Response Body", - "type": "object", - "description": "Response body schema for **GET** `/redemptions`.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about redemptions in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "redemptions", - "description": "Identifies the name of the attribute that contains the array of redemption objects." - }, - "redemptions": { - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object" - }, - { - "$ref": "#/components/schemas/7_obj_rollback_redemption_object_truncated" - } - ] - }, - "total": { - "type": "integer", - "description": "Total number of redemptions." - } - } - }, - "7_filter_conditions_string": { - "title": "Filter by conditions", - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "$in": { - "type": "array", - "description": "Array of resource values that should be included in the results. (multiple values)", - "items": { - "type": "string" - } - }, - "$not_in": { - "type": "array", - "description": "Array of resource values that should be included in the results. (multiple values)", - "items": { - "type": "string" - } - }, - "$is": { - "type": "string", - "description": "Value is exactly this value. (single value)" - }, - "$is_not": { - "type": "string", - "description": "Results omit this value. (single value)" - }, - "$has_value": { - "type": "string", - "description": "Value is NOT null. The value for this parameter is an empty string." - }, - "$is_unknown": { - "type": "string", - "description": "Value is null. The value for this parameter is an empty string." - }, - "$starts_with": { - "type": "string", - "description": "Value starts with the specified string." - }, - "$ends_with": { - "type": "string", - "description": "Value ends with the specified string." - } - } - }, - "7_res_get_vouchers_redemptions": { - "type": "object", - "title": "Get Voucher's Redemptions Response Body", - "description": "Response body schema for **GET** `/vouchers/{code}/redemption`.", - "properties": { - "quantity": { - "type": "integer", - "description": "The maximum number of times a voucher can be redeemed." - }, - "redeemed_quantity": { - "type": "integer", - "description": "The number of times the voucher was redeemed successfully." - }, - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about redemptions in a dictionary." - }, - "url": { - "type": "string", - "example": "/v1/vouchers/PROMO-CODE2/redemptions?page=1&limit=10", - "description": "URL " - }, - "data_ref": { - "type": "string", - "default": "redemption_entries", - "description": "Identifies the name of the attribute that contains the array of `redemption_entries`." - }, - "total": { - "type": "integer", - "description": "Total number of redemption objects." - }, - "redemption_entries": { - "type": "array", - "description": "Contains the array of successful and failed redemption objects.", - "items": { - "$ref": "#/components/schemas/7_obj_redemption_object_voucher" - } - } - } - }, - "7_req_redeem_voucher": { - "title": "Redeem Voucher Request Body", - "description": "Request body schema for redeeming a voucher using **POST** `/vouchers/{code}/redemption`.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_req_redeem_voucher_discount_code" - }, - { - "$ref": "#/components/schemas/7_req_redeem_voucher_gift_card" - }, - { - "$ref": "#/components/schemas/7_req_redeem_voucher_loyalty_card" - } - ] - }, - "7_res_redeem_voucher": { - "title": "Redeem Voucher Response Body", - "$ref": "#/components/schemas/7_obj_redemption_object_voucher_extended", - "description": "Response body schema for **POST** `/vouchers/{code}/redemption`." - }, - "7_req_redeem_promotion_tier": { - "title": "Redeem Promotion Tier", - "type": "object", - "description": "Redeem a promotion tier.", - "properties": { - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" - }, - { - "$ref": "#/components/schemas/10_req_create_order" - } - ], - "description": "Order information." - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against promotion tiers requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the [Create Validation Rules](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." - } - } - }, - "7_req_redeem_voucher_discount_code": { - "title": "Discount Code", - "type": "object", - "description": "Redeem a discount code.", - "properties": { - "session": { - "$ref": "#/components/schemas/6_req_session_lock_discount_code" - }, - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" - }, - { - "$ref": "#/components/schemas/10_req_create_order" - } - ], - "description": "Order information." - }, - "metadata": { - "type": "object", - "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "options": { - "type": "object", - "description": "Configure parameters returned in the response.", - "properties": { - "expand": { - "type": "array", - "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. Add `category` as a string in the array to include a `categories` object in the response.", - "items": { + ] + }, + "7_obj_redemption_object_voucher": { + "title": "Redemption Object", + "description": "This is an object representing an attempted or successful voucher redemption.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_discount_voucher" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_gift_card" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_voucher_fail" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_rollback_object_discount_voucher" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_rollback_object_gift_card" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_rollback_object_loyalty_card" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_rollback_object_voucher_fail" + } + ] + }, + "7_obj_redemption_object_voucher_extended": { + "title": "Redemption Object", + "description": "This is an object representing an attempted or successful voucher redemption.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_discount_voucher_extended" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_extended" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_gift_card_extended" + } + ] + }, + "7_obj_redemption_object_discount_voucher_extended": { + "type": "object", + "title": "Discount Voucher", + "description": "This is an object representing a redemption. \n\nRedemption 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](rollback-redemption).", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "result": { "type": "string", "enum": [ - "category" + "SUCCESS", + "FAILURE" ], - "example": "category" - } - } - } - } - } - }, - "7_req_redeem_voucher_gift_card": { - "title": "Gift Card", - "type": "object", - "description": "Redeem a gift card.", - "properties": { - "session": { - "$ref": "#/components/schemas/6_req_session_lock_gift_card" - }, - "gift": { - "type": "object", - "description": "Contains information on the number of gift card credits that the customer wants to apply to the order.", - "properties": { - "credits": { - "type": "integer", - "description": "The number of credits that the user wants to use from the gift card to fulfil the order. The value of credits cannot be higher than the current balance on the gift card. If the user gives more points than he has on the gift card, the application will return an error code in response. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - }, - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" - }, - { - "$ref": "#/components/schemas/10_req_create_order" - } - ], - "description": "Order information." - }, - "metadata": { - "type": "object", - "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "options": { - "type": "object", - "description": "Configure parameters returned in the response.", - "properties": { - "expand": { - "type": "array", - "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. Add `category` as a string in the array to include a `categories` object in the response.", - "items": { + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", "enum": [ - "category" - ], - "example": "category" + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Defines the details of the voucher being redeemed." } } - } - } - } - }, - "7_req_redeem_voucher_loyalty_card": { - "title": "Loyalty Card", - "type": "object", - "description": "Redeem a loyalty card.", - "properties": { - "session": { - "$ref": "#/components/schemas/6_req_session_lock_loyalty_card" - }, - "reward": { - "type": "object", - "description": "Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward." - }, - "points": { - "type": "integer", - "description": "The number of loyalty points that the user wants to spend in order to fulfill the order. The number of points cannot be higher than the current balance on the loyalty card. If the user gives more points than he/she has on the loyalty card, the application will return an error code in response." - } - } - }, - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" - }, - { - "$ref": "#/components/schemas/10_req_create_order" + }, + "7_obj_redemption_object_discount_voucher_extended_stacked": { + "type": "object", + "title": "Discount Voucher", + "description": "This is an object representing a redemption.", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the parent redemption.", + "example": "r_0c656311b5878a2031" + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Defines the details of the voucher being redeemed." + } } - ], - "description": "Order information." - }, - "metadata": { - "type": "object", - "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "options": { - "type": "object", - "description": "Configure parameters returned in the response.", - "properties": { - "expand": { - "type": "array", - "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. Add `category` as a string in the array to include a `categories` object in the response.", - "items": { + }, + "7_obj_redemption_object_loyalty_card_extended": { + "type": "object", + "title": "Loyalty Card Voucher", + "description": "This is an object representing a redemption. \n\nRedemption 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](rollback-redemption).", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the redemption.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "amount": { + "type": "integer", + "description": "Number of points being redeemed for a reward." + }, + "result": { "type": "string", "enum": [ - "category" + "SUCCESS", + "FAILURE" ], - "example": "category" + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the reward.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object. i.e. `voucher`.", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Defines the details of the voucher being redeemed." + }, + "reward": { + "description": "Defines the reward being redeemed.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" + } + ] + }, + "loyalty_card": { + "type": "object", + "description": "Stores the number of points being subtracted from the loyalty card for the reward redemption.", + "properties": { + "points": { + "type": "integer", + "description": "Number of points being subtracted from the loyalty card for the reward redemption." + } + } } } - } - } - } - }, - "7_req_rollback_redemption": { - "title": "Rollback Redemption Request Body", - "type": "object", - "properties": { - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_rollback_redemption_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_rollback_redemption_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" + }, + "7_obj_redemption_object_loyalty_card_extended_stacked": { + "type": "object", + "title": "Loyalty Card Voucher", + "description": "This is an object representing a redemption.", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the redemption.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "amount": { + "type": "integer", + "description": "Number of points being redeemed for a reward." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the parent redemption.", + "example": "r_0c656311b5878a2031" + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the reward.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object. i.e. `voucher`.", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Defines the details of the voucher being redeemed." + }, + "reward": { + "description": "Defines the reward being redeemed.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" + } + ] + }, + "loyalty_card": { + "type": "object", + "description": "Stores the number of points being subtracted from the loyalty card for the reward redemption.", + "properties": { + "points": { + "type": "integer", + "description": "Number of points being subtracted from the loyalty card for the reward redemption." + } + } + } } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_rollback_redemption_order_id" - }, - { - "$ref": "#/components/schemas/6_req_rollback_redemption_order_source_id" + }, + "7_obj_redemption_object_gift_card_extended": { + "type": "object", + "title": "Gift Card", + "description": "This is an object representing a gift card redemption.", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "amount": { + "type": "integer", + "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the gift card.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Defines the details of the voucher being redeemed." + }, + "gift": { + "type": "object", + "description": "Contains the amount being subtracted from the gift card for the redemption.", + "properties": { + "amount": { + "type": "integer", + "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." + } + } + } } - ], - "description": "Send order information to ensure the correct order is being undone." - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to update **redemption** metadata." - } - }, - "description": "Request body schema for **POST** `/redemptions/{redemptionId}/rollback`." - }, - "7_res_rollback_redemption": { - "title": "Rollback Redemption Response Body", - "$ref": "#/components/schemas/7_obj_rollback_redemption_object_extended", - "description": "Response body schema for **POST** `/redemptions/{redemptionId}/rollback`." - }, - "8_obj_loyalty_campaign_object": { - "title": "Loyalty Campaign Object", - "description": "This is an object representing a loyalty campaign. \n\nThe loyalty campaign object contains details about the loyalty campaign. You can use dedicated endpoints to list loyalty campaigns, list loyalty card holders, member activities, active rewards, earning rules, loyalty tiers for given loyalty campaign.", - "x-tags": [ - "LOYALTIES API" - ], - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique campaign ID, assigned by Voucherify.", - "example": "camp_f7fBbQxUuTN7dI7tGOo5XMDA" - }, - "name": { - "type": "string", - "description": "Loyalty campaign name." - }, - "campaign_type": { - "type": "string", - "enum": [ - "LOYALTY_PROGRAM" - ], - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria \n- `STATIC`: vouchers need to be manually published", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "voucher": { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_LOYALTY_CARD" - }, - "auto_join": { - "type": "boolean", - "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + }, + "7_obj_redemption_object_gift_card_extended_stacked": { + "type": "object", + "title": "Gift Card", + "description": "This is an object representing a gift card redemption.", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "amount": { + "type": "integer", + "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the parent redemption.", + "example": "r_0c656311b5878a2031" + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the gift card.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Defines the details of the voucher being redeemed." + }, + "gift": { + "type": "object", + "description": "Contains the amount being subtracted from the gift card for the redemption.", + "properties": { + "amount": { + "type": "integer", + "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." + } + } + } } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign." - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2021-12-01T08:00:50.038Z", - "description": "Timestamp representing the date and time when the campaign was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-09-20T09:18:19.623Z", - "description": "Timestamp representing the date and time when the voucher was updated in ISO 8601 format." - }, - "creation_status": { - "type": "string", - "enum": [ - "DONE", - "IN_PROGRESS", - "FAILED", - "DRAFT", - "MODIFYING" - ], - "description": "Indicates the status of the campaign creation." - }, - "vouchers_generation_status": { - "type": "string", - "description": "Indicates the status of the campaign's vouchers.", - "enum": [ - "DONE", - "IN_PROGRESS", - "FAILED", - "DRAFT" - ] - }, - "protected": { - "type": "boolean", - "description": "Indicates whether the resource can be deleted." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to.", - "example": "cat_0b688929a2476386a7" - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object" - }, - "loyalty_tiers_expiration": { - "type": "object", - "description": "Defines the expiration mechanism for loyalty tiers.", - "anyOf": [ - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance" - }, - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_points_in_period" - } - ] - }, - "object": { - "type": "string", - "default": "campaign", - "description": "The type of object represented by JSON. This object stores information about the campaign." - } - } - }, - "8_obj_loyalty_campaign_object_no_extended_categories": { - "title": "Loyalty Campaign Object", - "description": "This is an object representing a loyalty campaign. \n\nThe loyalty campaign object contains details about the loyalty campaign. You can use dedicated endpoints to list loyalty campaigns, list loyalty card holders, member activities, active rewards, earning rules, loyalty tiers for given loyalty campaign.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique campaign ID, assigned by Voucherify.", - "example": "camp_f7fBbQxUuTN7dI7tGOo5XMDA" - }, - "name": { - "type": "string", - "description": "Loyalty campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "campaign_type": { - "type": "string", - "enum": [ - "LOYALTY_PROGRAM" - ], - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria \n- `STATIC`: vouchers need to be manually published", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "voucher": { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_LOYALTY_CARD" - }, - "auto_join": { - "type": "boolean", - "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign." - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2021-12-01T08:00:50.038Z", - "description": "Timestamp representing the date and time when the campaign was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-09-20T09:18:19.623Z", - "description": "Timestamp representing the date and time when the voucher was updated in ISO 8601 format." - }, - "creation_status": { - "type": "string", - "enum": [ - "DONE", - "IN_PROGRESS", - "FAILED", - "DRAFT", - "MODIFYING" - ], - "description": "Indicates the status of the campaign creation." - }, - "vouchers_generation_status": { - "type": "string", - "description": "Indicates the status of the campaign's vouchers.", - "enum": [ - "DONE", - "IN_PROGRESS", - "FAILED", - "DRAFT" - ] - }, - "protected": { - "type": "boolean", - "description": "Indicates whether the resource can be deleted." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to.", - "example": "cat_0b688929a2476386a7" - }, - "categories": { - "type": "array", - "description": "Contains details about the category.", - "items": { - "$ref": "#/components/schemas/20_obj_category_object" - } - }, - "loyalty_tiers_expiration": { - "type": "object", - "description": "Defines the expiration mechanism for loyalty tiers.", - "anyOf": [ - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance" - }, - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_points_in_period" - } - ] - }, - "object": { - "type": "string", - "default": "campaign", - "description": "The type of object represented by JSON. This object stores information about the campaign." - } - } - }, - "8_obj_loyalty_card_object": { - "title": "Loyalty Card Object", - "type": "object", - "description": "This is an object representing a loyalty card.", - "examples": [ - { - "id": "v_hrMBBeT4sOP9VSGPmj5KAgJwX202UjiY", - "code": "LOYALTY-CARD-xLPbpbXR", - "campaign": "Loyalty Program Fall 2022", - "campaign_id": "camp_f7fBbQxUuTN7dI7tGOo5XMDA", - "category": "First", - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" - } - ], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 110, - "balance": 100, - "next_expiration_date": "2023-12-31", - "next_expiration_points": 100 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8/6I6hUEqtz/F6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD/DjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8%2F6I6hUEqtz%2FF6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD%2FDjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/SpYuOrU9wd6/o1wzy6E/04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ/FJtiw69djuzQk1f4HdQo8s5gaZ7fd2U+1zbaeAvi9usyvRHZE4=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FSpYuOrU9wd6%2Fo1wzy6E%2F04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ%2FFJtiw69djuzQk1f4HdQo8s5gaZ7fd2U%2B1zbaeAvi9usyvRHZE4%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-19T07:56:22.355Z", - "updated_at": "2022-09-19T08:04:22.458Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 1, - "redeemed_points": 10, - "object": "list", - "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/redemptions?page=1&limit=10" }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/publications?page=1&limit=10" + "7_obj_rollback_redemption_object_truncated": { + "title": "Rollback Redemption Object", + "description": "This is an object representing an attempted or successful voucher or promotion tier rollback.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_rollback_object_discount_voucher" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_rollback_object_loyalty_card" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_rollback_object_gift_card" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_rollback_object_promotion_tier" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_rollback_object_voucher_fail" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_rollback_object_promotion_tier_fail" + } + ] }, - "object": "voucher" - } - ], - "properties": { - "id": { - "type": "string", - "example": "v_mkZN9v7vjYUadXnHrMza8W5c34fE5KiV", - "description": "Assigned by the Voucherify API, identifies the voucher." - }, - "code": { - "type": "string", - "example": "WVPblOYX", - "description": "A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters." - }, - "campaign": { - "type": "string", - "example": "Loyalty Card Campaign", - "description": "A unique campaign name, identifies the voucher's parent campaign." - }, - "campaign_id": { - "type": "string", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "description": "Assigned by the Voucherify API, identifies the voucher's parent campaign." - }, - "category": { - "type": "string", - "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint." - }, - "category_id": { - "type": "string", - "description": "Unique category ID assigned by Voucherify.", - "example": "cat_0bb343dee3cdb5ec0c" - }, - "categories": { - "type": "array", - "description": "Contains details about the category.", - "items": { - "$ref": "#/components/schemas/20_obj_category_object" - } - }, - "type": { - "type": "string", - "enum": [ - "LOYALTY_CARD" - ], - "description": "Defines the type of voucher. " - }, - "discount": { - "default": null, - "description": "Object representing discount parameters. Child attributes are present only if `type` is `DISCOUNT_VOUCHER`. Defaults to `null`.", - "type": "null" - }, - "gift": { - "type": "null", - "description": "Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`." - }, - "loyalty_card": { - "type": "object", - "description": "Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`.", - "properties": { - "points": { - "type": "integer", - "example": 7000, - "description": "Total points incurred over lifespan of loyalty card." - }, - "balance": { - "type": "integer", - "example": 6970, - "description": "Points available for reward redemption." - }, - "next_expiration_date": { - "type": "string", - "format": "date", - "example": "2023-05-30", - "description": "The next closest date when the next set of points are due to expire." - }, - "next_expiration_points": { - "type": "integer", - "description": "The amount of points that are set to expire next." - } - } - }, - "start_date": { - "type": "string", - "example": "2021-12-01T00:00:00.000Z", - "format": "date-time", - "description": "Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. " - }, - "expiration_date": { - "type": "string", - "example": "2021-12-31T00:00:00.000Z", - "format": "date-time", - "description": "Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the voucher is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "example": "PT1H", - "description": "Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a `duration` of `PT1H` will be valid for a duration of one hour." - }, - "interval": { - "type": "string", - "example": "P2D", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an `interval` of `P2D` will be active every other day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "enum": [ - [ - 0 - ], - [ - 1 - ], - [ - 2 - ], - [ - 3 - ], - [ - 4 - ], - [ - 5 - ], - [ - 6 + "7_obj_rollback_redemption_object_extended": { + "title": "Rollback Redemption Object", + "description": "This is an object representing an attempted or successful voucher or promotion tier rollback.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_rollback_redemption_object_discount_voucher_extended" + }, + { + "$ref": "#/components/schemas/7_obj_rollback_redemption_object_loyalty_card_extended" + }, + { + "$ref": "#/components/schemas/7_obj_rollback_redemption_object_gift_card_extended" + }, + { + "$ref": "#/components/schemas/7_obj_rollback_redemption_object_promotion_tier_extended" + } ] - ], - "description": "Integer array corresponding to the particular days of the week in which the voucher is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" - }, - "additional_info": { - "type": "string", - "description": "An optional field to keep any extra textual information about the code such as a code description and details." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - }, - "assets": { - "type": "object", - "description": "Stores links to images of QR and barcode that correspond to an encrypted voucher code.", - "properties": { - "qr": { - "type": "object", - "description": "Stores Quick Response (QR) representation of encrypted code.", - "properties": { - "id": { - "type": "string", - "example": "U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK+t4pp7U7oFzjGJzj9q/bmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg+BaZk5QwXMf8k/OzSlOEVybpwSq+AiqPoNtjeuqtIgkDyvT6Q==", - "description": "Encrypted voucher code ID." - }, - "url": { - "type": "string", - "example": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK%2Bt4pp7U7oFzjGJzj9q%2FbmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg%2BBaZk5QwXMf8k%2FOzSlOEVybpwSq%2BAiqPoNtjeuqtIgkDyvT6Q%3D%3D", - "description": "URL to QR code \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" + }, + "7_obj_rollback_redemption_object_discount_voucher_extended": { + "type": "object", + "title": "Discount Voucher", + "description": "This is an object representing a redemption.", + "properties": { + "id": { + "type": "string", + "example": "rr_0bc92f81a6801f9bca", + "description": "Unique rollback redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", + "default": "redemption_rollback" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "redemption": { + "type": "string", + "description": "The unique redemption ID of the initial redemption.", + "example": "r_0c5d6689b35320059a" + }, + "reason": { + "type": "string", + "description": "The reason for the redemption rollback." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "$ref": "#/components/schemas/7_obj_order_object_rollback" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption rollback was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } } - } - }, - "barcode": { - "type": "object", - "description": "Stores barcode representation of encrypted code.", - "properties": { - "id": { - "type": "string", - "example": "U2FsdGVkX19eJhGfWwUrH9+tulBkON+AnMktic+N6CVWzZ9+fHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ+kJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6/pFs61apEn9SJx32ttCF6d3oxKISQQ==", - "description": "Encrypted voucher code ID." - }, - "url": { - "type": "string", - "example": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19eJhGfWwUrH9%2BtulBkON%2BAnMktic%2BN6CVWzZ9%2BfHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ%2BkJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6%2FpFs61apEn9SJx32ttCF6d3oxKISQQ%3D%3D", - "description": "URL to barcode \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Defines the details of the voucher being redeemed." } } - } - }, - "is_referral_code": { - "type": "boolean", - "description": "Flag indicating whether this voucher is a referral code." - }, - "created_at": { - "type": "string", - "example": "2021-12-22T10:13:06.487Z", - "description": "Timestamp representing the date and time when the voucher was created in ISO 8601 format.", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "example": "2021-12-22T10:14:45.316Z", - "format": "date-time", - "description": "Timestamp representing the date and time when the voucher was last updated in ISO 8601 format." - }, - "holder_id": { - "type": "string", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "description": "Unique customer ID of voucher owner." - }, - "redemption": { - "type": "object", - "description": "Stores a summary of redemptions that have been applied to the voucher.", - "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited." - }, - "redeemed_quantity": { - "type": "integer", - "example": 1, - "description": "How many times a voucher has already been redeemed." - }, - "redeemed_points": { - "type": "integer", - "example": 100000, - "description": "Total loyalty points redeemed." - }, - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute." - }, - "url": { - "type": "string", - "example": "/v1/vouchers/WVPblOYX/redemptions?page=1&limit=10", - "description": "The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`" - } - } - }, - "publish": { - "type": "object", - "description": "This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or publish voucher API method. \n\n\n\n| Required | Optional |\n| -------- | :------: |\n| `type`:`LOYALTY_CARD` | `type`:`DISCOUNT_VOUCHER` | \n| `is_referral_code`:`true` | `type`:`GIFT_VOUCHER` |\n", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute." - }, - "count": { - "type": "integer", - "example": 0, - "description": "Publication events counter." - }, - "url": { - "type": "string", - "example": "/v1/vouchers/WVPblOYX/publications?page=1&limit=10", - "description": "The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`" - } - } - }, - "object": { - "type": "string", - "description": "The type of object represented by JSON. Default is `voucher`.", - "default": "voucher" - } - }, - "x-tags": [ - "LOYALTIES API" - ] - }, - "8_obj_loyalty_reward_object": { - "title": "Loyalty Reward Object", - "type": "object", - "description": "This is an object representing a loyalty reward.", - "x-tags": [ - "LOYALTIES API" - ], - "properties": { - "reward": { - "$ref": "#/components/schemas/4_obj_reward_object" - }, - "assignment": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" - }, - "object": { - "type": "string", - "default": "loyalty_reward", - "description": "The type of object represented by JSON. This object stores information about the loyalty reward object." - } - } - }, - "8_obj_loyalty_points_bucket": { - "type": "object", - "title": "Loyalty Points Bucket Object", - "description": "This is an object representing a loyalty points bucket.", - "properties": { - "id": { - "type": "string", - "example": "lopb_zdeIBq3EsnPnRSDa7Tyyb6X2", - "description": "Unique loyalty points bucket ID." - }, - "voucher_id": { - "type": "string", - "example": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", - "description": "Unique parent loyalty card ID." - }, - "campaign_id": { - "type": "string", - "example": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "description": "Unique parent campaign ID." - }, - "bucket": { - "type": "object", - "description": "Defines the number of points stored in the given loyalty points bucket.", - "properties": { - "total_points": { - "type": "integer", - "description": "Total number of points in the loyalty points bucket." - } - } - }, - "status": { - "type": "string", - "enum": [ - "ACTIVE" - ], - "description": "Loyalty points bucket point status." - }, - "expires_at": { - "type": "string", - "example": "2022-11-30", - "format": "date", - "description": "Date when the number of points defined in the `bucket` object are due to expire." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-11-21T13:49:54.949Z", - "description": "Timestamp representing the date and time when the loyalty points bucket object was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "example": "2022-08-30T08:34:45.989Z", - "format": "date-time", - "description": "Timestamp representing the date and time when the loyalty points bucket object was updated in ISO 8601 format." - }, - "object": { - "type": "string", - "default": "loyalty_points_bucket", - "description": "The type of object represented by JSON. This object stores information about the loyalty points bucket." - } - } - }, - "8_obj_loyalty_tier_reward_object": { - "title": "Loyalty Tier Reward Object", - "type": "object", - "description": "This is an object representing a loyalty tier reward.", - "x-tags": [ - "LOYALTIES API" - ], - "properties": { - "reward": { - "$ref": "#/components/schemas/4_obj_reward_object" - }, - "assignment": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" - }, - "object": { - "type": "string", - "default": "loyalty_tier_reward", - "description": "The type of object represented by JSON. This object stores information about the loyalty tier reward." - } - } - }, - "8_obj_loyalty_card_object_non_expanded_categories": { - "title": "Loyalty Card Object", - "type": "object", - "description": "This is an object representing a loyalty card.", - "examples": [ - { - "id": "v_hrMBBeT4sOP9VSGPmj5KAgJwX202UjiY", - "code": "LOYALTY-CARD-xLPbpbXR", - "campaign": "Loyalty Program Fall 2022", - "campaign_id": "camp_f7fBbQxUuTN7dI7tGOo5XMDA", - "category": "First", - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" - } - ], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 110, - "balance": 100, - "next_expiration_date": "2023-12-31", - "next_expiration_points": 100 }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8/6I6hUEqtz/F6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD/DjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8%2F6I6hUEqtz%2FF6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD%2FDjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/SpYuOrU9wd6/o1wzy6E/04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ/FJtiw69djuzQk1f4HdQo8s5gaZ7fd2U+1zbaeAvi9usyvRHZE4=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FSpYuOrU9wd6%2Fo1wzy6E%2F04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ%2FFJtiw69djuzQk1f4HdQo8s5gaZ7fd2U%2B1zbaeAvi9usyvRHZE4%3D" + "7_obj_rollback_redemption_object_loyalty_card_extended": { + "type": "object", + "title": "Loyalty Card Voucher", + "description": "This is an object representing a loyalty card rollback redemption.", + "properties": { + "id": { + "type": "string", + "example": "rr_0bc92f81a6801f9bca", + "description": "Unique redemption rollback ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", + "default": "redemption_rollback" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "amount": { + "type": "integer", + "description": "Number of points being returned to the loyalty card." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the initial redemption.", + "example": "r_0b56726b09cfb73e84" + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "$ref": "#/components/schemas/7_obj_order_object_rollback" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption rollback was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the reward.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object. i.e. `voucher`.", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Defines the details of the voucher being redeemed." + }, + "reward": { + "description": "Defines the reward being redeemed.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" + } + ] + }, + "loyalty_card": { + "type": "object", + "description": "Stores the number of points being added back to the loyalty card for the reward redemption rollback.", + "properties": { + "points": { + "type": "integer", + "description": "Number of points being returned to the loyalty card for the reward redemption rollback." + } + } + } } }, - "is_referral_code": false, - "created_at": "2022-09-19T07:56:22.355Z", - "updated_at": "2022-09-19T08:04:22.458Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 1, - "redeemed_points": 10, - "object": "list", - "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/publications?page=1&limit=10" - }, - "object": "voucher" - } - ], - "properties": { - "id": { - "type": "string", - "example": "v_mkZN9v7vjYUadXnHrMza8W5c34fE5KiV", - "description": "Assigned by the Voucherify API, identifies the voucher." - }, - "code": { - "type": "string", - "example": "WVPblOYX", - "description": "A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters." - }, - "campaign": { - "type": "string", - "example": "Loyalty Card Campaign", - "description": "A unique campaign name, identifies the voucher's parent campaign." - }, - "campaign_id": { - "type": "string", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "description": "Assigned by the Voucherify API, identifies the voucher's parent campaign." - }, - "category": { - "type": "string", - "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint." - }, - "category_id": { - "type": "string", - "description": "Unique category ID assigned by Voucherify.", - "example": "cat_0bb343dee3cdb5ec0c" - }, - "categories": { - "type": "array", - "description": "Contains details about the category.", - "items": { - "$ref": "#/components/schemas/20_obj_category_object" - } - }, - "type": { - "type": "string", - "enum": [ - "LOYALTY_CARD" - ], - "description": "Defines the type of voucher. " - }, - "discount": { - "default": null, - "description": "Object representing discount parameters. Child attributes are present only if `type` is `DISCOUNT_VOUCHER`. Defaults to `null`.", - "type": "null" - }, - "gift": { - "type": "null", - "description": "Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`." - }, - "loyalty_card": { - "type": "object", - "description": "Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`.", - "properties": { - "points": { - "type": "integer", - "example": 7000, - "description": "Total points incurred over lifespan of loyalty card." - }, - "balance": { - "type": "integer", - "example": 6970, - "description": "Points available for reward redemption." - }, - "next_expiration_date": { - "type": "string", - "format": "date", - "example": "2023-05-30", - "description": "The next closest date when the next set of points are due to expire." - }, - "next_expiration_points": { - "type": "integer", - "description": "The amount of points that are set to expire next." - } - } - }, - "start_date": { - "type": "string", - "example": "2021-12-01T00:00:00.000Z", - "format": "date-time", - "description": "Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. " - }, - "expiration_date": { - "type": "string", - "example": "2021-12-31T00:00:00.000Z", - "format": "date-time", - "description": "Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the voucher is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "example": "PT1H", - "description": "Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a `duration` of `PT1H` will be valid for a duration of one hour." - }, - "interval": { - "type": "string", - "example": "P2D", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an `interval` of `P2D` will be active every other day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "enum": [ - [ - 0 - ], - [ - 1 - ], - [ - 2 - ], - [ - 3 - ], - [ - 4 - ], - [ - 5 - ], - [ - 6 - ] - ], - "description": "Integer array corresponding to the particular days of the week in which the voucher is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" - }, - "additional_info": { - "type": "string", - "description": "An optional field to keep any extra textual information about the code such as a code description and details." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - }, - "assets": { - "type": "object", - "description": "Stores links to images of QR and barcode that correspond to an encrypted voucher code.", - "properties": { - "qr": { - "type": "object", - "description": "Stores Quick Response (QR) representation of encrypted code.", - "properties": { - "id": { - "type": "string", - "example": "U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK+t4pp7U7oFzjGJzj9q/bmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg+BaZk5QwXMf8k/OzSlOEVybpwSq+AiqPoNtjeuqtIgkDyvT6Q==", - "description": "Encrypted voucher code ID." - }, - "url": { - "type": "string", - "example": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK%2Bt4pp7U7oFzjGJzj9q%2FbmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg%2BBaZk5QwXMf8k%2FOzSlOEVybpwSq%2BAiqPoNtjeuqtIgkDyvT6Q%3D%3D", - "description": "URL to QR code \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" + "7_obj_rollback_redemption_object_gift_card_extended": { + "type": "object", + "title": "Gift Card", + "description": "This is an object representing a gift card rollback redemption.", + "properties": { + "id": { + "type": "string", + "example": "rr_0bc92f81a6801f9bca", + "description": "Unique redemption rollback ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", + "default": "redemption_rollback" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "amount": { + "type": "integer", + "description": "The amount credited back to the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the initial redemption.", + "example": "r_0b56726b09cfb73e84" + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "$ref": "#/components/schemas/7_obj_order_object_rollback" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption rollback was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } } - } - }, - "barcode": { - "type": "object", - "description": "Stores barcode representation of encrypted code.", - "properties": { - "id": { - "type": "string", - "example": "U2FsdGVkX19eJhGfWwUrH9+tulBkON+AnMktic+N6CVWzZ9+fHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ+kJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6/pFs61apEn9SJx32ttCF6d3oxKISQQ==", - "description": "Encrypted voucher code ID." - }, - "url": { - "type": "string", - "example": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19eJhGfWwUrH9%2BtulBkON%2BAnMktic%2BN6CVWzZ9%2BfHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ%2BkJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6%2FpFs61apEn9SJx32ttCF6d3oxKISQQ%3D%3D", - "description": "URL to barcode \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the gift card.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Defines the details of the voucher being redeemed." + }, + "gift": { + "type": "object", + "description": "Contains the amount being added back to the gift card for the redemption rollback.", + "properties": { + "amount": { + "type": "integer", + "description": "The amount added back on the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." + } } } } - } - }, - "is_referral_code": { - "type": "boolean", - "description": "Flag indicating whether this voucher is a referral code." - }, - "created_at": { - "type": "string", - "example": "2021-12-22T10:13:06.487Z", - "description": "Timestamp representing the date and time when the voucher was created in ISO 8601 format.", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "example": "2021-12-22T10:14:45.316Z", - "format": "date-time", - "description": "Timestamp representing the date and time when the voucher was last updated in ISO 8601 format." - }, - "holder_id": { - "type": "string", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "description": "Unique customer ID of voucher owner." - }, - "redemption": { - "type": "object", - "description": "Stores a summary of redemptions that have been applied to the voucher.", - "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited." - }, - "redeemed_quantity": { - "type": "integer", - "example": 1, - "description": "How many times a voucher has already been redeemed." - }, - "redeemed_points": { - "type": "integer", - "example": 100000, - "description": "Total loyalty points redeemed." - }, - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute." - }, - "url": { - "type": "string", - "example": "/v1/vouchers/WVPblOYX/redemptions?page=1&limit=10", - "description": "The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`" - } - } - }, - "publish": { - "type": "object", - "description": "This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or publish voucher API method. \n\n\n\n| Required | Optional |\n| -------- | :------: |\n| `type`:`LOYALTY_CARD` | `type`:`DISCOUNT_VOUCHER` | \n| `is_referral_code`:`true` | `type`:`GIFT_VOUCHER` |\n", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute." - }, - "count": { - "type": "integer", - "example": 0, - "description": "Publication events counter." - }, - "url": { - "type": "string", - "example": "/v1/vouchers/WVPblOYX/publications?page=1&limit=10", - "description": "The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`" - } - } - }, - "object": { - "type": "string", - "description": "The type of object represented by JSON. Default is `voucher`.", - "default": "voucher" - } - } - }, - "8_res_get_loyalty_card_transactions": { - "title": "Get Loyalty Card Transactions Response Body", - "type": "object", - "description": "List of loyalty card transactions", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of transaction objects." - }, - "data": { - "type": "array", - "description": "A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object.", - "items": { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object" - } - }, - "has_more": { - "type": "boolean", - "description": "As query results are always limited (by the limit parameter), the `has_more` flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results." - } - } - }, - "1_obj_loyalty_card_transaction_object": { - "title": "Loyalty Card Transaction Object", - "description": "Loyalty card transaction object", - "anyOf": [ - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_redemption" - }, - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_accrual" - }, - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_accrual_custom_event" - }, - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_refund" - }, - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_addition" - }, - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_removal" - }, - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_expiration" - }, - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_transfer_out" - }, - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_transfer_in" - } - ] - }, - "1_obj_loyalty_card_transaction_object_redemption": { - "title": "Redemption", - "description": "When loyalty points are used to pay for an order.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is `null`." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "source": { - "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is `null`." - }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred. In case of a redemption, this value is `null`." - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "POINTS_REDEMPTION", - "enum": [ - "POINTS_REDEMPTION" - ] - }, - "details": { - "type": "object", - "description": "Contains the detailed information about the transaction.", - "properties": { - "balance": { - "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", - "properties": { - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "loyalty_card" - }, - "total": { - "type": "integer", - "description": "The available points prior to the transaction." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, - "points": { - "type": "integer", - "description": "The amount of points being used up in the transaction." - }, - "balance": { - "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." - }, - "related_object": { - "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "type": { - "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" - } + }, + "7_obj_rollback_redemption_object_promotion_tier_extended": { + "type": "object", + "title": "Promotion Tier", + "description": "This is an object representing a promotion tier rollback redemption.", + "properties": { + "id": { + "type": "string", + "example": "rr_0bc92f81a6801f9bca", + "description": "Unique redemption rollback ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the initial redemption.", + "example": "r_0b56726b09cfb73e84" + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "$ref": "#/components/schemas/7_obj_order_object_rollback" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption rollback was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the rollback redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } } - } - }, - "order": { - "type": "object", - "description": "Contains information about the original order.", - "properties": { - "id": { - "type": "string", - "description": "Unique order ID.", - "example": "ord_jj5EzDxDOd2xFPsAJJ18IaZK" - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - } - } - }, - "redemption": { - "type": "object", - "description": "Contains information about the original redemption.", - "properties": { - "id": { - "type": "string", - "description": "Unique redemption ID.", - "example": "r_0c94ed583fcafc31c1" - } - } - }, - "reward": { - "type": "object", - "description": "Contains information about the pay with points reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique reward ID.", - "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1" - }, - "name": { - "type": "string", - "description": "Reward name.", - "example": "100 = $20" + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } } - } - } - } - }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of this type of transaction." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." - } - } - }, - "1_obj_loyalty_card_transaction_object_accrual": { - "title": "Accrual", - "description": "When points are earned on the card through an earning rule.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a points accrual, this value is `null`." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "source": { - "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", - "enum": [ - "Automation" - ] - }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred. In case of a points accrual, this value is `null`." - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "POINTS_ACCRUAL", - "enum": [ - "POINTS_ACCRUAL" - ] - }, - "details": { - "type": "object", - "description": "Contains the detailed information about the transaction.", - "properties": { - "balance": { - "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", - "properties": { - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "loyalty_card" - }, - "total": { - "type": "integer", - "description": "The available points after the transaction." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, - "points": { - "type": "integer", - "description": "The amount of points being added in the transaction." - }, - "balance": { - "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." - }, - "related_object": { - "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "type": { - "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.", + "enum": [ + "promotion_tier" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." + }, + "voucher": { + "type": "null" + }, + "promotion_tier": { + "type": "object", + "description": "Contains details of the promotion tier and the parent campaign.", + "properties": { + "id": { + "type": "string", + "description": "Unique promotion tier ID assigned by Voucherify.", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" + }, + "campaign": { + "type": "object", + "description": "Promotion tier's parent campaign.", + "properties": { + "id": { + "type": "string", + "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." + } } } } } - }, - "order": { - "type": "object", - "description": "Contains information about the original order.", - "properties": { - "id": { - "type": "string", - "description": "Unique order ID.", - "example": "ord_jj5EzDxDOd2xFPsAJJ18IaZK" - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + } + }, + "7_obj_redemption_object_discount_voucher": { + "type": "object", + "title": "Discount Voucher", + "description": "This is an object representing a redemption. \n\nRedemption 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](rollback-redemption).", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the parent redemption if this particular redemption was issued through a stacked redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } } - } - }, - "event": { - "type": "object", - "description": "Contains information about the event that triggers the point accrual.", - "properties": { - "id": { - "type": "string", - "description": "Unique event ID.", - "example": "evcus_0c9c21def34e3c05bf" - }, - "type": { - "type": "string", - "description": "Type of event.", - "example": "customer.order.paid" + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } } - } - }, - "earning_rule": { - "type": "object", - "description": "Contains information about the earning rule.", - "properties": { - "id": { - "type": "string", - "description": "Unique earning rule ID.", - "example": "ern_2WsCIBEx6Lzf5IAV5IOR7a23" - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name.", - "properties": { - "banner": { - "type": "string", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "type": "object", + "description": "Defines the details of the voucher being redeemed.", + "properties": { + "id": { + "type": "string", + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" } } } } - } - }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of this type of transaction." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." - } - } - }, - "1_obj_loyalty_card_transaction_object_accrual_custom_event": { - "title": "Accrual for Custom Event", - "description": "When points are earned on the card through an earning rule based on a custom event.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a points accrual, this value is `null`." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "source": { - "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", - "enum": [ - "Automation" - ] - }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred. In case of a points accrual, this value is `null`." - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "POINTS_ACCRUAL", - "enum": [ - "POINTS_ACCRUAL" - ] - }, - "details": { - "type": "object", - "description": "Contains the detailed information about the transaction.", - "properties": { - "balance": { - "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", - "properties": { - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "loyalty_card" - }, - "total": { - "type": "integer", - "description": "The available points after the transaction." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, - "points": { - "type": "integer", - "description": "The amount of points being added in the transaction." - }, - "balance": { - "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." - }, - "related_object": { - "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "type": { - "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" - } + }, + "7_obj_redemption_rollback_object_discount_voucher": { + "type": "object", + "title": "Rollback Discount Voucher", + "description": "This is an object representing a redemption rollback for a discount voucher.", + "properties": { + "id": { + "type": "string", + "example": "rr_0c5eba630bc4979e70", + "description": "Unique redemption rollback ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", + "default": "redemption_rollback" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the original redemption." + }, + "reason": { + "type": "string", + "description": "The reason for the redemption rollback." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "$ref": "#/components/schemas/7_obj_order_object_rollback" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption rollback was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } } - } - }, - "event": { - "type": "object", - "description": "Contains information about the customer event that triggers the point accrual.", - "properties": { - "id": { - "type": "string", - "description": "Unique event ID.", - "example": "evcus_0c9c21def34e3c05bf" - }, - "type": { - "type": "string", - "description": "Type of event.", - "example": "customer.custom_event" + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } } - } - }, - "earning_rule": { - "type": "object", - "description": "Contains information about the earning rule.", - "properties": { - "id": { - "type": "string", - "description": "Unique earning rule ID.", - "example": "ern_2WsCIBEx6Lzf5IAV5IOR7a23" - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name.", - "properties": { - "banner": { - "type": "string", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "type": "object", + "description": "Defines the details of the voucher being redeemed.", + "properties": { + "id": { + "type": "string", + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" } } } - }, - "custom_event": { - "type": "object", - "description": "Contains information about the custom event that triggers the point accrual.", - "properties": { - "id": { - "type": "string", - "description": "Unique event ID.", - "example": "event_0cc916d8374bfe8bc2" - }, - "type": { - "type": "string", - "description": "Type of custom event.", - "example": "user_subscribed" + } + }, + "7_obj_redemption_rollback_object_loyalty_card": { + "type": "object", + "title": "Rollback Loyalty Card Voucher", + "description": "This is an object representing a redemption rollback for a loyalty card.", + "properties": { + "id": { + "type": "string", + "example": "rr_0c5eaf4060133bf784", + "description": "Unique redemption rollback ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", + "default": "redemption_rollback" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "amount": { + "type": "integer", + "description": "Number of points being returned to the loyalty card." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the original redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "$ref": "#/components/schemas/7_obj_order_object_rollback" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption rollback was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } } - } - }, - "event_schema": { - "type": "object", - "description": "Contains information about the custom event metadata schema.", - "properties": { - "id": { - "type": "string", - "description": "Unique metadata schema ID.", - "example": "ms_qpRZ3EmRQyszNH6Z52Gkq8au" - }, - "type": { - "type": "string", - "description": "Type of custom event.", - "example": "user_subscribed" + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the reward.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object. i.e. `voucher`.", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "type": "object", + "description": "Defines the details of the voucher being redeemed.", + "properties": { + "id": { + "type": "string", + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + } + } + }, + "reward": { + "description": "Defines the reward that was initially redeemed.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" + } + ] + }, + "loyalty_card": { + "type": "object", + "description": "Stores the number of points being added back to the loyalty card for the reward redemption rollback.", + "properties": { + "points": { + "type": "integer", + "description": "Number of points being added back to the loyalty card for the reward redemption rollback." + } } } } - } - }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of this type of transaction." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." - } - } - }, - "1_obj_loyalty_card_transaction_object_refund": { - "title": "Refund", - "description": "When points are credited back to a card through a redemption rollback.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a points refund, this value is `null`." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "source": { - "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a points refund, this value is `null`." - }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred. In case of a points refund, this value is `null`." - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "POINTS_REFUND", - "enum": [ - "POINTS_REFUND" - ] - }, - "details": { - "type": "object", - "description": "Contains the detailed information about the transaction.", - "properties": { - "balance": { - "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", - "properties": { - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "loyalty_card" - }, - "total": { - "type": "integer", - "description": "The available points after the transaction." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, - "points": { - "type": "integer", - "description": "The amount of points being added in the transaction." - }, - "balance": { - "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." - }, - "related_object": { - "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "type": { - "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" - } + }, + "7_obj_redemption_object_loyalty_card": { + "type": "object", + "title": "Loyalty Card Voucher", + "description": "This is an object representing a redemption. \n\nRedemption 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](rollback-redemption).", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the redemption.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "amount": { + "type": "integer", + "description": "Number of points being redeemed for a reward." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the parent redemption if this particular redemption was issued through a stacked redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } } - } - }, - "order": { - "type": "object", - "description": "Contains information about the original order.", - "properties": { - "id": { - "type": "string", - "description": "Unique order ID.", - "example": "ord_jj5EzDxDOd2xFPsAJJ18IaZK" - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the reward.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } } - } - }, - "redemption": { - "type": "object", - "description": "Contains information about the original redemption.", - "properties": { - "id": { - "type": "string", - "description": "Unique redemption ID.", - "example": "r_0c94ed583fcafc31c1" + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object. i.e. `voucher`.", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "type": "object", + "description": "Defines the details of the voucher being redeemed.", + "properties": { + "id": { + "type": "string", + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + } } - } - }, - "rollback": { - "type": "object", - "description": "Contains information about the redemption rollback.", - "properties": { - "id": { - "type": "string", - "description": "Unique redemption rollback ID.", - "example": "rr_0c9b0967244a862a33" - } - } - }, - "reward": { - "type": "object", - "description": "Contains information about the pay with points reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique reward ID.", - "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1" - }, - "name": { - "type": "string", - "description": "Reward name.", - "example": "100 = $20" + }, + "reward": { + "description": "Defines the reward being redeemed.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" + } + ] + }, + "loyalty_card": { + "type": "object", + "description": "Stores the number of points being subtracted from the loyalty card for the reward redemption.", + "properties": { + "points": { + "type": "integer", + "description": "Number of points being subtracted from the loyalty card for the reward redemption." + } } } } - } - }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of this type of transaction." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." - } - } - }, - "1_obj_loyalty_card_transaction_object_addition": { - "title": "Addition", - "description": "When points are added to a card.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "source": { - "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", - "enum": [ - "voucherify-web-ui", - "API" - ] - }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred." - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "POINTS_ADDITION", - "enum": [ - "POINTS_ADDITION" - ] - }, - "details": { - "type": "object", - "description": "Contains the detailed information about the transaction.", - "properties": { - "balance": { - "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", - "properties": { - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "loyalty_card" - }, - "total": { - "type": "integer", - "description": "The available points after the transaction." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, - "points": { - "type": "integer", - "description": "The amount of points being added in the transaction." - }, - "balance": { - "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." - }, - "related_object": { - "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "type": { - "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" - } + }, + "7_obj_redemption_object_loyalty_card_pay_with_points": { + "type": "object", + "description": "Defines the pay with points reward redeemed for the particular loyalty card.", + "properties": { + "customer": { + "type": "object", + "description": "Defines the customer redeeming the reward.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" } } - } - } - } - }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of this type of transaction." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." - } - } - }, - "1_obj_loyalty_card_transaction_object_removal": { - "title": "Removal", - "description": "When points are removed from a card.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "source": { - "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", - "enum": [ - "voucherify-web-ui", - "API" - ] - }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred." - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "POINTS_REMOVAL", - "enum": [ - "POINTS_REMOVAL" - ] - }, - "details": { - "type": "object", - "description": "Contains the detailed information about the transaction.", - "properties": { - "balance": { - "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", - "properties": { - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "loyalty_card" - }, - "total": { - "type": "integer", - "description": "The available points after the transaction." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, - "points": { - "type": "integer", - "description": "The amount of points being subtracted in the transaction." - }, - "balance": { - "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." - }, - "related_object": { - "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "type": { - "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" + }, + "assignment_id": { + "type": "string", + "example": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", + "description": "Unique reward assginment ID assigned by Voucherify." + }, + "id": { + "type": "string", + "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "description": "Unique reward ID assigned by Voucherify." + }, + "object": { + "type": "string", + "default": "reward", + "description": "Type of object represented is `reward`." + }, + "name": { + "type": "string", + "description": "Reward name." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the reward was created." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the reward was updated." + }, + "parameters": { + "type": "object", + "description": "These are parameters representing a Pay with Points (COIN) reward.", + "properties": { + "coin": { + "type": "object", + "description": "Defines the ratio by mapping the number of loyalty points in `points_ratio` to a predefined cash amount in `exchange_ratio`.", + "properties": { + "exchange_ratio": { + "type": "integer", + "description": "The cash equivalent of the points defined in the `points_ratio` property." + }, + "points_ratio": { + "type": "integer", + "description": "The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property." + } } } } + }, + "type": { + "type": "string", + "description": "Reward type", + "enum": [ + "COIN" + ] } - } - } - }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of this type of transaction." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." - } - } - }, - "1_obj_loyalty_card_transaction_object_expiration": { - "title": "Expiration", - "description": "When points expire.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a points expiration, this value is `null`." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "source": { - "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", - "enum": [ - "Automation" - ] - }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred. In case of a points expiration, this value is `null`." - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "POINTS_EXPIRATION", - "enum": [ - "POINTS_EXPIRATION" - ] - }, - "details": { - "type": "object", - "description": "Contains the detailed information about the transaction.", - "properties": { - "balance": { - "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", - "properties": { - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "loyalty_card" - }, - "total": { - "type": "integer", - "description": "The available points after the transaction." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, - "points": { - "type": "integer", - "description": "The amount of points removed during the transaction." - }, - "balance": { - "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." - }, - "related_object": { - "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "type": { - "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" - } + }, + "title": "Pay with Points Reward" + }, + "7_obj_redemption_object_loyalty_card_material_product": { + "type": "object", + "description": "Defines the product material reward redeemed for the particular loyalty card.", + "properties": { + "customer": { + "type": "object", + "description": "Defines the customer redeeming the reward.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" } } - } - } - } - }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of this type of transaction." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." - } - } - }, - "1_obj_loyalty_card_transaction_object_transfer_out": { - "title": "Transfer Out", - "description": "When points are transferred from one loyalty card to another.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "source": { - "type": "string", - "description": "The channel through which the transaction took place.", - "enum": [ - "API" - ] - }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred." - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "POINTS_TRANSFER_OUT", - "enum": [ - "POINTS_TRANSFER_OUT" - ] - }, - "details": { - "type": "object", - "description": "Contains the detailed information about the transaction.", - "properties": { - "balance": { - "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", - "properties": { - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "loyalty_card" - }, - "total": { - "type": "integer", - "description": "The available points after the transaction." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, - "points": { - "type": "integer", - "description": "The amount of points being subtracted in the transaction." - }, - "balance": { - "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." - }, - "related_object": { - "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "type": { - "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" + }, + "assignment_id": { + "type": "string", + "example": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", + "description": "Unique reward assginment ID assigned by Voucherify." + }, + "product": { + "description": "Details of the product redeemed as a reward.", + "$ref": "#/components/schemas/11_obj_product_object_truncated" + }, + "id": { + "type": "string", + "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "description": "Unique reward ID assigned by Voucherify." + }, + "object": { + "type": "string", + "default": "reward", + "description": "Type of object represented is `reward`." + }, + "name": { + "type": "string", + "description": "Reward name." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the reward was created." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the reward was updated." + }, + "parameters": { + "type": "object", + "description": "These are parameters representing a material reward.", + "properties": { + "product": { + "type": "object", + "description": "Defines the product redeemed as a reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique product ID assignedy by Voucherify of the product.", + "example": "prod_0b2c2ddf35150b83bb" + }, + "sku_id": { + "type": "null" + } } } } + }, + "type": { + "type": "string", + "description": "Reward type", + "enum": [ + "MATERIAL" + ] } }, - "destination_voucher": { - "type": "object", - "description": "Contains information on how the balance on the receiving loyalty card was affected by the transaction.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the destination voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "code": { - "type": "string", - "description": "Unique code of the destination voucher.", - "example": "LOYALTY-CARD-A8XVurg" - }, - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "LOYALTY_CARD" - }, - "campaign": { - "type": "string", - "description": "Unqiue campaign name of the voucher's parent campaign." - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "loyalty_card": { - "type": "object", - "description": "Contains information on how the balance on the receiving loyalty card was affected by the transaction.", - "properties": { - "points": { - "type": "integer", - "description": "The total amount of points after the transaction." - }, - "balance": { - "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." - }, - "next_expiration_date": { - "type": "string", - "description": "The date when the next set of points are due to expire, i.e. `YYYY-MM-DD`. This does not mean that the transferred points were added to this bucket. It only shows the next set of points due to expire. The transferred points are added to the last expiring bucket, i.e. to the bucket of points that are to expire the furthest in the future.", - "example": "2023-12-31" - }, - "next_expiration_points": { - "type": "integer", - "description": "The number of points due to expire on the next expiration date." - } - } - }, - "is_referral_code": { - "type": "integer", - "description": "Flag indicating whether this voucher is a referral code." - } - } - } - } - }, - "related_transaction_id": { - "type": "string", - "description": "The related transaction ID on the receiving card.", - "example": "vtx_0c9afe802593b34b81" - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." - } - } - }, - "1_obj_loyalty_card_transaction_object_transfer_in": { - "title": "Transfer In", - "description": "When points are transferred in from another loyalty card.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a ponits transfer, this value is `null`." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "source": { - "type": "string", - "description": "The channel through which the transaction took place.", - "enum": [ - "API" - ] - }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred." - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "POINTS_TRANSFER_IN", - "enum": [ - "POINTS_TRANSFER_IN" - ] - }, - "details": { - "type": "object", - "description": "Contains the detailed information about the transaction.", - "properties": { - "balance": { - "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", - "properties": { - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "loyalty_card" - }, - "total": { - "type": "integer", - "description": "The available points after the transaction." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, - "points": { - "type": "integer", - "description": "The amount of points being added in the transaction." - }, - "balance": { - "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." - }, - "related_object": { - "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "type": { - "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" + "title": "Product Material Reward" + }, + "7_obj_redemption_object_loyalty_card_material_sku": { + "type": "object", + "description": "Defines the SKU material reward redeemed for the particular loyalty card.", + "properties": { + "customer": { + "type": "object", + "description": "Defines the customer redeeming the reward.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "assignment_id": { + "type": "string", + "example": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", + "description": "Unique reward assginment ID assigned by Voucherify." + }, + "product": { + "description": "Details of the SKU's parent product redeemed as a reward.", + "$ref": "#/components/schemas/11_obj_product_object_truncated" + }, + "sku": { + "description": "Details of the SKU redeemed as a reward.", + "$ref": "#/components/schemas/11_obj_sku_object" + }, + "id": { + "type": "string", + "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "description": "Unique reward ID assigned by Voucherify." + }, + "object": { + "type": "string", + "default": "reward", + "description": "Type of object represented is `reward`." + }, + "name": { + "type": "string", + "description": "Reward name." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the reward was created." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the reward was updated." + }, + "parameters": { + "type": "object", + "description": "These are parameters representing a material reward.", + "properties": { + "product": { + "type": "object", + "description": "Defines the SKU redeemed as a reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique product ID assignedy by Voucherify of the SKU's parent." + }, + "sku_id": { + "type": "string", + "description": "Unique SKU ID assigned by Voucherify of the SKU redeemed as a reward." + } } } } + }, + "type": { + "type": "string", + "description": "Reward type", + "enum": [ + "MATERIAL" + ] } }, - "source_voucher": { - "type": "object", - "description": "Contains information on how the balance on the donor loyalty card was affected by the transaction.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the source voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "code": { - "type": "string", - "description": "Unique code of the source voucher.", - "example": "LOYALTY-CARD-A8XVurg" - }, - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "LOYALTY_CARD" - }, - "campaign": { - "type": "string", - "description": "Unqiue campaign name of the voucher's parent campaign." - }, - "holder_id": { - "type": "string", - "description": "Unqiue customer ID of the loyalty card holder, this is the ID that was assigned by the Voucherify API.", - "example": "cust_xqA7DGj5eYPHg6PHVKwYRWiA" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "loyalty_card": { - "type": "object", - "description": "Contains information on how the balance on the source loyalty card was affected by the transaction.", - "properties": { - "points": { - "type": "integer", - "description": "The total amount of points after the transaction." - }, - "balance": { - "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." - }, - "next_expiration_date": { - "type": "string", - "description": "The date when the next set of points are due to expire, i.e. `YYYY-MM-DD`. The points from the source loyalty card are taken from the expiration bucket(s) that are the first coming up to expire, starting from the first expiration bucket to expire in time. This parameter shows the next expiration date after the points were taken out of the loyalty card.", - "example": "2023-12-31" - }, - "next_expiration_points": { - "type": "integer", - "description": "The number of points due to expire on the expiration date." - } + "title": "SKU Material Reward" + }, + "7_obj_redemption_object_loyalty_card_digital": { + "type": "object", + "description": "Defines the digital reward redeemed for the particular loyalty card.", + "properties": { + "customer": { + "type": "object", + "description": "Defines the customer redeeming the reward.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "assignment_id": { + "type": "string", + "example": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", + "description": "Unique reward assginment ID assigned by Voucherify." + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Voucher object." + }, + "id": { + "type": "string", + "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "description": "Unique reward ID assigned by Voucherify." + }, + "object": { + "type": "string", + "default": "reward", + "description": "Type of object represented is `reward`." + }, + "name": { + "type": "string", + "description": "Reward name." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the reward was created." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the reward was updated." + }, + "parameters": { + "type": "object", + "description": "These are parameters representing a digital reward. These can be in the form of discount coupons, gift card credits, or loyalty point credits.", + "properties": { + "campaign": { + "description": "Defines the source of the digital reward.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital_discount_voucher" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital_gift_card_credits" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital_loyalty_card_points" + } + ] } - }, - "is_referral_code": { - "type": "integer", - "description": "Flag indicating whether this voucher is a referral code." } + }, + "type": { + "type": "string", + "description": "Reward type", + "enum": [ + "CAMPAIGN" + ] + } + }, + "title": "Digital Reward" + }, + "7_obj_redemption_object_loyalty_card_digital_discount_voucher": { + "type": "object", + "title": "Discount Voucher", + "description": "Contains information about the source of the digital reward.", + "properties": { + "id": { + "type": "string", + "example": "camp_0dJG7cCAjquzcxWmZ634bA0C", + "description": "Unique parent campaign ID of reward." + }, + "type": { + "type": "string", + "description": "Campaign type.", + "enum": [ + "DISCOUNT_COUPONS" + ] } } - } - }, - "related_transaction_id": { - "type": "string", - "description": "The related transaction ID on the source card.", - "example": "vtx_0c9afe802593b34b81" - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." - } - } - }, - "8_req_create_loyalty_card_transactions_export": { - "type": "object", - "title": "Create Loyalty Card Transactions Export Request Body", - "description": "Request body schema for **POST** `/loyalties/members/{memberId}/transactions/export`.", - "properties": { - "parameters": { - "$ref": "#/components/schemas/8_obj_export_loyalty_card_transactions", - "description": "Contains the parameters that define the data to be exported." - } - } - }, - "8_obj_export_loyalty_card_transactions": { - "description": "List of available fields and filters that can be exported with a loyalty card transactions export along with the sorting order of the returned data.", - "title": "Export Transactions", - "type": "object", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "-created_at", - "created_at" - ] - }, - "fields": { - "type": "array", - "enum": [ - [ - "id", - "type", - "source_id", - "reason", - "balance", - "amount", - "created_at", - "voucher_id", - "campaign_id", - "source", - "details", - "related_transaction_id" - ] - ], - "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID assigned by Voucherify. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `POINTS_EXPIRATION`
- `POINTS_ADDITION`
- `POINTS_REMOVAL`
- `POINTS_TRANSFER_OUT`
- `POINTS_ACCRUAL`
- `POINTS_REFUND`
- `POINTS_REDEMPTION` |\n| source_id | Custom source ID of the transaction if one was included originally. | source_id_custom |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The loyalty card balance after the transaction. | |\n| amount | The amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | - `API`
- `voucherify-web-ui`
- `Automation` |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n| related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |", - "items": { - "type": "string" - } - } - } - }, - "8_obj_export_transactions_object": { - "title": "Export Object", - "type": "object", - "description": "This is an object representing an export. \n\n Using this endpoint, you can export [loyalty card transactions](ref:list-loyalty-card-transactions) as a CSV file. This functionality works asynchronously and comes down to the following steps: \n* create an export object and return its `id` so you can track its `status`\n* trigger a CSV file generation, change the status to `SCHEDULED`\n* when the generation is over, store the file in S3 and change the `status` to `DONE`\n* now you can (ref:download-export) it\n\nWith `parameters` you can select which `fields` will be exported. An export request will almost always result in a single file being generated by the system. However, when your volume of data is large, the system may split the results into multiple chunks.", - "properties": { - "id": { - "type": "string", - "description": "Unique export ID.", - "example": "exp_FFfp9o7daWuJqJCKp5xqqli4" - }, - "object": { - "type": "string", - "default": "export", - "description": "The type of object being represented. This object stores information about the `export`." - }, - "created_at": { - "type": "string", - "example": "2022-04-28T11:23:20.922Z", - "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format.", - "format": "date-time" - }, - "status": { - "type": "string", - "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.", - "enum": [ - "SCHEDULED", - "IN_PROGRESS", - "DONE", - "ERROR" - ] - }, - "channel": { - "type": "string", - "description": "The channel through which the export was triggered.", - "default": "API" - }, - "exported_object": { - "type": "string", - "description": "The type of exported object.", - "default": "voucher_transactions" - }, - "parameters": { - "$ref": "#/components/schemas/16_obj_export_loyalty_card_transactions" - }, - "result": { - "type": "object", - "description": "Contains the URL of the CSV file.", - "properties": { - "url": { - "type": "string", - "description": "URL of the CSV file location. It contains the `token` used for authorization in the [Download export](ref:download-export) method." + }, + "7_obj_redemption_object_loyalty_card_digital_gift_card_credits": { + "type": "object", + "title": "Gift Card", + "description": "Contains information about the source of the digital reward.", + "properties": { + "id": { + "type": "string", + "example": "camp_0dJG7cCAjquzcxWmZ634bA0C", + "description": "Unique parent campaign ID of reward." + }, + "balance": { + "type": "integer", + "description": "The amount credited to the gift card as a reward expressed as the smallest currency unit (that is, 100 cents for $1.00)." + }, + "type": { + "type": "string", + "description": "Campaign type.", + "enum": [ + "GIFT_VOUCHERS" + ] + } } - } - }, - "user_id": { - "type": "string", - "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the `channel` value is `WEBSITE`.", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH" - } - } - }, - "8_obj_loyalty_tier_object": { - "type": "object", - "title": "Loyalty Tier Object", - "description": "This is an object representing a loyalty tier. \n\nLoyalty tiers are used to create a loyalty program with different levels of membership and varied earning rules and rewards based on customer’s tiers.", - "properties": { - "id": { - "type": "string", - "example": "ltr_30KHciA0UG8B71Fo51GZqwgN", - "description": "Unique loyalty tier ID." - }, - "name": { - "type": "string", - "description": "Loyalty Tier name." - }, - "campaign_id": { - "type": "string", - "example": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "description": "Unique parent campaign ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-11-10T12:20:52.755Z", - "description": "Timestamp representing the date and time when the loyalty tier was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-11-25T10:59:43.231Z", - "description": "Timestamp representing the date and time when the loyalty tier was updated in ISO 8601 format." - }, - "earning_rules": { - "type": "object", - "description": "Contains a list of earning rule IDs and their points mapping for the given earning rule.", - "properties": { - "unique_earning_rule_ID": { - "description": "ern_95aq3JaE5A8xzHjoJPYNRqXZ", - "anyOf": [ - { - "$ref": "#/components/schemas/8_obj_mapping_multiply" - }, - { - "$ref": "#/components/schemas/8_obj_mapping_fixed" - } - ] + }, + "7_obj_redemption_object_loyalty_card_digital_loyalty_card_points": { + "type": "object", + "title": "Loyalty Card", + "description": "Contains information about the source of the digital reward.", + "properties": { + "id": { + "type": "string", + "example": "camp_0dJG7cCAjquzcxWmZ634bA0C", + "description": "Unique parent campaign ID of reward." + }, + "balance": { + "type": "integer", + "description": "The number of loyalty points that is added to the loyalty card as a reward." + }, + "type": { + "type": "string", + "description": "Campaign type.", + "enum": [ + "LOYALTY_PROGRAM" + ] + } } - } - }, - "rewards": { - "type": "object", - "description": "Contains a list of reward IDs and their points mapping for the given reward.", - "properties": { - "unique_reward_ID": { - "description": "rewa_t88DnSdNnE0IzQX6gqH3jHGQ", - "anyOf": [ - { - "$ref": "#/components/schemas/8_obj_mapping_multiply" - }, - { - "$ref": "#/components/schemas/8_obj_mapping_fixed" + }, + "7_obj_redemption_rollback_object_gift_card": { + "type": "object", + "title": "Rollback Gift Card", + "description": "This is an object representing a gift card redemption rollback.", + "properties": { + "id": { + "type": "string", + "example": "rr_0bc92f81a6801f9bca", + "description": "Unique redemption rollback ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", + "default": "redemption_rollback" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "amount": { + "type": "integer", + "description": "The amount added back to the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the initial redemption.", + "example": "r_0c5bf3323008a35032" + }, + "reason": { + "type": "string", + "description": "The reason for the redemption rollback." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "$ref": "#/components/schemas/7_obj_order_object_rollback" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption rollback was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } } - ] - } - } - }, - "config": { - "type": "object", - "description": "Defines loyalty tier range in points.", - "properties": { - "points": { - "type": "object", - "description": "Defines range of loyalty tier in points.", - "properties": { - "from": { - "type": "integer", - "description": "Bottom points threshold value." - }, - "to": { - "type": "integer", - "description": "Top points threshold value." + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the gift card.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "type": "object", + "description": "Defines the details of the voucher being redeemed.", + "properties": { + "id": { + "type": "string", + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + } + } + }, + "gift": { + "type": "object", + "description": "Contains the amount being adde back to the gift card for the redemption rollback", + "properties": { + "amount": { + "type": "integer", + "description": "The amount added back to the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." + } } } } - } - }, - "points": { - "type": "object", - "description": "Defines range of loyalty tier in points.", - "properties": { - "from": { - "type": "integer", - "description": "Bottom points threshold value." - }, - "to": { - "type": "integer", - "description": "Top points threshold value." - } - } - }, - "object": { - "type": "string", - "default": "loyalty_tier", - "description": "The type of object represented by JSON. This object stores information about the loyalty." - } - } - }, - "8_obj_loyalty_tier_object_member": { - "type": "object", - "title": "Loyalty Tier Object", - "description": "This is an object representing a loyalty tier. \n\nLoyalty tiers are used to create a loyalty program with different levels of membership and varied earning rules and rewards based on customer’s tiers.", - "properties": { - "id": { - "type": "string", - "example": "ltr_30KHciA0UG8B71Fo51GZqwgN", - "description": "Unique loyalty tier ID." - }, - "name": { - "type": "string", - "description": "Loyalty Tier name." - }, - "campaign_id": { - "type": "string", - "example": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "description": "Unique parent campaign ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-11-10T12:20:52.755Z", - "description": "Timestamp representing the date and time when the loyalty tier was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-11-25T10:59:43.231Z", - "description": "Timestamp representing the date and time when the loyalty tier was updated in ISO 8601 format." - }, - "earning_rules": { - "type": "object", - "description": "Contains a list of earning rule IDs and their points mapping for the given earning rule.", - "properties": { - "unique_earning_rule_ID": { - "description": "ern_95aq3JaE5A8xzHjoJPYNRqXZ", - "anyOf": [ - { - "$ref": "#/components/schemas/8_obj_mapping_multiply" - }, - { - "$ref": "#/components/schemas/8_obj_mapping_fixed" + }, + "7_obj_redemption_object_gift_card": { + "type": "object", + "title": "Gift Card", + "description": "This is an object representing a gift card redemption.", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "amount": { + "type": "integer", + "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the parent redemption if this particular redemption was issued through a stacked redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } } - ] - } - } - }, - "rewards": { - "type": "object", - "description": "Contains a list of reward IDs and their points mapping for the given reward.", - "properties": { - "unique_reward_ID": { - "description": "rewa_t88DnSdNnE0IzQX6gqH3jHGQ", - "anyOf": [ - { - "$ref": "#/components/schemas/8_obj_mapping_multiply" - }, - { - "$ref": "#/components/schemas/8_obj_mapping_fixed" + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the gift card.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } } - ] - } - } - }, - "config": { - "type": "object", - "description": "Defines loyalty tier range in points.", - "properties": { - "points": { - "type": "object", - "description": "Defines range of loyalty tier in points.", - "properties": { - "from": { - "type": "integer", - "description": "Bottom points threshold value." - }, - "to": { - "type": "integer", - "description": "Top points threshold value." + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "type": "object", + "description": "Defines the details of the voucher being redeemed.", + "properties": { + "id": { + "type": "string", + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + } + } + }, + "gift": { + "type": "object", + "description": "Contains the amount being subtracted from the gift card for the redemption.", + "properties": { + "amount": { + "type": "integer", + "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." + } } } } - } - }, - "points": { - "type": "object", - "description": "Defines range of loyalty tier in points.", - "properties": { - "from": { - "type": "integer", - "description": "Bottom points threshold value." - }, - "to": { - "type": "integer", - "description": "Top points threshold value." - } - } - }, - "expiration": { - "type": "object", - "description": "Contains information about when the expiration tier will expire.", - "properties": { - "customer_id": { - "type": "string", - "example": "cust_qBwHpagDOFu71Z3F22UzR80X", - "description": "Unique customer ID whose point expiration dates are defined in this object." - }, - "campaign_id": { - "type": "string", - "example": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "description": "Unique parent campaign ID." - }, - "tier_id": { - "type": "string", - "example": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2", - "description": "Unique loyalty tier ID." - }, - "start_date": { - "type": "string", - "example": "2022-11-10", - "description": "Exact start date of the loyalty tier for the given customer." - }, - "expiration_date": { - "type": "string", - "example": "2023-02-28", - "description": "Exact expiration date of the loyalty tier for the given customer." - }, - "created_at": { - "type": "string", - "example": "2022-11-09T11:26:26.719Z", - "format": "date-time", - "description": "Timestamp representing the date and time when the loyalty tier expiration was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "example": "2022-11-10T08:54:47.200Z", - "format": "date-time", - "description": "Timestamp representing the date and time when the loyalty tier expiration was created in ISO 8601 format." - } - } - }, - "object": { - "type": "string", - "default": "loyalty_tier", - "description": "The type of object represented by JSON. This object stores information about the loyalty." - } - } - }, - "8_obj_mapping_multiply": { - "type": "object", - "title": "Multiply Points", - "description": "Points are multiplied by a multiplier.", - "properties": { - "type": { - "type": "string", - "description": "Type of calculation.", - "enum": [ - "MULTIPLY" - ] - }, - "multiplier": { - "type": "integer", - "description": "Multiplication factor used to multiply the points to obtain the mapped points." - } - } - }, - "8_obj_mapping_fixed": { - "type": "object", - "title": "Fixed Points", - "description": "Points are fixed.", - "properties": { - "type": { - "type": "string", - "description": "Type of calculation.", - "enum": [ - "CUSTOM" - ] - }, - "points": { - "type": "integer", - "description": "Fixed number of points to be applied." - } - } - }, - "8_obj_earning_rule_object": { - "description": "This is an object representing an earning rule.", - "title": "Earning Rule Object", - "examples": [ - { - "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", - "created_at": "2022-02-07T08:19:41.810Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 2, - "type": "FIXED" - }, - "custom_event": { - "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" - }, - "event": "saw_on_facebook", - "source": { - "banner": "Saw on Facebook Timeframe", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-07T08:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "object": "earning_rule", - "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" - }, - { - "id": "ern_taClaOIiaGNdmdby8xS0lCcy", - "created_at": "2022-02-04T13:27:50.665Z", - "updated_at": "2022-02-07T08:19:44.198Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "event": "order.paid", - "source": { - "banner": "Order paid 1000 points", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 4 - ], - "object": "earning_rule", - "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" - }, - { - "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", - "created_at": "2022-02-04T13:02:52.937Z", - "updated_at": "2022-02-07T08:19:43.291Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "segment": { - "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" - }, - "event": "customer.segment.entered", - "source": { - "banner": "Entered segment 100 points.", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" - }, - { - "id": "ern_gVo6CHBduFPoh1hctASfXHLT", - "created_at": "2022-11-24T17:01:42.809Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { + "7_obj_redemption_object_voucher_fail": { + "type": "object", + "title": "Failed Voucher Redemption", + "description": "This is an object representing a failed redemption for a voucher.", + "properties": { + "id": { + "type": "string", + "example": "rf_0bbaccc96e0830ff9e", + "description": "Unique failed redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, "metadata": { - "every": 4, - "points": 4, - "property": "customer_life_time_value" + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "failure_code": { + "type": "string", + "example": "customer_rules_violated", + "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." + }, + "failure_message": { + "type": "string", + "description": "If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed." + }, + "order": { + "type": "null" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |\n", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "voucher": { + "type": "object", + "description": "Defines the voucher details.", + "properties": { + "id": { + "type": "string", + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + } + } } } }, - "event": "customer.loyalty.tier.joined", - "loyalty_tier": { - "id": "ltr_pudTGWasuIqxdiDM0go31OV1" - }, - "source": { - "banner": "Tier joined", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_wdlEo17wmoqYHGfilbayEUj7", - "metadata": { - "Type": "Tier joined - customer metadata - proportional" - } - }, - { - "id": "ern_66OdCyLADv5IGFoQe18vGUwa", - "created_at": "2022-11-24T17:03:59.414Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { + "7_obj_redemption_object_promotion_tier_fail": { + "type": "object", + "title": "Failed Promotion Tier Redemption", + "description": "This is an object representing a failed redemption for a promotion tier.", + "properties": { + "id": { + "type": "string", + "example": "rf_0bbaccc96e0830ff9e", + "description": "Unique failed redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the redemption.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, "metadata": { - "every": 2, - "points": 2, - "property": "customer_life_time_value" + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "failure_code": { + "type": "string", + "example": "customer_rules_violated", + "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." + }, + "failure_message": { + "type": "string", + "description": "If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed." + }, + "order": { + "type": "null" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the promotion.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n", + "enum": [ + "promotion_tier" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify.", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" + }, + "voucher": { + "type": "null" + }, + "promotion_tier": { + "type": "object", + "description": "Contains details about the promotion tier and it's parent campaign.", + "properties": { + "id": { + "type": "string", + "description": "Unique promotion tier ID assigned by Voucherify.", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" + }, + "campaign": { + "type": "object", + "description": "Promotion tier's parent campaign.", + "properties": { + "id": { + "type": "string", + "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." + } + } + } + } } } }, - "event": "customer.loyalty.tier.left", - "loyalty_tier": { - "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2" - }, - "source": { - "banner": "Tier left", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_czm5el1Uz1jeGaO97AYoDNAq", - "metadata": { - "Type": "Tier left" - } - }, - { - "id": "ern_YR3fDfCjAmz9a5D68nk0i4dm", - "created_at": "2022-11-25T07:29:38.961Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { + "7_obj_redemption_object_fail": { + "type": "object", + "title": "Failed Redemption", + "description": "This is an object representing a failed redemption when a resource to be redeemed cannot be found.", + "properties": { + "id": { + "type": "string", + "example": "rf_0c4c7baf58c243af6b", + "description": "Unique failed redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the redemption.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "null", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "null", + "description": "Hashed customer source ID." + }, "metadata": { - "every": 3, - "points": 4, - "property": "customer_life_time_value" + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "failure_code": { + "type": "string", + "example": "not_found", + "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." + }, + "failure_message": { + "type": "string", + "description": "If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed." + }, + "order": { + "type": "null" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } + } + }, + "customer": { + "type": "null" + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| redemption | Related redemption. |\n", + "enum": [ + "redemption" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify.", + "example": "rf_0c5bde8dfc0156f0e3" + }, + "voucher": { + "type": "null" } } }, - "event": "customer.loyalty.tier.upgraded", - "loyalty_tier": { - "id": "ltr_30KHciA0UG8B71Fo51GZqwgN" - }, - "source": { - "banner": "Tier upgraded", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_M1OdRH8spk6Fs7yTuPLN2LAv", - "metadata": { - "Type": "Upgraded" - } - }, - { - "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", - "created_at": "2022-11-25T07:31:05.866Z", - "updated_at": "2022-11-25T07:31:43.029Z", - "validation_rule_id": "val_kfmWpfXMI9P1", - "loyalty": { - "points": 1, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.downgraded", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Tier Downgraded", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", - "metadata": { - "Type": "Tier" - } - }, - { - "id": "ern_AdlWO2yt6b6llWsibIdiRXVE", - "created_at": "2022-11-25T07:31:42.767Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 5, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.prolonged", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Prolonged", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_4jH1yq9WJS0oJ8suagCrltyb", - "metadata": {} - } - ], - "anyOf": [ - { - "$ref": "#/components/schemas/8_obj_earning_rule_object_order_paid" - }, - { - "$ref": "#/components/schemas/8_obj_earning_rule_object_custom_event" - }, - { - "$ref": "#/components/schemas/8_obj_earning_rule_object_entered_segment" - }, - { - "$ref": "#/components/schemas/8_obj_earning_rule_object_tier" - } - ] - }, - "8_obj_earning_rule_object_no_validation_rule": { - "description": "This is an object representing an earning rule.", - "title": "Earning Rule Object", - "examples": [ - { - "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", - "created_at": "2022-02-07T08:19:41.810Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 2, - "type": "FIXED" - }, - "custom_event": { - "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" - }, - "event": "saw_on_facebook", - "source": { - "banner": "Saw on Facebook Timeframe", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-07T08:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "object": "earning_rule", - "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" - }, - { - "id": "ern_taClaOIiaGNdmdby8xS0lCcy", - "created_at": "2022-02-04T13:27:50.665Z", - "updated_at": "2022-02-07T08:19:44.198Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "event": "order.paid", - "source": { - "banner": "Order paid 1000 points", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 4 - ], - "object": "earning_rule", - "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" - }, - { - "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", - "created_at": "2022-02-04T13:02:52.937Z", - "updated_at": "2022-02-07T08:19:43.291Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "segment": { - "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" - }, - "event": "customer.segment.entered", - "source": { - "banner": "Entered segment 100 points.", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" - }, - { - "id": "ern_gVo6CHBduFPoh1hctASfXHLT", - "created_at": "2022-11-24T17:01:42.809Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { + "7_obj_redemption_rollback_object_voucher_fail": { + "type": "object", + "title": "Failed Voucher Redemption Rollback", + "description": "This is an object representing a failed redemption rollback for a voucher.", + "properties": { + "id": { + "type": "string", + "example": "rrf_0c63990fed133bfb88", + "description": "Unique failed redemption rollback ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", + "default": "redemption_rollback" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, "metadata": { - "every": 4, - "points": 4, - "property": "customer_life_time_value" + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "redemption": { + "type": "string", + "description": "The unique redemption ID of the initial redemption.", + "example": "r_0c5d6689b35320059a" + }, + "reason": { + "type": "string", + "description": "The reason for the redemption rollback." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "failure_code": { + "type": "string", + "example": "already_rolled_back", + "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." + }, + "failure_message": { + "type": "string", + "description": "If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed." + }, + "order": { + "type": "null" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption rollback was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |\n", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "voucher": { + "type": "object", + "description": "Defines the voucher details.", + "properties": { + "id": { + "type": "string", + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + } + } } } }, - "event": "customer.loyalty.tier.joined", - "loyalty_tier": { - "id": "ltr_pudTGWasuIqxdiDM0go31OV1" - }, - "source": { - "banner": "Tier joined", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_wdlEo17wmoqYHGfilbayEUj7", - "metadata": { - "Type": "Tier joined - customer metadata - proportional" - } - }, - { - "id": "ern_66OdCyLADv5IGFoQe18vGUwa", - "created_at": "2022-11-24T17:03:59.414Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { + "7_obj_redemption_rollback_object_promotion_tier_fail": { + "type": "object", + "title": "Failed Promotion Tier Redemption Rollback", + "description": "This is an object representing a failed redemption rollback for a promotion tier.", + "properties": { + "id": { + "type": "string", + "example": "rrf_0c5eb3bd884497ed05", + "description": "Unique failed redemption rollback ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", + "default": "redemption_rollback" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, "metadata": { - "every": 2, - "points": 2, - "property": "customer_life_time_value" + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "redemption": { + "type": "string", + "description": "The unique redemption ID of the initial redemption.", + "example": "r_0c5d6689b35320059a" + }, + "reason": { + "type": "string", + "description": "The reason for the redemption rollback." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "failure_code": { + "type": "string", + "example": "customer_rules_violated", + "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." + }, + "failure_message": { + "type": "string", + "description": "If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed." + }, + "order": { + "type": "null" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption rollback was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the promotion.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n", + "enum": [ + "promotion_tier" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify.", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" + }, + "voucher": { + "type": "null" + }, + "promotion_tier": { + "type": "object", + "description": "Contains details about the promotion tier and it's parent campaign.", + "properties": { + "id": { + "type": "string", + "description": "Unique promotion tier ID assigned by Voucherify.", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" + }, + "campaign": { + "type": "object", + "description": "Promotion tier's parent campaign.", + "properties": { + "id": { + "type": "string", + "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." + } + } + } + } } } }, - "event": "customer.loyalty.tier.left", - "loyalty_tier": { - "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2" - }, - "source": { - "banner": "Tier left", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_czm5el1Uz1jeGaO97AYoDNAq", - "metadata": { - "Type": "Tier left" - } - }, - { - "id": "ern_YR3fDfCjAmz9a5D68nk0i4dm", - "created_at": "2022-11-25T07:29:38.961Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { + "7_obj_redemption_rollback_object_promotion_tier": { + "type": "object", + "title": "Promotion Tier", + "description": "This is an object representing a promotion tier redemption rollback", + "properties": { + "id": { + "type": "string", + "example": "rr_0bc92f81a6801f9bca", + "description": "Unique redemption rollback ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", + "default": "redemption_rollback" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, "metadata": { - "every": 3, - "points": 4, - "property": "customer_life_time_value" + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of initial redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "$ref": "#/components/schemas/7_obj_order_object_rollback" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption rollback was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.", + "enum": [ + "promotion_tier" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." + }, + "voucher": { + "type": "null" + }, + "promotion_tier": { + "type": "object", + "description": "Contains details of the promotion tier and the parent campaign.", + "properties": { + "id": { + "type": "string", + "description": "Unique promotion tier ID assigned by Voucherify.", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" + }, + "campaign": { + "type": "object", + "description": "Promotion tier's parent campaign.", + "properties": { + "id": { + "type": "string", + "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." + } + } + } + } } } }, - "event": "customer.loyalty.tier.upgraded", - "loyalty_tier": { - "id": "ltr_30KHciA0UG8B71Fo51GZqwgN" - }, - "source": { - "banner": "Tier upgraded", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_M1OdRH8spk6Fs7yTuPLN2LAv", - "metadata": { - "Type": "Upgraded" - } - }, - { - "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", - "created_at": "2022-11-25T07:31:05.866Z", - "updated_at": "2022-11-25T07:31:43.029Z", - "validation_rule_id": "val_kfmWpfXMI9P1", - "loyalty": { - "points": 1, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.downgraded", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Tier Downgraded", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", - "metadata": { - "Type": "Tier" - } - }, - { - "id": "ern_AdlWO2yt6b6llWsibIdiRXVE", - "created_at": "2022-11-25T07:31:42.767Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 5, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.prolonged", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Prolonged", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_4jH1yq9WJS0oJ8suagCrltyb", - "metadata": {} - } - ], - "anyOf": [ - { - "$ref": "#/components/schemas/8_obj_earning_rule_object_order_paid_no_validation_rule" - }, - { - "$ref": "#/components/schemas/8_obj_earning_rule_object_custom_event_no_validation_rule" - }, - { - "$ref": "#/components/schemas/8_obj_earning_rule_object_entered_segment_no_validation_rule" - }, - { - "$ref": "#/components/schemas/8_obj_earning_rule_object_tier_no_validation_rule" - } - ] - }, - "8_obj_earning_rule_object_order_paid": { - "description": "This is an object representing an earning rule for a paid order.", - "type": "object", - "title": "Earning Rule Object for Order Paid", - "examples": [ - { - "id": "ern_taClaOIiaGNdmdby8xS0lCcy", - "created_at": "2022-02-04T13:27:50.665Z", - "updated_at": "2022-02-07T08:19:44.198Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "event": "order.paid", - "source": { - "banner": "Order paid 1000 points", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 4 - ], - "object": "earning_rule", - "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" - } - ], - "properties": { - "id": { - "type": "string", - "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", - "description": "Assigned by the Voucherify API, identifies the earning rule object." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", - "example": "2022-02-02T13:18:32.557Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", - "example": "2022-02-03T13:09:27.206Z", - "format": "date-time" - }, - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_paid" - } - ] - }, - "event": { - "type": "string", - "enum": [ - "order.paid" - ], - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `order.paid` an event defined by the Voucherify API corresponding to an order status `PAID`. " - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - }, - "object_id": { - "type": "string", - "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "description": "A unique campaign identifier assigned by the Voucherify API." - }, - "object_type": { - "type": "string", - "default": "campaign", - "description": "Defines the object associated with the earning rule. Defaults to `campaign`." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" + "7_obj_redemption_object_promotion_tier": { + "type": "object", + "title": "Promotion Tier", + "description": "This is an object representing a promotion tier redemption.", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the parent redemption if this particular redemption was issued through a stacked redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.", + "enum": [ + "promotion_tier" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." + }, + "voucher": { + "type": "null" + }, + "promotion_tier": { + "type": "object", + "description": "Contains details of the promotion tier and the parent campaign.", + "properties": { + "id": { + "type": "string", + "description": "Unique promotion tier ID assigned by Voucherify.", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" + }, + "campaign": { + "type": "object", + "description": "Promotion tier's parent campaign.", + "properties": { + "id": { + "type": "string", + "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." + } + } + } + } + } } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "object": { - "type": "string", - "default": "earning_rule", - "description": "The type of object represented by JSON. Default is `earning_rule`." - }, - "automation_id": { - "type": "string", - "description": "For internal use by Voucherify.", - "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } - } - }, - "8_req_earning_rule_object_order_paid": { - "description": "This is an object representing an earning rule for a paid order.", - "type": "object", - "title": "Earning Rule Object for Order Paid", - "examples": [ - { - "id": "ern_taClaOIiaGNdmdby8xS0lCcy", - "created_at": "2022-02-04T13:27:50.665Z", - "updated_at": "2022-02-07T08:19:44.198Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "event": "order.paid", - "source": { - "banner": "Order paid 1000 points", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" }, - "validity_day_of_week": [ - 4 - ], - "object": "earning_rule", - "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" - } - ], - "properties": { - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_paid" + "7_obj_redemption_object_promotion_tier_extended": { + "type": "object", + "title": "Promotion Tier", + "description": "This is an object representing a promotion tier redemption.", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.", + "enum": [ + "promotion_tier" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." + }, + "voucher": { + "type": "null" + }, + "promotion_tier": { + "description": "Contains details of the promotion tier and the parent campaign.", + "$ref": "#/components/schemas/3_obj_promotion_tier_object" + } } - ] - }, - "event": { - "type": "string", - "enum": [ - "order.paid" - ], - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `order.paid` an event defined by the Voucherify API corresponding to an order status `PAID`. " - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + }, + "7_obj_redemption_object_promotion_tier_extended_stacked": { + "type": "object", + "title": "Promotion Tier", + "description": "This is an object representing a promotion tier redemption.", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the parent redemption.", + "example": "r_0c656311b5878a2031" + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.", + "enum": [ + "promotion_tier" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." + }, + "voucher": { + "type": "null" + }, + "promotion_tier": { + "description": "Contains details of the promotion tier and the parent campaign.", + "$ref": "#/components/schemas/3_obj_promotion_tier_object" + } } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" + }, + "7_obj_redemption_object_stackable_discounts": { + "type": "object", + "title": "Stacked Redemption", + "description": "This is an object representing a stacked redemption.", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object_stacked_redemptions" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer making the stacked redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.", + "enum": [ + "redemption" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. r_0c5d07222e08a34ace for a redemption." + }, + "voucher": { + "type": "null" + } } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } - } - }, - "8_req_update_earning_rule_object_order_paid": { - "description": "This is an object representing an earning rule for a paid order.", - "type": "object", - "title": "Earning Rule Object for Order Paid", - "examples": [ - { - "id": "ern_taClaOIiaGNdmdby8xS0lCcy", - "created_at": "2022-02-04T13:27:50.665Z", - "updated_at": "2022-02-07T08:19:44.198Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "event": "order.paid", - "source": { - "banner": "Order paid 1000 points", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" + "7_res_get_redemption": { + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object" + }, + { + "$ref": "#/components/schemas/7_obj_rollback_redemption_object_truncated" + } + ], + "title": "Get Redemption Response Body", + "description": "Response body schema for **GET** `/redemptions/{redemptionId}" }, - "validity_day_of_week": [ - 4 - ], - "object": "earning_rule", - "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" - } - ], - "properties": { - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_paid" + "7_res_list_redemptions": { + "title": "List Redemptions Response Body", + "type": "object", + "description": "Response body schema for **GET** `/redemptions`.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about redemptions in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "redemptions", + "description": "Identifies the name of the attribute that contains the array of redemption objects." + }, + "redemptions": { + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object" + }, + { + "$ref": "#/components/schemas/7_obj_rollback_redemption_object_truncated" + } + ] + }, + "total": { + "type": "integer", + "description": "Total number of redemptions." + } } - ] - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + }, + "7_filter_conditions_string": { + "title": "Filter by conditions", + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "$in": { + "type": "array", + "description": "Array of resource values that should be included in the results. (multiple values)", + "items": { + "type": "string" + } + }, + "$not_in": { + "type": "array", + "description": "Array of resource values that should be included in the results. (multiple values)", + "items": { + "type": "string" + } + }, + "$is": { + "type": "string", + "description": "Value is exactly this value. (single value)" + }, + "$is_not": { + "type": "string", + "description": "Results omit this value. (single value)" + }, + "$has_value": { + "type": "string", + "description": "Value is NOT null. The value for this parameter is an empty string." + }, + "$is_unknown": { + "type": "string", + "description": "Value is null. The value for this parameter is an empty string." + }, + "$starts_with": { + "type": "string", + "description": "Value starts with the specified string." + }, + "$ends_with": { + "type": "string", + "description": "Value ends with the specified string." + } } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" + }, + "7_res_get_vouchers_redemptions": { + "type": "object", + "title": "Get Voucher's Redemptions Response Body", + "description": "Response body schema for **GET** `/vouchers/{code}/redemption`.", + "properties": { + "quantity": { + "type": "integer", + "description": "The maximum number of times a voucher can be redeemed." + }, + "redeemed_quantity": { + "type": "integer", + "description": "The number of times the voucher was redeemed successfully." + }, + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about redemptions in a dictionary." + }, + "url": { + "type": "string", + "example": "/v1/vouchers/PROMO-CODE2/redemptions?page=1&limit=10", + "description": "URL " + }, + "data_ref": { + "type": "string", + "default": "redemption_entries", + "description": "Identifies the name of the attribute that contains the array of `redemption_entries`." + }, + "total": { + "type": "integer", + "description": "Total number of redemption objects." + }, + "redemption_entries": { + "type": "array", + "description": "Contains the array of successful and failed redemption objects.", + "items": { + "$ref": "#/components/schemas/7_obj_redemption_object_voucher" + } + } } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } - } - }, - "8_obj_earning_rule_object_order_paid_no_validation_rule": { - "description": "This is an object representing an earning rule for a paid order.", - "type": "object", - "title": "Earning Rule Object for Order Paid", - "examples": [ - { - "id": "ern_taClaOIiaGNdmdby8xS0lCcy", - "created_at": "2022-02-04T13:27:50.665Z", - "updated_at": "2022-02-07T08:19:44.198Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "event": "order.paid", - "source": { - "banner": "Order paid 1000 points", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" + "7_req_redeem_voucher": { + "title": "Redeem Voucher Request Body", + "description": "Request body schema for redeeming a voucher using **POST** `/vouchers/{code}/redemption`.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_req_redeem_voucher_discount_code" + }, + { + "$ref": "#/components/schemas/7_req_redeem_voucher_gift_card" + }, + { + "$ref": "#/components/schemas/7_req_redeem_voucher_loyalty_card" + } + ] }, - "validity_day_of_week": [ - 4 - ], - "object": "earning_rule", - "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" - } - ], - "properties": { - "id": { - "type": "string", - "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", - "description": "Assigned by the Voucherify API, identifies the earning rule object." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", - "example": "2022-02-02T13:18:32.557Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", - "example": "2022-02-03T13:09:27.206Z", - "format": "date-time" - }, - "validation_rule_id": { - "type": "null", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_paid" - } - ] - }, - "event": { - "type": "string", - "enum": [ - "order.paid" - ], - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `order.paid` an event defined by the Voucherify API corresponding to an order status `PAID`. " - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - }, - "object_id": { - "type": "string", - "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "description": "A unique campaign identifier assigned by the Voucherify API." - }, - "object_type": { - "type": "string", - "default": "campaign", - "description": "Defines the object associated with the earning rule. Defaults to `campaign`." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "object": { - "type": "string", - "default": "earning_rule", - "description": "The type of object represented by JSON. Default is `earning_rule`." - }, - "automation_id": { - "type": "string", - "description": "For internal use by Voucherify.", - "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } - } - }, - "8_obj_earning_rule_object_entered_segment": { - "description": "This is an object representing an earning rule for entering a customer segment.", - "type": "object", - "title": "Earning Rule Object for Entered Segment", - "examples": [ - { - "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", - "created_at": "2022-02-04T13:02:52.937Z", - "updated_at": "2022-02-07T08:19:43.291Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "segment": { - "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" - }, - "event": "customer.segment.entered", - "source": { - "banner": "Entered segment 100 points.", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" + "7_res_redeem_voucher": { + "title": "Redeem Voucher Response Body", + "$ref": "#/components/schemas/7_obj_redemption_object_voucher_extended", + "description": "Response body schema for **POST** `/vouchers/{code}/redemption`." }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" + "7_req_redeem_promotion_tier": { + "title": "Redeem Promotion Tier", + "type": "object", + "description": "Redeem a promotion tier.", + "properties": { + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" + } + ], + "description": "Order information." + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against promotion tiers requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the [Create Validation Rules](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + } + } }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" - } - ], - "properties": { - "id": { - "type": "string", - "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", - "description": "Assigned by the Voucherify API, identifies the earning rule object." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", - "example": "2022-02-02T13:18:32.557Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", - "example": "2022-02-03T13:09:27.206Z", - "format": "date-time" - }, - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "segment": { - "type": "object", - "description": "Contains the id of a customer segment. **Required** for the `customer.segment.entered` option in `event`.", - "properties": { - "id": { - "type": "string", - "description": "Contains a unique identifier of a customer segment. Assigned by the Voucherify API." - } - } - }, - "event": { - "type": "string", - "enum": [ - "customer.segment.entered" - ], - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.segment.entered` an event defined by the Voucherify API corresponding to a customer entering a pre-defined customer segment." - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - }, - "object_id": { - "type": "string", - "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "description": "A unique campaign identifier assigned by the Voucherify API." - }, - "object_type": { - "type": "string", - "default": "campaign", - "description": "Defines the object associated with the earning rule. Defaults to `campaign`." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" + "7_req_redeem_voucher_discount_code": { + "title": "Discount Code", + "type": "object", + "description": "Redeem a discount code.", + "properties": { + "session": { + "$ref": "#/components/schemas/6_req_session_lock_discount_code" + }, + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" + } + ], + "description": "Order information." + }, + "metadata": { + "type": "object", + "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "options": { + "type": "object", + "description": "Configure parameters returned in the response.", + "properties": { + "expand": { + "type": "array", + "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. Add `category` as a string in the array to include a `categories` object in the response.", + "items": { + "type": "string", + "enum": [ + "category" + ], + "example": "category" + } + } + } + } } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "object": { - "type": "string", - "default": "earning_rule", - "description": "The type of object represented by JSON. Default is `earning_rule`." - }, - "automation_id": { - "type": "string", - "description": "For internal use by Voucherify.", - "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } - } - }, - "8_req_earning_rule_object_entered_segment": { - "description": "This is an object representing an earning rule for entering a customer segment.", - "type": "object", - "title": "Earning Rule Object for Entered Segment", - "examples": [ - { - "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", - "created_at": "2022-02-04T13:02:52.937Z", - "updated_at": "2022-02-07T08:19:43.291Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "segment": { - "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" - }, - "event": "customer.segment.entered", - "source": { - "banner": "Entered segment 100 points.", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" - } - ], - "properties": { - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "segment": { - "type": "object", - "description": "Contains the id of a customer segment. **Required** for the `customer.segment.entered` option in `event`.", - "properties": { - "id": { - "type": "string", - "description": "Contains a unique identifier of a customer segment. Assigned by the Voucherify API." - } - } - }, - "event": { - "type": "string", - "enum": [ - "customer.segment.entered" - ], - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.segment.entered` an event defined by the Voucherify API corresponding to a customer entering a pre-defined customer segment." - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" + "7_req_redeem_voucher_gift_card": { + "title": "Gift Card", + "type": "object", + "description": "Redeem a gift card.", + "properties": { + "session": { + "$ref": "#/components/schemas/6_req_session_lock_gift_card" + }, + "gift": { + "type": "object", + "description": "Contains information on the number of gift card credits that the customer wants to apply to the order.", + "properties": { + "credits": { + "type": "integer", + "description": "The number of credits that the user wants to use from the gift card to fulfil the order. The value of credits cannot be higher than the current balance on the gift card. If the user gives more points than he has on the gift card, the application will return an error code in response. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + }, + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" + } + ], + "description": "Order information." + }, + "metadata": { + "type": "object", + "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "options": { + "type": "object", + "description": "Configure parameters returned in the response.", + "properties": { + "expand": { + "type": "array", + "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. Add `category` as a string in the array to include a `categories` object in the response.", + "items": { + "type": "string", + "enum": [ + "category" + ], + "example": "category" + } + } + } + } } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } - } - }, - "8_req_update_earning_rule_object_entered_segment": { - "description": "This is an object representing an earning rule for entering a customer segment.", - "type": "object", - "title": "Earning Rule Object for Entered Segment", - "examples": [ - { - "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", - "created_at": "2022-02-04T13:02:52.937Z", - "updated_at": "2022-02-07T08:19:43.291Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "segment": { - "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" - }, - "event": "customer.segment.entered", - "source": { - "banner": "Entered segment 100 points.", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" - } - ], - "properties": { - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" + "7_req_redeem_voucher_loyalty_card": { + "title": "Loyalty Card", + "type": "object", + "description": "Redeem a loyalty card.", + "properties": { + "session": { + "$ref": "#/components/schemas/6_req_session_lock_loyalty_card" + }, + "reward": { + "type": "object", + "description": "Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward." + }, + "points": { + "type": "integer", + "description": "The number of loyalty points that the user wants to spend in order to fulfill the order. The number of points cannot be higher than the current balance on the loyalty card. If the user gives more points than he/she has on the loyalty card, the application will return an error code in response." + } + } + }, + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" + } + ], + "description": "Order information." + }, + "metadata": { + "type": "object", + "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "options": { + "type": "object", + "description": "Configure parameters returned in the response.", + "properties": { + "expand": { + "type": "array", + "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. Add `category` as a string in the array to include a `categories` object in the response.", + "items": { + "type": "string", + "enum": [ + "category" + ], + "example": "category" + } + } + } + } } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } - } - }, - "8_obj_earning_rule_object_entered_segment_no_validation_rule": { - "description": "This is an object representing an earning rule for entering a customer segment.", - "type": "object", - "title": "Earning Rule Object for Entered Segment", - "examples": [ - { - "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", - "created_at": "2022-02-04T13:02:52.937Z", - "updated_at": "2022-02-07T08:19:43.291Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "segment": { - "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" - }, - "event": "customer.segment.entered", - "source": { - "banner": "Entered segment 100 points.", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" - } - ], - "properties": { - "id": { - "type": "string", - "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", - "description": "Assigned by the Voucherify API, identifies the earning rule object." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", - "example": "2022-02-02T13:18:32.557Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", - "example": "2022-02-03T13:09:27.206Z", - "format": "date-time" - }, - "validation_rule_id": { - "type": "null", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "segment": { - "type": "object", - "description": "Contains the id of a customer segment. **Required** for the `customer.segment.entered` option in `event`.", - "properties": { - "id": { - "type": "string", - "description": "Contains a unique identifier of a customer segment. Assigned by the Voucherify API." - } - } - }, - "event": { - "type": "string", - "enum": [ - "customer.segment.entered" - ], - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.segment.entered` an event defined by the Voucherify API corresponding to a customer entering a pre-defined customer segment." - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - }, - "object_id": { - "type": "string", - "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "description": "A unique campaign identifier assigned by the Voucherify API." - }, - "object_type": { - "type": "string", - "default": "campaign", - "description": "Defines the object associated with the earning rule. Defaults to `campaign`." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" + "7_req_rollback_redemption": { + "title": "Rollback Redemption Request Body", + "type": "object", + "properties": { + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_rollback_redemption_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_rollback_redemption_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_rollback_redemption_order_id" + }, + { + "$ref": "#/components/schemas/6_req_rollback_redemption_order_source_id" + } + ], + "description": "Send order information to ensure the correct order is being undone." + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to update **redemption** metadata." + } }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "object": { - "type": "string", - "default": "earning_rule", - "description": "The type of object represented by JSON. Default is `earning_rule`." - }, - "automation_id": { - "type": "string", - "description": "For internal use by Voucherify.", - "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } - } - }, - "8_obj_earning_rule_object_custom_event": { - "description": "This is an object representing an earning rule triggered by a custom event.", - "type": "object", - "title": "Earning Rule Object for Custom Event", - "examples": [ - { - "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", - "created_at": "2022-02-07T08:19:41.810Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 2, - "type": "FIXED" - }, - "custom_event": { - "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" - }, - "event": "saw_on_facebook", - "source": { - "banner": "Saw on Facebook Timeframe", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" + "description": "Request body schema for **POST** `/redemptions/{redemptionId}/rollback`." }, - "active": true, - "start_date": "2022-02-07T08:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" + "7_res_rollback_redemption": { + "title": "Rollback Redemption Response Body", + "$ref": "#/components/schemas/7_obj_rollback_redemption_object_extended", + "description": "Response body schema for **POST** `/redemptions/{redemptionId}/rollback`." }, - "object": "earning_rule", - "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" - } - ], - "properties": { - "id": { - "type": "string", - "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", - "description": "Assigned by the Voucherify API, identifies the earning rule object." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", - "example": "2022-02-02T13:18:32.557Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", - "example": "2022-02-03T13:09:27.206Z", - "format": "date-time" - }, - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_custom_event_metadata" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "custom_event": { - "type": "object", - "description": "Contains the schema id of a custom event. **Required** for the custom event option in `event`.", - "properties": { - "schema_id": { - "type": "string", - "description": "Contains a unique identifier of a custom event schema. Assigned by the Voucherify API.", - "example": "ms_gn4Qe4xsFPf7orCArCiNVY13" - } - } - }, - "event": { - "type": "string", - "enum": [ - "custom_event_defined_in_EVENT_SCHEMA" - ], - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `custom_event_name` the name of a custom event defined in the Dashboard → **Project Settings** → **EVENT SCHEMA** → **Add event definition**. Read more on defining [custom events](https://support.voucherify.io/article/111-custom-events). " - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - }, - "object_id": { - "type": "string", - "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "description": "A unique campaign identifier assigned by the Voucherify API." - }, - "object_type": { - "type": "string", - "default": "campaign", - "description": "Defines the object associated with the earning rule. Defaults to `campaign`." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" + "8_obj_loyalty_campaign_object": { + "title": "Loyalty Campaign Object", + "description": "This is an object representing a loyalty campaign. \n\nThe loyalty campaign object contains details about the loyalty campaign. You can use dedicated endpoints to list loyalty campaigns, list loyalty card holders, member activities, active rewards, earning rules, loyalty tiers for given loyalty campaign.", + "x-tags": [ + "LOYALTIES API" + ], + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique campaign ID, assigned by Voucherify.", + "example": "camp_f7fBbQxUuTN7dI7tGOo5XMDA" + }, + "name": { + "type": "string", + "description": "Loyalty campaign name." + }, + "campaign_type": { + "type": "string", + "enum": [ + "LOYALTY_PROGRAM" + ], + "description": "Type of campaign." + }, + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria \n- `STATIC`: vouchers need to be manually published", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + }, + "voucher": { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_LOYALTY_CARD" + }, + "auto_join": { + "type": "boolean", + "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "use_voucher_metadata_schema": { + "type": "boolean", + "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "vouchers_count": { + "type": "integer", + "description": "Total number of unique vouchers in campaign." + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2021-12-01T08:00:50.038Z", + "description": "Timestamp representing the date and time when the campaign was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-09-20T09:18:19.623Z", + "description": "Timestamp representing the date and time when the voucher was updated in ISO 8601 format." + }, + "creation_status": { + "type": "string", + "enum": [ + "DONE", + "IN_PROGRESS", + "FAILED", + "DRAFT", + "MODIFYING" + ], + "description": "Indicates the status of the campaign creation." + }, + "vouchers_generation_status": { + "type": "string", + "description": "Indicates the status of the campaign's vouchers.", + "enum": [ + "DONE", + "IN_PROGRESS", + "FAILED", + "DRAFT" + ] + }, + "protected": { + "type": "boolean", + "description": "Indicates whether the resource can be deleted." + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to.", + "example": "cat_0b688929a2476386a7" + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" + }, + "loyalty_tiers_expiration": { + "type": "object", + "description": "Defines the expiration mechanism for loyalty tiers.", + "anyOf": [ + { + "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance" + }, + { + "$ref": "#/components/schemas/2_loyalty_tiers_expiration_points_in_period" + } + ] + }, + "object": { + "type": "string", + "default": "campaign", + "description": "The type of object represented by JSON. This object stores information about the campaign." + } } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "object": { - "type": "string", - "default": "earning_rule", - "description": "The type of object represented by JSON. Default is `earning_rule`." - }, - "automation_id": { - "type": "string", - "description": "For internal use by Voucherify.", - "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } - } - }, - "8_req_earning_rule_object_custom_event": { - "description": "This is an object representing an earning rule triggered by a custom event.", - "type": "object", - "title": "Earning Rule Object for Custom Event", - "examples": [ - { - "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", - "created_at": "2022-02-07T08:19:41.810Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 2, - "type": "FIXED" - }, - "custom_event": { - "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" - }, - "event": "saw_on_facebook", - "source": { - "banner": "Saw on Facebook Timeframe", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" }, - "active": true, - "start_date": "2022-02-07T08:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" + "8_obj_loyalty_campaign_object_no_extended_categories": { + "title": "Loyalty Campaign Object", + "description": "This is an object representing a loyalty campaign. \n\nThe loyalty campaign object contains details about the loyalty campaign. You can use dedicated endpoints to list loyalty campaigns, list loyalty card holders, member activities, active rewards, earning rules, loyalty tiers for given loyalty campaign.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique campaign ID, assigned by Voucherify.", + "example": "camp_f7fBbQxUuTN7dI7tGOo5XMDA" + }, + "name": { + "type": "string", + "description": "Loyalty campaign name." + }, + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "campaign_type": { + "type": "string", + "enum": [ + "LOYALTY_PROGRAM" + ], + "description": "Type of campaign." + }, + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria \n- `STATIC`: vouchers need to be manually published", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + }, + "voucher": { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_LOYALTY_CARD" + }, + "auto_join": { + "type": "boolean", + "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "use_voucher_metadata_schema": { + "type": "boolean", + "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "vouchers_count": { + "type": "integer", + "description": "Total number of unique vouchers in campaign." + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2021-12-01T08:00:50.038Z", + "description": "Timestamp representing the date and time when the campaign was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-09-20T09:18:19.623Z", + "description": "Timestamp representing the date and time when the voucher was updated in ISO 8601 format." + }, + "creation_status": { + "type": "string", + "enum": [ + "DONE", + "IN_PROGRESS", + "FAILED", + "DRAFT", + "MODIFYING" + ], + "description": "Indicates the status of the campaign creation." + }, + "vouchers_generation_status": { + "type": "string", + "description": "Indicates the status of the campaign's vouchers.", + "enum": [ + "DONE", + "IN_PROGRESS", + "FAILED", + "DRAFT" + ] + }, + "protected": { + "type": "boolean", + "description": "Indicates whether the resource can be deleted." + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to.", + "example": "cat_0b688929a2476386a7" + }, + "categories": { + "type": "array", + "description": "Contains details about the category.", + "items": { + "$ref": "#/components/schemas/20_obj_category_object" + } + }, + "loyalty_tiers_expiration": { + "type": "object", + "description": "Defines the expiration mechanism for loyalty tiers.", + "anyOf": [ + { + "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance" + }, + { + "$ref": "#/components/schemas/2_loyalty_tiers_expiration_points_in_period" + } + ] + }, + "object": { + "type": "string", + "default": "campaign", + "description": "The type of object represented by JSON. This object stores information about the campaign." + } + } }, - "object": "earning_rule", - "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" - } - ], - "properties": { - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_custom_event_metadata" + "8_obj_loyalty_card_object": { + "title": "Loyalty Card Object", + "type": "object", + "description": "This is an object representing a loyalty card.", + "examples": [ + { + "id": "v_hrMBBeT4sOP9VSGPmj5KAgJwX202UjiY", + "code": "LOYALTY-CARD-xLPbpbXR", + "campaign": "Loyalty Program Fall 2022", + "campaign_id": "camp_f7fBbQxUuTN7dI7tGOo5XMDA", + "category": "First", + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" + } + ], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 110, + "balance": 100, + "next_expiration_date": "2023-12-31", + "next_expiration_points": 100 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8/6I6hUEqtz/F6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD/DjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8%2F6I6hUEqtz%2FF6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD%2FDjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/SpYuOrU9wd6/o1wzy6E/04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ/FJtiw69djuzQk1f4HdQo8s5gaZ7fd2U+1zbaeAvi9usyvRHZE4=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FSpYuOrU9wd6%2Fo1wzy6E%2F04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ%2FFJtiw69djuzQk1f4HdQo8s5gaZ7fd2U%2B1zbaeAvi9usyvRHZE4%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-19T07:56:22.355Z", + "updated_at": "2022-09-19T08:04:22.458Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "redeemed_points": 10, + "object": "list", + "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/publications?page=1&limit=10" + }, + "object": "voucher" + } + ], + "properties": { + "id": { + "type": "string", + "example": "v_mkZN9v7vjYUadXnHrMza8W5c34fE5KiV", + "description": "Assigned by the Voucherify API, identifies the voucher." + }, + "code": { + "type": "string", + "example": "WVPblOYX", + "description": "A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters." + }, + "campaign": { + "type": "string", + "example": "Loyalty Card Campaign", + "description": "A unique campaign name, identifies the voucher's parent campaign." + }, + "campaign_id": { + "type": "string", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV", + "description": "Assigned by the Voucherify API, identifies the voucher's parent campaign." + }, + "category": { + "type": "string", + "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint." + }, + "category_id": { + "type": "string", + "description": "Unique category ID assigned by Voucherify.", + "example": "cat_0bb343dee3cdb5ec0c" + }, + "categories": { + "type": "array", + "description": "Contains details about the category.", + "items": { + "$ref": "#/components/schemas/20_obj_category_object" + } + }, + "type": { + "type": "string", + "enum": [ + "LOYALTY_CARD" + ], + "description": "Defines the type of voucher. " + }, + "discount": { + "default": null, + "description": "Object representing discount parameters. Child attributes are present only if `type` is `DISCOUNT_VOUCHER`. Defaults to `null`.", + "type": "null" + }, + "gift": { + "type": "null", + "description": "Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`." + }, + "loyalty_card": { + "type": "object", + "description": "Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`.", + "properties": { + "points": { + "type": "integer", + "example": 7000, + "description": "Total points incurred over lifespan of loyalty card." + }, + "balance": { + "type": "integer", + "example": 6970, + "description": "Points available for reward redemption." + }, + "next_expiration_date": { + "type": "string", + "format": "date", + "example": "2023-05-30", + "description": "The next closest date when the next set of points are due to expire." + }, + "next_expiration_points": { + "type": "integer", + "description": "The amount of points that are set to expire next." + } + } + }, + "start_date": { + "type": "string", + "example": "2021-12-01T00:00:00.000Z", + "format": "date-time", + "description": "Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. " + }, + "expiration_date": { + "type": "string", + "example": "2021-12-31T00:00:00.000Z", + "format": "date-time", + "description": "Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the voucher is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "example": "PT1H", + "description": "Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a `duration` of `PT1H` will be valid for a duration of one hour." + }, + "interval": { + "type": "string", + "example": "P2D", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an `interval` of `P2D` will be active every other day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "enum": [ + [ + 0 + ], + [ + 1 + ], + [ + 2 + ], + [ + 3 + ], + [ + 4 + ], + [ + 5 + ], + [ + 6 + ] + ], + "description": "Integer array corresponding to the particular days of the week in which the voucher is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" + }, + "additional_info": { + "type": "string", + "description": "An optional field to keep any extra textual information about the code such as a code description and details." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + }, + "assets": { + "type": "object", + "description": "Stores links to images of QR and barcode that correspond to an encrypted voucher code.", + "properties": { + "qr": { + "type": "object", + "description": "Stores Quick Response (QR) representation of encrypted code.", + "properties": { + "id": { + "type": "string", + "example": "U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK+t4pp7U7oFzjGJzj9q/bmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg+BaZk5QwXMf8k/OzSlOEVybpwSq+AiqPoNtjeuqtIgkDyvT6Q==", + "description": "Encrypted voucher code ID." + }, + "url": { + "type": "string", + "example": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK%2Bt4pp7U7oFzjGJzj9q%2FbmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg%2BBaZk5QwXMf8k%2FOzSlOEVybpwSq%2BAiqPoNtjeuqtIgkDyvT6Q%3D%3D", + "description": "URL to QR code \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" + } + } + }, + "barcode": { + "type": "object", + "description": "Stores barcode representation of encrypted code.", + "properties": { + "id": { + "type": "string", + "example": "U2FsdGVkX19eJhGfWwUrH9+tulBkON+AnMktic+N6CVWzZ9+fHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ+kJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6/pFs61apEn9SJx32ttCF6d3oxKISQQ==", + "description": "Encrypted voucher code ID." + }, + "url": { + "type": "string", + "example": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19eJhGfWwUrH9%2BtulBkON%2BAnMktic%2BN6CVWzZ9%2BfHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ%2BkJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6%2FpFs61apEn9SJx32ttCF6d3oxKISQQ%3D%3D", + "description": "URL to barcode \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" + } + } + } + } + }, + "is_referral_code": { + "type": "boolean", + "description": "Flag indicating whether this voucher is a referral code." + }, + "created_at": { + "type": "string", + "example": "2021-12-22T10:13:06.487Z", + "description": "Timestamp representing the date and time when the voucher was created in ISO 8601 format.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2021-12-22T10:14:45.316Z", + "format": "date-time", + "description": "Timestamp representing the date and time when the voucher was last updated in ISO 8601 format." + }, + "holder_id": { + "type": "string", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "description": "Unique customer ID of voucher owner." + }, + "redemption": { + "type": "object", + "description": "Stores a summary of redemptions that have been applied to the voucher.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + }, + "redeemed_quantity": { + "type": "integer", + "example": 1, + "description": "How many times a voucher has already been redeemed." + }, + "redeemed_points": { + "type": "integer", + "example": 100000, + "description": "Total loyalty points redeemed." + }, + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute." + }, + "url": { + "type": "string", + "example": "/v1/vouchers/WVPblOYX/redemptions?page=1&limit=10", + "description": "The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`" + } + } + }, + "publish": { + "type": "object", + "description": "This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or publish voucher API method. \n\n\n\n| Required | Optional |\n| -------- | :------: |\n| `type`:`LOYALTY_CARD` | `type`:`DISCOUNT_VOUCHER` | \n| `is_referral_code`:`true` | `type`:`GIFT_VOUCHER` |\n", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute." + }, + "count": { + "type": "integer", + "example": 0, + "description": "Publication events counter." + }, + "url": { + "type": "string", + "example": "/v1/vouchers/WVPblOYX/publications?page=1&limit=10", + "description": "The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`" + } + } + }, + "object": { + "type": "string", + "description": "The type of object represented by JSON. Default is `voucher`.", + "default": "voucher" + } }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" + "x-tags": [ + "LOYALTIES API" + ] + }, + "8_obj_loyalty_reward_object": { + "title": "Loyalty Reward Object", + "type": "object", + "description": "This is an object representing a loyalty reward.", + "x-tags": [ + "LOYALTIES API" + ], + "properties": { + "reward": { + "$ref": "#/components/schemas/4_obj_reward_object" + }, + "assignment": { + "$ref": "#/components/schemas/4_obj_reward_assignment_object" + }, + "object": { + "type": "string", + "default": "loyalty_reward", + "description": "The type of object represented by JSON. This object stores information about the loyalty reward object." + } } - ] - }, - "custom_event": { - "type": "object", - "description": "Contains the schema id of a custom event. **Required** for the custom event option in `event`.", - "properties": { - "schema_id": { - "type": "string", - "description": "Contains a unique identifier of a custom event schema. Assigned by the Voucherify API.", - "example": "ms_gn4Qe4xsFPf7orCArCiNVY13" + }, + "8_obj_loyalty_points_bucket": { + "type": "object", + "title": "Loyalty Points Bucket Object", + "description": "This is an object representing a loyalty points bucket.", + "properties": { + "id": { + "type": "string", + "example": "lopb_zdeIBq3EsnPnRSDa7Tyyb6X2", + "description": "Unique loyalty points bucket ID." + }, + "voucher_id": { + "type": "string", + "example": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", + "description": "Unique parent loyalty card ID." + }, + "campaign_id": { + "type": "string", + "example": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "description": "Unique parent campaign ID." + }, + "bucket": { + "type": "object", + "description": "Defines the number of points stored in the given loyalty points bucket.", + "properties": { + "total_points": { + "type": "integer", + "description": "Total number of points in the loyalty points bucket." + } + } + }, + "status": { + "type": "string", + "enum": [ + "ACTIVE" + ], + "description": "Loyalty points bucket point status." + }, + "expires_at": { + "type": "string", + "example": "2022-11-30", + "format": "date", + "description": "Date when the number of points defined in the `bucket` object are due to expire." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-11-21T13:49:54.949Z", + "description": "Timestamp representing the date and time when the loyalty points bucket object was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "example": "2022-08-30T08:34:45.989Z", + "format": "date-time", + "description": "Timestamp representing the date and time when the loyalty points bucket object was updated in ISO 8601 format." + }, + "object": { + "type": "string", + "default": "loyalty_points_bucket", + "description": "The type of object represented by JSON. This object stores information about the loyalty points bucket." + } } - } - }, - "event": { - "type": "string", - "enum": [ - "custom_event_defined_in_EVENT_SCHEMA" - ], - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `custom_event_name` the name of a custom event defined in the Dashboard → **Project Settings** → **EVENT SCHEMA** → **Add event definition**. Read more on defining [custom events](https://support.voucherify.io/article/111-custom-events). " - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + }, + "8_obj_loyalty_tier_reward_object": { + "title": "Loyalty Tier Reward Object", + "type": "object", + "description": "This is an object representing a loyalty tier reward.", + "x-tags": [ + "LOYALTIES API" + ], + "properties": { + "reward": { + "$ref": "#/components/schemas/4_obj_reward_object" + }, + "assignment": { + "$ref": "#/components/schemas/4_obj_reward_assignment_object" + }, + "object": { + "type": "string", + "default": "loyalty_tier_reward", + "description": "The type of object represented by JSON. This object stores information about the loyalty tier reward." + } } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } - } - }, - "8_req_update_earning_rule_object_custom_event": { - "description": "This is an object representing an earning rule triggered by a custom event.", - "type": "object", - "title": "Earning Rule Object for Custom Event", - "examples": [ - { - "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", - "created_at": "2022-02-07T08:19:41.810Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 2, - "type": "FIXED" - }, - "custom_event": { - "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" - }, - "event": "saw_on_facebook", - "source": { - "banner": "Saw on Facebook Timeframe", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-07T08:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" }, - "object": "earning_rule", - "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" - } - ], - "properties": { - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_custom_event_metadata" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + "8_obj_loyalty_card_object_non_expanded_categories": { + "title": "Loyalty Card Object", + "type": "object", + "description": "This is an object representing a loyalty card.", + "examples": [ + { + "id": "v_hrMBBeT4sOP9VSGPmj5KAgJwX202UjiY", + "code": "LOYALTY-CARD-xLPbpbXR", + "campaign": "Loyalty Program Fall 2022", + "campaign_id": "camp_f7fBbQxUuTN7dI7tGOo5XMDA", + "category": "First", + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" + } + ], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 110, + "balance": 100, + "next_expiration_date": "2023-12-31", + "next_expiration_points": 100 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8/6I6hUEqtz/F6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD/DjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8%2F6I6hUEqtz%2FF6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD%2FDjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/SpYuOrU9wd6/o1wzy6E/04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ/FJtiw69djuzQk1f4HdQo8s5gaZ7fd2U+1zbaeAvi9usyvRHZE4=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FSpYuOrU9wd6%2Fo1wzy6E%2F04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ%2FFJtiw69djuzQk1f4HdQo8s5gaZ7fd2U%2B1zbaeAvi9usyvRHZE4%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-19T07:56:22.355Z", + "updated_at": "2022-09-19T08:04:22.458Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "redeemed_points": 10, + "object": "list", + "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/publications?page=1&limit=10" + }, + "object": "voucher" + } + ], + "properties": { + "id": { + "type": "string", + "example": "v_mkZN9v7vjYUadXnHrMza8W5c34fE5KiV", + "description": "Assigned by the Voucherify API, identifies the voucher." + }, + "code": { + "type": "string", + "example": "WVPblOYX", + "description": "A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters." + }, + "campaign": { + "type": "string", + "example": "Loyalty Card Campaign", + "description": "A unique campaign name, identifies the voucher's parent campaign." + }, + "campaign_id": { + "type": "string", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV", + "description": "Assigned by the Voucherify API, identifies the voucher's parent campaign." + }, + "category": { + "type": "string", + "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint." + }, + "category_id": { + "type": "string", + "description": "Unique category ID assigned by Voucherify.", + "example": "cat_0bb343dee3cdb5ec0c" + }, + "categories": { + "type": "array", + "description": "Contains details about the category.", + "items": { + "$ref": "#/components/schemas/20_obj_category_object" + } + }, + "type": { + "type": "string", + "enum": [ + "LOYALTY_CARD" + ], + "description": "Defines the type of voucher. " + }, + "discount": { + "default": null, + "description": "Object representing discount parameters. Child attributes are present only if `type` is `DISCOUNT_VOUCHER`. Defaults to `null`.", + "type": "null" + }, + "gift": { + "type": "null", + "description": "Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`." + }, + "loyalty_card": { + "type": "object", + "description": "Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`.", + "properties": { + "points": { + "type": "integer", + "example": 7000, + "description": "Total points incurred over lifespan of loyalty card." + }, + "balance": { + "type": "integer", + "example": 6970, + "description": "Points available for reward redemption." + }, + "next_expiration_date": { + "type": "string", + "format": "date", + "example": "2023-05-30", + "description": "The next closest date when the next set of points are due to expire." + }, + "next_expiration_points": { + "type": "integer", + "description": "The amount of points that are set to expire next." + } + } + }, + "start_date": { + "type": "string", + "example": "2021-12-01T00:00:00.000Z", + "format": "date-time", + "description": "Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. " + }, + "expiration_date": { + "type": "string", + "example": "2021-12-31T00:00:00.000Z", + "format": "date-time", + "description": "Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the voucher is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "example": "PT1H", + "description": "Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a `duration` of `PT1H` will be valid for a duration of one hour." + }, + "interval": { + "type": "string", + "example": "P2D", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an `interval` of `P2D` will be active every other day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "enum": [ + [ + 0 + ], + [ + 1 + ], + [ + 2 + ], + [ + 3 + ], + [ + 4 + ], + [ + 5 + ], + [ + 6 + ] + ], + "description": "Integer array corresponding to the particular days of the week in which the voucher is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" + }, + "additional_info": { + "type": "string", + "description": "An optional field to keep any extra textual information about the code such as a code description and details." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + }, + "assets": { + "type": "object", + "description": "Stores links to images of QR and barcode that correspond to an encrypted voucher code.", + "properties": { + "qr": { + "type": "object", + "description": "Stores Quick Response (QR) representation of encrypted code.", + "properties": { + "id": { + "type": "string", + "example": "U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK+t4pp7U7oFzjGJzj9q/bmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg+BaZk5QwXMf8k/OzSlOEVybpwSq+AiqPoNtjeuqtIgkDyvT6Q==", + "description": "Encrypted voucher code ID." + }, + "url": { + "type": "string", + "example": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK%2Bt4pp7U7oFzjGJzj9q%2FbmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg%2BBaZk5QwXMf8k%2FOzSlOEVybpwSq%2BAiqPoNtjeuqtIgkDyvT6Q%3D%3D", + "description": "URL to QR code \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" + } + } + }, + "barcode": { + "type": "object", + "description": "Stores barcode representation of encrypted code.", + "properties": { + "id": { + "type": "string", + "example": "U2FsdGVkX19eJhGfWwUrH9+tulBkON+AnMktic+N6CVWzZ9+fHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ+kJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6/pFs61apEn9SJx32ttCF6d3oxKISQQ==", + "description": "Encrypted voucher code ID." + }, + "url": { + "type": "string", + "example": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19eJhGfWwUrH9%2BtulBkON%2BAnMktic%2BN6CVWzZ9%2BfHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ%2BkJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6%2FpFs61apEn9SJx32ttCF6d3oxKISQQ%3D%3D", + "description": "URL to barcode \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" + } + } + } + } + }, + "is_referral_code": { + "type": "boolean", + "description": "Flag indicating whether this voucher is a referral code." + }, + "created_at": { + "type": "string", + "example": "2021-12-22T10:13:06.487Z", + "description": "Timestamp representing the date and time when the voucher was created in ISO 8601 format.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2021-12-22T10:14:45.316Z", + "format": "date-time", + "description": "Timestamp representing the date and time when the voucher was last updated in ISO 8601 format." + }, + "holder_id": { + "type": "string", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "description": "Unique customer ID of voucher owner." + }, + "redemption": { + "type": "object", + "description": "Stores a summary of redemptions that have been applied to the voucher.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + }, + "redeemed_quantity": { + "type": "integer", + "example": 1, + "description": "How many times a voucher has already been redeemed." + }, + "redeemed_points": { + "type": "integer", + "example": 100000, + "description": "Total loyalty points redeemed." + }, + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute." + }, + "url": { + "type": "string", + "example": "/v1/vouchers/WVPblOYX/redemptions?page=1&limit=10", + "description": "The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`" + } + } + }, + "publish": { + "type": "object", + "description": "This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or publish voucher API method. \n\n\n\n| Required | Optional |\n| -------- | :------: |\n| `type`:`LOYALTY_CARD` | `type`:`DISCOUNT_VOUCHER` | \n| `is_referral_code`:`true` | `type`:`GIFT_VOUCHER` |\n", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute." + }, + "count": { + "type": "integer", + "example": 0, + "description": "Publication events counter." + }, + "url": { + "type": "string", + "example": "/v1/vouchers/WVPblOYX/publications?page=1&limit=10", + "description": "The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`" + } + } + }, + "object": { + "type": "string", + "description": "The type of object represented by JSON. Default is `voucher`.", + "default": "voucher" + } } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" + }, + "8_res_get_loyalty_card_transactions": { + "title": "Get Loyalty Card Transactions Response Body", + "type": "object", + "description": "List of loyalty card transactions", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON." + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of transaction objects." + }, + "data": { + "type": "array", + "description": "A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object.", + "items": { + "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object" + } + }, + "has_more": { + "type": "boolean", + "description": "As query results are always limited (by the limit parameter), the `has_more` flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results." + } } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } - } - }, - "8_obj_earning_rule_object_custom_event_no_validation_rule": { - "description": "This is an object representing an earning rule triggered by a custom event.", - "type": "object", - "title": "Earning Rule Object for Custom Event", - "examples": [ - { - "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", - "created_at": "2022-02-07T08:19:41.810Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 2, - "type": "FIXED" - }, - "custom_event": { - "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" - }, - "event": "saw_on_facebook", - "source": { - "banner": "Saw on Facebook Timeframe", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" }, - "active": true, - "start_date": "2022-02-07T08:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" + "1_obj_loyalty_card_transaction_object": { + "title": "Loyalty Card Transaction Object", + "description": "Loyalty card transaction object", + "anyOf": [ + { + "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_redemption" + }, + { + "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_accrual" + }, + { + "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_accrual_custom_event" + }, + { + "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_refund" + }, + { + "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_addition" + }, + { + "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_removal" + }, + { + "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_expiration" + }, + { + "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_transfer_out" + }, + { + "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_transfer_in" + } + ] }, - "object": "earning_rule", - "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" - } - ], - "properties": { - "id": { - "type": "string", - "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", - "description": "Assigned by the Voucherify API, identifies the earning rule object." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", - "example": "2022-02-02T13:18:32.557Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", - "example": "2022-02-03T13:09:27.206Z", - "format": "date-time" - }, - "validation_rule_id": { - "type": "null", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_custom_event_metadata" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "custom_event": { - "type": "object", - "description": "Contains the schema id of a custom event. **Required** for the custom event option in `event`.", - "properties": { - "schema_id": { - "type": "string", - "description": "Contains a unique identifier of a custom event schema. Assigned by the Voucherify API.", - "example": "ms_gn4Qe4xsFPf7orCArCiNVY13" - } - } - }, - "event": { - "type": "string", - "enum": [ - "custom_event_defined_in_EVENT_SCHEMA" - ], - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `custom_event_name` the name of a custom event defined in the Dashboard → **Project Settings** → **EVENT SCHEMA** → **Add event definition**. Read more on defining [custom events](https://support.voucherify.io/article/111-custom-events). " - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - }, - "object_id": { - "type": "string", - "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "description": "A unique campaign identifier assigned by the Voucherify API." - }, - "object_type": { - "type": "string", - "default": "campaign", - "description": "Defines the object associated with the earning rule. Defaults to `campaign`." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "object": { - "type": "string", - "default": "earning_rule", - "description": "The type of object represented by JSON. Default is `earning_rule`." - }, - "automation_id": { - "type": "string", - "description": "For internal use by Voucherify.", - "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } - } - }, - "8_obj_earning_rule_object_tier": { - "description": "This is an object representing an earning rule for tiers.", - "type": "object", - "title": "Earning Rule Object for Tiers", - "properties": { - "id": { - "type": "string", - "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", - "description": "Assigned by the Voucherify API, identifies the earning rule object." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", - "example": "2022-02-02T13:18:32.557Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", - "example": "2022-02-03T13:09:27.206Z", - "format": "date-time" - }, - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "event": { - "type": "string", - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.loyalty.tier.joined` an event defined by the Voucherify API corresponding to a customer joining a tier \n- `customer.loyalty.tier.left` an event defined by the Voucherify API corresponding to a customer leaving a tier \n- `customer.loyalty.tier.upgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.downgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.prolonged` an event defined by the Voucherify API corresponding to a customer's tier being prolonged", - "enum": [ - "customer.loyalty.tier.joined", - "customer.loyalty.tier.left", - "customer.loyalty.tier.upgraded", - "customer.loyalty.tier.downgraded", - "customer.loyalty.tier.prolonged" - ] - }, - "loyalty_tier": { - "type": "object", - "description": "Defines the tier associated with the earning rule definition.", - "properties": { - "id": { - "type": "string", - "description": "Unique loyalty tier ID associated with the earning rule. \n\n- `__ANY__`: any loyalty tier within the campaign", - "example": "ltr_pudTGWasuIqxdiDM0go31OV1" + "1_obj_loyalty_card_transaction_object_redemption": { + "title": "Redemption", + "description": "When loyalty points are used to pay for an order.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique transaction ID.", + "example": "vtx_0c9dccc4d5813e71bd" + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is `null`." + }, + "voucher_id": { + "type": "string", + "description": "Unique voucher ID.", + "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "source": { + "type": "string", + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is `null`." + }, + "reason": { + "type": "string", + "description": "Reason why the transaction occurred. In case of a redemption, this value is `null`." + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "POINTS_REDEMPTION", + "enum": [ + "POINTS_REDEMPTION" + ] + }, + "details": { + "type": "object", + "description": "Contains the detailed information about the transaction.", + "properties": { + "balance": { + "type": "object", + "description": "Contains information on how the balance was affected by the transaction.", + "properties": { + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "loyalty_card" + }, + "total": { + "type": "integer", + "description": "The available points prior to the transaction." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON.", + "default": "balance" + }, + "points": { + "type": "integer", + "description": "The amount of points being used up in the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." + }, + "related_object": { + "type": "object", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "type": { + "type": "string", + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" + } + } + } + } + }, + "order": { + "type": "object", + "description": "Contains information about the original order.", + "properties": { + "id": { + "type": "string", + "description": "Unique order ID.", + "example": "ord_jj5EzDxDOd2xFPsAJJ18IaZK" + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + } + } + }, + "redemption": { + "type": "object", + "description": "Contains information about the original redemption.", + "properties": { + "id": { + "type": "string", + "description": "Unique redemption ID.", + "example": "r_0c94ed583fcafc31c1" + } + } + }, + "reward": { + "type": "object", + "description": "Contains information about the pay with points reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique reward ID.", + "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1" + }, + "name": { + "type": "string", + "description": "Reward name.", + "example": "100 = $20" + } + } + } + } + }, + "related_transaction_id": { + "type": "string", + "description": "This field is `null` in the case of this type of transaction." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." + } } - } - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - }, - "object_id": { - "type": "string", - "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "description": "A unique campaign identifier assigned by the Voucherify API." - }, - "object_type": { - "type": "string", - "default": "campaign", - "description": "Defines the object associated with the earning rule. Defaults to `campaign`." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "object": { - "type": "string", - "default": "earning_rule", - "description": "The type of object represented by JSON. Default is `earning_rule`." - }, - "automation_id": { - "type": "string", - "description": "For internal use by Voucherify.", - "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } - } - }, - "8_req_earning_rule_object_tier": { - "description": "This is an object representing an earning rule for tiers.", - "type": "object", - "title": "Earning Rule Object for Tiers", - "properties": { - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "event": { - "type": "string", - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.loyalty.tier.joined` an event defined by the Voucherify API corresponding to a customer joining a tier \n- `customer.loyalty.tier.left` an event defined by the Voucherify API corresponding to a customer leaving a tier \n- `customer.loyalty.tier.upgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.downgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.prolonged` an event defined by the Voucherify API corresponding to a customer's tier being prolonged", - "enum": [ - "customer.loyalty.tier.joined", - "customer.loyalty.tier.left", - "customer.loyalty.tier.upgraded", - "customer.loyalty.tier.downgraded", - "customer.loyalty.tier.prolonged" - ] - }, - "loyalty_tier": { - "type": "object", - "description": "Defines the tier associated with the earning rule definition.", - "properties": { - "id": { - "type": "string", - "description": "Unique loyalty tier ID associated with the earning rule. \n\n- `__ANY__`: any loyalty tier within the campaign", - "example": "ltr_pudTGWasuIqxdiDM0go31OV1" - } - } - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } - } - }, - "8_req_update_earning_rule_object_tier": { - "description": "This is an object representing an earning rule for tiers.", - "type": "object", - "title": "Earning Rule Object for Tiers", - "properties": { - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "event": { - "type": "string", - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.loyalty.tier.joined` an event defined by the Voucherify API corresponding to a customer joining a tier \n- `customer.loyalty.tier.left` an event defined by the Voucherify API corresponding to a customer leaving a tier \n- `customer.loyalty.tier.upgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.downgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.prolonged` an event defined by the Voucherify API corresponding to a customer's tier being prolonged", - "enum": [ - "customer.loyalty.tier.joined", - "customer.loyalty.tier.left", - "customer.loyalty.tier.upgraded", - "customer.loyalty.tier.downgraded", - "customer.loyalty.tier.prolonged" - ] - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } - } - }, - "8_obj_earning_rule_object_tier_no_validation_rule": { - "description": "This is an object representing an earning rule for tiers.", - "type": "object", - "title": "Earning Rule Object for Tiers", - "properties": { - "id": { - "type": "string", - "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", - "description": "Assigned by the Voucherify API, identifies the earning rule object." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", - "example": "2022-02-02T13:18:32.557Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", - "example": "2022-02-03T13:09:27.206Z", - "format": "date-time" - }, - "validation_rule_id": { - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance.", - "type": "null" - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "event": { - "type": "string", - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.loyalty.tier.joined` an event defined by the Voucherify API corresponding to a customer joining a tier \n- `customer.loyalty.tier.left` an event defined by the Voucherify API corresponding to a customer leaving a tier \n- `customer.loyalty.tier.upgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.downgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.prolonged` an event defined by the Voucherify API corresponding to a customer's tier being prolonged", - "enum": [ - "customer.loyalty.tier.joined", - "customer.loyalty.tier.left", - "customer.loyalty.tier.upgraded", - "customer.loyalty.tier.downgraded", - "customer.loyalty.tier.prolonged" - ] - }, - "loyalty_tier": { - "type": "object", - "description": "Defines the tier associated with the earning rule definition.", - "properties": { - "id": { - "type": "string", - "description": "Unique loyalty tier ID associated with the earning rule. \n\n- `__ANY__`: any loyalty tier within the campaign", - "example": "ltr_pudTGWasuIqxdiDM0go31OV1" - } - } - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - }, - "object_id": { - "type": "string", - "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "description": "A unique campaign identifier assigned by the Voucherify API." - }, - "object_type": { - "type": "string", - "default": "campaign", - "description": "Defines the object associated with the earning rule. Defaults to `campaign`." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "object": { - "type": "string", - "default": "earning_rule", - "description": "The type of object represented by JSON. Default is `earning_rule`." - }, - "automation_id": { - "type": "string", - "description": "For internal use by Voucherify.", - "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } - } - }, - "8_obj_fixed_points": { - "title": "Define Fixed Amount of Points", - "type": "object", - "description": "This is an object representing points calculated based on a fixed value.", - "properties": { - "points": { - "type": "integer", - "description": "The number of points to be added to the loyalty card.", - "example": 100 - }, - "type": { - "type": "string", - "description": "Defines how the points will be added to the loyalty card. `FIXED` adds a fixed number of `points`.", - "enum": [ - "FIXED" - ] - } - } - }, - "8_obj_calculate_points_proportionally_order_paid": { - "title": "Calculate Points Proportionally", - "description": "This is an object representing points calculated proportionally to another property.", - "anyOf": [ - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_amounts" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_total_amount" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_metadata" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_item_amount" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_items_subtotal_amount" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_items_quantity" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "8_obj_calculate_points_proportionally_order_amounts": { - "title": "Calculate Points Proportionally to Order Amount", - "type": "object", - "description": "This is an object representing points calculated proportionally to another property.", - "properties": { - "type": { - "type": "string", - "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", - "enum": [ - "PROPORTIONAL" - ] - }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_AMOUNT" - ], - "description": "`ORDER_AMOUNT`: Pre-discount order amount (X points for every Y spent excluding discounts)" - }, - "order": { - "type": "object", - "properties": { - "amount": { - "type": "object", - "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every set of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` `calculation_type`, give `points`.", - "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + }, + "1_obj_loyalty_card_transaction_object_accrual": { + "title": "Accrual", + "description": "When points are earned on the card through an earning rule.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique transaction ID.", + "example": "vtx_0c9dccc4d5813e71bd" + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a points accrual, this value is `null`." + }, + "voucher_id": { + "type": "string", + "description": "Unique voucher ID.", + "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "source": { + "type": "string", + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", + "enum": [ + "Automation" + ] + }, + "reason": { + "type": "string", + "description": "Reason why the transaction occurred. In case of a points accrual, this value is `null`." + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "POINTS_ACCRUAL", + "enum": [ + "POINTS_ACCRUAL" + ] + }, + "details": { + "type": "object", + "description": "Contains the detailed information about the transaction.", + "properties": { + "balance": { + "type": "object", + "description": "Contains information on how the balance was affected by the transaction.", + "properties": { + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "loyalty_card" + }, + "total": { + "type": "integer", + "description": "The available points after the transaction." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON.", + "default": "balance" + }, + "points": { + "type": "integer", + "description": "The amount of points being added in the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." + }, + "related_object": { + "type": "object", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "type": { + "type": "string", + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" + } + } + } + } + }, + "order": { + "type": "object", + "description": "Contains information about the original order.", + "properties": { + "id": { + "type": "string", + "description": "Unique order ID.", + "example": "ord_jj5EzDxDOd2xFPsAJJ18IaZK" + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + } + } + }, + "event": { + "type": "object", + "description": "Contains information about the event that triggers the point accrual.", + "properties": { + "id": { + "type": "string", + "description": "Unique event ID.", + "example": "evcus_0c9c21def34e3c05bf" + }, + "type": { + "type": "string", + "description": "Type of event.", + "example": "customer.order.paid" + } + } + }, + "earning_rule": { + "type": "object", + "description": "Contains information about the earning rule.", + "properties": { + "id": { + "type": "string", + "description": "Unique earning rule ID.", + "example": "ern_2WsCIBEx6Lzf5IAV5IOR7a23" + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name.", + "properties": { + "banner": { + "type": "string", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + } + } + } + } + } } + }, + "related_transaction_id": { + "type": "string", + "description": "This field is `null` in the case of this type of transaction." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." } } - } - } - } - }, - "8_obj_calculate_points_proportionally_order_total_amount": { - "title": "Calculate Points Proportionally to Total Order Amount", - "type": "object", - "description": "This is an object representing points calculated proportionally to another property.", - "properties": { - "type": { - "type": "string", - "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", - "enum": [ - "PROPORTIONAL" - ] - }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_TOTAL_AMOUNT" - ], - "description": "`ORDER_TOTAL_AMOUNT`: Total order amount (X points for every Y spent including discount)" - }, - "order": { - "type": "object", - "properties": { - "total_amount": { - "type": "object", - "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every set of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` `calculation_type`, give `points`.", - "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + }, + "1_obj_loyalty_card_transaction_object_accrual_custom_event": { + "title": "Accrual for Custom Event", + "description": "When points are earned on the card through an earning rule based on a custom event.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique transaction ID.", + "example": "vtx_0c9dccc4d5813e71bd" + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a points accrual, this value is `null`." + }, + "voucher_id": { + "type": "string", + "description": "Unique voucher ID.", + "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "source": { + "type": "string", + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", + "enum": [ + "Automation" + ] + }, + "reason": { + "type": "string", + "description": "Reason why the transaction occurred. In case of a points accrual, this value is `null`." + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "POINTS_ACCRUAL", + "enum": [ + "POINTS_ACCRUAL" + ] + }, + "details": { + "type": "object", + "description": "Contains the detailed information about the transaction.", + "properties": { + "balance": { + "type": "object", + "description": "Contains information on how the balance was affected by the transaction.", + "properties": { + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "loyalty_card" + }, + "total": { + "type": "integer", + "description": "The available points after the transaction." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON.", + "default": "balance" + }, + "points": { + "type": "integer", + "description": "The amount of points being added in the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." + }, + "related_object": { + "type": "object", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "type": { + "type": "string", + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" + } + } + } + } + }, + "event": { + "type": "object", + "description": "Contains information about the customer event that triggers the point accrual.", + "properties": { + "id": { + "type": "string", + "description": "Unique event ID.", + "example": "evcus_0c9c21def34e3c05bf" + }, + "type": { + "type": "string", + "description": "Type of event.", + "example": "customer.custom_event" + } + } + }, + "earning_rule": { + "type": "object", + "description": "Contains information about the earning rule.", + "properties": { + "id": { + "type": "string", + "description": "Unique earning rule ID.", + "example": "ern_2WsCIBEx6Lzf5IAV5IOR7a23" + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name.", + "properties": { + "banner": { + "type": "string", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + } + } + } + } + }, + "custom_event": { + "type": "object", + "description": "Contains information about the custom event that triggers the point accrual.", + "properties": { + "id": { + "type": "string", + "description": "Unique event ID.", + "example": "event_0cc916d8374bfe8bc2" + }, + "type": { + "type": "string", + "description": "Type of custom event.", + "example": "user_subscribed" + } + } + }, + "event_schema": { + "type": "object", + "description": "Contains information about the custom event metadata schema.", + "properties": { + "id": { + "type": "string", + "description": "Unique metadata schema ID.", + "example": "ms_qpRZ3EmRQyszNH6Z52Gkq8au" + }, + "type": { + "type": "string", + "description": "Type of custom event.", + "example": "user_subscribed" + } + } + } } + }, + "related_transaction_id": { + "type": "string", + "description": "This field is `null` in the case of this type of transaction." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." } } - } - } - } - }, - "8_obj_calculate_points_proportionally_order_metadata": { - "title": "Calculate Points Proportionally To an Order Metadata Property", - "type": "object", - "description": "This is an object representing points calculated proportionally to an order metadata property.", - "properties": { - "type": { - "type": "string", - "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", - "enum": [ - "PROPORTIONAL" - ] - }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_METADATA" - ], - "description": "`ORDER_METADATA`: Order Metadata (X points for every Y in metadata attribute, defined in the `property` key under the `order.metadata` object)" - }, - "order": { - "type": "object", - "description": "Defines the formula for calculating points proportionally.", - "properties": { - "metadata": { - "type": "object", - "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every given increment of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` order metadata property value, give `points`.", - "properties": { - "every": { - "type": "integer", - "description": "For how many increments of the order metadata property to grant points for.", - "example": 100 - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card.", - "example": 10 - }, - "property": { - "type": "string", - "example": "number_of_store_visits", - "description": "Order metadata property." + }, + "1_obj_loyalty_card_transaction_object_refund": { + "title": "Refund", + "description": "When points are credited back to a card through a redemption rollback.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique transaction ID.", + "example": "vtx_0c9dccc4d5813e71bd" + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a points refund, this value is `null`." + }, + "voucher_id": { + "type": "string", + "description": "Unique voucher ID.", + "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "source": { + "type": "string", + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a points refund, this value is `null`." + }, + "reason": { + "type": "string", + "description": "Reason why the transaction occurred. In case of a points refund, this value is `null`." + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "POINTS_REFUND", + "enum": [ + "POINTS_REFUND" + ] + }, + "details": { + "type": "object", + "description": "Contains the detailed information about the transaction.", + "properties": { + "balance": { + "type": "object", + "description": "Contains information on how the balance was affected by the transaction.", + "properties": { + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "loyalty_card" + }, + "total": { + "type": "integer", + "description": "The available points after the transaction." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON.", + "default": "balance" + }, + "points": { + "type": "integer", + "description": "The amount of points being added in the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." + }, + "related_object": { + "type": "object", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "type": { + "type": "string", + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" + } + } + } + } + }, + "order": { + "type": "object", + "description": "Contains information about the original order.", + "properties": { + "id": { + "type": "string", + "description": "Unique order ID.", + "example": "ord_jj5EzDxDOd2xFPsAJJ18IaZK" + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + } + } + }, + "redemption": { + "type": "object", + "description": "Contains information about the original redemption.", + "properties": { + "id": { + "type": "string", + "description": "Unique redemption ID.", + "example": "r_0c94ed583fcafc31c1" + } + } + }, + "rollback": { + "type": "object", + "description": "Contains information about the redemption rollback.", + "properties": { + "id": { + "type": "string", + "description": "Unique redemption rollback ID.", + "example": "rr_0c9b0967244a862a33" + } + } + }, + "reward": { + "type": "object", + "description": "Contains information about the pay with points reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique reward ID.", + "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1" + }, + "name": { + "type": "string", + "description": "Reward name.", + "example": "100 = $20" + } + } + } } + }, + "related_transaction_id": { + "type": "string", + "description": "This field is `null` in the case of this type of transaction." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." } } - } - } - } - }, - "8_obj_calculate_points_proportionally_item_amount": { - "title": "Calculate Points Proportionally to Order Items Amount", - "type": "object", - "description": "This is an object representing points calculated proportionally to another property.", - "properties": { - "type": { - "type": "string", - "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", - "enum": [ - "PROPORTIONAL" - ] - }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_ITEMS_AMOUNT" - ], - "description": "- `ORDER_ITEMS_AMOUNT`; Pre-discount amount spent on items defined in the `order_items.amount.object` & `.id` (X points for every Y spent on items excluding discounts)" - }, - "order_items": { - "type": "object", - "properties": { - "amount": { - "type": "object", - "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every set of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` `calculation_type`, give `points`.", - "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - }, - "object": { - "type": "string", - "description": "Type of object taken under consideration.", - "enum": [ - "products_collection", - "product", - "sku" - ] - }, - "id": { - "type": "string", - "description": "Unique ID of the resource, i.e. `pc_75U0dHlr7u75BJodrW1AE3t6`, `prod_0bae32322150fd0546`, or `sku_0b7d7dfb090be5c619`." + }, + "1_obj_loyalty_card_transaction_object_addition": { + "title": "Addition", + "description": "When points are added to a card.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique transaction ID.", + "example": "vtx_0c9dccc4d5813e71bd" + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." + }, + "voucher_id": { + "type": "string", + "description": "Unique voucher ID.", + "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "source": { + "type": "string", + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", + "enum": [ + "voucherify-web-ui", + "API" + ] + }, + "reason": { + "type": "string", + "description": "Reason why the transaction occurred." + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "POINTS_ADDITION", + "enum": [ + "POINTS_ADDITION" + ] + }, + "details": { + "type": "object", + "description": "Contains the detailed information about the transaction.", + "properties": { + "balance": { + "type": "object", + "description": "Contains information on how the balance was affected by the transaction.", + "properties": { + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "loyalty_card" + }, + "total": { + "type": "integer", + "description": "The available points after the transaction." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON.", + "default": "balance" + }, + "points": { + "type": "integer", + "description": "The amount of points being added in the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." + }, + "related_object": { + "type": "object", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "type": { + "type": "string", + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" + } + } + } + } + } } + }, + "related_transaction_id": { + "type": "string", + "description": "This field is `null` in the case of this type of transaction." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." } } - } - } - } - }, - "8_obj_calculate_points_proportionally_items_subtotal_amount": { - "title": "Calculate Points Proportionally to Order Items Subtotal Amount", - "type": "object", - "description": "This is an object representing points calculated proportionally to another property.", - "properties": { - "type": { - "type": "string", - "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", - "enum": [ - "PROPORTIONAL" - ] - }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_ITEMS_SUBTOTAL_AMOUNT" - ], - "description": "- `ORDER_ITEMS_SUBTOTAL_AMOUNT`; Amount spent on items defined in the `order_items.subtotal_amount.object` & `.id` (X points for every Y spent on items including discounts)" - }, - "order_items": { - "type": "object", - "properties": { - "subtotal_amount": { - "type": "object", - "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every set of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` `calculation_type`, give `points`.", - "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - }, - "object": { - "type": "string", - "description": "Type of object taken under consideration.", - "enum": [ - "products_collection", - "product", - "sku" - ] - }, - "id": { - "type": "string", - "description": "Unique ID of the resource, i.e. `pc_75U0dHlr7u75BJodrW1AE3t6`, `prod_0bae32322150fd0546`, or `sku_0b7d7dfb090be5c619`." + }, + "1_obj_loyalty_card_transaction_object_removal": { + "title": "Removal", + "description": "When points are removed from a card.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique transaction ID.", + "example": "vtx_0c9dccc4d5813e71bd" + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." + }, + "voucher_id": { + "type": "string", + "description": "Unique voucher ID.", + "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "source": { + "type": "string", + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", + "enum": [ + "voucherify-web-ui", + "API" + ] + }, + "reason": { + "type": "string", + "description": "Reason why the transaction occurred." + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "POINTS_REMOVAL", + "enum": [ + "POINTS_REMOVAL" + ] + }, + "details": { + "type": "object", + "description": "Contains the detailed information about the transaction.", + "properties": { + "balance": { + "type": "object", + "description": "Contains information on how the balance was affected by the transaction.", + "properties": { + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "loyalty_card" + }, + "total": { + "type": "integer", + "description": "The available points after the transaction." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON.", + "default": "balance" + }, + "points": { + "type": "integer", + "description": "The amount of points being subtracted in the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." + }, + "related_object": { + "type": "object", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "type": { + "type": "string", + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" + } + } + } + } + } } + }, + "related_transaction_id": { + "type": "string", + "description": "This field is `null` in the case of this type of transaction." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." } } - } - } - } - }, - "8_obj_calculate_points_proportionally_items_quantity": { - "title": "Calculate Points Proportionally to Quantity of Items in the Cart", - "type": "object", - "description": "This is an object representing points calculated proportionally to quantity of items in the cart.", - "properties": { - "type": { - "type": "string", - "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", - "enum": [ - "PROPORTIONAL" - ] - }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_ITEMS_QUANTITY" - ], - "description": "`ORDER_ITEMS_QUANTITY`: Quantity of items defined in `order_items.quantity.object` & `.id` (X points for every Y items excluding free items)" - }, - "order_items": { - "type": "object", - "properties": { - "quantity": { - "type": "object", - "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every set of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` `calculation_type`, give `points`.", - "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - }, - "object": { - "type": "string", - "description": "Type of object taken under consideration.", - "enum": [ - "products_collection", - "product", - "sku" - ] - }, - "id": { - "type": "string", - "description": "Unique ID of the resource, i.e. `pc_75U0dHlr7u75BJodrW1AE3t6`, `prod_0bae32322150fd0546`, or `sku_0b7d7dfb090be5c619`." + }, + "1_obj_loyalty_card_transaction_object_expiration": { + "title": "Expiration", + "description": "When points expire.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique transaction ID.", + "example": "vtx_0c9dccc4d5813e71bd" + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a points expiration, this value is `null`." + }, + "voucher_id": { + "type": "string", + "description": "Unique voucher ID.", + "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "source": { + "type": "string", + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", + "enum": [ + "Automation" + ] + }, + "reason": { + "type": "string", + "description": "Reason why the transaction occurred. In case of a points expiration, this value is `null`." + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "POINTS_EXPIRATION", + "enum": [ + "POINTS_EXPIRATION" + ] + }, + "details": { + "type": "object", + "description": "Contains the detailed information about the transaction.", + "properties": { + "balance": { + "type": "object", + "description": "Contains information on how the balance was affected by the transaction.", + "properties": { + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "loyalty_card" + }, + "total": { + "type": "integer", + "description": "The available points after the transaction." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON.", + "default": "balance" + }, + "points": { + "type": "integer", + "description": "The amount of points removed during the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." + }, + "related_object": { + "type": "object", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "type": { + "type": "string", + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" + } + } + } + } + } } + }, + "related_transaction_id": { + "type": "string", + "description": "This field is `null` in the case of this type of transaction." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." } } - } - } - } - }, - "8_obj_calculate_points_proportionally_customer_metadata": { - "title": "Calculate Points Proportionally To a Customer Metadata Property", - "type": "object", - "description": "This is an object representing points calculated proportionally to a customer metadata property.", - "properties": { - "type": { - "type": "string", - "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", - "enum": [ - "PROPORTIONAL" - ] - }, - "calculation_type": { - "type": "string", - "enum": [ - "CUSTOMER_METADATA" - ], - "description": "`CUSTOMER_METADATA`: Customer Metadata (X points for every Y in metadata attribute, defined in the `property` key under the `customer.metadata` object)" - }, - "customer": { - "type": "object", - "description": "Defines the formula for calculating points proportionally.", - "properties": { - "metadata": { - "type": "object", - "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every given increment of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` order metadata property value, give `points`.", - "properties": { - "every": { - "type": "integer", - "description": "For how many increments of the customer metadata property to grant points for.", - "example": 100 - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card.", - "example": 10 - }, - "property": { - "type": "string", - "example": "customer_life_time_value", - "description": "Customer metadata property." - } - } - } - } - } - } - }, - "8_obj_calculate_points_proportionally_custom_event_metadata": { - "title": "Calculate Points Proportionally To a Custom Event Metadata Property", - "type": "object", - "description": "This is an object representing points calculated proportionally to a custom event metadata property.", - "properties": { - "type": { - "type": "string", - "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", - "enum": [ - "PROPORTIONAL" - ] - }, - "calculation_type": { - "type": "string", - "enum": [ - "CUSTOMER_METADATA" - ], - "description": "`CUSTOM_EVENT_METADATA`: Custom Event Metadata (X points for every Y in metadata attribute, defined in the `property` key under the `custom_event.metadata` object)" - }, - "custom_event": { - "type": "object", - "description": "Defines the formula for calculating points proportionally.", - "properties": { - "metadata": { - "type": "object", - "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every given increment of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` order metadata property value, give `points`.", - "properties": { - "every": { - "type": "integer", - "description": "For how many increments of the custom event metadata property to grant points for.", - "example": 100 - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card.", - "example": 10 - }, - "property": { - "type": "string", - "example": "volume_number", - "description": "Custom event metadata property." - } - } - } - } - } - } - }, - "8_res_list_loyalty_campaigns": { - "title": "List Loyalty Campaigns Response Body", - "type": "object", - "description": "Response body schema for listing loyalty campaigns using **GET** `/loyalties`.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about loyalty campaigns in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "campaigns", - "description": "Identifies the name of the attribute that contains the array of loyalty campaign objects." - }, - "campaigns": { - "type": "array", - "description": "Contains an array of loyalty campaign objects.", - "items": { - "$ref": "#/components/schemas/8_obj_loyalty_campaign_object_no_extended_categories" - } - }, - "total": { - "type": "integer", - "description": "Total number of loyalty campaign objects." - } - } - }, - "8_req_create_loyalty_cards": { - "type": "object", - "title": "Create Loyalty Campaign Request Body", - "description": "Request body schema for creating a loyalty campaign.", - "properties": { - "name": { - "type": "string", - "description": "Campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "auto_join": { - "type": "boolean", - "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. CONTEXT: `LOYALTY_PROGRAM`." - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign (size of campaign)." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "loyalty_tiers_expiration": { - "type": "object", - "description": "Defines the expiration mechanism for loyalty tiers.", - "anyOf": [ - { - "$ref": "#/components/schemas/8_loyalty_tiers_expiration_balance" - }, - { - "$ref": "#/components/schemas/8_loyalty_tiers_expiration_points_in_period" - } - ] - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "voucher": { - "$ref": "#/components/schemas/2_req_campaign_object_voucher_object_LOYALTY_CARD" - } - } - }, - "8_loyalty_tiers_expiration_balance": { - "title": "Balance", - "type": "object", - "description": "Defines the Balance expiration mechanism for loyalty tiers.", - "properties": { - "qualification_type": { - "type": "string", - "enum": [ - "BALANCE" - ], - "description": "Tier qualification. \n\n`BALANCE`: Points balance is based on the customer's current points balance. Customers qualify for the tier if their points balance is in the points range of the tier." - }, - "start_date": { - "type": "object", - "description": "Defines the conditions for the start date of the tier.", - "properties": { - "type": { - "type": "string", - "enum": [ - "IMMEDIATE" - ], - "description": "What triggers the tier to be valid for a customer. \n`IMMEDIATE`: After reaching the minimum required points." - } - } - }, - "expiration_date": { - "description": "Defines the conditions for the expiration date of a tier.", - "anyOf": [ - { - "$ref": "#/components/schemas/8_loyalty_tiers_expiration_balance_expiration_date_balance_drop" - }, - { - "$ref": "#/components/schemas/8_loyalty_tiers_expiration_balance_expiration_date_custom" - } - ] - } - } - }, - "8_loyalty_tiers_expiration_balance_expiration_date_balance_drop": { - "title": "Balance Drop", - "type": "object", - "description": "Defines the conditions for the expiration date of a tier based on a pure balance drop.", - "properties": { - "type": { - "type": "string", - "enum": [ - "BALANCE_DROP" - ], - "description": "What triggers the tier to expire for a customer. \n`BALANCE_DROP`: Tier expires when the points balance drops below the required range of the tier." - } - } - }, - "8_loyalty_tiers_expiration_balance_expiration_date_custom": { - "title": "Custom", - "type": "object", - "description": "Defines the custom conditions for the expiration date of a tier.", - "properties": { - "type": { - "type": "string", - "enum": [ - "CUSTOM" - ], - "description": "What triggers the tier to expire for a customer. \n`CUSTOM`: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier." - }, - "extend": { - "type": "string", - "description": "Defines the amount of time the tier will remain active in ISO 8601 format. The expiration date counter starts at the moment when the customer reaches the minimum required points that are required to be in the tier. For example, a tier with a duration of P3M will be valid for a duration of 3 months." - }, - "rounding": { - "description": "Defines the rounding mechanism for tier expiration.", - "anyOf": [ - { - "$ref": "#/components/schemas/8_loyalty_tiers_expiration_expiration_date_rounding_default_options" - }, - { - "$ref": "#/components/schemas/8_loyalty_tiers_expiration_expiration_date_rounding_custom" - } - ] - } - } - }, - "8_loyalty_tiers_expiration_expiration_date_rounding_default_options": { - "title": "Calendar Periods", - "type": "object", - "description": "Defines the rounding mechanism for tier expiration based on a list of available time periods.", - "properties": { - "type": { - "type": "string", - "enum": [ - "MONTH", - "QUARTER", - "HALF_YEAR", - "YEAR" - ], - "description": "Period to which the expiration will be rounded to. \n- `MONTH`: The expiration date will be rounded to the end of the month. \n- `QUARTER`: The expiration date will be rounded to the end of the quarter. \n- `HALF_YEAR`: The expiration date will be rounded to the half year. \n- `YEAR`: The expiration date will be rounded to the end of the year." - } - } - }, - "8_loyalty_tiers_expiration_expiration_date_rounding_custom": { - "title": "Specific Month", - "type": "object", - "description": "Defines the custom rounding mechanism for tier expiration.", - "properties": { - "type": { - "type": "string", - "enum": [ - "CUSTOM" - ], - "description": "This mechanism describes a custom rounding for the expiration date." - }, - "unit": { - "type": "string", - "description": "Defines the type of unit of time in which the rounding period is counted.", - "enum": [ - "MONTH" - ] - }, - "value": { - "type": "integer", - "description": "Value for the unit of time that the rounding applies to. Units for this parameter are defined by the `rounding.unit` parameter. \n- `0`: January\n- `1`: February\n- `2`: March\n- `3`: April\n- `4`: May\n- `5`: June\n- `6`: July\n- `7`: August\n- `8`: September\n- `9`: October\n- `10`: November\n- `11`: December" - } - } - }, - "8_loyalty_tiers_expiration_points_in_period": { - "title": "Points in Period", - "type": "object", - "description": "Defines the Points in Period expiration mechanism for loyalty tiers.", - "properties": { - "qualification_type": { - "type": "string", - "enum": [ - "POINTS_IN_PERIOD" - ], - "description": "Tier qualification. \n\n`POINTS_IN_PERIOD`: A customer qualifies for the tier only if the sum of the accumulated points in a **defined time interval** reaches the tier threshold." - }, - "qualification_period": { - "type": "string", - "description": "Customers can qualify for the tier if they collected enough points in a given time period. So, in addition to the customer having to reach a points range, they also need to have collected the points within a set time period. \n\n| **Period** | **Definition** |\n|:---|:---|\n| **Calendar Month** | Points collected in one calendar month
January, February, March, etc. |\n| **Calendar Quarter** | Points collected in the quarter
- January - March
- April - June
- July - September
- October - December |\n| **Calendar Half-year** | Points collected in the half-year
- January - June
- July - December |\n| **Calendar Year** | Points collected in one calendar year
January - December |", - "enum": [ - "MONTH", - "QUARTER", - "HALF_YEAR", - "YEAR" - ] - }, - "start_date": { - "type": "object", - "description": "Defines the conditions for the start date of the tier.", - "properties": { - "type": { - "type": "string", - "enum": [ - "IMMEDIATE", - "NEXT_PERIOD" - ], - "description": "What triggers the tier to be valid for a customer. \n`IMMEDIATE`: After reaching the minimum required points. \n`NEXT_PERIOD`: When the next qualification period starts." - } - } - }, - "expiration_date": { - "type": "object", - "description": "Defines the conditions for the expiration date of a tier.", - "properties": { - "type": { - "type": "string", - "enum": [ - "END_OF_PERIOD", - "END_OF_NEXT_PERIOD" - ], - "description": "What triggers the tier to expire for a customer. \n`END_OF_PERIOD`: Expire tier at the end of the period. \n`END_OF_NEXT_PERIOD`: Expire tier at the end of the next period." - }, - "extend": { - "type": "string", - "description": "Extend the expiration by adding extra months or days in ISO 8601 format. The tier will remain active even though it reaches its expiration time period. For example, a tier with a duration of `P3M` will be valid for an additional duration of 3 months and a tier with a duration of `P1D` will be valid for an additional duration of 1 day." - } - } - } - } - }, - "8_req_update_loyalty_campaign": { - "type": "object", - "title": "Update Loyalty Campaign Request Body", - "description": "Request body schema for updating a loyalty campaign using **PUT** `/loyalties/{campaignId}`.", - "properties": { - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "auto_join": { - "type": "boolean", - "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. CONTEXT: `LOYALTY_PROGRAM`." - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "loyalty_tiers_expiration": { - "type": "object", - "description": "Defines the expiration mechanism for loyalty tiers.", - "anyOf": [ - { - "$ref": "#/components/schemas/8_loyalty_tiers_expiration_balance" - }, - { - "$ref": "#/components/schemas/8_loyalty_tiers_expiration_points_in_period" - } - ] - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." - }, - "loyalty_card": { - "description": "Defines the loyalty card details.", - "type": "object", - "properties": { - "points": { - "type": "integer", - "description": "Initial loyalty card income in points to be applied to the loyalty card at voucher generation." - }, - "expiration_rules": { - "type": "object", - "description": "Defines point expiration rules.", - "properties": { - "period_type": { - "type": "string", - "enum": [ - "MONTH" - ], - "description": "The expiration period." - }, - "period_value": { - "type": "integer", - "description": "How many periods should pass before the expiration occurs." - }, - "rounding_type": { - "type": "string", - "enum": [ - "END_OF_MONTH", - "END_OF_QUARTER", - "END_OF_HALF_YEAR", - "END_OF_YEAR", - "PARTICULAR_MONTH" - ], - "description": "Round up expiration till the end of the given period type." + }, + "1_obj_loyalty_card_transaction_object_transfer_out": { + "title": "Transfer Out", + "description": "When points are transferred from one loyalty card to another.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique transaction ID.", + "example": "vtx_0c9dccc4d5813e71bd" + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." + }, + "voucher_id": { + "type": "string", + "description": "Unique voucher ID.", + "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "source": { + "type": "string", + "description": "The channel through which the transaction took place.", + "enum": [ + "API" + ] + }, + "reason": { + "type": "string", + "description": "Reason why the transaction occurred." + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "POINTS_TRANSFER_OUT", + "enum": [ + "POINTS_TRANSFER_OUT" + ] + }, + "details": { + "type": "object", + "description": "Contains the detailed information about the transaction.", + "properties": { + "balance": { + "type": "object", + "description": "Contains information on how the balance was affected by the transaction.", + "properties": { + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "loyalty_card" + }, + "total": { + "type": "integer", + "description": "The available points after the transaction." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON.", + "default": "balance" + }, + "points": { + "type": "integer", + "description": "The amount of points being subtracted in the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." + }, + "related_object": { + "type": "object", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "type": { + "type": "string", + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" + } + } + } + } + }, + "destination_voucher": { + "type": "object", + "description": "Contains information on how the balance on the receiving loyalty card was affected by the transaction.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the destination voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "code": { + "type": "string", + "description": "Unique code of the destination voucher.", + "example": "LOYALTY-CARD-A8XVurg" + }, + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "LOYALTY_CARD" + }, + "campaign": { + "type": "string", + "description": "Unqiue campaign name of the voucher's parent campaign." + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "loyalty_card": { + "type": "object", + "description": "Contains information on how the balance on the receiving loyalty card was affected by the transaction.", + "properties": { + "points": { + "type": "integer", + "description": "The total amount of points after the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." + }, + "next_expiration_date": { + "type": "string", + "description": "The date when the next set of points are due to expire, i.e. `YYYY-MM-DD`. This does not mean that the transferred points were added to this bucket. It only shows the next set of points due to expire. The transferred points are added to the last expiring bucket, i.e. to the bucket of points that are to expire the furthest in the future.", + "example": "2023-12-31" + }, + "next_expiration_points": { + "type": "integer", + "description": "The number of points due to expire on the next expiration date." + } + } + }, + "is_referral_code": { + "type": "integer", + "description": "Flag indicating whether this voucher is a referral code." + } + } + } } + }, + "related_transaction_id": { + "type": "string", + "description": "The related transaction ID on the receiving card.", + "example": "vtx_0c9afe802593b34b81" + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." } } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - } - } - }, - "8_req_create_earning_rules": { - "description": "This data model represents the request body for the `/loyalties/{campaignId}/earning-rules` endpoint.", - "title": "Create Earning Rule Request Body", - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/8_req_earning_rule_object_order_paid" }, - { - "$ref": "#/components/schemas/8_req_earning_rule_object_entered_segment" - }, - { - "$ref": "#/components/schemas/8_req_earning_rule_object_custom_event" - }, - { - "$ref": "#/components/schemas/8_req_earning_rule_object_tier" - } - ] - } - }, - "8_req_create_earning_rules_copy": { - "description": "This data model represents the request body for the `/loyalties/{campaignId}/earning-rules` endpoint.", - "type": "object", - "title": "Create Earning Rule Request Body", - "properties": { - "event": { - "type": "string", - "enum": [ - "order.paid", - "customer.segment.entered", - "custom_event_defined_in_EVENT_SCHEMA" - ], - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `order.paid` an event defined by the Voucherify API corresponding to an order status `PAID`. Read more here. \n- `customer.segment.entered` an event defined by the Voucherify API corresponding to a customer entering a pre-defined customer segment. Read more here. \n- `custom_event_name` the name of a custom event defined in the Dashboard → **Project Settings** → **EVENT SCHEMA** → **Add event definition**. Read more on defining custom events. " - }, - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "description": "Fixed. Applicable to events `order.paid`, `customer.segment.entered`, and `custom_event`.", - "properties": { - "points": { - "type": "integer", - "description": "The number of points to be added to the loyalty card.", - "example": 1000 - }, - "type": { - "type": "string", - "description": "Defines how the points will be added to the loyalty card. `FIXED` adds a fixed number of `points`.", - "default": "FIXED" - } + "1_obj_loyalty_card_transaction_object_transfer_in": { + "title": "Transfer In", + "description": "When points are transferred in from another loyalty card.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique transaction ID.", + "example": "vtx_0c9dccc4d5813e71bd" }, - "required": [ - "points", - "type" - ] - }, - { - "description": "Proportional. Applicable to only `order.paid`.", - "properties": { - "type": { - "type": "string", - "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio", - "default": "PROPORTIONAL" - }, - "order": { - "type": "object", - "description": "Defines proportion for calculating how many points to add to a loyalty card. The ratio is based on the order amount. For `every` dollar spent, the customer will get this many `points`. \n", - "required": [ - "amount" - ], - "properties": { - "amount": { - "type": "object", - "description": "Defines the ratio based on the order amount.", - "required": [ - "every", - "points" - ], - "properties": { - "every": { - "type": "integer", - "description": "Order amount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points awarded." + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a ponits transfer, this value is `null`." + }, + "voucher_id": { + "type": "string", + "description": "Unique voucher ID.", + "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "source": { + "type": "string", + "description": "The channel through which the transaction took place.", + "enum": [ + "API" + ] + }, + "reason": { + "type": "string", + "description": "Reason why the transaction occurred." + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "POINTS_TRANSFER_IN", + "enum": [ + "POINTS_TRANSFER_IN" + ] + }, + "details": { + "type": "object", + "description": "Contains the detailed information about the transaction.", + "properties": { + "balance": { + "type": "object", + "description": "Contains information on how the balance was affected by the transaction.", + "properties": { + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "loyalty_card" + }, + "total": { + "type": "integer", + "description": "The available points after the transaction." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON.", + "default": "balance" + }, + "points": { + "type": "integer", + "description": "The amount of points being added in the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." + }, + "related_object": { + "type": "object", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "type": { + "type": "string", + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" + } + } + } + } + }, + "source_voucher": { + "type": "object", + "description": "Contains information on how the balance on the donor loyalty card was affected by the transaction.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the source voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "code": { + "type": "string", + "description": "Unique code of the source voucher.", + "example": "LOYALTY-CARD-A8XVurg" + }, + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "LOYALTY_CARD" + }, + "campaign": { + "type": "string", + "description": "Unqiue campaign name of the voucher's parent campaign." + }, + "holder_id": { + "type": "string", + "description": "Unqiue customer ID of the loyalty card holder, this is the ID that was assigned by the Voucherify API.", + "example": "cust_xqA7DGj5eYPHg6PHVKwYRWiA" + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "loyalty_card": { + "type": "object", + "description": "Contains information on how the balance on the source loyalty card was affected by the transaction.", + "properties": { + "points": { + "type": "integer", + "description": "The total amount of points after the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." + }, + "next_expiration_date": { + "type": "string", + "description": "The date when the next set of points are due to expire, i.e. `YYYY-MM-DD`. The points from the source loyalty card are taken from the expiration bucket(s) that are the first coming up to expire, starting from the first expiration bucket to expire in time. This parameter shows the next expiration date after the points were taken out of the loyalty card.", + "example": "2023-12-31" + }, + "next_expiration_points": { + "type": "integer", + "description": "The number of points due to expire on the expiration date." + } } + }, + "is_referral_code": { + "type": "integer", + "description": "Flag indicating whether this voucher is a referral code." } } } } }, - "required": [ - "type", - "order" - ] - } - ], - "type": "object" - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + "related_transaction_id": { + "type": "string", + "description": "The related transaction ID on the source card.", + "example": "vtx_0c9afe802593b34b81" + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." + } } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default." - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day. `start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" + }, + "8_req_create_loyalty_card_transactions_export": { + "type": "object", + "title": "Create Loyalty Card Transactions Export Request Body", + "description": "Request body schema for **POST** `/loyalties/members/{memberId}/transactions/export`.", + "properties": { + "parameters": { + "$ref": "#/components/schemas/8_obj_export_loyalty_card_transactions", + "description": "Contains the parameters that define the data to be exported." + } } }, - "required": [ - "duration", - "interval" - ] - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "custom_event": { - "type": "object", - "description": "Contains the schema id of a custom event. **Required** for the custom event option in `event`.", - "properties": { - "schema_id": { - "type": "string", - "description": "Contains a unique identifier of a custom event schema. Assigned by the Voucherify API." + "8_obj_export_loyalty_card_transactions": { + "description": "List of available fields and filters that can be exported with a loyalty card transactions export along with the sorting order of the returned data.", + "title": "Export Transactions", + "type": "object", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "-created_at", + "created_at" + ] + }, + "fields": { + "type": "array", + "enum": [ + [ + "id", + "type", + "source_id", + "reason", + "balance", + "amount", + "created_at", + "voucher_id", + "campaign_id", + "source", + "details", + "related_transaction_id" + ] + ], + "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID assigned by Voucherify. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `POINTS_EXPIRATION`
- `POINTS_ADDITION`
- `POINTS_REMOVAL`
- `POINTS_TRANSFER_OUT`
- `POINTS_ACCRUAL`
- `POINTS_REFUND`
- `POINTS_REDEMPTION` |\n| source_id | Custom source ID of the transaction if one was included originally. | source_id_custom |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The loyalty card balance after the transaction. | |\n| amount | The amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | - `API`
- `voucherify-web-ui`
- `Automation` |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n| related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |", + "items": { + "type": "string" + } + } } }, - "required": [ - "schema_id" - ] - }, - "segment": { - "type": "object", - "description": "Contains the id of a customer segment. **Required** for the `customer.segment.entered` option in `event`.", - "properties": { - "id": { - "type": "string", - "description": "Contains a unique identifier of a customer segment. Assigned by the Voucherify API." - } - }, - "required": [ - "id" - ] - } - }, - "required": [ - "event", - "loyalty" - ] - }, - "8_req_update_earning_rule": { - "description": "Request body schema for updating earning rules using **PUT** `/loyalties/{campaignId}/earning-rules/{earningRuleId}` endpoint.", - "title": "Update Earning Rule Request Body", - "anyOf": [ - { - "$ref": "#/components/schemas/8_req_update_earning_rule_object_order_paid" - }, - { - "$ref": "#/components/schemas/8_req_update_earning_rule_object_entered_segment" - }, - { - "$ref": "#/components/schemas/8_req_update_earning_rule_object_custom_event" - }, - { - "$ref": "#/components/schemas/8_req_update_earning_rule_object_tier" - } - ] - }, - "8_res_list_earning_rules": { - "description": "Response body schema for listing earning rules using **GET** `/loyalties/{campaignId}/earning-rules` endpoint.", - "type": "object", - "title": "List Earning Rules Response Body", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about earning rules in a dictionary.", - "default": "list" - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of earning rule objects." - }, - "data": { - "type": "array", - "description": "Contains array of earning rule objects.", - "items": { - "$ref": "#/components/schemas/8_obj_earning_rule_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of earning rule objects." - } - } - }, - "8_req_add_remove_points_balance": { - "title": "Add or Remove Points Balance Request Body", - "type": "object", - "description": "Request schema for adding or removing points from a loyalty card.", - "properties": { - "points": { - "type": "integer", - "description": "Incremental balance to be added to/subtracted from the loyalty card. \n\nTo add points: `100` \nTo subtract points, add a minus: `-100`" - }, - "expiration_type": { - "type": "string", - "default": "PROGRAM_RULES", - "enum": [ - "PROGRAM_RULES", - "NON_EXPIRING", - "CUSTOM_DATE" - ], - "description": "Set the type of expiration for added points. \n- `PROGRAM_RULES`: Inherit rules from campaign.\n- `NON_EXPIRING`: Points never expire.\n- `CUSTOM_DATE`: Points expire on a particular date. **Requires** `expiration_date` parameter." - }, - "expiration_date": { - "type": "string", - "description": "Set expiration date for added points, i.e. `YYYY-MM-DD`. This parameter is **required** only when `expiration_type` is set to `CUSTOM_DATE`.", - "example": "2020-05-30" - }, - "reason": { - "type": "string", - "description": "Reason for the transfer." - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." - } - } - }, - "8_res_add_remove_points_balance": { - "description": "Response schema for adding or removing points from a loyalty card.", - "type": "object", - "title": "Add or Remove Loyalty Card Balance Response Body", - "properties": { - "points": { - "type": "integer", - "description": "The incremental points removed or added to the current balance on the loyalty card." - }, - "total": { - "type": "integer", - "description": "The total of points accrued over the lifetime of the loyalty card." - }, - "balance": { - "type": "integer", - "description": "The balance after adding/removing points." - }, - "type": { - "type": "string", - "description": "The type of voucher being modified.", - "default": "loyalty_card" - }, - "object": { - "type": "string", - "description": "The type of object represented by JSON. Default is `balance`.", - "default": "balance" - }, - "related_object": { - "type": "object", - "description": "Defines the object that is being modified with the values that are returned in the balance object.", - "properties": { - "type": { - "type": "string", - "description": "The object being modified.", - "default": "voucher" - }, - "id": { - "type": "string", - "description": "Identifies the loyalty card that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + "8_obj_export_transactions_object": { + "title": "Export Object", + "type": "object", + "description": "This is an object representing an export. \n\n Using this endpoint, you can export [loyalty card transactions](ref:list-loyalty-card-transactions) as a CSV file. This functionality works asynchronously and comes down to the following steps: \n* create an export object and return its `id` so you can track its `status`\n* trigger a CSV file generation, change the status to `SCHEDULED`\n* when the generation is over, store the file in S3 and change the `status` to `DONE`\n* now you can (ref:download-export) it\n\nWith `parameters` you can select which `fields` will be exported. An export request will almost always result in a single file being generated by the system. However, when your volume of data is large, the system may split the results into multiple chunks.", + "properties": { + "id": { + "type": "string", + "description": "Unique export ID.", + "example": "exp_FFfp9o7daWuJqJCKp5xqqli4" + }, + "object": { + "type": "string", + "default": "export", + "description": "The type of object being represented. This object stores information about the `export`." + }, + "created_at": { + "type": "string", + "example": "2022-04-28T11:23:20.922Z", + "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format.", + "format": "date-time" + }, + "status": { + "type": "string", + "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.", + "enum": [ + "SCHEDULED", + "IN_PROGRESS", + "DONE", + "ERROR" + ] + }, + "channel": { + "type": "string", + "description": "The channel through which the export was triggered.", + "default": "API" + }, + "exported_object": { + "type": "string", + "description": "The type of exported object.", + "default": "voucher_transactions" + }, + "parameters": { + "$ref": "#/components/schemas/16_obj_export_loyalty_card_transactions" + }, + "result": { + "type": "object", + "description": "Contains the URL of the CSV file.", + "properties": { + "url": { + "type": "string", + "description": "URL of the CSV file location. It contains the `token` used for authorization in the [Download export](ref:download-export) method." + } + } + }, + "user_id": { + "type": "string", + "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the `channel` value is `WEBSITE`.", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH" + } } - } - } - } - }, - "8_req_transfer_loyalty_points": { - "description": "Request body schema for transferring points from a loyalty card.", - "type": "array", - "title": "Transfer Loyalty Points Request Body", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "Unique loyalty card code from which the user wants to transfer loyalty points (source).", - "example": "L-CARD-02hgnq4" - }, - "points": { - "type": "integer", - "description": "The number of loyalty points that the user wants to transfer to another loyalty card. The number of points cannot be higher than the current balance on the loyalty card (source).", - "example": 2 - }, - "reason": { - "type": "string", - "description": "Reason for the transfer." }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." - } - } - } - }, - "8_req_redeem_reward": { - "description": "Request body schema for redeeming a reward.", - "type": "object", - "title": "Redeem Reward Request Body", - "properties": { - "reward": { - "type": "object", - "description": "Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward if the reward is a pay with points reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward.", - "example": "rew_eSi4eYJk7o3tOycvweicR2z7" - }, - "points": { - "type": "integer", - "description": "The number of loyalty points that the user wants to spend in order to fulfill the order. The number of points cannot be higher than the current balance on the loyalty card." - } - } - }, - "order": { - "$ref": "#/components/schemas/8_req_order_object_redeem_reward", - "description": "Order object that is **required** when redeeming a pay with points reward." - }, - "metadata": { - "type": "object", - "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." - } - } - }, - "8_req_order_object_redeem_reward": { - "type": "object", - "title": "Order object", - "description": "Request body schema for creating an order, **required** when redeeming a pay with points reward.", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of an integration between multiple systems. It can be an order ID from a CRM system, database or 3rd-party service." - }, - "status": { - "type": "string", - "description": "The order status.", - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULLFILLED" - ] - }, - "amount": { - "type": "integer", - "description": "A positive integer in the smallest currency unit (that is, 100 cents for $1.00) representing the total amount of the order; this is the sum of the order items' amounts." - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format." - }, - "referrer": { - "$ref": "#/components/schemas/10_req_orders_referrer_object" - }, - "items": { - "$ref": "#/components/schemas/10_req_orders_items_array" - } - } - }, - "8_res_redeem_reward": { - "description": "Response body schema for redeeming a reward.", - "title": "Redeem Reward Response Body", - "$ref": "#/components/schemas/8_obj_redemption_object_loyalty_card_extended" - }, - "8_obj_redemption_object_loyalty_card_extended": { - "type": "object", - "title": "Loyalty Card Voucher", - "description": "This is an object representing a redemption. \n\nRedemption is the key operation in the voucher lifecycle. A customer can redeem a voucher 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](rollback-redemption).", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the redemption.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "amount": { - "type": "integer", - "description": "Number of points being redeemed for a reward." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the reward.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object. i.e. `voucher`.", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Defines the details of the voucher being redeemed." - }, - "reward": { - "description": "Defines the reward being redeemed.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" - } - ] - }, - "loyalty_card": { - "type": "object", - "description": "Stores the number of points being subtracted from the loyalty card for the reward redemption.", - "properties": { - "points": { - "type": "integer", - "description": "Number of points being subtracted from the loyalty card for the reward redemption." - } - } - } - } - }, - "8_res_loyalties_campaign_id_tiers_tier_id_earning_rules": { - "type": "object", - "properties": { - "object": { - "type": "string" - }, - "data_ref": { - "type": "string" - }, - "data": { - "type": "array", - "items": { + "8_obj_loyalty_tier_object": { "type": "object", + "title": "Loyalty Tier Object", + "description": "This is an object representing a loyalty tier. \n\nLoyalty tiers are used to create a loyalty program with different levels of membership and varied earning rules and rewards based on customer’s tiers.", "properties": { "id": { - "type": "string" + "type": "string", + "example": "ltr_30KHciA0UG8B71Fo51GZqwgN", + "description": "Unique loyalty tier ID." + }, + "name": { + "type": "string", + "description": "Loyalty Tier name." + }, + "campaign_id": { + "type": "string", + "example": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "description": "Unique parent campaign ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format." }, "created_at": { - "type": "string" + "type": "string", + "format": "date-time", + "example": "2022-11-10T12:20:52.755Z", + "description": "Timestamp representing the date and time when the loyalty tier was created in ISO 8601 format." }, "updated_at": { - "type": "null" + "type": "string", + "format": "date-time", + "example": "2022-11-25T10:59:43.231Z", + "description": "Timestamp representing the date and time when the loyalty tier was updated in ISO 8601 format." }, - "validation_rule_id": { - "type": "null" + "earning_rules": { + "type": "object", + "description": "Contains a list of earning rule IDs and their points mapping for the given earning rule.", + "properties": { + "unique_earning_rule_ID": { + "description": "ern_95aq3JaE5A8xzHjoJPYNRqXZ", + "anyOf": [ + { + "$ref": "#/components/schemas/8_obj_mapping_multiply" + }, + { + "$ref": "#/components/schemas/8_obj_mapping_fixed" + } + ] + } + } }, - "loyalty": { + "rewards": { + "type": "object", + "description": "Contains a list of reward IDs and their points mapping for the given reward.", + "properties": { + "unique_reward_ID": { + "description": "rewa_t88DnSdNnE0IzQX6gqH3jHGQ", + "anyOf": [ + { + "$ref": "#/components/schemas/8_obj_mapping_multiply" + }, + { + "$ref": "#/components/schemas/8_obj_mapping_fixed" + } + ] + } + } + }, + "config": { "type": "object", + "description": "Defines loyalty tier range in points.", "properties": { "points": { - "type": "integer" + "type": "object", + "description": "Defines range of loyalty tier in points.", + "properties": { + "from": { + "type": "integer", + "description": "Bottom points threshold value." + }, + "to": { + "type": "integer", + "description": "Top points threshold value." + } + } + } + } + }, + "points": { + "type": "object", + "description": "Defines range of loyalty tier in points.", + "properties": { + "from": { + "type": "integer", + "description": "Bottom points threshold value." }, - "type": { - "type": "string" + "to": { + "type": "integer", + "description": "Top points threshold value." } } }, - "event": { - "type": "string" + "object": { + "type": "string", + "default": "loyalty_tier", + "description": "The type of object represented by JSON. This object stores information about the loyalty." + } + } + }, + "8_obj_loyalty_tier_object_member": { + "type": "object", + "title": "Loyalty Tier Object", + "description": "This is an object representing a loyalty tier. \n\nLoyalty tiers are used to create a loyalty program with different levels of membership and varied earning rules and rewards based on customer’s tiers.", + "properties": { + "id": { + "type": "string", + "example": "ltr_30KHciA0UG8B71Fo51GZqwgN", + "description": "Unique loyalty tier ID." }, - "source": { + "name": { + "type": "string", + "description": "Loyalty Tier name." + }, + "campaign_id": { + "type": "string", + "example": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "description": "Unique parent campaign ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-11-10T12:20:52.755Z", + "description": "Timestamp representing the date and time when the loyalty tier was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-11-25T10:59:43.231Z", + "description": "Timestamp representing the date and time when the loyalty tier was updated in ISO 8601 format." + }, + "earning_rules": { "type": "object", + "description": "Contains a list of earning rule IDs and their points mapping for the given earning rule.", "properties": { - "banner": { - "type": "string" - }, - "object_id": { - "type": "string" - }, - "object_type": { - "type": "string" + "unique_earning_rule_ID": { + "description": "ern_95aq3JaE5A8xzHjoJPYNRqXZ", + "anyOf": [ + { + "$ref": "#/components/schemas/8_obj_mapping_multiply" + }, + { + "$ref": "#/components/schemas/8_obj_mapping_fixed" + } + ] } } }, - "active": { - "type": "boolean" + "rewards": { + "type": "object", + "description": "Contains a list of reward IDs and their points mapping for the given reward.", + "properties": { + "unique_reward_ID": { + "description": "rewa_t88DnSdNnE0IzQX6gqH3jHGQ", + "anyOf": [ + { + "$ref": "#/components/schemas/8_obj_mapping_multiply" + }, + { + "$ref": "#/components/schemas/8_obj_mapping_fixed" + } + ] + } + } }, - "object": { - "type": "string" + "config": { + "type": "object", + "description": "Defines loyalty tier range in points.", + "properties": { + "points": { + "type": "object", + "description": "Defines range of loyalty tier in points.", + "properties": { + "from": { + "type": "integer", + "description": "Bottom points threshold value." + }, + "to": { + "type": "integer", + "description": "Top points threshold value." + } + } + } + } }, - "automation_id": { - "type": "string" + "points": { + "type": "object", + "description": "Defines range of loyalty tier in points.", + "properties": { + "from": { + "type": "integer", + "description": "Bottom points threshold value." + }, + "to": { + "type": "integer", + "description": "Top points threshold value." + } + } }, - "custom_event": { + "expiration": { "type": "object", + "description": "Contains information about when the expiration tier will expire.", "properties": { - "schema_id": { - "type": "string" + "customer_id": { + "type": "string", + "example": "cust_qBwHpagDOFu71Z3F22UzR80X", + "description": "Unique customer ID whose point expiration dates are defined in this object." + }, + "campaign_id": { + "type": "string", + "example": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "description": "Unique parent campaign ID." + }, + "tier_id": { + "type": "string", + "example": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2", + "description": "Unique loyalty tier ID." + }, + "start_date": { + "type": "string", + "example": "2022-11-10", + "description": "Exact start date of the loyalty tier for the given customer." + }, + "expiration_date": { + "type": "string", + "example": "2023-02-28", + "description": "Exact expiration date of the loyalty tier for the given customer." + }, + "created_at": { + "type": "string", + "example": "2022-11-09T11:26:26.719Z", + "format": "date-time", + "description": "Timestamp representing the date and time when the loyalty tier expiration was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "example": "2022-11-10T08:54:47.200Z", + "format": "date-time", + "description": "Timestamp representing the date and time when the loyalty tier expiration was created in ISO 8601 format." } } + }, + "object": { + "type": "string", + "default": "loyalty_tier", + "description": "The type of object represented by JSON. This object stores information about the loyalty." } } - } - }, - "total": { - "type": "integer" - } - }, - "description": "Response body schema for `/loyalties/{campaignId}/tiers/{tierId}/earning-rules`.", - "title": "List Loyalty Tier Earning Rules" - }, - "8_res_loyalties_campaign_id_tiers_tier_id_rewards": { - "title": "List Loyalty Tier Rewards", - "type": "object", - "properties": { - "id": { - "type": "string" - } - }, - "description": "Response body schema for `/loyalties/{campaignId}/tiers/{tierId}/rewards`." - }, - "8_res_loyalties_campaign_id_reward-assignments_assignment_id": { - "type": "object", - "description": "Response body schema for `/loyalties/{campaignId}/reward-assignments/{assignmentId}`", - "title": "Get Reward Assignment", - "properties": { - "id": { - "type": "string", - "example": "rewa_hzc19a5NLyIr2bVL3UB1w0B3" - }, - "reward_id": { - "type": "string", - "example": "rew_JhjeISE1npQyxRmGV1JYohDP" - }, - "related_object_id": { - "type": "string", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - }, - "related_object_type": { - "type": "string", - "example": "campaign" - }, - "created_at": { - "type": "string", - "example": "2021-12-13T11:58:32.261Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "example": "2022-01-13T11:58:32.261Z", - "format": "date-time" - }, - "object": { - "type": "string", - "default": "reward_assignment" - } - } - }, - "8_res_loyalties_campaign_id_reward-assignments_assignment_id_reward": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "type": { - "type": "string" - }, - "parameters": { - "type": "object", - "properties": { - "coin": { - "type": "object", - "properties": { - "exchange_ratio": { - "type": "number" - }, - "points_ratio": { - "type": "integer" - } + }, + "8_obj_mapping_multiply": { + "type": "object", + "title": "Multiply Points", + "description": "Points are multiplied by a multiplier.", + "properties": { + "type": { + "type": "string", + "description": "Type of calculation.", + "enum": [ + "MULTIPLY" + ] + }, + "multiplier": { + "type": "integer", + "description": "Multiplication factor used to multiply the points to obtain the mapped points." } } - } - }, - "stock": { - "type": "null" - }, - "redeemed": { - "type": "null" - }, - "attributes": { - "type": "object", - "properties": {} - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "null", - "format": "date-time" - }, - "object": { - "type": "string" - } - }, - "description": "Response body schema for `/loyalties/{campaignId}/reward-assignments/{assignmentId}/`", - "title": "Get Reward Details" - }, - "8_obj_export_object_points_expiration": { - "title": "Points Expirations Export Object", - "type": "object", - "description": "This is an object representing an export of points expirations. ", - "properties": { - "id": { - "type": "string", - "description": "Unique export ID.", - "example": "exp_FFfp9o7daWuJqJCKp5xqqli4" - }, - "object": { - "type": "string", - "default": "export", - "description": "The type of object being represented. This object stores information about the export." - }, - "created_at": { - "type": "string", - "example": "2022-04-28T11:23:20.922Z", - "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format.", - "format": "date-time" - }, - "status": { - "type": "string", - "description": "Status of the export. Informs you whether the export has already been completed.", - "enum": [ - "SCHEDULED", - "IN_PROGRESS", - "DONE", - "ERROR" - ] - }, - "channel": { - "type": "string", - "description": "The channel through which the export was triggered.", - "enum": [ - "API", - "WEBSITE" - ] - }, - "exported_object": { - "type": "string", - "description": "The type of exported object.", - "enum": [ - "points_expiration" - ] - }, - "parameters": { - "type": "object", - "description": "List of fields and filters that were passed in the request body to create the export.", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "expires_at", - "-expires_at" - ] - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data that was exported. These fields define the headers in the CSV file. \n\n The array can be a combination of any of the following available fields: \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n |\n| campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 |\n| status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` |\n| expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 |\n| points | Number of points. | 1000 |", - "items": { - "type": "string" + }, + "8_obj_mapping_fixed": { + "type": "object", + "title": "Fixed Points", + "description": "Points are fixed.", + "properties": { + "type": { + "type": "string", + "description": "Type of calculation.", + "enum": [ + "CUSTOM" + ] + }, + "points": { + "type": "integer", + "description": "Fixed number of points to be applied." } - }, - "filters": { - "description": "Data filters used to narrow the data records to be returned in the export.", - "anyOf": [ - { - "$ref": "#/components/schemas/8_req_filter_campaign_id" + } + }, + "8_obj_earning_rule_object": { + "description": "This is an object representing an earning rule.", + "title": "Earning Rule Object", + "examples": [ + { + "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", + "created_at": "2022-02-07T08:19:41.810Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 2, + "type": "FIXED" }, - { - "$ref": "#/components/schemas/8_req_filter_voucher_id" + "custom_event": { + "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" + }, + "event": "saw_on_facebook", + "source": { + "banner": "Saw on Facebook Timeframe", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-02-07T08:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "object": "earning_rule", + "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" + }, + { + "id": "ern_taClaOIiaGNdmdby8xS0lCcy", + "created_at": "2022-02-04T13:27:50.665Z", + "updated_at": "2022-02-07T08:19:44.198Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" + }, + "event": "order.paid", + "source": { + "banner": "Order paid 1000 points", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 4 + ], + "object": "earning_rule", + "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" + }, + { + "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", + "created_at": "2022-02-04T13:02:52.937Z", + "updated_at": "2022-02-07T08:19:43.291Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" + }, + "segment": { + "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" + }, + "event": "customer.segment.entered", + "source": { + "banner": "Entered segment 100 points.", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" + }, + { + "id": "ern_gVo6CHBduFPoh1hctASfXHLT", + "created_at": "2022-11-24T17:01:42.809Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 4, + "points": 4, + "property": "customer_life_time_value" + } + } + }, + "event": "customer.loyalty.tier.joined", + "loyalty_tier": { + "id": "ltr_pudTGWasuIqxdiDM0go31OV1" + }, + "source": { + "banner": "Tier joined", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_wdlEo17wmoqYHGfilbayEUj7", + "metadata": { + "Type": "Tier joined - customer metadata - proportional" } - ] - } - } - }, - "result": { - "type": "object", - "description": "Contains the URL of the CSV file.", - "properties": { - "url": { - "type": "string", - "description": "URL of the CSV file location." - } - } - }, - "user_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0Fr", - "description": " The user_id identifies the specific user who initiated the export through the Voucherify Dashboard; this `user_id` is returned when the channel value is `WEBSITE`." - } - } - }, - "8_req_export_points_expirations": { - "title": "Points Expirations Export Request Body", - "type": "object", - "description": "Request body schema for creating points expirations. ", - "properties": { - "parameters": { - "type": "object", - "description": "List of fields and filters that were passed in the request body to create the export.", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "expires_at", - "-expires_at" - ] - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data that was exported. These fields define the headers in the CSV file. \n\n The array can be a combintation of any of the following available fields: \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n |\n| campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 |\n| status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` |\n| expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 |\n| points | Number of points. | 1000 |", - "items": { - "type": "string" + }, + { + "id": "ern_66OdCyLADv5IGFoQe18vGUwa", + "created_at": "2022-11-24T17:03:59.414Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 2, + "points": 2, + "property": "customer_life_time_value" + } + } + }, + "event": "customer.loyalty.tier.left", + "loyalty_tier": { + "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2" + }, + "source": { + "banner": "Tier left", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_czm5el1Uz1jeGaO97AYoDNAq", + "metadata": { + "Type": "Tier left" + } + }, + { + "id": "ern_YR3fDfCjAmz9a5D68nk0i4dm", + "created_at": "2022-11-25T07:29:38.961Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 3, + "points": 4, + "property": "customer_life_time_value" + } + } + }, + "event": "customer.loyalty.tier.upgraded", + "loyalty_tier": { + "id": "ltr_30KHciA0UG8B71Fo51GZqwgN" + }, + "source": { + "banner": "Tier upgraded", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_M1OdRH8spk6Fs7yTuPLN2LAv", + "metadata": { + "Type": "Upgraded" + } + }, + { + "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", + "created_at": "2022-11-25T07:31:05.866Z", + "updated_at": "2022-11-25T07:31:43.029Z", + "validation_rule_id": "val_kfmWpfXMI9P1", + "loyalty": { + "points": 1, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.downgraded", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Tier Downgraded", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", + "metadata": { + "Type": "Tier" + } + }, + { + "id": "ern_AdlWO2yt6b6llWsibIdiRXVE", + "created_at": "2022-11-25T07:31:42.767Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 5, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.prolonged", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Prolonged", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_4jH1yq9WJS0oJ8suagCrltyb", + "metadata": {} } - }, - "filters": { - "description": "Data filters used to narrow the data records to be returned in the export.", - "anyOf": [ - { - "$ref": "#/components/schemas/8_req_filter_campaign_id" + ], + "anyOf": [ + { + "$ref": "#/components/schemas/8_obj_earning_rule_object_order_paid" + }, + { + "$ref": "#/components/schemas/8_obj_earning_rule_object_custom_event" + }, + { + "$ref": "#/components/schemas/8_obj_earning_rule_object_entered_segment" + }, + { + "$ref": "#/components/schemas/8_obj_earning_rule_object_tier" + } + ] + }, + "8_obj_earning_rule_object_no_validation_rule": { + "description": "This is an object representing an earning rule.", + "title": "Earning Rule Object", + "examples": [ + { + "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", + "created_at": "2022-02-07T08:19:41.810Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 2, + "type": "FIXED" }, - { - "$ref": "#/components/schemas/8_req_filter_voucher_id" + "custom_event": { + "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" + }, + "event": "saw_on_facebook", + "source": { + "banner": "Saw on Facebook Timeframe", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-02-07T08:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "object": "earning_rule", + "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" + }, + { + "id": "ern_taClaOIiaGNdmdby8xS0lCcy", + "created_at": "2022-02-04T13:27:50.665Z", + "updated_at": "2022-02-07T08:19:44.198Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" + }, + "event": "order.paid", + "source": { + "banner": "Order paid 1000 points", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 4 + ], + "object": "earning_rule", + "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" + }, + { + "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", + "created_at": "2022-02-04T13:02:52.937Z", + "updated_at": "2022-02-07T08:19:43.291Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" + }, + "segment": { + "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" + }, + "event": "customer.segment.entered", + "source": { + "banner": "Entered segment 100 points.", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" + }, + { + "id": "ern_gVo6CHBduFPoh1hctASfXHLT", + "created_at": "2022-11-24T17:01:42.809Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 4, + "points": 4, + "property": "customer_life_time_value" + } + } + }, + "event": "customer.loyalty.tier.joined", + "loyalty_tier": { + "id": "ltr_pudTGWasuIqxdiDM0go31OV1" + }, + "source": { + "banner": "Tier joined", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_wdlEo17wmoqYHGfilbayEUj7", + "metadata": { + "Type": "Tier joined - customer metadata - proportional" } - ] - } - } - } - } - }, - "8_req_filter_campaign_id": { - "title": "Filter by campaign ID", - "type": "object", - "description": "Filter conditions set on the campaign ID.", - "properties": { - "campaign_id": { - "$ref": "#/components/schemas/8_req_filter_conditions" - }, - "junction": { - "type": "string", - "description": "Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `and` is an all-inclusive logical operator, meaning the `and` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `or` operator displays a record if **ANY** of the conditions separated by OR is TRUE.", - "enum": [ - "AND", - "OR" - ] - } - } - }, - "8_req_filter_voucher_id": { - "title": "Filter by voucher ID", - "type": "object", - "description": "Filter conditions set on the voucher ID.", - "properties": { - "voucher_id": { - "$ref": "#/components/schemas/8_req_filter_conditions" - }, - "junction": { - "type": "string", - "description": "Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `and` is an all-inclusive logical operator, meaning the `and` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `or` operator displays a record if **ANY** of the conditions separated by OR is TRUE.", - "enum": [ - "AND", - "OR" - ] - } - } - }, - "8_req_filter_junction": { - "title": "Filter by campaign ID", - "type": "object", - "description": "Filter conditions by campaign ID.", - "properties": { - "junction": { - "type": "string", - "description": "Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `and` is an all-inclusive logical operator, meaning the `and` operator displays a record if all the conditions separated by AND are TRUE, while an `or` operator displays a record if any of the conditions separated by OR is TRUE." - } - } - }, - "8_req_filter_conditions": { - "title": "Filter by conditions", - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "conditions": { - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "$in": { - "type": "array", - "description": "Array of resource values that should be included in the results.", - "items": { - "type": "string" + }, + { + "id": "ern_66OdCyLADv5IGFoQe18vGUwa", + "created_at": "2022-11-24T17:03:59.414Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 2, + "points": 2, + "property": "customer_life_time_value" + } + } + }, + "event": "customer.loyalty.tier.left", + "loyalty_tier": { + "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2" + }, + "source": { + "banner": "Tier left", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_czm5el1Uz1jeGaO97AYoDNAq", + "metadata": { + "Type": "Tier left" + } + }, + { + "id": "ern_YR3fDfCjAmz9a5D68nk0i4dm", + "created_at": "2022-11-25T07:29:38.961Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 3, + "points": 4, + "property": "customer_life_time_value" + } + } + }, + "event": "customer.loyalty.tier.upgraded", + "loyalty_tier": { + "id": "ltr_30KHciA0UG8B71Fo51GZqwgN" + }, + "source": { + "banner": "Tier upgraded", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_M1OdRH8spk6Fs7yTuPLN2LAv", + "metadata": { + "Type": "Upgraded" + } + }, + { + "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", + "created_at": "2022-11-25T07:31:05.866Z", + "updated_at": "2022-11-25T07:31:43.029Z", + "validation_rule_id": "val_kfmWpfXMI9P1", + "loyalty": { + "points": 1, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.downgraded", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Tier Downgraded", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", + "metadata": { + "Type": "Tier" + } + }, + { + "id": "ern_AdlWO2yt6b6llWsibIdiRXVE", + "created_at": "2022-11-25T07:31:42.767Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 5, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.prolonged", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Prolonged", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_4jH1yq9WJS0oJ8suagCrltyb", + "metadata": {} } - }, - "$not_in": { - "type": "array", - "description": "Array of resource values that should be included in the results.", - "items": { - "type": "string" + ], + "anyOf": [ + { + "$ref": "#/components/schemas/8_obj_earning_rule_object_order_paid_no_validation_rule" + }, + { + "$ref": "#/components/schemas/8_obj_earning_rule_object_custom_event_no_validation_rule" + }, + { + "$ref": "#/components/schemas/8_obj_earning_rule_object_entered_segment_no_validation_rule" + }, + { + "$ref": "#/components/schemas/8_obj_earning_rule_object_tier_no_validation_rule" } - }, - "$is": { - "type": "string", - "description": "Specify the exact resource value." - }, - "$is_not": { - "type": "string", - "description": "Results should omit this value." - } - } - } - } - }, - "8_res_list_reward_assignments": { - "title": "List Reward Assignments", - "type": "object", - "description": "Response body schema for **GET** `/loyalties/{campaignId}/rewards`.", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about loyalty reward assignments in a dictionary.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of reward assignment objects.", - "default": "data" - }, - "data": { - "type": "array", - "description": "Contains array of reward assignment objects.", - "items": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of reward assignment objects." - } - } - }, - "8_res_list_loyalty_tiers": { - "title": "List Loyalty Tiers", - "type": "object", - "description": "Response body schema for listing loyalty tiers for a campaign using **GET** `/loyalties/{campaignId}/tiers`.", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of loyalty tier objects.", - "default": "data" - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/8_obj_loyalty_tier_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of loyalty tier objects." - } - } - }, - "8_res_get_member_loyalty_tier": { - "title": "Get Member's Loyalty Tier Response Body", - "type": "object", - "description": "Response body schema for retrieving a member's loyalty tier for a campaign using **GET** `/loyalties/members/{memberId}/tiers`.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of loyalty tier objects." - }, - "data": { - "type": "array", - "description": "Contains array of loyalty tier objects.", - "items": { - "$ref": "#/components/schemas/8_obj_loyalty_tier_object_member" - } - }, - "total": { - "type": "integer", - "description": "Total number of loyalty tiers." - } - } - }, - "8_req_create_reward_assignment": { - "title": "Create Reward Assignment Request Body", - "type": "array", - "description": "Request body schema for **POST** `/loyalties/{campaignId}/rewards`.", - "items": { - "type": "object", - "properties": { - "reward": { - "type": "string", - "example": "rew_2yGflHThU2yJwFECEFKrXBI2", - "description": "Unique reward ID." + ] }, - "parameters": { + "8_obj_earning_rule_object_order_paid": { + "description": "This is an object representing an earning rule for a paid order.", "type": "object", - "description": "An object that defines the price of the reward in loyalty points.", + "title": "Earning Rule Object for Order Paid", + "examples": [ + { + "id": "ern_taClaOIiaGNdmdby8xS0lCcy", + "created_at": "2022-02-04T13:27:50.665Z", + "updated_at": "2022-02-07T08:19:44.198Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" + }, + "event": "order.paid", + "source": { + "banner": "Order paid 1000 points", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 4 + ], + "object": "earning_rule", + "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" + } + ], "properties": { + "id": { + "type": "string", + "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", + "description": "Assigned by the Voucherify API, identifies the earning rule object." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", + "example": "2022-02-02T13:18:32.557Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", + "example": "2022-02-03T13:09:27.206Z", + "format": "date-time" + }, + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_paid" + } + ] + }, + "event": { + "type": "string", + "enum": [ + "order.paid" + ], + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `order.paid` an event defined by the Voucherify API corresponding to an order status `PAID`. " + }, + "source": { "type": "object", - "description": "Stores the points parameter.", + "description": "Contains the custom earning rule name and parent campaign.", "properties": { - "points": { - "type": "integer", - "description": "Defines how many points are required to obtain the reward." + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + }, + "object_id": { + "type": "string", + "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "description": "A unique campaign identifier assigned by the Voucherify API." + }, + "object_type": { + "type": "string", + "default": "campaign", + "description": "Defines the object associated with the earning rule. Defaults to `campaign`." + } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" } } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "object": { + "type": "string", + "default": "earning_rule", + "description": "The type of object represented by JSON. Default is `earning_rule`." + }, + "automation_id": { + "type": "string", + "description": "For internal use by Voucherify.", + "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." } } - } - } - } - }, - "8_res_create_reward_assignment": { - "title": "Create Reward Assignment Response Body", - "type": "array", - "description": "Response body schema for **POST** `/loyalties/{campaignId}/rewards`.", - "items": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" - } - }, - "8_req_update_reward_assignment": { - "title": "Update Reward Assignment Request Body", - "type": "object", - "description": "Request body schema for **PUT** `/loyalties/{campaignId}/rewards/{assignmentId}`.", - "properties": { - "parameters": { - "type": "object", - "description": "An object that defines the price of the reward in loyalty points.", - "properties": { - "loyalty": { - "type": "object", - "description": "Stores the points parameter.", - "properties": { - "points": { - "type": "integer", - "description": "Defines how many points are required to obtain the reward." + }, + "8_req_earning_rule_object_order_paid": { + "description": "This is an object representing an earning rule for a paid order.", + "type": "object", + "title": "Earning Rule Object for Order Paid", + "examples": [ + { + "id": "ern_taClaOIiaGNdmdby8xS0lCcy", + "created_at": "2022-02-04T13:27:50.665Z", + "updated_at": "2022-02-07T08:19:44.198Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" + }, + "event": "order.paid", + "source": { + "banner": "Order paid 1000 points", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 4 + ], + "object": "earning_rule", + "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" + } + ], + "properties": { + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_paid" + } + ] + }, + "event": { + "type": "string", + "enum": [ + "order.paid" + ], + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `order.paid` an event defined by the Voucherify API corresponding to an order status `PAID`. " + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." } } - } - } - } - }, - "8_res_list_loyalty_tier_earning_rules": { - "title": "List Loyalty Tier Earning Rules", - "type": "object", - "description": "Response body schema for `/loyalties/{campaignId}/tiers/{tierId}/earning-rules`.", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about loyalty tier earning rules in a dictionary." - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of loyalty tier earning rule objects." - }, - "data": { - "type": "array", - "description": "Contains array of loyalty tier earning rules.", - "items": { - "$ref": "#/components/schemas/8_obj_earning_rule_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of earning rule objects." - } - } - }, - "8_res_list_loyalty_tier_rewards": { - "title": "List Loyalty Tier Rewards", - "type": "object", - "description": "Response schema for `/loyalties/{campaignId}/tiers/{tierId}/rewards`.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about loyalty tier rewards in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of loyalty tier reward objects." - }, - "data": { - "type": "array", - "description": "Contains array of loyalty tier reward objects.", - "items": { - "$ref": "#/components/schemas/8_obj_loyalty_tier_reward_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of loyalty tier reward objects." - } - } - }, - "8_res_list_members": { - "title": "List Members", - "type": "object", - "description": "Response body schema for **GET** `/loyalties/{campaignId}/members`.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about members in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "vouchers", - "description": "Identifies the name of the attribute that contains the array of voucher objects." - }, - "vouchers": { - "type": "array", - "description": "Contains array of voucher objects representing loyalty cards, in other words, loyalty program members.", - "items": { - "$ref": "#/components/schemas/8_obj_loyalty_card_object_non_expanded_categories" - } - }, - "total": { - "type": "integer", - "description": "Total number of voucher objects." - } - } - }, - "8_req_add_member": { - "title": "Add Member Request Body", - "type": "object", - "description": "Request body schema for assigning a loyalty card to a customer using **POST** `/loyalties/{campaignId}/members`.", - "properties": { - "voucher": { - "type": "string", - "description": "Specify the loyalty card code that you would like to publish to a customer." - }, - "channel": { - "type": "string", - "description": "Specify the distribution channel." - }, - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/8_req_customer_id_string" - }, - { - "$ref": "#/components/schemas/8_req_customer_id" - }, - { - "$ref": "#/components/schemas/8_req_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." - }, - "metadata": { - "type": "string", - "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." - } - } - }, - "8_req_customer_id": { - "title": "Customer ID", - "description": "You can pass the unique customer ID that was assigned by Voucherify.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of an existing customer." - } - } - }, - "8_req_customer_id_string": { - "title": "Customer ID", - "description": "You can pass the unique customer ID that was assigned by Voucherify or the source ID.", - "type": "string" - }, - "8_req_customer_source_id": { - "title": "Customer Source ID", - "description": "You can send the source ID that you used to create the customer in Voucherify.", - "type": "object", - "properties": { - "source_id": { - "type": "string", - "description": "A unique identifier of a customer. It can be a customer ID or email from a CRM system, database or 3rd-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored." - } - } - }, - "8_res_get_member_activities": { - "title": "Get Member Activities", - "type": "object", - "description": "Response body schema for retrieving member activities.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about member activities in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "activities", - "description": "Identifies the name of the attribute that contains the array of event objects." - }, - "activities": { - "type": "array", - "description": "Contains array of event objects.", - "items": {} - }, - "total": { - "type": "integer", - "description": "Total number of event objects." - } - } - }, - "8_res_list_member_rewards": { - "title": "List Member Rewards", - "type": "object", - "description": "Response body schema for `/loyalties/members/{memberId}/rewards`.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about member rewards in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of loyalty reward objects." - }, - "data": { - "type": "array", - "description": "Contains array of loyalty reward objects.", - "items": { - "$ref": "#/components/schemas/8_obj_loyalty_reward_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of loyalty reward objects." - } - } - }, - "8_res_get_points_expiration": { - "title": "Get Points Expiration Response Body", - "type": "object", - "description": "Response body schema for `/loyalties/{campaignId}/members/{memberId}/points-expiration`.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about loyalty points expiration buckets in a dictionary." - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of loyalty points expiration bucket objects.", - "default": "data" - }, - "data": { - "type": "array", - "description": "Contains array of loyalty points expiration buckets.", - "items": { - "$ref": "#/components/schemas/8_obj_loyalty_points_bucket" - } - }, - "total": { - "type": "integer", - "description": "Total number of point expiration buckets." - } - } - }, - "9_req_create_customer": { - "type": "object", - "title": "Customer", - "description": "This is an object containing information about the customer.", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service. \n\nPlease note that if you would like your data to sync based on the `source_id` of the customer, you need to define the `source_id` upfront. You will not be able to change or update the `source_id` later on." - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a customer object." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "phone": { - "type": "string", - "description": "Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel." - }, - "address": { - "type": "object", - "description": "Customer's address.", - "properties": { - "city": { - "type": "string", - "description": "City" - }, - "state": { - "type": "string", - "description": "State" - }, - "line_1": { - "type": "string", - "description": "First line of address." - }, - "line_2": { - "type": "string", - "description": "Second line of address." - }, - "country": { - "type": "string", - "description": "Country." - }, - "postal_code": { - "type": "string", - "description": "Postal code." - } - } - }, - "birthdate": { - "type": "string", - "description": "Customer's birthdate; format `YYYY-MM-DD`.", - "format": "date" - }, - "birthday": { - "type": "string", - "description": "Customer's birthdate; format `YYYY-MM-DD`.", - "format": "date" - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. " - } - } - }, - "9_req_update_customer": { - "type": "object", - "title": "Customer object", - "description": "This is an object containing information about the customer.", - "properties": { - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a customer object." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "phone": { - "type": "string", - "description": "Customer's phone number." - }, - "address": { - "type": "object", - "description": "Customer's address.", - "properties": { - "city": { - "type": "string", - "description": "City" - }, - "state": { - "type": "string", - "description": "State" - }, - "line_1": { - "type": "string", - "description": "First line of address." - }, - "line_2": { - "type": "string", - "description": "Second line of address." - }, - "country": { - "type": "string", - "description": "Country." - }, - "postal_code": { - "type": "string", - "description": "Postal code." - } - } - }, - "birthdate": { - "type": "string", - "description": "Customer's birthdate; format `YYYY-MM-DD`.", - "format": "date" - }, - "birthday": { - "type": "string", - "description": "Customer's birthdate; format `YYYY-MM-DD`.", - "format": "date" - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. " - } - } - }, - "9_obj_customer_object": { - "type": "object", - "description": "This is an object representing a customer. \n\nThis entity allows you to:\n* store customer details in Voucherify\n* link [redemptions](ref:list-redemptions) and [validations](ref:validate-voucher) to a particular customer\n* build customer segments and use them in validation rules. ", - "title": "Customer Object", - "examples": [ - { - "id": "cust_4vMj8Twr5nBzvTrNCgipMb6M", - "source_id": "08dd9b5a", - "name": "Bob Smith", - "email": "bob.smith@email.com", - "address": { - "city": "New York", - "state": "NY", - "line_1": "678 Main St", - "line_2": null, - "country": "USA", - "postal_code": "10001" - }, - "summary": { - "redemptions": { - "total_redeemed": 5, - "total_failed": 0, - "total_succeeded": 5, - "total_rolled_back": 0, - "total_rollback_failed": 0, - "total_rollback_succeeded": 0, - "gift": { - "redeemed_amount": 0, - "amount_to_go": 0 - }, - "loyalty_card": { - "redeemed_points": 0, - "points_to_go": 830 - } - }, - "orders": { - "total_amount": 94600, - "total_count": 5, - "average_amount": 18920, - "last_order_amount": 27500, - "last_order_date": "2022-09-15T11:11:36.630Z" - } - }, - "loyalty": { - "points": 830, - "referred_customers": 0, - "campaigns": { - "Loyalty Campaign - Webinar": { - "points": 830, - "referred_customers": 0 - } - } - }, - "referrals": { - "total": 0, - "campaigns": [] - }, - "metadata": { - "age": 24, - "loyalty_customer": "true", - "acquisition_channel": "Facebook" - }, - "system_metadata": { - "consents": { - "cnst_lbgOBhHTuDrB7sjIhFjvIALj": { - "date": "2022-11-22T15:48:50.219Z", - "value": true - } - } - }, - "created_at": "2022-09-15T10:33:46.388Z", - "updated_at": "2022-11-22T15:48:50.220Z", - "assets": { - "cockpit_url": "https://cockpits.voucherify.io/customers?token=U2FsdGVkX186yavyLJyykWa9KfhE1J850qWbQ1B%2BjKBZ0wrIzBNaW1WR6tNZo71Y5oTWG6PYpI9BpXDSnzz7CRfQ3lu7M151btz2vlYVxbd2eHNOjTFEwTbD8wK4moLONgtTlPM8ze42nmutFk5GUBepUEhxHRfbk8zekWqWvo8%2FbnAJsPl2rxYyaggwXQDj" }, - "object": "customer" - } - ], - "x-tags": [ - "CUSTOMERS API" - ], - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_CSnYd37MXmrbS19XCrghjBsv" - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It is externally defined. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a customer object." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "phone": { - "type": "string", - "description": "Customer's phone number." - }, - "birthdate": { - "type": "string", - "description": "Customer's birthdate." - }, - "birthday": { - "type": "string", - "description": "Customer's birthday." - }, - "address": { - "type": "object", - "description": "Customer's address.", - "properties": { - "city": { - "type": "string", - "description": "City" - }, - "state": { - "type": "string", - "description": "State" - }, - "line_1": { - "type": "string", - "description": "First line of address." - }, - "line_2": { - "type": "string", - "description": "Second line of address." - }, - "country": { - "type": "string", - "description": "Country." - }, - "postal_code": { - "type": "string", - "description": "Postal code." - } - } - }, - "summary": { - "type": "object", - "description": "Contains a summary of customer's redemption and order statistics.", - "properties": { - "redemptions": { - "type": "object", - "description": "Customer's redemptions statistics.", - "properties": { - "total_redeemed": { - "type": "integer", - "description": "Total number of redemptions made by the customer." - }, - "total_failed": { - "type": "integer", - "description": "Total number of redemptions that failed." - }, - "total_succeeded": { - "type": "integer", - "description": "Total number of redemptions that succeeded." - }, - "total_rolled_back": { - "type": "integer", - "description": "Total number of redemptions that were rolled back for the customer." + "8_req_update_earning_rule_object_order_paid": { + "description": "This is an object representing an earning rule for a paid order.", + "type": "object", + "title": "Earning Rule Object for Order Paid", + "examples": [ + { + "id": "ern_taClaOIiaGNdmdby8xS0lCcy", + "created_at": "2022-02-04T13:27:50.665Z", + "updated_at": "2022-02-07T08:19:44.198Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" }, - "total_rollback_failed": { - "type": "integer", - "description": "Total number of redemption rollbacks that failed." + "event": "order.paid", + "source": { + "banner": "Order paid 1000 points", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" }, - "total_rollback_succeeded": { - "type": "integer", - "description": "Total number of redemption rollbacks that succeeded." + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" }, - "gift": { - "type": "object", - "description": "Summary of gift card credits.", - "properties": { - "redeemed_amount": { - "type": "integer", - "description": "Total amount of gift card credits redeemed by customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "amount_to_go": { - "type": "integer", - "description": "Remaining gift card balance across all gift cards. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } + "validity_day_of_week": [ + 4 + ], + "object": "earning_rule", + "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" + } + ], + "properties": { + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_paid" } - }, - "loyalty_card": { - "type": "object", - "description": "Summary of loyalty points.", - "properties": { - "redeemed_points": { - "type": "integer", - "description": "Total number of loyalty points redeemed by the customer." - }, - "points_to_go": { - "type": "integer", - "description": "Sum of remaining available point balance across all loyalty cards." - } + ] + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" } } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." } - }, - "orders": { - "type": "object", - "description": "Customer's order statistics.", - "properties": { - "total_amount": { - "type": "integer", - "description": "The total amount spent by the customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "total_count": { - "type": "integer", - "description": "Total number of orders made by the customer." + } + }, + "8_obj_earning_rule_object_order_paid_no_validation_rule": { + "description": "This is an object representing an earning rule for a paid order.", + "type": "object", + "title": "Earning Rule Object for Order Paid", + "examples": [ + { + "id": "ern_taClaOIiaGNdmdby8xS0lCcy", + "created_at": "2022-02-04T13:27:50.665Z", + "updated_at": "2022-02-07T08:19:44.198Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" }, - "average_amount": { - "type": "integer", - "description": "Average amount spent on orders. `total_amount` ÷ `total_count`. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "event": "order.paid", + "source": { + "banner": "Order paid 1000 points", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" }, - "last_order_amount": { - "type": "integer", - "description": "Amount spent on last order. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" }, - "last_order_date": { - "type": "string", - "format": "date-time", - "example": "2022-08-30T11:51:08.029Z", - "description": "Timestamp representing the date and time of the customer's last order in ISO 8601 format." - } + "validity_day_of_week": [ + 4 + ], + "object": "earning_rule", + "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" } - } - } - }, - "loyalty": { - "type": "object", - "description": "Summary of customer's loyalty information.", - "properties": { - "points": { - "type": "integer", - "description": "Sum of remaining available point balance across all loyalty cards." - }, - "referred_customers": { - "type": "integer", - "description": "Total number of customers referred by the customer." - }, - "campaigns": { - "type": "object", - "description": "Contains campaigns with details about point balances and how many customers were referred by the customer.", - "properties": { - "campaign_name": { - "type": "object", - "description": "Contains details about the point balances left on loyalty cards and the number of referred customers in each campaign.", - "properties": { - "points": { - "type": "integer", - "description": "Remaining point balance in campaign." - }, - "loyalty_tier": { - "type": "string", - "example": "ltr_UJ5Q54Q0OvEhua87Qfv2Ki5x", - "description": "Customer's loyalty tier within the campaign." - }, - "referred_customers": { - "type": "integer", - "description": "Number of customers referred by the customer in campaign." - } + ], + "properties": { + "id": { + "type": "string", + "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", + "description": "Assigned by the Voucherify API, identifies the earning rule object." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", + "example": "2022-02-02T13:18:32.557Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", + "example": "2022-02-03T13:09:27.206Z", + "format": "date-time" + }, + "validation_rule_id": { + "type": "null", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_paid" } - } - } - } - } - }, - "referrals": { - "type": "object", - "description": "Summary of customer's referrals, in this case, the customer being the referee, i.e. information about the source of referrals and number of times the customer was referred by other customers.", - "properties": { - "total": { - "type": "integer", - "description": "Total number of times this customer received a referral, i.e. was referred by another customer." - }, - "campaigns": { - "type": "array", - "description": "Contains an array of campaigns that served as the source of a referral for the customer.", - "items": { + ] + }, + "event": { + "type": "string", + "enum": [ + "order.paid" + ], + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `order.paid` an event defined by the Voucherify API corresponding to an order status `PAID`. " + }, + "source": { "type": "object", - "description": "Contains information about the source of the referral.", + "description": "Contains the custom earning rule name and parent campaign.", "properties": { - "campaign_id": { + "banner": { "type": "string", - "description": "Unique campaign ID, assigned by Voucherify.", - "example": "camp_rRsfatlwN7unSeUIJDCYedal" + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." }, - "referrer_id": { + "object_id": { "type": "string", - "example": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", - "description": "Unique referrer ID, assigned by Voucherify. This is the customer ID of a customer that is referring this customer." + "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "description": "A unique campaign identifier assigned by the Voucherify API." }, - "related_object_id": { + "object_type": { "type": "string", - "description": "Related object ID, i.e. `r_0b9d4cc4aa164dd073`." - }, - "related_object_type": { + "default": "campaign", + "description": "Defines the object associated with the earning rule. Defaults to `campaign`." + } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { "type": "string", - "description": "Related object type, i.e. `redemption`." + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" }, - "date": { + "interval": { "type": "string", - "format": "date-time", - "example": "2022-08-30T10:19:39.196Z", - "description": "Timestamp representing the date and time when the customer was referred in ISO 8601 format." + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" } } - } - } - } - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments." - }, - "system_metadata": { - "type": "object", - "description": "Object used to store system metadata information.", - "properties": { - "consents": { - "type": "object", - "description": "Stores a list of consent ID's along with the timestamp and decision on accepting or rejecting a marketing permission.", - "properties": { - "consentId": { - "type": "object", - "description": "Unique ID of a consent, i.e. `cnst_lbgOBhHTuDrB7sjIhFjvIALj`.", - "properties": { - "date": { - "type": "string", - "description": "Timestamp representing the date and time when a consent was accepted or rejected in ISO 8601 format.", - "example": "2022-05-10T08:50:10.338Z", - "format": "date-time" - }, - "value": { - "type": "boolean", - "description": "Accepted: `true`, Rejected: `false`" - } - } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" } - } - }, - "source": { - "type": "string", - "description": "Takes on the name of the source of the integration if the customer was created through an integration, i.e. `Bigcommerce` or `Shopify`." - } - } - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the customer was created in ISO 8601 format.", - "example": "2022-08-30T06:32:07.380Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the customer was updated in ISO 8601 format.", - "example": "2022-08-31T06:32:07.380Z", - "format": "date-time" - }, - "assets": { - "type": "object", - "description": "Contains information about the customer's cockpit.", - "properties": { - "cockpit_url": { - "type": "string", - "description": "Customer's cockpit URL address." - } - } - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the customer.", - "default": "customer" - } - } - }, - "9_obj_customer_object_email_parameter": { - "type": "object", - "description": "This is an object representing a customer.", - "title": "Customer Object", - "examples": [ - { - "id": "cust_4vMj8Twr5nBzvTrNCgipMb6M", - "source_id": "08dd9b5a", - "name": "Bob Smith", - "email": "bob.smith@email.com", - "address": { - "city": "New York", - "state": "NY", - "line_1": "678 Main St", - "line_2": null, - "country": "USA", - "postal_code": "10001" - }, - "summary": { - "redemptions": { - "total_redeemed": 5, - "total_failed": 0, - "total_succeeded": 5, - "total_rolled_back": 0, - "total_rollback_failed": 0, - "total_rollback_succeeded": 0, - "gift": { - "redeemed_amount": 0, - "amount_to_go": 0 }, - "loyalty_card": { - "redeemed_points": 0, - "points_to_go": 830 + "object": { + "type": "string", + "default": "earning_rule", + "description": "The type of object represented by JSON. Default is `earning_rule`." + }, + "automation_id": { + "type": "string", + "description": "For internal use by Voucherify.", + "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." } - }, - "orders": { - "total_amount": 94600, - "total_count": 5, - "average_amount": 18920, - "last_order_amount": 27500, - "last_order_date": "2022-09-15T11:11:36.630Z" } }, - "loyalty": { - "points": 830, - "referred_customers": 0, - "campaigns": { - "Loyalty Campaign - Webinar": { - "points": 830, - "referred_customers": 0 + "8_obj_earning_rule_object_entered_segment": { + "description": "This is an object representing an earning rule for entering a customer segment.", + "type": "object", + "title": "Earning Rule Object for Entered Segment", + "examples": [ + { + "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", + "created_at": "2022-02-04T13:02:52.937Z", + "updated_at": "2022-02-07T08:19:43.291Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" + }, + "segment": { + "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" + }, + "event": "customer.segment.entered", + "source": { + "banner": "Entered segment 100 points.", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" } - } - }, - "referrals": { - "total": 0, - "campaigns": [] - }, - "metadata": { - "age": 24, - "loyalty_customer": "true", - "acquisition_channel": "Facebook" - }, - "system_metadata": { - "consents": { - "cnst_lbgOBhHTuDrB7sjIhFjvIALj": { - "date": "2022-11-22T15:48:50.219Z", - "value": true + ], + "properties": { + "id": { + "type": "string", + "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", + "description": "Assigned by the Voucherify API, identifies the earning rule object." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", + "example": "2022-02-02T13:18:32.557Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", + "example": "2022-02-03T13:09:27.206Z", + "format": "date-time" + }, + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" + } + ] + }, + "segment": { + "type": "object", + "description": "Contains the id of a customer segment. **Required** for the `customer.segment.entered` option in `event`.", + "properties": { + "id": { + "type": "string", + "description": "Contains a unique identifier of a customer segment. Assigned by the Voucherify API." + } + } + }, + "event": { + "type": "string", + "enum": [ + "customer.segment.entered" + ], + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.segment.entered` an event defined by the Voucherify API corresponding to a customer entering a pre-defined customer segment." + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + }, + "object_id": { + "type": "string", + "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "description": "A unique campaign identifier assigned by the Voucherify API." + }, + "object_type": { + "type": "string", + "default": "campaign", + "description": "Defines the object associated with the earning rule. Defaults to `campaign`." + } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "object": { + "type": "string", + "default": "earning_rule", + "description": "The type of object represented by JSON. Default is `earning_rule`." + }, + "automation_id": { + "type": "string", + "description": "For internal use by Voucherify.", + "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." } } }, - "created_at": "2022-09-15T10:33:46.388Z", - "updated_at": "2022-11-22T15:48:50.220Z", - "assets": { - "cockpit_url": "https://cockpits.voucherify.io/customers?token=U2FsdGVkX186yavyLJyykWa9KfhE1J850qWbQ1B%2BjKBZ0wrIzBNaW1WR6tNZo71Y5oTWG6PYpI9BpXDSnzz7CRfQ3lu7M151btz2vlYVxbd2eHNOjTFEwTbD8wK4moLONgtTlPM8ze42nmutFk5GUBepUEhxHRfbk8zekWqWvo8%2FbnAJsPl2rxYyaggwXQDj" - }, - "object": "customer" - } - ], - "x-tags": [ - "CUSTOMERS API" - ], - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_CSnYd37MXmrbS19XCrghjBsv" - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a customer object." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "phone": { - "type": "string", - "description": "Customer's phone number." - }, - "birthdate": { - "type": "string", - "description": "Customer's birthdate." - }, - "birthday": { - "type": "string", - "description": "Customer's birthday." - }, - "address": { - "type": "object", - "description": "Customer's address.", - "properties": { - "city": { - "type": "string", - "description": "City" - }, - "state": { - "type": "string", - "description": "State" - }, - "line_1": { - "type": "string", - "description": "First line of address." - }, - "line_2": { - "type": "string", - "description": "Second line of address." - }, - "country": { - "type": "string", - "description": "Country." - }, - "postal_code": { - "type": "string", - "description": "Postal code." - } - } - }, - "summary": { - "type": "object", - "description": "Contains a summary of customer's redemption and order statistics.", - "properties": { - "redemptions": { - "type": "object", - "description": "Customer's redemptions statistics.", - "properties": { - "total_redeemed": { - "type": "integer", - "description": "Total number of redemptions made by the customer." - }, - "total_failed": { - "type": "integer", - "description": "Total number of redemptions that failed." - }, - "total_succeeded": { - "type": "integer", - "description": "Total number of redemptions that succeeded." + "8_req_earning_rule_object_entered_segment": { + "description": "This is an object representing an earning rule for entering a customer segment.", + "type": "object", + "title": "Earning Rule Object for Entered Segment", + "examples": [ + { + "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", + "created_at": "2022-02-04T13:02:52.937Z", + "updated_at": "2022-02-07T08:19:43.291Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" }, - "total_rolled_back": { - "type": "integer", - "description": "Total number of redemptions that were rolled back for the customer." + "segment": { + "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" }, - "total_rollback_failed": { - "type": "integer", - "description": "Total number of redemption rollbacks that failed." + "event": "customer.segment.entered", + "source": { + "banner": "Entered segment 100 points.", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" }, - "total_rollback_succeeded": { - "type": "integer", - "description": "Total number of redemption rollbacks that succeeded." + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" }, - "gift": { - "type": "object", - "description": "Summary of gift card credits.", - "properties": { - "redeemed_amount": { - "type": "integer", - "description": "Total amount of gift card credits redeemed by customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "amount_to_go": { - "type": "integer", - "description": "Remaining gift card balance across all gift cards. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" + } + ], + "properties": { + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" } - }, - "loyalty_card": { - "type": "object", - "description": "Summary of loyalty points.", - "properties": { - "redeemed_points": { - "type": "integer", - "description": "Total number of loyalty points redeemed by the customer." - }, - "points_to_go": { - "type": "integer", - "description": "Sum of remaining available point balance accross all loyalty cards." - } + ] + }, + "segment": { + "type": "object", + "description": "Contains the id of a customer segment. **Required** for the `customer.segment.entered` option in `event`.", + "properties": { + "id": { + "type": "string", + "description": "Contains a unique identifier of a customer segment. Assigned by the Voucherify API." + } + } + }, + "event": { + "type": "string", + "enum": [ + "customer.segment.entered" + ], + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.segment.entered` an event defined by the Voucherify API corresponding to a customer entering a pre-defined customer segment." + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" } } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." } - }, - "orders": { - "type": "object", - "description": "Customer's order statistics.", - "properties": { - "total_amount": { - "type": "integer", - "description": "The total amount spent by the customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + }, + "8_req_update_earning_rule_object_entered_segment": { + "description": "This is an object representing an earning rule for entering a customer segment.", + "type": "object", + "title": "Earning Rule Object for Entered Segment", + "examples": [ + { + "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", + "created_at": "2022-02-04T13:02:52.937Z", + "updated_at": "2022-02-07T08:19:43.291Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" }, - "total_count": { - "type": "integer", - "description": "Total number of orders made by the customer." + "segment": { + "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" }, - "average_amount": { - "type": "integer", - "description": "Average amount spent on orders. `total_amount` ÷ `total_count`. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "event": "customer.segment.entered", + "source": { + "banner": "Entered segment 100 points.", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" }, - "last_order_amount": { - "type": "integer", - "description": "Amount spent on last order. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" }, - "last_order_date": { - "type": "string", - "example": "2022-08-30T11:51:08.029Z", - "description": "Timestamp representing the date and time of the customer's last order in ISO 8601 format." - } + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" } - } - } - }, - "loyalty": { - "type": "object", - "description": "Summary of customer's loyalty information.", - "properties": { - "points": { - "type": "integer" - }, - "referred_customers": { - "type": "integer", - "description": "Total number of customers referred by the customer." - }, - "campaigns": { - "type": "object", - "description": "Contains campaigns with details about point balances and how many customers were referred by the customer.", - "properties": { - "campaign_name": { - "type": "object", - "description": "Contains details about the point balances left on loyalty cards and the number of referred customers in each campaign.", - "properties": { - "points": { - "type": "integer", - "description": "Remaining point balance in campaign." - }, - "loyalty_tier": { - "type": "string", - "example": "ltr_UJ5Q54Q0OvEhua87Qfv2Ki5x", - "description": "Customer's loyalty tier within the campaign." - }, - "referred_customers": { - "type": "integer", - "description": "Number of customers referred by the customer in campaign." - } + ], + "properties": { + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" + } + ] + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" } } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." } } - } - }, - "referrals": { - "type": "object", - "description": "Summary of customer's referrals, in this case, the customer being the referee, i.e. information about the source of referrals and number of times the customer was referred by other customers.", - "properties": { - "total": { - "type": "integer", - "description": "Total number of times this customer received a referral, i.e. was referred by another customer." - }, - "campaigns": { - "type": "array", - "description": "Contains an array of campaigns that served as the source of a referral for the customer.", - "items": { + }, + "8_obj_earning_rule_object_entered_segment_no_validation_rule": { + "description": "This is an object representing an earning rule for entering a customer segment.", + "type": "object", + "title": "Earning Rule Object for Entered Segment", + "examples": [ + { + "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", + "created_at": "2022-02-04T13:02:52.937Z", + "updated_at": "2022-02-07T08:19:43.291Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" + }, + "segment": { + "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" + }, + "event": "customer.segment.entered", + "source": { + "banner": "Entered segment 100 points.", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" + } + ], + "properties": { + "id": { + "type": "string", + "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", + "description": "Assigned by the Voucherify API, identifies the earning rule object." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", + "example": "2022-02-02T13:18:32.557Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", + "example": "2022-02-03T13:09:27.206Z", + "format": "date-time" + }, + "validation_rule_id": { + "type": "null", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" + } + ] + }, + "segment": { "type": "object", - "description": "Contains information about the source of the referral.", + "description": "Contains the id of a customer segment. **Required** for the `customer.segment.entered` option in `event`.", "properties": { - "campaign_id": { + "id": { "type": "string", - "description": "Unique campaign ID, assigned by Voucherify.", - "example": "camp_rRsfatlwN7unSeUIJDCYedal" - }, - "referrer_id": { + "description": "Contains a unique identifier of a customer segment. Assigned by the Voucherify API." + } + } + }, + "event": { + "type": "string", + "enum": [ + "customer.segment.entered" + ], + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.segment.entered` an event defined by the Voucherify API corresponding to a customer entering a pre-defined customer segment." + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { "type": "string", - "example": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", - "description": "Unique referrer ID, assigned by Voucherify. This is the customer ID of a customer that is referring this customer." + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." }, - "related_object_id": { + "object_id": { "type": "string", - "description": "Related object ID, i.e. `r_0b9d4cc4aa164dd073`." + "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "description": "A unique campaign identifier assigned by the Voucherify API." }, - "related_object_type": { + "object_type": { + "type": "string", + "default": "campaign", + "description": "Defines the object associated with the earning rule. Defaults to `campaign`." + } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { "type": "string", - "description": "Related object type, i.e. `redemption`." + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" }, - "date": { + "interval": { "type": "string", - "example": "2022-08-30T10:19:39.196Z", - "description": "Timestamp representing the date and time when the customer was referred in ISO 8601 format." + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" } } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "object": { + "type": "string", + "default": "earning_rule", + "description": "The type of object represented by JSON. Default is `earning_rule`." + }, + "automation_id": { + "type": "string", + "description": "For internal use by Voucherify.", + "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." } } - } - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments." - }, - "system_metadata": { - "type": "object", - "description": "Object used to store system metadata information.", - "properties": { - "consents": { - "type": "object", - "description": "Stores a list of consent ID's along with the timestamp and decision on accepting or rejecting a marketing permission.", - "properties": { - "consentId": { - "type": "object", - "description": "Unique ID of a consent, i.e. `cnst_lbgOBhHTuDrB7sjIhFjvIALj`.", - "properties": { - "date": { - "type": "string", - "description": "Timestamp representing the date and time when a consent was accepted or rejected in ISO 8601 format.", - "example": "2022-05-10T08:50:10.338Z", - "format": "date-time" - }, - "value": { - "type": "boolean", - "description": "Accepted: `true`, Rejected: `false`" - } + }, + "8_obj_earning_rule_object_custom_event": { + "description": "This is an object representing an earning rule triggered by a custom event.", + "type": "object", + "title": "Earning Rule Object for Custom Event", + "examples": [ + { + "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", + "created_at": "2022-02-07T08:19:41.810Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 2, + "type": "FIXED" + }, + "custom_event": { + "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" + }, + "event": "saw_on_facebook", + "source": { + "banner": "Saw on Facebook Timeframe", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-02-07T08:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "object": "earning_rule", + "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" + } + ], + "properties": { + "id": { + "type": "string", + "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", + "description": "Assigned by the Voucherify API, identifies the earning rule object." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", + "example": "2022-02-02T13:18:32.557Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", + "example": "2022-02-03T13:09:27.206Z", + "format": "date-time" + }, + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_custom_event_metadata" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" + } + ] + }, + "custom_event": { + "type": "object", + "description": "Contains the schema id of a custom event. **Required** for the custom event option in `event`.", + "properties": { + "schema_id": { + "type": "string", + "description": "Contains a unique identifier of a custom event schema. Assigned by the Voucherify API.", + "example": "ms_gn4Qe4xsFPf7orCArCiNVY13" } } - } - }, - "source": { - "type": "string", - "description": "Takes on the name of the source of the integration if the customer was created through an integration, i.e. `Bigcommerce` or `Shopify`." - } - } - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the customer was created in ISO 8601 format.", - "example": "2022-08-30T06:32:07.380Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the customer was updated in ISO 8601 format.", - "example": "2022-08-31T06:32:07.380Z", - "format": "date-time" - }, - "assets": { - "type": "object", - "description": "Contains information about the customer's cockpit.", - "properties": { - "cockpit_url": { - "type": "string", - "description": "Customer's cockpit URL address." - } - } - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the customer.", - "default": "customer" - }, - "email_unsubscribed": { - "type": "boolean" - } - } - }, - "9_res_list_customers": { - "type": "object", - "title": "List Customers Response Body", - "description": "Response body schema for **GET** `/customers`.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about customers in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "customers", - "description": "Identifies the name of the attribute that contains the array of customer objects." - }, - "customers": { - "type": "array", - "description": "Contains array of customer objects.", - "items": { - "$ref": "#/components/schemas/9_obj_customer_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of customers." - } - } - }, - "9_res_list_customer_activities": { - "type": "object", - "title": "List Customer Activities Response Body", - "description": "Request body schema for `/customers/{customerId}/activities`.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about customer activities in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of customer activity objects." - }, - "data": { - "type": "array", - "description": "Array of customer activity objects.", - "items": { - "$ref": "#/components/schemas/9_obj_customer_activity_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of customer activities." - } - } - }, - "22_obj_webhooks": { - "type": "object", - "title": "Webhooks", - "description": "Data object model for a webhook.\n\n\nredemption.succeeded \nredemption.failed \nredemption.rollback.succeeded \nredemption.rollback.failed \npublication.succeeded \nvoucher.published \nvoucher.updated \nvoucher.deleted \nvoucher.created \nVoucher.enabled \nvoucher.disabled \nvoucher.loyalty_card.points_added \nvoucher.gift.balance_added \ncampaign.enabled \ncampaign.deleted \ncampaign.created \ncampaign.updated \ncampaign.disabled \ncampaign.vouchers.generation.completed \nbusiness_validation_rule.assignment.created \nbusiness_validation_rule.assignment.deleted \nbusiness_validation_rule.created \nbusiness_validation_rule.deleted \nbusiness_validation_rule.updated \ncustomer.created \ncustomer.deleted \ncustomer.rewarded \ncustomer.rewarded.loyalty_points \ncustomer.consents.revoked \ncustomer.consents.given ", - "x-tags": [ - "WEBHOOKS" - ], - "properties": { - "id": { - "type": "string", - "example": "event_m7MXf3zPf1n51IoUM8XHpP0w", - "description": "Unique event ID." - }, - "object": { - "type": "string", - "default": "event", - "description": "The type of object represented by JSON. This object stores information about events in a dictionary." - }, - "webhook_id": { - "type": "string", - "example": "wh_K7hpwSVDmKaxmBsDn0EpCvDy", - "description": "Unique webhook ID." - }, - "project_id": { - "type": "string", - "example": "proj_z7id5", - "description": "Unique Voucherify project ID." - }, - "created_at": { - "type": "string", - "example": "2022-11-30T16:53:30.434Z", - "format": "date-time", - "description": "Timestamp representing the date and time when the webhook was created in ISO 8601 format." - }, - "type": { - "type": "string", - "enum": [ - "redemption.succeeded", - "redemption.failed", - "redemption.rollback.succeeded", - "redemption.rollback.failed", - "publication.succeeded", - "voucher.published", - "voucher.updated", - "voucher.deleted", - "voucher.created", - "Voucher.enabled", - "voucher.disabled", - "voucher.loyalty_card.points_added", - "voucher.gift.balance_added", - "campaign.enabled", - "campaign.deleted", - "campaign.created", - "campaign.updated", - "campaign.disabled", - "campaign.vouchers.generation.completed", - "business_validation_rule.assignment.created", - "business_validation_rule.assignment.deleted", - "business_validation_rule.created", - "business_validation_rule.deleted", - "business_validation_rule.updated", - "customer.created", - "customer.deleted", - "customer.rewarded", - "customer.rewarded.loyalty_points", - "customer.consents.revoked", - "customer.consents.given" - ] - }, - "data": { - "$ref": "#/components/schemas/22_obj_webhook_object_data" - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs attached to a webhook. The metadata object stores all custom attributes assigned to the webhook. It can be useful for storing additional information about the webhook in a structured format.", - "properties": { - "source": { - "type": "string", - "description": "The origin of the webhook.", - "enum": [ - "API" - ] - } - } - } - } - }, - "22_obj_webhook_object_data": { - "title": "Webhook Object", - "description": "Webhook event data object schema.", - "anyOf": [ - { - "$ref": "#/components/schemas/22_obj_event_redemption_succeeded" - }, - { - "$ref": "#/components/schemas/22_obj_event_redemption_failed" - }, - { - "$ref": "#/components/schemas/22_obj_event_redemption_rollback_succeeded" - }, - { - "$ref": "#/components/schemas/22_obj_event_redemption_rollback_failed" - }, - { - "$ref": "#/components/schemas/22_obj_event_publication_succeeded" - }, - { - "$ref": "#/components/schemas/22_obj_event_voucher_published" - }, - { - "$ref": "#/components/schemas/22_obj_event_voucher_updated" - }, - { - "$ref": "#/components/schemas/22_obj_event_voucher_deleted" - }, - { - "$ref": "#/components/schemas/22_obj_event_voucher_created" - }, - { - "$ref": "#/components/schemas/22_obj_event_voucher_enabled" - }, - { - "$ref": "#/components/schemas/22_obj_event_voucher_disabled" - }, - { - "$ref": "#/components/schemas/22_obj_event_voucher_loyalty_card_points_added" - }, - { - "$ref": "#/components/schemas/22_obj_event_voucher_gift_balance_added" - }, - { - "$ref": "#/components/schemas/22_obj_event_campaign_enabled" - }, - { - "$ref": "#/components/schemas/22_obj_event_campaign_deleted" - }, - { - "$ref": "#/components/schemas/22_obj_event_campaign_created" - }, - { - "$ref": "#/components/schemas/22_obj_event_campaign_updated" - }, - { - "$ref": "#/components/schemas/22_obj_event_campaign_disabled" - }, - { - "$ref": "#/components/schemas/22_obj_event_campaign_vouchers_generation_completed" - }, - { - "$ref": "#/components/schemas/22_obj_event_business_validation_rule_assignment_created" - }, - { - "$ref": "#/components/schemas/22_obj_event_business_validation_rule_assignment_deleted" - }, - { - "$ref": "#/components/schemas/22_obj_event_business_validation_rule_created" - }, - { - "$ref": "#/components/schemas/22_obj_event_business_validation_rule_deleted" - }, - { - "$ref": "#/components/schemas/22_obj_event_business_validation_rule_updated" - }, - { - "$ref": "#/components/schemas/22_obj_event_customer_created" - }, - { - "$ref": "#/components/schemas/22_obj_event_customer_deleted" - }, - { - "$ref": "#/components/schemas/22_obj_event_customer_rewarded" - }, - { - "$ref": "#/components/schemas/22_obj_event_customer_rewarded_loyalty_points" - }, - { - "$ref": "#/components/schemas/22_obj_event_customer_consents_given" - }, - { - "$ref": "#/components/schemas/22_obj_event_customer_consents_revoked" - } - ] - }, - "22_obj_event_redemption_succeeded": { - "title": "Redemption Succeeded", - "description": "Event data object schema for `redemption.succeeded`.", - "type": "object" - }, - "22_obj_event_redemption_failed": { - "title": "Redemption Failed", - "description": "Event data object schema for `redemption.failed`.", - "type": "object" - }, - "22_obj_event_redemption_rollback_failed": { - "title": "Redemption Rollback Failed", - "description": "Event data object schema for `redemption.rollback.failed`.", - "type": "object" - }, - "22_obj_event_redemption_rollback_succeeded": { - "title": "Redemption Rollback Succeeded", - "description": "Event data object schema for `redemption.rollback.succeeded`.", - "type": "object" - }, - "22_obj_event_publication_succeeded": { - "title": "Publication Succeeded", - "description": "Event data object schema for `publication.succeeded`.", - "type": "object" - }, - "22_obj_event_voucher_published": { - "title": "Voucher Published", - "description": "Event data object schema for `voucher.published`.", - "type": "object" - }, - "22_obj_event_voucher_updated": { - "title": "Voucher Updated", - "description": "Event data object schema for `voucher.updated`.", - "type": "object" - }, - "22_obj_event_voucher_deleted": { - "title": "Voucher Deleted", - "description": "Event data object schema for `voucher.deleted`.", - "type": "object" - }, - "22_obj_event_voucher_created": { - "title": "Voucher Created", - "description": "Event data object schema for `voucher.created`.", - "type": "object" - }, - "22_obj_event_voucher_enabled": { - "title": "Voucher Enabled", - "description": "Event data object schema for `voucher.enabled`.", - "type": "object" - }, - "22_obj_event_voucher_disabled": { - "title": "Voucher Disabled", - "description": "Event data object schema for `voucher.disabled`.", - "type": "object" - }, - "22_obj_event_voucher_loyalty_card_points_added": { - "title": "Voucher Loyalty Card Points Added", - "description": "Event data object schema for `voucher.loyalty_card.points_added`.", - "type": "object", - "properties": { - "object": { - "$ref": "#/components/schemas/1_obj_voucher_object" - }, - "related_object": { - "$ref": "#/components/schemas/8_res_add_remove_points_balance" - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object" - } - } - }, - "22_obj_event_voucher_gift_balance_added": { - "title": "Voucher Gift Balance Added", - "description": "Event data object schema for `voucher.gift.balance_added`.", - "type": "object" - }, - "22_obj_event_campaign_enabled": { - "title": "Campaign Enabled", - "description": "Event data object schema for `campaign.enabled`.", - "type": "object" - }, - "22_obj_event_campaign_deleted": { - "title": "Campaign Deleted", - "description": "Event data object schema for `campaign.deleted`.", - "type": "object", - "properties": { - "object": { - "$ref": "#/components/schemas/2_obj_campaign_object" - }, - "campaign": { - "$ref": "#/components/schemas/2_obj_campaign_object" - } - } - }, - "22_obj_event_campaign_created": { - "title": "Campaign Created", - "description": "Event data object schema for `campaign.created`.", - "type": "object" - }, - "22_obj_event_campaign_updated": { - "title": "Campaign Updated", - "description": "Event data object schema for `campaign.updated`.", - "type": "object" - }, - "22_obj_event_campaign_disabled": { - "title": "Campaign Disabled", - "description": "Event data object schema for `campaign.disabled`.", - "type": "object" - }, - "22_obj_event_campaign_vouchers_generation_completed": { - "title": "Campaign Vouchers Generation Completed", - "description": "Event data object schema for `campaign.vouchers.generation.completed`.", - "type": "object" - }, - "22_obj_event_business_validation_rule_assignment_created": { - "title": "Business Validation Rule Assignment Created", - "description": "Event data object schema for `business_validation_rule.assignment.created`.", - "type": "object" - }, - "22_obj_event_business_validation_rule_assignment_deleted": { - "title": "Business Validation Rule Assignment Deleted", - "description": "Event data object schema for `business_validation_rule.assignment.deleted`.", - "type": "object" - }, - "22_obj_event_business_validation_rule_created": { - "title": "Business Validation Rule Created", - "description": "Event data object schema for `business_validation_rule.created`.", - "type": "object" - }, - "22_obj_event_business_validation_rule_deleted": { - "title": "Business Validation Rule Deleted", - "description": "Event data object schema for `business_validation_rule.deleted`.", - "type": "object" - }, - "22_obj_event_business_validation_rule_updated": { - "title": "Business Validation Rule Updated", - "description": "Event data object schema for `business_validation_rule.updated`.", - "type": "object" - }, - "22_obj_event_customer_created": { - "title": "Customer Created", - "description": "Event data object schema for `customer.created`.", - "type": "object" - }, - "22_obj_event_customer_deleted": { - "title": "Customer Deleted", - "description": "Event data object schema for `customer.deleted`.", - "type": "object" - }, - "22_obj_event_customer_rewarded": { - "title": "Customer Rewarded", - "description": "Event data object schema for `customer.rewarded`.", - "type": "object" - }, - "22_obj_event_customer_rewarded_loyalty_points": { - "title": "Customer Rewarded Loyalty Points", - "description": "Event data object schema for `customer.rewarded.loyalty_points`.", - "type": "object", - "properties": { - "object": { - "$ref": "#/components/schemas/9_obj_customer_object" - }, - "related_object": { - "$ref": "#/components/schemas/8_res_add_remove_points_balance" - }, - "customer": { - "$ref": "#/components/schemas/9_obj_customer_object" - }, - "voucher": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "code": { - "type": "string" - }, - "loyalty_card": { - "type": "object", - "properties": { - "points": { - "type": "integer" - }, - "balance": { - "type": "integer" - } - } - }, - "type": { - "type": "string", - "default": "LOYALTY_CARD" - }, - "campaign": { - "type": "string" - }, - "campaign_id": { - "type": "string" - }, - "is_referral_code": { - "type": "boolean" - }, - "holder_id": { - "type": "string", - "example": "cust_o3ffuQSwM0vlxeJJoMqiOLMI" - } - } - }, - "campaign": { - "type": "string" - }, - "earning_rule": { - "$ref": "#/components/schemas/8_obj_earning_rule_object" - } - } - }, - "22_obj_event_customer_consents_revoked": { - "title": "Customer Consents Revoked", - "description": "Event data object schema for `customer.consents.revoked`.", - "type": "object" - }, - "22_obj_event_customer_consents_given": { - "title": "Customer Consents Given", - "description": "Event data object schema for `customer.consents.given`.", - "type": "object" - }, - "9_obj_customer_activity_object": { - "type": "object", - "title": "Customer Activity Object", - "description": "This is an object representing customer activity. \n\nThis is a general object which presents moments from customers' activity. There are all types of different events that customers perform during their journey once they participate in Promotions. Events describe moments when customers redeem coupons and earn points or rewards. The list of all types of activities is listed below.\n\nThe details describing the activity are collected in a property named `data`. In this object, software integrators will find all further information explaining the event context. \n\nCustomer Activity Object is a type of [Event](ref:track-custom-event) which is our way of letting you know when something interesting happens in your project. When an interesting event concerning an individual customer occurs, we create a new Customer Activity object. For example, when a code is published to a customer, we create a `customer.publication.succeeded` event.\n\n| **Event types (definition in progress)** |\n|:---|\n| customer.confirmed |\n| customer.created |\n| customer.updated |\n| customer.deleted |\n| customer.referred |\n| customer.custom_event |\n| customer.segment.entered |\n| customer.segment.left |\n| customer.sms.sent |\n| customer.sms.failed |\n| customer.email.sent |\n| customer.email.failed |\n| customer.activecampaign.sent |\n| customer.activecampaign.failed |\n| customer.braze.sent |\n| customer.braze.failed |\n| customer.mailchimp.sent |\n| customer.mailchimp.failed |\n| customer.intercom.sent |\n| customer.intercom.failed |\n| customer.rewarded |\n| customer.rewarded.loyalty_points |\n| customer.voucher.gift.balance_added |\n| customer.voucher.loyalty_card.points_added |\n| customer.voucher.loyalty_card.points_transferred |\n| customer.publication.succeeded |\n| customer.publication.failed |\n| customer.redemption.succeeded |\n| customer.redemption.failed |\n| customer.redemption.rollback.succeeded |\n| customer.redemption.rollback.failed |\n| customer.consents.given |\n| customer.consents.revoked |", - "x-tags": [ - "CUSTOMERS API" - ], - "properties": { - "id": { - "type": "string", - "description": "Unique event ID, assigned by Voucherify.", - "example": "evcus_0c150c51730c6b60b1" - }, - "type": { - "type": "string", - "description": "Event type.", - "enum": [ - "customer.confirmed", - "customer.created", - "customer.updated", - "customer.deleted", - "customer.referred", - "customer.custom_event", - "customer.segment_entered", - "customer.segment.left", - "customer.sms.sent", - "customer.sms.failed", - "customer.email.sent", - "customer.email.failed", - "customer.activecampaign.sent", - "customer.braze.sent", - "customer.mailchimp.sent", - "customer.intercom.sent", - "customer.intercom.failed", - "customer.rewarded", - "customer.rewarded.loyalty_points", - "customer.voucher.gift.balance_added", - "customer.voucher.loyalty_card.points_added", - "customer.voucher.loyalty_card.points_transferred", - "customer.publication.succeeded", - "customer.publication.failed", - "customer.redemption.succeeded", - "customer.redemption.failed", - "customer.redemption.rollback.succeeded", - "customer.redemption.rollback.failed", - "customer.consents.given", - "customer.consents.revoked" - ] - }, - "data": { - "type": "array", - "description": "Contains details about the event. The objects that are returned in the data attribute differ based on the context of the event type.", - "items": { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data" - } - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the customer activity occurred in ISO 8601 format.", - "example": "2022-08-30T09:14:07.660Z", - "format": "date-time" - } - } - }, - "9_obj_customer_activity_object_data": { - "title": "Customer Activity Data Object", - "description": "Event data object schema.", - "anyOf": [ - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_confirmed" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_created" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_updated" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_deleted" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_referred" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_custom_event" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_segment_entered" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_segment_left" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_sms_sent" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_sms_failed" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_email_sent" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_email_failed" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_activecampaign_sent" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_activecampaign_failed" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_braze_sent" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_braze_failed" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_mailchimp_sent" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_mailchimp_failed" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_intercom_sent" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_intercom_failed" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_rewarded" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_rewarded_loyalty_points" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_voucher_gift_voucher_balance_added" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_voucher_loyalty_card_points_added" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_voucher_loyalty_card_points_transferred" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_publication_succeeded" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_publication_failed" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_redemption_succeeded" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_redemption_failed" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_redemption_rollback_succeeded" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_redemption_rollback_failed" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_consents_given" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_consents_revoked" - } - ] - }, - "9_obj_customer_activity_object_data_customer_email_unsubscribed": { - "title": "Email Unsubscribed", - "description": "Email unsubscribed", - "type": "object", - "properties": { - "email_unsubscribed": { - "type": "boolean" - } - } - }, - "9_obj_customer_activity_object_data_customer_confirmed": { - "title": "Customer Confirmed", - "description": "Event data object schema for `customer.confirmed`.", - "type": "object", - "properties": { - "customer": { - "$ref": "#/components/schemas/9_obj_customer_object_email_parameter" - }, - "unconfirmed_customer": { - "type": "string", - "example": "ucust_1qa70mVfYkl11Ab0ZxDPdWNa" - } - } - }, - "9_obj_customer_activity_object_data_customer_created": { - "title": "Customer Created", - "description": "Event data object schema for `customer.created`.", - "type": "object", - "properties": { - "customer": { - "$ref": "#/components/schemas/9_obj_customer_object_email_parameter" - } - } - }, - "9_obj_customer_activity_object_data_customer_updated": { - "title": "Customer Updated", - "description": "Event data object schema for `customer.updated`.", - "type": "object", - "properties": { - "customer": { - "$ref": "#/components/schemas/9_obj_customer_object_email_parameter" - } - } - }, - "9_obj_customer_activity_object_data_customer_deleted": { - "title": "Customer Deleted", - "description": "Event data object schema for `customer.deleted`.", - "type": "object", - "properties": { - "customer": { - "$ref": "#/components/schemas/9_obj_customer_object_email_parameter" - } - } - }, - "9_obj_customer_activity_object_data_customer_referred": { - "title": "Customer Referred", - "description": "Event data object schema for `customer.referred`.", - "type": "object", - "properties": { - "voucher": { - "type": "object" - }, - "campaign": { - "type": "object" - }, - "customer": { - "type": "object" - }, - "referrer": { - "type": "object" - }, - "redemption": { - "type": "object" - }, - "custom_event": { - "type": "object" - } - } - }, - "9_obj_customer_activity_object_data_customer_custom_event": { - "title": "Custom Event", - "description": "Event data object schema for `customer.custom_event`.", - "type": "object", - "properties": { - "event": { - "type": "object" - }, - "loyalty": { - "type": "object" - }, - "customer": { - "type": "object" - }, - "referral": { - "type": "object" - }, - "event_schema": { - "type": "object" - } - } - }, - "9_obj_customer_activity_object_data_customer_segment_entered": { - "title": "Segment Entered", - "description": "Event data object schema for `customer.segment.entered`.", - "type": "object", - "properties": { - "segment": { - "type": "object" - }, - "customer": { - "type": "object" - } - } - }, - "9_obj_customer_activity_object_data_customer_segment_left": { - "title": "Segment Left", - "description": "Event data object schema for `customer.segment.left`.", - "type": "object", - "properties": { - "segment": { - "type": "object" - }, - "customer": { - "type": "object" - } - } - }, - "9_obj_customer_activity_object_data_customer_sms_sent": { - "title": "SMS Sent", - "description": "Event data object schema for `customer.sms.sent`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_sms_failed": { - "title": "SMS Failed", - "description": "Event data object schema for `customer.sms.failed`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_email_sent": { - "title": "Email Sent", - "description": "Event data object schema for `customer.email.sent`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_email_failed": { - "title": "Email Failed", - "description": "Event data object schema for `customer.email.failed`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_activecampaign_sent": { - "title": "ActiveCampaign Sent", - "description": "Event data object schema for `customer.activecampaign.sent`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_activecampaign_failed": { - "title": "ActiveCampaign Failed", - "description": "Event data object schema for `customer.activecampaign.failed`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_braze_sent": { - "title": "Braze Sent", - "description": "Event data object schema for `customer.braze.sent`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_braze_failed": { - "title": "Braze Failed", - "description": "Event data object schema for `customer.braze.failed`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_mailchimp_sent": { - "title": "Mailchimp Sent", - "description": "Event data object schema for `customer.mailchimp.sent`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_mailchimp_failed": { - "title": "Mailchimp Failed", - "description": "Event data object schema for `customer.mailchimp.failed`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_intercom_sent": { - "title": "Intercom Sent", - "description": "Event data object schema for `customer.intercom.sent`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_intercom_failed": { - "title": "Intercom Failed", - "description": "Event data object schema for `customer.intercom.failed`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_rewarded": { - "title": "Customer Rewarded", - "description": "Event data object schema for `customer.rewarded`.", - "type": "object", - "properties": { - "holder": { - "type": "object" - }, - "reward": { - "type": "object" - }, - "balance": { - "type": "object" - }, - "voucher": { - "type": "object" - }, - "campaign": { - "type": "object" - }, - "customer": { - "type": "object" - }, - "redemption": { - "type": "object" - }, - "custom_event": { - "type": "object" - }, - "referral_tier": { - "type": "object" - }, - "customer_event": { - "type": "object" - } - } - }, - "9_obj_customer_activity_object_data_customer_rewarded_loyalty_points": { - "title": "Customer Rewarded Loyalty Points", - "description": "Event data object schema for `customer.rewarded.loyalty_points`.", - "type": "object", - "properties": { - "order": { - "type": "object" - }, - "holder": { - "type": "object" - }, - "balance": { - "type": "object" - }, - "voucher": { - "type": "object" - }, - "campaign": { - "type": "object" - }, - "customer": { - "type": "object" - }, - "earning_rule": { - "type": "object" - }, - "loyalty_tier": { - "type": "object" - } - } - }, - "9_obj_customer_activity_object_data_customer_voucher_gift_voucher_balance_added": { - "title": "Gift Voucher Balance Added", - "description": "Event data object schema for `customer.voucher.gift.balance_added`.", - "type": "object", - "properties": { - "balance": { - "type": "object" - }, - "voucher": { - "type": "object" - }, - "campaign": { - "type": "object" - }, - "customer": { - "type": "object" - } - } - }, - "9_obj_customer_activity_object_data_customer_voucher_loyalty_card_points_added": { - "title": "Loyalty Card Points Added", - "description": "Event data object schema for `customer.voucher.loyalty_card.points_added`.", - "type": "object", - "properties": { - "balance": { - "type": "object" - }, - "voucher": { - "type": "object" - }, - "campaign": { - "type": "object" - }, - "customer": { - "type": "object" - } - } - }, - "9_obj_customer_activity_object_data_customer_voucher_loyalty_card_points_transferred": { - "title": "Loyalty Card Points Transferred", - "description": "Event data object schema for `customer.voucher.loyalty_card.points_transferred`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_publication_succeeded": { - "title": "Publication Succeeded", - "description": "Event data object schema for `customer.publication.succeeded`.", - "type": "object", - "properties": { - "campaign": { - "type": "object" - }, - "customer": { - "type": "object" - }, - "publication": { - "type": "object" - } - } - }, - "9_obj_customer_activity_object_data_customer_publication_failed": { - "title": "Publication Failed", - "description": "Event data object schema for `customer.publication.failed`.", - "type": "object", - "properties": { - "campaign": { - "type": "object" - }, - "customer": { - "type": "object" - }, - "publication": { - "type": "object" - } - } - }, - "9_obj_customer_activity_object_data_customer_redemption_succeeded": { - "title": "Redemption Succeeded", - "description": "Event data object schema for `customer.redemption.succeeded`.", - "type": "object", - "properties": { - "order": { - "type": "object" - }, - "holder": { - "type": "object" - }, - "voucher": { - "type": "object" - }, - "campaign": { - "type": "object" - }, - "customer": { - "type": "object" - }, - "redemption": { - "type": "object" - }, - "promotion_tier": { - "type": "object" - } - } - }, - "9_obj_customer_activity_object_data_customer_redemption_failed": { - "title": "Redemption Succeeded", - "description": "Event data object schema for `customer.redemption.failed`.", - "type": "object", - "properties": { - "order": { - "type": "object" - }, - "holder": { - "type": "object" - }, - "voucher": { - "type": "object" - }, - "campaign": { - "type": "object" - }, - "customer": { - "type": "object" - }, - "redemption": { - "type": "object" - }, - "promotion_tier": { - "type": "object" - } - } - }, - "9_obj_customer_activity_object_data_customer_redemption_rollback_succeeded": { - "title": "Redemption Rollback Succeeded", - "description": "Event data object schema for `customer.redemption.rollback.succeeded`.", - "type": "object", - "properties": { - "order": { - "type": "object" - }, - "holder": { - "type": "object" - }, - "voucher": { - "type": "object" - }, - "campaign": { - "type": "object" - }, - "customer": { - "type": "object" - }, - "redemption": { - "type": "object" - }, - "promotion_tier": { - "type": "object" - }, - "redemption_rollback": { - "type": "object" - } - } - }, - "9_obj_customer_activity_object_data_customer_redemption_rollback_failed": { - "title": "Redemption Rollback Failed", - "description": "Event data object schema for `customer.redemption.rollback.failed`.", - "type": "object", - "properties": { - "order": { - "type": "object" - }, - "holder": { - "type": "object" - }, - "campaign": { - "type": "object" - }, - "customer": { - "type": "object" - }, - "redemption": { - "type": "object" - }, - "promotion_tier": { - "type": "object" - }, - "redemption_rollback": { - "type": "object" - } - } - }, - "9_obj_customer_activity_object_data_customer_consents_given": { - "title": "Consents Given", - "description": "Event data object schema for `customer.consents.given`.", - "type": "object", - "properties": { - "consents": { - "type": "object" - }, - "customer": { - "type": "object" - } - } - }, - "9_obj_customer_activity_object_data_customer_consents_revoked": { - "title": "Consents Given", - "description": "Event data object schema for `customer.consents.revoked`.", - "type": "object", - "properties": { - "consents": { - "type": "object" - }, - "customer": { - "type": "object" - } - } - }, - "customers_permanent_deletion_response_body": { - "type": "object", - "title": "Customer Permanent Deletion Response Body", - "description": "Response body schema for `/customers/{customerId}/permanent-deletion`.", - "properties": { - "id": { - "type": "string", - "description": "Unique permanent deletion object ID.", - "example": "del_mgzqZNwUnwnt1Ddw6phEG90Q" - }, - "created_at": { - "type": "string", - "example": "2022-09-02T17:55:47.865Z", - "description": "Timestamp representing the date and time when the customer was requested to be deleted in ISO 8601 format.", - "format": "date-time" - }, - "related_object_id": { - "type": "string", - "example": "cust_m557pDDl4IGXexkU6KOQ2Dwi", - "description": "Unique customer ID that is being deleted." - }, - "related_object": { - "type": "string", - "description": "Object being deleted.", - "default": "customer" - }, - "status": { - "type": "string", - "description": "Deletion status.", - "default": "DONE" - }, - "data_json": { - "type": "object", - "description": "Statistics summarizing the number of related information that was deleted.", - "required": [ - "events", - "customer_events", - "daily_events", - "segments", - "orders", - "order_events", - "customer" - ], - "properties": { - "events": { - "type": "integer", - "description": "Number of events deleted." - }, - "customer_events": { - "type": "integer", - "description": "Number of customer events deleted." - }, - "daily_events": { - "type": "integer", - "description": "Number of daily events deleted." - }, - "segments": { - "type": "integer", - "description": "Number of segments deleted." - }, - "orders": { - "type": "integer", - "description": "Number of orders deleted." - }, - "order_events": { - "type": "integer", - "description": "Number of order events deleted." - }, - "customer": { - "type": "integer", - "description": "Number of customers deleted.", - "default": 1 - } - } - }, - "object": { - "type": "string", - "description": "The type of object represented by JSON.", - "default": "pernament_deletion" - } - }, - "required": [ - "id", - "created_at", - "related_object_id", - "related_object", - "status", - "data_json", - "object" - ] - }, - "customers_update_metadata_in_bulk_request_body": { - "type": "object", - "title": "Update Customers' Metadata in bulk Request Body", - "description": "Request body schema for `/customers/metadata/async`.", - "properties": { - "source_ids": { - "type": "array", - "description": "An array of customer `source_id`'s.", - "items": { - "type": "string" - } - }, - "metadata": { - "type": "object", - "description": "Metadata key value pairs to be updated. A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments." - } - }, - "required": [ - "source_ids", - "metadata" - ] - }, - "customers_update_in_bulk_request_body": { - "type": "array", - "title": "Update Customers in bulk Request Body", - "description": "Request body schema for `/customers/bulk/async`.", - "items": { - "$ref": "#/components/schemas/customers_update_in_bulk_item_request_body" - } - }, - "customers_update_in_bulk_item_request_body": { - "title": "Update Customers in bulk Request Body", - "description": "Request body schema for `/customers/bulk/async`.", - "properties": { - "source_id": { - "type": "string", - "description": "Unique customer source ID." - }, - "name": { - "type": [ - "string", - "null" - ], - "description": "Customer's first and last name." - }, - "description": { - "type": [ - "string", - "null" - ], - "description": "An arbitrary string that you can attach to a customer object." - }, - "email": { - "type": [ - "string", - "null" - ], - "description": "Customer's email address." - }, - "phone": { - "type": [ - "string", - "null" - ], - "description": "Customer's phone number." - }, - "address": { - "type": "object", - "description": "Customer's address.", - "properties": { - "city": { - "type": [ - "string", - "null" - ], - "description": "City" - }, - "state": { - "type": [ - "string", - "null" - ], - "description": "State" - }, - "line_1": { - "type": [ - "string", - "null" - ], - "description": "First line of address." - }, - "line_2": { - "type": [ - "string", - "null" - ], - "description": "Second line of address." - }, - "country": { - "type": [ - "string", - "null" - ], - "description": "Country." - }, - "postal_code": { - "type": [ - "string", - "null" - ], - "description": "Postal code." - } - } - }, - "birthdate": { - "type": [ - "string", - "null" - ], - "description": "Customer's birthdate; format `YYYY-MM-DD`." - }, - "metadata": { - "type": [ - "object", - "null" - ], - "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. " - } - }, - "required": [ - "source_id" - ] - }, - "9_req_update_customers_consents": { - "type": "object", - "title": "Update Customer Consents Request Body", - "description": "Request body schema for **PUT** `/customers/{customerId}/consents`.", - "properties": { - "consent_id": { - "type": "boolean", - "description": "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." - }, - "unsubscribed": { - "type": "boolean", - "description": "To deny all consents, use `unsubscribed` as a consent identifier and `true` as a value." - } - } - }, - "10_obj_order_object": { - "type": "object", - "title": "Order object", - "description": "This is an object representing an order. \n\nThe purchase transactions can be tracked in Voucherify by the creation of an order object. You can create, retrieve, and pay individual orders, as well as list and export all of them in a CSV format. Orders are identified by a unique ID.\n\nOrders are automatically created during the [redeem voucher](ref:redeem-voucher) and [redeem promotion](redeem-promotion) call.\n\n\n> #### order.id and order session\n>\n> If you use the same order.id in more than one redemption request, all valid discounts provided in the redemption payload will be applied to the given order.\n> \n> Each time you use particular order in your requests, the API will automatically trigger a new session linked to the order.id. The session is active during the request and ends asynchronously after the request is completed. The session mechanism ensures that the particular order.id can be used in one API request at once.", - "x-tags": [ - "ORDERS API" - ], - "properties": { - "id": { - "type": "string", - "description": "Unique order ID, assigned by Voucherify.", - "example": "ord_GFDbbv2I0wnO0sFUBOOOXPj2" - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the order was created in ISO 8601 format.", - "example": "2022-03-09T11:19:04.819Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "example": "2022-08-12T13:34:10.681Z", - "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format.", - "format": "date-time" - }, - "status": { - "type": "string", - "description": "Order status.", - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULFILLED" - ] - }, - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "discount_amount": { - "type": "integer", - "description": "Sum of all order-level discounts applied to the order." - }, - "items_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" - }, - "total_discount_amount": { - "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`\t" - }, - "total_amount": { - "type": "integer", - "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", - "items": { - "type": "object", - "properties": { - "object": { - "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." - }, - "product_id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "sku_id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." - }, - "discount_amount": { - "type": "integer", - "description": "The item-level discount applied to the item." - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" - }, - "product": { - "type": "object", - "description": "This object stores more information about the related product.", - "properties": { - "id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" - }, - "name": { - "type": "string", - "example": "Brewing System", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - }, - "sku": { - "type": "object", - "description": "This object stores more information about the related SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." - }, - "sku": { - "type": "string", - "description": "SKU name." - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - } - } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are attached to an order object. Stores additional information about the order in a structured format." - }, - "customer": { - "type": "object", - "description": "Object containing information about the customer that is making the purchase.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique customer ID of the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `customer` object." - } - } - }, - "referrer": { - "type": "object", - "description": "Object containing information about the referrer.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique referrer ID, who referred the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the referrer object." - } - } - }, - "customer_id": { - "type": "string", - "description": "Unique customer ID of the customer making the purchase.", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" - }, - "referrer_id": { - "type": "string", - "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "description": "Unique referrer ID." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - }, - "redemptions": { - "oneOf": [ - { - "$ref": "#/components/schemas/10_obj_order_object_unstacked_redemptions" - }, - { - "$ref": "#/components/schemas/10_obj_order_object_stacked_redemptions" - } - ] - } - } - }, - "10_obj_order_object_no_discount_calculations": { - "type": "object", - "title": "Order object", - "description": "This is an object representing an order.", - "properties": { - "id": { - "type": "string", - "description": "Unique order ID, assigned by Voucherify.", - "example": "ord_GFDbbv2I0wnO0sFUBOOOXPj2" - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the order was created in ISO 8601 format.", - "example": "2022-03-09T11:19:04.819Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "example": "2022-08-12T13:34:10.681Z", - "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format.", - "format": "date-time" - }, - "status": { - "type": "string", - "description": "Order status.", - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULFILLED" - ] - }, - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "total_amount": { - "type": "integer", - "description": "Order amount after applying all the discounts." - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", - "items": { - "type": "object", - "properties": { - "object": { - "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." - }, - "product_id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "sku_id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique identifier that represents the product or SKU from your inventory system." - }, - "related_object": { - "type": "string", - "description": "Reference to the object containing details of the related product. This can either be a `product` or `sku`.", - "enum": [ - "product", - "sku" - ] - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`." - }, - "product": { - "type": "object", - "description": "This object stores more information about the related product.", - "properties": { - "id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" - }, - "name": { - "type": "string", - "example": "Brewing System", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } + }, + "event": { + "type": "string", + "enum": [ + "custom_event_defined_in_EVENT_SCHEMA" + ], + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `custom_event_name` the name of a custom event defined in the Dashboard → **Project Settings** → **EVENT SCHEMA** → **Add event definition**. Read more on defining [custom events](https://support.voucherify.io/article/111-custom-events). " + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + }, + "object_id": { + "type": "string", + "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "description": "A unique campaign identifier assigned by the Voucherify API." + }, + "object_type": { + "type": "string", + "default": "campaign", + "description": "Defines the object associated with the earning rule. Defaults to `campaign`." + } } }, - "sku": { - "type": "object", - "description": "This object stores more information about the related SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." - }, - "sku": { - "type": "string", - "description": "SKU name." - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - } - } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are attached to an order object. Stores additional information about the order in a structured format." - }, - "customer": { - "type": "object", - "description": "Object containing information about the customer that is making the purchase.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique customer ID of the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `customer` object." - } - } - }, - "referrer": { - "type": "object", - "description": "Object containing information about the referrer.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique referrer ID, who referred the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the referrer object." - } - } - }, - "customer_id": { - "type": "string", - "description": "Unique customer ID of the customer making the purchase.", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" - }, - "referrer_id": { - "type": "string", - "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "description": "Unique referrer ID." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - } - } - }, - "10_obj_order_object_unstacked_redemptions": { - "type": "object", - "title": "Unstacked Redemption", - "description": "Redemption object representing a single redemption.", - "properties": { - "redemption_ID": { - "type": "object", - "description": "The property name is the unique redemption ID; i.e. `r_0ba186c4824e4881e1`. This object contains information about the redemption of an incentive.", - "properties": { - "date": { - "type": "string", - "description": "Timestamp representing the date and time when the redemption was created in ISO 8601 format.", - "example": "2022-09-02T17:06:56.649Z", - "format": "date-time" - }, - "related_object_type": { - "type": "string", - "description": "The source of the incentive.", - "enum": [ - "voucher", - "promotion_tier" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique ID of the related object that defines the incentive." - }, - "related_object_parent_id": { - "type": "string", - "description": "Represent's the campaign ID of the voucher if the redemption was based on a voucher that was part of bulk codes generated within a campaign. In case of a promotion tier, this represents the campaign ID of the promotion tier's parent campaign." - } - } - } - } - }, - "10_obj_order_object_stacked_redemptions": { - "type": "object", - "title": "Stacked Redemption", - "description": "Redemption object representing a stacked redemption.", - "properties": { - "redemption_ID": { - "type": "object", - "description": "The property name is the unique parent redemption ID; i.e. `r_0ba186c4824e4881e1`. This object contains information about the redemption of multiple incentives.", - "properties": { - "date": { - "type": "string", - "description": "Timestamp representing the date and time when the redemption was created in ISO 8601 format.", - "example": "2022-09-02T17:06:56.649Z", - "format": "date-time" - }, - "related_object_type": { - "type": "string", - "description": "The source of the incentive.", - "default": "redemption" - }, - "related_object_id": { - "type": "string", - "description": "Unique ID of the parent redemption.", - "example": "r_0ba186c4824e4881e1" - }, - "stacked": { - "type": "array", - "description": "Contains a list of unique IDs of child redemptions, which belong to the stacked incentives.", - "items": { - "type": "string" - } - } - } - } - } - }, - "10_res_list_orders": { - "type": "object", - "title": "List Orders Response Body", - "description": "Response body schema representing **GET** `/orders`.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about orders in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "orders", - "description": "Identifies the name of the attribute that contains the array of order objects." - }, - "orders": { - "type": "array", - "description": "Contains array of order objects.", - "items": { - "$ref": "#/components/schemas/10_obj_order_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of orders." - } - } - }, - "10_req_create_order": { - "type": "object", - "title": "Order", - "description": "Request body schema for creating an order.", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of an integration between multiple systems. It can be an order ID from a CRM system, database or 3rd-party service." - }, - "status": { - "type": "string", - "description": "The order status.", - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULLFILLED" - ] - }, - "amount": { - "type": "integer", - "description": "A positive integer in the smallest currency unit (that is, 100 cents for $1.00) representing the total amount of the order; this is the sum of the order items' amounts." - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format." - }, - "customer": { - "$ref": "#/components/schemas/10_req_orders_customer_object" - }, - "referrer": { - "$ref": "#/components/schemas/10_req_orders_referrer_object" - }, - "items": { - "$ref": "#/components/schemas/10_req_orders_items_array" - } - } - }, - "10_req_update_order": { - "type": "object", - "title": "Update Order Request Body", - "description": "Request body schema for **PUT** `/orders/{orderId}`.", - "properties": { - "status": { - "type": "string", - "description": "The order status.", - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULLFILLED" - ] - }, - "amount": { - "type": "integer", - "description": "A positive integer in the smallest currency unit (that is, 100 cents for $1.00) representing the total amount of the order; this is the sum of the order items' amounts." - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format." - }, - "customer": { - "$ref": "#/components/schemas/10_req_orders_customer_object" - }, - "referrer": { - "$ref": "#/components/schemas/10_req_orders_referrer_object" - }, - "items": { - "$ref": "#/components/schemas/10_req_orders_items_array" - }, - "customer_id": { - "type": "string", - "example": "cust_T849EgzNVVmn5icJ2FAkT2rO", - "description": "Unique customer ID of the customer making the purchase." - }, - "referrer_id": { - "type": "string", - "example": "cust_T849EgzNVVmn5icJ2FAkT2rO", - "description": "Unique referrer ID." - } - } - }, - "10_req_create_order_export": { - "type": "object", - "title": "Create Order Export Request Body", - "description": "Request body schema for **POST** `/orders/export`.", - "properties": { - "parameters": { - "$ref": "#/components/schemas/16_obj_export_order", - "description": "Contains the parameters that define the data to be exported." - } - } - }, - "10_req_orders_import": { - "type": "array", - "title": "Import Orders Request Body", - "description": "Request body schema for POST `/orders/import`.", - "items": { - "type": "object", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of an integration between multiple systems. It can be an order ID from a CRM system, database or 3rd-party service." - }, - "status": { - "type": "string", - "description": "The order status. One of `CREATED`, `PAID`, `CANCELED`, `FULFILLED`." - }, - "amount": { - "type": "integer", - "description": "A positive integer in the smallest currency unit (that is, 100 cents for $1.00) representing the total amount of the order; this is the sum of the order items' amounts." - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format." - }, - "customer": { - "$ref": "#/components/schemas/10_req_orders_customer_object" - }, - "referrer": { - "$ref": "#/components/schemas/10_req_orders_referrer_object" - }, - "items": { - "$ref": "#/components/schemas/10_req_orders_items_array" - } - } - } - }, - "10_req_orders_customer_object": { - "type": "object", - "title": "Customer", - "description": "This is an object containing information about the customer.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of an existing customer that will be linked to the order; this is an ID that has been assigned to the customer by Voucherify, i.e. `cust_LMY4ZylSdUYB1J4tzqNcl5VV`." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a customer object." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "phone": { - "type": "string", - "description": "Customer's phone number." - }, - "address": { - "type": "object", - "description": "Customer's address.", - "properties": { - "city": { - "type": "string", - "description": "City" - }, - "state": { - "type": "string", - "description": "State" - }, - "line_1": { - "type": "string", - "description": "First line of address" - }, - "line_2": { - "type": "string", - "description": "Second line of address" - }, - "country": { - "type": "string", - "description": "Country" - }, - "postal_code": { - "type": "string", - "description": "Postal code" - } - } - }, - "birthdate": { - "type": "string", - "description": "Customer's birthdate; format `YYYY-MM-DD`.", - "format": "date" - }, - "birthday": { - "type": "string", - "description": "Customer's birthdate; format `YYYY-MM-DD`.", - "format": "date" - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to a customer." - } - } - }, - "10_req_orders_referrer_object": { - "type": "object", - "title": "Referrer", - "description": "This is an ojbect containing information about the referrer.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of an existing customer that will be linked to the order as the referrer; this is an ID that has been assigned to the customer by Voucherify, i.e. `cust_LMY4ZylSdUYB1J4tzqNcl5VV`." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "name": { - "type": "string", - "description": "Referrer's first and last name." - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a referrer object." - }, - "email": { - "type": "string", - "description": "Referrer's email address." - }, - "phone": { - "type": "string", - "description": "Referrer's phone number." - }, - "address": { - "type": "object", - "description": "Referrer's address.", - "properties": { - "city": { - "type": "string", - "description": "City" - }, - "state": { - "type": "string", - "description": "State" - }, - "line_1": { - "type": "string", - "description": "First line of address" - }, - "line_2": { - "type": "string", - "description": "Second line of address" - }, - "country": { - "type": "string", - "description": "Country" - }, - "postal_code": { - "type": "string", - "description": "Postal code" - } - } - }, - "birthdate": { - "type": "string", - "description": "Referrer's birthdate; format `YYYY-MM-DD`.", - "format": "date" - }, - "birthday": { - "type": "string", - "description": "Referrer's birthdate; format `YYYY-MM-DD`.", - "format": "date" - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to a referrer." - } - } - }, - "10_req_orders_items_array": { - "type": "array", - "title": "Items Array", - "description": "Array of items applied to the order.", - "items": { - "$ref": "#/components/schemas/10_req_orders_order_item" - } - }, - "10_req_orders_order_item": { - "type": "object", - "title": "Order Item", - "description": "This object represents an order line item.", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s product/SKU ID (if it is different from the Voucherify product/SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service." - }, - "related_object": { - "type": "string", - "description": "Used along with the `source_id` property, can be set to either `sku` or `product`." - }, - "product_id": { - "type": "string", - "description": "A unique product ID assigned by Voucherify.", - "example": "prod_0a7e62db1fca8322a2" - }, - "sku_id": { - "type": "string", - "description": "A unique SKU ID assigned by Voucherify.", - "example": "sku_0a41e31c7b41c28358" - }, - "quantity": { - "type": "integer", - "description": "The quantity of the particular item in the cart." - }, - "price": { - "type": "integer", - "description": "The unit price of the item." - }, - "amount": { - "type": "integer", - "description": "The total amount of the order item (`price` * `quantity`)." - }, - "product": { - "$ref": "#/components/schemas/10_req_orders_order_item_product" - }, - "sku": { - "$ref": "#/components/schemas/10_req_orders_order_item_sku" - } - } - }, - "10_req_orders_order_item_product": { - "type": "object", - "title": "Product", - "description": "An object containing details of the related product.", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s product ID (if it is different than Voucherify's product ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service." - }, - "name": { - "type": "string", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Product price. A positive integer in the smallest currency unit (that is, 100 cents for $1.00)." - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to a product. It can be useful for storing additional information about the product in a structured format." - }, - "override": { - "type": "boolean", - "description": "The override set to true is used to store the product information in the system. If product does not exist, it will be created with the use of `source_id`; if it does exist, the provided values for the `name`, `price`, and `metadata` will replace those already stored in the system." - } - } - }, - "10_req_orders_order_item_sku": { - "type": "object", - "title": "SKU", - "description": "An object containing details of the related SKU.", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s SKU ID (if it is different than Voucherify's SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service." - }, - "sku": { - "type": "string", - "description": "The SKU name." - }, - "price": { - "type": "integer", - "description": "SKU price. A positive integer in the smallest currency unit (that is, 100 cents for $1.00)." - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to an SKU. It can be useful for storing additional information about the SKU in a structured format." - }, - "override": { - "type": "boolean", - "description": "The override is used to store the SKU in the system. If the SKU does not exist, it will be created with the use of `source_id`. Additionally, if the SKU does not exist, you are required to set the parent `product_id` that it belongs to. Set the parent `product_id` one level above, i.e. at the item level. If the parent product does not exist in Voucherify, i.e. does not have a unique `product_id`, then define the product object one level above, i.e. at the item level and make sure to also include the override as `true` for the product." - } - } - }, - "10_obj_order_item_object": { - "title": "Order Item Object", - "type": "object", - "properties": { - "object": { - "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." - }, - "product_id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "sku_id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." - }, - "discount_amount": { - "type": "integer", - "description": "The item-level discount applied to the item." - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" - }, - "product": { - "type": "object", - "description": "This object stores more information about the related product.", - "properties": { - "id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" - }, - "name": { - "type": "string", - "example": "Brewing System", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - }, - "sku": { - "type": "object", - "description": "This object stores more information about the related SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." - }, - "sku": { - "type": "string", - "description": "SKU name." - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - } - }, - "description": "This is an object representing an order item. \n\nOrder Items are always specified within the [order object](ref:get-order). They can be related either to [products](list-products) or [SKUs](ref:list-skus-in-product). \n\nProduct/SKU details sent within an order item will be used on top of Product/SKU already stored in the system during the [Redeem Voucher](ref:redeem-voucher), [Validate Voucher](ref:validate-voucher), [Validate Promotions](ref:validate-promotions) and [Redeem Promotion](ref:redeem-promotion) requests.", - "x-tags": [ - "ORDERS API" - ] - }, - "11_obj_product_object": { - "type": "object", - "description": "This is an object representing a product. \n\nThis entity should be used to map product items from your inventory management system. The aim of products is to build validation rules which reflect product-specific campaigns.", - "title": "Product Object", - "x-tags": [ - "PRODUCTS API" - ], - "properties": { - "id": { - "type": "string", - "description": "Unique product ID assigned by Voucherify.", - "example": "prod_0b1da8105693710357" - }, - "source_id": { - "type": "string", - "example": "productSourceID16", - "description": "Unique product source ID from your inventory system." - }, - "name": { - "type": "string", - "description": "Unique user-defined product name.", - "example": "T-shirt" - }, - "price": { - "type": "integer", - "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "attributes": { - "type": "array", - "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", - "items": { - "type": "string" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." - }, - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", - "example": "https://images.com/original.jpg" - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the product was created in ISO 8601 format.", - "example": "2022-05-23T06:52:55.008Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the product was updated in ISO 8601 format.", - "example": "2022-05-23T09:24:07.405Z", - "format": "date-time" - }, - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about the `product`.", - "default": "product" - }, - "skus": { - "$ref": "#/components/schemas/11_res_get_product_skus_object" - } - } - }, - "11_req_create_product": { - "type": "object", - "description": "Request schema for **POST** `/products`.", - "title": "Create Product Request Body", - "properties": { - "source_id": { - "type": "string", - "example": "productSourceID16", - "description": "Unique product source ID." - }, - "name": { - "type": "string", - "description": "Unique user-defined product name.", - "example": "T-shirt" - }, - "price": { - "type": "integer", - "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "attributes": { - "type": "array", - "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", - "items": { - "type": "string" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." - }, - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", - "example": "https://images.com/original.jpg" - } - } - }, - "11_req_update_products_metadata_in_bulk": { - "type": "object", - "description": "Request schema for **POST** `/products/metadata/async`.", - "title": "Update Products' Metadata in Bulk Request Body", - "properties": { - "source_ids": { - "type": "array", - "description": "Array of unique product source IDs.", - "items": { - "type": "string" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." - } - }, - "required": [ - "source_ids", - "metadata" - ] - }, - "11_req_update_product": { - "type": "object", - "description": "Request schema for **PUT** `/products/{productId}`.", - "title": "Update Product Request Body", - "properties": { - "name": { - "type": "string", - "description": "Unique user-defined product name.", - "example": "T-shirt" - }, - "price": { - "type": "integer", - "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "attributes": { - "type": "array", - "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", - "items": { - "type": "string" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." - }, - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", - "example": "https://images.com/original.jpg" - } - } - }, - "11_req_update_product_bulk": { - "type": "object", - "description": "Request schema for **POST** `/products/bulk/async`.", - "title": "Update Product Request Body", - "properties": { - "source_id": { - "type": "string", - "description": "Unique product source ID from your inventory system.", - "example": "test_prod_id_1" - }, - "name": { - "type": "string", - "description": "Unique user-defined product name.", - "example": "T-shirt" - }, - "price": { - "type": "integer", - "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "attributes": { - "type": "array", - "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", - "items": { - "type": "string" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." - }, - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", - "example": "https://images.com/original.jpg" - } - } - }, - "11_res_list_products": { - "type": "object", - "description": "Response body schema representing **GET** `/products`.", - "title": "Product Object", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about products in a dictionary.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of product objects.", - "default": "products" - }, - "products": { - "type": "array", - "description": "Contains array of product objects.", - "items": { - "$ref": "#/components/schemas/11_obj_list_products_product_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of product objects." - } - } - }, - "11_obj_list_products_product_object": { - "type": "object", - "description": "This is an object representing a product. \n\nThis entity should be used to map product items from your inventory management system. The aim of products is to build which reflect product-specific campaigns.", - "title": "Product Object", - "properties": { - "id": { - "type": "string", - "description": "Unique product ID assigned by Voucherify.", - "example": "prod_0b1da8105693710357" - }, - "source_id": { - "type": "string", - "example": "productSourceID16", - "description": "Unique product source ID." - }, - "name": { - "type": "string", - "description": "Unique user-defined product name.", - "example": "T-shirt" - }, - "price": { - "type": "integer", - "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "attributes": { - "type": "array", - "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", - "items": { - "type": "string" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." - }, - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", - "example": "https://images.com/original.jpg" - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the product was created in ISO 8601 format.", - "example": "2022-05-23T06:52:55.008Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the product was updated in ISO 8601 format.", - "example": "2022-05-23T09:24:07.405Z", - "format": "date-time" - }, - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about the product.", - "default": "product" - }, - "skus": { - "type": "object", - "description": "Contains a list of related child SKUs.", - "properties": { - "data": { - "type": "array", - "description": "Contains a list of SKU objects.", - "items": { - "$ref": "#/components/schemas/11_obj_sku_object" - } - }, - "total": { - "type": "number", - "description": "Total number of SKUs." - } - } - } - } - }, - "11_res_get_product_skus_object": { - "type": "object", - "description": "Contains information about child SKUs.", - "title": "SKUs object", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about SKUs.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the JSON property that contains the array of SKUs.", - "default": "data" - }, - "data": { - "type": "array", - "description": "A dictionary that contains an array of SKUs.", - "items": { - "$ref": "#/components/schemas/11_obj_sku_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of SKUs in the product." - } - } - }, - "product_collections_product_in_collection": { - "type": "object", - "description": "This is an object representing a product in product collection.", - "title": "Product in Collection", - "properties": { - "id": { - "type": "string", - "description": "Unique product ID.", - "example": "prod_f1r5Tpr0DuC7" - }, - "source_id": { - "type": [ - "string", - "null" - ], - "example": "productSourceID16", - "description": "Unique product source ID." - }, - "name": { - "type": [ - "string", - "null" - ], - "description": "Unique user-defined product name.", - "example": "T-shirt" - }, - "price": { - "type": [ - "integer", - "null" - ], - "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "attributes": { - "type": "array", - "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", - "items": { - "type": "string" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." - }, - "image_url": { - "type": [ - "string", - "null" - ], - "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", - "example": "https://images.com/original.jpg" - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the product was created in ISO 8601 format.", - "example": "2022-05-23T06:52:55.008Z", - "format": "date-time" - }, - "updated_at": { - "type": [ - "string", - "null" - ], - "description": "Timestamp representing the date and time when the product was updated in ISO 8601 format.", - "example": "2022-05-23T09:24:07.405Z" - }, - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about the `product`.", - "default": "product" - } - }, - "required": [ - "id", - "source_id", - "name", - "price", - "attributes", - "metadata", - "image_url", - "created_at", - "updated_at", - "object" - ] - }, - "11_obj_product_object_truncated": { - "type": "object", - "description": "This is an object representing a product.", - "title": "Product Object", - "properties": { - "id": { - "type": "string", - "description": "Unique product ID.", - "example": "prod_f1r5Tpr0DuC7" - }, - "source_id": { - "type": "string", - "example": "productSourceID16", - "description": "Unique product source ID." - }, - "name": { - "type": "string", - "description": "Unique user-defined product name.", - "example": "T-shirt" - }, - "price": { - "type": "integer", - "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "attributes": { - "type": "array", - "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", - "items": { - "type": "string" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." - }, - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", - "example": "https://images.com/original.jpg" - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the product was created in ISO 8601 format.", - "example": "2022-05-23T06:52:55.008Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the product was updated in ISO 8601 format.", - "example": "2022-05-23T09:24:07.405Z", - "format": "date-time" - }, - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about the `product`.", - "default": "product" - } - } - }, - "11_obj_sku_object": { - "title": "SKU Object", - "type": "object", - "description": "This is an object representing a product SKU. \n\nThe SKU (acronym from Stock Keeping Unit) is tightly related to the [product object](ref:get-product). It reflects its different variants. One product can have many SKUs which are characterized and differentiated by varying values of the parent product `attributes`.", - "x-tags": [ - "PRODUCTS API" - ], - "examples": [ - { - "id": "sku_0b1621b2f25248b79c", - "source_id": "sku_source_id_1", - "product_id": "prod_0b15f6b9f650c16990", - "sku": "Extra Small Blue Shirt", - "price": 1300, - "currency": "USD", - "attributes": { - "size": "XS", - "color": "blue", - "ranking": 1 - }, - "image_url": "", - "metadata": {}, - "created_at": "2022-05-17T10:36:30.057Z", - "updated_at": "2022-07-01T05:34:16.822Z", - "object": "sku" - } - ], - "properties": { - "id": { - "type": "string", - "example": "sku_0b1621b319d248b79f", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "sku_source_id_4", - "description": "A unique SKU identifier from your inventory system." - }, - "product_id": { - "type": "string", - "example": "prod_0b15f6b9f650c16990", - "description": "The parent product's unique ID." - }, - "sku": { - "type": "string", - "example": "Large Pink Shirt", - "description": "Unique user-defined SKU name." - }, - "price": { - "type": "integer", - "description": "SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "currency": { - "type": "string", - "description": "SKU price currency.", - "example": "USD" - }, - "attributes": { - "type": "object", - "description": "The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family." - }, - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format." - }, - "created_at": { - "type": "string", - "example": "2022-05-17T10:36:30.187Z", - "description": "Timestamp representing the date and time when the SKU was created in ISO 8601 format.", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "example": "2022-05-17T10:55:09.137Z", - "description": "Timestamp representing the date and time when the SKU was updated in ISO 8601 format.", - "format": "date-time" - }, - "object": { - "type": "string", - "default": "sku", - "description": "The type of object represented by JSON. This object stores information about the `SKU`." - } - } - }, - "11_req_create_sku": { - "title": "SKU Object", - "type": "object", - "description": "Request body schema for **POST** `/products/{productId}/skus", - "properties": { - "source_id": { - "type": "string", - "example": "sku_source_id_4", - "description": "A unique SKU identifier from your inventory system." - }, - "sku": { - "type": "string", - "example": "Large Pink Shirt", - "description": "Unique user-defined SKU name." - }, - "price": { - "type": "integer", - "description": "SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "currency": { - "type": "string", - "description": "SKU price currency.", - "example": "USD" - }, - "attributes": { - "type": "object", - "description": "The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family." - }, - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format." - } - } - }, - "product_collections_sku_in_collection": { - "title": "SKU in Collection", - "type": "object", - "description": "This is an object representing a SKU in product collection.", - "properties": { - "id": { - "type": "string", - "example": "sku_0b1621b319d248b79f", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": [ - "string", - "null" - ], - "example": "sku_source_id_4", - "description": "A unique SKU identifier from your inventory system." - }, - "product_id": { - "type": "string", - "example": "prod_0b15f6b9f650c16990", - "description": "The parent product's unique ID." - }, - "sku": { - "type": [ - "string", - "null" - ], - "example": "Large Pink Shirt", - "description": "Unique user-defined SKU name." - }, - "price": { - "type": [ - "integer", - "null" - ], - "description": "SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "attributes": { - "type": "object", - "description": "The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family." - }, - "image_url": { - "type": [ - "string", - "null" - ], - "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format." - }, - "created_at": { - "type": "string", - "example": "2022-05-17T10:36:30.187Z", - "description": "Timestamp representing the date and time when the SKU was created in ISO 8601 format.", - "format": "date-time" - }, - "updated_at": { - "type": [ - "string", - "null" - ], - "example": "2022-05-17T10:55:09.137Z", - "description": "Timestamp representing the date and time when the SKU was updated in ISO 8601 format.", - "format": "date-time" - }, - "object": { - "type": "string", - "default": "sku", - "description": "The type of object represented by JSON. This object stores information about the `SKU`." - }, - "product": { - "type": "object", - "description": "Stores information about the parent product.", - "required": [ - "id", - "source_id", - "name", - "price", - "attributes", - "metadata", - "object" - ], - "properties": { - "id": { - "type": "string", - "example": "prod_f15Tpr0DuC7", - "description": "Unique product ID." - }, - "source_id": { - "type": [ - "string", - "null" - ], - "example": "productSourceID11", - "description": "A unique product ID from your inventory system." - }, - "name": { - "type": [ - "string", - "null" - ], - "example": "Shirts", - "description": "Unique user-defined product name." - }, - "price": { - "type": [ - "integer", - "null" - ], - "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "attributes": { - "type": "array", - "description": "A list of product attributes whose values you can customize for given SKUs: `[\"'color\", \"size\", \"ranking\"]` . Each child SKL can have a unique value for a given attribute.", - "items": { - "type": "string" + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "object": { + "type": "string", + "default": "earning_rule", + "description": "The type of object represented by JSON. Default is `earning_rule`." + }, + "automation_id": { + "type": "string", + "description": "For internal use by Voucherify.", + "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." - }, - "object": { - "type": "string", - "default": "product", - "description": "The type of object represented by the object. This object stores information about the parent `product`." } - } - } - }, - "required": [ - "id", - "source_id", - "product_id", - "sku", - "price", - "attributes", - "image_url", - "metadata", - "created_at", - "updated_at", - "object", - "product" - ] - }, - "11_req_update_sku": { - "title": "Update SKU Request Body", - "type": "object", - "description": "Request body schema for **PUT** `/products/{productId}/skus/{skuId}`.", - "properties": { - "sku": { - "type": "string", - "example": "Large Pink Shirt", - "description": "Unique user-defined SKU name." - }, - "price": { - "type": "integer", - "description": "SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "currency": { - "type": "string", - "description": "SKU price currency." - }, - "attributes": { - "type": "object", - "description": "The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family." - }, - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format." - } - } - }, - "product_collections_list_products_response_body": { - "type": "object", - "description": "Response body schema for **GET** `/product-collections/{productCollectionID}/products`.", - "title": "List Products in Collection Response Body", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about products and SKUs.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the JSON property that contains the array of products and SKUs.", - "default": "data" - }, - "data": { - "type": "array", - "description": "A dictionary that contains an array of products and SKUs.", - "items": { - "oneOf": [ + }, + "8_req_earning_rule_object_custom_event": { + "description": "This is an object representing an earning rule triggered by a custom event.", + "type": "object", + "title": "Earning Rule Object for Custom Event", + "examples": [ + { + "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", + "created_at": "2022-02-07T08:19:41.810Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 2, + "type": "FIXED" + }, + "custom_event": { + "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" + }, + "event": "saw_on_facebook", + "source": { + "banner": "Saw on Facebook Timeframe", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-02-07T08:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "object": "earning_rule", + "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" + } + ], + "properties": { + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_custom_event_metadata" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" + } + ] + }, + "custom_event": { + "type": "object", + "description": "Contains the schema id of a custom event. **Required** for the custom event option in `event`.", + "properties": { + "schema_id": { + "type": "string", + "description": "Contains a unique identifier of a custom event schema. Assigned by the Voucherify API.", + "example": "ms_gn4Qe4xsFPf7orCArCiNVY13" + } + } + }, + "event": { + "type": "string", + "enum": [ + "custom_event_defined_in_EVENT_SCHEMA" + ], + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `custom_event_name` the name of a custom event defined in the Dashboard → **Project Settings** → **EVENT SCHEMA** → **Add event definition**. Read more on defining [custom events](https://support.voucherify.io/article/111-custom-events). " + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + } + } + }, + "8_req_update_earning_rule_object_custom_event": { + "description": "This is an object representing an earning rule triggered by a custom event.", + "type": "object", + "title": "Earning Rule Object for Custom Event", + "examples": [ { - "$ref": "#/components/schemas/product_collections_product_in_collection" + "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", + "created_at": "2022-02-07T08:19:41.810Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 2, + "type": "FIXED" + }, + "custom_event": { + "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" + }, + "event": "saw_on_facebook", + "source": { + "banner": "Saw on Facebook Timeframe", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-02-07T08:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "object": "earning_rule", + "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" + } + ], + "properties": { + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_custom_event_metadata" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" + } + ] + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" + } + } }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + } + } + }, + "8_obj_earning_rule_object_custom_event_no_validation_rule": { + "description": "This is an object representing an earning rule triggered by a custom event.", + "type": "object", + "title": "Earning Rule Object for Custom Event", + "examples": [ { - "$ref": "#/components/schemas/product_collections_sku_in_collection" + "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", + "created_at": "2022-02-07T08:19:41.810Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 2, + "type": "FIXED" + }, + "custom_event": { + "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" + }, + "event": "saw_on_facebook", + "source": { + "banner": "Saw on Facebook Timeframe", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-02-07T08:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "object": "earning_rule", + "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" } - ] - } - }, - "total": { - "type": "integer", - "description": "Total number of products & SKUs in the product collection." - } - }, - "required": [ - "object", - "data_ref", - "data", - "total" - ] - }, - "11_res_products_productId_skus": { - "type": "object", - "description": "Response body schema for **GET** `/products/{productID}/skus`.", - "title": "List SKUs in Product Response Body", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about SKUs.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the JSON property that contains the array of SKUs.", - "default": "skus" - }, - "skus": { - "type": "array", - "description": "A dictionary that contains an array of SKUs.", - "items": { - "$ref": "#/components/schemas/11_obj_sku_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of SKUs in the product." - } - } - }, - "product_collections_static_collection": { - "type": "object", - "title": "Static Product Collection", - "description": "Schema model for a `STATIC` product collection.", - "properties": { - "type": { - "description": "Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products).", - "enum": [ - "STATIC" - ] - }, - "products": { - "description": "Defines a set of products for a `STATIC` product collection type.", - "type": "array", - "items": { + ], + "properties": { + "id": { + "type": "string", + "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", + "description": "Assigned by the Voucherify API, identifies the earning rule object." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", + "example": "2022-02-02T13:18:32.557Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", + "example": "2022-02-03T13:09:27.206Z", + "format": "date-time" + }, + "validation_rule_id": { + "type": "null", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_custom_event_metadata" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" + } + ] + }, + "custom_event": { + "type": "object", + "description": "Contains the schema id of a custom event. **Required** for the custom event option in `event`.", + "properties": { + "schema_id": { + "type": "string", + "description": "Contains a unique identifier of a custom event schema. Assigned by the Voucherify API.", + "example": "ms_gn4Qe4xsFPf7orCArCiNVY13" + } + } + }, + "event": { + "type": "string", + "enum": [ + "custom_event_defined_in_EVENT_SCHEMA" + ], + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `custom_event_name` the name of a custom event defined in the Dashboard → **Project Settings** → **EVENT SCHEMA** → **Add event definition**. Read more on defining [custom events](https://support.voucherify.io/article/111-custom-events). " + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + }, + "object_id": { + "type": "string", + "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "description": "A unique campaign identifier assigned by the Voucherify API." + }, + "object_type": { + "type": "string", + "default": "campaign", + "description": "Defines the object associated with the earning rule. Defaults to `campaign`." + } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "object": { + "type": "string", + "default": "earning_rule", + "description": "The type of object represented by JSON. Default is `earning_rule`." + }, + "automation_id": { + "type": "string", + "description": "For internal use by Voucherify.", + "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + } + } + }, + "8_obj_earning_rule_object_tier": { + "description": "This is an object representing an earning rule for tiers.", + "type": "object", + "title": "Earning Rule Object for Tiers", + "properties": { + "id": { + "type": "string", + "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", + "description": "Assigned by the Voucherify API, identifies the earning rule object." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", + "example": "2022-02-02T13:18:32.557Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", + "example": "2022-02-03T13:09:27.206Z", + "format": "date-time" + }, + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" + } + ] + }, + "event": { + "type": "string", + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.loyalty.tier.joined` an event defined by the Voucherify API corresponding to a customer joining a tier \n- `customer.loyalty.tier.left` an event defined by the Voucherify API corresponding to a customer leaving a tier \n- `customer.loyalty.tier.upgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.downgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.prolonged` an event defined by the Voucherify API corresponding to a customer's tier being prolonged", + "enum": [ + "customer.loyalty.tier.joined", + "customer.loyalty.tier.left", + "customer.loyalty.tier.upgraded", + "customer.loyalty.tier.downgraded", + "customer.loyalty.tier.prolonged" + ] + }, + "loyalty_tier": { + "type": "object", + "description": "Defines the tier associated with the earning rule definition.", + "properties": { + "id": { + "type": "string", + "description": "Unique loyalty tier ID associated with the earning rule. \n\n- `__ANY__`: any loyalty tier within the campaign", + "example": "ltr_pudTGWasuIqxdiDM0go31OV1" + } + } + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + }, + "object_id": { + "type": "string", + "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "description": "A unique campaign identifier assigned by the Voucherify API." + }, + "object_type": { + "type": "string", + "default": "campaign", + "description": "Defines the object associated with the earning rule. Defaults to `campaign`." + } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "object": { + "type": "string", + "default": "earning_rule", + "description": "The type of object represented by JSON. Default is `earning_rule`." + }, + "automation_id": { + "type": "string", + "description": "For internal use by Voucherify.", + "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + } + } + }, + "8_req_earning_rule_object_tier": { + "description": "This is an object representing an earning rule for tiers.", + "type": "object", + "title": "Earning Rule Object for Tiers", + "properties": { + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" + } + ] + }, + "event": { + "type": "string", + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.loyalty.tier.joined` an event defined by the Voucherify API corresponding to a customer joining a tier \n- `customer.loyalty.tier.left` an event defined by the Voucherify API corresponding to a customer leaving a tier \n- `customer.loyalty.tier.upgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.downgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.prolonged` an event defined by the Voucherify API corresponding to a customer's tier being prolonged", + "enum": [ + "customer.loyalty.tier.joined", + "customer.loyalty.tier.left", + "customer.loyalty.tier.upgraded", + "customer.loyalty.tier.downgraded", + "customer.loyalty.tier.prolonged" + ] + }, + "loyalty_tier": { + "type": "object", + "description": "Defines the tier associated with the earning rule definition.", + "properties": { + "id": { + "type": "string", + "description": "Unique loyalty tier ID associated with the earning rule. \n\n- `__ANY__`: any loyalty tier within the campaign", + "example": "ltr_pudTGWasuIqxdiDM0go31OV1" + } + } + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + } + } + }, + "8_req_update_earning_rule_object_tier": { + "description": "This is an object representing an earning rule for tiers.", + "type": "object", + "title": "Earning Rule Object for Tiers", + "properties": { + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" + } + ] + }, + "event": { + "type": "string", + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.loyalty.tier.joined` an event defined by the Voucherify API corresponding to a customer joining a tier \n- `customer.loyalty.tier.left` an event defined by the Voucherify API corresponding to a customer leaving a tier \n- `customer.loyalty.tier.upgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.downgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.prolonged` an event defined by the Voucherify API corresponding to a customer's tier being prolonged", + "enum": [ + "customer.loyalty.tier.joined", + "customer.loyalty.tier.left", + "customer.loyalty.tier.upgraded", + "customer.loyalty.tier.downgraded", + "customer.loyalty.tier.prolonged" + ] + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + } + } + }, + "8_obj_earning_rule_object_tier_no_validation_rule": { + "description": "This is an object representing an earning rule for tiers.", "type": "object", + "title": "Earning Rule Object for Tiers", "properties": { "id": { "type": "string", - "example": "prod_0a41bcf807c5fcaaf6", - "description": "The product ID." + "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", + "description": "Assigned by the Voucherify API, identifies the earning rule object." }, - "product_id": { + "created_at": { "type": "string", - "description": "Product ID for SKUs." + "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", + "example": "2022-02-02T13:18:32.557Z", + "format": "date-time" }, - "object": { - "enum": [ - "sku", - "product" - ], - "description": "Denotes the type of object represented by the ID." - } - }, - "required": [ - "id", - "object" - ] - } - } - }, - "required": [ - "type", - "products" - ] - }, - "product_collections_dynamic_collection": { - "type": "object", - "title": "Dynamic Product Collection", - "description": "Schema model for an `AUTO_UPDATE` product collection.", - "properties": { - "type": { - "description": "Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products).", - "enum": [ - "AUTO_UPDATE" - ] - }, - "filter": { - "type": "object", - "description": "Defines a set of criteria and boundary conditions for an `AUTO_UPDATE` product collection type.", - "additionalProperties": false, - "required": [ - "junction" - ], - "properties": { - "junction": { - "$ref": "#/components/schemas/Junction" - }, - "id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "product_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "source_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "name": { - "$ref": "#/components/schemas/FieldConditions" - }, - "price": { - "$ref": "#/components/schemas/FieldConditions" - }, - "object": { - "$ref": "#/components/schemas/FieldConditions" - }, - "attributes": { - "$ref": "#/components/schemas/FieldConditions" - }, - "metadata": { - "$ref": "#/components/schemas/FieldConditions" - }, - "image_url": { - "$ref": "#/components/schemas/FieldConditions" - }, - "skus": { - "$ref": "#/components/schemas/FieldConditions" - }, - "created_at": { - "$ref": "#/components/schemas/FieldConditions" - }, - "updated_at": { - "$ref": "#/components/schemas/FieldConditions" - } - } - } - }, - "required": [ - "type", - "filter" - ] - }, - "product_collections_list_response_body": { - "type": "object", - "title": "List Product Collections Response Body", - "description": "Response body schema for **GET** `/product-collections`.", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about product collections.", - "default": "list" - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the JSON property that contains the array of product collections." - }, - "data": { - "description": "A dictionary that contains an array of product collections and their details.", - "type": "array", - "items": { - "$ref": "#/components/schemas/product_collections_collection_item" - } - }, - "total": { - "type": "integer", - "description": "Total number of product collections." - } - }, - "required": [ - "object", - "data_ref", - "data", - "total" - ] - }, - "13_obj_validation_rule_object": { - "title": "Validation Rule Object", - "type": "object", - "description": "This is an object representing a validation rule. \n\nThis entity stores the rules used to limit resources in Voucherify. The validation rule can be assigned to resources such as a: \n- [voucher](ref:get-voucher)\n- [campaign](ref:get-campaign)\n- [earning rule](ref:get-earning-rule)\n- [reward assignment](ref:get-reward-assignment)\n- [promotion tier](ref:list-promotion-tiers)\n- [publication](ref:list-publications)\n\nYou can configure the Validation Rule to include your own custom error messages which are going to be returned from the API upon a validation / redemption failure. You can read more [here](ref:errors#custom-error-messages-with-validation-rules).", - "x-tags": [ - "VALIDATION RULES API" - ], - "properties": { - "id": { - "type": "string", - "example": "val_eR1c41hu0vUU", - "description": "Unique validation rule ID." - }, - "name": { - "type": "string", - "description": "Custom, unique name for set of validation rules.", - "example": "Business Validation Rule" - }, - "rules": { - "type": "object", - "description": "Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", - "properties": { - "1": { - "type": "object", - "description": "Defines the rule.", - "properties": { - "name": { - "type": "string", - "description": "Voucherify specific rule name. The list of available names is provided below. \n\n**Name** |\n---- | -----------\n**Customer** | customer.segment
customer.metadata* \n**Order** |order.amount
order.items.count
order.items.price_any
order.items.price_each
order.items.metadata_any
order.items.metadata_each
order.metadata* |\n| **Campaign** | campaign.orders.amount_discounted
campaign.orders.amount
campaign.redemptions.count
campaign.redemptions.count.daily
campaign.redemptions.count.monthly
campaign.redemptions.customers_count
campaign.redemptions.customers_count.daily
campaign.redemptions.customers_count.monthly |\n| **Redemption** |redemption.gift.amount
redemption.count.daily
redemption.count.monthly
redemption.count.per_customer
redemption.count.per_customer.daily
redemption.count.per_customer.monthly
redemption.api_key
redemption.count.per_api_key
redemption.user.login
redemption.count.per_user
redemption.metadata*
redemption.reward.pay_with_points.points_used |\n| **Product** | product.id
product.price
product.quantity
product.discount_applicable
product.metadata*
product.metadata.aggregated_quantity
product.metadata.aggregated_amount
product.metadata.discount_applicable
product.metadata.match_all |\n| **SKU** | sku.id
sku.price
sku.quantity
sku.discount_applicable |\n| **Publication** | publication.redeemable_by_linked_customer |\n| **Custom Event** | custom_event.metadata* |\n| **Order items** | order.items.every
order.items.any
order.items.none
order.items.cheapest
order.items.most_expensive | order.items.quantity
order.items.aggregated_quantity
order.items.price
order.items.aggregated_amount
order.items.metadata* | \n\n\n\n*Requires the `property` field to be defined." - }, - "property": { - "type": [ - "string", - "null" - ], - "description": "Custom name for a metadata property associated with the condition to be satisfied. **Required** if the property `name` is any of the following: \n customer_metadata
custom_event_metadata
order_items_metadata
order_metadata
product_metadata
redemption_metadata" - }, - "conditions": { - "type": "object", - "description": "A set of key value pairs representing the condition name and value. The list of available conditions is provided below: \n**Condition (key)** | **Definition** | **Does not support Types** \n--- | --- | ---\n $is | A property is a predefined value. | \n $is_not | A property is not a predefined value. | \n $in | A property either one value in a predefined list of values. | \n $less_than | A property is less than a predefined value. | boolean \n $less_than_or_equal | A property is less than or equal to a predefined value. | boolean \n $more_than | A property is more than a predefined value. | boolean \n $more_than_or_equal | A property is more than or equal to a predefined value. | boolean \n $starts_with | A property starts with the predefined sequence of characters. | boolean, number \n $ends_with | A property ends with the predefined sequence of characters. | boolean, number \n $contains | A property contains the predefined sequence of characters. | boolean, number \n $timeframe | | boolean, number \n $dow | | boolean, string \n $count | | boolean, string \n $count_more | | boolean, string \n $count_less | | boolean, string ", - "properties": { - "$one_of_voucherify_conditions": { - "type": "array", - "description": "Contains a set of conditions for the rule.", - "items": { - "type": [ - "string", - "integer", - "boolean" - ] - } - } - } - }, - "rules": { - "type": "object", - "description": "Contains all the nested rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", - "properties": { - "1": { - "type": "object", - "description": "Defines the nested rule.", - "properties": { - "name": { - "type": "string" - }, - "property": { - "type": "string" - }, - "conditions": { - "type": "object" - }, - "rules": { - "type": "object" - } - } - }, - "logic": { - "type": "string" - } + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", + "example": "2022-02-03T13:09:27.206Z", + "format": "date-time" + }, + "validation_rule_id": { + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance.", + "type": "null" + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" } - }, - "error": { - "type": "object", - "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rule.", - "properties": { - "message": { - "type": "string", - "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rule." - } + ] + }, + "event": { + "type": "string", + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.loyalty.tier.joined` an event defined by the Voucherify API corresponding to a customer joining a tier \n- `customer.loyalty.tier.left` an event defined by the Voucherify API corresponding to a customer leaving a tier \n- `customer.loyalty.tier.upgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.downgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.prolonged` an event defined by the Voucherify API corresponding to a customer's tier being prolonged", + "enum": [ + "customer.loyalty.tier.joined", + "customer.loyalty.tier.left", + "customer.loyalty.tier.upgraded", + "customer.loyalty.tier.downgraded", + "customer.loyalty.tier.prolonged" + ] + }, + "loyalty_tier": { + "type": "object", + "description": "Defines the tier associated with the earning rule definition.", + "properties": { + "id": { + "type": "string", + "description": "Unique loyalty tier ID associated with the earning rule. \n\n- `__ANY__`: any loyalty tier within the campaign", + "example": "ltr_pudTGWasuIqxdiDM0go31OV1" } } - } - }, - "logic": { - "type": "string", - "example": "(1 and 2) and (3)", - "description": "Defines the logic between the rules." - } - } - }, - "error": { - "type": "object", - "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules.", - "properties": { - "message": { - "type": "string", - "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rules." - } - } - }, - "applicable_to": { - "type": "object", - "properties": { - "excluded": { - "type": "array", - "description": "Defines which items are excluded from a discount.", - "items": { + }, + "source": { "type": "object", - "description": "Defines the excluded item.", + "description": "Contains the custom earning rule name and parent campaign.", "properties": { - "object": { + "banner": { "type": "string", - "enum": [ - "product", - "sku", - "products_collection" - ], - "description": "The type of object being excluded from the rule." + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." }, - "id": { + "object_id": { "type": "string", - "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." - }, - "source_id": { - "type": "string" - }, - "strict": { - "type": "boolean" + "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "description": "A unique campaign identifier assigned by the Voucherify API." }, - "effect": { + "object_type": { "type": "string", - "enum": [ - "APPLY_TO_EVERY" - ], - "description": "Discount effect for an excluded resource." + "default": "campaign", + "description": "Defines the object associated with the earning rule. Defaults to `campaign`." } } - } - }, - "included": { - "type": "array", - "description": "Defines which items are included in a discount.", - "items": { + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { "type": "object", - "description": "Defines the included item.", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", "properties": { - "object": { - "type": "string", - "enum": [ - "product", - "sku", - "products_collection" - ], - "description": "The type of object being included in the rule." - }, - "id": { + "duration": { "type": "string", - "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." - }, - "source_id": { - "type": "string" - }, - "strict": { - "type": "boolean" + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" }, - "effect": { + "interval": { "type": "string", - "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Discount effect for an included resource." - }, - "quantity_limit": { - "type": "integer", - "description": "A limit on the number of units that at maximum can qualify for a discount. This property is present for an AMOUNT type discount when the effect is applied to ITEMS and each unit of matched products has the same discount value." + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" } } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "object": { + "type": "string", + "default": "earning_rule", + "description": "The type of object represented by JSON. Default is `earning_rule`." + }, + "automation_id": { + "type": "string", + "description": "For internal use by Voucherify.", + "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." } - }, - "included_all": { - "type": "boolean", - "description": "Indicates whether all items are included in the discount." } - } - }, - "created_at": { - "type": "string", - "example": "2022-03-23T07:44:00.444Z", - "description": "Timestamp representing the date and time when the validation rule was created in ISO 8601 format.", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "example": "2022-04-26T08:35:54.960Z", - "description": "Timestamp representing the date and time when the validation rule was updated in ISO 8601 format.", - "format": "date-time" - }, - "type": { - "type": "string", - "enum": [ - "basic", - "advanced", - "complex" - ], - "description": "Type of validation rule." - }, - "context_type": { - "type": "string", - "enum": [ - "earning_rule.order.paid", - "earning_rule.custom_event", - "earning_rule.customer.segment.entered", - "campaign.discount_coupons", - "campaign.discount_coupons.discount.apply_to_order", - "campaign.discount_coupons.discount.apply_to_items", - "campaign.discount_coupons.discount.apply_to_items_proportionally", - "campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity", - "campaign.discount_coupons.discount.fixed.apply_to_items", - "campaign.gift_vouchers", - "campaign.gift_vouchers.gift.apply_to_order", - "campaign.gift_vouchers.gift.apply_to_items", - "campaign.referral_program", - "campaign.referral_program.discount.apply_to_order", - "campaign.referral_program.discount.apply_to_items", - "campaign.referral_program.discount.apply_to_items_proportionally", - "campaign.referral_program.discount.apply_to_items_proportionally_by_quantity", - "campaign.referral_program.discount.fixed.apply_to_items", - "campaign.promotion", - "campaign.promotion.discount.apply_to_order", - "campaign.promotion.discount.apply_to_items", - "campaign.promotion.discount.apply_to_items_proportionally", - "campaign.promotion.discount.apply_to_items_proportionally_by_quantity", - "campaign.promotion.discount.fixed.apply_to_items", - "campaign.loyalty_program", - "campaign.lucky_draw", - "voucher.discount_voucher", - "voucher.discount_voucher.discount.apply_to_order", - "voucher.discount_voucher.discount.apply_to_items", - "voucher.discount_voucher.discount.apply_to_items_proportionally", - "voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity", - "voucher.discount_voucher.discount.fixed.apply_to_items", - "voucher.gift_voucher", - "voucher.gift_voucher.gift.apply_to_order", - "voucher.gift_voucher.gift.apply_to_items", - "voucher.loyalty_card", - "voucher.lucky_draw_code", - "distribution.custom_event", - "reward_assignment.pay_with_points", - "global" - ], - "description": "Validation rule context type. \n\n| **Context Type** | **Definition** |\n|:---|:---|\n| earning_rule.order.paid | |\n| earning_rule.custom_event | |\n| earning_rule.customer.segment.entered | |\n| campaign.discount_coupons | |\n| campaign.discount_coupons.discount.apply_to_order | |\n| campaign.discount_coupons.discount.apply_to_items | |\n| campaign.discount_coupons.discount.apply_to_items_proportionally | |\n| campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.discount_coupons.discount.fixed.apply_to_items | |\n| campaign.gift_vouchers | |\n| campaign.gift_vouchers.gift.apply_to_order | |\n| campaign.gift_vouchers.gift.apply_to_items | |\n| campaign.referral_program | |\n| campaign.referral_program.discount.apply_to_order | |\n| campaign.referral_program.discount.apply_to_items | |\n| campaign.referral_program.discount.apply_to_items_proportionally | |\n| campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.referral_program.discount.fixed.apply_to_items | |\n| campaign.promotion | |\n| campaign.promotion.discount.apply_to_order | |\n| campaign.promotion.discount.apply_to_items | |\n| campaign.promotion.discount.apply_to_items_proportionally | |\n| campaign.promotion.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.promotion.discount.fixed.apply_to_items | |\n| campaign.loyalty_program | |\n| campaign.lucky_draw | |\n| voucher.discount_voucher | |\n| voucher.discount_voucher.discount.apply_to_order | |\n| voucher.discount_voucher.discount.apply_to_items | |\n| voucher.discount_voucher.discount.apply_to_items_proportionally | |\n| voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | |\n| voucher.discount_voucher.discount.fixed.apply_to_items | |\n| voucher.gift_voucher | |\n| voucher.gift_voucher.gift.apply_to_order | |\n| voucher.gift_voucher.gift.apply_to_items | |\n| voucher.loyalty_card | |\n| voucher.lucky_draw_code | |\n| distribution.custom_event | |\n| reward_assignment.pay_with_points | |\n| global | |" - }, - "object": { - "type": "string", - "default": "validation_rules", - "description": "The type of object represented by JSON. This object stores information about the validation rule." - } - } - }, - "13_req_create_validation_rule": { - "title": "Create Validation Rule Request Body", - "type": "object", - "description": "Request body schema for **POST** `/validation-rules`.", - "properties": { - "name": { - "type": "string", - "description": "Custom, unique name for the set of validation rules.", - "example": "Business Validation Rule" - }, - "rules": { - "type": "object", - "description": "Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", - "properties": { - "1": { - "type": "object", - "description": "Defines the rule.", - "properties": { - "name": { - "type": "string", - "description": "Voucherify specific rule name. The list of available names is provided below. \n| **Name** |\n|:---|\n| **Customer** |\n| customer.segment
customer.metadata* |\n| **Order** |\n| order.amount
order.items.count
order.items.price_any
order.items.price_each
order.items.metadata_any
order.items.metadata_each
order.metadata* |\n| **Campaign** |\n| campaign.orders.amount_discounted
campaign.orders.amount
campaign.redemptions.count
campaign.redemptions.count.daily
campaign.redemptions.count.monthly
campaign.redemptions.customers_count
campaign.redemptions.customers_count.daily
campaign.redemptions.customers_count.monthly |\n| **Redemption** |\n| redemption.gift.amount
redemption.count.daily
redemption.count.monthly
redemption.count.per_customer
redemption.count.per_customer.daily
redemption.count.per_customer.monthly
redemption.api_key
redemption.count.per_api_key
redemption.user.login
redemption.count.per_user
redemption.metadata*
redemption.reward.pay_with_points.points_used |\n| **Product** |\n| product.id
product.price
product.quantity
product.discount_applicable
product.metadata*
product.metadata.aggregated_quantity
product.metadata.aggregated_amount
product.metadata.discount_applicable
product.metadata.match_all |\n| **SKU** |\n| sku.id
sku.price
sku.quantity
sku.discount_applicable |\n| **Publication** |\n| publication.redeemable_by_linked_customer |\n| **Custom Event** |\n| custom_event.metadata* |\n| **Order items** |\n| order.items.every
order.items.any
order.items.none
order.items.cheapest
order.items.most_expensive |\n| order.items.quantity
order.items.aggregated_quantity
order.items.price
order.items.aggregated_amount
order.items.metadata* | \n\n\n*Requires the `property` field to be defined." - }, - "property": { - "type": [ - "string", - "null" - ], - "description": "Custom name for a metadata property associated with the condition to be satisfied. **Required** if the property `name` is any of the following: \n| **Name** |\n|:---|\n| customer_metadata |\n| custom_event_metadata |\n| order_items_metadata |\n| order_metadata |\n| product_metadata |\n| redemption_metadata |" - }, - "conditions": { - "type": "object", - "description": "A set of key value pairs representing the condition name and value. The list of available conditions is provided below: \n| **Condition (key)** | **Definition** | **Does not support Types** |\n|:---|:---|:---|\n| $is | A property is a predefined value. | |\n| $is_not | A property is not a predefined value. | |\n| $in | A property either one value in a predefined list of values. | |\n| $less_than | A property is less than a predefined value. | boolean |\n| $less_than_or_equal | A property is less than or equal to a predefined value. | boolean |\n| $more_than | A property is more than a predefined value. | boolean |\n| $more_than_or_equal | A property is more than or equal to a predefined value. | boolean |\n| $starts_with | A property starts with the predefined sequence of characters. | boolean, number |\n| $ends_with | A property ends with the predefined sequence of characters. | boolean, number |\n| $contains | A property contains the predefined sequence of characters. | boolean, number |\n| $timeframe | | boolean, number |\n| $dow | | boolean, string |\n| $count | | boolean, string |\n| $count_more | | boolean, string |\n| $count_less | | boolean, string |", - "properties": { - "$one_of_voucherify_conditions": { - "type": "array", - "description": "Contains a set of conditions for the rule.", - "items": { - "type": [ - "string", - "integer", - "boolean" - ] + }, + "8_obj_fixed_points": { + "title": "Define Fixed Amount of Points", + "type": "object", + "description": "This is an object representing points calculated based on a fixed value.", + "properties": { + "points": { + "type": "integer", + "description": "The number of points to be added to the loyalty card.", + "example": 100 + }, + "type": { + "type": "string", + "description": "Defines how the points will be added to the loyalty card. `FIXED` adds a fixed number of `points`.", + "enum": [ + "FIXED" + ] + } + } + }, + "8_obj_calculate_points_proportionally_order_paid": { + "title": "Calculate Points Proportionally", + "description": "This is an object representing points calculated proportionally to another property.", + "anyOf": [ + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_amounts" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_total_amount" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_metadata" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_item_amount" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_items_subtotal_amount" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_items_quantity" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" + } + ] + }, + "8_obj_calculate_points_proportionally_order_amounts": { + "title": "Calculate Points Proportionally to Order Amount", + "type": "object", + "description": "This is an object representing points calculated proportionally to another property.", + "properties": { + "type": { + "type": "string", + "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", + "enum": [ + "PROPORTIONAL" + ] + }, + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_AMOUNT" + ], + "description": "`ORDER_AMOUNT`: Pre-discount order amount (X points for every Y spent excluding discounts)" + }, + "order": { + "type": "object", + "properties": { + "amount": { + "type": "object", + "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every set of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` `calculation_type`, give `points`.", + "properties": { + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." } } } - }, - "rules": { - "type": "object", - "description": "Contains all the nested rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", - "properties": { - "1": { - "type": "object", - "description": "Defines the nested rule.", - "properties": { - "name": { - "type": "string" - }, - "property": { - "type": "string" - }, - "conditions": { - "type": "object" - }, - "rules": { - "type": "object" - } + } + } + } + }, + "8_obj_calculate_points_proportionally_order_total_amount": { + "title": "Calculate Points Proportionally to Total Order Amount", + "type": "object", + "description": "This is an object representing points calculated proportionally to another property.", + "properties": { + "type": { + "type": "string", + "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", + "enum": [ + "PROPORTIONAL" + ] + }, + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_TOTAL_AMOUNT" + ], + "description": "`ORDER_TOTAL_AMOUNT`: Total order amount (X points for every Y spent including discount)" + }, + "order": { + "type": "object", + "properties": { + "total_amount": { + "type": "object", + "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every set of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` `calculation_type`, give `points`.", + "properties": { + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." } - }, - "logic": { - "type": "string" } } - }, - "error": { - "type": "object", - "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rule.", - "properties": { - "message": { - "type": "string", - "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rule." + } + } + } + }, + "8_obj_calculate_points_proportionally_order_metadata": { + "title": "Calculate Points Proportionally To an Order Metadata Property", + "type": "object", + "description": "This is an object representing points calculated proportionally to an order metadata property.", + "properties": { + "type": { + "type": "string", + "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", + "enum": [ + "PROPORTIONAL" + ] + }, + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_METADATA" + ], + "description": "`ORDER_METADATA`: Order Metadata (X points for every Y in metadata attribute, defined in the `property` key under the `order.metadata` object)" + }, + "order": { + "type": "object", + "description": "Defines the formula for calculating points proportionally.", + "properties": { + "metadata": { + "type": "object", + "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every given increment of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` order metadata property value, give `points`.", + "properties": { + "every": { + "type": "integer", + "description": "For how many increments of the order metadata property to grant points for.", + "example": 100 + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card.", + "example": 10 + }, + "property": { + "type": "string", + "example": "number_of_store_visits", + "description": "Order metadata property." + } } } } } - }, - "logic": { - "type": "string", - "example": "(1 and 2) and (3)", - "description": "Defines the logic between the rules." - } - } - }, - "error": { - "type": "object", - "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules.", - "properties": { - "message": { - "type": "string", - "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rules." } - } - }, - "applicable_to": { - "type": "object", - "properties": { - "excluded": { - "type": "array", - "description": "Defines which items are excluded from a discount.", - "items": { + }, + "8_obj_calculate_points_proportionally_item_amount": { + "title": "Calculate Points Proportionally to Order Items Amount", + "type": "object", + "description": "This is an object representing points calculated proportionally to another property.", + "properties": { + "type": { + "type": "string", + "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", + "enum": [ + "PROPORTIONAL" + ] + }, + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_ITEMS_AMOUNT" + ], + "description": "- `ORDER_ITEMS_AMOUNT`; Pre-discount amount spent on items defined in the `order_items.amount.object` & `.id` (X points for every Y spent on items excluding discounts)" + }, + "order_items": { "type": "object", - "description": "Defines the excluded item.", "properties": { - "object": { - "type": "string", - "enum": [ - "product", - "sku", - "products_collection" - ], - "description": "The type of object being excluded from the rule." - }, - "id": { - "type": "string", - "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." - }, - "source_id": { - "type": "string" - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY" - ], - "description": "Discount effect for an excluded resource." + "amount": { + "type": "object", + "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every set of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` `calculation_type`, give `points`.", + "properties": { + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + }, + "object": { + "type": "string", + "description": "Type of object taken under consideration.", + "enum": [ + "products_collection", + "product", + "sku" + ] + }, + "id": { + "type": "string", + "description": "Unique ID of the resource, i.e. `pc_75U0dHlr7u75BJodrW1AE3t6`, `prod_0bae32322150fd0546`, or `sku_0b7d7dfb090be5c619`." + } + } } } } - }, - "included": { - "type": "array", - "description": "Defines which items are included in a discount.", - "items": { + } + }, + "8_obj_calculate_points_proportionally_items_subtotal_amount": { + "title": "Calculate Points Proportionally to Order Items Subtotal Amount", + "type": "object", + "description": "This is an object representing points calculated proportionally to another property.", + "properties": { + "type": { + "type": "string", + "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", + "enum": [ + "PROPORTIONAL" + ] + }, + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_ITEMS_SUBTOTAL_AMOUNT" + ], + "description": "- `ORDER_ITEMS_SUBTOTAL_AMOUNT`; Amount spent on items defined in the `order_items.subtotal_amount.object` & `.id` (X points for every Y spent on items including discounts)" + }, + "order_items": { "type": "object", - "description": "Defines the included item.", "properties": { - "object": { - "type": "string", - "enum": [ - "product", - "sku", - "products_collection" - ], - "description": "The type of object being included in the rule." - }, - "id": { - "type": "string", - "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." - }, - "source_id": { - "type": "string" - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Discount effect for an included resource." - }, - "quantity_limit": { - "type": "integer", - "description": "A limit on the number of units that at maximum can qualify for a discount. This property is present for an AMOUNT type discount when the effect is applied to ITEMS and each unit of matched products has the same discount value." + "subtotal_amount": { + "type": "object", + "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every set of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` `calculation_type`, give `points`.", + "properties": { + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + }, + "object": { + "type": "string", + "description": "Type of object taken under consideration.", + "enum": [ + "products_collection", + "product", + "sku" + ] + }, + "id": { + "type": "string", + "description": "Unique ID of the resource, i.e. `pc_75U0dHlr7u75BJodrW1AE3t6`, `prod_0bae32322150fd0546`, or `sku_0b7d7dfb090be5c619`." + } + } } } } - }, - "included_all": { - "type": "boolean", - "description": "Indicates whether all items are included in the discount." } - } - } - } - }, - "13_res_list_validation_rules": { - "description": "Response body schema for listing validation rules. \n\nThis entity stores the [validation rules](ref:get-validation-rule) used to limit your resources.", - "type": "object", - "title": "List Validation Rules Response Body", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about validation rules.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of validation rules.", - "default": "data" - }, - "data": { - "type": "array", - "uniqueItems": true, - "description": "An array of validation rules.", - "items": { + }, + "8_obj_calculate_points_proportionally_items_quantity": { + "title": "Calculate Points Proportionally to Quantity of Items in the Cart", "type": "object", - "description": "Stores information about the validation rule.", + "description": "This is an object representing points calculated proportionally to quantity of items in the cart.", "properties": { - "id": { + "type": { "type": "string", - "description": "Unique validation rule ID.", - "example": "val_F4Artfc4HQIq" + "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", + "enum": [ + "PROPORTIONAL" + ] }, - "name": { + "calculation_type": { "type": "string", - "description": "Custom, unique name for the set of validation rules." + "enum": [ + "ORDER_ITEMS_QUANTITY" + ], + "description": "`ORDER_ITEMS_QUANTITY`: Quantity of items defined in `order_items.quantity.object` & `.id` (X points for every Y items excluding free items)" }, - "rules": { + "order_items": { "type": "object", - "description": "A set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", "properties": { - "1": { + "quantity": { "type": "object", - "description": "Defines the rule.", + "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every set of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` `calculation_type`, give `points`.", "properties": { - "name": { - "type": "string", - "description": "Voucherify specific rule name. The list of available names is provided below. \n\n**Name** |\n---- | -----------\n**Customer** | customer.segment
customer.metadata* \n**Order** |order.amount
order.items.count
order.items.price_any
order.items.price_each
order.items.metadata_any
order.items.metadata_each
order.metadata* |\n| **Campaign** | campaign.orders.amount_discounted
campaign.orders.amount
campaign.redemptions.count
campaign.redemptions.count.daily
campaign.redemptions.count.monthly
campaign.redemptions.customers_count
campaign.redemptions.customers_count.daily
campaign.redemptions.customers_count.monthly |\n| **Redemption** |redemption.gift.amount
redemption.count.daily
redemption.count.monthly
redemption.count.per_customer
redemption.count.per_customer.daily
redemption.count.per_customer.monthly
redemption.api_key
redemption.count.per_api_key
redemption.user.login
redemption.count.per_user
redemption.metadata*
redemption.reward.pay_with_points.points_used |\n| **Product** | product.id
product.price
product.quantity
product.discount_applicable
product.metadata*
product.metadata.aggregated_quantity
product.metadata.aggregated_amount
product.metadata.discount_applicable
product.metadata.match_all |\n| **SKU** | sku.id
sku.price
sku.quantity
sku.discount_applicable |\n| **Publication** | publication.redeemable_by_linked_customer |\n| **Custom Event** | custom_event.metadata* |\n| **Order items** | order.items.every
order.items.any
order.items.none
order.items.cheapest
order.items.most_expensive | order.items.quantity
order.items.aggregated_quantity
order.items.price
order.items.aggregated_amount
order.items.metadata* | \n\n\n*Requires the `property` field to be defined." + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." }, - "rules": { - "type": "object", - "description": "Contains all the nested rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", - "properties": { - "1": { - "type": "object", - "description": "Defines the nested rule.", - "properties": { - "name": { - "type": "string" - }, - "property": { - "type": "string" - }, - "conditions": { - "type": "object" - }, - "rules": { - "type": "object" - } - } - }, - "logic": { - "type": "string" - } - } + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." }, - "property": { + "object": { "type": "string", - "description": "Custom name for a metadata property associated with the condition to be satisfied. **Required** if the property `name` is any of the following: \n| **Name** |\n|:---|\n| customer_metadata |\n| custom_event_metadata |\n| order_items_metadata |\n| order_metadata |\n| product_metadata |\n| redemption_metadata |" - }, - "conditions": { - "type": "array", - "description": "A set of key value pairs representing the condition name and value. The list of available conditions is provided below: \n| **Condition (key)** | **Definition** | **Does not support Types** |\n|:---|:---|:---|\n| $is | A property is a predefined value. | |\n| $is_not | A property is not a predefined value. | |\n| $in | A property either one value in a predefined list of values. | |\n| $less_than | A property is less than a predefined value. | boolean |\n| $less_than_or_equal | A property is less than or equal to a predefined value. | boolean |\n| $more_than | A property is more than a predefined value. | boolean |\n| $more_than_or_equal | A property is more than or equal to a predefined value. | boolean |\n| $starts_with | A property starts with the predefined sequence of characters. | boolean, number |\n| $ends_with | A property ends with the predefined sequence of characters. | boolean, number |\n| $contains | A property contains the predefined sequence of characters. | boolean, number |\n| $timeframe | | boolean, number |\n| $dow | | boolean, string |\n| $count | | boolean, string |\n| $count_more | | boolean, string |\n| $count_less | | boolean, string |", - "items": { - "type": [ - "string", - "integer", - "boolean" - ] - } + "description": "Type of object taken under consideration.", + "enum": [ + "products_collection", + "product", + "sku" + ] }, - "error": { - "type": "object", - "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rule.", - "properties": { - "message": { - "type": "string", - "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rule." - } - } + "id": { + "type": "string", + "description": "Unique ID of the resource, i.e. `pc_75U0dHlr7u75BJodrW1AE3t6`, `prod_0bae32322150fd0546`, or `sku_0b7d7dfb090be5c619`." } } - }, - "logic": { - "type": "string", - "description": "Defines the logic between the rules.", - "example": "(1 and 2) and (3)" } } + } + } + }, + "8_obj_calculate_points_proportionally_customer_metadata": { + "title": "Calculate Points Proportionally To a Customer Metadata Property", + "type": "object", + "description": "This is an object representing points calculated proportionally to a customer metadata property.", + "properties": { + "type": { + "type": "string", + "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", + "enum": [ + "PROPORTIONAL" + ] }, - "error": { + "calculation_type": { + "type": "string", + "enum": [ + "CUSTOMER_METADATA" + ], + "description": "`CUSTOMER_METADATA`: Customer Metadata (X points for every Y in metadata attribute, defined in the `property` key under the `customer.metadata` object)" + }, + "customer": { "type": "object", - "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules.", + "description": "Defines the formula for calculating points proportionally.", "properties": { - "message": { - "type": "string", - "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rules." + "metadata": { + "type": "object", + "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every given increment of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` order metadata property value, give `points`.", + "properties": { + "every": { + "type": "integer", + "description": "For how many increments of the customer metadata property to grant points for.", + "example": 100 + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card.", + "example": 10 + }, + "property": { + "type": "string", + "example": "customer_life_time_value", + "description": "Customer metadata property." + } + } } } + } + } + }, + "8_obj_calculate_points_proportionally_custom_event_metadata": { + "title": "Calculate Points Proportionally To a Custom Event Metadata Property", + "type": "object", + "description": "This is an object representing points calculated proportionally to a custom event metadata property.", + "properties": { + "type": { + "type": "string", + "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", + "enum": [ + "PROPORTIONAL" + ] }, - "applicable_to": { + "calculation_type": { + "type": "string", + "enum": [ + "CUSTOMER_METADATA" + ], + "description": "`CUSTOM_EVENT_METADATA`: Custom Event Metadata (X points for every Y in metadata attribute, defined in the `property` key under the `custom_event.metadata` object)" + }, + "custom_event": { "type": "object", + "description": "Defines the formula for calculating points proportionally.", "properties": { - "excluded": { - "type": "array", - "description": "Defines which items are excluded from a discount.", - "items": { - "type": "object", - "description": "Defines the excluded item.", - "properties": { - "object": { - "type": "string", - "enum": [ - "product", - "sku", - "products_collection" - ], - "description": "The type of object being excluded from the rule." - }, - "id": { - "type": "string", - "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." - }, - "source_id": { - "type": "string" - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY" - ], - "description": "Discount effect for an excluded resource." - } - } - } - }, - "included": { - "type": "array", - "description": "Defines which items are included in a discount.", - "items": { - "type": "object", - "description": "Defines the included item.", - "properties": { - "object": { - "type": "string", - "enum": [ - "product", - "sku", - "products_collection" - ], - "description": "The type of object being included in the rule." - }, - "id": { - "type": "string", - "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." - }, - "source_id": { - "type": "string" - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Discount effect for an included resource." - }, - "quantity_limit": { - "type": "integer", - "description": "A limit on the number of units that at maximum can qualify for a discount. This property is present for an AMOUNT type discount when the effect is applied to ITEMS and each unit of matched products has the same discount value." - } + "metadata": { + "type": "object", + "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every given increment of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` order metadata property value, give `points`.", + "properties": { + "every": { + "type": "integer", + "description": "For how many increments of the custom event metadata property to grant points for.", + "example": 100 + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card.", + "example": 10 + }, + "property": { + "type": "string", + "example": "volume_number", + "description": "Custom event metadata property." } } - }, - "included_all": { - "type": "boolean", - "description": "Indicates whether all items are included in the discount." } } + } + } + }, + "8_res_list_loyalty_campaigns": { + "title": "List Loyalty Campaigns Response Body", + "type": "object", + "description": "Response body schema for listing loyalty campaigns using **GET** `/loyalties`.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about loyalty campaigns in a dictionary." }, - "created_at": { + "data_ref": { "type": "string", - "description": "Timestamp representing the date and time when the validation rule was created in ISO 8601 format.", - "example": "2022-04-07T07:42:44.442Z", - "format": "date-time" + "default": "campaigns", + "description": "Identifies the name of the attribute that contains the array of loyalty campaign objects." }, - "updated_at": { + "campaigns": { + "type": "array", + "description": "Contains an array of loyalty campaign objects.", + "items": { + "$ref": "#/components/schemas/8_obj_loyalty_campaign_object_no_extended_categories" + } + }, + "total": { + "type": "integer", + "description": "Total number of loyalty campaign objects." + } + } + }, + "8_req_create_loyalty_cards": { + "type": "object", + "title": "Create Loyalty Campaign Request Body", + "description": "Request body schema for creating a loyalty campaign.", + "properties": { + "name": { "type": "string", - "example": "2022-05-09T07:42:44.442Z", - "description": "Timestamp representing the date and time when the validation rule was updated in ISO 8601 format.", - "format": "date-time" + "description": "Campaign name." + }, + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." }, "type": { "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", "enum": [ - "basic", - "advanced", - "complex" - ], - "description": "Type of validation rule." + "AUTO_UPDATE", + "STATIC" + ] }, - "context_type": { + "auto_join": { + "type": "boolean", + "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. CONTEXT: `LOYALTY_PROGRAM`." + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "use_voucher_metadata_schema": { + "type": "boolean", + "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." + }, + "vouchers_count": { + "type": "integer", + "description": "Total number of unique vouchers in campaign (size of campaign)." + }, + "start_date": { "type": "string", - "enum": [ - "earning_rule.order.paid", - "earning_rule.custom_event", - "earning_rule.customer.segment.entered", - "campaign.discount_coupons", - "campaign.discount_coupons.discount.apply_to_order", - "campaign.discount_coupons.discount.apply_to_items", - "campaign.discount_coupons.discount.apply_to_items_proportionally", - "campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity", - "campaign.discount_coupons.discount.fixed.apply_to_items", - "campaign.gift_vouchers", - "campaign.gift_vouchers.gift.apply_to_order", - "campaign.gift_vouchers.gift.apply_to_items", - "campaign.referral_program", - "campaign.referral_program.discount.apply_to_order", - "campaign.referral_program.discount.apply_to_items", - "campaign.referral_program.discount.apply_to_items_proportionally", - "campaign.referral_program.discount.apply_to_items_proportionally_by_quantity", - "campaign.referral_program.discount.fixed.apply_to_items", - "campaign.promotion", - "campaign.promotion.discount.apply_to_order", - "campaign.promotion.discount.apply_to_items", - "campaign.promotion.discount.apply_to_items_proportionally", - "campaign.promotion.discount.apply_to_items_proportionally_by_quantity", - "campaign.promotion.discount.fixed.apply_to_items", - "campaign.loyalty_program", - "campaign.lucky_draw", - "voucher.discount_voucher", - "voucher.discount_voucher.discount.apply_to_order", - "voucher.discount_voucher.discount.apply_to_items", - "voucher.discount_voucher.discount.apply_to_items_proportionally", - "voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity", - "voucher.discount_voucher.discount.fixed.apply_to_items", - "voucher.gift_voucher", - "voucher.gift_voucher.gift.apply_to_order", - "voucher.gift_voucher.gift.apply_to_items", - "voucher.loyalty_card", - "voucher.lucky_draw_code", - "distribution.custom_event", - "reward_assignment.pay_with_points", - "global" - ], - "description": "Validation rule context type. \n\n| **Context Type** | **Definition** |\n|:---|:---|\n| earning_rule.order.paid | |\n| earning_rule.custom_event | |\n| earning_rule.customer.segment.entered | |\n| campaign.discount_coupons | |\n| campaign.discount_coupons.discount.apply_to_order | |\n| campaign.discount_coupons.discount.apply_to_items | |\n| campaign.discount_coupons.discount.apply_to_items_proportionally | |\n| campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.discount_coupons.discount.fixed.apply_to_items | |\n| campaign.gift_vouchers | |\n| campaign.gift_vouchers.gift.apply_to_order | |\n| campaign.gift_vouchers.gift.apply_to_items | |\n| campaign.referral_program | |\n| campaign.referral_program.discount.apply_to_order | |\n| campaign.referral_program.discount.apply_to_items | |\n| campaign.referral_program.discount.apply_to_items_proportionally | |\n| campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.referral_program.discount.fixed.apply_to_items | |\n| campaign.promotion | |\n| campaign.promotion.discount.apply_to_order | |\n| campaign.promotion.discount.apply_to_items | |\n| campaign.promotion.discount.apply_to_items_proportionally | |\n| campaign.promotion.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.promotion.discount.fixed.apply_to_items | |\n| campaign.loyalty_program | |\n| campaign.lucky_draw | |\n| voucher.discount_voucher | |\n| voucher.discount_voucher.discount.apply_to_order | |\n| voucher.discount_voucher.discount.apply_to_items | |\n| voucher.discount_voucher.discount.apply_to_items_proportionally | |\n| voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | |\n| voucher.discount_voucher.discount.fixed.apply_to_items | |\n| voucher.gift_voucher | |\n| voucher.gift_voucher.gift.apply_to_order | |\n| voucher.gift_voucher.gift.apply_to_items | |\n| voucher.loyalty_card | |\n| voucher.lucky_draw_code | |\n| distribution.custom_event | |\n| reward_assignment.pay_with_points | |\n| global | |" + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" }, - "assignments_count": { - "description": "The number of instances the validation rule has been assigned to different types of redeemables.", - "type": "integer" + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" }, - "object": { + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "activity_duration_after_publishing": { "type": "string", - "default": "validation_rules", - "description": "The type of object represented by each nested object in the JSON `data` array. This object stores information about the validation rules." - } - } - } - }, - "total": { - "type": "integer", - "description": "Total number of validation rules in the project." - } - } - }, - "13_obj_validation_rule_assignment_object": { - "title": "Validation Rule Assignment Object", - "type": "object", - "description": "This is an object representing a validation rule assignment. \n\nThis object stores an assignment of a: \n- [voucher](ref:get-voucher)\n- [campaign](ref:get-campaign)\n- [earning rule](ref:get-earning-rule)\n- [reward assignment](ref:get-reward-assignment)\n- [promotion tier](ref:list-promotion-tiers)\n- [publication](ref:list-publications)", - "x-tags": [ - "VALIDATION RULES API" - ], - "properties": { - "id": { - "type": "string", - "example": "asgm_74F7QZoYbUoljwQO", - "description": "Validation rule assignment ID." - }, - "rule_id": { - "type": "string", - "example": "val_4j7DCRm2IS59", - "description": "Validation rule ID." - }, - "related_object_id": { - "type": "string", - "example": "v_JtWunK6jUo7X2qOFj0SyRHq4p9tgENlT", - "description": "The resource ID to which the validation rule was assigned." - }, - "related_object_type": { - "type": "string", - "description": "The type of resource to which the validation rule was assigned.", - "enum": [ - "voucher", - "campaign", - "earning_rule", - "reward_assignment", - "promotion_tier", - "distribution" - ] - }, - "created_at": { - "type": "string", - "example": "2022-02-17T08:18:15.085Z", - "description": "Timestamp representing the date and time when the validation rule assignment was created in ISO 8601 format.", - "format": "date-time" - }, - "object": { - "type": "string", - "default": "validation_rules_assignment", - "description": "The type of object represented by the ID." - } - } - }, - "13_res_validation-rules_validationRuleId_assignments": { - "type": "object", - "description": "Validation Rule Assignments", - "title": "Validation Rule Assignments", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about validation rule assignments.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the JSON property that contains the array of validation rule assignments.", - "default": "data" - }, - "data": { - "type": "array", - "description": "A dictionary that contains an array of validation rule assignments.", - "items": { - "$ref": "#/components/schemas/13_obj_validation_rule_assignment_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of validation rule assignments." - } - } - }, - "13_req_create_validation_rule_assignments": { - "description": "Respone body schema for **POST** `/validation-rules/{validationRuleId}/assignments`.", - "title": "Create Validation Rule Assignments Request Body", - "oneOf": [ - { - "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_voucher" - }, - { - "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_campaign" - }, - { - "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_promotion_tier" - }, - { - "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_earning_rule" - }, - { - "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_reward" - }, - { - "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_distribution" - } - ] - }, - "13_req_create_validation_rule_assignments_voucher": { - "type": "object", - "description": "Assign a validation rule to a voucher.", - "title": "Voucher", - "properties": { - "voucher": { - "type": "string", - "description": "Unique voucher ID or code to which you would like to assign the validation rule to.", - "example": "v_ssR6vhswwh5odSloN2Vc3O60w7aea018" - } - } - }, - "13_req_create_validation_rule_assignments_campaign": { - "type": "object", - "description": "Assign a validation rule to a campaign.", - "title": "Campaign", - "properties": { - "campaign": { - "type": "string", - "description": "Unique campaign ID or name to which you would like to assign the validation rule to.", - "example": "camp_HXsR22VUMC4hN4DR7eAhCalp" - } - } - }, - "13_req_create_validation_rule_assignments_promotion_tier": { - "type": "object", - "description": "Assign a validation rule to a promotion tier.", - "title": "Promotion Tier", - "properties": { - "promotion_tier": { - "type": "string", - "description": "Unique promotion tier ID to which you would like to assign the validation rule to.", - "example": "promo_Vet0vCNyyo5pOddHfu2X3FCB" - } - } - }, - "13_req_create_validation_rule_assignments_earning_rule": { - "type": "object", - "description": "Assign a validation rule to an earning rule.", - "title": "Earning Rule", - "properties": { - "earning_rule": { - "type": "string", - "description": "Unique earning rule ID to which you would like to assign the validation rule to.", - "example": "ern_CfvQ4vWEKD4kHTxghdY8YJGs" - } - } - }, - "13_req_create_validation_rule_assignments_reward": { - "type": "object", - "description": "Assign a validation rule to a reward.", - "title": "Reward", - "properties": { - "related_object_id": { - "type": "string", - "description": "Unique reward assignment ID, i.e. rewa_6VSWcXjfm5PuZlfeuZxl5JZT. This is the first parameter to be sent for a validation rule assignment to be assigned to a reward assignment. The prerequisites for assigning a validation rule to a reward assignment are: \n1. Define a loyalty campaign. \n2. Connect a reward with the campaign. \n3. Retrieve a reward assignment ID for the reward assigned to the loyalty campaign. \n4. And finally you can use this endpoint to assign a validation rule to the particular reward assignment.", - "example": "rewa_6VSWcXjfm5PuZlfeuZxl5JZT" - }, - "related_object_type": { - "type": "string", - "description": "This is the second parameter that needs to be sent in order to properly assign a validation rule to a reward assignment.", - "example": "reward_assignment", - "default": "reward_assignment", - "enum": [ - "reward_assignment" - ] - } - } - }, - "13_req_create_validation_rule_assignments_distribution": { - "type": "object", - "description": "Assign a validation rule to a distribution.", - "title": "Distribution", - "properties": { - "distribution": { - "type": "string", - "description": "Unique distribution ID to which you would like to assign the validation rule to.", - "example": "distr_2nUIekYnS9L1Vm1I55vmC7kSvd" - } - } - }, - "14_obj_segment_object": { - "title": "Customer Segment Object", - "type": "object", - "properties": { - "id": { - "type": "string", - "example": "seg_1wc52c5z6r1kQ81brO8j9Hk2", - "description": "Unique segment ID." - }, - "name": { - "type": "string", - "description": "Segment name." - }, - "created_at": { - "type": "string", - "example": "2022-05-12T13:01:56.896Z", - "description": "Timestamp representing the date and time when the segment was created in ISO 8601 format.", - "format": "date-time" - }, - "type": { - "type": "string", - "enum": [ - "auto-update", - "static" - ], - "description": "Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers)." - }, - "filter": { - "type": [ - "object", - "null" - ], - "description": "Defines a set of criteria for an `auto-update` segment type. " - }, - "initial_sync_status": { - "type": "string", - "enum": [ - "IN_PROGRESS", - "DONE" - ] - }, - "object": { - "type": "string", - "default": "segment", - "description": "The type of object represented by JSON. This object stores information about the customer segment." - } - }, - "description": "This is an object representing a customer segment.", - "x-tags": [ - "SEGMENTS API" - ] - }, - "14_req_create_segment": { - "title": "Create Customer Segment Request Body", - "description": "Request body schema for **POST** `/segments`.", - "oneOf": [ - { - "$ref": "#/components/schemas/14_req_create_segment_static" - }, - { - "$ref": "#/components/schemas/14_req_create_segment_dynamic" - } - ] - }, - "14_req_create_segment_static": { - "title": "Static Customer Segment", - "type": "object", - "description": "Request body schema for creating a static customer segment in **POST** `/segments`.", - "properties": { - "name": { - "type": "string", - "description": "Segment name." - }, - "type": { - "type": "string", - "description": "Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers).", - "default": "static" - }, - "customers": { - "type": "array", - "description": "Array of customer IDs.", - "items": {} - } - } - }, - "14_req_create_segment_dynamic": { - "title": "Dynamic Customer Segment", - "type": "object", - "description": "Request body schema for creating a dynamic customer segment in **POST** `/segments`.", - "properties": { - "name": { - "type": "string", - "description": "Segment name." - }, - "type": { - "type": "string", - "description": "Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers).", - "default": "auto-update" - }, - "filter": { - "type": "object", - "description": "Defines a set of criteria for an `auto-update` segment type." - } - } - }, - "14_res_customers_customerId_segments": { - "type": "object", - "title": "List Segments for Customer Response Body", - "description": "Response body schema for `/customers/{customerId}/segments`.", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about customer segments.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the JSON property that contains the array of segment IDs.", - "default": "data" - }, - "data": { - "type": "array", - "description": "A dictionary that contains an array of segment IDs and names.", - "items": { - "type": "object", - "properties": { - "id": { + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "loyalty_tiers_expiration": { + "type": "object", + "description": "Defines the expiration mechanism for loyalty tiers.", + "anyOf": [ + { + "$ref": "#/components/schemas/8_loyalty_tiers_expiration_balance" + }, + { + "$ref": "#/components/schemas/8_loyalty_tiers_expiration_points_in_period" + } + ] + }, + "category_id": { "type": "string", - "description": "Unique segment ID.", - "example": "seg_DNAOhUtJffvX0f57ajLMFBYR" + "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", + "example": "cat_0b688929a2476386a7" }, - "name": { + "category": { "type": "string", - "description": "Segment name." + "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." }, - "object": { + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + }, + "voucher": { + "$ref": "#/components/schemas/2_req_campaign_object_voucher_object_LOYALTY_CARD" + } + } + }, + "8_loyalty_tiers_expiration_balance": { + "title": "Balance", + "type": "object", + "description": "Defines the Balance expiration mechanism for loyalty tiers.", + "properties": { + "qualification_type": { "type": "string", - "description": "The type of object represented by the ID.", - "default": "segment" + "enum": [ + "BALANCE" + ], + "description": "Tier qualification. \n\n`BALANCE`: Points balance is based on the customer's current points balance. Customers qualify for the tier if their points balance is in the points range of the tier." + }, + "start_date": { + "type": "object", + "description": "Defines the conditions for the start date of the tier.", + "properties": { + "type": { + "type": "string", + "enum": [ + "IMMEDIATE" + ], + "description": "What triggers the tier to be valid for a customer. \n`IMMEDIATE`: After reaching the minimum required points." + } + } + }, + "expiration_date": { + "description": "Defines the conditions for the expiration date of a tier.", + "anyOf": [ + { + "$ref": "#/components/schemas/8_loyalty_tiers_expiration_balance_expiration_date_balance_drop" + }, + { + "$ref": "#/components/schemas/8_loyalty_tiers_expiration_balance_expiration_date_custom" + } + ] } } - } - }, - "total": { - "type": "integer", - "description": "Total number of segments the customer belongs to." - } - } - }, - "15_obj_event_object": { - "title": "Event Object", - "type": "object", - "description": "This is an object representing an event. \n\nVoucherify distinguishes two types of events - custom and internal. Both are presented in the same Event structure. \n\n## Custom Events\n\nCustom Events are actions taken by your customers. They’re best suited for tracking high-value customer interactions with your application. Logging a custom event can trigger any number of distributions, and enables the segmentation filters around the recency and frequency of that event.\n\nWith Custom Event metadata field, Voucherify allows you to set properties on custom events. These properties can then be used for further qualifying trigger conditions, increasing personalization in messaging, and generating more sophisticated analytics through raw data export.\n\nThe Custom Events are directly linked to the customers' resources from Voucherify. It means that each event gets a connection to a customer. \n\n\n> #### An example \n>\n> If an e-commerce application wanted to send a message to a user when he/she abandons their cart, the custom event could additionally improve its target audience and allow for increased distribution personalization by adding a Custom Event of the `value` of customers’ order.\n\n## Internal Voucherify Events \n\nMoreover, Events are our way of letting you know when something interesting happens in your project. When an interesting event occurs, we create a new Event object. For example, when a redemption succeeds, we create a `redemption.succeeded` event.\n\nNote that many API requests may cause multiple events to be created. For example, if you create a new redemption for a new customer not existing yet in Voucherify, you will receive both a `customer.created` event and a `redemption.succeeded` event.\n\nThe events occur when the state of another API resource changes and the state of that resource at the time of the change is embedded in the data field of the event. \n\n| **Types of internal events** |\n|:---|\n| **Campaign** |\n| campaign.validation_rules.created
campaign.created
campaign.disabled
campaign.export_mailchimp_scheduled
campaign.export_mailchimp_done
campaign.validation_rules.deleted
campaign.validation_rules.updated
campaign.updated
campaign.deleted
campaign.export_mailchimp_failed
campaign.enabled |\n| **Voucher** |\n| voucher.validation.succeeded
voucher.updated
voucher.enabled
voucher.gift.balance_added
voucher.validation_rules.updated
voucher.published
voucher.validation_rules.deleted
voucher.disabled
voucher.validation.failed
voucher.validation_rules.created
voucher.deleted
voucher.created |\n| **Redemption** |\n| redemption.succeeded
redemption.failed
redemption.rollback.failed
redemption.rollback.succeeded |\n| **Customer** |\n| customer.rewarded
customer.rewarded.loyalty_points
customer.sms.sent
customer.email.failed
customer.deleted
customer.created
customer.updated
customer.segment.left
customer.sms.failed
customer.segment.entered
customer.email.sent |\n| **Order** |\n| order.canceled
order.created
order.updated
order.paid |\n| **Product** |\n| product.updated
product.created
product.deleted |\n| **SKU** |\n| sku.updated
sku.created
sku.deleted |\n| **Distribution** |\n| distribution.sms.failed
distribution.sms.sent
distribution.email.sent
distribution.email.failed |\n| **Export** |\n| export.done
export.scheduled
export.failed
export.deleted | \n\n## Webhooks \n\nVoucherify also has a separate system for sending the event objects directly to an endpoint at your end (server). We called that mechanism webhooks. They are managed in your project settings. \n\n| **Attribute** | **Description** | **Example** |\n|:---|:---|:---|\n| `id`
string | | event_xjGas2mI2PduFFPL2NAcFeHkHfLn3H |\n| `object`
string | Type of the object represented by JSON. Value is `event`. | |\n| `created_at`
string, ISO 8601 date format | Time at which the object was created. | 2016-11-16T14:14:31Z |\n| `type`
string | Description of the event | view_pricing_page
redemption.succeeded |\n| `data.object`
object | The object containing data associated with the event. It can be a `customer`, `redemption` or any other type of object which is a source of the event. In this object structure, you can also find a property `related_object` which contains values presenting any other resource connected to the event.

For Custom Event the structure of child attributes is constant:

- customer (`object`) - The object presenting a profile of the related customer who performed an action.

- metadata (`object`) - A set of key/value pairs that you can attach to a custom event object. It can be useful for storing additional information about the event in a structured format. | \"data\": { \"object\": { \"customer\": { \"id\": \"cust_OtHDKrv5sJrjd8aYBYZ6AOIF\", \"name\": \"Gustav Purpleson\", \"object\": \"customer\", \"source_id\": \"gustav@purpleson.com\", \"created_at\": 1510834859417, \"updated_at\": 1510835106559 }, \"metadata\": { \"lang\": \"en\", \"test\": true, \"page\": \"http://main.io\" } } } |\n| `metadata`
object | A set of key/value pairs that Voucherify attaches to a custom event object. It is a set of additional system information about the event in a structured format. | |\n\n\n```json\n{\n \"id\": \"event_ehkvgZFgSePlb95SH3JJulkApy9Kg9\",\n \"object\": \"event\",\n \"created_at\": \"2017-11-16T14:45:34.181Z\",\n \"type\": \"redemption.succeeded\",\n \"data\": {\n \"object\": {\n \"id\": \"r_mist0IpebikTaRdxiOGI2IhL\",\n \"date\": \"2017-11-16T14:45:32.733Z\",\n \"order\": {\n \"id\": \"ord_AhDlR13vQE5ino95P2NIABBN\",\n \"items\": [\n {\n \"object\": \"order_item\",\n \"sku_id\": null,\n \"quantity\": 1,\n \"source_id\": null,\n \"product_id\": \"iphone8\"\n }\n ],\n \"amount\": 50000,\n \"object\": \"order\",\n \"status\": \"CREATED\",\n \"customer\": {\n \"id\": \"cust_fJPsoub5ITJnIEVO3v9whrP9\",\n \"object\": \"customer\"\n },\n \"metadata\": null,\n \"referrer\": null,\n \"source_id\": null,\n \"created_at\": \"2017-11-16T14:45:32.023Z\",\n \"updated_at\": null,\n \"discount_amount\": 2000\n },\n \"object\": \"redemption\",\n \"result\": \"SUCCESS\",\n \"voucher\": {\n \"code\": \"2017-goX-aH\",\n \"gift\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"object\": \"voucher\",\n \"campaign\": \"SteffenTest\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"amount_off\": 2000\n },\n \"is_referral_code\": false\n },\n \"customer\": {\n \"id\": \"cust_fJPsoub5ITJnIEVO3v9whrP9\",\n \"object\": \"customer\"\n },\n \"metadata\": {\n \"city\": \"London1\"\n },\n \"customer_id\": \"cust_fJPsoub5ITJnIEVO3v9whrP9\",\n \"tracking_id\": \"track_3tM7KR57bbeIRtMcvpKYr2aAOrCpYBDZ\",\n \"related_object_type\": \"voucher\"\n },\n \"previous_attributes\": {}\n },\n \"metadata\": {\n \"source\": \"API\"\n }\n}\n```\n\n## Customisable Campaign Events \n\nAs part of campaign creation, users can configure webhooks triggered when specific activities appear within a campaign's lifetime. Those webhooks get configurable names and the users implement them in Voucherify Dashboard as part of the campaign creation process.\n\nThis type of webhooks can be configured for the following actions: \n\n| **Action** |\n|:---|\n| **Referral Program** |\n| Referrer rewarded
Referral code assigned
Customer referred |\n| **Loyalty Campaign** |\n| Loyalty card assigned
Points earned
Points redeemed | \n\nPayloads of customizable webhooks:\n\n### Referral Program\n\n\n```json\n{\n \"id\": \"evcus_0a26b1a5acd3437894\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-01-24T11:09:57.765Z\",\n \"type\": \"referral_code_assigned\",\n \"data\": {\n \"object\": {\n \"voucher\": {\n \"id\": \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\",\n \"code\": \"xYwEheRh\",\n \"campaign\": \"Referral Webhooks\",\n \"campaign_id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"category\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"amount_off\": 1000,\n \"effect\": \"APPLY_TO_ORDER\"\n },\n \"gift\": null,\n \"loyalty_card\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX19wsHlNj5GT/2Kkf/MnPKlL4WjU55GyTsmpXgw+KQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy/OHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va+MFPSHRy5tesDQ==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19wsHlNj5GT%2F2Kkf%2FMnPKlL4WjU55GyTsmpXgw%2BKQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy%2FOHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va%2BMFPSHRy5tesDQ%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19ZgrgURtgcjD1cvt/L6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i/UVUbmXTxDvNXsceP+nzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19ZgrgURtgcjD1cvt%2FL6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i%2FUVUbmXTxDvNXsceP%2BnzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w%3D%3D\"\n }\n },\n \"is_referral_code\": true,\n \"created_at\": \"2021-11-12T11:09:57.772Z\",\n \"updated_at\": null,\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"referrer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/xYwEheRh/redemptions?page=1&limit=10\"\n },\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/xYwEheRh/publications?page=1&limit=10\"\n },\n \"object\": \"voucher\"\n },\n \"campaign\": {\n \"id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"name\": \"Referral Webhooks\",\n \"campaign_type\": \"REFERRAL_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"voucher\": {\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"amount_off\": 1000,\n \"effect\": \"APPLY_TO_ORDER\"\n },\n \"gift\": null,\n \"loyalty_card\": null,\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"prefix\": \"\",\n \"postfix\": \"\"\n },\n \"is_referral_code\": true\n },\n \"referral_program\": {\n \"conversion_event_type\": \"redemption\"\n },\n \"join_once\": false,\n \"use_voucher_metadata_schema\": true,\n \"vouchers_count\": 1,\n \"active\": true,\n \"metadata\": {},\n \"created_at\": \"2021-11-12T11:00:08.306Z\",\n \"updated_at\": \"2021-11-12T11:09:40.671Z\",\n \"creation_status\": \"DONE\",\n \"vouchers_generation_status\": \"DONE\",\n \"object\": \"campaign\"\n },\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"source_id\": \"test_referrer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0\n },\n \"orders\": {\n \"total_amount\": 0,\n \"total_count\": 0,\n \"average_amount\": null,\n \"last_order_amount\": null,\n \"last_order_date\": null\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 0,\n \"campaigns\": {}\n },\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-11-12T11:09:57.749Z\",\n \"updated_at\": \"2021-11-12T11:09:58.620Z\",\n \"object\": \"customer\"\n },\n \"publication\": {\n \"id\": \"pub_gSpZUNX0hcDfEeRx3qIMMFrtfsZjeJO8\",\n \"object\": \"publication\",\n \"result\": \"SUCCESS\",\n \"channel\": \"API\",\n \"voucher\": {\n \"id\": \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\",\n \"code\": \"xYwEheRh\",\n \"gift\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"active\": true,\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX19wsHlNj5GT/2Kkf/MnPKlL4WjU55GyTsmpXgw+KQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy/OHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va+MFPSHRy5tesDQ==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19wsHlNj5GT%2F2Kkf%2FMnPKlL4WjU55GyTsmpXgw%2BKQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy%2FOHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va%2BMFPSHRy5tesDQ%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19ZgrgURtgcjD1cvt/L6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i/UVUbmXTxDvNXsceP+nzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19ZgrgURtgcjD1cvt%2FL6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i%2FUVUbmXTxDvNXsceP%2BnzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w%3D%3D\"\n }\n },\n \"object\": \"voucher\",\n \"publish\": {\n \"url\": \"/v1/vouchers/xYwEheRh/publications?page=1&limit=10\",\n \"count\": 1,\n \"object\": \"list\"\n },\n \"campaign\": \"Referral Webhooks\",\n \"category\": null,\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"metadata\": {},\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"created_at\": \"2021-11-12T11:09:57.772Z\",\n \"redemption\": {\n \"url\": \"/v1/vouchers/xYwEheRh/redemptions?page=1&limit=10\",\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"start_date\": null,\n \"updated_at\": null,\n \"campaign_id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"referrer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"loyalty_card\": null,\n \"distributions\": null,\n \"additional_info\": null,\n \"expiration_date\": null,\n \"is_referral_code\": true,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"referred_customers_count\": null,\n \"value\": \"$10.00\"\n },\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"object\": \"customer\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"source_id\": \"test_referrer__01\"\n },\n \"metadata\": {},\n \"source_id\": null,\n \"created_at\": \"2021-11-12T11:09:57.765Z\",\n \"customer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"tracking_id\": \"test_referrer__01\",\n \"vouchers_id\": [\n \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\"\n ]\n }\n },\n \"related_object\": {\n \"id\": \"evcus_0a26b1a5acd3437894\",\n \"type\": \"customer.publication.succeeded\",\n \"data\": {\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"test_referrer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"campaign\": {\n \"id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"name\": \"Referral Webhooks\",\n \"campaign_type\": \"REFERRAL_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"is_referral_code\": true,\n \"voucher\": {\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n }\n },\n \"referral_program\": {\n \"conversion_event_type\": \"redemption\"\n },\n \"auto_join\": null,\n \"join_once\": false,\n \"active\": true\n },\n \"publication\": {\n \"id\": \"pub_gSpZUNX0hcDfEeRx3qIMMFrtfsZjeJO8\",\n \"object\": \"publication\",\n \"result\": \"SUCCESS\",\n \"channel\": \"API\",\n \"voucher\": {\n \"id\": \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\",\n \"code\": \"xYwEheRh\",\n \"gift\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"active\": true,\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX19wsHlNj5GT/2Kkf/MnPKlL4WjU55GyTsmpXgw+KQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy/OHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va+MFPSHRy5tesDQ==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19wsHlNj5GT%2F2Kkf%2FMnPKlL4WjU55GyTsmpXgw%2BKQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy%2FOHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va%2BMFPSHRy5tesDQ%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19ZgrgURtgcjD1cvt/L6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i/UVUbmXTxDvNXsceP+nzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19ZgrgURtgcjD1cvt%2FL6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i%2FUVUbmXTxDvNXsceP%2BnzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w%3D%3D\"\n }\n },\n \"object\": \"voucher\",\n \"publish\": {\n \"url\": \"/v1/vouchers/xYwEheRh/publications?page=1&limit=10\",\n \"count\": 1,\n \"object\": \"list\"\n },\n \"campaign\": \"Referral Webhooks\",\n \"category\": null,\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"metadata\": {},\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"created_at\": \"2021-11-12T11:09:57.772Z\",\n \"redemption\": {\n \"url\": \"/v1/vouchers/xYwEheRh/redemptions?page=1&limit=10\",\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"start_date\": null,\n \"updated_at\": null,\n \"campaign_id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"referrer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"loyalty_card\": null,\n \"distributions\": null,\n \"additional_info\": null,\n \"expiration_date\": null,\n \"is_referral_code\": true,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"referred_customers_count\": null\n },\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"object\": \"customer\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"source_id\": \"test_referrer__01\"\n },\n \"metadata\": {},\n \"source_id\": null,\n \"created_at\": \"2021-11-12T11:09:57.765Z\",\n \"customer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"tracking_id\": \"test_referrer__01\",\n \"vouchers_id\": [\n \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\"\n ]\n }\n },\n \"created_at\": \"2021-11-12T11:09:57.765Z\"\n }\n },\n \"metadata\": {}\n}\n```\n\n```json\n{\n \"id\": \"evcus_0a26b3e7b718c480ca\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-01-24T11:19:49.723Z\",\n \"type\": \"referrer_rewarded_webhook\",\n \"data\": {\n \"object\": {\n \"voucher\": {\n \"id\": \"v_2teI9HcRvdvK1RsWD6gyNztHr4SMkMDy\",\n \"code\": \"dOzJ84Ky\",\n \"campaign\": \"Bonus Cards\",\n \"campaign_id\": \"camp_yheSCBQGrgeBwGMkQqjsUW24\",\n \"category\": null,\n \"type\": \"GIFT_VOUCHER\",\n \"discount\": null,\n \"gift\": {\n \"amount\": 500,\n \"balance\": 500\n },\n \"loyalty_card\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX1+tdyBGQeM+ZONM/k\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1+tdyBGQeM+ZONM/k\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1+WOEBHpX4y\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BWOEBHpX4y\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-01-24T11:19:40.409Z\",\n \"updated_at\": \"2021-01-24T11:19:41.518Z\",\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"redemption\": {\n \"quantity\": 1,\n \"redeemed_quantity\": 0,\n \"redeemed_amount\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/dOzJ84Ky/redemptions?page=1&limit=10\"\n },\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/dOzJ84Ky/publications?page=1&limit=10\"\n },\n \"object\": \"voucher\"\n },\n \"campaign\": {\n \"id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"name\": \"Referral Webhooks\",\n \"campaign_type\": \"REFERRAL_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"voucher\": {\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n },\n \"is_referral_code\": true\n },\n \"referral_program\": {\n \"conversion_event_type\": \"redemption\"\n },\n \"join_once\": false,\n \"vouchers_count\": 0,\n \"active\": true,\n \"object\": \"campaign\"\n },\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"source_id\": \"test_referrer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0\n },\n \"orders\": {\n \"total_amount\": 0,\n \"total_count\": 0,\n \"average_amount\": null,\n \"last_order_amount\": null\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 1,\n \"campaigns\": {\n \"Referral Webhooks\": {\n \"points\": 0,\n \"referred_customers\": 1\n }\n }\n },\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-01-24T11:09:57.749Z\",\n \"updated_at\": \"2021-01-24T11:19:41.513Z\",\n \"object\": \"customer\"\n },\n \"publication\": {\n \"id\": \"pub_9Y7nwUx3BaU3cHqBVbd0TEtS2ENiFZhJ\",\n \"created_at\": \"2021-01-24T11:19:40.317Z\",\n \"customer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"test_referrer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"tracking_id\": \"test_referrer__01\",\n \"metadata\": {},\n \"channel\": \"Automation\",\n \"source_id\": null,\n \"result\": \"SUCCESS\",\n \"voucher_code\": \"dOzJ84Ky\",\n \"vouchers\": [\n {\n \"id\": \"v_2teI9HcRvdvK1RsWD6gyNztHr4SMkMDy\",\n \"code\": \"dOzJ84Ky\",\n \"campaign\": \"Bonus Cards\",\n \"campaign_id\": \"camp_yheSCBQGrgeBwGMkQqjsUW24\",\n \"category\": null,\n \"type\": \"GIFT_VOUCHER\",\n \"discount\": null,\n \"gift\": {\n \"amount\": 500,\n \"balance\": 500\n },\n \"loyalty_card\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX1+tdyBGQeM+ZONM/kBdZ\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BtdyBGQeM%2BZONM%2FkBdZ\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1+WOEBHpX4y\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BWOEBHpX4y\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-01-24T11:19:40.409Z\",\n \"updated_at\": \"2021-01-24T11:19:41.518Z\",\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"object\": \"voucher\",\n \"distributions\": null,\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/dOzJ84Ky/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"quantity\": 1,\n \"redeemed_quantity\": 0,\n \"redeemed_amount\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/dOzJ84Ky/redemptions?page=1&limit=10\"\n }\n }\n ],\n \"vouchers_id\": [\n \"v_2teI9HcRvdvK1RsWD6gyNztHr4SMkMDy\"\n ],\n \"campaign_name\": \"Bonus Cards\",\n \"gift\": {\n \"amount\": 0,\n \"balance\": 0\n },\n \"loyalty_card\": null,\n \"discount\": null,\n \"is_referral_code\": false,\n \"failure_code\": null,\n \"failure_message\": null,\n \"voucher\": null\n }\n },\n \"related_object\": {\n \"id\": \"evcus_0a26b3e7b718c480ca\",\n \"type\": \"customer.reward_redemptions.completed\",\n \"data\": {\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"test_referrer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"holder\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"test_referrer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"voucher\": {\n \"id\": \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\",\n \"code\": \"xYwEheRh\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"amount_off\": 1000,\n \"effect\": \"APPLY_TO_ORDER\"\n },\n \"type\": \"DISCOUNT_VOUCHER\",\n \"campaign\": \"Referral Webhooks\",\n \"campaign_id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"is_referral_code\": true,\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"referrer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\"\n },\n \"campaign\": {\n \"id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"name\": \"Referral Webhooks\",\n \"campaign_type\": \"REFERRAL_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"is_referral_code\": true,\n \"voucher\": {\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n }\n },\n \"referral_program\": {\n \"conversion_event_type\": \"redemption\"\n },\n \"auto_join\": null,\n \"join_once\": false,\n \"active\": true\n },\n \"reward_redemption\": {\n \"id\": \"rewr_Fuzc1rngCCuKRDfBXBjUwl5j\",\n \"state\": \"COMPLETED\",\n \"created_at\": \"2021-01-24T11:19:43.883Z\",\n \"updated_at\": null,\n \"voucher_id\": \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\",\n \"campaign_id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"customer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"reward_assignment_id\": \"rewa_9FxFsy0M5UYc8jWjNrlSBWtG\",\n \"source_id\": \"event_0a26b3d269013fc79e\",\n \"source_type\": \"redemption_event\"\n },\n \"reward\": {\n \"assignment_id\": \"rewa_9FxFsy0M5UYc8jWjNrlSBWtG\",\n \"voucher\": {\n \"id\": \"v_2teI9HcRvdvK1RsWD6gyNztHr4SMkMDy\",\n \"code\": \"dOzJ84Ky\",\n \"gift\": {\n \"amount\": 500,\n \"balance\": 500\n },\n \"type\": \"GIFT_VOUCHER\",\n \"campaign\": \"Bonus Cards\",\n \"campaign_id\": \"camp_yheSCBQGrgeBwGMkQqjsUW24\",\n \"is_referral_code\": false,\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\"\n },\n \"id\": \"rew_e5taIjbo05k2vODIJtZ7mGED\",\n \"object\": \"reward\",\n \"name\": \"Credits - 5$\",\n \"type\": \"CAMPAIGN\"\n },\n \"reward_assignment\": {\n \"id\": \"rewa_9FxFsy0M5UYc8jWjNrlSBWtG\",\n \"reward_id\": \"rew_e5taIjbo05k2vODIJtZ7mGED\",\n \"related_object_id\": \"rrt_NWk1WYi1sZs3Epjvvd5a9JZx\",\n \"related_object_type\": \"referral_tier\",\n \"created_at\": \"2021-01-24T11:00:08.471Z\",\n \"updated_at\": null,\n \"object\": \"reward_assignment\"\n },\n \"source\": {\n \"id\": \"event_0a26b3d269013fc79e\",\n \"type\": \"redemption_event\"\n },\n \"balance\": {\n \"amount\": 500\n }\n },\n \"created_at\": \"2021-01-24T11:19:49.723Z\"\n }\n },\n \"metadata\": {}\n}\n```\n\n```json\n{\n \"id\": \"event_0a26b3d893cc3ac160\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-01-24T11:19:41.101Z\",\n \"type\": \"referee_invited\",\n \"data\": {\n \"object\": {\n \"order\": {},\n \"campaign\": {\n \"object\": \"campaign\",\n \"id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"name\": \"Referral Webhooks\",\n \"campaign_type\": \"REFERRAL_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"description\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"activity_duration_after_publishing\": null,\n \"vouchers_count\": 0,\n \"updated_at\": \"2021-01-24T11:09:40.671Z\",\n \"created_at\": \"2021-01-24T11:00:08.306Z\",\n \"active\": true,\n \"metadata\": {},\n \"vouchers_generation_status\": \"DONE\",\n \"category\": null,\n \"voucher\": {\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"gift\": null,\n \"loyalty_card\": null,\n \"redemption\": {\n \"quantity\": null\n },\n \"code_config\": {\n \"length\": 8,\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\"\n }\n },\n \"referral_program\": {\n \"conversion_event_type\": \"redemption\"\n },\n \"lucky_draw\": null\n },\n \"customer\": {\n \"id\": \"cust_BfTxUsoofap6Sb6oxG1BLCi5\",\n \"source_id\": \"referred_001\",\n \"name\": null,\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0,\n \"gift\": {\n \"redeemed_amount\": 0,\n \"amount_to_go\": 0\n },\n \"loyalty_card\": {\n \"redeemed_points\": 0,\n \"points_to_go\": 0\n }\n },\n \"orders\": {\n \"total_amount\": 25000,\n \"total_count\": 1,\n \"average_amount\": 25000,\n \"last_order_amount\": 25000,\n \"last_order_date\": \"2021-01-24T11:19:28.598Z\"\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 0,\n \"campaigns\": {}\n },\n \"metadata\": {\n \"vip\": true\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-01-24T11:19:27.844Z\",\n \"updated_at\": \"2021-01-24T11:19:28.926Z\",\n \"email_unsubscribed\": false,\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"object\": \"customer\"\n }\n },\n \"related_object\": {\n \"id\": \"event_0a26b3d893cc3ac160\",\n \"type\": \"customer.referred\",\n \"created_at\": \"2021-01-24T11:19:34.223Z\",\n \"data_json\": {\n \"object\": {\n \"id\": \"cust_BfTxUsoofap6Sb6oxG1BLCi5\",\n \"source_id\": \"referred_001\",\n \"name\": null,\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0,\n \"gift\": {\n \"redeemed_amount\": 0,\n \"amount_to_go\": 0\n },\n \"loyalty_card\": {\n \"redeemed_points\": 0,\n \"points_to_go\": 0\n }\n },\n \"orders\": {\n \"total_amount\": 25000,\n \"total_count\": 1,\n \"average_amount\": 25000,\n \"last_order_amount\": 25000,\n \"last_order_date\": \"2021-01-24T11:19:28.598Z\"\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 0,\n \"campaigns\": {}\n },\n \"metadata\": {\n \"vip\": true\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-01-24T11:19:27.844Z\",\n \"updated_at\": \"2021-01-24T11:19:28.926Z\",\n \"email_unsubscribed\": false,\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"object\": \"customer\"\n },\n \"previous_attributes\": {},\n \"related_object\": {}\n },\n \"metadata_json\": {\n \"is_rewarded\": true,\n \"source\": null\n },\n \"automation_id\": null,\n \"group_id\": \"v-0a26b3d24b032c4871\"\n }\n },\n \"metadata\": {}\n}\n```\n\n### Loyalty Campaign \n\n\n```json\n{\n \"id\": \"evcus_0a26b89763051ed721\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-11-12T11:40:18.125Z\",\n \"type\": \"loyalty_code_assigned\",\n \"data\": {\n \"object\": {\n \"voucher\": {\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"code\": \"qjvEslzU\",\n \"campaign\": \"Loyalty Webhooks\",\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"category\": null,\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf/oALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf%2FoALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1/ICHe/XvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU+S0A4SpuuDsMXXotf/AOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FICHe%2FXvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU%2BS0A4SpuuDsMXXotf%2FAOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-11-12T11:40:18.138Z\",\n \"updated_at\": null,\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0,\n \"redeemed_points\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/qjvEslzU/redemptions?page=1&limit=10\"\n },\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/qjvEslzU/publications?page=1&limit=10\"\n },\n \"object\": \"voucher\"\n },\n \"campaign\": {\n \"id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"name\": \"Loyalty Webhooks\",\n \"campaign_type\": \"LOYALTY_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"voucher\": {\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"prefix\": \"\",\n \"postfix\": \"\"\n },\n \"is_referral_code\": false\n },\n \"auto_join\": false,\n \"join_once\": false,\n \"use_voucher_metadata_schema\": true,\n \"vouchers_count\": 0,\n \"active\": true,\n \"metadata\": {},\n \"created_at\": \"2021-11-12T11:39:05.254Z\",\n \"creation_status\": \"DONE\",\n \"vouchers_generation_status\": \"DONE\",\n \"object\": \"campaign\"\n },\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"source_id\": \"Loyal_customer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0\n },\n \"orders\": {\n \"total_amount\": 0,\n \"total_count\": 0,\n \"average_amount\": null,\n \"last_order_amount\": null\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 0,\n \"campaigns\": {}\n },\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-11-12T11:40:18.077Z\",\n \"updated_at\": \"2021-11-12T11:40:19.724Z\",\n \"object\": \"customer\"\n },\n \"publication\": {\n \"id\": \"pub_ZAS0kZMqzF8LG5y55nx6dHMx2GkVPmxP\",\n \"object\": \"publication\",\n \"result\": \"SUCCESS\",\n \"channel\": \"API\",\n \"voucher\": {\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"code\": \"qjvEslzU\",\n \"gift\": null,\n \"type\": \"LOYALTY_CARD\",\n \"active\": true,\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf/oALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf%2FoALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1/ICHe/XvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU+S0A4SpuuDsMXXotf/AOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FICHe%2FXvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU%2BS0A4SpuuDsMXXotf%2FAOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA%3D%3D\"\n }\n },\n \"object\": \"voucher\",\n \"publish\": {\n \"url\": \"/v1/vouchers/qjvEslzU/publications?page=1&limit=10\",\n \"count\": 1,\n \"object\": \"list\"\n },\n \"campaign\": \"Loyalty Webhooks\",\n \"category\": null,\n \"discount\": null,\n \"metadata\": {},\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"created_at\": \"2021-11-12T11:40:18.138Z\",\n \"redemption\": {\n \"url\": \"/v1/vouchers/qjvEslzU/redemptions?page=1&limit=10\",\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_points\": 0,\n \"redeemed_quantity\": 0\n },\n \"start_date\": null,\n \"updated_at\": null,\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"distributions\": null,\n \"additional_info\": null,\n \"expiration_date\": null,\n \"is_referral_code\": false,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"value\": 0\n },\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"object\": \"customer\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"source_id\": \"Loyal_customer__01\"\n },\n \"metadata\": {},\n \"source_id\": null,\n \"created_at\": \"2021-11-12T11:40:18.125Z\",\n \"customer_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"tracking_id\": \"Loyal_customer__01\",\n \"vouchers_id\": [\n \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\"\n ]\n }\n },\n \"related_object\": {\n \"id\": \"evcus_0a26b89763051ed721\",\n \"type\": \"customer.publication.succeeded\",\n \"data\": {\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"Loyal_customer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"campaign\": {\n \"id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"name\": \"Loyalty Webhooks\",\n \"campaign_type\": \"LOYALTY_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"is_referral_code\": false,\n \"voucher\": {\n \"type\": \"LOYALTY_CARD\",\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n }\n },\n \"auto_join\": false,\n \"join_once\": false,\n \"active\": true\n },\n \"publication\": {\n \"id\": \"pub_ZAS0kZMqzF8LG5y55nx6dHMx2GkVPmxP\",\n \"object\": \"publication\",\n \"result\": \"SUCCESS\",\n \"channel\": \"API\",\n \"voucher\": {\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"code\": \"qjvEslzU\",\n \"gift\": null,\n \"type\": \"LOYALTY_CARD\",\n \"active\": true,\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf/oALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf%2FoALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1/ICHe/XvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU+S0A4SpuuDsMXXotf/AOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FICHe%2FXvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU%2BS0A4SpuuDsMXXotf%2FAOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA%3D%3D\"\n }\n },\n \"object\": \"voucher\",\n \"publish\": {\n \"url\": \"/v1/vouchers/qjvEslzU/publications?page=1&limit=10\",\n \"count\": 1,\n \"object\": \"list\"\n },\n \"campaign\": \"Loyalty Webhooks\",\n \"category\": null,\n \"discount\": null,\n \"metadata\": {},\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"created_at\": \"2021-11-12T11:40:18.138Z\",\n \"redemption\": {\n \"url\": \"/v1/vouchers/qjvEslzU/redemptions?page=1&limit=10\",\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_points\": 0,\n \"redeemed_quantity\": 0\n },\n \"start_date\": null,\n \"updated_at\": null,\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"distributions\": null,\n \"additional_info\": null,\n \"expiration_date\": null,\n \"is_referral_code\": false,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null\n },\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"object\": \"customer\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"source_id\": \"Loyal_customer__01\"\n },\n \"metadata\": {},\n \"source_id\": null,\n \"created_at\": \"2021-11-12T11:40:18.125Z\",\n \"customer_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"tracking_id\": \"Loyal_customer__01\",\n \"vouchers_id\": [\n \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\"\n ]\n }\n },\n \"created_at\": \"2021-11-12T11:40:18.125Z\"\n }\n },\n \"metadata\": {}\n}\n```\n\n```json\n{\n \"id\": \"event_0a26b9290fc4891587\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-11-12T11:42:51.380Z\",\n \"type\": \"points_earned\",\n \"data\": {\n \"object\": {\n \"order\": {},\n \"voucher\": {\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"code\": \"qjvEslzU\",\n \"campaign\": \"Loyalty Webhooks\",\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"category\": null,\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 220,\n \"balance\": 220\n },\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf/oALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf%2FoALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1/ICHe/XvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU+S0A4SpuuDsMXXotf/AOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FICHe%2FXvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU%2BS0A4SpuuDsMXXotf%2FAOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-11-12T11:40:18.138Z\",\n \"updated_at\": \"2021-11-12T11:42:50.332Z\",\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"object\": \"voucher\",\n \"distributions\": {\n \"distr_naR4rx0AgM1baWZkFm1kfHn7A9\": {\n \"date\": \"2021-11-12T11:40:21.957Z\"\n },\n \"distr_pnfPKLDAxUpiPi3ZsuMrygtYNN\": {\n \"date\": \"2021-11-12T11:42:50.332Z\"\n }\n },\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/qjvEslzU/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0,\n \"redeemed_points\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/qjvEslzU/redemptions?page=1&limit=10\"\n }\n },\n \"campaign\": {\n \"object\": \"campaign\",\n \"id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"name\": \"Loyalty Webhooks\",\n \"campaign_type\": \"LOYALTY_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"description\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"activity_duration_after_publishing\": null,\n \"vouchers_count\": 0,\n \"updated_at\": null,\n \"created_at\": \"2021-11-12T11:39:05.254Z\",\n \"active\": true,\n \"metadata\": {},\n \"vouchers_generation_status\": \"DONE\",\n \"category\": null,\n \"voucher\": {\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"redemption\": {\n \"quantity\": null\n },\n \"code_config\": {\n \"length\": 8,\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\"\n }\n },\n \"referral_program\": null,\n \"lucky_draw\": null\n },\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"source_id\": \"Loyal_customer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0,\n \"gift\": {\n \"redeemed_amount\": 0,\n \"amount_to_go\": 0\n },\n \"loyalty_card\": {\n \"redeemed_points\": 0,\n \"points_to_go\": 220\n }\n },\n \"orders\": {\n \"total_amount\": 22000,\n \"total_count\": 1,\n \"average_amount\": 22000,\n \"last_order_amount\": 22000,\n \"last_order_date\": \"2021-11-12T11:42:39.633Z\"\n }\n },\n \"loyalty\": {\n \"points\": 220,\n \"referred_customers\": 0,\n \"campaigns\": {\n \"Loyalty Webhooks\": {\n \"points\": 220,\n \"referred_customers\": 0\n }\n }\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-11-12T11:40:18.077Z\",\n \"updated_at\": \"2021-11-12T11:42:47.393Z\",\n \"email_unsubscribed\": false,\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"object\": \"customer\"\n }\n },\n \"related_object\": {\n \"id\": \"event_0a26b9290fc4891587\",\n \"type\": \"customer.rewarded.loyalty_points\",\n \"created_at\": \"2021-11-12T11:42:47.359Z\",\n \"data_json\": {\n \"object\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"source_id\": \"Loyal_customer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0,\n \"gift\": {\n \"redeemed_amount\": 0,\n \"amount_to_go\": 0\n },\n \"loyalty_card\": {\n \"redeemed_points\": 0,\n \"points_to_go\": 0\n }\n },\n \"orders\": {\n \"total_amount\": 22000,\n \"total_count\": 1,\n \"average_amount\": 22000,\n \"last_order_amount\": 22000,\n \"last_order_date\": \"2021-11-12T11:42:39.633Z\"\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 0,\n \"campaigns\": {\n \"Loyalty Webhooks\": {\n \"points\": 0,\n \"referred_customers\": 0\n }\n }\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-11-12T11:40:18.077Z\",\n \"updated_at\": \"2021-11-12T11:42:40.635Z\",\n \"email_unsubscribed\": false,\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"object\": \"customer\"\n },\n \"previous_attributes\": {},\n \"related_object\": {\n \"points\": 220,\n \"total\": 220,\n \"balance\": 220,\n \"type\": \"loyalty_card\",\n \"object\": \"balance\",\n \"related_object\": {\n \"type\": \"voucher\",\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\"\n }\n },\n \"balance\": {\n \"points\": 220,\n \"total\": 220,\n \"balance\": 220,\n \"type\": \"loyalty_card\",\n \"object\": \"balance\",\n \"related_object\": {\n \"type\": \"voucher\",\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\"\n }\n }\n },\n \"metadata_json\": {\n \"source\": \"Automation\"\n },\n \"automation_id\": \"auto_McXM3rjWcPwaNU5ndIIP13jX\",\n \"group_id\": \"v-0a26b921779d7eebcb\"\n }\n },\n \"metadata\": {}\n}\n```\n\n```json \n{\n \"id\": \"evcus_0a26bb89060c3ad8bc\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-11-12T11:53:09.910Z\",\n \"type\": \"points_redeemed\",\n \"data\": {\n \"object\": {\n \"voucher\": {\n \"id\": \"v_ix6p7zxM8m7AdlgObubjP2ibDTCsnEkq\",\n \"code\": \"xUgBLQck\",\n \"campaign\": \"20% discount\",\n \"campaign_id\": \"camp_o9vZ7yIqtj5B9CbhJlKRXIZ5\",\n \"category\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"PERCENT\",\n \"amount_limit\": 5000,\n \"percent_off\": 20\n },\n \"gift\": null,\n \"loyalty_card\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX19pNCYXQ8ztNEb+OaYwP13ZoOfOMBJwzgz2RNchFxoMDPIHS47i8tY+oc3HzEpFr2SqITQ/IdD6V7RuYxsyrcfz53Je6+me6VBl9Pze3p8lTSJWwjp79tKEZHygNMggPsfIEi4Ei3Wt1A==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19pNCYXQ8ztNEb%2BOaYwP13ZoOfOMBJwzgz2RNchFxoMDPIHS47i8tY%2Boc3HzEpFr2SqITQ%2FIdD6V7RuYxsyrcfz53Je6%2Bme6VBl9Pze3p8lTSJWwjp79tKEZHygNMggPsfIEi4Ei3Wt1A%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19a0CQqRE3y6dRDn0Jyr74H85dLNo9MQrXRZFBj9fcDUlaV3Q0uG2xa4l4Ch4WVfPGQ3iEEPpYTMQGwm8xN9cynpCv/upu9ZD9iWat6+nlw+PsKH5CcyNemhfI273GhBOvh5ysRMpFUZQ==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19a0CQqRE3y6dRDn0Jyr74H85dLNo9MQrXRZFBj9fcDUlaV3Q0uG2xa4l4Ch4WVfPGQ3iEEPpYTMQGwm8xN9cynpCv%2Fupu9ZD9iWat6%2Bnlw%2BPsKH5CcyNemhfI273GhBOvh5ysRMpFUZQ%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-11-12T11:53:03.194Z\",\n \"updated_at\": null,\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"redemption\": {\n \"quantity\": 1,\n \"redeemed_quantity\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/xUgBLQck/redemptions?page=1&limit=10\"\n },\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/xUgBLQck/publications?page=1&limit=10\"\n },\n \"object\": \"voucher\"\n },\n \"campaign\": {\n \"id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"name\": \"Loyalty Webhooks\",\n \"campaign_type\": \"LOYALTY_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"voucher\": {\n \"type\": \"LOYALTY_CARD\",\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n },\n \"is_referral_code\": false\n },\n \"auto_join\": false,\n \"join_once\": false,\n \"vouchers_count\": 0,\n \"active\": true,\n \"object\": \"campaign\"\n },\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"source_id\": \"Loyal_customer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 1,\n \"total_failed\": 0,\n \"total_succeeded\": 1,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0\n },\n \"orders\": {\n \"total_amount\": 22000,\n \"total_count\": 1,\n \"average_amount\": 22000,\n \"last_order_amount\": 22000,\n \"last_order_date\": \"2021-11-12T11:42:39.633Z\"\n }\n },\n \"loyalty\": {\n \"points\": 218,\n \"referred_customers\": 0,\n \"campaigns\": {\n \"Loyalty Webhooks\": {\n \"points\": 218,\n \"referred_customers\": 0\n }\n }\n },\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-11-12T11:40:18.077Z\",\n \"updated_at\": \"2021-11-12T11:53:07.582Z\",\n \"object\": \"customer\"\n },\n \"publication\": {\n \"id\": \"pub_aFszQ4kOtT1Hori8Wl1i0az1sFQN3CRv\",\n \"created_at\": \"2021-11-12T11:53:03.172Z\",\n \"customer_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"Loyal_customer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"tracking_id\": \"Loyal_customer__01\",\n \"metadata\": {},\n \"channel\": \"API\",\n \"source_id\": null,\n \"result\": \"SUCCESS\",\n \"voucher_code\": \"xUgBLQck\",\n \"vouchers\": [\n {\n \"id\": \"v_ix6p7zxM8m7AdlgObubjP2ibDTCsnEkq\",\n \"code\": \"xUgBLQck\",\n \"campaign\": \"20% discount\",\n \"campaign_id\": \"camp_o9vZ7yIqtj5B9CbhJlKRXIZ5\",\n \"category\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"PERCENT\",\n \"percent_off\": 20,\n \"amount_limit\": 5000\n },\n \"gift\": null,\n \"loyalty_card\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX19pNCYXQ8ztNEb+OaYwP13ZoOfOMBJwzgz2RNchFxoMDPIHS47i8tY+oc3HzEpFr2SqITQ/IdD6V7RuYxsyrcfz53Je6+me6VBl9Pze3p8lTSJWwjp79tKEZHygNMggPsfIEi4Ei3Wt1A==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19pNCYXQ8ztNEb%2BOaYwP13ZoOfOMBJwzgz2RNchFxoMDPIHS47i8tY%2Boc3HzEpFr2SqITQ%2FIdD6V7RuYxsyrcfz53Je6%2Bme6VBl9Pze3p8lTSJWwjp79tKEZHygNMggPsfIEi4Ei3Wt1A%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19a0CQqRE3y6dRDn0Jyr74H85dLNo9MQrXRZFBj9fcDUlaV3Q0uG2xa4l4Ch4WVfPGQ3iEEPpYTMQGwm8xN9cynpCv/upu9ZD9iWat6+nlw+PsKH5CcyNemhfI273GhBOvh5ysRMpFUZQ==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19a0CQqRE3y6dRDn0Jyr74H85dLNo9MQrXRZFBj9fcDUlaV3Q0uG2xa4l4Ch4WVfPGQ3iEEPpYTMQGwm8xN9cynpCv%2Fupu9ZD9iWat6%2Bnlw%2BPsKH5CcyNemhfI273GhBOvh5ysRMpFUZQ%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-11-12T11:53:03.194Z\",\n \"updated_at\": null,\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"object\": \"voucher\",\n \"distributions\": null,\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/xUgBLQck/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"quantity\": 1,\n \"redeemed_quantity\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/xUgBLQck/redemptions?page=1&limit=10\"\n }\n }\n ],\n \"vouchers_id\": [\n \"v_ix6p7zxM8m7AdlgObubjP2ibDTCsnEkq\"\n ],\n \"campaign_name\": \"20% discount\",\n \"gift\": null,\n \"loyalty_card\": null,\n \"discount\": {\n \"type\": \"PERCENT\",\n \"percent_off\": 20,\n \"amount_limit\": 5000\n },\n \"is_referral_code\": false,\n \"failure_code\": null,\n \"failure_message\": null,\n \"voucher\": null\n }\n },\n \"related_object\": {\n \"id\": \"evcus_0a26bb89060c3ad8bc\",\n \"type\": \"customer.reward_redemptions.completed\",\n \"data\": {\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"Loyal_customer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"holder\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"Loyal_customer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"voucher\": {\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"code\": \"qjvEslzU\",\n \"loyalty_card\": {\n \"points\": 220,\n \"balance\": 218\n },\n \"type\": \"LOYALTY_CARD\",\n \"campaign\": \"Loyalty Webhooks\",\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"is_referral_code\": false,\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\"\n },\n \"campaign\": {\n \"id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"name\": \"Loyalty Webhooks\",\n \"campaign_type\": \"LOYALTY_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"is_referral_code\": false,\n \"voucher\": {\n \"type\": \"LOYALTY_CARD\",\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n }\n },\n \"auto_join\": false,\n \"join_once\": false,\n \"active\": true\n },\n \"reward_redemption\": {\n \"id\": \"rewr_uATcoUjIp3VJNgT5TZT5NMaT\",\n \"state\": \"COMPLETED\",\n \"created_at\": \"2021-11-12T11:53:06.025Z\",\n \"updated_at\": null,\n \"voucher_id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"customer_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"reward_assignment_id\": \"rewa_bRTNrtAqXmdHNDe4cNg7y3JC\",\n \"source_id\": \"r_Lbxqqjv59hCRLG3Nkl8E4yYk\",\n \"source_type\": \"redemption\"\n },\n \"reward\": {\n \"assignment_id\": \"rewa_bRTNrtAqXmdHNDe4cNg7y3JC\",\n \"voucher\": {\n \"id\": \"v_ix6p7zxM8m7AdlgObubjP2ibDTCsnEkq\",\n \"code\": \"xUgBLQck\",\n \"discount\": {\n \"type\": \"PERCENT\",\n \"amount_limit\": 5000,\n \"percent_off\": 20\n },\n \"type\": \"DISCOUNT_VOUCHER\",\n \"campaign\": \"20% discount\",\n \"campaign_id\": \"camp_o9vZ7yIqtj5B9CbhJlKRXIZ5\",\n \"is_referral_code\": false,\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\"\n },\n \"id\": \"rew_l7z9yeLGZHJgCsxwNX5tDXqs\",\n \"object\": \"reward\",\n \"name\": \"20% discount\",\n \"type\": \"CAMPAIGN\"\n },\n \"reward_assignment\": {\n \"id\": \"rewa_bRTNrtAqXmdHNDe4cNg7y3JC\",\n \"reward_id\": \"rew_l7z9yeLGZHJgCsxwNX5tDXqs\",\n \"related_object_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"related_object_type\": \"campaign\",\n \"parameters\": {\n \"loyalty\": {\n \"points\": 2\n }\n },\n \"created_at\": \"2021-11-12T11:39:05.504Z\",\n \"updated_at\": null,\n \"object\": \"reward_assignment\"\n },\n \"source\": {\n \"id\": \"r_Lbxqqjv59hCRLG3Nkl8E4yYk\",\n \"type\": \"redemption\"\n },\n \"balance\": null\n },\n \"created_at\": \"2021-11-12T11:53:09.910Z\"\n }\n },\n \"metadata\": {}\n}\n```", - "x-tags": [ - "EVENTS API" - ] - }, - "15_req_track_custom_event": { - "title": "Track Custom Event Request Body", - "type": "object", - "description": "Request schema for tracking a custom event.", - "properties": { - "event": { - "type": "string", - "description": "Event name. This is the same name that you used to define a custom event in the **Dashboard** > **Project Settings** > **Event Schema**." - }, - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" + }, + "8_loyalty_tiers_expiration_balance_expiration_date_balance_drop": { + "title": "Balance Drop", + "type": "object", + "description": "Defines the conditions for the expiration date of a tier based on a pure balance drop.", + "properties": { + "type": { + "type": "string", + "enum": [ + "BALANCE_DROP" + ], + "description": "What triggers the tier to expire for a customer. \n`BALANCE_DROP`: Tier expires when the points balance drops below the required range of the tier." + } } - ], - "type": "object" - }, - "referral": { - "type": "object", - "description": "If a **conversion event** for a referral program is set to a custom event, then you need to send the referral code in the payload to make a record of the conversion event. ", - "properties": { - "code": { - "type": "string", - "description": "A code through which a new visitor has been referred to a service." - }, - "referrer_id": { - "type": "string", - "description": "Unique ID of the referring person - it is optional and not required if the referral **code** is provided.", - "example": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" + }, + "8_loyalty_tiers_expiration_balance_expiration_date_custom": { + "title": "Custom", + "type": "object", + "description": "Defines the custom conditions for the expiration date of a tier.", + "properties": { + "type": { + "type": "string", + "enum": [ + "CUSTOM" + ], + "description": "What triggers the tier to expire for a customer. \n`CUSTOM`: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier." + }, + "extend": { + "type": "string", + "description": "Defines the amount of time the tier will remain active in ISO 8601 format. The expiration date counter starts at the moment when the customer reaches the minimum required points that are required to be in the tier. For example, a tier with a duration of P3M will be valid for a duration of 3 months." + }, + "rounding": { + "description": "Defines the rounding mechanism for tier expiration.", + "anyOf": [ + { + "$ref": "#/components/schemas/8_loyalty_tiers_expiration_expiration_date_rounding_default_options" + }, + { + "$ref": "#/components/schemas/8_loyalty_tiers_expiration_expiration_date_rounding_custom" + } + ] + } } - } - }, - "loyalty": { - "type": "object", - "description": "If an earning rule in a loyalty program is based on a custom event. This objects let's you specify the loyalty card to which the custom event should be attributed to.", - "properties": { - "code": { - "type": "string", - "description": "Code of the loyalty card to receive points based on the calculation method defined in the related earning rule. An earning rule is triggered for the loyalty card when the event passed in the `event` parameter of the request payload gets sent along with this loyalty card code." + }, + "8_loyalty_tiers_expiration_expiration_date_rounding_default_options": { + "title": "Calendar Periods", + "type": "object", + "description": "Defines the rounding mechanism for tier expiration based on a list of available time periods.", + "properties": { + "type": { + "type": "string", + "enum": [ + "MONTH", + "QUARTER", + "HALF_YEAR", + "YEAR" + ], + "description": "Period to which the expiration will be rounded to. \n- `MONTH`: The expiration date will be rounded to the end of the month. \n- `QUARTER`: The expiration date will be rounded to the end of the quarter. \n- `HALF_YEAR`: The expiration date will be rounded to the half year. \n- `YEAR`: The expiration date will be rounded to the end of the year." + } } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the event. A set of key/value pairs that you can attach to an event object. It can be useful for storing additional information about the event in a structured format. Event metadata schema is defined in the **Dashboard** > **Project Settings** > **Event Schema** > **Edit particular event** > **Metadata property definition**." - } - } - }, - "15_res_track_custom_event": { - "title": "Track Custom Event Request Body", - "type": "object", - "description": "Request schema for tracking a custom event.", - "properties": { - "object": { - "type": "string", - "default": "event", - "description": "The object represented is an `event`." - }, - "type": { - "type": "string", - "description": "The event name." - }, - "customer": { - "type": "object", - "description": "An empty customer object." - }, - "referral": { - "type": "null", - "description": "A `null` referral object." - }, - "loyalty": { - "type": "null", - "description": "A `null` loyalty object." - } - } - }, - "16_obj_export_object": { - "title": "Export Object", - "type": "object", - "description": "This is an object representing an export. \n\nThe `/exports` endpoint allows you to retrieve Voucherify objects such as [vouchers](ref:get-voucher), [redemptions](ref:list-redemptions), [publications](ref:list-publications), [customers](ref:get-customer), and [orders](ref:get-order) as a CSV file. This functionality works asynchronously and comes down to the following steps: \n* create an export object and return its `id` so you can track its `status`\n* trigger a CSV file generation, change the status to `SCHEDULED`\n* when the generation is over, store the file in S3 and change the `status` to `DONE`\n* now you can [get](ref:download-export) it\n\nWith `parameters` you can select which `fields` will be exported and `filter` out the relevant data\n\n\n```json\n{\n \"fields\": [\n \"code\",\n \"voucher_type\"\n ],\n \"filters\": {\n \"categories\": {\n \"conditions\": {\n \"$in\": [\n \"postman\"\n ]\n }\n }\n }\n}\n```\n\n\n## Fields values\nHere is a list of the fields you can export for particular objects. \n| **Object** | **Fields** |\n|:---|:---|\n| voucher | code
voucher_type
value
discount_type
campaign
category
start_date
expiration_date
gift_balance
loyalty_balance
redemption_quantity
redemption_count
active
qr_code
bar_code
id
is_referral_code
created_at
updated_at
validity_timeframe_interval
validity_timeframe_duration
validity_day_of_week
discount_amount_limit
campaign_id
additional_info
customer_id
discount_unit_type
discount_unit_effect
customer_source_id
metadata
metadata.X *where X is the name of a particular metadata property* |\n| redemption | object
date
voucher_code
campaign
promotion_tier_id
customer_id
customer_source_id
customer_name
tracking_id
order_amount
gift_amount
loyalty_points
result
failure_code
failure_message
metadata
metadata.X *where X is the name of a particular metadata property* |\n| publication | voucher_code
customer_id
customer_source_id
date
channel
campaign
is_winner
metadata
metadata.X *where X is the name of a particular metadata property* |\n| customer | name
id
description
email
source_id
created_at
address_city
address_state
address_line_1
address_line_2
address_country
address_postal_code
redemptions_total_redeemed
redemptions_total_failed
redemptions_total_succeeded
redemptions_total_rolled_back
redemptions_total_rollback_failed
redemptions_total_rollback_succeeded
orders_total_amount
orders_total_count
orders_average_amount
orders_last_order_amount
orders_last_order_date
loyalty_points
loyalty_referred_customers
updated_at
phone
birthdate
birthday
metadata
metadata.X *where X is the name of a particular metadata property* |\n| order | id
source_id
status
created_at
updated_at
amount
discount_amount
items_discount_amount
total_discount_amount
total_amount
customer_id
referrer_id
metadata
metadata.X *where X is the name of a particular metadata property* |\n| points expiration | id
campaign_id
voucher_id
expires_at
status
points |\n\n\n## Pagination and example request\nVoucherify allows you to specify the timeframe for the records you want to retrieve. Thanks to this mechanism it should be easy to implement a pagination mechanism. See the example of request body: \n\n\n```json Export Redemption Example\n{\n \"exported_object\": \"redemption\",\n \"parameters\": {\n \"order\": \"-created_at\",\n \"fields\": [\n \"id\",\n \"object\",\n \"date\",\n \"voucher_code\",\n \"customer_id\",\n \"result\"\n ],\n \"filters\": {\n \"junction\": \"and\",\n \"created_at\": {\n \"conditions\": {\n \"$after\": [\n \"2018-05-30T22:00:00.000Z\"\n ],\n \"$before\": [\n \"2018-06-29T22:00:00.000Z\"\n ]\n }\n }\n }\n }\n}\n```\n\nAn export request will almost always result in a single file being generated by the system. However, when your volume of data is large, the system may split the results into multiple chunks.", - "x-tags": [ - "EXPORTS API" - ], - "properties": { - "id": { - "type": "string", - "description": "Unique export ID.", - "example": "exp_FFfp9o7daWuJqJCKp5xqqli4" - }, - "object": { - "type": "string", - "default": "export", - "description": "The type of object being represented. This object stores information about the `export`." - }, - "created_at": { - "type": "string", - "example": "2022-04-28T11:23:20.922Z", - "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format.", - "format": "date-time" - }, - "status": { - "type": "string", - "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.", - "enum": [ - "SCHEDULED", - "IN_PROGRESS", - "DONE", - "ERROR" - ] - }, - "channel": { - "type": "string", - "description": "The channel through which the export was triggered.", - "enum": [ - "API", - "WEBSITE" - ] - }, - "exported_object": { - "type": "string", - "description": "The type of exported object.", - "enum": [ - "order", - "voucher", - "publication", - "redemption", - "customer", - "points_expiration", - "voucher_transactions" - ] - }, - "parameters": { - "anyOf": [ - { - "$ref": "#/components/schemas/16_obj_export_order" - }, - { - "$ref": "#/components/schemas/16_obj_export_voucher" - }, - { - "$ref": "#/components/schemas/16_obj_export_publication" - }, - { - "$ref": "#/components/schemas/16_obj_export_redemption" - }, - { - "$ref": "#/components/schemas/16_obj_export_customer" - }, - { - "$ref": "#/components/schemas/16_obj_export_points_expiration" - }, - { - "$ref": "#/components/schemas/16_obj_export_gift_card_transactions" - }, - { - "$ref": "#/components/schemas/16_obj_export_loyalty_card_transactions" + }, + "8_loyalty_tiers_expiration_expiration_date_rounding_custom": { + "title": "Specific Month", + "type": "object", + "description": "Defines the custom rounding mechanism for tier expiration.", + "properties": { + "type": { + "type": "string", + "enum": [ + "CUSTOM" + ], + "description": "This mechanism describes a custom rounding for the expiration date." + }, + "unit": { + "type": "string", + "description": "Defines the type of unit of time in which the rounding period is counted.", + "enum": [ + "MONTH" + ] + }, + "value": { + "type": "integer", + "description": "Value for the unit of time that the rounding applies to. Units for this parameter are defined by the `rounding.unit` parameter. \n- `0`: January\n- `1`: February\n- `2`: March\n- `3`: April\n- `4`: May\n- `5`: June\n- `6`: July\n- `7`: August\n- `8`: September\n- `9`: October\n- `10`: November\n- `11`: December" + } } - ] - }, - "result": { - "type": "object", - "description": "Contains the URL of the CSV file.", - "properties": { - "url": { - "type": "string", - "description": "URL of the CSV file location. It contains the `token` used for authorization in the [Download export](ref:download-export) method." + }, + "8_loyalty_tiers_expiration_points_in_period": { + "title": "Points in Period", + "type": "object", + "description": "Defines the Points in Period expiration mechanism for loyalty tiers.", + "properties": { + "qualification_type": { + "type": "string", + "enum": [ + "POINTS_IN_PERIOD" + ], + "description": "Tier qualification. \n\n`POINTS_IN_PERIOD`: A customer qualifies for the tier only if the sum of the accumulated points in a **defined time interval** reaches the tier threshold." + }, + "qualification_period": { + "type": "string", + "description": "Customers can qualify for the tier if they collected enough points in a given time period. So, in addition to the customer having to reach a points range, they also need to have collected the points within a set time period. \n\n| **Period** | **Definition** |\n|:---|:---|\n| **Calendar Month** | Points collected in one calendar month
January, February, March, etc. |\n| **Calendar Quarter** | Points collected in the quarter
- January - March
- April - June
- July - September
- October - December |\n| **Calendar Half-year** | Points collected in the half-year
- January - June
- July - December |\n| **Calendar Year** | Points collected in one calendar year
January - December |", + "enum": [ + "MONTH", + "QUARTER", + "HALF_YEAR", + "YEAR" + ] + }, + "start_date": { + "type": "object", + "description": "Defines the conditions for the start date of the tier.", + "properties": { + "type": { + "type": "string", + "enum": [ + "IMMEDIATE", + "NEXT_PERIOD" + ], + "description": "What triggers the tier to be valid for a customer. \n`IMMEDIATE`: After reaching the minimum required points. \n`NEXT_PERIOD`: When the next qualification period starts." + } + } + }, + "expiration_date": { + "type": "object", + "description": "Defines the conditions for the expiration date of a tier.", + "properties": { + "type": { + "type": "string", + "enum": [ + "END_OF_PERIOD", + "END_OF_NEXT_PERIOD" + ], + "description": "What triggers the tier to expire for a customer. \n`END_OF_PERIOD`: Expire tier at the end of the period. \n`END_OF_NEXT_PERIOD`: Expire tier at the end of the next period." + }, + "extend": { + "type": "string", + "description": "Extend the expiration by adding extra months or days in ISO 8601 format. The tier will remain active even though it reaches its expiration time period. For example, a tier with a duration of `P3M` will be valid for an additional duration of 3 months and a tier with a duration of `P1D` will be valid for an additional duration of 1 day." + } + } + } } - } - }, - "user_id": { - "type": "string", - "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the `channel` value is `WEBSITE`.", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH" - } - } - }, - "16_res_list_exports": { - "description": "Response schema for listing exports.", - "type": "object", - "title": "List Exports Response Body", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about exports.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of exports.", - "default": "exports" - }, - "exports": { - "type": "array", - "uniqueItems": true, - "description": "An array of export objects.", - "items": { - "$ref": "#/components/schemas/16_obj_export_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of exports." - } - } - }, - "16_req_create_export_POST": { - "description": "Request schema for creating an export.", - "type": "object", - "title": "Create Export Request Body", - "properties": { - "exported_object": { - "type": "string", - "description": "The type of object to be exported.", - "enum": [ - "order", - "voucher", - "publication", - "redemption", - "customer", - "points_expiration", - "voucher_transactions" - ] - }, - "parameters": { - "anyOf": [ - { - "$ref": "#/components/schemas/16_obj_export_order" - }, - { - "$ref": "#/components/schemas/16_obj_export_voucher" - }, - { - "$ref": "#/components/schemas/16_obj_export_publication" - }, - { - "$ref": "#/components/schemas/16_obj_export_redemption" - }, - { - "$ref": "#/components/schemas/16_obj_export_customer" - }, - { - "$ref": "#/components/schemas/16_obj_export_points_expiration" - }, - { - "$ref": "#/components/schemas/16_obj_export_gift_card_transactions" - }, - { - "$ref": "#/components/schemas/16_obj_export_loyalty_card_transactions" + }, + "8_req_update_loyalty_campaign": { + "type": "object", + "title": "Update Loyalty Campaign Request Body", + "description": "Request body schema for updating a loyalty campaign using **PUT** `/loyalties/{campaignId}`.", + "properties": { + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + }, + "auto_join": { + "type": "boolean", + "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. CONTEXT: `LOYALTY_PROGRAM`." + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "loyalty_tiers_expiration": { + "type": "object", + "description": "Defines the expiration mechanism for loyalty tiers.", + "anyOf": [ + { + "$ref": "#/components/schemas/8_loyalty_tiers_expiration_balance" + }, + { + "$ref": "#/components/schemas/8_loyalty_tiers_expiration_points_in_period" + } + ] + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", + "example": "cat_0b688929a2476386a7" + }, + "category": { + "type": "string", + "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." + }, + "loyalty_card": { + "description": "Defines the loyalty card details.", + "type": "object", + "properties": { + "points": { + "type": "integer", + "description": "Initial loyalty card income in points to be applied to the loyalty card at voucher generation." + }, + "expiration_rules": { + "type": "object", + "description": "Defines point expiration rules.", + "properties": { + "period_type": { + "type": "string", + "enum": [ + "MONTH" + ], + "description": "The expiration period." + }, + "period_value": { + "type": "integer", + "description": "How many periods should pass before the expiration occurs." + }, + "rounding_type": { + "type": "string", + "enum": [ + "END_OF_MONTH", + "END_OF_QUARTER", + "END_OF_HALF_YEAR", + "END_OF_YEAR", + "PARTICULAR_MONTH" + ], + "description": "Round up expiration till the end of the given period type." + } + } + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + } } - ] - } - } - }, - "16_obj_export_order": { - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data.", - "title": "order", - "type": "object", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "-created_at", - "created_at", - "updated_at", - "-updated_at", - "status", - "-status" - ] - }, - "fields": { - "type": "array", - "enum": [ - [ - "id", - "source_id", - "created_at", - "updated_at", - "status", - "amount", - "discount_amount", - "items_discount_amount", - "total_discount_amount", - "total_amount", - "customer_id", - "referrer_id", - "metadata" - ] - ], - "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique order ID. | ord_A69RIxEdRsPuC6i8gFGVHUft |\n| source_id | Unique order source ID. | 8638 |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the order was created. | 2022-03-09T09:16:32.521Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the order was last updated. | 2022-03-09T09:16:33.331Z |\n| status | Order status. | `PAID`, `CREATED`, `FULFILLED`, `CANCELED` |\n| amount | Total amount of order items. | 7700 |\n| discount_amount | Represents total amount of the discount applied to whole cart. | 500 |\n| items_discount_amount | Represents total amount of the discount applied to order line items. | 100 |\n| total_discount_amount | All discounts applied to the order including discounts applied to particular order line items and discounts applied to the whole cart. | 600 |\n| total_amount | Total order amount after applying all discounts. | 7100 |\n| customer_id | Customer unique ID. | cust_2G4fUQdCXUqp35nXNleav7bO |\n| referrer_id | Referrer unique ID. | cust_IkrTR674vvQvr9a4rDMiqglY |\n| metadata | Returns all order metadata. | Response will include all order metadata. |\n| metadata.X | Where X is the name of a particular order metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Order. [Read more here](https://support.voucherify.io/article/99-schema-validation-metadata). |", - "items": { - "type": "string" - } - }, - "filters": { - "anyOf": [ - { - "$ref": "#/components/schemas/16_obj_filter_order_status" - }, - { - "$ref": "#/components/schemas/16_obj_filter_order_source_id" - }, - { - "$ref": "#/components/schemas/16_obj_filter_order_amount" - }, - { - "$ref": "#/components/schemas/16_obj_filter_order_total_amount" - }, - { - "$ref": "#/components/schemas/16_obj_filter_order_discount_amount" - }, - { - "$ref": "#/components/schemas/16_obj_filter_order_total_discount_amount" - }, - { - "$ref": "#/components/schemas/16_obj_filter_order_items_discount_amount" + }, + "8_req_create_earning_rules": { + "description": "This data model represents the request body for the `/loyalties/{campaignId}/earning-rules` endpoint.", + "title": "Create Earning Rule Request Body", + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/components/schemas/8_req_earning_rule_object_order_paid" + }, + { + "$ref": "#/components/schemas/8_req_earning_rule_object_entered_segment" + }, + { + "$ref": "#/components/schemas/8_req_earning_rule_object_custom_event" + }, + { + "$ref": "#/components/schemas/8_req_earning_rule_object_tier" + } + ] } - ] - } - } - }, - "16_obj_export_voucher": { - "description": "List of available fields and filters that can be exported with a voucher along with the sorting order of the returned data.", - "title": "voucher", - "type": "object", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at", - "code", - "-code" - ] - }, - "fields": { - "type": "array", - "enum": [ - [ - "code", - "voucher_type", - "value", - "discount_type", - "campaign", - "category", - "start_date", - "expiration_date", - "gift_balance", - "loyalty_balance", - "redemption_quantity", - "redemption_count", - "active", - "qr_code", - "bar_code", - "id", - "is_referral_code", - "created_at", - "updated_at", - "validity_timeframe_interval", - "validity_timeframe_duration", - "validity_day_of_week", - "discount_amount_limit", - "campaign_id", - "additional_info", - "customer_id", - "discount_unit_type", - "discount_unit_effect", - "customer_source_id", - "metadata" - ] - ], - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique voucher ID. | v_HSnGD2vNIHYighTQxwcB4dtVAv8VOmZD |\n| code | Unique voucher code. | WELCOME100 |\n| voucher_type | Type of voucher. | `DISCOUNT_VOUCHER`, `GIFT_VOUCHER`, `LOYALTY_CARD` |\n| value | Value of voucher. | `DISCOUNT_VOUCHER` : amount, percent, unit
`GIFT_VOUCHER`: amount left to spend
`LOYALTY_CARD`: available usable points |\n| discount_type | The type of discount for a `DISCOUNT_VOUCHER`. | `AMOUNT`, `PERCENT`, `UNIT`, `FIXED` |\n| campaign | Unique campaign name. | Summer Discounts 20% off |\n| category | Tag defining the category that this voucher belongs to. | |\n| start_date | Start date defines when the code starts to be active. Activation timestamp in ISO 8601 format. Voucher is _inactive_ before this date. | 2020-12-10T23:00:00.000Z |\n| expiration_date | Expiration date defines when the code expires. Expiration timestamp in ISO 8601 format. Voucher is _inactive_ after this date. | 2023-12-31T23:00:00.000Z |\n| gift_balance | Amount left to spend. | 1000 |\n| loyalty_balance | Available usable points. | 2000 |\n| redemption_quantity | Maximum number of times a voucher can be redeemed. | 2 |\n| redemption_count | Total redemptions. | 59 |\n| active | Boolean indicating whether the voucher is available for use. | `true`, `false` |\n| qr_code | URL to QR representation of encrypted code. | |\n| bar_code | URL to barcode representation of encrypted code. | |\n| is_referral_code | Boolean indicating whether the voucher is a referral code. | `true`, `false` |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the voucher was created. | 2022-04-14T09:55:46.814Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the voucher was last updated. | 2022-04-14T10:02:18.036Z |\n| validity_timeframe_interval | Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an interval of `P2D` will be active every other day. | P2D |\n| validity_timeframe_duration | Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a duration of `PT1H` will be valid for a duration of one hour. | PT1H |\n| validity_day_of_week | Array corresponding to the particular days of the week in which the voucher is valid. | \"1,2,3,4,5\" |\n| discount_amount_limit | For `PERCENT` discount type, this is the maximum threshold allowed to be deducted. | 50 |\n| campaign_id | Parent campaign ID. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| additional_info | An optional field to keep any extra textual information about the code such as a code description and details. | |\n| customer_id | Unique customer ID of the assigned owner to whom the voucher was published. | cust_7iUa6ICKyU6gH40dBU25kQU1 |\n| discount_unit_type | For `UNIT` discount type, either a shipping or product ID for a `UNIT` discount with one product. | prod_5h1pp1ng, prod_0a9f9aeddb019a42db |\n| discount_unit_effect | `UNIT` discount effect. | `ADD_MANY_ITEMS`, `ADD_MISSING_ITEMS`,`ADD_NEW_ITEMS` |\n| customer_source_id | Unique customer source id of the assigned owner to whom the voucher was published. | name.lastname@email.com |\n| metadata | Returns all voucher metadata. | Response will include all voucher metadata. |\n| metadata.X | Where X is the name of a particular voucher metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Voucher. [Read more here](https://support.voucherify.io/article/99-schema-validation-metadata). |\n", - "items": { - "type": "string" - } - }, - "filters": { - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the export. You can filter the following parameters: \n\n - `categories`\n\n - `vouchers`\n\n - `type`\n\n - `holder_id`\n\n - `is_referral_code`\n\n - `published_for_customer_id`\n\n - `validity_timeframe`\n\n - `category_ids`" - } - } - }, - "16_obj_export_publication": { - "description": "List of available fields and filters that can be exported with a publication along with the sorting order of the returned data.", - "title": "publication", - "type": "object", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "id", - "-id", - "voucher_code", - "-voucher_code", - "tracking_id", - "-tracking_id", - "customer_id", - "-customer_id", - "created_at", - "-created_at", - "channel", - "-channel" - ] - }, - "fields": { - "type": "array", - "enum": [ - [ - "voucher_code", - "customer_id", - "customer_source_id", - "date", - "channel", - "campaign", - "is_winner", - "metadata" - ] - ], - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| voucher_code | Unique voucher code. | WELCOME100 |\n| customer_id | Customer unique ID. | cust_7iUa6ICKyU6gH40dBU25kQU1 |\n| customer_source_id | Unique customer source id of the assigned owner to whom the voucher was published. | name.lastname@email.com |\n| date | Timestamp in ISO 8601 format representing the date and time when the voucher was published. | 2022-04-28T10:19:30.792Z |\n| channel | Publication channel. | voucherify-website |\n| campaign | Unique campaign name. | Summer Discounts 20% off |\n| is_winner | | |\n| metadata | Returns all publication metadata. | Response will include all publication metadata. |\n| metadata.X | Where X is the name of a particular publication metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Publication. [Read more here](https://support.voucherify.io/article/99-schema-validation-metadata) |", - "items": { - "type": "string" - } - }, - "filters": { - "description": "Data filters used to narrow the data records to be returned in the export. You can filter the following parameters: \n\n - `failure_code`\n\n - `result`\n\n - `customer_id`\n\n - `campaign_name`\n\n - `voucher_type`\n\n - `is_referral_code`\n\n - `parent_object_id`\n\n - `related_object_id`\n\n - `source_id`", - "anyOf": [ - { - "$ref": "#/components/schemas/16_obj_filter_publication_failure_code" - }, - { - "$ref": "#/components/schemas/16_obj_filter_publication_result" - }, - { - "$ref": "#/components/schemas/16_obj_filter_publication_customer_id" - }, - { - "$ref": "#/components/schemas/16_obj_filter_publication_campaign_name" - }, - { - "$ref": "#/components/schemas/16_obj_filter_publication_voucher_type" - }, - { - "$ref": "#/components/schemas/16_obj_filter_publication_is_referral_code" - }, - { - "$ref": "#/components/schemas/16_obj_filter_publication_parent_object_id" - }, - { - "$ref": "#/components/schemas/16_obj_filter_publication_related_object_id" + }, + "8_req_create_earning_rules_copy": { + "description": "This data model represents the request body for the `/loyalties/{campaignId}/earning-rules` endpoint.", + "type": "object", + "title": "Create Earning Rule Request Body", + "properties": { + "event": { + "type": "string", + "enum": [ + "order.paid", + "customer.segment.entered", + "custom_event_defined_in_EVENT_SCHEMA" + ], + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `order.paid` an event defined by the Voucherify API corresponding to an order status `PAID`. Read more here. \n- `customer.segment.entered` an event defined by the Voucherify API corresponding to a customer entering a pre-defined customer segment. Read more here. \n- `custom_event_name` the name of a custom event defined in the Dashboard → **Project Settings** → **EVENT SCHEMA** → **Add event definition**. Read more on defining custom events. " + }, + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "description": "Fixed. Applicable to events `order.paid`, `customer.segment.entered`, and `custom_event`.", + "properties": { + "points": { + "type": "integer", + "description": "The number of points to be added to the loyalty card.", + "example": 1000 + }, + "type": { + "type": "string", + "description": "Defines how the points will be added to the loyalty card. `FIXED` adds a fixed number of `points`.", + "default": "FIXED" + } + }, + "required": [ + "points", + "type" + ] + }, + { + "description": "Proportional. Applicable to only `order.paid`.", + "properties": { + "type": { + "type": "string", + "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio", + "default": "PROPORTIONAL" + }, + "order": { + "type": "object", + "description": "Defines proportion for calculating how many points to add to a loyalty card. The ratio is based on the order amount. For `every` dollar spent, the customer will get this many `points`. \n", + "required": [ + "amount" + ], + "properties": { + "amount": { + "type": "object", + "description": "Defines the ratio based on the order amount.", + "required": [ + "every", + "points" + ], + "properties": { + "every": { + "type": "integer", + "description": "Order amount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." + }, + "points": { + "type": "integer", + "description": "Number of points awarded." + } + } + } + } + } + }, + "required": [ + "type", + "order" + ] + } + ], + "type": "object" + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default." + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day. `start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" + } + }, + "required": [ + "duration", + "interval" + ] + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "custom_event": { + "type": "object", + "description": "Contains the schema id of a custom event. **Required** for the custom event option in `event`.", + "properties": { + "schema_id": { + "type": "string", + "description": "Contains a unique identifier of a custom event schema. Assigned by the Voucherify API." + } + }, + "required": [ + "schema_id" + ] + }, + "segment": { + "type": "object", + "description": "Contains the id of a customer segment. **Required** for the `customer.segment.entered` option in `event`.", + "properties": { + "id": { + "type": "string", + "description": "Contains a unique identifier of a customer segment. Assigned by the Voucherify API." + } + }, + "required": [ + "id" + ] + } }, - { - "$ref": "#/components/schemas/16_obj_filter_publication_source_id" - } - ] - } - } - }, - "16_obj_export_redemption": { - "description": "List of available fields and filters that can be exported with a redemption along with the sorting order of the returned data.", - "title": "redemption", - "type": "object", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "id", - "-id", - "voucher_code", - "-voucher_code", - "tracking_id", - "-tracking_id", - "customer_id", - "-customer_id", - "created_at", - "-created_at" - ] - }, - "fields": { - "type": "array", - "enum": [ - [ - "id", - "object", - "date", - "voucher_code", - "campaign", - "promotion_tier_id", - "customer_id", - "customer_source_id", - "customer_name", - "tracking_id", - "order_amount", - "gift_amount", - "loyalty_points", - "result", - "failure_code", - "failure_message", - "metadata" - ] - ], - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique redemption ID. | r_0acf3a6dae00e679c8, rf_0acf3a495740e679b8 |\n| object | Object being exported; by default `redemption`. | redemption |\n| date | Timestamp in ISO 8601 format representing the date and time when the voucher was redeemed. | 2022-03-23T08:52:24.867Z |\n| voucher_code | Unique voucher code redeemed. | WELCOME100 |\n| campaign | Parent campaign name of voucher if applicable. | Summer Discounts 20% off |\n| promotion_tier_id | | promo_Mwy9XpA0TLctSGriM5kum0qp |\n| customer_id | Unique customer ID of redeeming customer. | cust_nk0N1uNQ1YnupAoJGOgvsODC |\n| customer_source_id | Unique source ID of redeeming customer. | name.lastname@email.com |\n| customer_name | Customer name. | John Smith |\n| tracking_id | | track_Pw6r3ejnml43kIwNS4Zj09KZ67xOfLUy |\n| order_amount | Total order amount before applying all discounts. | 1000 |\n| gift_amount | Gift credits used for redemption. | 10 |\n| loyalty_points | | 12 |\n| result | Tells you whether the redemption succeeded. | `SUCCESS`, `FAILURE` |\n| failure_code | Internal Voucherify code for reason why redemption failed. | invalid_customer |\n| failure_message | A human-readable message providing a short description explaining why the redemption failed. | Customer must be a holder of a loyalty card. |\n| metadata | Returns all redemption metadata. | Response will include all redemption metadata. |\n| metadata.X | Where X is the name of a particular redemption metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Redemption. [Read more here](https://support.voucherify.io/article/99-schema-validation-metadata) |", - "items": { - "type": "string" - } - }, - "filters": { - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the export. You can filter the following parameters: \n\n - `voucher_code`\n\n - `related_object_id`\n\n - `related_object_parent_id`\n\n - `parent_redemption_id`\n\n - `failure_code`\n\n - `result`\n\n - `object`\n\n - `customer_id`\n\n - `campaign_name`\n\n - `user_login`" - } - } - }, - "16_obj_export_customer": { - "description": "List of available fields and filters that can be exported with a customer along with the sorting order of the returned data.", - "title": "customer", - "type": "object", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "name", - "-name", - "id", - "-id", - "email", - "-email", - "source_id", - "-source_id", - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ] - }, - "fields": { - "type": "array", - "enum": [ - [ - "name", - "id", - "description", - "email", - "source_id", - "created_at", - "address_city", - "address_state", - "address_line_1", - "address_line_2", - "address_country", - "address_postal_code", - "redemptions_total_redeemed", - "redemptions_total_failed", - "redemptions_total_succeeded", - "redemptions_total_rolled_back", - "redemptions_total_rollback_failed", - "redemptions_total_rollback_succeeded", - "orders_total_amount", - "orders_total_count", - "orders_average_amount", - "orders_last_order_amount", - "orders_last_order_date", - "loyalty_points", - "loyalty_referred_customers", - "updated_at", - "phone", - "birthday", - "metadata", - "birthdate" + "required": [ + "event", + "loyalty" ] - ], - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| name | Customer name. | John Smith |\n| id | Unique customer ID. | cust_J1CDUdbqn5Exva8ASWk1Fq0j |\n| description | An arbitrary string that you can attach to a customer object. | Customer requesting to be added to VIP tier. |\n| email | Customer's email. | name.lastname@email.com |\n| source_id | Unique custom customer identifier. | name.lastname@email.com |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the customer was created. | 2022-02-03T13:10:11.928Z |\n| address_city | City | Houston |\n| address_state | State | TX |\n| address_line_1 | First line of customer's address. | 72738 Main St |\n| address_line_2 | Second line of customer's address. | Bld 2, Apt 4 |\n| address_country | Country | United States of America |\n| address_postal_code | Postal code (ZIP code) | 77042-4143 |\n| redemptions_total_redeemed | Total customer redemptions. | 5 |\n| redemptions_total_failed | Total customer failed redemptions. | 2 |\n| redemptions_total_succeeded | Total customer succeeded redemptions. | 3 |\n| redemptions_total_rolled_back | Total customer redemptions that were rolled back. | 3 |\n| redemptions_total_rollback_failed | Total customer redemptions that were unsuccessfully rolled back. | 2 |\n| redemptions_total_rollback_succeeded | Total customer redemptions that were successfully rolled back. | 1 |\n| orders_total_amount | Total sum of order amounts over customer lifetime. Value is multiplied by 100 to precisely represent 2 decimal places. | 10000 (represents $100) |\n| orders_total_count | Total number of customer orders. Value is multiplied by 100 to precisely represent 2 decimal places. | 2 |\n| orders_average_amount | Average amount spent on orders. Value is multiplied by 100 to precisely represent 2 decimal places. | 50 |\n| orders_last_order_amount | How much did the customer spend on their last order. Value is multiplied by 100 to precisely represent 2 decimal places. | 50 |\n| orders_last_order_date | When was the last customer order; timestamp in ISO 8601 format representing the date and time. | 2022-02-03T13:17:30.630Z |\n| loyalty_points | Sum of customer's loyalty points to go across all loyalty cards. | |\n| loyalty_referred_customers | How many customers were referred by this customer. | |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the customer was updated. | 2022-02-14T14:10:14.305Z |\n| phone | Customer's phone number. | +1 (294) 752-1846 |\n| birthday | Customer's birthday. | 2022-01-01 |\n| birthdate | Customer's birthdate. | 2022-04-29 |\n| metadata | Returns all customer metadata. | Response will include all customer metadata. |\n| metadata.X | Where X is the name of a particular customer metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Customer. [Read more here](https://support.voucherify.io/article/99-schema-validation-metadata) |", - "items": { - "type": "string" - } - }, - "filters": { - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the export. You can filter the following parameters: \n\n - `name` (string)\n\n - `email` (string)\n\n - `phone` (string)\n\n - `metadata` (json)\n\n - `metadata.X` (?)\n\n - `address` (json)\n\n - `address.state` (string)\n\n - `address.country` (string)\n\n - `address.postal_code` (string)\n\n - `birthday` (string - date-time)\n\n - `birthdate` (string date-time)\n\n - `created_at` (date)\n\n - `source_id` (string)\n\n - `system.metadata` (json)\n\n - `system.metadata.source` (string)\n\n - `system.metadata.consents.unsubscribed` (boolean)\n\n - `loyalty_points` (json)\n\n - `loyalty` (json)\n\n - `summary.orders.total_amount` (json)\n\n - `summary.orders.last_order_date` (date)\n\n - `summary.orders.last_order_amount` (json)\n\n - `summary.redemptions.gift.redeemed_amount` (integer)\n\n - `summary.redemptions.total_succeeded` (integer)\n\n - `events.cart_abandoned.last_occurred` (integer)\n\n - `events.newsletter_subscribed.count` (integer)\n\n - `events.sign_up.last_occurred` (integer)" - } - } - }, - "16_obj_export_points_expiration": { - "description": "List of available fields and filters that can be exported with points expirations along with the sorting order of the returned data.", - "title": "points expiration", - "type": "object", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "expires_at", - "-expires_at" - ] - }, - "fields": { - "type": "array", - "enum": [ - [ - "id", - "campaign_id", - "voucher_id", - "status", - "expires_at", - "points" + }, + "8_req_update_earning_rule": { + "description": "Request body schema for updating earning rules using **PUT** `/loyalties/{campaignId}/earning-rules/{earningRuleId}` endpoint.", + "title": "Update Earning Rule Request Body", + "anyOf": [ + { + "$ref": "#/components/schemas/8_req_update_earning_rule_object_order_paid" + }, + { + "$ref": "#/components/schemas/8_req_update_earning_rule_object_entered_segment" + }, + { + "$ref": "#/components/schemas/8_req_update_earning_rule_object_custom_event" + }, + { + "$ref": "#/components/schemas/8_req_update_earning_rule_object_tier" + } ] - ], - "description": "Array of strings containing the data that was exported. These fields define the headers in the CSV file. \n\n The array can be a combintation of any of the following available fields: \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n |\n| campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 |\n| status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` |\n| expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 |\n| points | Number of points. | 1000 |", - "items": { - "type": "string" - } - }, - "filters": { - "description": "Data filters used to narrow the data records to be returned in the export. You can filter the following parameters: \n\n - `campaign_id`\n\n - `voucher_id`", - "anyOf": [ - { - "$ref": "#/components/schemas/16_obj_filter_points_expiration_campaign_id" - }, - { - "$ref": "#/components/schemas/16_obj_filter_points_expiration_voucher_id" + }, + "8_res_list_earning_rules": { + "description": "Response body schema for listing earning rules using **GET** `/loyalties/{campaignId}/earning-rules` endpoint.", + "type": "object", + "title": "List Earning Rules Response Body", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about earning rules in a dictionary.", + "default": "list" + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of earning rule objects." + }, + "data": { + "type": "array", + "description": "Contains array of earning rule objects.", + "items": { + "$ref": "#/components/schemas/8_obj_earning_rule_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of earning rule objects." + } } - ] - } - } - }, - "16_obj_export_gift_card_transactions": { - "description": "List of available fields and filters that can be exported with gift card transactions along with the sorting order of the returned data.", - "title": "gift card transactions", - "type": "object", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "-created_at", - "created_at" - ] - }, - "fields": { - "type": "array", - "enum": [ - [ - "id", - "type", - "source_id", - "reason", - "balance", - "amount", - "created_at", - "voucher_id", - "campaign_id", - "source", - "details" - ] - ], - "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
- `CREDITS_ADDITION`
- `CREDITS_REFUND`
- `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |", - "items": { - "type": "string" - } - }, - "filters": { - "$ref": "#/components/schemas/16_obj_filter_gift_card_transactions_voucher_id" - } - } - }, - "16_obj_export_loyalty_card_transactions": { - "description": "List of available fields and filters that can be exported with loyalty card transactions along with the sorting order of the returned data.", - "title": "loyalty card transactions", - "type": "object", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "-created_at", - "created_at" - ] - }, - "fields": { - "type": "array", - "enum": [ - [ - "id", - "type", - "source_id", - "reason", - "balance", - "amount", - "created_at", - "voucher_id", - "campaign_id", - "details", - "related_transaction_id" - ] - ], - "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID assigned by Voucherify. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `POINTS_EXPIRATION`
- `POINTS_ADDITION`
- `POINTS_REMOVAL`
- `POINTS_TRANSFER_OUT`
- `POINTS_ACCRUAL`
- `POINTS_REFUND`
- `POINTS_REDEMPTION` |\n| source_id | Custom source ID of the transaction if one was included originally. | source_id_custom |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The loyalty card balance after the transaction. | |\n| amount | The amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | - `API`
- `voucherify-web-ui`
- `Automation` |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n| related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |", - "items": { - "type": "string" - } - }, - "filters": { - "$ref": "#/components/schemas/16_obj_filter_loyalty_card_transactions_voucher_id" - } - } - }, - "16_obj_filter_publication_failure_code": { - "description": "Filter conditions set on the publication `failure_code`. Available options are:\n\n - `not_found`,\n\n - `no_voucher_suitable_for_publication`\n\n - `voucher_already_published`\n\n - `duplicate_source_id`\n\n - `too_many_vouchers_requested`", - "title": "Filter by failure code", - "type": "object", - "properties": { - "failure_code": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_publication_result": { - "description": "Filter conditions set on the publication `result`. Available options are:\n\n - `SUCCESS`\n\n - `FAILURE`", - "title": "Filter by result", - "type": "object", - "properties": { - "result": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_publication_customer_id": { - "description": "Filter conditions set on the publication `customer_id`.", - "title": "Filter by customer ID", - "type": "object", - "properties": { - "customer_id": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_publication_campaign_name": { - "description": "Filter conditions set on the publication `campaign_name`.", - "title": "Filter by campaign name", - "type": "object", - "properties": { - "campaign_name": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_publication_voucher_type": { - "description": "Filter conditions set on the publication `voucher_type`.", - "title": "Filter by voucher type", - "type": "object", - "properties": { - "voucher_type": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_publication_is_referral_code": { - "description": "Filter conditions set on the publication `is_referral_code`.", - "title": "Filter if the code is a referral code", - "type": "object", - "properties": { - "is_referral_code": { - "$ref": "#/components/schemas/16_filter_conditions_boolean" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_publication_parent_object_id": { - "description": "Filter conditions set on the publication `parent_object_id`, which is the parent campaigns unique ID assigned by Voucherify.", - "title": "Filter by parent object ID", - "type": "object", - "properties": { - "parent_object_id": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_publication_related_object_id": { - "description": "Filter conditions set on the publication `related_object_id`.", - "title": "Filter by related object ID", - "type": "object", - "properties": { - "related_object_id": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_publication_source_id": { - "description": "Filter conditions set on the publication `source_id`.", - "title": "Filter by publication source ID", - "type": "object", - "properties": { - "source_id": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_order_status": { - "description": "Filter conditions set on the order `status`.", - "title": "Filter by status", - "type": "object", - "properties": { - "status": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_order_source_id": { - "description": "Filter conditions set on the order `source_id`.", - "title": "Filter by order source ID", - "type": "object", - "properties": { - "source_id": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_order_amount": { - "description": "Filter conditions set on the order `amount`.", - "title": "Filter by order amount", - "type": "object", - "properties": { - "amount": { - "$ref": "#/components/schemas/16_filter_conditions_number" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_order_total_amount": { - "description": "Filter conditions set on the order `total_amount`.", - "title": "Filter by order total amount", - "type": "object", - "properties": { - "total_amount": { - "$ref": "#/components/schemas/16_filter_conditions_number" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_order_discount_amount": { - "description": "Filter conditions set on the order `discount_amount`.", - "title": "Filter by order discount amount", - "type": "object", - "properties": { - "discount_amount": { - "$ref": "#/components/schemas/16_filter_conditions_number" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_order_total_discount_amount": { - "description": "Filter conditions set on the order `total_discount_amount`.", - "title": "Filter by order total discount amount", - "type": "object", - "properties": { - "total_discount_amount": { - "$ref": "#/components/schemas/16_filter_conditions_number" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_order_items_discount_amount": { - "description": "Filter conditions set on the order `items_discount_amount`.", - "title": "Filter by order items discount amount", - "type": "object", - "properties": { - "items_discount_amount": { - "$ref": "#/components/schemas/16_filter_conditions_number" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_points_expiration_campaign_id": { - "description": "Filter conditions set on`the `campaign_id`.", - "title": "Filter by campaign ID", - "type": "object", - "properties": { - "campaign_id": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_points_expiration_voucher_id": { - "description": "Filter conditions set on`the `voucher_id`.", - "title": "Filter by voucher ID", - "type": "object", - "properties": { - "voucher_id": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_gift_card_transactions_voucher_id": { - "description": "Filter conditions set on`the `voucher_id`.", - "title": "Filter by voucher ID", - "type": "object", - "properties": { - "voucher_id": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_loyalty_card_transactions_voucher_id": { - "description": "Filter conditions set on`the `voucher_id`.", - "title": "Filter by voucher ID", - "type": "object", - "properties": { - "voucher_id": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_filter_junction": { - "description": "Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE.", - "title": "Logical Operator Between Filters", - "type": "string", - "enum": [ - "AND", - "OR" - ] - }, - "16_filter_conditions_string": { - "title": "Filter by conditions", - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "conditions": { - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "$in": { - "type": "array", - "description": "Array of resource values that should be included in the results. (multiple values)", + }, + "8_req_add_remove_points_balance": { + "title": "Add or Remove Points Balance Request Body", + "type": "object", + "description": "Request schema for adding or removing points from a loyalty card.", + "properties": { + "points": { + "type": "integer", + "description": "Incremental balance to be added to/subtracted from the loyalty card. \n\nTo add points: `100` \nTo subtract points, add a minus: `-100`" + }, + "expiration_type": { + "type": "string", + "default": "PROGRAM_RULES", + "enum": [ + "PROGRAM_RULES", + "NON_EXPIRING", + "CUSTOM_DATE" + ], + "description": "Set the type of expiration for added points. \n- `PROGRAM_RULES`: Inherit rules from campaign.\n- `NON_EXPIRING`: Points never expire.\n- `CUSTOM_DATE`: Points expire on a particular date. **Requires** `expiration_date` parameter." + }, + "expiration_date": { + "type": "string", + "description": "Set expiration date for added points, i.e. `YYYY-MM-DD`. This parameter is **required** only when `expiration_type` is set to `CUSTOM_DATE`.", + "example": "2020-05-30" + }, + "reason": { + "type": "string", + "description": "Reason for the transfer." + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." + } + } + }, + "8_res_add_remove_points_balance": { + "description": "Response schema for adding or removing points from a loyalty card.", + "type": "object", + "title": "Add or Remove Loyalty Card Balance Response Body", + "properties": { + "points": { + "type": "integer", + "description": "The incremental points removed or added to the current balance on the loyalty card." + }, + "total": { + "type": "integer", + "description": "The total of points accrued over the lifetime of the loyalty card." + }, + "balance": { + "type": "integer", + "description": "The balance after adding/removing points." + }, + "type": { + "type": "string", + "description": "The type of voucher being modified.", + "default": "loyalty_card" + }, + "object": { + "type": "string", + "description": "The type of object represented by JSON. Default is `balance`.", + "default": "balance" + }, + "related_object": { + "type": "object", + "description": "Defines the object that is being modified with the values that are returned in the balance object.", + "properties": { + "type": { + "type": "string", + "description": "The object being modified.", + "default": "voucher" + }, + "id": { + "type": "string", + "description": "Identifies the loyalty card that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + } + } + } + } + }, + "8_req_transfer_loyalty_points": { + "description": "Request body schema for transferring points from a loyalty card.", + "type": "array", + "title": "Transfer Loyalty Points Request Body", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Unique loyalty card code from which the user wants to transfer loyalty points (source).", + "example": "L-CARD-02hgnq4" + }, + "points": { + "type": "integer", + "description": "The number of loyalty points that the user wants to transfer to another loyalty card. The number of points cannot be higher than the current balance on the loyalty card (source).", + "example": 2 + }, + "reason": { + "type": "string", + "description": "Reason for the transfer." + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." + } + } + } + }, + "8_req_redeem_reward": { + "description": "Request body schema for redeeming a reward.", + "type": "object", + "title": "Redeem Reward Request Body", + "properties": { + "reward": { + "type": "object", + "description": "Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward if the reward is a pay with points reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward.", + "example": "rew_eSi4eYJk7o3tOycvweicR2z7" + }, + "points": { + "type": "integer", + "description": "The number of loyalty points that the user wants to spend in order to fulfill the order. The number of points cannot be higher than the current balance on the loyalty card." + } + } + }, + "order": { + "$ref": "#/components/schemas/8_req_order_object_redeem_reward", + "description": "Order object that is **required** when redeeming a pay with points reward." + }, + "metadata": { + "type": "object", + "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + } + } + }, + "8_req_order_object_redeem_reward": { + "type": "object", + "title": "Order object", + "description": "Request body schema for creating an order, **required** when redeeming a pay with points reward.", + "properties": { + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of an integration between multiple systems. It can be an order ID from a CRM system, database or 3rd-party service." + }, + "status": { + "type": "string", + "description": "The order status.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULLFILLED" + ] + }, + "amount": { + "type": "integer", + "description": "A positive integer in the smallest currency unit (that is, 100 cents for $1.00) representing the total amount of the order; this is the sum of the order items' amounts." + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format." + }, + "referrer": { + "$ref": "#/components/schemas/10_req_orders_referrer_object" + }, "items": { + "$ref": "#/components/schemas/10_req_orders_items_array" + } + } + }, + "8_res_redeem_reward": { + "description": "Response body schema for redeeming a reward.", + "title": "Redeem Reward Response Body", + "$ref": "#/components/schemas/8_obj_redemption_object_loyalty_card_extended" + }, + "8_obj_redemption_object_loyalty_card_extended": { + "type": "object", + "title": "Loyalty Card Voucher", + "description": "This is an object representing a redemption. \n\nRedemption is the key operation in the voucher lifecycle. A customer can redeem a voucher 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](rollback-redemption).", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the redemption.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "amount": { + "type": "integer", + "description": "Number of points being redeemed for a reward." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the reward.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object. i.e. `voucher`.", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Defines the details of the voucher being redeemed." + }, + "reward": { + "description": "Defines the reward being redeemed.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" + } + ] + }, + "loyalty_card": { + "type": "object", + "description": "Stores the number of points being subtracted from the loyalty card for the reward redemption.", + "properties": { + "points": { + "type": "integer", + "description": "Number of points being subtracted from the loyalty card for the reward redemption." + } + } + } + } + }, + "8_res_loyalties_campaign_id_tiers_tier_id_earning_rules": { + "type": "object", + "properties": { + "object": { + "type": "string" + }, + "data_ref": { "type": "string" + }, + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "updated_at": { + "type": "null" + }, + "validation_rule_id": { + "type": "null" + }, + "loyalty": { + "type": "object", + "properties": { + "points": { + "type": "integer" + }, + "type": { + "type": "string" + } + } + }, + "event": { + "type": "string" + }, + "source": { + "type": "object", + "properties": { + "banner": { + "type": "string" + }, + "object_id": { + "type": "string" + }, + "object_type": { + "type": "string" + } + } + }, + "active": { + "type": "boolean" + }, + "object": { + "type": "string" + }, + "automation_id": { + "type": "string" + }, + "custom_event": { + "type": "object", + "properties": { + "schema_id": { + "type": "string" + } + } + } + } + } + }, + "total": { + "type": "integer" } }, - "$not_in": { - "type": "array", - "description": "Array of resource values that should be included in the results. (multiple values)", - "items": { + "description": "Response body schema for `/loyalties/{campaignId}/tiers/{tierId}/earning-rules`.", + "title": "List Loyalty Tier Earning Rules" + }, + "8_res_loyalties_campaign_id_tiers_tier_id_rewards": { + "title": "List Loyalty Tier Rewards", + "type": "object", + "properties": { + "id": { "type": "string" } }, - "$is": { - "type": "string", - "description": "Value is exactly this value. (single value)" - }, - "$is_not": { - "type": "string", - "description": "Results omit this value. (single value)" - }, - "$has_value": { - "type": "string", - "description": "Value is NOT null. The value for this parameter is an empty string." - }, - "$is_unknown": { - "type": "string", - "description": "Value is null. The value for this parameter is an empty string." - }, - "$starts_with": { - "type": "string", - "description": "Value starts with the specified string." - }, - "$ends_with": { - "type": "string", - "description": "Value ends with the specified string." + "description": "Response body schema for `/loyalties/{campaignId}/tiers/{tierId}/rewards`." + }, + "8_res_loyalties_campaign_id_reward-assignments_assignment_id": { + "type": "object", + "description": "Response body schema for `/loyalties/{campaignId}/reward-assignments/{assignmentId}`", + "title": "Get Reward Assignment", + "properties": { + "id": { + "type": "string", + "example": "rewa_hzc19a5NLyIr2bVL3UB1w0B3" + }, + "reward_id": { + "type": "string", + "example": "rew_JhjeISE1npQyxRmGV1JYohDP" + }, + "related_object_id": { + "type": "string", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + }, + "related_object_type": { + "type": "string", + "example": "campaign" + }, + "created_at": { + "type": "string", + "example": "2021-12-13T11:58:32.261Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2022-01-13T11:58:32.261Z", + "format": "date-time" + }, + "object": { + "type": "string", + "default": "reward_assignment" + } } - } - } - } - }, - "16_filter_conditions_number": { - "title": "Filter by conditions", - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "conditions": { - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "$in": { - "type": "array", - "description": "Array of resource values that should be included in the results. (multiple values)", - "items": { - "type": "integer" + }, + "8_res_loyalties_campaign_id_reward-assignments_assignment_id_reward": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "parameters": { + "type": "object", + "properties": { + "coin": { + "type": "object", + "properties": { + "exchange_ratio": { + "type": "number" + }, + "points_ratio": { + "type": "integer" + } + } + } + } + }, + "stock": { + "type": "null" + }, + "redeemed": { + "type": "null" + }, + "attributes": { + "type": "object", + "properties": {} + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "null", + "format": "date-time" + }, + "object": { + "type": "string" } }, - "$not_in": { - "type": "array", - "description": "Array of resource values that should be included in the results. (multiple values)", - "items": { - "type": "integer" + "description": "Response body schema for `/loyalties/{campaignId}/reward-assignments/{assignmentId}/`", + "title": "Get Reward Details" + }, + "8_obj_export_object_points_expiration": { + "title": "Points Expirations Export Object", + "type": "object", + "description": "This is an object representing an export of points expirations. ", + "properties": { + "id": { + "type": "string", + "description": "Unique export ID.", + "example": "exp_FFfp9o7daWuJqJCKp5xqqli4" + }, + "object": { + "type": "string", + "default": "export", + "description": "The type of object being represented. This object stores information about the export." + }, + "created_at": { + "type": "string", + "example": "2022-04-28T11:23:20.922Z", + "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format.", + "format": "date-time" + }, + "status": { + "type": "string", + "description": "Status of the export. Informs you whether the export has already been completed.", + "enum": [ + "SCHEDULED", + "IN_PROGRESS", + "DONE", + "ERROR" + ] + }, + "channel": { + "type": "string", + "description": "The channel through which the export was triggered.", + "enum": [ + "API", + "WEBSITE" + ] + }, + "exported_object": { + "type": "string", + "description": "The type of exported object.", + "enum": [ + "points_expiration" + ] + }, + "parameters": { + "type": "object", + "description": "List of fields and filters that were passed in the request body to create the export.", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "expires_at", + "-expires_at" + ] + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data that was exported. These fields define the headers in the CSV file. \n\n The array can be a combination of any of the following available fields: \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n |\n| campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 |\n| status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` |\n| expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 |\n| points | Number of points. | 1000 |", + "items": { + "type": "string" + } + }, + "filters": { + "description": "Data filters used to narrow the data records to be returned in the export.", + "anyOf": [ + { + "$ref": "#/components/schemas/8_req_filter_campaign_id" + }, + { + "$ref": "#/components/schemas/8_req_filter_voucher_id" + } + ] + } + } + }, + "result": { + "type": "object", + "description": "Contains the URL of the CSV file.", + "properties": { + "url": { + "type": "string", + "description": "URL of the CSV file location." + } + } + }, + "user_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0Fr", + "description": " The user_id identifies the specific user who initiated the export through the Voucherify Dashboard; this `user_id` is returned when the channel value is `WEBSITE`." + } + } + }, + "8_req_export_points_expirations": { + "title": "Points Expirations Export Request Body", + "type": "object", + "description": "Request body schema for creating points expirations. ", + "properties": { + "parameters": { + "type": "object", + "description": "List of fields and filters that were passed in the request body to create the export.", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "expires_at", + "-expires_at" + ] + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data that was exported. These fields define the headers in the CSV file. \n\n The array can be a combintation of any of the following available fields: \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n |\n| campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 |\n| status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` |\n| expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 |\n| points | Number of points. | 1000 |", + "items": { + "type": "string" + } + }, + "filters": { + "description": "Data filters used to narrow the data records to be returned in the export.", + "anyOf": [ + { + "$ref": "#/components/schemas/8_req_filter_campaign_id" + }, + { + "$ref": "#/components/schemas/8_req_filter_voucher_id" + } + ] + } + } + } + } + }, + "8_req_filter_campaign_id": { + "title": "Filter by campaign ID", + "type": "object", + "description": "Filter conditions set on the campaign ID.", + "properties": { + "campaign_id": { + "$ref": "#/components/schemas/8_req_filter_conditions" + }, + "junction": { + "type": "string", + "description": "Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `and` is an all-inclusive logical operator, meaning the `and` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `or` operator displays a record if **ANY** of the conditions separated by OR is TRUE.", + "enum": [ + "AND", + "OR" + ] + } + } + }, + "8_req_filter_voucher_id": { + "title": "Filter by voucher ID", + "type": "object", + "description": "Filter conditions set on the voucher ID.", + "properties": { + "voucher_id": { + "$ref": "#/components/schemas/8_req_filter_conditions" + }, + "junction": { + "type": "string", + "description": "Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `and` is an all-inclusive logical operator, meaning the `and` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `or` operator displays a record if **ANY** of the conditions separated by OR is TRUE.", + "enum": [ + "AND", + "OR" + ] + } + } + }, + "8_req_filter_junction": { + "title": "Filter by campaign ID", + "type": "object", + "description": "Filter conditions by campaign ID.", + "properties": { + "junction": { + "type": "string", + "description": "Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `and` is an all-inclusive logical operator, meaning the `and` operator displays a record if all the conditions separated by AND are TRUE, while an `or` operator displays a record if any of the conditions separated by OR is TRUE." + } + } + }, + "8_req_filter_conditions": { + "title": "Filter by conditions", + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "conditions": { + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "$in": { + "type": "array", + "description": "Array of resource values that should be included in the results.", + "items": { + "type": "string" + } + }, + "$not_in": { + "type": "array", + "description": "Array of resource values that should be included in the results.", + "items": { + "type": "string" + } + }, + "$is": { + "type": "string", + "description": "Specify the exact resource value." + }, + "$is_not": { + "type": "string", + "description": "Results should omit this value." + } + } + } + } + }, + "8_res_list_reward_assignments": { + "title": "List Reward Assignments", + "type": "object", + "description": "Response body schema for **GET** `/loyalties/{campaignId}/rewards`.", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about loyalty reward assignments in a dictionary.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of reward assignment objects.", + "default": "data" + }, + "data": { + "type": "array", + "description": "Contains array of reward assignment objects.", + "items": { + "$ref": "#/components/schemas/4_obj_reward_assignment_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of reward assignment objects." + } + } + }, + "8_res_list_loyalty_tiers": { + "title": "List Loyalty Tiers", + "type": "object", + "description": "Response body schema for listing loyalty tiers for a campaign using **GET** `/loyalties/{campaignId}/tiers`.", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of loyalty tier objects.", + "default": "data" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/8_obj_loyalty_tier_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of loyalty tier objects." + } + } + }, + "8_res_get_member_loyalty_tier": { + "title": "Get Member's Loyalty Tier Response Body", + "type": "object", + "description": "Response body schema for retrieving a member's loyalty tier for a campaign using **GET** `/loyalties/members/{memberId}/tiers`.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of loyalty tier objects." + }, + "data": { + "type": "array", + "description": "Contains array of loyalty tier objects.", + "items": { + "$ref": "#/components/schemas/8_obj_loyalty_tier_object_member" + } + }, + "total": { + "type": "integer", + "description": "Total number of loyalty tiers." + } + } + }, + "8_req_create_reward_assignment": { + "title": "Create Reward Assignment Request Body", + "type": "array", + "description": "Request body schema for **POST** `/loyalties/{campaignId}/rewards`.", + "items": { + "type": "object", + "properties": { + "reward": { + "type": "string", + "example": "rew_2yGflHThU2yJwFECEFKrXBI2", + "description": "Unique reward ID." + }, + "parameters": { + "type": "object", + "description": "An object that defines the price of the reward in loyalty points.", + "properties": { + "loyalty": { + "type": "object", + "description": "Stores the points parameter.", + "properties": { + "points": { + "type": "integer", + "description": "Defines how many points are required to obtain the reward." + } + } + } + } + } + } + } + }, + "8_res_create_reward_assignment": { + "title": "Create Reward Assignment Response Body", + "type": "array", + "description": "Response body schema for **POST** `/loyalties/{campaignId}/rewards`.", + "items": { + "$ref": "#/components/schemas/4_obj_reward_assignment_object" + } + }, + "8_req_update_reward_assignment": { + "title": "Update Reward Assignment Request Body", + "type": "object", + "description": "Request body schema for **PUT** `/loyalties/{campaignId}/rewards/{assignmentId}`.", + "properties": { + "parameters": { + "type": "object", + "description": "An object that defines the price of the reward in loyalty points.", + "properties": { + "loyalty": { + "type": "object", + "description": "Stores the points parameter.", + "properties": { + "points": { + "type": "integer", + "description": "Defines how many points are required to obtain the reward." + } + } + } + } + } + } + }, + "8_res_list_loyalty_tier_earning_rules": { + "title": "List Loyalty Tier Earning Rules", + "type": "object", + "description": "Response body schema for `/loyalties/{campaignId}/tiers/{tierId}/earning-rules`.", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about loyalty tier earning rules in a dictionary." + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of loyalty tier earning rule objects." + }, + "data": { + "type": "array", + "description": "Contains array of loyalty tier earning rules.", + "items": { + "$ref": "#/components/schemas/8_obj_earning_rule_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of earning rule objects." + } + } + }, + "8_res_list_loyalty_tier_rewards": { + "title": "List Loyalty Tier Rewards", + "type": "object", + "description": "Response schema for `/loyalties/{campaignId}/tiers/{tierId}/rewards`.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about loyalty tier rewards in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of loyalty tier reward objects." + }, + "data": { + "type": "array", + "description": "Contains array of loyalty tier reward objects.", + "items": { + "$ref": "#/components/schemas/8_obj_loyalty_tier_reward_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of loyalty tier reward objects." + } + } + }, + "8_res_list_members": { + "title": "List Members", + "type": "object", + "description": "Response body schema for **GET** `/loyalties/{campaignId}/members`.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about members in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "vouchers", + "description": "Identifies the name of the attribute that contains the array of voucher objects." + }, + "vouchers": { + "type": "array", + "description": "Contains array of voucher objects representing loyalty cards, in other words, loyalty program members.", + "items": { + "$ref": "#/components/schemas/8_obj_loyalty_card_object_non_expanded_categories" + } + }, + "total": { + "type": "integer", + "description": "Total number of voucher objects." + } + } + }, + "8_req_add_member": { + "title": "Add Member Request Body", + "type": "object", + "description": "Request body schema for assigning a loyalty card to a customer using **POST** `/loyalties/{campaignId}/members`.", + "properties": { + "voucher": { + "type": "string", + "description": "Specify the loyalty card code that you would like to publish to a customer." + }, + "channel": { + "type": "string", + "description": "Specify the distribution channel." + }, + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/8_req_customer_id_string" + }, + { + "$ref": "#/components/schemas/8_req_customer_id" + }, + { + "$ref": "#/components/schemas/8_req_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "metadata": { + "type": "string", + "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." } - }, - "$is": { - "type": "integer", - "description": "Value is exactly this value. (single value)" - }, - "$is_not": { - "type": "integer", - "description": "Results omit this value. (single value)" - }, - "$has_value": { - "type": "string", - "description": "Value is NOT null. The value for this parameter is an empty string." - }, - "$is_unknown": { - "type": "string", - "description": "Value is null. The value for this parameter is an empty string." - }, - "$more_than": { - "type": "integer", - "description": "Value is more than the specified number." - }, - "$more_than_equal": { - "type": "integer", - "description": "Value is more than or equal to the specified number." - }, - "$less_than": { - "type": "integer", - "description": "Value is less than the specified number." - }, - "$less_than_equal": { - "type": "integer", - "description": "Value is less than or equal to the specified number." } - } - } - } - }, - "16_filter_conditions_array": { - "title": "Filter by conditions", - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "conditions": { - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "$in": { - "type": "array", - "description": "Array of resource values that should be included in the results. (multiple values)", - "items": { - "type": "string" + }, + "8_req_customer_id": { + "title": "Customer ID", + "description": "You can pass the unique customer ID that was assigned by Voucherify.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of an existing customer." } - }, - "$not_in": { - "type": "array", - "description": "Array of resource values that should be included in the results. (multiple values)", - "items": { - "type": "string" + } + }, + "8_req_customer_id_string": { + "title": "Customer ID", + "description": "You can pass the unique customer ID that was assigned by Voucherify or the source ID.", + "type": "string" + }, + "8_req_customer_source_id": { + "title": "Customer Source ID", + "description": "You can send the source ID that you used to create the customer in Voucherify.", + "type": "object", + "properties": { + "source_id": { + "type": "string", + "description": "A unique identifier of a customer. It can be a customer ID or email from a CRM system, database or 3rd-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored." } - }, - "$is": { - "type": "string", - "description": "Value is exactly this value. (single value)" - }, - "$is_not": { - "type": "string", - "description": "Results omit this value. (single value)" - }, - "$has_value": { - "type": "string", - "description": "Value is NOT null. The value for this parameter is an empty string." - }, - "$is_unknown": { - "type": "string", - "description": "Value is null. The value for this parameter is an empty string." - }, - "$starts_with": { - "type": "string", - "description": "Value starts with the specified string." - }, - "$ends_with": { - "type": "string", - "description": "Value ends with the specified string." - }, - "$count": { - "type": "integer", - "description": "Value has exactly this number of elements." - }, - "$count_less": { - "type": "integer", - "description": "Value has less than this number of elements." - }, - "$count_more": { - "type": "integer", - "description": "Value has more than this number of elements." - }, - "$contains": { - "type": "string", - "description": "Array contains this element." } - } - } - } - }, - "16_filter_conditions_boolean": { - "title": "Filter by conditions", - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "conditions": { - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "$is": { - "type": "string", - "description": "Value is exactly this value. (single value)" - }, - "$is_not": { - "type": "string", - "description": "Results omit this value. (single value)" - }, - "$has_value": { - "type": "string", - "description": "Value is NOT null. The value for this parameter is an empty string." - }, - "$is_unknown": { - "type": "string", - "description": "Value is null. The value for this parameter is an empty string." + }, + "8_res_get_member_activities": { + "title": "Get Member Activities", + "type": "object", + "description": "Response body schema for retrieving member activities.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about member activities in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "activities", + "description": "Identifies the name of the attribute that contains the array of event objects." + }, + "activities": { + "type": "array", + "description": "Contains array of event objects.", + "items": {} + }, + "total": { + "type": "integer", + "description": "Total number of event objects." + } } - } - } - } - }, - "16_filter_conditions_date": { - "title": "Filter by conditions", - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "conditions": { - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "$after": { - "type": "string", - "description": "Value is after this date. Value for this parameter is in ISO 8601 format." - }, - "$before": { - "type": "string", - "description": "Value is before this date. Value for this parameter is in ISO 8601 format." - }, - "$has_value": { - "type": "string", - "description": "Value is NOT null. The value for this parameter is an empty string." - }, - "$is_unknown": { - "type": "string", - "description": "Value is null. The value for this parameter is an empty string." + }, + "8_res_list_member_rewards": { + "title": "List Member Rewards", + "type": "object", + "description": "Response body schema for `/loyalties/members/{memberId}/rewards`.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about member rewards in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of loyalty reward objects." + }, + "data": { + "type": "array", + "description": "Contains array of loyalty reward objects.", + "items": { + "$ref": "#/components/schemas/8_obj_loyalty_reward_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of loyalty reward objects." + } } - } - } - } - }, - "16_filter_conditions_date_time": { - "title": "Filter by conditions", - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "conditions": { - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "$after": { - "type": "string", - "description": "Value is after this date. Value for this parameter is in ISO 8601 format.", - "format": "date-time" - }, - "$before": { - "type": "string", - "description": "Value is before this date. Value for this parameter is in ISO 8601 format.", - "format": "date-time" - }, - "$has_value": { - "type": "string", - "description": "Value is NOT null. The value for this parameter is an empty string." - }, - "$is_unknown": { - "type": "string", - "description": "Value is null. The value for this parameter is an empty string." + }, + "8_res_get_points_expiration": { + "title": "Get Points Expiration Response Body", + "type": "object", + "description": "Response body schema for `/loyalties/{campaignId}/members/{memberId}/points-expiration`.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about loyalty points expiration buckets in a dictionary." + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of loyalty points expiration bucket objects.", + "default": "data" + }, + "data": { + "type": "array", + "description": "Contains array of loyalty points expiration buckets.", + "items": { + "$ref": "#/components/schemas/8_obj_loyalty_points_bucket" + } + }, + "total": { + "type": "integer", + "description": "Total number of point expiration buckets." + } } - } - } - } - }, - "17_obj_async_action_object": { - "title": "Async Action Object", - "type": "object", - "description": "This is an object representing an asynchronous action.", - "x-tags": [ - "ASYNC ACTIONS API" - ], - "properties": { - "id": { - "type": "string", - "example": "aa_0adad13d6f057f088e", - "description": "Async action unique ID." - }, - "type": { - "type": "string", - "description": "Type of async action.", - "enum": [ - "CAMPAIGN.VOUCHERS_IMPORT", - "CAMPAIGN.VOUCHERS_IMPORT_CSV", - "CAMPAIGN.VOUCHERS_UPDATE", - "CAMPAIGN.VOUCHERS_DELETE", - "CAMPAIGN.VOUCHERS_GENERATE", - "CAMPAIGNS.METADATA_KEY_PURGE", - "CUSTOMERS.IMPORT_CSV", - "CUSTOMERS.BULK_UPDATE", - "CUSTOMERS.METADATA_UPDATE", - "CUSTOMERS.METADATA_KEY_PURGE", - "PRODUCTS.BULK_UPDATE", - "PRODUCTS.METADATA_UPDATE", - "PRODUCTS.METADATA_KEY_PURGE", - "PRODUCTS.IMPORT_CSV", - "SKUS.IMPORT_CSV", - "VOUCHERS.IMPORT", - "VOUCHERS.IMPORT_CSV", - "VOUCHERS.BULK_UPDATE", - "VOUCHERS.METADATA_UPDATE", - "VOUCHERS.METADATA_KEY_PURGE", - "ORDERS.IMPORT", - "ORDERS.METADATA_KEY_PURGE" - ] - }, - "status": { - "type": "string", - "description": "Status of async action. Informs you whether the async action has already been completed.", - "enum": [ - "ENQUEUED", - "IN_PROGRESS", - "DONE", - "FAILED" - ] - }, - "result": { - "anyOf": [ - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_vouchers_import" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_vouchers_import_csv" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_vouchers_update" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_vouchers_delete" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_vouchers_generate" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_metadata_key_purge" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_customers_import_csv" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_customers_bulk_update" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_customers_metadata_update" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_customers_metadata_key_purge" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_products_bulk_update" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_products_metadata_update" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_products_import_csv" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_skus_import_csv" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_products_metadata_key_purge" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_vouchers_import" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_vouchers_import_csv" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_vouchers_bulk_update" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_vouchers_metadata_update" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_vouchers_metadata_key_purge" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_orders_import" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_orders_metadata_key_purge" + }, + "9_req_create_customer": { + "type": "object", + "title": "Customer", + "description": "This is an object containing information about the customer.", + "properties": { + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service. \n\nPlease note that if you would like your data to sync based on the `source_id` of the customer, you need to define the `source_id` upfront. You will not be able to change or update the `source_id` later on." + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a customer object." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "phone": { + "type": "string", + "description": "Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel." + }, + "address": { + "type": "object", + "description": "Customer's address.", + "properties": { + "city": { + "type": "string", + "description": "City" + }, + "state": { + "type": "string", + "description": "State" + }, + "line_1": { + "type": "string", + "description": "First line of address." + }, + "line_2": { + "type": "string", + "description": "Second line of address." + }, + "country": { + "type": "string", + "description": "Country." + }, + "postal_code": { + "type": "string", + "description": "Postal code." + } + } + }, + "birthdate": { + "type": "string", + "description": "Customer's birthdate; format `YYYY-MM-DD`.", + "format": "date" + }, + "birthday": { + "type": "string", + "description": "Customer's birthdate; format `YYYY-MM-DD`.", + "format": "date" + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. " + } } - ] - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the async action was scheduled in ISO 8601 format.", - "example": "2022-06-23T11:21:45.578Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "example": "2022-06-23T11:21:46.795Z", - "description": "Timestamp representing the date and time when the async action was updated in ISO 8601 format.", - "format": "date-time" - }, - "request_id": { - "type": "string", - "example": "v-0b45cee140c3c9b5ca", - "description": "Unique request ID." - }, - "processing_time": { - "type": "integer", - "example": 1217, - "description": "The length of time it took to process the request in milliseconds." - }, - "progress": { - "type": "integer", - "description": "% progress to completion of the asynchronous action.", - "minimum": 0, - "maximum": 100 - }, - "object": { - "type": "string", - "default": "async_action", - "description": "The type of object represented by JSON. This object stores information about the `async_action`." - } - } - }, - "17_res_list_async_actions_GET": { - "description": "Response body schema for listing asynchronous actions. \n\nThe table below lists the possible types of async actions. The types are different for each endpoint generating the async action.\n\n| **Types by Context** |\n|:---|\n| **CAMPAIGN** |\n| CAMPAIGN.VOUCHERS_IMPORT
CAMPAIGN.VOUCHERS_IMPORT_CSV
CAMPAIGN.VOUCHERS_UPDATE
CAMPAIGN.VOUCHERS_DELETE
CAMPAIGN.VOUCHERS_GENERATE |\n| **CUSTOMERS** |\n| CUSTOMERS.IMPORT_CSV
CUSTOMERS.BULK_UPDATE
CUSTOMERS.METADATA_UPDATE
CUSTOMERS.METADATA_KEY_PURGE |\n| **PRODUCTS** |\n| PRODUCTS.BULK_UPDATE
PRODUCTS.METADATA_UPDATE
PRODUCTS.METADATA_KEY_PURGE
PRODUCTS.IMPORT_CSV
SKUS.IMPORT_CSV |\n| **VOUCHERS** |\n| VOUCHERS.IMPORT
VOUCHERS.IMPORT_CSV
VOUCHERS.BULK_UPDATE
VOUCHERS.METADATA_UPDATE
VOUCHERS.METADATA_KEY_PURGE |", - "type": "object", - "examples": [ - { - "object": "list", - "data_ref": "async_actions", - "async_actions": [ - { - "id": "aa_0ae2af6a38161f8c79", - "type": "CAMPAIGN.VOUCHERS_DELETE", - "status": "DONE", - "created_at": "2022-04-07T11:34:39.072Z", - "object": "async_action" - }, - { - "id": "aa_0ae27a55b696a4e0f0", - "type": "CUSTOMERS.BULK_UPDATE", - "status": "DONE", - "created_at": "2022-04-07T07:42:44.442Z", - "object": "async_action" - }, - { - "id": "aa_0adad13d6f057f088e", - "type": "CAMPAIGN.VOUCHERS_IMPORT", - "status": "DONE", - "created_at": "2022-04-01T08:54:35.196Z", - "object": "async_action" - }, - { - "id": "aa_0adacc81de057f084c", - "type": "CAMPAIGN.VOUCHERS_IMPORT", - "status": "DONE", - "created_at": "2022-04-01T08:33:54.552Z", - "object": "async_action" + }, + "9_req_update_customer": { + "type": "object", + "title": "Customer object", + "description": "This is an object containing information about the customer.", + "properties": { + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a customer object." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "phone": { + "type": "string", + "description": "Customer's phone number." + }, + "address": { + "type": "object", + "description": "Customer's address.", + "properties": { + "city": { + "type": "string", + "description": "City" + }, + "state": { + "type": "string", + "description": "State" + }, + "line_1": { + "type": "string", + "description": "First line of address." + }, + "line_2": { + "type": "string", + "description": "Second line of address." + }, + "country": { + "type": "string", + "description": "Country." + }, + "postal_code": { + "type": "string", + "description": "Postal code." + } + } + }, + "birthdate": { + "type": "string", + "description": "Customer's birthdate; format `YYYY-MM-DD`.", + "format": "date" + }, + "birthday": { + "type": "string", + "description": "Customer's birthdate; format `YYYY-MM-DD`.", + "format": "date" + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. " + } } - ] - } - ], - "title": "List Async Actions Response Body", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about asynchronous actions.", - "default": "list" - }, - "data_ref": { - "type": "string", - "default": "async_actions", - "description": "Identifies the name of the JSON property that contains the array of asynchronous actions." - }, - "async_actions": { - "type": "array", - "description": "An array of async actions.", - "items": { + }, + "9_obj_customer_object": { "type": "object", - "additionalProperties": false, - "description": "Contains an async action definition.", + "description": "This is an object representing a customer. \n\nThis entity allows you to:\n* store customer details in Voucherify\n* link [redemptions](ref:list-redemptions) and [validations](ref:validate-voucher) to a particular customer\n* build customer segments and use them in validation rules. ", + "title": "Customer Object", + "examples": [ + { + "id": "cust_4vMj8Twr5nBzvTrNCgipMb6M", + "source_id": "08dd9b5a", + "name": "Bob Smith", + "email": "bob.smith@email.com", + "address": { + "city": "New York", + "state": "NY", + "line_1": "678 Main St", + "line_2": null, + "country": "USA", + "postal_code": "10001" + }, + "summary": { + "redemptions": { + "total_redeemed": 5, + "total_failed": 0, + "total_succeeded": 5, + "total_rolled_back": 0, + "total_rollback_failed": 0, + "total_rollback_succeeded": 0, + "gift": { + "redeemed_amount": 0, + "amount_to_go": 0 + }, + "loyalty_card": { + "redeemed_points": 0, + "points_to_go": 830 + } + }, + "orders": { + "total_amount": 94600, + "total_count": 5, + "average_amount": 18920, + "last_order_amount": 27500, + "last_order_date": "2022-09-15T11:11:36.630Z" + } + }, + "loyalty": { + "points": 830, + "referred_customers": 0, + "campaigns": { + "Loyalty Campaign - Webinar": { + "points": 830, + "referred_customers": 0 + } + } + }, + "referrals": { + "total": 0, + "campaigns": [] + }, + "metadata": { + "age": 24, + "loyalty_customer": "true", + "acquisition_channel": "Facebook" + }, + "system_metadata": { + "consents": { + "cnst_lbgOBhHTuDrB7sjIhFjvIALj": { + "date": "2022-11-22T15:48:50.219Z", + "value": true + } + } + }, + "created_at": "2022-09-15T10:33:46.388Z", + "updated_at": "2022-11-22T15:48:50.220Z", + "assets": { + "cockpit_url": "https://cockpits.voucherify.io/customers?token=U2FsdGVkX186yavyLJyykWa9KfhE1J850qWbQ1B%2BjKBZ0wrIzBNaW1WR6tNZo71Y5oTWG6PYpI9BpXDSnzz7CRfQ3lu7M151btz2vlYVxbd2eHNOjTFEwTbD8wK4moLONgtTlPM8ze42nmutFk5GUBepUEhxHRfbk8zekWqWvo8%2FbnAJsPl2rxYyaggwXQDj" + }, + "object": "customer" + } + ], + "x-tags": [ + "CUSTOMERS API" + ], "properties": { "id": { "type": "string", - "description": "Async action unique ID.", - "example": "aa_0ae2af6a38161f8c79" + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_CSnYd37MXmrbS19XCrghjBsv" }, - "type": { + "source_id": { "type": "string", - "description": "Type of async action.", - "enum": [ - "CAMPAIGN.VOUCHERS_IMPORT", - "CAMPAIGN.VOUCHERS_IMPORT_CSV", - "CAMPAIGN.VOUCHERS_UPDATE", - "CAMPAIGN.VOUCHERS_DELETE", - "CAMPAIGN.VOUCHERS_GENERATE", - "CUSTOMERS.IMPORT_CSV", - "CUSTOMERS.BULK_UPDATE", - "CUSTOMERS.METADATA_UPDATE", - "CUSTOMERS.METADATA_KEY_PURGE", - "PRODUCTS.BULK_UPDATE", - "PRODUCTS.METADATA_UPDATE", - "PRODUCTS.METADATA_KEY_PURGE", - "PRODUCTS.IMPORT_CSV", - "SKUS.IMPORT_CSV", - "VOUCHERS.IMPORT", - "VOUCHERS.IMPORT_CSV", - "VOUCHERS.BULK_UPDATE", - "VOUCHERS.METADATA_UPDATE", - "VOUCHERS.METADATA_KEY_PURGE" - ] + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It is externally defined. It can be a customer ID from a CRM system, database or 3rd-party service." }, - "status": { + "name": { "type": "string", - "description": "Status of async action. Informs you whether the async action has already been completed.", - "enum": [ - "ENQUEUED", - "IN_PROGRESS", - "DONE", - "FAILED" - ] + "description": "Customer's first and last name." + }, + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a customer object." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "phone": { + "type": "string", + "description": "Customer's phone number." + }, + "birthdate": { + "type": "string", + "description": "Customer's birthdate." + }, + "birthday": { + "type": "string", + "description": "Customer's birthday." + }, + "address": { + "type": "object", + "description": "Customer's address.", + "properties": { + "city": { + "type": "string", + "description": "City" + }, + "state": { + "type": "string", + "description": "State" + }, + "line_1": { + "type": "string", + "description": "First line of address." + }, + "line_2": { + "type": "string", + "description": "Second line of address." + }, + "country": { + "type": "string", + "description": "Country." + }, + "postal_code": { + "type": "string", + "description": "Postal code." + } + } + }, + "summary": { + "type": "object", + "description": "Contains a summary of customer's redemption and order statistics.", + "properties": { + "redemptions": { + "type": "object", + "description": "Customer's redemptions statistics.", + "properties": { + "total_redeemed": { + "type": "integer", + "description": "Total number of redemptions made by the customer." + }, + "total_failed": { + "type": "integer", + "description": "Total number of redemptions that failed." + }, + "total_succeeded": { + "type": "integer", + "description": "Total number of redemptions that succeeded." + }, + "total_rolled_back": { + "type": "integer", + "description": "Total number of redemptions that were rolled back for the customer." + }, + "total_rollback_failed": { + "type": "integer", + "description": "Total number of redemption rollbacks that failed." + }, + "total_rollback_succeeded": { + "type": "integer", + "description": "Total number of redemption rollbacks that succeeded." + }, + "gift": { + "type": "object", + "description": "Summary of gift card credits.", + "properties": { + "redeemed_amount": { + "type": "integer", + "description": "Total amount of gift card credits redeemed by customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "amount_to_go": { + "type": "integer", + "description": "Remaining gift card balance across all gift cards. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + }, + "loyalty_card": { + "type": "object", + "description": "Summary of loyalty points.", + "properties": { + "redeemed_points": { + "type": "integer", + "description": "Total number of loyalty points redeemed by the customer." + }, + "points_to_go": { + "type": "integer", + "description": "Sum of remaining available point balance across all loyalty cards." + } + } + } + } + }, + "orders": { + "type": "object", + "description": "Customer's order statistics.", + "properties": { + "total_amount": { + "type": "integer", + "description": "The total amount spent by the customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "total_count": { + "type": "integer", + "description": "Total number of orders made by the customer." + }, + "average_amount": { + "type": "integer", + "description": "Average amount spent on orders. `total_amount` ÷ `total_count`. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "last_order_amount": { + "type": "integer", + "description": "Amount spent on last order. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "last_order_date": { + "type": "string", + "format": "date-time", + "example": "2022-08-30T11:51:08.029Z", + "description": "Timestamp representing the date and time of the customer's last order in ISO 8601 format." + } + } + } + } + }, + "loyalty": { + "type": "object", + "description": "Summary of customer's loyalty information.", + "properties": { + "points": { + "type": "integer", + "description": "Sum of remaining available point balance across all loyalty cards." + }, + "referred_customers": { + "type": "integer", + "description": "Total number of customers referred by the customer." + }, + "campaigns": { + "type": "object", + "description": "Contains campaigns with details about point balances and how many customers were referred by the customer.", + "properties": { + "campaign_name": { + "type": "object", + "description": "Contains details about the point balances left on loyalty cards and the number of referred customers in each campaign.", + "properties": { + "points": { + "type": "integer", + "description": "Remaining point balance in campaign." + }, + "loyalty_tier": { + "type": "string", + "example": "ltr_UJ5Q54Q0OvEhua87Qfv2Ki5x", + "description": "Customer's loyalty tier within the campaign." + }, + "referred_customers": { + "type": "integer", + "description": "Number of customers referred by the customer in campaign." + } + } + } + } + } + } + }, + "referrals": { + "type": "object", + "description": "Summary of customer's referrals, in this case, the customer being the referee, i.e. information about the source of referrals and number of times the customer was referred by other customers.", + "properties": { + "total": { + "type": "integer", + "description": "Total number of times this customer received a referral, i.e. was referred by another customer." + }, + "campaigns": { + "type": "array", + "description": "Contains an array of campaigns that served as the source of a referral for the customer.", + "items": { + "type": "object", + "description": "Contains information about the source of the referral.", + "properties": { + "campaign_id": { + "type": "string", + "description": "Unique campaign ID, assigned by Voucherify.", + "example": "camp_rRsfatlwN7unSeUIJDCYedal" + }, + "referrer_id": { + "type": "string", + "example": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", + "description": "Unique referrer ID, assigned by Voucherify. This is the customer ID of a customer that is referring this customer." + }, + "related_object_id": { + "type": "string", + "description": "Related object ID, i.e. `r_0b9d4cc4aa164dd073`." + }, + "related_object_type": { + "type": "string", + "description": "Related object type, i.e. `redemption`." + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-08-30T10:19:39.196Z", + "description": "Timestamp representing the date and time when the customer was referred in ISO 8601 format." + } + } + } + } + } + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments." + }, + "system_metadata": { + "type": "object", + "description": "Object used to store system metadata information.", + "properties": { + "consents": { + "type": "object", + "description": "Stores a list of consent ID's along with the timestamp and decision on accepting or rejecting a marketing permission.", + "properties": { + "consentId": { + "type": "object", + "description": "Unique ID of a consent, i.e. `cnst_lbgOBhHTuDrB7sjIhFjvIALj`.", + "properties": { + "date": { + "type": "string", + "description": "Timestamp representing the date and time when a consent was accepted or rejected in ISO 8601 format.", + "example": "2022-05-10T08:50:10.338Z", + "format": "date-time" + }, + "value": { + "type": "boolean", + "description": "Accepted: `true`, Rejected: `false`" + } + } + } + } + }, + "source": { + "type": "string", + "description": "Takes on the name of the source of the integration if the customer was created through an integration, i.e. `Bigcommerce` or `Shopify`." + } + } }, "created_at": { "type": "string", - "description": "Timestamp representing the date and time when the async action was scheduled in ISO 8601 format.", - "example": "2022-04-07T07:42:44.442Z", + "description": "Timestamp representing the date and time when the customer was created in ISO 8601 format.", + "example": "2022-08-30T06:32:07.380Z", "format": "date-time" }, "updated_at": { "type": "string", - "description": "Timestamp representing the date and time when the async action was updated in ISO 8601 format.", - "example": "2022-06-22T07:58:21.703Z", + "description": "Timestamp representing the date and time when the customer was updated in ISO 8601 format.", + "example": "2022-08-31T06:32:07.380Z", "format": "date-time" }, - "request_id": { - "type": "string", - "example": "v-0ba50a7feb4998490", - "description": "Unique request ID." - }, - "progress": { - "type": "integer", - "minimum": 0, - "maximum": 100, - "description": "% progress to completion of the asynchronous action." + "assets": { + "type": "object", + "description": "Contains information about the customer's cockpit.", + "properties": { + "cockpit_url": { + "type": "string", + "description": "Customer's cockpit URL address." + } + } }, "object": { "type": "string", - "default": "async_action", - "description": "The type of object represented by each nested object in the JSON async_actions array. This object stores information about the `async_action`." + "description": "The type of object represented by the JSON. This object stores information about the customer.", + "default": "customer" } } - } - } - } - }, - "17_res_obj_get_async_action_result_message": { - "title": "Message", - "type": "object", - "description": "Result schema with message.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - } - } - }, - "17_res_obj_get_async_action_result_message_failed": { - "title": "Message with Failed Array", - "type": "object", - "description": "Result schema with message and failed array.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "failed": { - "type": "array", - "description": "If any records failed during the process, this array shows the failure details.", - "items": {} - } - } - }, - "17_res_obj_get_async_action_result_code_updated_found": { - "title": "Code Updated and Found", - "type": "object", - "description": "Result schema with an array of code, updated, and found parameters.", - "properties": { - "results": { - "type": "array", - "description": "An array of statuses for each record.", - "items": { + }, + "9_obj_customer_object_email_parameter": { "type": "object", + "description": "This is an object representing a customer.", + "title": "Customer Object", + "examples": [ + { + "id": "cust_4vMj8Twr5nBzvTrNCgipMb6M", + "source_id": "08dd9b5a", + "name": "Bob Smith", + "email": "bob.smith@email.com", + "address": { + "city": "New York", + "state": "NY", + "line_1": "678 Main St", + "line_2": null, + "country": "USA", + "postal_code": "10001" + }, + "summary": { + "redemptions": { + "total_redeemed": 5, + "total_failed": 0, + "total_succeeded": 5, + "total_rolled_back": 0, + "total_rollback_failed": 0, + "total_rollback_succeeded": 0, + "gift": { + "redeemed_amount": 0, + "amount_to_go": 0 + }, + "loyalty_card": { + "redeemed_points": 0, + "points_to_go": 830 + } + }, + "orders": { + "total_amount": 94600, + "total_count": 5, + "average_amount": 18920, + "last_order_amount": 27500, + "last_order_date": "2022-09-15T11:11:36.630Z" + } + }, + "loyalty": { + "points": 830, + "referred_customers": 0, + "campaigns": { + "Loyalty Campaign - Webinar": { + "points": 830, + "referred_customers": 0 + } + } + }, + "referrals": { + "total": 0, + "campaigns": [] + }, + "metadata": { + "age": 24, + "loyalty_customer": "true", + "acquisition_channel": "Facebook" + }, + "system_metadata": { + "consents": { + "cnst_lbgOBhHTuDrB7sjIhFjvIALj": { + "date": "2022-11-22T15:48:50.219Z", + "value": true + } + } + }, + "created_at": "2022-09-15T10:33:46.388Z", + "updated_at": "2022-11-22T15:48:50.220Z", + "assets": { + "cockpit_url": "https://cockpits.voucherify.io/customers?token=U2FsdGVkX186yavyLJyykWa9KfhE1J850qWbQ1B%2BjKBZ0wrIzBNaW1WR6tNZo71Y5oTWG6PYpI9BpXDSnzz7CRfQ3lu7M151btz2vlYVxbd2eHNOjTFEwTbD8wK4moLONgtTlPM8ze42nmutFk5GUBepUEhxHRfbk8zekWqWvo8%2FbnAJsPl2rxYyaggwXQDj" + }, + "object": "customer" + } + ], + "x-tags": [ + "CUSTOMERS API" + ], "properties": { - "code": { + "id": { "type": "string", - "description": "Unique voucher code." + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_CSnYd37MXmrbS19XCrghjBsv" }, - "updated": { - "type": "boolean", - "description": "Indicates whether the record was updated." + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." }, - "found": { - "type": "boolean", - "description": "Indicates whether the record was found." - } - } - } - } - } - }, - "17_res_obj_get_async_action_result_campaign_vouchers_import": { - "title": "CAMPAIGN.VOUCHERS_IMPORT", - "type": "object", - "description": "Result schema for a CAMPAIGN.VOUCHERS_IMPORT async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "failed": { - "type": "array", - "description": "If any records failed during the process, this array shows the failure details.", - "items": { - "type": "object", - "properties": { - "code": { + "name": { "type": "string", - "description": "Unique voucher code." + "description": "Customer's first and last name." }, - "reason": { + "description": { "type": "string", - "description": "Detailed failure cause for the voucher code import." - } - } - } - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - }, - "failed_count": { - "type": "integer", - "description": "Number of resources failed to process." - } - } - }, - "17_res_obj_get_async_action_result_campaign_vouchers_import_csv": { - "title": "CAMPAIGN.VOUCHERS_IMPORT_CSV", - "type": "object", - "description": "Result schema for a CAMPAIGN.VOUCHERS_IMPORT_CSV async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "failed": { - "type": "array", - "description": "If any records failed during the process, this array shows the failure details.", - "items": { - "type": "object", - "properties": { - "code": { + "description": "An arbitrary string that you can attach to a customer object." + }, + "email": { "type": "string", - "description": "Unique voucher code." + "description": "Customer's email address." }, - "row": { - "type": "integer", - "description": "The CSV file row number where the code definition is recorded. The row counter excludes the file headers row." + "phone": { + "type": "string", + "description": "Customer's phone number." }, - "reason": { + "birthdate": { "type": "string", - "description": "Detailed failure cause for the voucher code import." - } - } - } - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - }, - "failed_count": { - "type": "integer", - "description": "Number of resources failed to process." - } - } - }, - "17_res_obj_get_async_action_result_campaign_vouchers_update": { - "title": "CAMPAIGN.VOUCHERS_UPDATE", - "type": "object", - "description": "Result schema for a CAMPAIGN.VOUCHERS_UPDATE async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - } - } - }, - "17_res_obj_get_async_action_result_campaign_vouchers_delete": { - "title": "CAMPAIGN.VOUCHERS_DELETE", - "type": "object", - "description": "Result schema for a CAMPAIGN.VOUCHERS_DELETE async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - } - } - }, - "17_res_obj_get_async_action_result_campaign_vouchers_generate": { - "title": "CAMPAIGN.VOUCHERS_GENERATE", - "type": "object", - "description": "Result schema for a CAMPAIGN.VOUCHERS_GENERATE async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - } - } - }, - "17_res_obj_get_async_action_result_campaign_metadata_key_purge": { - "title": "CAMPAIGNS.METADATA_KEY_PURGE", - "type": "object", - "description": "Result schema for a CAMPAIGNS.METADATA_KEY_PURGE async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - } - } - }, - "17_res_obj_get_async_action_result_customers_import_csv": { - "title": "CUSTOMERS.IMPORT_CSV", - "type": "object", - "description": "Result schema for a CUSTOMERS.IMPORT_CSV async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "failed": { - "type": "array", - "description": "If any records failed during the process, this array shows the failure details.", - "items": { - "type": "object", - "properties": { - "source_id": { + "description": "Customer's birthdate." + }, + "birthday": { "type": "string", - "description": "Unique customer ID from your inventory system as indicated in the CSV file." + "description": "Customer's birthday." }, - "row": { - "type": "integer", - "description": "The CSV file row number where the customer is recorded. The row counter excludes the file headers row." + "address": { + "type": "object", + "description": "Customer's address.", + "properties": { + "city": { + "type": "string", + "description": "City" + }, + "state": { + "type": "string", + "description": "State" + }, + "line_1": { + "type": "string", + "description": "First line of address." + }, + "line_2": { + "type": "string", + "description": "Second line of address." + }, + "country": { + "type": "string", + "description": "Country." + }, + "postal_code": { + "type": "string", + "description": "Postal code." + } + } }, - "reason": { + "summary": { + "type": "object", + "description": "Contains a summary of customer's redemption and order statistics.", + "properties": { + "redemptions": { + "type": "object", + "description": "Customer's redemptions statistics.", + "properties": { + "total_redeemed": { + "type": "integer", + "description": "Total number of redemptions made by the customer." + }, + "total_failed": { + "type": "integer", + "description": "Total number of redemptions that failed." + }, + "total_succeeded": { + "type": "integer", + "description": "Total number of redemptions that succeeded." + }, + "total_rolled_back": { + "type": "integer", + "description": "Total number of redemptions that were rolled back for the customer." + }, + "total_rollback_failed": { + "type": "integer", + "description": "Total number of redemption rollbacks that failed." + }, + "total_rollback_succeeded": { + "type": "integer", + "description": "Total number of redemption rollbacks that succeeded." + }, + "gift": { + "type": "object", + "description": "Summary of gift card credits.", + "properties": { + "redeemed_amount": { + "type": "integer", + "description": "Total amount of gift card credits redeemed by customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "amount_to_go": { + "type": "integer", + "description": "Remaining gift card balance across all gift cards. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + }, + "loyalty_card": { + "type": "object", + "description": "Summary of loyalty points.", + "properties": { + "redeemed_points": { + "type": "integer", + "description": "Total number of loyalty points redeemed by the customer." + }, + "points_to_go": { + "type": "integer", + "description": "Sum of remaining available point balance accross all loyalty cards." + } + } + } + } + }, + "orders": { + "type": "object", + "description": "Customer's order statistics.", + "properties": { + "total_amount": { + "type": "integer", + "description": "The total amount spent by the customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "total_count": { + "type": "integer", + "description": "Total number of orders made by the customer." + }, + "average_amount": { + "type": "integer", + "description": "Average amount spent on orders. `total_amount` ÷ `total_count`. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "last_order_amount": { + "type": "integer", + "description": "Amount spent on last order. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "last_order_date": { + "type": "string", + "example": "2022-08-30T11:51:08.029Z", + "description": "Timestamp representing the date and time of the customer's last order in ISO 8601 format." + } + } + } + } + }, + "loyalty": { + "type": "object", + "description": "Summary of customer's loyalty information.", + "properties": { + "points": { + "type": "integer" + }, + "referred_customers": { + "type": "integer", + "description": "Total number of customers referred by the customer." + }, + "campaigns": { + "type": "object", + "description": "Contains campaigns with details about point balances and how many customers were referred by the customer.", + "properties": { + "campaign_name": { + "type": "object", + "description": "Contains details about the point balances left on loyalty cards and the number of referred customers in each campaign.", + "properties": { + "points": { + "type": "integer", + "description": "Remaining point balance in campaign." + }, + "loyalty_tier": { + "type": "string", + "example": "ltr_UJ5Q54Q0OvEhua87Qfv2Ki5x", + "description": "Customer's loyalty tier within the campaign." + }, + "referred_customers": { + "type": "integer", + "description": "Number of customers referred by the customer in campaign." + } + } + } + } + } + } + }, + "referrals": { + "type": "object", + "description": "Summary of customer's referrals, in this case, the customer being the referee, i.e. information about the source of referrals and number of times the customer was referred by other customers.", + "properties": { + "total": { + "type": "integer", + "description": "Total number of times this customer received a referral, i.e. was referred by another customer." + }, + "campaigns": { + "type": "array", + "description": "Contains an array of campaigns that served as the source of a referral for the customer.", + "items": { + "type": "object", + "description": "Contains information about the source of the referral.", + "properties": { + "campaign_id": { + "type": "string", + "description": "Unique campaign ID, assigned by Voucherify.", + "example": "camp_rRsfatlwN7unSeUIJDCYedal" + }, + "referrer_id": { + "type": "string", + "example": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", + "description": "Unique referrer ID, assigned by Voucherify. This is the customer ID of a customer that is referring this customer." + }, + "related_object_id": { + "type": "string", + "description": "Related object ID, i.e. `r_0b9d4cc4aa164dd073`." + }, + "related_object_type": { + "type": "string", + "description": "Related object type, i.e. `redemption`." + }, + "date": { + "type": "string", + "example": "2022-08-30T10:19:39.196Z", + "description": "Timestamp representing the date and time when the customer was referred in ISO 8601 format." + } + } + } + } + } + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments." + }, + "system_metadata": { + "type": "object", + "description": "Object used to store system metadata information.", + "properties": { + "consents": { + "type": "object", + "description": "Stores a list of consent ID's along with the timestamp and decision on accepting or rejecting a marketing permission.", + "properties": { + "consentId": { + "type": "object", + "description": "Unique ID of a consent, i.e. `cnst_lbgOBhHTuDrB7sjIhFjvIALj`.", + "properties": { + "date": { + "type": "string", + "description": "Timestamp representing the date and time when a consent was accepted or rejected in ISO 8601 format.", + "example": "2022-05-10T08:50:10.338Z", + "format": "date-time" + }, + "value": { + "type": "boolean", + "description": "Accepted: `true`, Rejected: `false`" + } + } + } + } + }, + "source": { + "type": "string", + "description": "Takes on the name of the source of the integration if the customer was created through an integration, i.e. `Bigcommerce` or `Shopify`." + } + } + }, + "created_at": { "type": "string", - "description": "Detailed failure cause for the customer import." - } - } - } - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - }, - "failed_count": { - "type": "integer", - "description": "Number of resources failed to process." - } - } - }, - "17_res_obj_get_async_action_result_customers_bulk_update": { - "title": "CUSTOMERS.BULK_UPDATE", - "type": "object", - "description": "Result schema for a CUSTOMERS.BULK_UPDATE async action type.", - "properties": { - "results": { - "type": "array", - "description": "An array of statuses for each record.", - "items": { - "type": "object", - "properties": { - "source_id": { + "description": "Timestamp representing the date and time when the customer was created in ISO 8601 format.", + "example": "2022-08-30T06:32:07.380Z", + "format": "date-time" + }, + "updated_at": { "type": "string", - "description": "Unique customer `source_id`." + "description": "Timestamp representing the date and time when the customer was updated in ISO 8601 format.", + "example": "2022-08-31T06:32:07.380Z", + "format": "date-time" }, - "updated": { - "type": "boolean", - "description": "Indicates whether the record was updated." + "assets": { + "type": "object", + "description": "Contains information about the customer's cockpit.", + "properties": { + "cockpit_url": { + "type": "string", + "description": "Customer's cockpit URL address." + } + } }, - "found": { - "type": "boolean", - "description": "Indicates whether the record was found." + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the customer.", + "default": "customer" + }, + "email_unsubscribed": { + "type": "boolean" } } - } - }, - "done_count": { - "type": "integer", - "description": "Number or resources processed successfully." - } - } - }, - "17_res_obj_get_async_action_result_customers_metadata_update": { - "title": "CUSTOMERS.METADATA_UPDATE", - "type": "object", - "description": "Result schema for a CUSTOMERS.METADATA_UPDATE async action type.", - "properties": { - "results": { - "type": "array", - "description": "An array of statuses for each record.", - "items": { + }, + "9_res_list_customers": { "type": "object", + "title": "List Customers Response Body", + "description": "Response body schema for **GET** `/customers`.", "properties": { - "source_id": { + "object": { "type": "string", - "description": "Unique customer `source_id`." + "default": "list", + "description": "The type of object represented by JSON. This object stores information about customers in a dictionary." }, - "updated": { - "type": "boolean", - "description": "Indicates whether the record was updated." + "data_ref": { + "type": "string", + "default": "customers", + "description": "Identifies the name of the attribute that contains the array of customer objects." }, - "found": { - "type": "boolean", - "description": "Indicates whether the record was found." + "customers": { + "type": "array", + "description": "Contains array of customer objects.", + "items": { + "$ref": "#/components/schemas/9_obj_customer_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of customers." } } - } - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - } - } - }, - "17_res_obj_get_async_action_result_customers_metadata_key_purge": { - "title": "CUSTOMERS.METADATA_KEY_PURGE", - "type": "object", - "description": "Result schema for a CUSTOMERS.METADATA_KEY_PURGE async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - } - } - }, - "17_res_obj_get_async_action_result_products_bulk_update": { - "title": "PRODUCTS.BULK_UPDATE", - "type": "object", - "description": "Result schema for a PRODUCTS.BULK_UPDATE async action type.", - "properties": { - "results": { - "type": "array", - "description": "An array of statuses for each record.", - "items": { + }, + "9_res_list_customer_activities": { "type": "object", + "title": "List Customer Activities Response Body", + "description": "Request body schema for `/customers/{customerId}/activities`.", "properties": { - "source_id": { + "object": { "type": "string", - "description": "Unique product `source_id`." + "default": "list", + "description": "The type of object represented by JSON. This object stores information about customer activities in a dictionary." }, - "updated": { - "type": "boolean", - "description": "Indicates whether the record was updated." + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of customer activity objects." }, - "found": { - "type": "boolean", - "description": "Indicates whether the record was found." + "data": { + "type": "array", + "description": "Array of customer activity objects.", + "items": { + "$ref": "#/components/schemas/9_obj_customer_activity_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of customer activities." } } - } - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - } - } - }, - "17_res_obj_get_async_action_result_products_metadata_update": { - "title": "PRODUCTS.METADATA_UPDATE", - "type": "object", - "description": "Result schema for a PRODUCTS.METADATA_UPDATE async action type.", - "properties": { - "results": { - "type": "array", - "description": "An array of statuses for each record.", - "items": { + }, + "22_obj_webhooks": { "type": "object", + "title": "Webhooks", + "description": "Data object model for a webhook.\n\n\nredemption.succeeded \nredemption.failed \nredemption.rollback.succeeded \nredemption.rollback.failed \npublication.succeeded \nvoucher.published \nvoucher.updated \nvoucher.deleted \nvoucher.created \nVoucher.enabled \nvoucher.disabled \nvoucher.loyalty_card.points_added \nvoucher.gift.balance_added \ncampaign.enabled \ncampaign.deleted \ncampaign.created \ncampaign.updated \ncampaign.disabled \ncampaign.vouchers.generation.completed \nbusiness_validation_rule.assignment.created \nbusiness_validation_rule.assignment.deleted \nbusiness_validation_rule.created \nbusiness_validation_rule.deleted \nbusiness_validation_rule.updated \ncustomer.created \ncustomer.deleted \ncustomer.rewarded \ncustomer.rewarded.loyalty_points \ncustomer.consents.revoked \ncustomer.consents.given ", + "x-tags": [ + "WEBHOOKS" + ], "properties": { - "source_id": { + "id": { "type": "string", - "description": "Unique product `source_id`." + "example": "event_m7MXf3zPf1n51IoUM8XHpP0w", + "description": "Unique event ID." }, - "updated": { - "type": "boolean", - "description": "Indicates whether the record was updated." + "object": { + "type": "string", + "default": "event", + "description": "The type of object represented by JSON. This object stores information about events in a dictionary." }, - "found": { - "type": "boolean", - "description": "Indicates whether the record was found." + "webhook_id": { + "type": "string", + "example": "wh_K7hpwSVDmKaxmBsDn0EpCvDy", + "description": "Unique webhook ID." + }, + "project_id": { + "type": "string", + "example": "proj_z7id5", + "description": "Unique Voucherify project ID." + }, + "created_at": { + "type": "string", + "example": "2022-11-30T16:53:30.434Z", + "format": "date-time", + "description": "Timestamp representing the date and time when the webhook was created in ISO 8601 format." + }, + "type": { + "type": "string", + "enum": [ + "redemption.succeeded", + "redemption.failed", + "redemption.rollback.succeeded", + "redemption.rollback.failed", + "publication.succeeded", + "voucher.published", + "voucher.updated", + "voucher.deleted", + "voucher.created", + "Voucher.enabled", + "voucher.disabled", + "voucher.loyalty_card.points_added", + "voucher.gift.balance_added", + "campaign.enabled", + "campaign.deleted", + "campaign.created", + "campaign.updated", + "campaign.disabled", + "campaign.vouchers.generation.completed", + "business_validation_rule.assignment.created", + "business_validation_rule.assignment.deleted", + "business_validation_rule.created", + "business_validation_rule.deleted", + "business_validation_rule.updated", + "customer.created", + "customer.deleted", + "customer.rewarded", + "customer.rewarded.loyalty_points", + "customer.consents.revoked", + "customer.consents.given" + ] + }, + "data": { + "$ref": "#/components/schemas/22_obj_webhook_object_data" + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs attached to a webhook. The metadata object stores all custom attributes assigned to the webhook. It can be useful for storing additional information about the webhook in a structured format.", + "properties": { + "source": { + "type": "string", + "description": "The origin of the webhook.", + "enum": [ + "API" + ] + } + } } } - } - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - } - } - }, - "17_res_obj_get_async_action_result_products_metadata_key_purge": { - "title": "PRODUCTS.METADATA_KEY_PURGE", - "type": "object", - "description": "Result schema for a PRODUCTS.METADATA_KEY_PURGE async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "done_count": { - "type": "integer", - "description": "Number of resources updated successfully." - } - } - }, - "17_res_obj_get_async_action_result_products_import_csv": { - "title": "PRODUCTS.IMPORT_CSV", - "type": "object", - "description": "Result schema for a PRODUCTS.IMPORT_CSV async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "failed": { - "type": "array", - "description": "If any records failed during the process, this array shows the failure details.", - "items": { - "type": "object", - "description": "Contains the details regarding a CSV file line item failed import.", - "properties": { - "row": { - "type": "integer", - "description": "The CSV file row number where the product definition is recorded. The row counter excludes the file headers row." + }, + "22_obj_webhook_object_data": { + "title": "Webhook Object", + "description": "Webhook event data object schema.", + "anyOf": [ + { + "$ref": "#/components/schemas/22_obj_event_redemption_succeeded" + }, + { + "$ref": "#/components/schemas/22_obj_event_redemption_failed" + }, + { + "$ref": "#/components/schemas/22_obj_event_redemption_rollback_succeeded" + }, + { + "$ref": "#/components/schemas/22_obj_event_redemption_rollback_failed" + }, + { + "$ref": "#/components/schemas/22_obj_event_publication_succeeded" + }, + { + "$ref": "#/components/schemas/22_obj_event_voucher_published" + }, + { + "$ref": "#/components/schemas/22_obj_event_voucher_updated" + }, + { + "$ref": "#/components/schemas/22_obj_event_voucher_deleted" + }, + { + "$ref": "#/components/schemas/22_obj_event_voucher_created" + }, + { + "$ref": "#/components/schemas/22_obj_event_voucher_enabled" + }, + { + "$ref": "#/components/schemas/22_obj_event_voucher_disabled" + }, + { + "$ref": "#/components/schemas/22_obj_event_voucher_loyalty_card_points_added" + }, + { + "$ref": "#/components/schemas/22_obj_event_voucher_gift_balance_added" + }, + { + "$ref": "#/components/schemas/22_obj_event_campaign_enabled" + }, + { + "$ref": "#/components/schemas/22_obj_event_campaign_deleted" + }, + { + "$ref": "#/components/schemas/22_obj_event_campaign_created" + }, + { + "$ref": "#/components/schemas/22_obj_event_campaign_updated" + }, + { + "$ref": "#/components/schemas/22_obj_event_campaign_disabled" + }, + { + "$ref": "#/components/schemas/22_obj_event_campaign_vouchers_generation_completed" + }, + { + "$ref": "#/components/schemas/22_obj_event_business_validation_rule_assignment_created" + }, + { + "$ref": "#/components/schemas/22_obj_event_business_validation_rule_assignment_deleted" }, - "reason": { - "type": "string", - "description": "Detailed failure cause for the product import." - } - } - } - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - }, - "failed_count": { - "type": "integer", - "description": "Number of resources failed to process." - } - } - }, - "17_res_obj_get_async_action_result_skus_import_csv": { - "title": "SKUS.IMPORT_CSV", - "type": "object", - "description": "Result schema for a SKUS.IMPORT_CSV async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result.", - "example": "2 sku(s) imported successfully, 6 failed." - }, - "failed": { - "type": "array", - "description": "If any records failed during the process, this array shows the failure details.", - "items": { - "type": "object", - "description": "Contains the details regarding a CSV file line item failed import.", - "properties": { - "row": { - "type": "integer", - "description": "The CSV file row number where the SKU definition is recorded. The row counter excludes the file headers row.", - "example": 2 + { + "$ref": "#/components/schemas/22_obj_event_business_validation_rule_created" }, - "reason": { - "type": "string", - "description": "Detailed failure cause for the SKU import.", - "example": "Resource sku with id size-small is in use by products with ids [prod_0b0e3441c2462eff2c]" + { + "$ref": "#/components/schemas/22_obj_event_business_validation_rule_deleted" + }, + { + "$ref": "#/components/schemas/22_obj_event_business_validation_rule_updated" + }, + { + "$ref": "#/components/schemas/22_obj_event_customer_created" + }, + { + "$ref": "#/components/schemas/22_obj_event_customer_deleted" + }, + { + "$ref": "#/components/schemas/22_obj_event_customer_rewarded" + }, + { + "$ref": "#/components/schemas/22_obj_event_customer_rewarded_loyalty_points" + }, + { + "$ref": "#/components/schemas/22_obj_event_customer_consents_given" + }, + { + "$ref": "#/components/schemas/22_obj_event_customer_consents_revoked" } - } - } - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - }, - "failed_count": { - "type": "integer", - "description": "Number of resources failed to process." - } - } - }, - "17_res_obj_get_async_action_result_vouchers_import": { - "title": "VOUCHERS.IMPORT", - "type": "object", - "description": "Result schema for a VOUCHERS.IMPORT async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "failed": { - "description": "If any records failed during the process, this array shows the failure details.", - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "reason": { - "type": "string", - "description": "Detailed failure cause for the voucher code import." - } - } - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - }, - "failed_count": { - "type": "integer", - "description": "Number of resources failed to process." - } - } - }, - "17_res_obj_get_async_action_result_vouchers_import_csv": { - "title": "VOUCHERS.IMPORT_CSV", - "type": "object", - "description": "Result schema for a VOUCHERS.IMPORT_CSV async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "failed": { - "type": "array", - "description": "If any records failed during the process, this array shows the failure details.", - "items": { + ] + }, + "22_obj_event_redemption_succeeded": { + "title": "Redemption Succeeded", + "description": "Event data object schema for `redemption.succeeded`.", + "type": "object" + }, + "22_obj_event_redemption_failed": { + "title": "Redemption Failed", + "description": "Event data object schema for `redemption.failed`.", + "type": "object" + }, + "22_obj_event_redemption_rollback_failed": { + "title": "Redemption Rollback Failed", + "description": "Event data object schema for `redemption.rollback.failed`.", + "type": "object" + }, + "22_obj_event_redemption_rollback_succeeded": { + "title": "Redemption Rollback Succeeded", + "description": "Event data object schema for `redemption.rollback.succeeded`.", + "type": "object" + }, + "22_obj_event_publication_succeeded": { + "title": "Publication Succeeded", + "description": "Event data object schema for `publication.succeeded`.", + "type": "object" + }, + "22_obj_event_voucher_published": { + "title": "Voucher Published", + "description": "Event data object schema for `voucher.published`.", + "type": "object" + }, + "22_obj_event_voucher_updated": { + "title": "Voucher Updated", + "description": "Event data object schema for `voucher.updated`.", + "type": "object" + }, + "22_obj_event_voucher_deleted": { + "title": "Voucher Deleted", + "description": "Event data object schema for `voucher.deleted`.", + "type": "object" + }, + "22_obj_event_voucher_created": { + "title": "Voucher Created", + "description": "Event data object schema for `voucher.created`.", + "type": "object" + }, + "22_obj_event_voucher_enabled": { + "title": "Voucher Enabled", + "description": "Event data object schema for `voucher.enabled`.", + "type": "object" + }, + "22_obj_event_voucher_disabled": { + "title": "Voucher Disabled", + "description": "Event data object schema for `voucher.disabled`.", + "type": "object" + }, + "22_obj_event_voucher_loyalty_card_points_added": { + "title": "Voucher Loyalty Card Points Added", + "description": "Event data object schema for `voucher.loyalty_card.points_added`.", "type": "object", "properties": { - "code": { - "type": "string", - "description": "Unique voucher code." + "object": { + "$ref": "#/components/schemas/1_obj_voucher_object" }, - "row": { - "type": "integer", - "description": "The CSV file row number where the code definition is recorded. The row counter excludes the file headers row." + "related_object": { + "$ref": "#/components/schemas/8_res_add_remove_points_balance" }, - "reason": { - "type": "string", - "description": "Detailed failure cause for the voucher code import." + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object" } } - } - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - }, - "failed_count": { - "type": "integer", - "description": "Number of resources failed to process." - } - } - }, - "17_res_obj_get_async_action_result_vouchers_bulk_update": { - "title": "VOUCHERS.BULK_UPDATE", - "type": "object", - "description": "Result schema for a VOUCHERS.BULK_UPDATE async action type.", - "properties": { - "results": { - "type": "array", - "description": "An array of statuses for each record.", - "items": { + }, + "22_obj_event_voucher_gift_balance_added": { + "title": "Voucher Gift Balance Added", + "description": "Event data object schema for `voucher.gift.balance_added`.", + "type": "object" + }, + "22_obj_event_campaign_enabled": { + "title": "Campaign Enabled", + "description": "Event data object schema for `campaign.enabled`.", + "type": "object" + }, + "22_obj_event_campaign_deleted": { + "title": "Campaign Deleted", + "description": "Event data object schema for `campaign.deleted`.", "type": "object", "properties": { - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "updated": { - "type": "boolean", - "description": "Indicates whether the record was updated." + "object": { + "$ref": "#/components/schemas/2_obj_campaign_object" }, - "found": { - "type": "boolean", - "description": "Indicates whether the record was found." + "campaign": { + "$ref": "#/components/schemas/2_obj_campaign_object" } } - } - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - } - } - }, - "17_res_obj_get_async_action_result_vouchers_metadata_update": { - "title": "VOUCHERS.METADATA_UPDATE", - "type": "object", - "description": "Result schema for a VOUCHERS.METADATA_UPDATE async action type.", - "properties": { - "results": { - "type": "array", - "description": "An array of statuses for each record.", - "items": { + }, + "22_obj_event_campaign_created": { + "title": "Campaign Created", + "description": "Event data object schema for `campaign.created`.", + "type": "object" + }, + "22_obj_event_campaign_updated": { + "title": "Campaign Updated", + "description": "Event data object schema for `campaign.updated`.", + "type": "object" + }, + "22_obj_event_campaign_disabled": { + "title": "Campaign Disabled", + "description": "Event data object schema for `campaign.disabled`.", + "type": "object" + }, + "22_obj_event_campaign_vouchers_generation_completed": { + "title": "Campaign Vouchers Generation Completed", + "description": "Event data object schema for `campaign.vouchers.generation.completed`.", + "type": "object" + }, + "22_obj_event_business_validation_rule_assignment_created": { + "title": "Business Validation Rule Assignment Created", + "description": "Event data object schema for `business_validation_rule.assignment.created`.", + "type": "object" + }, + "22_obj_event_business_validation_rule_assignment_deleted": { + "title": "Business Validation Rule Assignment Deleted", + "description": "Event data object schema for `business_validation_rule.assignment.deleted`.", + "type": "object" + }, + "22_obj_event_business_validation_rule_created": { + "title": "Business Validation Rule Created", + "description": "Event data object schema for `business_validation_rule.created`.", + "type": "object" + }, + "22_obj_event_business_validation_rule_deleted": { + "title": "Business Validation Rule Deleted", + "description": "Event data object schema for `business_validation_rule.deleted`.", + "type": "object" + }, + "22_obj_event_business_validation_rule_updated": { + "title": "Business Validation Rule Updated", + "description": "Event data object schema for `business_validation_rule.updated`.", + "type": "object" + }, + "22_obj_event_customer_created": { + "title": "Customer Created", + "description": "Event data object schema for `customer.created`.", + "type": "object" + }, + "22_obj_event_customer_deleted": { + "title": "Customer Deleted", + "description": "Event data object schema for `customer.deleted`.", + "type": "object" + }, + "22_obj_event_customer_rewarded": { + "title": "Customer Rewarded", + "description": "Event data object schema for `customer.rewarded`.", + "type": "object" + }, + "22_obj_event_customer_rewarded_loyalty_points": { + "title": "Customer Rewarded Loyalty Points", + "description": "Event data object schema for `customer.rewarded.loyalty_points`.", "type": "object", "properties": { - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "updated": { - "type": "boolean", - "description": "Indicates whether the record was updated." + "object": { + "$ref": "#/components/schemas/9_obj_customer_object" }, - "found": { - "type": "boolean", - "description": "Indicates whether the record was found." - } - } - } - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - } - } - }, - "17_res_obj_get_async_action_result_vouchers_metadata_key_purge": { - "title": "VOUCHERS.METADATA_KEY_PURGE", - "type": "object", - "description": "Result schema for a VOUCHERS.METADATA_KEY_PURGE async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - } - } - }, - "17_res_obj_get_async_action_result_orders_import": { - "title": "ORDERS.IMPORT", - "type": "object", - "description": "Result schema for a ORDERS.IMPORT async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "failed": { - "description": "If any records failed during the process, this array shows the failure details.", - "type": "object", - "properties": { - "source_id": { - "type": "string", - "description": "Unique order source ID." - }, - "reason": { - "type": "string", - "description": "Detailed failure cause for the voucher code import." - } - } - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - }, - "failed_count": { - "type": "integer", - "description": "Number of resources failed to process." - } - } - }, - "17_res_obj_get_async_action_result_orders_metadata_key_purge": { - "title": "ORDERS.METADATA_KEY_PURGE", - "type": "object", - "description": "Result schema for a ORDERS.METADATA_KEY_PURGE async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - } - } - }, - "18_res_list_consents_GET": { - "description": "Response body schema for listing consents.", - "type": "object", - "examples": [ - { - "groups": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "cnstgr_3c7Z3rcOLv51bsXlRtTZPYj8", - "name": "Consent group", - "description": "Consent group", - "consents": [ - "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", - "cnst_VCmucIvAsmDYw2PPAok6bcYy" - ], - "created_at": "2022-04-13T09:12:47.743Z", - "updated_at": "2022-04-13T09:45:46.616Z", - "object": "consent_group" + "related_object": { + "$ref": "#/components/schemas/8_res_add_remove_points_balance" }, - { - "id": "cnstgr_EAIakTj5lNG2ZpiQEauGqBlY", - "name": "Consent group 2", - "description": "Consent group 2", - "consents": [ - "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", - "cnst_VCmucIvAsmDYw2PPAok6bcYy" - ], - "created_at": "2022-04-13T10:03:46.564Z", - "updated_at": null, - "object": "consent_group" - } - ], - "total": 2 - }, - "consents": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", - "name": "Consent", - "description": "Consent for marketing", - "category": "New", - "created_at": "2022-04-13T09:11:27.037Z", - "updated_at": null, - "object": "consent" + "customer": { + "$ref": "#/components/schemas/9_obj_customer_object" }, - { - "id": "cnst_VCmucIvAsmDYw2PPAok6bcYy", - "name": "Consent 2", - "description": "Consent 2", - "category": "Trial", - "created_at": "2022-04-13T09:45:37.597Z", - "updated_at": null, - "object": "consent" - } - ], - "total": 2 - } - } - ], - "title": "List Consents Response Body", - "properties": { - "groups": { - "type": "object", - "description": "Contains marketing permission groups' definitions.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "Stores information about marketing permission groups." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of marketing permission groups." - }, - "data": { - "type": "array", - "description": "An array of marketing permission groups.", - "items": { + "voucher": { "type": "object", - "additionalProperties": false, - "description": "Contains a marketing permission group's definition.", "properties": { "id": { - "type": "string", - "example": "cnstgr_3c7Z3rcOLv51bsXlRtTZPYj8", - "description": "Unique group ID." - }, - "name": { - "type": "string", - "description": "Marketing permission group name." + "type": "string" }, - "description": { - "type": "string", - "description": "Marketing permission group category." + "code": { + "type": "string" }, - "consents": { - "type": "array", - "description": "List of consents that are assigned to the group.", - "items": { - "type": "string" + "loyalty_card": { + "type": "object", + "properties": { + "points": { + "type": "integer" + }, + "balance": { + "type": "integer" + } } }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-04-13T09:12:47.743Z", - "description": "Timestamp representing the date and time when the group was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-05-14T09:11:27.037Z", - "description": "Timestamp representing the date and time when the group was updated in ISO 8601 format." - }, - "object": { - "type": "string", - "default": "consent_group", - "description": "Stores information about a marketing permission group." - } - } - } - }, - "total": { - "type": "integer", - "description": "Total number of groups." - } - } - }, - "consents": { - "type": "object", - "description": "Contains opt-in consents' definitions.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "Stores information about opt-in consents." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of opt-in consents." - }, - "data": { - "type": "array", - "description": "An array of consents.", - "items": { - "type": "object", - "additionalProperties": false, - "description": "Contains an opt-in consent definition.", - "properties": { - "id": { - "type": "string", - "example": "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", - "description": "Unique consent ID." - }, - "name": { - "type": "string", - "description": "Consent name." - }, - "description": { + "type": { "type": "string", - "description": "Consent description." + "default": "LOYALTY_CARD" }, - "category": { - "type": "string", - "description": "Consent category." + "campaign": { + "type": "string" }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-04-13T09:11:27.037Z", - "description": "Timestamp representing the date and time when the consent was created in ISO 8601 format." + "campaign_id": { + "type": "string" }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-05-14T09:11:27.037Z", - "description": "Timestamp representing the date and time when the consent was updated in ISO 8601 format." + "is_referral_code": { + "type": "boolean" }, - "object": { + "holder_id": { "type": "string", - "default": "consent", - "description": "Stores information about an opt-in consent." + "example": "cust_o3ffuQSwM0vlxeJJoMqiOLMI" } } + }, + "campaign": { + "type": "string" + }, + "earning_rule": { + "$ref": "#/components/schemas/8_obj_earning_rule_object" } - }, - "total": { - "type": "integer", - "description": "Total number of consents." } - } - } - } - }, - "20_res_list_categories": { - "type": "object", - "title": "List Categories Response Body", - "description": "Response schema for **GET** `/categories`.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about categories in a dictionary." - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of category objects.", - "default": "data" - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/20_obj_category_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of categories." - } - } - }, - "20_obj_category_object": { - "type": "object", - "title": "Category Object", - "description": "This is an object representing a category.", - "x-tags": [ - "CATEGORIES API" - ], - "properties": { - "id": { - "type": "string", - "description": "Unique category ID assigned by Voucherify." - }, - "name": { - "type": "string", - "description": "Category name." - }, - "hierarchy": { - "type": "integer", - "description": "Category hierarchy." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the category was created in ISO 8601 format.", - "example": "2022-07-14T10:45:13.156Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "example": "2022-08-16T10:52:08.094Z", - "description": "Timestamp representing the date and time when the category was updated in ISO 8601 format.", - "format": "date-time" - }, - "object": { - "type": "string", - "default": "category", - "description": "The type of object represented by the JSON. This object stores information about the category." - } - }, - "examples": [ - { - "id": "cat_0b60cfe7d0d7ddbb55", - "name": "Update", - "hierarchy": 1, - "created_at": "2022-07-14T10:45:13.156Z", - "updated_at": "2022-08-16T11:03:54.727Z", - "object": "category" - } - ] - }, - "20_req_update_categories_categoryId": { - "type": "object", - "title": "Update Category Request Body", - "description": "Request schema for updating a category using **PUT** `/categories/{categoryId}`.", - "properties": { - "name": { - "type": "string", - "description": "Category name." - }, - "hierarchy": { - "type": "integer", - "description": "Category hierarchy." - } - }, - "required": [ - "name", - "hierarchy" - ] - }, - "20_req_create_category": { - "type": "object", - "title": "Create Category Request Body", - "description": "Request schema for creating a category using **POST** `/categories`.", - "properties": { - "name": { - "type": "string", - "description": "Category name." - }, - "hierarchy": { - "type": "integer", - "description": "Category hierarchy." - } - }, - "required": [ - "name", - "hierarchy" - ] - }, - "20_res_create_category": { - "type": "object", - "title": "Category Object", - "description": "This is an object representing a newly created category.", - "properties": { - "id": { - "type": "string", - "description": "Unique category ID assigned by Voucherify." - }, - "name": { - "type": "string", - "description": "Category name." - }, - "hierarchy": { - "type": "integer", - "description": "Category hierarchy." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the category was created in ISO 8601 format.", - "example": "2022-07-14T10:45:13.156Z", - "format": "date-time" - }, - "object": { - "type": "string", - "default": "category", - "description": "The type of object represented by the JSON. This object stores information about the category." - } - } - }, - "21_obj_metadata_schema_object": { - "type": "object", - "title": "Metadata Schema Object", - "description": "This is an object representing a metadata schema.", - "properties": { - "id": { - "type": "string", - "description": "Unique metadata schema ID.", - "example": "ms_OF36L2rk4EqhdxvZs56IW9iE" - }, - "related_object": { - "type": "string", - "description": "The resource type. There is an infinite number of possibilities for the resource type because you can define custom metadata schemas. Some examples are included here to show you the standard metadata schema resource types.", - "enum": [ - "campaign", - "customer", - "earning_rule", - "loyalty_tier", - "order", - "order_item", - "product", - "promotion_tier", - "publication", - "redemption", - "reward", - "voucher" - ] - }, - "properties": { - "description": "Contains the metadata definitions. There can be many properties within this object.", - "anyOf": [ - { - "properties": { - "custom_property_name": { - "type": "object", - "description": "Custom property name. This is defined in **Project Settings** > **Metadata Schema** in the Dashboard.", - "properties": { - "type": { - "type": "string", - "enum": [ - "string", - "number", - "object", - "date", - "datetime", - "geopoint", - "boolean", - "image_url" - ] - }, - "array": { - "type": "boolean", - "description": "Indicates whether the definition is an array." - }, - "optional": { - "type": "boolean", - "description": "Indicates whether this definition is optional or not optional for the resource." - }, - "objectType": { - "type": [ - "string", - "null" - ], - "description": "Returns the name of the custom resource if the resource was previously defined in the Dashboard as a custom (non-standard) Nested object." - }, - "eq": { - "type": "array", - "description": "Array of possible values when the setting for `is equal to any of` in the Dashboard is defined explicitly.", - "items": {} - }, - "ne": { - "type": "array", - "description": "Array of values that are not allowed when the setting for `is not equal to any of` in the Dashboard is defined explicitly.", - "items": {} - }, - "lt": { - "type": "integer", - "description": "A property of `number` type must have `less than` this value." - }, - "lte": { - "type": "integer", - "description": "A property of `number` type must be `less than or equal` to this value." - }, - "gt": { - "type": "integer", - "description": "A property of `number` type must be `greater than` this value." - }, - "gte": { - "type": "integer", - "description": "A property of `number` type must be `greater than or equal` to this value." - }, - "deleted": { - "type": "boolean", - "description": "Indicates whether the definition was deleted from the schema." - }, - "maxLength": { - "type": "integer", - "description": "Value for maximum length when the setting for `has maximum length of` in the Dashboard is defined explicitly." - }, - "minLength": { - "type": "integer", - "description": "Value indicating minimum length when the setting for `has minimum length of` in the Dashboard is defined explicitly." - }, - "exactLength": { - "type": "integer", - "description": "Value indicating exact length when the setting for `has exact length of` in the Dashboard is defined explicitly." - } - } + }, + "22_obj_event_customer_consents_revoked": { + "title": "Customer Consents Revoked", + "description": "Event data object schema for `customer.consents.revoked`.", + "type": "object" + }, + "22_obj_event_customer_consents_given": { + "title": "Customer Consents Given", + "description": "Event data object schema for `customer.consents.given`.", + "type": "object" + }, + "9_obj_customer_activity_object": { + "type": "object", + "title": "Customer Activity Object", + "description": "This is an object representing customer activity. \n\nThis is a general object which presents moments from customers' activity. There are all types of different events that customers perform during their journey once they participate in Promotions. Events describe moments when customers redeem coupons and earn points or rewards. The list of all types of activities is listed below.\n\nThe details describing the activity are collected in a property named `data`. In this object, software integrators will find all further information explaining the event context. \n\nCustomer Activity Object is a type of [Event](ref:track-custom-event) which is our way of letting you know when something interesting happens in your project. When an interesting event concerning an individual customer occurs, we create a new Customer Activity object. For example, when a code is published to a customer, we create a `customer.publication.succeeded` event.\n\n| **Event types (definition in progress)** |\n|:---|\n| customer.confirmed |\n| customer.created |\n| customer.updated |\n| customer.deleted |\n| customer.referred |\n| customer.custom_event |\n| customer.segment.entered |\n| customer.segment.left |\n| customer.sms.sent |\n| customer.sms.failed |\n| customer.email.sent |\n| customer.email.failed |\n| customer.activecampaign.sent |\n| customer.activecampaign.failed |\n| customer.braze.sent |\n| customer.braze.failed |\n| customer.mailchimp.sent |\n| customer.mailchimp.failed |\n| customer.intercom.sent |\n| customer.intercom.failed |\n| customer.rewarded |\n| customer.rewarded.loyalty_points |\n| customer.voucher.gift.balance_added |\n| customer.voucher.loyalty_card.points_added |\n| customer.voucher.loyalty_card.points_transferred |\n| customer.publication.succeeded |\n| customer.publication.failed |\n| customer.redemption.succeeded |\n| customer.redemption.failed |\n| customer.redemption.rollback.succeeded |\n| customer.redemption.rollback.failed |\n| customer.consents.given |\n| customer.consents.revoked |", + "x-tags": [ + "CUSTOMERS API" + ], + "properties": { + "id": { + "type": "string", + "description": "Unique event ID, assigned by Voucherify.", + "example": "evcus_0c150c51730c6b60b1" + }, + "type": { + "type": "string", + "description": "Event type.", + "enum": [ + "customer.confirmed", + "customer.created", + "customer.updated", + "customer.deleted", + "customer.referred", + "customer.custom_event", + "customer.segment_entered", + "customer.segment.left", + "customer.sms.sent", + "customer.sms.failed", + "customer.email.sent", + "customer.email.failed", + "customer.activecampaign.sent", + "customer.braze.sent", + "customer.mailchimp.sent", + "customer.intercom.sent", + "customer.intercom.failed", + "customer.rewarded", + "customer.rewarded.loyalty_points", + "customer.voucher.gift.balance_added", + "customer.voucher.loyalty_card.points_added", + "customer.voucher.loyalty_card.points_transferred", + "customer.publication.succeeded", + "customer.publication.failed", + "customer.redemption.succeeded", + "customer.redemption.failed", + "customer.redemption.rollback.succeeded", + "customer.redemption.rollback.failed", + "customer.consents.given", + "customer.consents.revoked" + ] + }, + "data": { + "type": "array", + "description": "Contains details about the event. The objects that are returned in the data attribute differ based on the context of the event type.", + "items": { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data" } + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the customer activity occurred in ISO 8601 format.", + "example": "2022-08-30T09:14:07.660Z", + "format": "date-time" + } + } + }, + "9_obj_customer_activity_object_data": { + "title": "Customer Activity Data Object", + "description": "Event data object schema.", + "anyOf": [ + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_confirmed" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_created" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_updated" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_deleted" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_referred" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_custom_event" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_segment_entered" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_segment_left" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_sms_sent" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_sms_failed" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_email_sent" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_email_failed" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_activecampaign_sent" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_activecampaign_failed" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_braze_sent" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_braze_failed" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_mailchimp_sent" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_mailchimp_failed" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_intercom_sent" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_intercom_failed" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_rewarded" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_rewarded_loyalty_points" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_voucher_gift_voucher_balance_added" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_voucher_loyalty_card_points_added" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_voucher_loyalty_card_points_transferred" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_publication_succeeded" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_publication_failed" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_redemption_succeeded" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_redemption_failed" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_redemption_rollback_succeeded" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_redemption_rollback_failed" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_consents_given" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_consents_revoked" + } + ] + }, + "9_obj_customer_activity_object_data_customer_email_unsubscribed": { + "title": "Email Unsubscribed", + "description": "Email unsubscribed", + "type": "object", + "properties": { + "email_unsubscribed": { + "type": "boolean" } } - ], - "type": "object" - }, - "allow_defined_only": { - "type": "boolean", - "description": "Restricts the creation of metadata fields when set to `true`. In other words, it indicates whether or not you are allowed to create new metadata definitions; for example, in the campaign manager or publication manager. If it is set to true, then only the defined fields will be available for assigning values.\t" - }, - "created_at": { - "type": "string", - "example": "2021-12-03T13:33:44.556Z", - "description": "Timestamp representing the date and time when the metadata schema was created in ISO 8601 format.\t", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "example": "2022-08-11T08:05:30.695Z", - "description": "Timestamp representing the date and time when the metadata schema was updated in ISO 8601 format.\t", - "format": "date-time" - }, - "object": { - "type": "string", - "default": "metadata_schema", - "description": "The type of object represented by the JSON. This object stores information about the metadata schema." - } - }, - "x-tags": [ - "METADATA SCHEMAS API" - ], - "examples": [ - { - "id": "ms_27vMXZqBAkkqBoOuw8EYTRLn", - "related_object": "earning_rule", - "properties": { - "channel_id": { - "type": "string", - "array": true, - "optional": true, - "objectType": null, - "exactLength": 5 - }, - "channel_name": { - "eq": [ - "instagram", - "facebook", - "google", - "twitter", - "linkedin", - "website" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null + }, + "9_obj_customer_activity_object_data_customer_confirmed": { + "title": "Customer Confirmed", + "description": "Event data object schema for `customer.confirmed`.", + "type": "object", + "properties": { + "customer": { + "$ref": "#/components/schemas/9_obj_customer_object_email_parameter" + }, + "unconfirmed_customer": { + "type": "string", + "example": "ucust_1qa70mVfYkl11Ab0ZxDPdWNa" + } } }, - "allow_defined_only": false, - "created_at": "2022-08-25T13:09:59.970Z", - "updated_at": "2022-08-25T13:11:15.704Z", - "object": "metadata_schema" - }, - { - "id": "ms_psGSDpVl6JcPilPA7toZ83Kj", - "related_object": "campaign", - "properties": { - "region": { - "eq": [ - "EMEA", - "AMER", - "APAC" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null + "9_obj_customer_activity_object_data_customer_created": { + "title": "Customer Created", + "description": "Event data object schema for `customer.created`.", + "type": "object", + "properties": { + "customer": { + "$ref": "#/components/schemas/9_obj_customer_object_email_parameter" + } } }, - "allow_defined_only": false, - "created_at": "2022-08-25T13:12:58.447Z", - "updated_at": null, - "object": "metadata_schema" - }, - { - "id": "ms_f0r4hm3ta6a4a5ch3ma", - "related_object": "customer", - "properties": { - "age": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "city_id": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "location": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "favorite_brands": { - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "acquisition_channel": { - "eq": [ - "Facebook", - "Twitter", - "Website" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "customer_life_time_value": { - "type": "number", - "array": false, - "optional": true, - "objectType": null + "9_obj_customer_activity_object_data_customer_updated": { + "title": "Customer Updated", + "description": "Event data object schema for `customer.updated`.", + "type": "object", + "properties": { + "customer": { + "$ref": "#/components/schemas/9_obj_customer_object_email_parameter" + } } }, - "allow_defined_only": false, - "created_at": "2021-12-01T08:00:48.889Z", - "updated_at": "2022-09-12T07:34:49.163Z", - "object": "metadata_schema" - }, - { - "id": "ms_jHUoFlgepKVEftxK1pKPGZlO", - "related_object": "loyalty_tier", - "properties": { - "level_name": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "audience_restricted": { - "type": "boolean", - "array": false, - "optional": true, - "objectType": null + "9_obj_customer_activity_object_data_customer_deleted": { + "title": "Customer Deleted", + "description": "Event data object schema for `customer.deleted`.", + "type": "object", + "properties": { + "customer": { + "$ref": "#/components/schemas/9_obj_customer_object_email_parameter" + } } }, - "allow_defined_only": false, - "created_at": "2022-08-25T13:14:54.954Z", - "updated_at": "2022-08-25T13:15:24.436Z", - "object": "metadata_schema" - }, - { - "id": "ms_f1r5Tm3ta6a4a5ch3ma", - "related_object": "order", - "properties": { - "card": { - "eq": [ - "Visa", - "MasterCard", - "Other" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "currency": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "location": { - "ne": [ - 1, - 2, - 18, - 22 - ], - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "store_city": { - "eq": [ - "Hampden", - "San Francisco", - "Warsaw" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "location_id": { - "eq": [ - "L1", - "L2", - "L3" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "payment_mean": { - "eq": [ - "credit-card", - "wire-transfer", - "paypal" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "booking_end_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - }, - "booking_start_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null + "9_obj_customer_activity_object_data_customer_referred": { + "title": "Customer Referred", + "description": "Event data object schema for `customer.referred`.", + "type": "object", + "properties": { + "voucher": { + "type": "object" + }, + "campaign": { + "type": "object" + }, + "customer": { + "type": "object" + }, + "referrer": { + "type": "object" + }, + "redemption": { + "type": "object" + }, + "custom_event": { + "type": "object" + } } }, - "allow_defined_only": false, - "created_at": "2021-12-01T08:00:47.575Z", - "updated_at": "2022-10-25T10:05:18.978Z", - "object": "metadata_schema" - }, - { - "id": "ms_7ux44AEnt82bqo8ww5V1SXzV", - "related_object": "order_item", - "properties": { - "manufacturer_id": { - "gte": 15, - "type": "number", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-08-25T13:16:03.167Z", - "updated_at": null, - "object": "metadata_schema" - }, - { - "id": "ms_s3c0N6m3ta6a4a5ch3ma", - "related_object": "product", - "properties": { - "vendor": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "category": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "location": { - "type": "geopoint", - "array": false, - "optional": true, - "objectType": null + "9_obj_customer_activity_object_data_customer_custom_event": { + "title": "Custom Event", + "description": "Event data object schema for `customer.custom_event`.", + "type": "object", + "properties": { + "event": { + "type": "object" + }, + "loyalty": { + "type": "object" + }, + "customer": { + "type": "object" + }, + "referral": { + "type": "object" + }, + "event_schema": { + "type": "object" + } } }, - "allow_defined_only": false, - "created_at": "2021-12-01T08:00:48.298Z", - "updated_at": "2022-07-14T15:53:29.226Z", - "object": "metadata_schema" - }, - { - "id": "ms_dNb5aLMzU0VBCiRuxLOeMNwn", - "related_object": "promotion_tier", - "properties": { - "level": { - "type": "string", - "array": false, - "optional": true, - "objectType": null + "9_obj_customer_activity_object_data_customer_segment_entered": { + "title": "Segment Entered", + "description": "Event data object schema for `customer.segment.entered`.", + "type": "object", + "properties": { + "segment": { + "type": "object" + }, + "customer": { + "type": "object" + } } }, - "allow_defined_only": false, - "created_at": "2022-01-24T10:42:04.937Z", - "updated_at": "2022-09-23T08:51:46.266Z", - "object": "metadata_schema" - }, - { - "id": "ms_fzvWNh7sU4LeykEQ2Abpg6jG", - "related_object": "publication", - "properties": { - "file_uploaded": { - "type": "image_url", - "array": false, - "optional": true, - "objectType": null - }, - "publication_method": { - "type": "string", - "array": false, - "optional": true, - "objectType": null + "9_obj_customer_activity_object_data_customer_segment_left": { + "title": "Segment Left", + "description": "Event data object schema for `customer.segment.left`.", + "type": "object", + "properties": { + "segment": { + "type": "object" + }, + "customer": { + "type": "object" + } } }, - "allow_defined_only": false, - "created_at": "2022-08-25T13:16:35.534Z", - "updated_at": "2022-09-12T10:26:31.135Z", - "object": "metadata_schema" - }, - { - "id": "ms_t4ir0Dm3ta6a4a5ch3ma", - "related_object": "redemption", - "properties": { - "location_id": { - "eq": [ - "L1", - "L2", - "L3" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "redemption_location": { - "type": "object", - "array": false, - "optional": true, - "objectType": "Location" + "9_obj_customer_activity_object_data_customer_sms_sent": { + "title": "SMS Sent", + "description": "Event data object schema for `customer.sms.sent`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_sms_failed": { + "title": "SMS Failed", + "description": "Event data object schema for `customer.sms.failed`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_email_sent": { + "title": "Email Sent", + "description": "Event data object schema for `customer.email.sent`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_email_failed": { + "title": "Email Failed", + "description": "Event data object schema for `customer.email.failed`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_activecampaign_sent": { + "title": "ActiveCampaign Sent", + "description": "Event data object schema for `customer.activecampaign.sent`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_activecampaign_failed": { + "title": "ActiveCampaign Failed", + "description": "Event data object schema for `customer.activecampaign.failed`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_braze_sent": { + "title": "Braze Sent", + "description": "Event data object schema for `customer.braze.sent`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_braze_failed": { + "title": "Braze Failed", + "description": "Event data object schema for `customer.braze.failed`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_mailchimp_sent": { + "title": "Mailchimp Sent", + "description": "Event data object schema for `customer.mailchimp.sent`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_mailchimp_failed": { + "title": "Mailchimp Failed", + "description": "Event data object schema for `customer.mailchimp.failed`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_intercom_sent": { + "title": "Intercom Sent", + "description": "Event data object schema for `customer.intercom.sent`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_intercom_failed": { + "title": "Intercom Failed", + "description": "Event data object schema for `customer.intercom.failed`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_rewarded": { + "title": "Customer Rewarded", + "description": "Event data object schema for `customer.rewarded`.", + "type": "object", + "properties": { + "holder": { + "type": "object" + }, + "reward": { + "type": "object" + }, + "balance": { + "type": "object" + }, + "voucher": { + "type": "object" + }, + "campaign": { + "type": "object" + }, + "customer": { + "type": "object" + }, + "redemption": { + "type": "object" + }, + "custom_event": { + "type": "object" + }, + "referral_tier": { + "type": "object" + }, + "customer_event": { + "type": "object" + } } }, - "allow_defined_only": false, - "created_at": "2021-12-01T08:00:48.794Z", - "updated_at": "2022-08-25T13:19:50.497Z", - "object": "metadata_schema" - }, - { - "id": "ms_PwrAtwqCFXeH4Qix22gEkqhl", - "related_object": "reward", - "properties": { - "reward_type": { - "eq": [ - "MATERIAL", - "PAY-WITH-POINTS", - "DISCOUNT-COUPON", - "GIFT-CARD-CREDITS", - "LOYALTY POINTS" - ], - "type": "string", - "array": false, - "optional": false, - "objectType": null + "9_obj_customer_activity_object_data_customer_rewarded_loyalty_points": { + "title": "Customer Rewarded Loyalty Points", + "description": "Event data object schema for `customer.rewarded.loyalty_points`.", + "type": "object", + "properties": { + "order": { + "type": "object" + }, + "holder": { + "type": "object" + }, + "balance": { + "type": "object" + }, + "voucher": { + "type": "object" + }, + "campaign": { + "type": "object" + }, + "customer": { + "type": "object" + }, + "earning_rule": { + "type": "object" + }, + "loyalty_tier": { + "type": "object" + } } }, - "allow_defined_only": true, - "created_at": "2022-08-25T13:07:13.689Z", - "updated_at": "2022-08-25T13:08:26.696Z", - "object": "metadata_schema" - }, - { - "id": "ms_9uE6eP17Jvoxl46mCqL6Q3Ut", - "related_object": "voucher", - "properties": { - "lang": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "Season": { - "eq": [ - "Spring", - "Summer", - "Fall", - "Winter" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "marketing_text": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "ProductionVoucherCodeMetaData": { - "type": "string", - "array": false, - "deleted": true, - "optional": true, - "objectType": null + "9_obj_customer_activity_object_data_customer_voucher_gift_voucher_balance_added": { + "title": "Gift Voucher Balance Added", + "description": "Event data object schema for `customer.voucher.gift.balance_added`.", + "type": "object", + "properties": { + "balance": { + "type": "object" + }, + "voucher": { + "type": "object" + }, + "campaign": { + "type": "object" + }, + "customer": { + "type": "object" + } } }, - "allow_defined_only": false, - "created_at": "2022-01-24T10:42:23.994Z", - "updated_at": "2022-09-19T14:13:30.590Z", - "object": "metadata_schema" - } - ] - }, - "21_res_list_metadata_shemas": { - "title": "List Metadata Schemas Response Body", - "type": "object", - "description": "Response schema for listing metadata schemas using **GET** `/metadata-schemas`.", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about metadata schemas in a dictionary.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of metadata schema objects.", - "default": "schemas" - }, - "schemas": { - "type": "array", - "description": "Array of metadata schema objects.", - "items": { - "$ref": "#/components/schemas/21_obj_metadata_schema_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of metadata schemas." - } - }, - "examples": [ - { - "object": "list", - "data_ref": "schemas", - "schemas": [ - { - "id": "ms_yqMHRHH6S1KYIHPmQHealNf4", - "related_object": "Payment", - "properties": { - "payment_tax": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "payment_method": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - } + "9_obj_customer_activity_object_data_customer_voucher_loyalty_card_points_added": { + "title": "Loyalty Card Points Added", + "description": "Event data object schema for `customer.voucher.loyalty_card.points_added`.", + "type": "object", + "properties": { + "balance": { + "type": "object" }, - "allow_defined_only": true, - "created_at": "2022-03-07T11:01:01.747Z", - "updated_at": "2022-03-07T11:01:44.785Z", - "object": "metadata_schema" - }, - { - "id": "ms_DwUjpX32sY3fJEoQELpS7bN3", - "related_object": "campaign", - "properties": { - "Store": { - "type": "string", - "array": false, - "deleted": true, - "optional": true, - "objectType": null - }, - "locale": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "date_tag": { - "type": "date", - "array": false, - "optional": true, - "objectType": null - }, - "store_names": { - "eq": [ - "Store 1 - New York - Broadway", - "Store 2 - Florida - Miami", - "Store 3 - London - Heathrow", - "Store 4 - Berlin - Alexanderplatz" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "date_time_tag": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - }, - "favorite_brands": { - "type": "string", - "array": true, - "deleted": true, - "optional": true, - "objectType": null - }, - "height_customer_number": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "location_country_string": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - } + "voucher": { + "type": "object" }, - "allow_defined_only": false, - "created_at": "2021-12-03T13:33:44.556Z", - "updated_at": "2022-07-26T13:57:42.288Z", - "object": "metadata_schema" - }, - { - "id": "ms_f0r4hm3ta6a4a5ch3ma", - "related_object": "customer", - "properties": { - "birth_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - }, - "CRM_created_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - }, - "customer_location": { - "type": "geopoint", - "array": false, - "optional": true, - "objectType": null - }, - "acquisition_channel": { - "eq": [ - "Facebook", - "Twitter", - "Website" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "customer_life_time_value": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - } + "campaign": { + "type": "object" }, - "allow_defined_only": false, - "created_at": "2021-12-03T06:33:45.894Z", - "updated_at": "2022-07-14T15:15:34.928Z", - "object": "metadata_schema" - }, - { - "id": "ms_7X7krsG84H6MeNuIaKkb4LXN", - "related_object": "earning_rule", - "properties": { - "Type": { - "type": "string", - "array": false, - "optional": true, - "minLength": 6, - "objectType": null - } + "customer": { + "type": "object" + } + } + }, + "9_obj_customer_activity_object_data_customer_voucher_loyalty_card_points_transferred": { + "title": "Loyalty Card Points Transferred", + "description": "Event data object schema for `customer.voucher.loyalty_card.points_transferred`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_publication_succeeded": { + "title": "Publication Succeeded", + "description": "Event data object schema for `customer.publication.succeeded`.", + "type": "object", + "properties": { + "campaign": { + "type": "object" }, - "allow_defined_only": false, - "created_at": "2022-07-27T08:54:07.980Z", - "updated_at": null, - "object": "metadata_schema" - }, - { - "id": "ms_OF36L2rk4EqhdxvZs56IW9iE", - "related_object": "loyalty_tier", - "properties": { - "has_funds": { - "type": "boolean", - "array": false, - "optional": true, - "objectType": null - } + "customer": { + "type": "object" }, - "allow_defined_only": false, - "created_at": "2022-03-30T06:22:16.685Z", - "updated_at": "2022-07-27T08:55:01.628Z", - "object": "metadata_schema" - }, - { - "id": "ms_f1r5Tm3ta6a4a5ch3ma", - "related_object": "order", - "properties": { - "Payment": { - "type": "object", - "array": false, - "deleted": true, - "optional": true, - "objectType": "Payment" - }, - "day_of_week": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "location_id": { - "eq": [ - "L1", - "L2", - "L3" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "payment_mean": { - "eq": [ - "credit-card", - "wire-transfer", - "paypal" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "booking_end_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - }, - "booking_start_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - }, - "number_of_store_visits": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - } + "publication": { + "type": "object" + } + } + }, + "9_obj_customer_activity_object_data_customer_publication_failed": { + "title": "Publication Failed", + "description": "Event data object schema for `customer.publication.failed`.", + "type": "object", + "properties": { + "campaign": { + "type": "object" }, - "allow_defined_only": false, - "created_at": "2021-12-03T06:33:45.798Z", - "updated_at": "2022-04-20T06:47:10.350Z", - "object": "metadata_schema" - }, - { - "id": "ms_0qgIlxP7bYb8H59DqpnWBCUN", - "related_object": "order_item", - "properties": { - "Size": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "Color": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "Thickness": { - "eq": [ - "Thin", - "Medium", - "Thick" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - } + "customer": { + "type": "object" }, - "allow_defined_only": false, - "created_at": "2022-03-11T13:32:55.029Z", - "updated_at": "2022-05-23T13:46:01.463Z", - "object": "metadata_schema" - }, - { - "id": "ms_s3c0N6m3ta6a4a5ch3ma", - "related_object": "product", - "properties": { - "color": { - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "origin": { - "type": "string", - "array": false, - "optional": true, - "minLength": 1, - "objectType": null - }, - "product_location": { - "type": "geopoint", - "array": false, - "optional": true, - "objectType": null - }, - "metadata_attribute_name_with_date_property": { - "type": "date", - "array": false, - "optional": true, - "objectType": null - }, - "metadata_attribute_name_with_number_property": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "metadata_attribute_name_with_boolean_property": { - "type": "boolean", - "array": false, - "optional": true, - "objectType": null - }, - "metadata_attribute_name_with_datetime_property": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - } + "publication": { + "type": "object" + } + } + }, + "9_obj_customer_activity_object_data_customer_redemption_succeeded": { + "title": "Redemption Succeeded", + "description": "Event data object schema for `customer.redemption.succeeded`.", + "type": "object", + "properties": { + "order": { + "type": "object" }, - "allow_defined_only": false, - "created_at": "2021-12-03T06:33:45.880Z", - "updated_at": "2022-07-14T15:46:47.994Z", - "object": "metadata_schema" - }, - { - "id": "ms_th8YHt9yFYY1yAA99XOasT5W", - "related_object": "promotion_tier", - "properties": { - "has_budget": { - "type": "boolean", - "array": false, - "optional": true, - "objectType": null - } + "holder": { + "type": "object" }, - "allow_defined_only": false, - "created_at": "2022-01-24T07:22:21.523Z", - "updated_at": "2022-07-27T08:54:42.909Z", - "object": "metadata_schema" - }, - { - "id": "ms_Z7niydc0OpGjDRL4yB40niXn", - "related_object": "publication", - "properties": { - "year": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - } + "voucher": { + "type": "object" }, - "allow_defined_only": false, - "created_at": "2022-03-30T06:23:49.715Z", - "updated_at": "2022-04-19T10:28:24.568Z", - "object": "metadata_schema" - }, - { - "id": "ms_t4ir0Dm3ta6a4a5ch3ma", - "related_object": "redemption", - "properties": { - "location_id": { - "eq": [ - "L1", - "L2", - "L3" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "store_names": { - "eq": [ - "Store 1 - New York - Broadway", - "Store 2 - Florida - Miami", - "Store 3 - London - Heathrow", - "Store 4 - Berlin - Alexanderplatz" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - } + "campaign": { + "type": "object" }, - "allow_defined_only": false, - "created_at": "2021-12-03T06:33:45.890Z", - "updated_at": "2022-07-26T14:58:24.546Z", - "object": "metadata_schema" - }, - { - "id": "ms_EnSASZVEIDsZAYa8Z0nG8Rlg", - "related_object": "reward", - "properties": { - "Type": { - "type": "string", - "array": false, - "optional": true, - "objectType": null, - "exactLength": 4 - } + "customer": { + "type": "object" }, - "allow_defined_only": false, - "created_at": "2022-07-27T08:53:32.257Z", - "updated_at": "2022-07-27T08:53:48.542Z", - "object": "metadata_schema" - }, - { - "id": "ms_xUHvkRBPvVJAlWcTkVzufKx4", - "related_object": "voucher", - "properties": { - "unit": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "Region": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "Season": { - "eq": [ - "Spring", - "Summer", - "Fall", - "Winter" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "CATEGORY": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "active_on_calendar_month": { - "eq": [ - 1, - 2, - 3, - 5, - 7, - 9, - 10, - 11, - 12 - ], - "type": "number", - "array": false, - "optional": true, - "objectType": null - } + "redemption": { + "type": "object" + }, + "promotion_tier": { + "type": "object" + } + } + }, + "9_obj_customer_activity_object_data_customer_redemption_failed": { + "title": "Redemption Succeeded", + "description": "Event data object schema for `customer.redemption.failed`.", + "type": "object", + "properties": { + "order": { + "type": "object" + }, + "holder": { + "type": "object" + }, + "voucher": { + "type": "object" + }, + "campaign": { + "type": "object" + }, + "customer": { + "type": "object" + }, + "redemption": { + "type": "object" + }, + "promotion_tier": { + "type": "object" + } + } + }, + "9_obj_customer_activity_object_data_customer_redemption_rollback_succeeded": { + "title": "Redemption Rollback Succeeded", + "description": "Event data object schema for `customer.redemption.rollback.succeeded`.", + "type": "object", + "properties": { + "order": { + "type": "object" + }, + "holder": { + "type": "object" + }, + "voucher": { + "type": "object" + }, + "campaign": { + "type": "object" }, - "allow_defined_only": false, - "created_at": "2022-01-24T07:22:01.281Z", - "updated_at": "2022-06-22T07:22:09.577Z", - "object": "metadata_schema" + "customer": { + "type": "object" + }, + "redemption": { + "type": "object" + }, + "promotion_tier": { + "type": "object" + }, + "redemption_rollback": { + "type": "object" + } } - ], - "total": 13 - } - ] - }, - "22_res_list_locations": { - "title": "List Locations Response Body", - "type": "object", - "description": "Response schema for listing locations using **GET** `/locations`.", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about locations in a dictionary.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of metadata schema objects.", - "default": "data" - }, - "data": { - "type": "array", - "description": "Array of location objects.", - "items": { - "$ref": "#/components/schemas/22_obj_location_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of locations." - }, - "has_more": { - "type": "boolean", - "description": "As query results are always limited (by the limit parameter), the `has_more` flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different end date filter) to get more records returned in the results." - } - }, - "examples": [ - { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "loc_NoMGXmHO9OUs7iz9mGWpamma", - "object": "location", - "name": "Belleville", - "shape": { - "type": "circle", - "format": "distance", - "distance": { - "center": "geo:40.79372699823857,-74.15092132694554", - "radius": "1.54 km" - } + }, + "9_obj_customer_activity_object_data_customer_redemption_rollback_failed": { + "title": "Redemption Rollback Failed", + "description": "Event data object schema for `customer.redemption.rollback.failed`.", + "type": "object", + "properties": { + "order": { + "type": "object" }, - "created_at": "2022-07-15T06:04:36.924Z", - "updated_at": null - }, - { - "id": "loc_ae2gKWpAFMsuRhyMqGx2FZFF", - "object": "location", - "name": "New York", - "shape": { - "type": "polygon", - "format": "geojson", - "geojson": { - "type": "Polygon", - "coordinates": [ - [ - [ - -74.016167, - 40.703186 - ], - [ - -74.008687, - 40.750656 - ], - [ - -73.943597, - 40.851838 - ], - [ - -73.928559, - 40.845285 - ], - [ - -73.936152, - 40.8356 - ], - [ - -73.934298, - 40.810015 - ], - [ - -73.92711, - 40.795145 - ], - [ - -73.978623, - 40.710432 - ], - [ - -74.013201, - 40.701619 - ], - [ - -74.016167, - 40.703186 - ] - ] - ] - } + "holder": { + "type": "object" }, - "created_at": "2022-07-15T05:37:45.299Z", - "updated_at": null - }, - { - "id": "loc_f5HqjVaiq7g9ISlmivpytxSf", - "object": "location", - "name": "Germany", - "shape": { - "type": "circle", - "format": "distance", - "distance": { - "center": "geo:51.303908897065064,10.222253628401518", - "radius": "192.37 km" - } + "campaign": { + "type": "object" }, - "created_at": "2022-07-14T15:51:39.265Z", - "updated_at": null - }, - { - "id": "loc_RcYz537sV07e1t5aG5tIH9FD", - "object": "location", - "name": "Poland", - "shape": { - "type": "polygon", - "format": "geojson", - "geojson": { - "type": "Polygon", - "coordinates": [ - [ - [ - 18.553923, - 50.559107 - ], - [ - 18.528805, - 51.087437 - ], - [ - 19.591667, - 50.832424 - ], - [ - 19.425109, - 50.497984 - ], - [ - 19.375814, - 50.330652 - ], - [ - 19.398107, - 50.111652 - ], - [ - 18.73906, - 49.981498 - ], - [ - 18.272477, - 50.088707 - ], - [ - 18.553923, - 50.559107 - ] - ] - ] - } + "customer": { + "type": "object" }, - "created_at": "2022-07-14T15:21:55.085Z", - "updated_at": null - } - ], - "total": 4, - "has_more": false - } - ] - }, - "22_obj_location_object": { - "title": "Location object", - "type": "object", - "description": "This is an object representing a location.", - "x-tags": [ - "LOCATIONS API" - ], - "properties": { - "id": { - "type": "string", - "description": "Unique location ID, assigned by the Voucherify API.", - "example": "loc_NoMGXmHO9OUs7iz9mGWpamma" - }, - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about a `location`.", - "default": "location" - }, - "name": { - "type": "string", - "description": "Location name." - }, - "shape": { - "type": "object", - "description": "Defines the shape and boundaries of the location.", - "anyOf": [ - { - "$ref": "#/components/schemas/22_obj_location_object_shape_circle" - }, - { - "$ref": "#/components/schemas/22_obj_location_object_shape_polygon" + "redemption": { + "type": "object" + }, + "promotion_tier": { + "type": "object" + }, + "redemption_rollback": { + "type": "object" + } } - ] - }, - "created_at": { - "type": "string", - "example": "2022-02-14T15:12:06.817Z", - "description": "Timestamp representing the date and time when the location was created in ISO 8601 format.", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "example": "2022-03-14T15:12:06.817Z", - "description": "Timestamp representing the date and time when the location was updated in ISO 8601 format.", - "format": "date-time" - } - } - }, - "22_obj_location_object_shape_circle": { - "title": "Circle", - "type": "object", - "description": "This is an object representing a circular shape.", - "properties": { - "type": { - "type": "string", - "description": "The type of shape being defined is a `circle`.", - "default": "circle" - }, - "format": { - "type": "string", - "description": "The location is defined in terms of a `distance` object.", - "default": "distance" - }, - "distance": { - "type": "object", - "title": "Distance", - "description": "Defines the parameters for the circle.", - "properties": { - "center": { - "type": "string", - "description": "Center of the circle identified by GPS coordinates in decimal degrees.", - "example": "geo:40.79372699823857,-74.15092132694554" - }, - "radius": { - "type": "string", - "description": "Defines the radius of the circle." + }, + "9_obj_customer_activity_object_data_customer_consents_given": { + "title": "Consents Given", + "description": "Event data object schema for `customer.consents.given`.", + "type": "object", + "properties": { + "consents": { + "type": "object" + }, + "customer": { + "type": "object" + } } - } - } - } - }, - "22_obj_location_object_shape_polygon": { - "title": "Polygon", - "type": "object", - "description": "This is an object representing a polygon.", - "properties": { - "type": { - "type": "string", - "description": "The type of shape being defined is a `polygon`.", - "default": "polygon" - }, - "format": { - "type": "string", - "description": "The location is defined in terms of a `geojson` object.", - "default": "geojson" - }, - "distance": { - "type": "object", - "title": "Geojson", - "description": "Defines the parameters for the polygon.", - "properties": { - "type": { - "type": "string", - "description": "Type of geojson coordinates, i.e. `Polygon`.", - "default": "Polygon" - }, - "coordinates": { - "type": "array", - "description": "Contains array of GeoJSON coordinate arrays.", - "items": { - "$ref": "#/components/schemas/22_geojson_array" + }, + "9_obj_customer_activity_object_data_customer_consents_revoked": { + "title": "Consents Given", + "description": "Event data object schema for `customer.consents.revoked`.", + "type": "object", + "properties": { + "consents": { + "type": "object" + }, + "customer": { + "type": "object" } } - } - } - } - }, - "22_geojson_array": { - "title": "GeoJSON coordinate array.", - "type": "array", - "description": "GeoJSON coordinate array.", - "items": { - "$ref": "#/components/schemas/22_geojson_coordinates" - } - }, - "22_geojson_coordinates": { - "title": "GeoJSON coordinate.", - "type": "array", - "description": "GeoJSON coordinate.", - "items": { - "type": "integer" - } - }, - "22_filter_updated_at": { - "type": "object", - "title": "Updated at", - "properties": { - "updated_at": { - "$ref": "#/components/schemas/16_filter_conditions_date_time" - } - }, - "description": "A filter on the list based on the object `updated_at` field. The value is a dictionary with the following options: `before`, `after`. A date value must be presented in ISO 8601 format (`2016-11-16T14:14:31Z` or `2016-11-16`). An example: `[updated_at][before]=2017-09-08T13:52:18.227Z`" - }, - "22_filter_created_at": { - "type": "object", - "title": "Created at", - "properties": { - "created_at": { - "$ref": "#/components/schemas/16_filter_conditions_date_time" - } - }, - "description": "A filter on the list based on the object `created_at` field. The value is a dictionary with the following options: `before`, `after`. A date value must be presented in ISO 8601 format (`2016-11-16T14:14:31Z` or `2016-11-16`). An example: `[created_at][before]=2017-09-08T13:52:18.227Z`" - }, - "22_filter_name": { - "type": "object", - "title": "Name", - "properties": { - "name": { - "$ref": "#/components/schemas/16_filter_conditions_string" - } - }, - "description": "A filter on the list based on the name field." - }, - "22_filter_id": { - "type": "object", - "title": "ID", - "properties": { - "id": { - "$ref": "#/components/schemas/16_filter_conditions_string" - } - }, - "description": "A filter on the list based on the id of the location." - }, - "23_obj_qualification_object": { - "title": "Qualification object", - "type": "object", - "description": "This is an object representing a qualification.", - "x-tags": [ - "QUALIFICATIONS API" - ], - "properties": { - "redeemables": { - "$ref": "#/components/schemas/23_obj_qualification_redeemables" - }, - "tracking_id": { - "type": "string", - "description": "This identifier is generated during voucher qualification based on your internal id (e.g., email, database ID). This is a hashed customer source ID." - }, - "order": { - "type": "object", - "description": "The order object sent in the request.", - "$ref": "#/components/schemas/23_obj_order_object" - }, - "stacking_rules": { - "$ref": "#/components/schemas/23_obj_qualification_object_stacking_rules" - } - } - }, - "23_obj_order_object": { - "type": "object", - "title": "Order object", - "description": "This is an object representing an order. \n\nThe purchase transactions can be tracked in Voucherify by the creation of an order object. You can create, retrieve, and pay individual orders, as well as list and export all of them in a CSV format. Orders are identified by a unique ID.\n\nOrders are automatically created during the [redeem voucher](ref:redeem-voucher) and [redeem promotion](redeem-promotion) call.\n\n\n> #### order.id and order session\n>\n> If you use the same order.id in more than one redemption request, all valid discounts provided in the redemption payload will be applied to the given order.\n> \n> Each time you use particular order in your requests, the API will automatically trigger a new session linked to the order.id. The session is active during the request and ends asynchronously after the request is completed. The session mechanism ensures that the particular order.id can be used in one API request at once.", - "x-tags": [ - "ORDERS API" - ], - "properties": { - "id": { - "type": "string", - "description": "Unique order ID, assigned by Voucherify.", - "example": "ord_GFDbbv2I0wnO0sFUBOOOXPj2" - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the order was created in ISO 8601 format.", - "example": "2022-03-09T11:19:04.819Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "example": "2022-08-12T13:34:10.681Z", - "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format.", - "format": "date-time" - }, - "status": { - "type": "string", - "description": "Order status.", - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULFILLED" - ] - }, - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "discount_amount": { - "type": "integer", - "description": "Sum of all order-level discounts applied to the order." - }, - "items_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" - }, - "total_discount_amount": { - "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`\t" - }, - "total_amount": { - "type": "integer", - "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", - "items": { + }, + "customers_permanent_deletion_response_body": { "type": "object", + "title": "Customer Permanent Deletion Response Body", + "description": "Response body schema for `/customers/{customerId}/permanent-deletion`.", "properties": { - "object": { + "id": { "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." + "description": "Unique permanent deletion object ID.", + "example": "del_mgzqZNwUnwnt1Ddw6phEG90Q" }, - "product_id": { + "created_at": { "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." + "example": "2022-09-02T17:55:47.865Z", + "description": "Timestamp representing the date and time when the customer was requested to be deleted in ISO 8601 format.", + "format": "date-time" }, - "sku_id": { + "related_object_id": { "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." - }, - "discount_amount": { - "type": "integer", - "description": "The item-level discount applied to the item." + "example": "cust_m557pDDl4IGXexkU6KOQ2Dwi", + "description": "Unique customer ID that is being deleted." }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "related_object": { + "type": "string", + "description": "Object being deleted.", + "default": "customer" }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" + "status": { + "type": "string", + "description": "Deletion status.", + "default": "DONE" }, - "product": { + "data_json": { "type": "object", - "description": "This object stores more information about the related product.", + "description": "Statistics summarizing the number of related information that was deleted.", + "required": [ + "events", + "customer_events", + "daily_events", + "segments", + "orders", + "order_events", + "customer" + ], "properties": { - "id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." + "events": { + "type": "integer", + "description": "Number of events deleted." }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" + "customer_events": { + "type": "integer", + "description": "Number of customer events deleted." }, - "name": { - "type": "string", - "example": "Brewing System", - "description": "Product name." + "daily_events": { + "type": "integer", + "description": "Number of daily events deleted." }, - "price": { + "segments": { "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - }, - "sku": { - "type": "object", - "description": "This object stores more information about the related SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + "description": "Number of segments deleted." }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." + "orders": { + "type": "integer", + "description": "Number of orders deleted." }, - "sku": { - "type": "string", - "description": "SKU name." + "order_events": { + "type": "integer", + "description": "Number of order events deleted." }, - "price": { + "customer": { "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + "description": "Number of customers deleted.", + "default": 1 } } - } - } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are attached to an order object. Stores additional information about the order in a structured format." - }, - "customer": { - "type": "object", - "description": "Object containing information about the customer that is making the purchase.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique customer ID of the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `customer` object." - } - } - }, - "referrer": { - "type": "object", - "description": "Object containing information about the referrer.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique referrer ID, who referred the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the referrer object." - } - } - }, - "customer_id": { - "type": "string", - "description": "Unique customer ID of the customer making the purchase.", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" - }, - "referrer_id": { - "type": "string", - "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "description": "Unique referrer ID." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - } - } - }, - "23_obj_qualification_object_stacking_rules": { - "type": "object", - "title": "Examine Qualification Stacking Rules", - "description": "Defines stacking rules for the redeemables.", - "properties": { - "redeemables_limit": { - "type": "integer", - "description": "Defines how many redeemables can be sent with one stacking request. We have extended the maximum value from 5 to 30 (comment: but more redeemables means more processing time!). Default limit is `30`.", - "default": 30 - }, - "applicable_redeemables_limit": { - "type": "integer", - "description": "Defines how many of sent redeemables will be actually applied to the order (e.g. user can select 30 discounts but only 5 will be applied to the order, the remaining will be marked as SKIPPED). Default limit is `5`.", - "default": 5 - } - } - }, - "23_req_create_qualification": { - "type": "object", - "title": "Examine Qualification Request Body", - "description": "Request body schema for examining a qualification`.", - "properties": { - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/23_req_create_qualification_customer_id" - }, - { - "$ref": "#/components/schemas/23_req_create_qualification_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/23_req_create_qualification_order_id" - }, - { - "$ref": "#/components/schemas/23_req_create_qualification_order_source_id" - }, - { - "$ref": "#/components/schemas/10_req_create_order" - } - ], - "description": "Order information. This object enables you to pass purchase transaction data. Read what properties you can use in the [Order object](ref:get-order)." - }, - "options": { - "type": "object", - "description": "Configure parameters returned in the response.", - "properties": { - "expand": { - "type": "array", - "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. \n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"redeemable\"] | - Returns the redeemables' metadata. |\n| [\"category\"] | - Returns an expanded `categories` object, showing details about the category. |", - "items": { + }, + "object": { "type": "string", - "enum": [ - "redeemable", - "category" - ] + "description": "The type of object represented by JSON.", + "default": "pernament_deletion" } }, - "limit": { - "type": "integer", - "description": "The maximum number of redeemables to be returned in the API request. The actual number of returned redeemables will be determined by the API. The default value is set to 5, and the maximum value is 50.", - "maximum": 50 - }, - "starting_after": { - "type": "string", - "example": "2021-09-08T13:52:18.227Z", - "format": "date-time", - "description": "Curser used for paging." - }, - "filters": { - "description": "A set of fiters to return only a specific category or type of redeemable.", - "anyOf": [ - { - "$ref": "#/components/schemas/23_obj_filter_resource_type" - }, - { - "$ref": "#/components/schemas/23_obj_filter_category_id" - } - ] - } - } - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against redeemables requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the [Create Validation Rules](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "mode": { - "type": "string", - "description": "Defines which resources Voucherify will use. Currently, `BASIC` is supported." - }, - "scenario": { - "type": "string", - "description": "Defines the scenario Voucherify should consider during the qualification process.\n\n- `ALL` - Scenario that returns all redeemables available for the customer in one API request.\n- `CUSTOMER_WALLET` - returns vouchers applicable to the customer’s cart based on the vouchers assigned to the customer’s profile.\n- `AUDIENCE_ONLY` - returns all vouchers, promotion tiers, and campaigns available to the customer. Voucherify validates the rules based on the customer profile only.\n- `PRODUCTS` - returns all promotions available for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule).\n- `PRODUCTS_DISCOUNT` - returns all promotions available for products when a discount is defined as applicable to specific item(s).\n- `PROMOTION_STACKS` - returns the applicable promotion stacks.\n- `PRODUCTS_BY_CUSTOMER` - returns all promotions available for a customer for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule).\n- `PRODUCTS_DISCOUNT_BY_CUSTOMER` - returns all promotions available for a customer for products when a discount is defined as applicable to specific item(s).", - "enum": [ - "ALL", - "CUSTOMER_WALLET", - "AUDIENCE_ONLY", - "PRODUCTS", - "PRODUCTS_DISCOUNT", - "PROMOTION_STACKS", - "PRODUCTS_BY_CUSTOMER", - "PRODUCTS_DISCOUNT_BY_CUSTOMER" - ] - } - } - }, - "23_req_create_qualification_customer_id": { - "title": "Customer ID", - "description": "You can pass the unique customer ID that was assigned by Voucherify.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The ID of an existing customer that will be linked to redemption in this request.", - "example": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" - } - } - }, - "23_req_create_qualification_customer_source_id": { - "title": "Customer Source ID", - "description": "You can send the source ID that you used to create the customer in Voucherify.", - "type": "object", - "properties": { - "source_id": { - "type": "string", - "description": "A unique identifier of a customer. It can be a customer ID or email from a CRM system, database or 3rd-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored." - } - } - }, - "23_req_create_qualification_order_id": { - "title": "Order ID", - "description": "You can pass the unique order ID that was assigned by Voucherify.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request." - } - } - }, - "23_req_create_qualification_order_source_id": { - "title": "Order Source ID", - "description": "You can send the source ID that you used to create the order in Voucherify.", - "type": "object", - "properties": { - "source_id": { - "type": "string", - "description": "Unique source ID of an existing order that will be linked to the redemption of this request." - } - } - }, - "23_obj_filter_resource_type": { - "description": "Filter conditions set on the resource `type`. The resource types include: `voucher`, `promotion_tier`, `campaign`.", - "title": "Filter by type", - "type": "object", - "properties": { - "resource_type": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "23_obj_filter_category_id": { - "description": "Filter conditions set on the resource `category_id`.", - "title": "Filter by category ID", - "type": "object", - "properties": { - "category_id": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "23_obj_qualification_redeemables": { - "title": "Redeemables", - "type": "object", - "description": "List or redeemables for examine qualification.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. Default is `list`." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of qualified redeemables." - }, - "data": { - "type": "array", - "description": "Array of qualified redeemables.", - "items": { - "allOf": [] - } - }, - "total": { - "type": "integer", - "example": 5, - "description": "The number of redeemables returned in the API request." - }, - "has_more": { - "type": "boolean", - "description": "As results are always limited, the `has_more` flag indicates whether there are more records for given parameters. This let's you know if you are able to run another request (with different options) to get more records returned in the results." - } - } - }, - "LoyaltiesGetPointsExpirationResponseBody": { - "title": "Loyalties Get Points Expiration Response Body", - "type": "object", - "properties": { - "object": { - "type": "string", - "pattern": "list", - "enum": [ - "list" - ], - "description": "The type of object represented by JSON. This object stores information about loyalty points expiration buckets in a dictionary." - }, - "data_ref": { - "type": "string", - "pattern": "data", - "enum": [ - "data" - ], - "description": "Identifies the name of the attribute that contains the array of loyalty points expiration bucket objects." - }, - "data": { - "type": "array", - "description": "Contains array of loyalty points expiration buckets.", - "items": { + "required": [ + "id", + "created_at", + "related_object_id", + "related_object", + "status", + "data_json", + "object" + ] + }, + "customers_update_metadata_in_bulk_request_body": { "type": "object", + "title": "Update Customers' Metadata in bulk Request Body", + "description": "Request body schema for `/customers/metadata/async`.", + "properties": { + "source_ids": { + "type": "array", + "description": "An array of customer `source_id`'s.", + "items": { + "type": "string" + } + }, + "metadata": { + "type": "object", + "description": "Metadata key value pairs to be updated. A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments." + } + }, + "required": [ + "source_ids", + "metadata" + ] + }, + "customers_update_in_bulk_request_body": { + "type": "array", + "title": "Update Customers in bulk Request Body", + "description": "Request body schema for `/customers/bulk/async`.", + "items": { + "$ref": "#/components/schemas/customers_update_in_bulk_item_request_body" + } + }, + "customers_update_in_bulk_item_request_body": { + "title": "Update Customers in bulk Request Body", + "description": "Request body schema for `/customers/bulk/async`.", "properties": { - "id": { + "source_id": { "type": "string", - "description": "Unique loyalty points bucket ID." + "description": "Unique customer source ID." }, - "voucher_id": { - "type": "string", - "description": "Unique parent loyalty card ID." + "name": { + "type": [ + "string", + "null" + ], + "description": "Customer's first and last name." }, - "campaign_id": { - "type": "string", - "description": "\nUnique parent campaign ID." + "description": { + "type": [ + "string", + "null" + ], + "description": "An arbitrary string that you can attach to a customer object." }, - "bucket": { - "type": "object", - "required": [ - "total_points" + "email": { + "type": [ + "string", + "null" ], - "description": "Defines the number of points stored in the given loyalty points bucket.", + "description": "Customer's email address." + }, + "phone": { + "type": [ + "string", + "null" + ], + "description": "Customer's phone number." + }, + "address": { + "type": "object", + "description": "Customer's address.", "properties": { - "total_points": { - "type": "integer", - "description": "Total number of points in the loyalty points bucket." + "city": { + "type": [ + "string", + "null" + ], + "description": "City" + }, + "state": { + "type": [ + "string", + "null" + ], + "description": "State" + }, + "line_1": { + "type": [ + "string", + "null" + ], + "description": "First line of address." + }, + "line_2": { + "type": [ + "string", + "null" + ], + "description": "Second line of address." + }, + "country": { + "type": [ + "string", + "null" + ], + "description": "Country." + }, + "postal_code": { + "type": [ + "string", + "null" + ], + "description": "Postal code." } } }, + "birthdate": { + "type": [ + "string", + "null" + ], + "description": "Customer's birthdate; format `YYYY-MM-DD`." + }, + "metadata": { + "type": [ + "object", + "null" + ], + "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. " + } + }, + "required": [ + "source_id" + ] + }, + "9_req_update_customers_consents": { + "type": "object", + "title": "Update Customer Consents Request Body", + "description": "Request body schema for **PUT** `/customers/{customerId}/consents`.", + "properties": { + "consent_id": { + "type": "boolean", + "description": "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." + }, + "unsubscribed": { + "type": "boolean", + "description": "To deny all consents, use `unsubscribed` as a consent identifier and `true` as a value." + } + } + }, + "10_obj_order_object": { + "type": "object", + "title": "Order object", + "description": "This is an object representing an order. \n\nThe purchase transactions can be tracked in Voucherify by the creation of an order object. You can create, retrieve, and pay individual orders, as well as list and export all of them in a CSV format. Orders are identified by a unique ID.\n\nOrders are automatically created during the [redeem voucher](ref:redeem-voucher) and [redeem promotion](redeem-promotion) call.\n\n\n> #### order.id and order session\n>\n> If you use the same order.id in more than one redemption request, all valid discounts provided in the redemption payload will be applied to the given order.\n> \n> Each time you use particular order in your requests, the API will automatically trigger a new session linked to the order.id. The session is active during the request and ends asynchronously after the request is completed. The session mechanism ensures that the particular order.id can be used in one API request at once.", + "x-tags": [ + "ORDERS API" + ], + "properties": { + "id": { + "type": "string", + "description": "Unique order ID, assigned by Voucherify.", + "example": "ord_GFDbbv2I0wnO0sFUBOOOXPj2" + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + }, "created_at": { "type": "string", - "description": "Timestamp representing the date and time when the loyalty points bucket object was created in ISO 8601 format.", + "description": "Timestamp representing the date and time when the order was created in ISO 8601 format.", + "example": "2022-03-09T11:19:04.819Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2022-08-12T13:34:10.681Z", + "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format.", "format": "date-time" }, "status": { "type": "string", - "description": "Loyalty points bucket point status." + "description": "Order status.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULFILLED" + ] }, - "expires_at": { + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "discount_amount": { + "type": "integer", + "description": "Sum of all order-level discounts applied to the order." + }, + "items_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" + }, + "total_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`\t" + }, + "total_amount": { + "type": "integer", + "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", + "items": { + "type": "object", + "properties": { + "object": { + "type": "string", + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." + }, + "product_id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "sku_id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + }, + "discount_amount": { + "type": "integer", + "description": "The item-level discount applied to the item." + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" + }, + "product": { + "type": "object", + "description": "This object stores more information about the related product.", + "properties": { + "id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" + }, + "name": { + "type": "string", + "example": "Brewing System", + "description": "Product name." + }, + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + }, + "sku": { + "type": "object", + "description": "This object stores more information about the related SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." + }, + "sku": { + "type": "string", + "description": "SKU name." + }, + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + } + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are attached to an order object. Stores additional information about the order in a structured format." + }, + "customer": { + "type": "object", + "description": "Object containing information about the customer that is making the purchase.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique customer ID of the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `customer` object." + } + } + }, + "referrer": { + "type": "object", + "description": "Object containing information about the referrer.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique referrer ID, who referred the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the referrer object." + } + } + }, + "customer_id": { "type": "string", - "format": "date-time", - "description": "Date when the number of points defined in the bucket object are due to expire." + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" }, - "updated_at": { + "referrer_id": { "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the loyalty points bucket object was updated in ISO 8601 format." + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." }, "object": { "type": "string", - "pattern": "loyalty_points_bucket", - "enum": [ - "loyalty_points_bucket" - ], - "description": "The type of object represented by JSON. This object stores information about the loyalty points bucket." + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + }, + "redemptions": { + "oneOf": [ + { + "$ref": "#/components/schemas/10_obj_order_object_unstacked_redemptions" + }, + { + "$ref": "#/components/schemas/10_obj_order_object_stacked_redemptions" + } + ] } - }, - "required": [ - "id", - "voucher_id", - "campaign_id", - "bucket", - "created_at", - "status", - "expires_at", - "object" - ] - } - }, - "total": { - "type": "integer", - "description": "Total number of point expiration buckets." - } - }, - "required": [ - "object", - "data_ref", - "data", - "total" - ] - }, - "LoyaltiesGetEarningRuleResponseBody": { - "$ref": "#/components/schemas/EarningRule" - }, - "LoyaltiesEnableEarningRulesResponseBody": { - "allOf": [ - { - "$ref": "#/components/schemas/EarningRuleBase" - }, - { - "type": "object", - "properties": { - "updated_at": { - "type": [ - "string", - "null" - ], - "format": "date-time", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format." - }, - "active": { - "type": "boolean", - "default": true, - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date." - } - }, - "required": [ - "updated_at", - "active" - ] - } - ] - }, - "LoyaltiesDisableEarningRulesResponseBody": { - "allOf": [ - { - "$ref": "#/components/schemas/EarningRuleBase" - }, - { - "type": "object", - "properties": { - "updated_at": { - "type": [ - "string", - "null" - ], - "format": "date-time", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format." - }, - "active": { - "type": "boolean", - "default": false, - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date." - } - }, - "required": [ - "updated_at", - "active" - ] - } - ] - }, - "EarningRuleBase": { - "title": "EarningRuleBase", - "x-stoplight": { - "id": "w4ci1ljqva0r1" - }, - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Assigned by the Voucherify API, identifies the earning rule object." - }, - "created_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format." - }, - "loyalty": { - "anyOf": [ - { - "$ref": "#/components/schemas/EarningRuleFixed" - }, - { - "$ref": "#/components/schemas/EarningRuleProportional" - } - ] - }, - "event": { - "$ref": "#/components/schemas/EarningRuleEvent", - "description": "Defines the event which triggers the earning rule to add points to a loyalty card." - }, - "custom_event": { - "type": "object", - "properties": { - "schema_id": { - "type": "string" - } - }, - "required": [ - "schema_id" - ] - }, - "segment": { - "type": "object", - "description": "Contains the id of a customer segment. Required for the customer.segment.entered option in event.", - "properties": { - "id": { - "type": "string", - "description": "Contains a unique identifier of a customer segment. Assigned by the Voucherify API." - } - }, - "required": [ - "id" - ] - }, - "source": { - "type": "object", - "required": [ - "object_id", - "object_type" - ], - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - }, - "object_id": { - "type": "string", - "description": "A unique campaign identifier assigned by the Voucherify API." - }, - "object_type": { - "type": "string", - "description": "Defines the object associated with the earning rule. Defaults to `campaign`.", - "enum": [ - "campaign" - ] - } - } - }, - "object": { - "type": "string", - "enum": [ - "earning_rule" - ], - "description": "The type of object represented by JSON. Default is earning_rule." - }, - "automation_id": { - "type": "string", - "description": "For internal use by Voucherify." - }, - "start_date": { - "type": "string", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is inactive before this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default." - }, - "expiration_date": { - "type": "string", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is inactive after this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.start_date required when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a duration of PT1H will be valid for a duration of one hour." - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an interval of P2D will be valid every other day." } }, - "required": [ - "duration", - "interval" - ] - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday\n- `1` Monday\n- `2` Tuesday\n- `3` Wednesday\n- `4` Thursday\n- `5` Friday\n- `6` Saturday", - "items": { - "type": "integer", - "minimum": 0, - "maximum": 6 - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } - }, - "required": [ - "id", - "created_at", - "loyalty", - "source", - "object", - "automation_id", - "metadata" - ] - }, - "EarningRuleEvent": { - "title": "EarningRuleEvent", - "x-stoplight": { - "id": "6vxql7fnzg2zp" - }, - "type": "string", - "enum": [ - "order.paid", - "customer.segment.entered", - "custom_event", - "customer.loyalty.tier.upgraded", - "customer.loyalty.tier.downgraded", - "customer.loyalty.tier.prolonged", - "customer.loyalty.tier.joined", - "customer.loyalty.tier.left" - ] - }, - "EarningRuleFixed": { - "title": "Define fixed amount of points", - "x-stoplight": { - "id": "r5o8m0sdli7fq" - }, - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "FIXED" - ], - "description": "The number of points to be added to the loyalty card." - }, - "points": { - "type": "integer", - "description": "Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points." - } - } - }, - "EarningRuleProportionalOrder": { - "anyOf": [ - { - "$ref": "#/components/schemas/EarningRuleProportionalOrderAmount" - }, - { - "$ref": "#/components/schemas/EarningRuleProportionalOrderTotalAmount" - }, - { - "$ref": "#/components/schemas/EarningRuleProportionalOrderMetadata" - } - ], - "title": "Order" - }, - "EarningRuleProportionalOrderAmount": { - "title": "Order Amount", - "x-stoplight": { - "id": "1z7lk7z1lp5af" - }, - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "PROPORTIONAL" - ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." - }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_AMOUNT" - ], - "description": "`ORDER_AMOUNT`: Pre-discount order amount (X points for every Y spent excluding discounts)" - }, - "order": { - "type": "object", - "required": [ - "amount" - ], - "properties": { - "amount": { - "type": "object", - "required": [ - "every", - "points" - ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", - "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - } - } - } - } - } - }, - "required": [ - "type", - "calculation_type", - "order" - ] - }, - "EarningRuleProportionalOrderTotalAmount": { - "title": "Order Total Amount", - "x-stoplight": { - "id": "ekudxr430edgk" - }, - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "PROPORTIONAL" - ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." - }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_TOTAL_AMOUNT" - ], - "description": "`ORDER_TOTAL_AMOUNT`: Total order amount (X points for every Y spent including discount)" - }, - "order": { - "type": "object", - "required": [ - "total_amount" - ], - "properties": { - "total_amount": { - "type": "object", - "required": [ - "every", - "points" - ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", - "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + "10_obj_order_object_no_discount_calculations": { + "type": "object", + "title": "Order object", + "description": "This is an object representing an order.", + "properties": { + "id": { + "type": "string", + "description": "Unique order ID, assigned by Voucherify.", + "example": "ord_GFDbbv2I0wnO0sFUBOOOXPj2" + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the order was created in ISO 8601 format.", + "example": "2022-03-09T11:19:04.819Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2022-08-12T13:34:10.681Z", + "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format.", + "format": "date-time" + }, + "status": { + "type": "string", + "description": "Order status.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULFILLED" + ] + }, + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "total_amount": { + "type": "integer", + "description": "Order amount after applying all the discounts." + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", + "items": { + "type": "object", + "properties": { + "object": { + "type": "string", + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." + }, + "product_id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "sku_id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "A unique identifier that represents the product or SKU from your inventory system." + }, + "related_object": { + "type": "string", + "description": "Reference to the object containing details of the related product. This can either be a `product` or `sku`.", + "enum": [ + "product", + "sku" + ] + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`." + }, + "product": { + "type": "object", + "description": "This object stores more information about the related product.", + "properties": { + "id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" + }, + "name": { + "type": "string", + "example": "Brewing System", + "description": "Product name." + }, + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + }, + "sku": { + "type": "object", + "description": "This object stores more information about the related SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." + }, + "sku": { + "type": "string", + "description": "SKU name." + }, + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + } + } } - } - } - } - } - }, - "required": [ - "type", - "calculation_type", - "order" - ] - }, - "EarningRuleProportionalOrderMetadata": { - "title": "Order Metadata", - "x-stoplight": { - "id": "4ccw4gz8b47u5" - }, - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "PROPORTIONAL" - ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." - }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_METADATA" - ], - "description": "`ORDER_METADATA`: Order Metadata (X points for every Y in metadata attribute, defined in the property key under the order.metadata object)" - }, - "order": { - "type": "object", - "required": [ - "metadata" - ], - "description": "Defines the formula for calculating points proportionally.", - "properties": { - "metadata": { - "type": "object", - "required": [ - "every", - "points", - "property" - ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points.", - "properties": { - "every": { - "type": "integer", - "description": "For how many increments of the order metadata property to grant points for." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - }, - "property": { - "type": "string", - "description": "Order metadata property." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are attached to an order object. Stores additional information about the order in a structured format." + }, + "customer": { + "type": "object", + "description": "Object containing information about the customer that is making the purchase.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique customer ID of the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `customer` object." + } } - } - } - } - } - }, - "required": [ - "type", - "calculation_type", - "order" - ] - }, - "EarningRuleProportionalOrderItemsQuantity": { - "title": "Order Items Quantity", - "x-stoplight": { - "id": "pqsn9otpzyot9" - }, - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "PROPORTIONAL" - ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." - }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_ITEMS_QUANTITY" - ], - "description": "`ORDER_ITEMS_QUANTITY`: Quantity of items defined in order_items.quantity.object & .id (X points for every Y items excluding free items)" - }, - "order_items": { - "type": "object", - "required": [ - "quantity" - ], - "properties": { - "quantity": { - "type": "object", - "required": [ - "every", - "points", - "object", - "id" - ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", - "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - }, - "object": { - "type": "string", - "description": "Type of object taken under consideration.", - "enum": [ - "products_collection", - "product", - "sku" - ] - }, - "id": { - "type": "string", - "description": "Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619." + }, + "referrer": { + "type": "object", + "description": "Object containing information about the referrer.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique referrer ID, who referred the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the referrer object." + } } + }, + "customer_id": { + "type": "string", + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" + }, + "referrer_id": { + "type": "string", + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." } } - } - } - }, - "required": [ - "type", - "calculation_type", - "order_items" - ] - }, - "EarningRuleProportionalOrderItemsAmount": { - "title": "Order Items Amount", - "x-stoplight": { - "id": "8pg4o23daepkb" - }, - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "PROPORTIONAL" - ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." - }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_ITEMS_AMOUNT" - ], - "description": "ORDER_ITEMS_AMOUNT; Pre-discount amount spent on items defined in the order_items.amount.object & .id (X points for every Y spent on items excluding discounts)" - }, - "order_items": { - "type": "object", - "required": [ - "amount" - ], - "properties": { - "amount": { - "type": "object", - "required": [ - "every", - "points", - "object", - "id" - ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", - "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - }, - "object": { - "type": "string", - "description": "Type of object taken under consideration.", - "enum": [ - "products_collection", - "product", - "sku" - ] - }, - "id": { - "type": "string", - "description": "Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619." + }, + "10_obj_order_object_unstacked_redemptions": { + "type": "object", + "title": "Unstacked Redemption", + "description": "Redemption object representing a single redemption.", + "properties": { + "redemption_ID": { + "type": "object", + "description": "The property name is the unique redemption ID; i.e. `r_0ba186c4824e4881e1`. This object contains information about the redemption of an incentive.", + "properties": { + "date": { + "type": "string", + "description": "Timestamp representing the date and time when the redemption was created in ISO 8601 format.", + "example": "2022-09-02T17:06:56.649Z", + "format": "date-time" + }, + "related_object_type": { + "type": "string", + "description": "The source of the incentive.", + "enum": [ + "voucher", + "promotion_tier" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique ID of the related object that defines the incentive." + }, + "related_object_parent_id": { + "type": "string", + "description": "Represent's the campaign ID of the voucher if the redemption was based on a voucher that was part of bulk codes generated within a campaign. In case of a promotion tier, this represents the campaign ID of the promotion tier's parent campaign." + } } } } - } - } - }, - "required": [ - "type", - "calculation_type", - "order_items" - ] - }, - "EarningRuleProportionalOrderItemsSubtotalAmount": { - "title": "Order Items Subtotal Amount", - "x-stoplight": { - "id": "duxy5qw36h5ph" - }, - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "PROPORTIONAL" - ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." - }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_ITEMS_SUBTOTAL_AMOUNT" - ], - "description": "ORDER_ITEMS_SUBTOTAL_AMOUNT; Amount spent on items defined in the order_items.subtotal_amount.object & .id (X points for every Y spent on items including discounts)" - }, - "order_items": { - "type": "object", - "required": [ - "subtotal_amount" - ], - "properties": { - "subtotal_amount": { - "type": "object", - "required": [ - "every", - "points", - "object", - "id" - ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", - "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - }, - "object": { - "type": "string", - "description": "Type of object taken under consideration.", - "enum": [ - "products_collection", - "product", - "sku" - ] - }, - "id": { - "type": "string", - "description": "Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619." + }, + "10_obj_order_object_stacked_redemptions": { + "type": "object", + "title": "Stacked Redemption", + "description": "Redemption object representing a stacked redemption.", + "properties": { + "redemption_ID": { + "type": "object", + "description": "The property name is the unique parent redemption ID; i.e. `r_0ba186c4824e4881e1`. This object contains information about the redemption of multiple incentives.", + "properties": { + "date": { + "type": "string", + "description": "Timestamp representing the date and time when the redemption was created in ISO 8601 format.", + "example": "2022-09-02T17:06:56.649Z", + "format": "date-time" + }, + "related_object_type": { + "type": "string", + "description": "The source of the incentive.", + "default": "redemption" + }, + "related_object_id": { + "type": "string", + "description": "Unique ID of the parent redemption.", + "example": "r_0ba186c4824e4881e1" + }, + "stacked": { + "type": "array", + "description": "Contains a list of unique IDs of child redemptions, which belong to the stacked incentives.", + "items": { + "type": "string" + } + } } } } - } - } - }, - "required": [ - "type", - "calculation_type", - "order_items" - ] - }, - "EarningRuleProportionalCustomerMetadata": { - "title": "Customer Metadata", - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "PROPORTIONAL" - ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." - }, - "calculation_type": { - "type": "string", - "enum": [ - "CUSTOMER_METADATA" - ], - "description": "CUSTOMER_METADATA: Customer Metadata (X points for every Y in metadata attribute, defined in the property key under the customer.metadata object)" - }, - "customer": { - "type": "object", - "required": [ - "metadata" - ], - "properties": { - "metadata": { - "type": "object", - "required": [ - "every", - "points", - "property" - ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points.", - "properties": { - "every": { - "type": "integer", - "description": "For how many increments of the customer metadata property to grant points for." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - }, - "property": { - "type": "string", - "description": "Customer metadata property." + }, + "10_res_list_orders": { + "type": "object", + "title": "List Orders Response Body", + "description": "Response body schema representing **GET** `/orders`.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about orders in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "orders", + "description": "Identifies the name of the attribute that contains the array of order objects." + }, + "orders": { + "type": "array", + "description": "Contains array of order objects.", + "items": { + "$ref": "#/components/schemas/10_obj_order_object" } + }, + "total": { + "type": "integer", + "description": "Total number of orders." } } - } - } - }, - "required": [ - "type", - "calculation_type", - "customer" - ] - }, - "EarningRuleProportionalCustomEvent": { - "title": "Custom Event", - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "PROPORTIONAL" - ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." - }, - "calculation_type": { - "type": "string", - "enum": [ - "CUSTOM_EVENT_METADATA" - ], - "description": "CUSTOM_EVENT_METADATA: Custom event metadata (X points for every Y in metadata attribute)." - }, - "custom_event": { - "type": "object", - "required": [ - "metadata" - ], - "properties": { - "metadata": { - "type": "object", - "required": [ - "every", - "points", - "property" - ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points.", - "properties": { - "every": { - "type": "integer", - "description": "For how many increments of the customer metadata property to grant points for." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - }, - "property": { - "type": "string", - "description": "\nCustom event metadata property." - } + }, + "10_req_create_order": { + "type": "object", + "title": "Order", + "description": "Request body schema for creating an order.", + "properties": { + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of an integration between multiple systems. It can be an order ID from a CRM system, database or 3rd-party service." + }, + "status": { + "type": "string", + "description": "The order status.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULLFILLED" + ] + }, + "amount": { + "type": "integer", + "description": "A positive integer in the smallest currency unit (that is, 100 cents for $1.00) representing the total amount of the order; this is the sum of the order items' amounts." + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format." + }, + "customer": { + "$ref": "#/components/schemas/10_req_orders_customer_object" + }, + "referrer": { + "$ref": "#/components/schemas/10_req_orders_referrer_object" + }, + "items": { + "$ref": "#/components/schemas/10_req_orders_items_array" } } - } - } - }, - "required": [ - "type", - "calculation_type", - "custom_event" - ] - }, - "EarningRuleProportional": { - "anyOf": [ - { - "$ref": "#/components/schemas/EarningRuleProportionalOrder" - }, - { - "$ref": "#/components/schemas/EarningRuleProportionalOrderItems" - }, - { - "$ref": "#/components/schemas/EarningRuleProportionalCustomerMetadata" - }, - { - "$ref": "#/components/schemas/EarningRuleProportionalCustomEvent" - } - ], - "title": "Calculate points proportionally" - }, - "EarningRuleProportionalOrderItems": { - "anyOf": [ - { - "$ref": "#/components/schemas/EarningRuleProportionalOrderItemsQuantity" - }, - { - "$ref": "#/components/schemas/EarningRuleProportionalOrderItemsAmount" - }, - { - "$ref": "#/components/schemas/EarningRuleProportionalOrderItemsSubtotalAmount" - } - ], - "title": "Order Items" - }, - "LoyaltiesListMemberRewardsRequestQuery": { - "title": "Loyalties List Member Rewards Request Query", - "type": "object", - "properties": { - "affordable_only": { - "type": "string" - }, - "limit": { - "type": "integer" - }, - "page": { - "type": "integer" - } - } - }, - "LoyaltiesGetPointsExpirationRequestQuery": { - "title": "Loyalties Get Points Expiration Request Query", - "type": "object", - "properties": { - "limit": { - "type": "integer", - "minimum": 1, - "multipleOf": 100 - }, - "page": { - "type": "integer" - } - } - }, - "LoyaltiesListCardTransactionsRequestQuery": { - "title": "Loyalties List Card Transactions Request Query", - "type": "object", - "properties": { - "limit": { - "type": "integer", - "minimum": 1, - "multipleOf": 100 - }, - "page": { - "type": "integer" - } - } - }, - "LoyaltiesListCardTransactionsResponseBody": { - "title": "Loyalties List Card Transactions Response Body", - "type": "object", - "properties": { - "object": { - "type": "string", - "pattern": "list", - "enum": [ - "list" - ], - "description": "The type of object represented by JSON." - }, - "data_ref": { - "type": "string", - "pattern": "data", - "enum": [ - "data" - ], - "description": "Identifies the name of the attribute that contains the array of transaction objects." - }, - "data": { - "type": "array", - "description": "A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object.", - "items": { - "$ref": "#/components/schemas/LoyaltyCardTransaction" - } - }, - "has_more": { - "type": "boolean", - "description": "As query results are always limited (by the limit parameter), the has_more flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results." - } - }, - "required": [ - "object", - "data_ref", - "data", - "has_more" - ] - }, - "LoyaltyCardTransactionsType": { - "type": "string", - "enum": [ - "POINTS_ACCRUAL", - "POINTS_CANCELLATION", - "POINTS_REDEMPTION", - "POINTS_REFUND", - "POINTS_ADDITION", - "POINTS_REMOVAL", - "POINTS_EXPIRATION", - "POINTS_TRANSFER_IN", - "POINTS_TRANSFER_OUT" - ] - }, - "SimpleLoyaltyVoucher": { - "title": "Simple Loyalty Voucher", - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "code": { - "type": "string" - }, - "loyalty_card": { - "type": "object", - "required": [ - "points", - "balance" - ], - "properties": { - "points": { - "type": "string" - }, - "balance": { - "type": "string" - }, - "next_expiration_date": { - "type": "string" - }, - "next_expiration_points": { - "type": "string" + }, + "10_req_update_order": { + "type": "object", + "title": "Update Order Request Body", + "description": "Request body schema for **PUT** `/orders/{orderId}`.", + "properties": { + "status": { + "type": "string", + "description": "The order status.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULLFILLED" + ] + }, + "amount": { + "type": "integer", + "description": "A positive integer in the smallest currency unit (that is, 100 cents for $1.00) representing the total amount of the order; this is the sum of the order items' amounts." + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format." + }, + "customer": { + "$ref": "#/components/schemas/10_req_orders_customer_object" + }, + "referrer": { + "$ref": "#/components/schemas/10_req_orders_referrer_object" + }, + "items": { + "$ref": "#/components/schemas/10_req_orders_items_array" + }, + "customer_id": { + "type": "string", + "example": "cust_T849EgzNVVmn5icJ2FAkT2rO", + "description": "Unique customer ID of the customer making the purchase." + }, + "referrer_id": { + "type": "string", + "example": "cust_T849EgzNVVmn5icJ2FAkT2rO", + "description": "Unique referrer ID." + } } - } - }, - "type": { - "type": "string", - "enum": [ - "LOYALTY_CARD" - ] - }, - "campaign": { - "type": "string" - }, - "campaign_id": { - "type": "string" - }, - "is_referral_code": { - "type": "boolean" - }, - "holder_id": { - "type": "string" - }, - "referrer_id": { - "type": "string" - }, - "created_at": { - "type": "string" - }, - "object": { - "type": "string", - "pattern": "voucher", - "enum": [ - "voucher" - ] - } - }, - "required": [ - "id", - "code", - "loyalty_card", - "type", - "campaign", - "campaign_id", - "object" - ] - }, - "LoyaltyCardTransaction": { - "title": "Loyalty Card Transaction", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID." - }, - "source_id": { - "type": [ - "string", - "null" - ], - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is null." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID." - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes." - }, - "source": { - "type": [ - "string", - "null" - ], - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is null." - }, - "reason": { - "type": [ - "string", - "null" - ], - "description": "Reason why the transaction occurred. In case of a redemption, this value is null." - }, - "type": { - "$ref": "#/components/schemas/LoyaltyCardTransactionsType", - "description": "Type of transaction." - }, - "details": { - "type": "object", - "description": "Contains the detailed information about the transaction.", - "properties": { - "balance": { + }, + "10_req_create_order_export": { + "type": "object", + "title": "Create Order Export Request Body", + "description": "Request body schema for **POST** `/orders/export`.", + "properties": { + "parameters": { + "$ref": "#/components/schemas/16_obj_export_order", + "description": "Contains the parameters that define the data to be exported." + } + } + }, + "10_req_orders_import": { + "type": "array", + "title": "Import Orders Request Body", + "description": "Request body schema for POST `/orders/import`.", + "items": { "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", "properties": { - "type": { + "source_id": { "type": "string", - "pattern": "loyalty_card", - "enum": [ - "loyalty_card" - ], - "description": "The type of voucher whose balance is being adjusted due to the transaction." + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of an integration between multiple systems. It can be an order ID from a CRM system, database or 3rd-party service." }, - "total": { - "type": "integer", - "description": "The available points prior to the transaction." - }, - "object": { + "status": { "type": "string", - "pattern": "balance", - "enum": [ - "balance" - ], - "description": "The type of object represented by the JSON." - }, - "points": { - "type": "integer", - "description": "The amount of points being used up in the transaction." + "description": "The order status. One of `CREATED`, `PAID`, `CANCELED`, `FULFILLED`." }, - "balance": { + "amount": { "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." + "description": "A positive integer in the smallest currency unit (that is, 100 cents for $1.00) representing the total amount of the order; this is the sum of the order items' amounts." }, - "related_object": { + "metadata": { "type": "object", - "required": [ - "id", - "type" - ], - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API." - }, - "type": { - "type": "string", - "pattern": "voucher", - "enum": [ - "voucher" - ], - "description": "The object being modified, i.e. voucher." - } + "description": "A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format." + }, + "customer": { + "$ref": "#/components/schemas/10_req_orders_customer_object" + }, + "referrer": { + "$ref": "#/components/schemas/10_req_orders_referrer_object" + }, + "items": { + "$ref": "#/components/schemas/10_req_orders_items_array" + } + } + } + }, + "10_req_orders_customer_object": { + "type": "object", + "title": "Customer", + "description": "This is an object containing information about the customer.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of an existing customer that will be linked to the order; this is an ID that has been assigned to the customer by Voucherify, i.e. `cust_LMY4ZylSdUYB1J4tzqNcl5VV`." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a customer object." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "phone": { + "type": "string", + "description": "Customer's phone number." + }, + "address": { + "type": "object", + "description": "Customer's address.", + "properties": { + "city": { + "type": "string", + "description": "City" + }, + "state": { + "type": "string", + "description": "State" + }, + "line_1": { + "type": "string", + "description": "First line of address" + }, + "line_2": { + "type": "string", + "description": "Second line of address" + }, + "country": { + "type": "string", + "description": "Country" + }, + "postal_code": { + "type": "string", + "description": "Postal code" } } }, - "required": [ - "type", - "total", - "object", - "points", - "balance", - "related_object" - ] - }, - "order": { - "type": "object", - "description": "Contains information about the original order.", - "properties": { - "id": { - "type": "string", - "description": "Unique order ID." - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + "birthdate": { + "type": "string", + "description": "Customer's birthdate; format `YYYY-MM-DD`.", + "format": "date" + }, + "birthday": { + "type": "string", + "description": "Customer's birthdate; format `YYYY-MM-DD`.", + "format": "date" + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to a customer." + } + } + }, + "10_req_orders_referrer_object": { + "type": "object", + "title": "Referrer", + "description": "This is an ojbect containing information about the referrer.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of an existing customer that will be linked to the order as the referrer; this is an ID that has been assigned to the customer by Voucherify, i.e. `cust_LMY4ZylSdUYB1J4tzqNcl5VV`." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "name": { + "type": "string", + "description": "Referrer's first and last name." + }, + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a referrer object." + }, + "email": { + "type": "string", + "description": "Referrer's email address." + }, + "phone": { + "type": "string", + "description": "Referrer's phone number." + }, + "address": { + "type": "object", + "description": "Referrer's address.", + "properties": { + "city": { + "type": "string", + "description": "City" + }, + "state": { + "type": "string", + "description": "State" + }, + "line_1": { + "type": "string", + "description": "First line of address" + }, + "line_2": { + "type": "string", + "description": "Second line of address" + }, + "country": { + "type": "string", + "description": "Country" + }, + "postal_code": { + "type": "string", + "description": "Postal code" + } } }, - "required": [ - "id", - "source_id" - ] + "birthdate": { + "type": "string", + "description": "Referrer's birthdate; format `YYYY-MM-DD`.", + "format": "date" + }, + "birthday": { + "type": "string", + "description": "Referrer's birthdate; format `YYYY-MM-DD`.", + "format": "date" + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to a referrer." + } + } + }, + "10_req_orders_items_array": { + "type": "array", + "title": "Items Array", + "description": "Array of items applied to the order.", + "items": { + "$ref": "#/components/schemas/10_req_orders_order_item" + } + }, + "10_req_orders_order_item": { + "type": "object", + "title": "Order Item", + "description": "This object represents an order line item.", + "properties": { + "source_id": { + "type": "string", + "description": "The merchant’s product/SKU ID (if it is different from the Voucherify product/SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service." + }, + "related_object": { + "type": "string", + "description": "Used along with the `source_id` property, can be set to either `sku` or `product`." + }, + "product_id": { + "type": "string", + "description": "A unique product ID assigned by Voucherify.", + "example": "prod_0a7e62db1fca8322a2" + }, + "sku_id": { + "type": "string", + "description": "A unique SKU ID assigned by Voucherify.", + "example": "sku_0a41e31c7b41c28358" + }, + "quantity": { + "type": "integer", + "description": "The quantity of the particular item in the cart." + }, + "price": { + "type": "integer", + "description": "The unit price of the item." + }, + "amount": { + "type": "integer", + "description": "The total amount of the order item (`price` * `quantity`)." + }, + "product": { + "$ref": "#/components/schemas/10_req_orders_order_item_product" + }, + "sku": { + "$ref": "#/components/schemas/10_req_orders_order_item_sku" + } + } + }, + "10_req_orders_order_item_product": { + "type": "object", + "title": "Product", + "description": "An object containing details of the related product.", + "properties": { + "source_id": { + "type": "string", + "description": "The merchant’s product ID (if it is different than Voucherify's product ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service." + }, + "name": { + "type": "string", + "description": "Product name." + }, + "price": { + "type": "integer", + "description": "Product price. A positive integer in the smallest currency unit (that is, 100 cents for $1.00)." + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to a product. It can be useful for storing additional information about the product in a structured format." + }, + "override": { + "type": "boolean", + "description": "The override set to true is used to store the product information in the system. If product does not exist, it will be created with the use of `source_id`; if it does exist, the provided values for the `name`, `price`, and `metadata` will replace those already stored in the system." + } + } + }, + "10_req_orders_order_item_sku": { + "type": "object", + "title": "SKU", + "description": "An object containing details of the related SKU.", + "properties": { + "source_id": { + "type": "string", + "description": "The merchant’s SKU ID (if it is different than Voucherify's SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service." + }, + "sku": { + "type": "string", + "description": "The SKU name." + }, + "price": { + "type": "integer", + "description": "SKU price. A positive integer in the smallest currency unit (that is, 100 cents for $1.00)." + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to an SKU. It can be useful for storing additional information about the SKU in a structured format." + }, + "override": { + "type": "boolean", + "description": "The override is used to store the SKU in the system. If the SKU does not exist, it will be created with the use of `source_id`. Additionally, if the SKU does not exist, you are required to set the parent `product_id` that it belongs to. Set the parent `product_id` one level above, i.e. at the item level. If the parent product does not exist in Voucherify, i.e. does not have a unique `product_id`, then define the product object one level above, i.e. at the item level and make sure to also include the override as `true` for the product." + } + } + }, + "10_obj_order_item_object": { + "title": "Order Item Object", + "type": "object", + "properties": { + "object": { + "type": "string", + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." + }, + "product_id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "sku_id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + }, + "discount_amount": { + "type": "integer", + "description": "The item-level discount applied to the item." + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" + }, + "product": { + "type": "object", + "description": "This object stores more information about the related product.", + "properties": { + "id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" + }, + "name": { + "type": "string", + "example": "Brewing System", + "description": "Product name." + }, + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + }, + "sku": { + "type": "object", + "description": "This object stores more information about the related SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." + }, + "sku": { + "type": "string", + "description": "SKU name." + }, + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + } }, - "event": { - "type": "object", - "description": "Contains information about the event that triggers the point accrual.", - "properties": { - "id": { - "type": "string", - "description": "Unique event ID." - }, - "type": { - "type": "string", - "description": "Type of event." + "description": "This is an object representing an order item. \n\nOrder Items are always specified within the [order object](ref:get-order). They can be related either to [products](list-products) or [SKUs](ref:list-skus-in-product). \n\nProduct/SKU details sent within an order item will be used on top of Product/SKU already stored in the system during the [Redeem Voucher](ref:redeem-voucher), [Validate Voucher](ref:validate-voucher), [Validate Promotions](ref:validate-promotions) and [Redeem Promotion](ref:redeem-promotion) requests.", + "x-tags": [ + "ORDERS API" + ] + }, + "11_obj_product_object": { + "type": "object", + "description": "This is an object representing a product. \n\nThis entity should be used to map product items from your inventory management system. The aim of products is to build validation rules which reflect product-specific campaigns.", + "title": "Product Object", + "x-tags": [ + "PRODUCTS API" + ], + "properties": { + "id": { + "type": "string", + "description": "Unique product ID assigned by Voucherify.", + "example": "prod_0b1da8105693710357" + }, + "source_id": { + "type": "string", + "example": "productSourceID16", + "description": "Unique product source ID from your inventory system." + }, + "name": { + "type": "string", + "description": "Unique user-defined product name.", + "example": "T-shirt" + }, + "price": { + "type": "integer", + "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "attributes": { + "type": "array", + "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", + "items": { + "type": "string" } }, - "required": [ - "id", - "type" - ] + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." + }, + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", + "example": "https://images.com/original.jpg" + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the product was created in ISO 8601 format.", + "example": "2022-05-23T06:52:55.008Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the product was updated in ISO 8601 format.", + "example": "2022-05-23T09:24:07.405Z", + "format": "date-time" + }, + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about the `product`.", + "default": "product" + }, + "skus": { + "$ref": "#/components/schemas/11_res_get_product_skus_object" + } + } + }, + "11_req_create_product": { + "type": "object", + "description": "Request schema for **POST** `/products`.", + "title": "Create Product Request Body", + "properties": { + "source_id": { + "type": "string", + "example": "productSourceID16", + "description": "Unique product source ID." + }, + "name": { + "type": "string", + "description": "Unique user-defined product name.", + "example": "T-shirt" + }, + "price": { + "type": "integer", + "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "attributes": { + "type": "array", + "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", + "items": { + "type": "string" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." + }, + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", + "example": "https://images.com/original.jpg" + } + } + }, + "11_req_update_products_metadata_in_bulk": { + "type": "object", + "description": "Request schema for **POST** `/products/metadata/async`.", + "title": "Update Products' Metadata in Bulk Request Body", + "properties": { + "source_ids": { + "type": "array", + "description": "Array of unique product source IDs.", + "items": { + "type": "string" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." + } }, - "earning_rule": { - "type": "object", - "description": "Contains information about the earning rule.", - "properties": { - "id": { - "type": "string", - "description": "Unique earning rule ID." - }, - "source": { - "type": "object", - "required": [ - "banner" - ], - "description": "Contains the custom earning rule name.", - "properties": { - "banner": { - "type": "string", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + "required": [ + "source_ids", + "metadata" + ] + }, + "11_req_update_product": { + "type": "object", + "description": "Request schema for **PUT** `/products/{productId}`.", + "title": "Update Product Request Body", + "properties": { + "name": { + "type": "string", + "description": "Unique user-defined product name.", + "example": "T-shirt" + }, + "price": { + "type": "integer", + "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "attributes": { + "type": "array", + "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", + "items": { + "type": "string" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." + }, + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", + "example": "https://images.com/original.jpg" + } + } + }, + "11_req_update_product_bulk": { + "type": "object", + "description": "Request schema for **POST** `/products/bulk/async`.", + "title": "Update Product Request Body", + "properties": { + "source_id": { + "type": "string", + "description": "Unique product source ID from your inventory system.", + "example": "test_prod_id_1" + }, + "name": { + "type": "string", + "description": "Unique user-defined product name.", + "example": "T-shirt" + }, + "price": { + "type": "integer", + "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "attributes": { + "type": "array", + "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", + "items": { + "type": "string" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." + }, + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", + "example": "https://images.com/original.jpg" + } + } + }, + "11_res_list_products": { + "type": "object", + "description": "Response body schema representing **GET** `/products`.", + "title": "Product Object", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about products in a dictionary.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of product objects.", + "default": "products" + }, + "products": { + "type": "array", + "description": "Contains array of product objects.", + "items": { + "$ref": "#/components/schemas/11_obj_list_products_product_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of product objects." + } + } + }, + "11_obj_list_products_product_object": { + "type": "object", + "description": "This is an object representing a product. \n\nThis entity should be used to map product items from your inventory management system. The aim of products is to build which reflect product-specific campaigns.", + "title": "Product Object", + "properties": { + "id": { + "type": "string", + "description": "Unique product ID assigned by Voucherify.", + "example": "prod_0b1da8105693710357" + }, + "source_id": { + "type": "string", + "example": "productSourceID16", + "description": "Unique product source ID." + }, + "name": { + "type": "string", + "description": "Unique user-defined product name.", + "example": "T-shirt" + }, + "price": { + "type": "integer", + "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "attributes": { + "type": "array", + "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", + "items": { + "type": "string" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." + }, + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", + "example": "https://images.com/original.jpg" + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the product was created in ISO 8601 format.", + "example": "2022-05-23T06:52:55.008Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the product was updated in ISO 8601 format.", + "example": "2022-05-23T09:24:07.405Z", + "format": "date-time" + }, + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about the product.", + "default": "product" + }, + "skus": { + "type": "object", + "description": "Contains a list of related child SKUs.", + "properties": { + "data": { + "type": "array", + "description": "Contains a list of SKU objects.", + "items": { + "$ref": "#/components/schemas/11_obj_sku_object" } + }, + "total": { + "type": "number", + "description": "Total number of SKUs." } } + } + } + }, + "11_res_get_product_skus_object": { + "type": "object", + "description": "Contains information about child SKUs.", + "title": "SKUs object", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about SKUs.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the JSON property that contains the array of SKUs.", + "default": "data" + }, + "data": { + "type": "array", + "description": "A dictionary that contains an array of SKUs.", + "items": { + "$ref": "#/components/schemas/11_obj_sku_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of SKUs in the product." + } + } + }, + "product_collections_product_in_collection": { + "type": "object", + "description": "This is an object representing a product in product collection.", + "title": "Product in Collection", + "properties": { + "id": { + "type": "string", + "description": "Unique product ID.", + "example": "prod_f1r5Tpr0DuC7" + }, + "source_id": { + "type": [ + "string", + "null" + ], + "example": "productSourceID16", + "description": "Unique product source ID." }, - "required": [ - "id", - "source" - ] - }, - "segment": { - "type": "object", - "description": "Contains information about the segment.", - "properties": { - "id": { - "type": "string" - }, - "name": { + "name": { + "type": [ + "string", + "null" + ], + "description": "Unique user-defined product name.", + "example": "T-shirt" + }, + "price": { + "type": [ + "integer", + "null" + ], + "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "attributes": { + "type": "array", + "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", + "items": { "type": "string" } }, - "required": [ - "id", - "name" - ] + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." + }, + "image_url": { + "type": [ + "string", + "null" + ], + "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", + "example": "https://images.com/original.jpg" + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the product was created in ISO 8601 format.", + "example": "2022-05-23T06:52:55.008Z", + "format": "date-time" + }, + "updated_at": { + "type": [ + "string", + "null" + ], + "description": "Timestamp representing the date and time when the product was updated in ISO 8601 format.", + "example": "2022-05-23T09:24:07.405Z" + }, + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about the `product`.", + "default": "product" + } }, - "loyalty_tier": { - "type": "object", - "description": "Contains information about the loyalty tier.", - "properties": { - "id": { - "type": "string" - }, - "name": { + "required": [ + "id", + "source_id", + "name", + "price", + "attributes", + "metadata", + "image_url", + "created_at", + "updated_at", + "object" + ] + }, + "11_obj_product_object_truncated": { + "type": "object", + "description": "This is an object representing a product.", + "title": "Product Object", + "properties": { + "id": { + "type": "string", + "description": "Unique product ID.", + "example": "prod_f1r5Tpr0DuC7" + }, + "source_id": { + "type": "string", + "example": "productSourceID16", + "description": "Unique product source ID." + }, + "name": { + "type": "string", + "description": "Unique user-defined product name.", + "example": "T-shirt" + }, + "price": { + "type": "integer", + "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "attributes": { + "type": "array", + "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", + "items": { "type": "string" } }, - "required": [ - "id", - "name" - ] - }, - "redemption": { - "type": "object", - "description": "Contains information about the original redemption.", - "properties": { - "id": { - "type": "string", - "description": "Unique redemption ID." - } + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." }, - "required": [ - "id" - ] - }, - "rollback": { - "type": "object", - "description": "Contains information about the redemption rollback.", - "properties": { - "id": { - "type": "string", - "description": "Unique redemption rollback ID." - } + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", + "example": "https://images.com/original.jpg" }, - "required": [ - "id" - ] - }, - "custom_event": { - "type": "object", - "description": "Contains information about the custom event that triggers the point accrual.", - "properties": { - "id": { - "type": "string", - "description": "Unique event ID." - }, - "type": { - "type": "string", - "description": "Type of custom event." - } + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the product was created in ISO 8601 format.", + "example": "2022-05-23T06:52:55.008Z", + "format": "date-time" }, - "required": [ - "id", - "type" - ] - }, - "event_schema": { - "type": "object", - "description": "Contains information about the custom event metadata schema.", - "properties": { - "id": { - "type": "string", - "description": "Unique metadata schema ID." - }, - "name": { - "type": "string", - "description": "Type of custom event." - } + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the product was updated in ISO 8601 format.", + "example": "2022-05-23T09:24:07.405Z", + "format": "date-time" }, - "required": [ - "id", - "name" - ] - }, - "reward": { - "type": "object", - "description": "Contains information about the pay with points reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique reward ID." + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about the `product`.", + "default": "product" + } + } + }, + "11_obj_sku_object": { + "title": "SKU Object", + "type": "object", + "description": "This is an object representing a product SKU. \n\nThe SKU (acronym from Stock Keeping Unit) is tightly related to the [product object](ref:get-product). It reflects its different variants. One product can have many SKUs which are characterized and differentiated by varying values of the parent product `attributes`.", + "x-tags": [ + "PRODUCTS API" + ], + "examples": [ + { + "id": "sku_0b1621b2f25248b79c", + "source_id": "sku_source_id_1", + "product_id": "prod_0b15f6b9f650c16990", + "sku": "Extra Small Blue Shirt", + "price": 1300, + "currency": "USD", + "attributes": { + "size": "XS", + "color": "blue", + "ranking": 1 }, - "name": { - "type": "string", - "description": "Reward name." - } + "image_url": "", + "metadata": {}, + "created_at": "2022-05-17T10:36:30.057Z", + "updated_at": "2022-07-01T05:34:16.822Z", + "object": "sku" + } + ], + "properties": { + "id": { + "type": "string", + "example": "sku_0b1621b319d248b79f", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." }, - "required": [ - "id", - "name" - ] - }, - "source_voucher": { - "$ref": "#/components/schemas/SimpleLoyaltyVoucher", - "description": "Contains information on how the balance on the donor loyalty card was affected by the transaction." - }, - "destination_voucher": { - "$ref": "#/components/schemas/SimpleLoyaltyVoucher", - "description": "Contains information on how the balance on the receiving loyalty card was affected by the transaction." + "source_id": { + "type": "string", + "example": "sku_source_id_4", + "description": "A unique SKU identifier from your inventory system." + }, + "product_id": { + "type": "string", + "example": "prod_0b15f6b9f650c16990", + "description": "The parent product's unique ID." + }, + "sku": { + "type": "string", + "example": "Large Pink Shirt", + "description": "Unique user-defined SKU name." + }, + "price": { + "type": "integer", + "description": "SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "currency": { + "type": "string", + "description": "SKU price currency.", + "example": "USD" + }, + "attributes": { + "type": "object", + "description": "The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family." + }, + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format." + }, + "created_at": { + "type": "string", + "example": "2022-05-17T10:36:30.187Z", + "description": "Timestamp representing the date and time when the SKU was created in ISO 8601 format.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2022-05-17T10:55:09.137Z", + "description": "Timestamp representing the date and time when the SKU was updated in ISO 8601 format.", + "format": "date-time" + }, + "object": { + "type": "string", + "default": "sku", + "description": "The type of object represented by JSON. This object stores information about the `SKU`." + } } - } - }, - "related_transaction_id": { - "type": [ - "string", - "null" - ], - "description": "The related transaction ID on the receiving card." - }, - "created_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format.\n\n" - } - }, - "required": [ - "id", - "source_id", - "voucher_id", - "campaign_id", - "source", - "reason", - "type", - "details", - "related_transaction_id", - "created_at" - ] - }, - "LoyaltyCardTransactionsFields": { - "type": "string", - "enum": [ - "id", - "campaign_id", - "voucher_id", - "type", - "source_id", - "reason", - "source", - "balance", - "amount", - "related_transaction_id", - "created_at", - "details" - ] - }, - "LoyaltiesExportCardTransactionsRequestBody": { - "title": "Loyalties Export Card Transactions Request Body", - "type": "object", - "properties": { - "order": { - "type": "string", - "enum": [ - "created_at", - "-created_at" - ], - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/LoyaltyCardTransactionsFields" - } - } - } - }, - "LoyaltiesExportCardTransactionsResponseBody": { - "title": "Loyalties Export Card Transactions Response Body", - "type": "object", - "description": "", - "properties": { - "id": { - "type": "string", - "description": "Unique export ID." - }, - "object": { - "type": "string", - "pattern": "export", - "enum": [ - "export" - ], - "description": "The type of object being represented. This object stores information about the export." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format.", - "format": "date-time" - }, - "status": { - "type": "string", - "pattern": "SCHEDULED", - "enum": [ - "SCHEDULED" - ], - "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated." - }, - "channel": { - "type": "string", - "description": "The channel through which the export was triggered." - }, - "exported_object": { - "type": "string", - "pattern": "voucher_transactions", - "enum": [ - "voucher_transactions" - ], - "description": "The type of exported object." - }, - "parameters": { - "type": "object", - "required": [ - "filters" - ], - "description": "List of available fields and filters that can be exported with loyalty card transactions along with the sorting order of the returned data.", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.\n\n`id`, `campaign_id`, `voucher_id`, `type`, `source_id`, `reason`, `source`, `balance`, `amount`, `related_transaction_id`, `created_at`, `details`", - "items": { - "$ref": "#/components/schemas/LoyaltyCardTransactionsFields" + }, + "11_req_create_sku": { + "title": "SKU Object", + "type": "object", + "description": "Request body schema for **POST** `/products/{productId}/skus", + "properties": { + "source_id": { + "type": "string", + "example": "sku_source_id_4", + "description": "A unique SKU identifier from your inventory system." + }, + "sku": { + "type": "string", + "example": "Large Pink Shirt", + "description": "Unique user-defined SKU name." + }, + "price": { + "type": "integer", + "description": "SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "currency": { + "type": "string", + "description": "SKU price currency.", + "example": "USD" + }, + "attributes": { + "type": "object", + "description": "The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family." + }, + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format." } - }, - "filters": { - "type": "object", - "required": [ - "voucher_id" - ], - "description": "Filter condition.", - "properties": { - "voucher_id": { - "type": "object", - "required": [ - "conditions" - ], - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "conditions": { - "type": "object", - "required": [ - "$in" - ], - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "$in": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { - "type": "string", - "minLength": 1, - "maxLength": 1 - } - } - } + } + }, + "product_collections_sku_in_collection": { + "title": "SKU in Collection", + "type": "object", + "description": "This is an object representing a SKU in product collection.", + "properties": { + "id": { + "type": "string", + "example": "sku_0b1621b319d248b79f", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": [ + "string", + "null" + ], + "example": "sku_source_id_4", + "description": "A unique SKU identifier from your inventory system." + }, + "product_id": { + "type": "string", + "example": "prod_0b15f6b9f650c16990", + "description": "The parent product's unique ID." + }, + "sku": { + "type": [ + "string", + "null" + ], + "example": "Large Pink Shirt", + "description": "Unique user-defined SKU name." + }, + "price": { + "type": [ + "integer", + "null" + ], + "description": "SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "attributes": { + "type": "object", + "description": "The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family." + }, + "image_url": { + "type": [ + "string", + "null" + ], + "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format." + }, + "created_at": { + "type": "string", + "example": "2022-05-17T10:36:30.187Z", + "description": "Timestamp representing the date and time when the SKU was created in ISO 8601 format.", + "format": "date-time" + }, + "updated_at": { + "type": [ + "string", + "null" + ], + "example": "2022-05-17T10:55:09.137Z", + "description": "Timestamp representing the date and time when the SKU was updated in ISO 8601 format.", + "format": "date-time" + }, + "object": { + "type": "string", + "default": "sku", + "description": "The type of object represented by JSON. This object stores information about the `SKU`." + }, + "product": { + "type": "object", + "description": "Stores information about the parent product.", + "required": [ + "id", + "source_id", + "name", + "price", + "attributes", + "metadata", + "object" + ], + "properties": { + "id": { + "type": "string", + "example": "prod_f15Tpr0DuC7", + "description": "Unique product ID." + }, + "source_id": { + "type": [ + "string", + "null" + ], + "example": "productSourceID11", + "description": "A unique product ID from your inventory system." + }, + "name": { + "type": [ + "string", + "null" + ], + "example": "Shirts", + "description": "Unique user-defined product name." + }, + "price": { + "type": [ + "integer", + "null" + ], + "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "attributes": { + "type": "array", + "description": "A list of product attributes whose values you can customize for given SKUs: `[\"'color\", \"size\", \"ranking\"]` . Each child SKL can have a unique value for a given attribute.", + "items": { + "type": "string" } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." + }, + "object": { + "type": "string", + "default": "product", + "description": "The type of object represented by the object. This object stores information about the parent `product`." } } } - } - } - }, - "result": { - "type": "null", - "description": "Contains the URL of the CSV file." - }, - "user_id": { - "type": [ - "string", - "null" - ], - "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE." - } - }, - "required": [ - "id", - "object", - "created_at", - "status", - "channel", - "exported_object", - "parameters", - "result", - "user_id" - ] - }, - "RewardAssignment": { - "title": "Reward Assignment", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique reward assignment ID, assigned by Voucherify." - }, - "reward_id": { - "type": "string", - "description": "Associated reward ID." - }, - "related_object_id": { - "type": "string", - "description": "Related object ID to which the reward was assigned." - }, - "related_object_type": { - "type": "string", - "description": "Related object type to which the reward was assigned." - }, - "parameters": { - "type": "object", - "description": "Defines the cost of the reward.", - "properties": { - "loyalty": { - "type": "object", - "description": "Defines the equivalent points value of the reward.", - "properties": { - "points": { - "type": "integer", - "description": "The number of points required to redeem the reward." - } - }, - "required": [ - "points" - ] - } - } - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the reward assignment was created in ISO 8601 format.", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format.", - "format": "date-time" - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the reward assignment." - } - }, - "required": [ - "id", - "reward_id", - "created_at", - "object" - ] - }, - "Reward": { - "allOf": [ - { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique reward ID, assigned by Voucherify." - }, - "name": { - "type": "string", - "description": "Reward name." - }, - "stock": { - "type": "integer", - "description": "Configurable for material rewards. The number of units of the product that you want to share as reward." - }, - "redeemed": { - "type": "integer", - "description": "Defines the number of already invoked (successful) reward redemptions." }, - "attributes": { - "type": "object", - "description": "These properties are configurable for material rewards.", - "properties": { - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file." - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a material reward." - } + "required": [ + "id", + "source_id", + "product_id", + "sku", + "price", + "attributes", + "image_url", + "metadata", + "created_at", + "updated_at", + "object", + "product" + ] + }, + "11_req_update_sku": { + "title": "Update SKU Request Body", + "type": "object", + "description": "Request body schema for **PUT** `/products/{productId}/skus/{skuId}`.", + "properties": { + "sku": { + "type": "string", + "example": "Large Pink Shirt", + "description": "Unique user-defined SKU name." + }, + "price": { + "type": "integer", + "description": "SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "currency": { + "type": "string", + "description": "SKU price currency." + }, + "attributes": { + "type": "object", + "description": "The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family." + }, + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format." } - }, - "created_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the reward was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the reward was updated in ISO 8601 format." - }, - "object": { - "type": "string", - "default": "reward", - "pattern": "reward", - "description": "The type of object represented by the JSON. This object stores information about the reward." } }, - "required": [ - "id", - "created_at", - "object" - ] - }, - { - "$ref": "#/components/schemas/RewardType" - } - ] - }, - "RewardType": { - "title": "Reward Type", - "anyOf": [ - { - "$ref": "#/components/schemas/RewardTypeCampaign" - }, - { - "$ref": "#/components/schemas/RewardTypeCoin" - }, - { - "$ref": "#/components/schemas/RewardTypeCoin" - } - ] - }, - "RewardTypeCoin": { - "title": "Reward Type Coin", - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "COIN" - ], - "description": "Reward type." - }, - "parameters": { - "type": "object", - "required": [ - "coin" - ], - "description": "Defines how the reward is generated.", - "properties": { - "coin": { - "type": "object", - "required": [ - "exchange_ratio" - ], - "description": "Defines the ratio by mapping the number of loyalty points in points_ratio to a predefined cash amount in exchange_ratio.", - "properties": { - "exchange_ratio": { - "type": "number", - "description": "The cash equivalent of the points defined in the points_ratio property." - }, - "points_ratio": { - "type": "integer", - "description": "The number of loyalty points that will map to the predefined cash amount defined by the exchange_ratio property." + "product_collections_list_products_response_body": { + "type": "object", + "description": "Response body schema for **GET** `/product-collections/{productCollectionID}/products`.", + "title": "List Products in Collection Response Body", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about products and SKUs.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the JSON property that contains the array of products and SKUs.", + "default": "data" + }, + "data": { + "type": "array", + "description": "A dictionary that contains an array of products and SKUs.", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/product_collections_product_in_collection" + }, + { + "$ref": "#/components/schemas/product_collections_sku_in_collection" + } + ] } + }, + "total": { + "type": "integer", + "description": "Total number of products & SKUs in the product collection." } - } - } - } - }, - "required": [ - "type", - "parameters" - ] - }, - "RewardTypeMaterial": { - "title": "Reward Type Material", - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "MATERIAL" - ], - "description": "Reward type." - }, - "parameters": { - "type": "object", - "required": [ - "product" - ], - "description": "Defines how the reward is generated.", - "properties": { - "product": { - "type": "object", - "required": [ - "id", - "sku" - ], - "description": "Contains information about the product given as a reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique product ID, assigned by Voucherify." - }, - "sku": { - "type": [ - "string", - "null" - ], - "description": "Unique SKU ID, assigned by Voucherify, of the SKU given as a reward." + }, + "required": [ + "object", + "data_ref", + "data", + "total" + ] + }, + "11_res_products_productId_skus": { + "type": "object", + "description": "Response body schema for **GET** `/products/{productID}/skus`.", + "title": "List SKUs in Product Response Body", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about SKUs.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the JSON property that contains the array of SKUs.", + "default": "skus" + }, + "skus": { + "type": "array", + "description": "A dictionary that contains an array of SKUs.", + "items": { + "$ref": "#/components/schemas/11_obj_sku_object" } + }, + "total": { + "type": "integer", + "description": "Total number of SKUs in the product." } } - } - } - }, - "required": [ - "type", - "parameters" - ] - }, - "RewardTypeCampaign": { - "title": "Reward Type Campaign", - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "CAMPAIGN" - ], - "description": "Reward type." - }, - "parameters": { - "type": "object", - "required": [ - "campaign" - ], - "description": "Defines how the reward is generated.", - "properties": { - "campaign": { - "type": "object", - "required": [ - "id", - "type" - ], - "description": "Objects stores information about the campaign related to the reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique campaign ID, assigned by Voucherify." - }, - "balance": { - "type": "integer", - "description": "The incremental amout to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "type": { - "type": "string", - "enum": [ - "DISCOUNT_COUPONS", - "PROMOTION", - "GIFT_VOUCHERS", - "REFERRAL_PROGRAM" - ], - "description": "Campaign type." + }, + "product_collections_static_collection": { + "type": "object", + "title": "Static Product Collection", + "description": "Schema model for a `STATIC` product collection.", + "properties": { + "type": { + "description": "Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products).", + "enum": [ + "STATIC" + ] + }, + "products": { + "description": "Defines a set of products for a `STATIC` product collection type.", + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "prod_0a41bcf807c5fcaaf6", + "description": "The product ID." + }, + "product_id": { + "type": "string", + "description": "Product ID for SKUs." + }, + "object": { + "enum": [ + "sku", + "product" + ], + "description": "Denotes the type of object represented by the ID." + } + }, + "required": [ + "id", + "object" + ] } } - } - } - } - }, - "required": [ - "type", - "parameters" - ] - }, - "LoyaltiesAddOrRemoveCardBalanceResponseBody": { - "title": "Loyalties Add Or Remove Card Balance Response Body", - "type": "object", - "description": "Response schema for adding or removing points from a loyalty card.", - "properties": { - "points": { - "type": "integer", - "description": "The incremental points removed or added to the current balance on the loyalty card." - }, - "total": { - "type": "integer", - "description": "The total of points accrued over the lifetime of the loyalty card." - }, - "balance": { - "type": "integer", - "minimum": 0, - "description": "The balance after adding/removing points." - }, - "type": { - "type": "string", - "enum": [ - "LOYALTY_CARD", - "GIFT_VOUCHER" - ], - "description": "The type of voucher being modified." - }, - "object": { - "type": "string", - "pattern": "balance", - "enum": [ - "balance" - ], - "description": "The type of object represented by JSON. Default is balance." - }, - "related_object": { - "type": "object", - "required": [ - "type", - "id" - ], - "description": "Defines the object that is being modified with the values that are returned in the balance object.", - "properties": { - "type": { - "type": "string", - "enum": [ - "voucher" - ], - "description": "The object being modified." - }, - "id": { - "type": "string", - "description": "Identifies the loyalty card that is being modified, this is the ID that was assigned by the Voucherify API." - } - } - }, - "operation_type": { - "type": "string", - "enum": [ - "MANUAL", - "AUTOMATIC" - ] - } - }, - "required": [ - "points", - "total", - "balance", - "type", - "object", - "related_object" - ] - }, - "LoyaltiesTransferPointsResponseBody": { - "title": "Loyalties Transfer Points Response Body", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Assigned by the Voucherify API, identifies the voucher." - }, - "code": { - "type": "string", - "description": "A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters." - }, - "campaign": { - "type": "string", - "description": "A unique campaign name, identifies the voucher's parent campaign." - }, - "campaign_id": { - "type": "string", - "description": "Assigned by the Voucherify API, identifies the voucher's parent campaign." - }, - "category": { - "type": [ - "string", - "null" - ], - "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint." - }, - "category_id": { - "type": [ - "string", - "null" - ], - "description": "Unique category ID assigned by Voucherify." - }, - "categories": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Category" - } - }, - "type": { - "type": "string", - "enum": [ - "LOYALTY_CARD" - ], - "description": "Defines the type of voucher." - }, - "loyalty_card": { - "type": "object", - "description": "Object representing loyalty card parameters. Child attributes are present only if type is LOYALTY_CARD.", - "required": [ - "points", - "balance" - ], - "properties": { - "points": { - "type": "integer", - "description": "Total points incurred over lifespan of loyalty card." - }, - "balance": { - "type": "integer", - "description": "Points available for reward redemption." - }, - "next_expiration_date": { - "type": "string", - "description": "The next closest date when the next set of points are due to expire." - }, - "next_expiration_points": { - "type": "integer", - "description": "The amount of points that are set to expire next." - } - } - }, - "start_date": { - "type": [ - "string", - "null" - ], - "description": "Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is inactive before this date.", - "format": "date-time" - }, - "expiration_date": { - "type": [ - "string", - "null" - ], - "description": "Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is inactive after this date.", - "format": "date-time" - }, - "validity_timeframe": { - "type": [ - "object", - "null" - ], - "description": "Set recurrent time periods when the voucher is valid. For example, valid for 1 hour every other day.start_date required when including the validity_timeframe.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a duration of PT1H will be valid for a duration of one hour." - }, - "duration": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an interval of P2D will be active every other day." - } - } - }, - "validity_day_of_week": { - "type": [ - "array", - "null" - ], - "description": "Integer array corresponding to the particular days of the week in which the voucher is valid.\n\n- `0` Sunday\n- `1` Monday\n- `2` Tuesday\n- `3` Wednesday\n- `4` Thursday\n- `5` Friday\n- `6` Saturday", - "items": { - "type": "integer", - "minimum": 0, - "maximum": 6 - } - }, - "publish": { - "type": "object", - "description": "This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or publish voucher API method.", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "description": "The type of object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute." - }, - "count": { - "type": "integer", - "description": "Publication events counter." }, - "entries": { - "type": "array", - "items": { - "type": "string" + "required": [ + "type", + "products" + ] + }, + "product_collections_dynamic_collection": { + "type": "object", + "title": "Dynamic Product Collection", + "description": "Schema model for an `AUTO_UPDATE` product collection.", + "properties": { + "type": { + "description": "Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products).", + "enum": [ + "AUTO_UPDATE" + ] + }, + "filter": { + "type": "object", + "description": "Defines a set of criteria and boundary conditions for an `AUTO_UPDATE` product collection type.", + "additionalProperties": false, + "required": [ + "junction" + ], + "properties": { + "junction": { + "$ref": "#/components/schemas/Junction" + }, + "id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "product_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "source_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "name": { + "$ref": "#/components/schemas/FieldConditions" + }, + "price": { + "$ref": "#/components/schemas/FieldConditions" + }, + "object": { + "$ref": "#/components/schemas/FieldConditions" + }, + "attributes": { + "$ref": "#/components/schemas/FieldConditions" + }, + "metadata": { + "$ref": "#/components/schemas/FieldConditions" + }, + "image_url": { + "$ref": "#/components/schemas/FieldConditions" + }, + "skus": { + "$ref": "#/components/schemas/FieldConditions" + }, + "created_at": { + "$ref": "#/components/schemas/FieldConditions" + }, + "updated_at": { + "$ref": "#/components/schemas/FieldConditions" + } + } } }, - "url": { - "type": "string", - "description": "The endpoint where this list of publications can be accessed using a GET method. /v1/vouchers/{voucher_code}/publications" - } + "required": [ + "type", + "filter" + ] }, - "required": [ - "object" - ] - }, - "redemption": { - "type": "object", - "description": "Stores a summary of redemptions that have been applied to the voucher.", - "properties": { - "quantity": { - "type": [ - "integer", - "null" - ], - "description": "How many times a voucher can be redeemed. A null value means unlimited." - }, - "redeemed_points": { - "type": "integer", - "description": "Total loyalty points redeemed." - }, - "redeemed_quantity": { - "type": "integer", - "description": "How many times a voucher has already been redeemed." + "product_collections_list_response_body": { + "type": "object", + "title": "List Product Collections Response Body", + "description": "Response body schema for **GET** `/product-collections`.", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about product collections.", + "default": "list" + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the JSON property that contains the array of product collections." + }, + "data": { + "description": "A dictionary that contains an array of product collections and their details.", + "type": "array", + "items": { + "$ref": "#/components/schemas/product_collections_collection_item" + } + }, + "total": { + "type": "integer", + "description": "Total number of product collections." + } }, - "redemption_entries": { - "type": "array", - "items": { - "type": "string" + "required": [ + "object", + "data_ref", + "data", + "total" + ] + }, + "13_obj_validation_rule_object": { + "title": "Validation Rule Object", + "type": "object", + "description": "This is an object representing a validation rule. \n\nThis entity stores the rules used to limit resources in Voucherify. The validation rule can be assigned to resources such as a: \n- [voucher](ref:get-voucher)\n- [campaign](ref:get-campaign)\n- [earning rule](ref:get-earning-rule)\n- [reward assignment](ref:get-reward-assignment)\n- [promotion tier](ref:list-promotion-tiers)\n- [publication](ref:list-publications)\n\nYou can configure the Validation Rule to include your own custom error messages which are going to be returned from the API upon a validation / redemption failure. You can read more [here](ref:errors#custom-error-messages-with-validation-rules).", + "x-tags": [ + "VALIDATION RULES API" + ], + "properties": { + "id": { + "type": "string", + "example": "val_eR1c41hu0vUU", + "description": "Unique validation rule ID." + }, + "name": { + "type": "string", + "description": "Custom, unique name for set of validation rules.", + "example": "Business Validation Rule" + }, + "rules": { + "type": "object", + "description": "Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", + "properties": { + "1": { + "type": "object", + "description": "Defines the rule.", + "properties": { + "name": { + "type": "string", + "description": "Voucherify specific rule name. The list of available names is provided below. \n\n**Name** |\n---- | -----------\n**Customer** | customer.segment
customer.metadata* \n**Order** |order.amount
order.items.count
order.items.price_any
order.items.price_each
order.items.metadata_any
order.items.metadata_each
order.metadata* |\n| **Campaign** | campaign.orders.amount_discounted
campaign.orders.amount
campaign.redemptions.count
campaign.redemptions.count.daily
campaign.redemptions.count.monthly
campaign.redemptions.customers_count
campaign.redemptions.customers_count.daily
campaign.redemptions.customers_count.monthly |\n| **Redemption** |redemption.gift.amount
redemption.count.daily
redemption.count.monthly
redemption.count.per_customer
redemption.count.per_customer.daily
redemption.count.per_customer.monthly
redemption.api_key
redemption.count.per_api_key
redemption.user.login
redemption.count.per_user
redemption.metadata*
redemption.reward.pay_with_points.points_used |\n| **Product** | product.id
product.price
product.quantity
product.discount_applicable
product.metadata*
product.metadata.aggregated_quantity
product.metadata.aggregated_amount
product.metadata.discount_applicable
product.metadata.match_all |\n| **SKU** | sku.id
sku.price
sku.quantity
sku.discount_applicable |\n| **Publication** | publication.redeemable_by_linked_customer |\n| **Custom Event** | custom_event.metadata* |\n| **Order items** | order.items.every
order.items.any
order.items.none
order.items.cheapest
order.items.most_expensive | order.items.quantity
order.items.aggregated_quantity
order.items.price
order.items.aggregated_amount
order.items.metadata* | \n\n\n\n*Requires the `property` field to be defined." + }, + "property": { + "type": [ + "string", + "null" + ], + "description": "Custom name for a metadata property associated with the condition to be satisfied. **Required** if the property `name` is any of the following: \n customer_metadata
custom_event_metadata
order_items_metadata
order_metadata
product_metadata
redemption_metadata" + }, + "conditions": { + "type": "object", + "description": "A set of key value pairs representing the condition name and value. The list of available conditions is provided below: \n**Condition (key)** | **Definition** | **Does not support Types** \n--- | --- | ---\n $is | A property is a predefined value. | \n $is_not | A property is not a predefined value. | \n $in | A property either one value in a predefined list of values. | \n $less_than | A property is less than a predefined value. | boolean \n $less_than_or_equal | A property is less than or equal to a predefined value. | boolean \n $more_than | A property is more than a predefined value. | boolean \n $more_than_or_equal | A property is more than or equal to a predefined value. | boolean \n $starts_with | A property starts with the predefined sequence of characters. | boolean, number \n $ends_with | A property ends with the predefined sequence of characters. | boolean, number \n $contains | A property contains the predefined sequence of characters. | boolean, number \n $timeframe | | boolean, number \n $dow | | boolean, string \n $count | | boolean, string \n $count_more | | boolean, string \n $count_less | | boolean, string ", + "properties": { + "$one_of_voucherify_conditions": { + "type": "array", + "description": "Contains a set of conditions for the rule.", + "items": { + "type": [ + "string", + "integer", + "boolean" + ] + } + } + } + }, + "rules": { + "type": "object", + "description": "Contains all the nested rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", + "properties": { + "1": { + "type": "object", + "description": "Defines the nested rule.", + "properties": { + "name": { + "type": "string" + }, + "property": { + "type": "string" + }, + "conditions": { + "type": "object" + }, + "rules": { + "type": "object" + } + } + }, + "logic": { + "type": "string" + } + } + }, + "error": { + "type": "object", + "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rule.", + "properties": { + "message": { + "type": "string", + "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rule." + } + } + } + } + }, + "logic": { + "type": "string", + "example": "(1 and 2) and (3)", + "description": "Defines the logic between the rules." + } + } + }, + "error": { + "type": "object", + "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules.", + "properties": { + "message": { + "type": "string", + "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rules." + } + } + }, + "applicable_to": { + "type": "object", + "properties": { + "excluded": { + "type": "array", + "description": "Defines which items are excluded from a discount.", + "items": { + "type": "object", + "description": "Defines the excluded item.", + "properties": { + "object": { + "type": "string", + "enum": [ + "product", + "sku", + "products_collection" + ], + "description": "The type of object being excluded from the rule." + }, + "id": { + "type": "string", + "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." + }, + "source_id": { + "type": "string" + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY" + ], + "description": "Discount effect for an excluded resource." + } + } + } + }, + "included": { + "type": "array", + "description": "Defines which items are included in a discount.", + "items": { + "type": "object", + "description": "Defines the included item.", + "properties": { + "object": { + "type": "string", + "enum": [ + "product", + "sku", + "products_collection" + ], + "description": "The type of object being included in the rule." + }, + "id": { + "type": "string", + "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." + }, + "source_id": { + "type": "string" + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Discount effect for an included resource." + }, + "quantity_limit": { + "type": "integer", + "description": "A limit on the number of units that at maximum can qualify for a discount. This property is present for an AMOUNT type discount when the effect is applied to ITEMS and each unit of matched products has the same discount value." + } + } + } + }, + "included_all": { + "type": "boolean", + "description": "Indicates whether all items are included in the discount." + } + } + }, + "created_at": { + "type": "string", + "example": "2022-03-23T07:44:00.444Z", + "description": "Timestamp representing the date and time when the validation rule was created in ISO 8601 format.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2022-04-26T08:35:54.960Z", + "description": "Timestamp representing the date and time when the validation rule was updated in ISO 8601 format.", + "format": "date-time" + }, + "type": { + "type": "string", + "enum": [ + "basic", + "advanced", + "complex" + ], + "description": "Type of validation rule." + }, + "context_type": { + "type": "string", + "enum": [ + "earning_rule.order.paid", + "earning_rule.custom_event", + "earning_rule.customer.segment.entered", + "campaign.discount_coupons", + "campaign.discount_coupons.discount.apply_to_order", + "campaign.discount_coupons.discount.apply_to_items", + "campaign.discount_coupons.discount.apply_to_items_proportionally", + "campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity", + "campaign.discount_coupons.discount.fixed.apply_to_items", + "campaign.gift_vouchers", + "campaign.gift_vouchers.gift.apply_to_order", + "campaign.gift_vouchers.gift.apply_to_items", + "campaign.referral_program", + "campaign.referral_program.discount.apply_to_order", + "campaign.referral_program.discount.apply_to_items", + "campaign.referral_program.discount.apply_to_items_proportionally", + "campaign.referral_program.discount.apply_to_items_proportionally_by_quantity", + "campaign.referral_program.discount.fixed.apply_to_items", + "campaign.promotion", + "campaign.promotion.discount.apply_to_order", + "campaign.promotion.discount.apply_to_items", + "campaign.promotion.discount.apply_to_items_proportionally", + "campaign.promotion.discount.apply_to_items_proportionally_by_quantity", + "campaign.promotion.discount.fixed.apply_to_items", + "campaign.loyalty_program", + "campaign.lucky_draw", + "voucher.discount_voucher", + "voucher.discount_voucher.discount.apply_to_order", + "voucher.discount_voucher.discount.apply_to_items", + "voucher.discount_voucher.discount.apply_to_items_proportionally", + "voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity", + "voucher.discount_voucher.discount.fixed.apply_to_items", + "voucher.gift_voucher", + "voucher.gift_voucher.gift.apply_to_order", + "voucher.gift_voucher.gift.apply_to_items", + "voucher.loyalty_card", + "voucher.lucky_draw_code", + "distribution.custom_event", + "reward_assignment.pay_with_points", + "global" + ], + "description": "Validation rule context type. \n\n| **Context Type** | **Definition** |\n|:---|:---|\n| earning_rule.order.paid | |\n| earning_rule.custom_event | |\n| earning_rule.customer.segment.entered | |\n| campaign.discount_coupons | |\n| campaign.discount_coupons.discount.apply_to_order | |\n| campaign.discount_coupons.discount.apply_to_items | |\n| campaign.discount_coupons.discount.apply_to_items_proportionally | |\n| campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.discount_coupons.discount.fixed.apply_to_items | |\n| campaign.gift_vouchers | |\n| campaign.gift_vouchers.gift.apply_to_order | |\n| campaign.gift_vouchers.gift.apply_to_items | |\n| campaign.referral_program | |\n| campaign.referral_program.discount.apply_to_order | |\n| campaign.referral_program.discount.apply_to_items | |\n| campaign.referral_program.discount.apply_to_items_proportionally | |\n| campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.referral_program.discount.fixed.apply_to_items | |\n| campaign.promotion | |\n| campaign.promotion.discount.apply_to_order | |\n| campaign.promotion.discount.apply_to_items | |\n| campaign.promotion.discount.apply_to_items_proportionally | |\n| campaign.promotion.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.promotion.discount.fixed.apply_to_items | |\n| campaign.loyalty_program | |\n| campaign.lucky_draw | |\n| voucher.discount_voucher | |\n| voucher.discount_voucher.discount.apply_to_order | |\n| voucher.discount_voucher.discount.apply_to_items | |\n| voucher.discount_voucher.discount.apply_to_items_proportionally | |\n| voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | |\n| voucher.discount_voucher.discount.fixed.apply_to_items | |\n| voucher.gift_voucher | |\n| voucher.gift_voucher.gift.apply_to_order | |\n| voucher.gift_voucher.gift.apply_to_items | |\n| voucher.loyalty_card | |\n| voucher.lucky_draw_code | |\n| distribution.custom_event | |\n| reward_assignment.pay_with_points | |\n| global | |" + }, + "object": { + "type": "string", + "default": "validation_rules", + "description": "The type of object represented by JSON. This object stores information about the validation rule." } - }, - "object": { - "type": "string", - "enum": [ - "list" - ], - "description": "The type of object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute." - }, - "url": { - "type": "string", - "description": "The endpoint where this list of redemptions can be accessed using a GET method. /v1/vouchers/{voucher_code}/redemptions" } }, - "required": [ - "quantity" - ] - }, - "active": { - "type": "string", - "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the start_date and expiration_date.\n\n- `true` indicates an active voucher\n- `false` indicates an inactive voucher" - }, - "additional_info": { - "type": [ - "string", - "null" - ], - "description": "An optional field to keep any extra textual information about the code such as a code description and details." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - }, - "assets": { - "type": "object", - "description": "Stores links to images of QR and barcode that correspond to an encrypted voucher code.", - "properties": { - "qr": { - "type": "object", - "description": "Stores Quick Response (QR) representation of encrypted code.", - "properties": { - "id": { - "type": "string", - "example": "U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK+t4pp7U7oFzjGJzj9q/bmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg+BaZk5QwXMf8k/OzSlOEVybpwSq+AiqPoNtjeuqtIgkDyvT6Q==", - "description": "Encrypted voucher code ID." - }, - "url": { - "type": "string", - "example": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK%2Bt4pp7U7oFzjGJzj9q%2FbmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg%2BBaZk5QwXMf8k%2FOzSlOEVybpwSq%2BAiqPoNtjeuqtIgkDyvT6Q%3D%3D", - "description": "URL to QR code \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" + "13_req_create_validation_rule": { + "title": "Create Validation Rule Request Body", + "type": "object", + "description": "Request body schema for **POST** `/validation-rules`.", + "properties": { + "name": { + "type": "string", + "description": "Custom, unique name for the set of validation rules.", + "example": "Business Validation Rule" + }, + "rules": { + "type": "object", + "description": "Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", + "properties": { + "1": { + "type": "object", + "description": "Defines the rule.", + "properties": { + "name": { + "type": "string", + "description": "Voucherify specific rule name. The list of available names is provided below. \n| **Name** |\n|:---|\n| **Customer** |\n| customer.segment
customer.metadata* |\n| **Order** |\n| order.amount
order.items.count
order.items.price_any
order.items.price_each
order.items.metadata_any
order.items.metadata_each
order.metadata* |\n| **Campaign** |\n| campaign.orders.amount_discounted
campaign.orders.amount
campaign.redemptions.count
campaign.redemptions.count.daily
campaign.redemptions.count.monthly
campaign.redemptions.customers_count
campaign.redemptions.customers_count.daily
campaign.redemptions.customers_count.monthly |\n| **Redemption** |\n| redemption.gift.amount
redemption.count.daily
redemption.count.monthly
redemption.count.per_customer
redemption.count.per_customer.daily
redemption.count.per_customer.monthly
redemption.api_key
redemption.count.per_api_key
redemption.user.login
redemption.count.per_user
redemption.metadata*
redemption.reward.pay_with_points.points_used |\n| **Product** |\n| product.id
product.price
product.quantity
product.discount_applicable
product.metadata*
product.metadata.aggregated_quantity
product.metadata.aggregated_amount
product.metadata.discount_applicable
product.metadata.match_all |\n| **SKU** |\n| sku.id
sku.price
sku.quantity
sku.discount_applicable |\n| **Publication** |\n| publication.redeemable_by_linked_customer |\n| **Custom Event** |\n| custom_event.metadata* |\n| **Order items** |\n| order.items.every
order.items.any
order.items.none
order.items.cheapest
order.items.most_expensive |\n| order.items.quantity
order.items.aggregated_quantity
order.items.price
order.items.aggregated_amount
order.items.metadata* | \n\n\n*Requires the `property` field to be defined." + }, + "property": { + "type": [ + "string", + "null" + ], + "description": "Custom name for a metadata property associated with the condition to be satisfied. **Required** if the property `name` is any of the following: \n| **Name** |\n|:---|\n| customer_metadata |\n| custom_event_metadata |\n| order_items_metadata |\n| order_metadata |\n| product_metadata |\n| redemption_metadata |" + }, + "conditions": { + "type": "object", + "description": "A set of key value pairs representing the condition name and value. The list of available conditions is provided below: \n| **Condition (key)** | **Definition** | **Does not support Types** |\n|:---|:---|:---|\n| $is | A property is a predefined value. | |\n| $is_not | A property is not a predefined value. | |\n| $in | A property either one value in a predefined list of values. | |\n| $less_than | A property is less than a predefined value. | boolean |\n| $less_than_or_equal | A property is less than or equal to a predefined value. | boolean |\n| $more_than | A property is more than a predefined value. | boolean |\n| $more_than_or_equal | A property is more than or equal to a predefined value. | boolean |\n| $starts_with | A property starts with the predefined sequence of characters. | boolean, number |\n| $ends_with | A property ends with the predefined sequence of characters. | boolean, number |\n| $contains | A property contains the predefined sequence of characters. | boolean, number |\n| $timeframe | | boolean, number |\n| $dow | | boolean, string |\n| $count | | boolean, string |\n| $count_more | | boolean, string |\n| $count_less | | boolean, string |", + "properties": { + "$one_of_voucherify_conditions": { + "type": "array", + "description": "Contains a set of conditions for the rule.", + "items": { + "type": [ + "string", + "integer", + "boolean" + ] + } + } + } + }, + "rules": { + "type": "object", + "description": "Contains all the nested rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", + "properties": { + "1": { + "type": "object", + "description": "Defines the nested rule.", + "properties": { + "name": { + "type": "string" + }, + "property": { + "type": "string" + }, + "conditions": { + "type": "object" + }, + "rules": { + "type": "object" + } + } + }, + "logic": { + "type": "string" + } + } + }, + "error": { + "type": "object", + "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rule.", + "properties": { + "message": { + "type": "string", + "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rule." + } + } + } + } + }, + "logic": { + "type": "string", + "example": "(1 and 2) and (3)", + "description": "Defines the logic between the rules." + } } - } - }, - "barcode": { - "type": "object", - "description": "Stores barcode representation of encrypted code.", - "properties": { - "id": { - "type": "string", - "example": "U2FsdGVkX19eJhGfWwUrH9+tulBkON+AnMktic+N6CVWzZ9+fHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ+kJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6/pFs61apEn9SJx32ttCF6d3oxKISQQ==", - "description": "Encrypted voucher code ID." - }, - "url": { - "type": "string", - "example": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19eJhGfWwUrH9%2BtulBkON%2BAnMktic%2BN6CVWzZ9%2BfHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ%2BkJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6%2FpFs61apEn9SJx32ttCF6d3oxKISQQ%3D%3D", - "description": "URL to barcode \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" + }, + "error": { + "type": "object", + "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules.", + "properties": { + "message": { + "type": "string", + "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rules." + } + } + }, + "applicable_to": { + "type": "object", + "properties": { + "excluded": { + "type": "array", + "description": "Defines which items are excluded from a discount.", + "items": { + "type": "object", + "description": "Defines the excluded item.", + "properties": { + "object": { + "type": "string", + "enum": [ + "product", + "sku", + "products_collection" + ], + "description": "The type of object being excluded from the rule." + }, + "id": { + "type": "string", + "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." + }, + "source_id": { + "type": "string" + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY" + ], + "description": "Discount effect for an excluded resource." + } + } + } + }, + "included": { + "type": "array", + "description": "Defines which items are included in a discount.", + "items": { + "type": "object", + "description": "Defines the included item.", + "properties": { + "object": { + "type": "string", + "enum": [ + "product", + "sku", + "products_collection" + ], + "description": "The type of object being included in the rule." + }, + "id": { + "type": "string", + "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." + }, + "source_id": { + "type": "string" + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Discount effect for an included resource." + }, + "quantity_limit": { + "type": "integer", + "description": "A limit on the number of units that at maximum can qualify for a discount. This property is present for an AMOUNT type discount when the effect is applied to ITEMS and each unit of matched products has the same discount value." + } + } + } + }, + "included_all": { + "type": "boolean", + "description": "Indicates whether all items are included in the discount." + } } } } - } - }, - "is_referral_code": { - "type": "boolean", - "description": "Flag indicating whether this voucher is a referral code." - }, - "holder_id": { - "type": "string", - "description": "Unique customer ID of voucher owner." - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.", - "format": "date-time" - }, - "created_at": { - "type": "string", - "format": "date-time" - } - }, - "required": [ - "id", - "code", - "category", - "category_id", - "type", - "loyalty_card", - "start_date", - "expiration_date", - "validity_timeframe", - "validity_day_of_week", - "active", - "additional_info", - "metadata", - "is_referral_code", - "created_at" - ] - }, - "LoyaltiesTransferPoints": { - "title": "Loyalties Transfer Points", - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "Unique loyalty card code from which the user wants to transfer loyalty points (source)." - }, - "points": { - "type": "integer", - "description": "The number of loyalty points that the user wants to transfer to another loyalty card. The number of points cannot be higher than the current balance on the loyalty card (source)." - }, - "reason": { - "type": "string", - "description": "Reason for the transfer." - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." - } - }, - "required": [ - "code", - "points", - "source_id" - ] - }, - "LoyaltiesTransferPointsRequestBody": { - "title": "Loyalties Transfer Points Request Body", - "type": "array", - "items": { - "$ref": "#/components/schemas/LoyaltiesTransferPoints" - } - }, - "LoyaltiesAddOrRemoveCardBalanceRequestBody": { - "title": "Loyalties Add Or Remove Card Balance Request Body", - "type": "object", - "properties": { - "points": { - "type": "integer", - "description": "Incremental balance to be added to/subtracted from the loyalty card.\n\n- To add points: 100\n- To subtract points, add a minus: -100" - }, - "expiration_type": { - "$ref": "#/components/schemas/PointsExpirationTypes", - "description": "Set the type of expiration for added points.\n\n`PROGRAM_RULES`: Inherit rules from campaign.\n`NON_EXPIRING`: Points never expire.\n`CUSTOM_DATE`: Points expire on a particular date. Requires expiration_date parameter." - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Set expiration date for added points, i.e. `YYYY-MM-DD`. This parameter is required only when expiration_type is set to `CUSTOM_DATE`." - }, - "reason": { - "type": "string", - "description": "Reason for the transfer." - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." - } - }, - "required": [ - "points" - ] - }, - "PointsExpirationTypes": { - "title": "Points Expiration Types", - "type": "string", - "enum": [ - "PROGRAM_RULES", - "CUSTOM_DATE", - "NON_EXPIRING" - ] - }, - "Category": { - "title": "Category", - "type": "object", - "description": "This is an object representing a category.", - "properties": { - "id": { - "type": "string", - "description": "Unique category ID assigned by Voucherify." - }, - "name": { - "type": "string", - "description": "Category name." - }, - "hierarchy": { - "type": "integer", - "description": "Category hierarchy." - }, - "created_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the category was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the category was updated in ISO 8601 format." - }, - "object": { - "type": "string", - "enum": [ - "category" - ], - "description": "The type of object represented by the JSON. This object stores information about the category." - } - }, - "required": [ - "id", - "name", - "hierarchy", - "created_at", - "object" - ] - }, - "ExportsCreateRequestBody": { - "anyOf": [ - { - "title": "Export Vouchers", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "voucher" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportVoucherOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportVoucherFields" + }, + "13_res_list_validation_rules": { + "description": "Response body schema for listing validation rules. \n\nThis entity stores the [validation rules](ref:get-validation-rule) used to limit your resources.", + "type": "object", + "title": "List Validation Rules Response Body", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about validation rules.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of validation rules.", + "default": "data" + }, + "data": { + "type": "array", + "uniqueItems": true, + "description": "An array of validation rules.", + "items": { + "type": "object", + "description": "Stores information about the validation rule.", + "properties": { + "id": { + "type": "string", + "description": "Unique validation rule ID.", + "example": "val_F4Artfc4HQIq" + }, + "name": { + "type": "string", + "description": "Custom, unique name for the set of validation rules." + }, + "rules": { + "type": "object", + "description": "A set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", + "properties": { + "1": { + "type": "object", + "description": "Defines the rule.", + "properties": { + "name": { + "type": "string", + "description": "Voucherify specific rule name. The list of available names is provided below. \n\n**Name** |\n---- | -----------\n**Customer** | customer.segment
customer.metadata* \n**Order** |order.amount
order.items.count
order.items.price_any
order.items.price_each
order.items.metadata_any
order.items.metadata_each
order.metadata* |\n| **Campaign** | campaign.orders.amount_discounted
campaign.orders.amount
campaign.redemptions.count
campaign.redemptions.count.daily
campaign.redemptions.count.monthly
campaign.redemptions.customers_count
campaign.redemptions.customers_count.daily
campaign.redemptions.customers_count.monthly |\n| **Redemption** |redemption.gift.amount
redemption.count.daily
redemption.count.monthly
redemption.count.per_customer
redemption.count.per_customer.daily
redemption.count.per_customer.monthly
redemption.api_key
redemption.count.per_api_key
redemption.user.login
redemption.count.per_user
redemption.metadata*
redemption.reward.pay_with_points.points_used |\n| **Product** | product.id
product.price
product.quantity
product.discount_applicable
product.metadata*
product.metadata.aggregated_quantity
product.metadata.aggregated_amount
product.metadata.discount_applicable
product.metadata.match_all |\n| **SKU** | sku.id
sku.price
sku.quantity
sku.discount_applicable |\n| **Publication** | publication.redeemable_by_linked_customer |\n| **Custom Event** | custom_event.metadata* |\n| **Order items** | order.items.every
order.items.any
order.items.none
order.items.cheapest
order.items.most_expensive | order.items.quantity
order.items.aggregated_quantity
order.items.price
order.items.aggregated_amount
order.items.metadata* | \n\n\n*Requires the `property` field to be defined." + }, + "rules": { + "type": "object", + "description": "Contains all the nested rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", + "properties": { + "1": { + "type": "object", + "description": "Defines the nested rule.", + "properties": { + "name": { + "type": "string" + }, + "property": { + "type": "string" + }, + "conditions": { + "type": "object" + }, + "rules": { + "type": "object" + } + } + }, + "logic": { + "type": "string" + } + } + }, + "property": { + "type": "string", + "description": "Custom name for a metadata property associated with the condition to be satisfied. **Required** if the property `name` is any of the following: \n| **Name** |\n|:---|\n| customer_metadata |\n| custom_event_metadata |\n| order_items_metadata |\n| order_metadata |\n| product_metadata |\n| redemption_metadata |" + }, + "conditions": { + "type": "array", + "description": "A set of key value pairs representing the condition name and value. The list of available conditions is provided below: \n| **Condition (key)** | **Definition** | **Does not support Types** |\n|:---|:---|:---|\n| $is | A property is a predefined value. | |\n| $is_not | A property is not a predefined value. | |\n| $in | A property either one value in a predefined list of values. | |\n| $less_than | A property is less than a predefined value. | boolean |\n| $less_than_or_equal | A property is less than or equal to a predefined value. | boolean |\n| $more_than | A property is more than a predefined value. | boolean |\n| $more_than_or_equal | A property is more than or equal to a predefined value. | boolean |\n| $starts_with | A property starts with the predefined sequence of characters. | boolean, number |\n| $ends_with | A property ends with the predefined sequence of characters. | boolean, number |\n| $contains | A property contains the predefined sequence of characters. | boolean, number |\n| $timeframe | | boolean, number |\n| $dow | | boolean, string |\n| $count | | boolean, string |\n| $count_more | | boolean, string |\n| $count_less | | boolean, string |", + "items": { + "type": [ + "string", + "integer", + "boolean" + ] + } + }, + "error": { + "type": "object", + "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rule.", + "properties": { + "message": { + "type": "string", + "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rule." + } + } + } + } + }, + "logic": { + "type": "string", + "description": "Defines the logic between the rules.", + "example": "(1 and 2) and (3)" + } + } + }, + "error": { + "type": "object", + "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules.", + "properties": { + "message": { + "type": "string", + "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rules." + } + } + }, + "applicable_to": { + "type": "object", + "properties": { + "excluded": { + "type": "array", + "description": "Defines which items are excluded from a discount.", + "items": { + "type": "object", + "description": "Defines the excluded item.", + "properties": { + "object": { + "type": "string", + "enum": [ + "product", + "sku", + "products_collection" + ], + "description": "The type of object being excluded from the rule." + }, + "id": { + "type": "string", + "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." + }, + "source_id": { + "type": "string" + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY" + ], + "description": "Discount effect for an excluded resource." + } + } + } + }, + "included": { + "type": "array", + "description": "Defines which items are included in a discount.", + "items": { + "type": "object", + "description": "Defines the included item.", + "properties": { + "object": { + "type": "string", + "enum": [ + "product", + "sku", + "products_collection" + ], + "description": "The type of object being included in the rule." + }, + "id": { + "type": "string", + "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." + }, + "source_id": { + "type": "string" + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Discount effect for an included resource." + }, + "quantity_limit": { + "type": "integer", + "description": "A limit on the number of units that at maximum can qualify for a discount. This property is present for an AMOUNT type discount when the effect is applied to ITEMS and each unit of matched products has the same discount value." + } + } + } + }, + "included_all": { + "type": "boolean", + "description": "Indicates whether all items are included in the discount." + } + } + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the validation rule was created in ISO 8601 format.", + "example": "2022-04-07T07:42:44.442Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2022-05-09T07:42:44.442Z", + "description": "Timestamp representing the date and time when the validation rule was updated in ISO 8601 format.", + "format": "date-time" + }, + "type": { + "type": "string", + "enum": [ + "basic", + "advanced", + "complex" + ], + "description": "Type of validation rule." + }, + "context_type": { + "type": "string", + "enum": [ + "earning_rule.order.paid", + "earning_rule.custom_event", + "earning_rule.customer.segment.entered", + "campaign.discount_coupons", + "campaign.discount_coupons.discount.apply_to_order", + "campaign.discount_coupons.discount.apply_to_items", + "campaign.discount_coupons.discount.apply_to_items_proportionally", + "campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity", + "campaign.discount_coupons.discount.fixed.apply_to_items", + "campaign.gift_vouchers", + "campaign.gift_vouchers.gift.apply_to_order", + "campaign.gift_vouchers.gift.apply_to_items", + "campaign.referral_program", + "campaign.referral_program.discount.apply_to_order", + "campaign.referral_program.discount.apply_to_items", + "campaign.referral_program.discount.apply_to_items_proportionally", + "campaign.referral_program.discount.apply_to_items_proportionally_by_quantity", + "campaign.referral_program.discount.fixed.apply_to_items", + "campaign.promotion", + "campaign.promotion.discount.apply_to_order", + "campaign.promotion.discount.apply_to_items", + "campaign.promotion.discount.apply_to_items_proportionally", + "campaign.promotion.discount.apply_to_items_proportionally_by_quantity", + "campaign.promotion.discount.fixed.apply_to_items", + "campaign.loyalty_program", + "campaign.lucky_draw", + "voucher.discount_voucher", + "voucher.discount_voucher.discount.apply_to_order", + "voucher.discount_voucher.discount.apply_to_items", + "voucher.discount_voucher.discount.apply_to_items_proportionally", + "voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity", + "voucher.discount_voucher.discount.fixed.apply_to_items", + "voucher.gift_voucher", + "voucher.gift_voucher.gift.apply_to_order", + "voucher.gift_voucher.gift.apply_to_items", + "voucher.loyalty_card", + "voucher.lucky_draw_code", + "distribution.custom_event", + "reward_assignment.pay_with_points", + "global" + ], + "description": "Validation rule context type. \n\n| **Context Type** | **Definition** |\n|:---|:---|\n| earning_rule.order.paid | |\n| earning_rule.custom_event | |\n| earning_rule.customer.segment.entered | |\n| campaign.discount_coupons | |\n| campaign.discount_coupons.discount.apply_to_order | |\n| campaign.discount_coupons.discount.apply_to_items | |\n| campaign.discount_coupons.discount.apply_to_items_proportionally | |\n| campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.discount_coupons.discount.fixed.apply_to_items | |\n| campaign.gift_vouchers | |\n| campaign.gift_vouchers.gift.apply_to_order | |\n| campaign.gift_vouchers.gift.apply_to_items | |\n| campaign.referral_program | |\n| campaign.referral_program.discount.apply_to_order | |\n| campaign.referral_program.discount.apply_to_items | |\n| campaign.referral_program.discount.apply_to_items_proportionally | |\n| campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.referral_program.discount.fixed.apply_to_items | |\n| campaign.promotion | |\n| campaign.promotion.discount.apply_to_order | |\n| campaign.promotion.discount.apply_to_items | |\n| campaign.promotion.discount.apply_to_items_proportionally | |\n| campaign.promotion.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.promotion.discount.fixed.apply_to_items | |\n| campaign.loyalty_program | |\n| campaign.lucky_draw | |\n| voucher.discount_voucher | |\n| voucher.discount_voucher.discount.apply_to_order | |\n| voucher.discount_voucher.discount.apply_to_items | |\n| voucher.discount_voucher.discount.apply_to_items_proportionally | |\n| voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | |\n| voucher.discount_voucher.discount.fixed.apply_to_items | |\n| voucher.gift_voucher | |\n| voucher.gift_voucher.gift.apply_to_order | |\n| voucher.gift_voucher.gift.apply_to_items | |\n| voucher.loyalty_card | |\n| voucher.lucky_draw_code | |\n| distribution.custom_event | |\n| reward_assignment.pay_with_points | |\n| global | |" + }, + "assignments_count": { + "description": "The number of instances the validation rule has been assigned to different types of redeemables.", + "type": "integer" + }, + "object": { + "type": "string", + "default": "validation_rules", + "description": "The type of object represented by each nested object in the JSON `data` array. This object stores information about the validation rules." + } } - }, - "filters": { - "$ref": "#/components/schemas/ExportVoucherFilters", - "description": "Filter conditions." } }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + "total": { + "type": "integer", + "description": "Total number of validation rules in the project." + } } }, - "required": [ - "exported_object" - ] - }, - { - "title": "Export Redemptions", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "redemption" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportRedemptionOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportRedemptionFields" - } - }, - "filters": { - "$ref": "#/components/schemas/ExportRedemptionFilters", - "description": "Filter conditions." - } + "13_obj_validation_rule_assignment_object": { + "title": "Validation Rule Assignment Object", + "type": "object", + "description": "This is an object representing a validation rule assignment. \n\nThis object stores an assignment of a: \n- [voucher](ref:get-voucher)\n- [campaign](ref:get-campaign)\n- [earning rule](ref:get-earning-rule)\n- [reward assignment](ref:get-reward-assignment)\n- [promotion tier](ref:list-promotion-tiers)\n- [publication](ref:list-publications)", + "x-tags": [ + "VALIDATION RULES API" + ], + "properties": { + "id": { + "type": "string", + "example": "asgm_74F7QZoYbUoljwQO", + "description": "Validation rule assignment ID." + }, + "rule_id": { + "type": "string", + "example": "val_4j7DCRm2IS59", + "description": "Validation rule ID." + }, + "related_object_id": { + "type": "string", + "example": "v_JtWunK6jUo7X2qOFj0SyRHq4p9tgENlT", + "description": "The resource ID to which the validation rule was assigned." + }, + "related_object_type": { + "type": "string", + "description": "The type of resource to which the validation rule was assigned.", + "enum": [ + "voucher", + "campaign", + "earning_rule", + "reward_assignment", + "promotion_tier", + "distribution" + ] }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + "created_at": { + "type": "string", + "example": "2022-02-17T08:18:15.085Z", + "description": "Timestamp representing the date and time when the validation rule assignment was created in ISO 8601 format.", + "format": "date-time" + }, + "object": { + "type": "string", + "default": "validation_rules_assignment", + "description": "The type of object represented by the ID." + } } }, - "required": [ - "exported_object" - ] - }, - { - "title": "Export Customers", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "customer" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportCustomerOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportCustomerFields" - } - }, - "filters": { - "$ref": "#/components/schemas/ExportCustomerFilters", - "description": "Filter conditions." + "13_res_validation-rules_validationRuleId_assignments": { + "type": "object", + "description": "Validation Rule Assignments", + "title": "Validation Rule Assignments", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about validation rule assignments.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the JSON property that contains the array of validation rule assignments.", + "default": "data" + }, + "data": { + "type": "array", + "description": "A dictionary that contains an array of validation rule assignments.", + "items": { + "$ref": "#/components/schemas/13_obj_validation_rule_assignment_object" } }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + "total": { + "type": "integer", + "description": "Total number of validation rule assignments." + } } }, - "required": [ - "exported_object" - ] - }, - { - "title": "Export Publications", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "publication" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportPublicationOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportPublicationFields" - } - }, - "filters": { - "$ref": "#/components/schemas/ExportPublicationFilters", - "description": "Filter conditions." - } + "13_req_create_validation_rule_assignments": { + "description": "Respone body schema for **POST** `/validation-rules/{validationRuleId}/assignments`.", + "title": "Create Validation Rule Assignments Request Body", + "oneOf": [ + { + "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_voucher" + }, + { + "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_campaign" + }, + { + "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_promotion_tier" + }, + { + "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_earning_rule" + }, + { + "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_reward" }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + { + "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_distribution" + } + ] + }, + "13_req_create_validation_rule_assignments_voucher": { + "type": "object", + "description": "Assign a validation rule to a voucher.", + "title": "Voucher", + "properties": { + "voucher": { + "type": "string", + "description": "Unique voucher ID or code to which you would like to assign the validation rule to.", + "example": "v_ssR6vhswwh5odSloN2Vc3O60w7aea018" + } } }, - "required": [ - "exported_object" - ] - }, - { - "title": "Export Order", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "order" - ], - "description": "The type of object to be exported." + "13_req_create_validation_rule_assignments_campaign": { + "type": "object", + "description": "Assign a validation rule to a campaign.", + "title": "Campaign", + "properties": { + "campaign": { + "type": "string", + "description": "Unique campaign ID or name to which you would like to assign the validation rule to.", + "example": "camp_HXsR22VUMC4hN4DR7eAhCalp" + } + } + }, + "13_req_create_validation_rule_assignments_promotion_tier": { + "type": "object", + "description": "Assign a validation rule to a promotion tier.", + "title": "Promotion Tier", + "properties": { + "promotion_tier": { + "type": "string", + "description": "Unique promotion tier ID to which you would like to assign the validation rule to.", + "example": "promo_Vet0vCNyyo5pOddHfu2X3FCB" + } + } + }, + "13_req_create_validation_rule_assignments_earning_rule": { + "type": "object", + "description": "Assign a validation rule to an earning rule.", + "title": "Earning Rule", + "properties": { + "earning_rule": { + "type": "string", + "description": "Unique earning rule ID to which you would like to assign the validation rule to.", + "example": "ern_CfvQ4vWEKD4kHTxghdY8YJGs" + } + } + }, + "13_req_create_validation_rule_assignments_reward": { + "type": "object", + "description": "Assign a validation rule to a reward.", + "title": "Reward", + "properties": { + "related_object_id": { + "type": "string", + "description": "Unique reward assignment ID, i.e. rewa_6VSWcXjfm5PuZlfeuZxl5JZT. This is the first parameter to be sent for a validation rule assignment to be assigned to a reward assignment. The prerequisites for assigning a validation rule to a reward assignment are: \n1. Define a loyalty campaign. \n2. Connect a reward with the campaign. \n3. Retrieve a reward assignment ID for the reward assigned to the loyalty campaign. \n4. And finally you can use this endpoint to assign a validation rule to the particular reward assignment.", + "example": "rewa_6VSWcXjfm5PuZlfeuZxl5JZT" + }, + "related_object_type": { + "type": "string", + "description": "This is the second parameter that needs to be sent in order to properly assign a validation rule to a reward assignment.", + "example": "reward_assignment", + "default": "reward_assignment", + "enum": [ + "reward_assignment" + ] + } + } + }, + "13_req_create_validation_rule_assignments_distribution": { + "type": "object", + "description": "Assign a validation rule to a distribution.", + "title": "Distribution", + "properties": { + "distribution": { + "type": "string", + "description": "Unique distribution ID to which you would like to assign the validation rule to.", + "example": "distr_2nUIekYnS9L1Vm1I55vmC7kSvd" + } + } + }, + "14_obj_segment_object": { + "title": "Customer Segment Object", + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "seg_1wc52c5z6r1kQ81brO8j9Hk2", + "description": "Unique segment ID." + }, + "name": { + "type": "string", + "description": "Segment name." + }, + "created_at": { + "type": "string", + "example": "2022-05-12T13:01:56.896Z", + "description": "Timestamp representing the date and time when the segment was created in ISO 8601 format.", + "format": "date-time" + }, + "type": { + "type": "string", + "enum": [ + "auto-update", + "static" + ], + "description": "Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers)." + }, + "filter": { + "type": [ + "object", + "null" + ], + "description": "Defines a set of criteria for an `auto-update` segment type. " + }, + "initial_sync_status": { + "type": "string", + "enum": [ + "IN_PROGRESS", + "DONE" + ] + }, + "object": { + "type": "string", + "default": "segment", + "description": "The type of object represented by JSON. This object stores information about the customer segment." + } }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportOrderOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportOrderFields" + "description": "This is an object representing a customer segment.", + "x-tags": [ + "SEGMENTS API" + ] + }, + "14_req_create_segment": { + "title": "Create Customer Segment Request Body", + "description": "Request body schema for **POST** `/segments`.", + "oneOf": [ + { + "$ref": "#/components/schemas/14_req_create_segment_static" + }, + { + "$ref": "#/components/schemas/14_req_create_segment_dynamic" + } + ] + }, + "14_req_create_segment_static": { + "title": "Static Customer Segment", + "type": "object", + "description": "Request body schema for creating a static customer segment in **POST** `/segments`.", + "properties": { + "name": { + "type": "string", + "description": "Segment name." + }, + "type": { + "type": "string", + "description": "Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers).", + "default": "static" + }, + "customers": { + "type": "array", + "description": "Array of customer IDs.", + "items": {} + } + } + }, + "14_req_create_segment_dynamic": { + "title": "Dynamic Customer Segment", + "type": "object", + "description": "Request body schema for creating a dynamic customer segment in **POST** `/segments`.", + "properties": { + "name": { + "type": "string", + "description": "Segment name." + }, + "type": { + "type": "string", + "description": "Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers).", + "default": "auto-update" + }, + "filter": { + "type": "object", + "description": "Defines a set of criteria for an `auto-update` segment type." + } + } + }, + "14_res_customers_customerId_segments": { + "type": "object", + "title": "List Segments for Customer Response Body", + "description": "Response body schema for `/customers/{customerId}/segments`.", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about customer segments.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the JSON property that contains the array of segment IDs.", + "default": "data" + }, + "data": { + "type": "array", + "description": "A dictionary that contains an array of segment IDs and names.", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique segment ID.", + "example": "seg_DNAOhUtJffvX0f57ajLMFBYR" + }, + "name": { + "type": "string", + "description": "Segment name." + }, + "object": { + "type": "string", + "description": "The type of object represented by the ID.", + "default": "segment" + } } - }, - "filters": { - "$ref": "#/components/schemas/ExportOrderFilters", - "description": "Filter conditions." } }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + "total": { + "type": "integer", + "description": "Total number of segments the customer belongs to." + } } }, - "required": [ - "exported_object" - ] - }, - { - "title": "Export Points Expirations", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "points_expiration" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportPointsExpirationOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportPointsExpirationFields" + "15_obj_event_object": { + "title": "Event Object", + "type": "object", + "description": "This is an object representing an event. \n\nVoucherify distinguishes two types of events - custom and internal. Both are presented in the same Event structure. \n\n## Custom Events\n\nCustom Events are actions taken by your customers. They’re best suited for tracking high-value customer interactions with your application. Logging a custom event can trigger any number of distributions, and enables the segmentation filters around the recency and frequency of that event.\n\nWith Custom Event metadata field, Voucherify allows you to set properties on custom events. These properties can then be used for further qualifying trigger conditions, increasing personalization in messaging, and generating more sophisticated analytics through raw data export.\n\nThe Custom Events are directly linked to the customers' resources from Voucherify. It means that each event gets a connection to a customer. \n\n\n> #### An example \n>\n> If an e-commerce application wanted to send a message to a user when he/she abandons their cart, the custom event could additionally improve its target audience and allow for increased distribution personalization by adding a Custom Event of the `value` of customers’ order.\n\n## Internal Voucherify Events \n\nMoreover, Events are our way of letting you know when something interesting happens in your project. When an interesting event occurs, we create a new Event object. For example, when a redemption succeeds, we create a `redemption.succeeded` event.\n\nNote that many API requests may cause multiple events to be created. For example, if you create a new redemption for a new customer not existing yet in Voucherify, you will receive both a `customer.created` event and a `redemption.succeeded` event.\n\nThe events occur when the state of another API resource changes and the state of that resource at the time of the change is embedded in the data field of the event. \n\n| **Types of internal events** |\n|:---|\n| **Campaign** |\n| campaign.validation_rules.created
campaign.created
campaign.disabled
campaign.export_mailchimp_scheduled
campaign.export_mailchimp_done
campaign.validation_rules.deleted
campaign.validation_rules.updated
campaign.updated
campaign.deleted
campaign.export_mailchimp_failed
campaign.enabled |\n| **Voucher** |\n| voucher.validation.succeeded
voucher.updated
voucher.enabled
voucher.gift.balance_added
voucher.validation_rules.updated
voucher.published
voucher.validation_rules.deleted
voucher.disabled
voucher.validation.failed
voucher.validation_rules.created
voucher.deleted
voucher.created |\n| **Redemption** |\n| redemption.succeeded
redemption.failed
redemption.rollback.failed
redemption.rollback.succeeded |\n| **Customer** |\n| customer.rewarded
customer.rewarded.loyalty_points
customer.sms.sent
customer.email.failed
customer.deleted
customer.created
customer.updated
customer.segment.left
customer.sms.failed
customer.segment.entered
customer.email.sent |\n| **Order** |\n| order.canceled
order.created
order.updated
order.paid |\n| **Product** |\n| product.updated
product.created
product.deleted |\n| **SKU** |\n| sku.updated
sku.created
sku.deleted |\n| **Distribution** |\n| distribution.sms.failed
distribution.sms.sent
distribution.email.sent
distribution.email.failed |\n| **Export** |\n| export.done
export.scheduled
export.failed
export.deleted | \n\n## Webhooks \n\nVoucherify also has a separate system for sending the event objects directly to an endpoint at your end (server). We called that mechanism webhooks. They are managed in your project settings. \n\n| **Attribute** | **Description** | **Example** |\n|:---|:---|:---|\n| `id`
string | | event_xjGas2mI2PduFFPL2NAcFeHkHfLn3H |\n| `object`
string | Type of the object represented by JSON. Value is `event`. | |\n| `created_at`
string, ISO 8601 date format | Time at which the object was created. | 2016-11-16T14:14:31Z |\n| `type`
string | Description of the event | view_pricing_page
redemption.succeeded |\n| `data.object`
object | The object containing data associated with the event. It can be a `customer`, `redemption` or any other type of object which is a source of the event. In this object structure, you can also find a property `related_object` which contains values presenting any other resource connected to the event.

For Custom Event the structure of child attributes is constant:

- customer (`object`) - The object presenting a profile of the related customer who performed an action.

- metadata (`object`) - A set of key/value pairs that you can attach to a custom event object. It can be useful for storing additional information about the event in a structured format. | \"data\": { \"object\": { \"customer\": { \"id\": \"cust_OtHDKrv5sJrjd8aYBYZ6AOIF\", \"name\": \"Gustav Purpleson\", \"object\": \"customer\", \"source_id\": \"gustav@purpleson.com\", \"created_at\": 1510834859417, \"updated_at\": 1510835106559 }, \"metadata\": { \"lang\": \"en\", \"test\": true, \"page\": \"http://main.io\" } } } |\n| `metadata`
object | A set of key/value pairs that Voucherify attaches to a custom event object. It is a set of additional system information about the event in a structured format. | |\n\n\n```json\n{\n \"id\": \"event_ehkvgZFgSePlb95SH3JJulkApy9Kg9\",\n \"object\": \"event\",\n \"created_at\": \"2017-11-16T14:45:34.181Z\",\n \"type\": \"redemption.succeeded\",\n \"data\": {\n \"object\": {\n \"id\": \"r_mist0IpebikTaRdxiOGI2IhL\",\n \"date\": \"2017-11-16T14:45:32.733Z\",\n \"order\": {\n \"id\": \"ord_AhDlR13vQE5ino95P2NIABBN\",\n \"items\": [\n {\n \"object\": \"order_item\",\n \"sku_id\": null,\n \"quantity\": 1,\n \"source_id\": null,\n \"product_id\": \"iphone8\"\n }\n ],\n \"amount\": 50000,\n \"object\": \"order\",\n \"status\": \"CREATED\",\n \"customer\": {\n \"id\": \"cust_fJPsoub5ITJnIEVO3v9whrP9\",\n \"object\": \"customer\"\n },\n \"metadata\": null,\n \"referrer\": null,\n \"source_id\": null,\n \"created_at\": \"2017-11-16T14:45:32.023Z\",\n \"updated_at\": null,\n \"discount_amount\": 2000\n },\n \"object\": \"redemption\",\n \"result\": \"SUCCESS\",\n \"voucher\": {\n \"code\": \"2017-goX-aH\",\n \"gift\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"object\": \"voucher\",\n \"campaign\": \"SteffenTest\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"amount_off\": 2000\n },\n \"is_referral_code\": false\n },\n \"customer\": {\n \"id\": \"cust_fJPsoub5ITJnIEVO3v9whrP9\",\n \"object\": \"customer\"\n },\n \"metadata\": {\n \"city\": \"London1\"\n },\n \"customer_id\": \"cust_fJPsoub5ITJnIEVO3v9whrP9\",\n \"tracking_id\": \"track_3tM7KR57bbeIRtMcvpKYr2aAOrCpYBDZ\",\n \"related_object_type\": \"voucher\"\n },\n \"previous_attributes\": {}\n },\n \"metadata\": {\n \"source\": \"API\"\n }\n}\n```\n\n## Customisable Campaign Events \n\nAs part of campaign creation, users can configure webhooks triggered when specific activities appear within a campaign's lifetime. Those webhooks get configurable names and the users implement them in Voucherify Dashboard as part of the campaign creation process.\n\nThis type of webhooks can be configured for the following actions: \n\n| **Action** |\n|:---|\n| **Referral Program** |\n| Referrer rewarded
Referral code assigned
Customer referred |\n| **Loyalty Campaign** |\n| Loyalty card assigned
Points earned
Points redeemed | \n\nPayloads of customizable webhooks:\n\n### Referral Program\n\n\n```json\n{\n \"id\": \"evcus_0a26b1a5acd3437894\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-01-24T11:09:57.765Z\",\n \"type\": \"referral_code_assigned\",\n \"data\": {\n \"object\": {\n \"voucher\": {\n \"id\": \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\",\n \"code\": \"xYwEheRh\",\n \"campaign\": \"Referral Webhooks\",\n \"campaign_id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"category\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"amount_off\": 1000,\n \"effect\": \"APPLY_TO_ORDER\"\n },\n \"gift\": null,\n \"loyalty_card\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX19wsHlNj5GT/2Kkf/MnPKlL4WjU55GyTsmpXgw+KQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy/OHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va+MFPSHRy5tesDQ==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19wsHlNj5GT%2F2Kkf%2FMnPKlL4WjU55GyTsmpXgw%2BKQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy%2FOHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va%2BMFPSHRy5tesDQ%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19ZgrgURtgcjD1cvt/L6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i/UVUbmXTxDvNXsceP+nzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19ZgrgURtgcjD1cvt%2FL6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i%2FUVUbmXTxDvNXsceP%2BnzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w%3D%3D\"\n }\n },\n \"is_referral_code\": true,\n \"created_at\": \"2021-11-12T11:09:57.772Z\",\n \"updated_at\": null,\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"referrer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/xYwEheRh/redemptions?page=1&limit=10\"\n },\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/xYwEheRh/publications?page=1&limit=10\"\n },\n \"object\": \"voucher\"\n },\n \"campaign\": {\n \"id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"name\": \"Referral Webhooks\",\n \"campaign_type\": \"REFERRAL_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"voucher\": {\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"amount_off\": 1000,\n \"effect\": \"APPLY_TO_ORDER\"\n },\n \"gift\": null,\n \"loyalty_card\": null,\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"prefix\": \"\",\n \"postfix\": \"\"\n },\n \"is_referral_code\": true\n },\n \"referral_program\": {\n \"conversion_event_type\": \"redemption\"\n },\n \"join_once\": false,\n \"use_voucher_metadata_schema\": true,\n \"vouchers_count\": 1,\n \"active\": true,\n \"metadata\": {},\n \"created_at\": \"2021-11-12T11:00:08.306Z\",\n \"updated_at\": \"2021-11-12T11:09:40.671Z\",\n \"creation_status\": \"DONE\",\n \"vouchers_generation_status\": \"DONE\",\n \"object\": \"campaign\"\n },\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"source_id\": \"test_referrer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0\n },\n \"orders\": {\n \"total_amount\": 0,\n \"total_count\": 0,\n \"average_amount\": null,\n \"last_order_amount\": null,\n \"last_order_date\": null\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 0,\n \"campaigns\": {}\n },\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-11-12T11:09:57.749Z\",\n \"updated_at\": \"2021-11-12T11:09:58.620Z\",\n \"object\": \"customer\"\n },\n \"publication\": {\n \"id\": \"pub_gSpZUNX0hcDfEeRx3qIMMFrtfsZjeJO8\",\n \"object\": \"publication\",\n \"result\": \"SUCCESS\",\n \"channel\": \"API\",\n \"voucher\": {\n \"id\": \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\",\n \"code\": \"xYwEheRh\",\n \"gift\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"active\": true,\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX19wsHlNj5GT/2Kkf/MnPKlL4WjU55GyTsmpXgw+KQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy/OHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va+MFPSHRy5tesDQ==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19wsHlNj5GT%2F2Kkf%2FMnPKlL4WjU55GyTsmpXgw%2BKQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy%2FOHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va%2BMFPSHRy5tesDQ%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19ZgrgURtgcjD1cvt/L6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i/UVUbmXTxDvNXsceP+nzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19ZgrgURtgcjD1cvt%2FL6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i%2FUVUbmXTxDvNXsceP%2BnzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w%3D%3D\"\n }\n },\n \"object\": \"voucher\",\n \"publish\": {\n \"url\": \"/v1/vouchers/xYwEheRh/publications?page=1&limit=10\",\n \"count\": 1,\n \"object\": \"list\"\n },\n \"campaign\": \"Referral Webhooks\",\n \"category\": null,\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"metadata\": {},\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"created_at\": \"2021-11-12T11:09:57.772Z\",\n \"redemption\": {\n \"url\": \"/v1/vouchers/xYwEheRh/redemptions?page=1&limit=10\",\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"start_date\": null,\n \"updated_at\": null,\n \"campaign_id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"referrer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"loyalty_card\": null,\n \"distributions\": null,\n \"additional_info\": null,\n \"expiration_date\": null,\n \"is_referral_code\": true,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"referred_customers_count\": null,\n \"value\": \"$10.00\"\n },\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"object\": \"customer\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"source_id\": \"test_referrer__01\"\n },\n \"metadata\": {},\n \"source_id\": null,\n \"created_at\": \"2021-11-12T11:09:57.765Z\",\n \"customer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"tracking_id\": \"test_referrer__01\",\n \"vouchers_id\": [\n \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\"\n ]\n }\n },\n \"related_object\": {\n \"id\": \"evcus_0a26b1a5acd3437894\",\n \"type\": \"customer.publication.succeeded\",\n \"data\": {\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"test_referrer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"campaign\": {\n \"id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"name\": \"Referral Webhooks\",\n \"campaign_type\": \"REFERRAL_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"is_referral_code\": true,\n \"voucher\": {\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n }\n },\n \"referral_program\": {\n \"conversion_event_type\": \"redemption\"\n },\n \"auto_join\": null,\n \"join_once\": false,\n \"active\": true\n },\n \"publication\": {\n \"id\": \"pub_gSpZUNX0hcDfEeRx3qIMMFrtfsZjeJO8\",\n \"object\": \"publication\",\n \"result\": \"SUCCESS\",\n \"channel\": \"API\",\n \"voucher\": {\n \"id\": \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\",\n \"code\": \"xYwEheRh\",\n \"gift\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"active\": true,\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX19wsHlNj5GT/2Kkf/MnPKlL4WjU55GyTsmpXgw+KQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy/OHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va+MFPSHRy5tesDQ==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19wsHlNj5GT%2F2Kkf%2FMnPKlL4WjU55GyTsmpXgw%2BKQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy%2FOHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va%2BMFPSHRy5tesDQ%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19ZgrgURtgcjD1cvt/L6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i/UVUbmXTxDvNXsceP+nzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19ZgrgURtgcjD1cvt%2FL6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i%2FUVUbmXTxDvNXsceP%2BnzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w%3D%3D\"\n }\n },\n \"object\": \"voucher\",\n \"publish\": {\n \"url\": \"/v1/vouchers/xYwEheRh/publications?page=1&limit=10\",\n \"count\": 1,\n \"object\": \"list\"\n },\n \"campaign\": \"Referral Webhooks\",\n \"category\": null,\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"metadata\": {},\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"created_at\": \"2021-11-12T11:09:57.772Z\",\n \"redemption\": {\n \"url\": \"/v1/vouchers/xYwEheRh/redemptions?page=1&limit=10\",\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"start_date\": null,\n \"updated_at\": null,\n \"campaign_id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"referrer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"loyalty_card\": null,\n \"distributions\": null,\n \"additional_info\": null,\n \"expiration_date\": null,\n \"is_referral_code\": true,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"referred_customers_count\": null\n },\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"object\": \"customer\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"source_id\": \"test_referrer__01\"\n },\n \"metadata\": {},\n \"source_id\": null,\n \"created_at\": \"2021-11-12T11:09:57.765Z\",\n \"customer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"tracking_id\": \"test_referrer__01\",\n \"vouchers_id\": [\n \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\"\n ]\n }\n },\n \"created_at\": \"2021-11-12T11:09:57.765Z\"\n }\n },\n \"metadata\": {}\n}\n```\n\n```json\n{\n \"id\": \"evcus_0a26b3e7b718c480ca\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-01-24T11:19:49.723Z\",\n \"type\": \"referrer_rewarded_webhook\",\n \"data\": {\n \"object\": {\n \"voucher\": {\n \"id\": \"v_2teI9HcRvdvK1RsWD6gyNztHr4SMkMDy\",\n \"code\": \"dOzJ84Ky\",\n \"campaign\": \"Bonus Cards\",\n \"campaign_id\": \"camp_yheSCBQGrgeBwGMkQqjsUW24\",\n \"category\": null,\n \"type\": \"GIFT_VOUCHER\",\n \"discount\": null,\n \"gift\": {\n \"amount\": 500,\n \"balance\": 500\n },\n \"loyalty_card\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX1+tdyBGQeM+ZONM/k\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1+tdyBGQeM+ZONM/k\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1+WOEBHpX4y\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BWOEBHpX4y\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-01-24T11:19:40.409Z\",\n \"updated_at\": \"2021-01-24T11:19:41.518Z\",\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"redemption\": {\n \"quantity\": 1,\n \"redeemed_quantity\": 0,\n \"redeemed_amount\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/dOzJ84Ky/redemptions?page=1&limit=10\"\n },\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/dOzJ84Ky/publications?page=1&limit=10\"\n },\n \"object\": \"voucher\"\n },\n \"campaign\": {\n \"id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"name\": \"Referral Webhooks\",\n \"campaign_type\": \"REFERRAL_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"voucher\": {\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n },\n \"is_referral_code\": true\n },\n \"referral_program\": {\n \"conversion_event_type\": \"redemption\"\n },\n \"join_once\": false,\n \"vouchers_count\": 0,\n \"active\": true,\n \"object\": \"campaign\"\n },\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"source_id\": \"test_referrer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0\n },\n \"orders\": {\n \"total_amount\": 0,\n \"total_count\": 0,\n \"average_amount\": null,\n \"last_order_amount\": null\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 1,\n \"campaigns\": {\n \"Referral Webhooks\": {\n \"points\": 0,\n \"referred_customers\": 1\n }\n }\n },\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-01-24T11:09:57.749Z\",\n \"updated_at\": \"2021-01-24T11:19:41.513Z\",\n \"object\": \"customer\"\n },\n \"publication\": {\n \"id\": \"pub_9Y7nwUx3BaU3cHqBVbd0TEtS2ENiFZhJ\",\n \"created_at\": \"2021-01-24T11:19:40.317Z\",\n \"customer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"test_referrer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"tracking_id\": \"test_referrer__01\",\n \"metadata\": {},\n \"channel\": \"Automation\",\n \"source_id\": null,\n \"result\": \"SUCCESS\",\n \"voucher_code\": \"dOzJ84Ky\",\n \"vouchers\": [\n {\n \"id\": \"v_2teI9HcRvdvK1RsWD6gyNztHr4SMkMDy\",\n \"code\": \"dOzJ84Ky\",\n \"campaign\": \"Bonus Cards\",\n \"campaign_id\": \"camp_yheSCBQGrgeBwGMkQqjsUW24\",\n \"category\": null,\n \"type\": \"GIFT_VOUCHER\",\n \"discount\": null,\n \"gift\": {\n \"amount\": 500,\n \"balance\": 500\n },\n \"loyalty_card\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX1+tdyBGQeM+ZONM/kBdZ\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BtdyBGQeM%2BZONM%2FkBdZ\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1+WOEBHpX4y\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BWOEBHpX4y\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-01-24T11:19:40.409Z\",\n \"updated_at\": \"2021-01-24T11:19:41.518Z\",\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"object\": \"voucher\",\n \"distributions\": null,\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/dOzJ84Ky/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"quantity\": 1,\n \"redeemed_quantity\": 0,\n \"redeemed_amount\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/dOzJ84Ky/redemptions?page=1&limit=10\"\n }\n }\n ],\n \"vouchers_id\": [\n \"v_2teI9HcRvdvK1RsWD6gyNztHr4SMkMDy\"\n ],\n \"campaign_name\": \"Bonus Cards\",\n \"gift\": {\n \"amount\": 0,\n \"balance\": 0\n },\n \"loyalty_card\": null,\n \"discount\": null,\n \"is_referral_code\": false,\n \"failure_code\": null,\n \"failure_message\": null,\n \"voucher\": null\n }\n },\n \"related_object\": {\n \"id\": \"evcus_0a26b3e7b718c480ca\",\n \"type\": \"customer.reward_redemptions.completed\",\n \"data\": {\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"test_referrer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"holder\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"test_referrer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"voucher\": {\n \"id\": \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\",\n \"code\": \"xYwEheRh\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"amount_off\": 1000,\n \"effect\": \"APPLY_TO_ORDER\"\n },\n \"type\": \"DISCOUNT_VOUCHER\",\n \"campaign\": \"Referral Webhooks\",\n \"campaign_id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"is_referral_code\": true,\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"referrer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\"\n },\n \"campaign\": {\n \"id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"name\": \"Referral Webhooks\",\n \"campaign_type\": \"REFERRAL_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"is_referral_code\": true,\n \"voucher\": {\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n }\n },\n \"referral_program\": {\n \"conversion_event_type\": \"redemption\"\n },\n \"auto_join\": null,\n \"join_once\": false,\n \"active\": true\n },\n \"reward_redemption\": {\n \"id\": \"rewr_Fuzc1rngCCuKRDfBXBjUwl5j\",\n \"state\": \"COMPLETED\",\n \"created_at\": \"2021-01-24T11:19:43.883Z\",\n \"updated_at\": null,\n \"voucher_id\": \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\",\n \"campaign_id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"customer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"reward_assignment_id\": \"rewa_9FxFsy0M5UYc8jWjNrlSBWtG\",\n \"source_id\": \"event_0a26b3d269013fc79e\",\n \"source_type\": \"redemption_event\"\n },\n \"reward\": {\n \"assignment_id\": \"rewa_9FxFsy0M5UYc8jWjNrlSBWtG\",\n \"voucher\": {\n \"id\": \"v_2teI9HcRvdvK1RsWD6gyNztHr4SMkMDy\",\n \"code\": \"dOzJ84Ky\",\n \"gift\": {\n \"amount\": 500,\n \"balance\": 500\n },\n \"type\": \"GIFT_VOUCHER\",\n \"campaign\": \"Bonus Cards\",\n \"campaign_id\": \"camp_yheSCBQGrgeBwGMkQqjsUW24\",\n \"is_referral_code\": false,\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\"\n },\n \"id\": \"rew_e5taIjbo05k2vODIJtZ7mGED\",\n \"object\": \"reward\",\n \"name\": \"Credits - 5$\",\n \"type\": \"CAMPAIGN\"\n },\n \"reward_assignment\": {\n \"id\": \"rewa_9FxFsy0M5UYc8jWjNrlSBWtG\",\n \"reward_id\": \"rew_e5taIjbo05k2vODIJtZ7mGED\",\n \"related_object_id\": \"rrt_NWk1WYi1sZs3Epjvvd5a9JZx\",\n \"related_object_type\": \"referral_tier\",\n \"created_at\": \"2021-01-24T11:00:08.471Z\",\n \"updated_at\": null,\n \"object\": \"reward_assignment\"\n },\n \"source\": {\n \"id\": \"event_0a26b3d269013fc79e\",\n \"type\": \"redemption_event\"\n },\n \"balance\": {\n \"amount\": 500\n }\n },\n \"created_at\": \"2021-01-24T11:19:49.723Z\"\n }\n },\n \"metadata\": {}\n}\n```\n\n```json\n{\n \"id\": \"event_0a26b3d893cc3ac160\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-01-24T11:19:41.101Z\",\n \"type\": \"referee_invited\",\n \"data\": {\n \"object\": {\n \"order\": {},\n \"campaign\": {\n \"object\": \"campaign\",\n \"id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"name\": \"Referral Webhooks\",\n \"campaign_type\": \"REFERRAL_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"description\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"activity_duration_after_publishing\": null,\n \"vouchers_count\": 0,\n \"updated_at\": \"2021-01-24T11:09:40.671Z\",\n \"created_at\": \"2021-01-24T11:00:08.306Z\",\n \"active\": true,\n \"metadata\": {},\n \"vouchers_generation_status\": \"DONE\",\n \"category\": null,\n \"voucher\": {\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"gift\": null,\n \"loyalty_card\": null,\n \"redemption\": {\n \"quantity\": null\n },\n \"code_config\": {\n \"length\": 8,\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\"\n }\n },\n \"referral_program\": {\n \"conversion_event_type\": \"redemption\"\n },\n \"lucky_draw\": null\n },\n \"customer\": {\n \"id\": \"cust_BfTxUsoofap6Sb6oxG1BLCi5\",\n \"source_id\": \"referred_001\",\n \"name\": null,\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0,\n \"gift\": {\n \"redeemed_amount\": 0,\n \"amount_to_go\": 0\n },\n \"loyalty_card\": {\n \"redeemed_points\": 0,\n \"points_to_go\": 0\n }\n },\n \"orders\": {\n \"total_amount\": 25000,\n \"total_count\": 1,\n \"average_amount\": 25000,\n \"last_order_amount\": 25000,\n \"last_order_date\": \"2021-01-24T11:19:28.598Z\"\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 0,\n \"campaigns\": {}\n },\n \"metadata\": {\n \"vip\": true\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-01-24T11:19:27.844Z\",\n \"updated_at\": \"2021-01-24T11:19:28.926Z\",\n \"email_unsubscribed\": false,\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"object\": \"customer\"\n }\n },\n \"related_object\": {\n \"id\": \"event_0a26b3d893cc3ac160\",\n \"type\": \"customer.referred\",\n \"created_at\": \"2021-01-24T11:19:34.223Z\",\n \"data_json\": {\n \"object\": {\n \"id\": \"cust_BfTxUsoofap6Sb6oxG1BLCi5\",\n \"source_id\": \"referred_001\",\n \"name\": null,\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0,\n \"gift\": {\n \"redeemed_amount\": 0,\n \"amount_to_go\": 0\n },\n \"loyalty_card\": {\n \"redeemed_points\": 0,\n \"points_to_go\": 0\n }\n },\n \"orders\": {\n \"total_amount\": 25000,\n \"total_count\": 1,\n \"average_amount\": 25000,\n \"last_order_amount\": 25000,\n \"last_order_date\": \"2021-01-24T11:19:28.598Z\"\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 0,\n \"campaigns\": {}\n },\n \"metadata\": {\n \"vip\": true\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-01-24T11:19:27.844Z\",\n \"updated_at\": \"2021-01-24T11:19:28.926Z\",\n \"email_unsubscribed\": false,\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"object\": \"customer\"\n },\n \"previous_attributes\": {},\n \"related_object\": {}\n },\n \"metadata_json\": {\n \"is_rewarded\": true,\n \"source\": null\n },\n \"automation_id\": null,\n \"group_id\": \"v-0a26b3d24b032c4871\"\n }\n },\n \"metadata\": {}\n}\n```\n\n### Loyalty Campaign \n\n\n```json\n{\n \"id\": \"evcus_0a26b89763051ed721\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-11-12T11:40:18.125Z\",\n \"type\": \"loyalty_code_assigned\",\n \"data\": {\n \"object\": {\n \"voucher\": {\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"code\": \"qjvEslzU\",\n \"campaign\": \"Loyalty Webhooks\",\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"category\": null,\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf/oALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf%2FoALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1/ICHe/XvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU+S0A4SpuuDsMXXotf/AOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FICHe%2FXvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU%2BS0A4SpuuDsMXXotf%2FAOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-11-12T11:40:18.138Z\",\n \"updated_at\": null,\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0,\n \"redeemed_points\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/qjvEslzU/redemptions?page=1&limit=10\"\n },\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/qjvEslzU/publications?page=1&limit=10\"\n },\n \"object\": \"voucher\"\n },\n \"campaign\": {\n \"id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"name\": \"Loyalty Webhooks\",\n \"campaign_type\": \"LOYALTY_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"voucher\": {\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"prefix\": \"\",\n \"postfix\": \"\"\n },\n \"is_referral_code\": false\n },\n \"auto_join\": false,\n \"join_once\": false,\n \"use_voucher_metadata_schema\": true,\n \"vouchers_count\": 0,\n \"active\": true,\n \"metadata\": {},\n \"created_at\": \"2021-11-12T11:39:05.254Z\",\n \"creation_status\": \"DONE\",\n \"vouchers_generation_status\": \"DONE\",\n \"object\": \"campaign\"\n },\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"source_id\": \"Loyal_customer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0\n },\n \"orders\": {\n \"total_amount\": 0,\n \"total_count\": 0,\n \"average_amount\": null,\n \"last_order_amount\": null\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 0,\n \"campaigns\": {}\n },\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-11-12T11:40:18.077Z\",\n \"updated_at\": \"2021-11-12T11:40:19.724Z\",\n \"object\": \"customer\"\n },\n \"publication\": {\n \"id\": \"pub_ZAS0kZMqzF8LG5y55nx6dHMx2GkVPmxP\",\n \"object\": \"publication\",\n \"result\": \"SUCCESS\",\n \"channel\": \"API\",\n \"voucher\": {\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"code\": \"qjvEslzU\",\n \"gift\": null,\n \"type\": \"LOYALTY_CARD\",\n \"active\": true,\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf/oALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf%2FoALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1/ICHe/XvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU+S0A4SpuuDsMXXotf/AOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FICHe%2FXvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU%2BS0A4SpuuDsMXXotf%2FAOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA%3D%3D\"\n }\n },\n \"object\": \"voucher\",\n \"publish\": {\n \"url\": \"/v1/vouchers/qjvEslzU/publications?page=1&limit=10\",\n \"count\": 1,\n \"object\": \"list\"\n },\n \"campaign\": \"Loyalty Webhooks\",\n \"category\": null,\n \"discount\": null,\n \"metadata\": {},\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"created_at\": \"2021-11-12T11:40:18.138Z\",\n \"redemption\": {\n \"url\": \"/v1/vouchers/qjvEslzU/redemptions?page=1&limit=10\",\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_points\": 0,\n \"redeemed_quantity\": 0\n },\n \"start_date\": null,\n \"updated_at\": null,\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"distributions\": null,\n \"additional_info\": null,\n \"expiration_date\": null,\n \"is_referral_code\": false,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"value\": 0\n },\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"object\": \"customer\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"source_id\": \"Loyal_customer__01\"\n },\n \"metadata\": {},\n \"source_id\": null,\n \"created_at\": \"2021-11-12T11:40:18.125Z\",\n \"customer_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"tracking_id\": \"Loyal_customer__01\",\n \"vouchers_id\": [\n \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\"\n ]\n }\n },\n \"related_object\": {\n \"id\": \"evcus_0a26b89763051ed721\",\n \"type\": \"customer.publication.succeeded\",\n \"data\": {\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"Loyal_customer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"campaign\": {\n \"id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"name\": \"Loyalty Webhooks\",\n \"campaign_type\": \"LOYALTY_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"is_referral_code\": false,\n \"voucher\": {\n \"type\": \"LOYALTY_CARD\",\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n }\n },\n \"auto_join\": false,\n \"join_once\": false,\n \"active\": true\n },\n \"publication\": {\n \"id\": \"pub_ZAS0kZMqzF8LG5y55nx6dHMx2GkVPmxP\",\n \"object\": \"publication\",\n \"result\": \"SUCCESS\",\n \"channel\": \"API\",\n \"voucher\": {\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"code\": \"qjvEslzU\",\n \"gift\": null,\n \"type\": \"LOYALTY_CARD\",\n \"active\": true,\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf/oALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf%2FoALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1/ICHe/XvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU+S0A4SpuuDsMXXotf/AOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FICHe%2FXvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU%2BS0A4SpuuDsMXXotf%2FAOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA%3D%3D\"\n }\n },\n \"object\": \"voucher\",\n \"publish\": {\n \"url\": \"/v1/vouchers/qjvEslzU/publications?page=1&limit=10\",\n \"count\": 1,\n \"object\": \"list\"\n },\n \"campaign\": \"Loyalty Webhooks\",\n \"category\": null,\n \"discount\": null,\n \"metadata\": {},\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"created_at\": \"2021-11-12T11:40:18.138Z\",\n \"redemption\": {\n \"url\": \"/v1/vouchers/qjvEslzU/redemptions?page=1&limit=10\",\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_points\": 0,\n \"redeemed_quantity\": 0\n },\n \"start_date\": null,\n \"updated_at\": null,\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"distributions\": null,\n \"additional_info\": null,\n \"expiration_date\": null,\n \"is_referral_code\": false,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null\n },\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"object\": \"customer\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"source_id\": \"Loyal_customer__01\"\n },\n \"metadata\": {},\n \"source_id\": null,\n \"created_at\": \"2021-11-12T11:40:18.125Z\",\n \"customer_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"tracking_id\": \"Loyal_customer__01\",\n \"vouchers_id\": [\n \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\"\n ]\n }\n },\n \"created_at\": \"2021-11-12T11:40:18.125Z\"\n }\n },\n \"metadata\": {}\n}\n```\n\n```json\n{\n \"id\": \"event_0a26b9290fc4891587\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-11-12T11:42:51.380Z\",\n \"type\": \"points_earned\",\n \"data\": {\n \"object\": {\n \"order\": {},\n \"voucher\": {\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"code\": \"qjvEslzU\",\n \"campaign\": \"Loyalty Webhooks\",\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"category\": null,\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 220,\n \"balance\": 220\n },\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf/oALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf%2FoALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1/ICHe/XvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU+S0A4SpuuDsMXXotf/AOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FICHe%2FXvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU%2BS0A4SpuuDsMXXotf%2FAOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-11-12T11:40:18.138Z\",\n \"updated_at\": \"2021-11-12T11:42:50.332Z\",\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"object\": \"voucher\",\n \"distributions\": {\n \"distr_naR4rx0AgM1baWZkFm1kfHn7A9\": {\n \"date\": \"2021-11-12T11:40:21.957Z\"\n },\n \"distr_pnfPKLDAxUpiPi3ZsuMrygtYNN\": {\n \"date\": \"2021-11-12T11:42:50.332Z\"\n }\n },\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/qjvEslzU/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0,\n \"redeemed_points\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/qjvEslzU/redemptions?page=1&limit=10\"\n }\n },\n \"campaign\": {\n \"object\": \"campaign\",\n \"id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"name\": \"Loyalty Webhooks\",\n \"campaign_type\": \"LOYALTY_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"description\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"activity_duration_after_publishing\": null,\n \"vouchers_count\": 0,\n \"updated_at\": null,\n \"created_at\": \"2021-11-12T11:39:05.254Z\",\n \"active\": true,\n \"metadata\": {},\n \"vouchers_generation_status\": \"DONE\",\n \"category\": null,\n \"voucher\": {\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"redemption\": {\n \"quantity\": null\n },\n \"code_config\": {\n \"length\": 8,\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\"\n }\n },\n \"referral_program\": null,\n \"lucky_draw\": null\n },\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"source_id\": \"Loyal_customer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0,\n \"gift\": {\n \"redeemed_amount\": 0,\n \"amount_to_go\": 0\n },\n \"loyalty_card\": {\n \"redeemed_points\": 0,\n \"points_to_go\": 220\n }\n },\n \"orders\": {\n \"total_amount\": 22000,\n \"total_count\": 1,\n \"average_amount\": 22000,\n \"last_order_amount\": 22000,\n \"last_order_date\": \"2021-11-12T11:42:39.633Z\"\n }\n },\n \"loyalty\": {\n \"points\": 220,\n \"referred_customers\": 0,\n \"campaigns\": {\n \"Loyalty Webhooks\": {\n \"points\": 220,\n \"referred_customers\": 0\n }\n }\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-11-12T11:40:18.077Z\",\n \"updated_at\": \"2021-11-12T11:42:47.393Z\",\n \"email_unsubscribed\": false,\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"object\": \"customer\"\n }\n },\n \"related_object\": {\n \"id\": \"event_0a26b9290fc4891587\",\n \"type\": \"customer.rewarded.loyalty_points\",\n \"created_at\": \"2021-11-12T11:42:47.359Z\",\n \"data_json\": {\n \"object\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"source_id\": \"Loyal_customer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0,\n \"gift\": {\n \"redeemed_amount\": 0,\n \"amount_to_go\": 0\n },\n \"loyalty_card\": {\n \"redeemed_points\": 0,\n \"points_to_go\": 0\n }\n },\n \"orders\": {\n \"total_amount\": 22000,\n \"total_count\": 1,\n \"average_amount\": 22000,\n \"last_order_amount\": 22000,\n \"last_order_date\": \"2021-11-12T11:42:39.633Z\"\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 0,\n \"campaigns\": {\n \"Loyalty Webhooks\": {\n \"points\": 0,\n \"referred_customers\": 0\n }\n }\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-11-12T11:40:18.077Z\",\n \"updated_at\": \"2021-11-12T11:42:40.635Z\",\n \"email_unsubscribed\": false,\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"object\": \"customer\"\n },\n \"previous_attributes\": {},\n \"related_object\": {\n \"points\": 220,\n \"total\": 220,\n \"balance\": 220,\n \"type\": \"loyalty_card\",\n \"object\": \"balance\",\n \"related_object\": {\n \"type\": \"voucher\",\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\"\n }\n },\n \"balance\": {\n \"points\": 220,\n \"total\": 220,\n \"balance\": 220,\n \"type\": \"loyalty_card\",\n \"object\": \"balance\",\n \"related_object\": {\n \"type\": \"voucher\",\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\"\n }\n }\n },\n \"metadata_json\": {\n \"source\": \"Automation\"\n },\n \"automation_id\": \"auto_McXM3rjWcPwaNU5ndIIP13jX\",\n \"group_id\": \"v-0a26b921779d7eebcb\"\n }\n },\n \"metadata\": {}\n}\n```\n\n```json \n{\n \"id\": \"evcus_0a26bb89060c3ad8bc\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-11-12T11:53:09.910Z\",\n \"type\": \"points_redeemed\",\n \"data\": {\n \"object\": {\n \"voucher\": {\n \"id\": \"v_ix6p7zxM8m7AdlgObubjP2ibDTCsnEkq\",\n \"code\": \"xUgBLQck\",\n \"campaign\": \"20% discount\",\n \"campaign_id\": \"camp_o9vZ7yIqtj5B9CbhJlKRXIZ5\",\n \"category\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"PERCENT\",\n \"amount_limit\": 5000,\n \"percent_off\": 20\n },\n \"gift\": null,\n \"loyalty_card\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX19pNCYXQ8ztNEb+OaYwP13ZoOfOMBJwzgz2RNchFxoMDPIHS47i8tY+oc3HzEpFr2SqITQ/IdD6V7RuYxsyrcfz53Je6+me6VBl9Pze3p8lTSJWwjp79tKEZHygNMggPsfIEi4Ei3Wt1A==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19pNCYXQ8ztNEb%2BOaYwP13ZoOfOMBJwzgz2RNchFxoMDPIHS47i8tY%2Boc3HzEpFr2SqITQ%2FIdD6V7RuYxsyrcfz53Je6%2Bme6VBl9Pze3p8lTSJWwjp79tKEZHygNMggPsfIEi4Ei3Wt1A%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19a0CQqRE3y6dRDn0Jyr74H85dLNo9MQrXRZFBj9fcDUlaV3Q0uG2xa4l4Ch4WVfPGQ3iEEPpYTMQGwm8xN9cynpCv/upu9ZD9iWat6+nlw+PsKH5CcyNemhfI273GhBOvh5ysRMpFUZQ==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19a0CQqRE3y6dRDn0Jyr74H85dLNo9MQrXRZFBj9fcDUlaV3Q0uG2xa4l4Ch4WVfPGQ3iEEPpYTMQGwm8xN9cynpCv%2Fupu9ZD9iWat6%2Bnlw%2BPsKH5CcyNemhfI273GhBOvh5ysRMpFUZQ%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-11-12T11:53:03.194Z\",\n \"updated_at\": null,\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"redemption\": {\n \"quantity\": 1,\n \"redeemed_quantity\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/xUgBLQck/redemptions?page=1&limit=10\"\n },\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/xUgBLQck/publications?page=1&limit=10\"\n },\n \"object\": \"voucher\"\n },\n \"campaign\": {\n \"id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"name\": \"Loyalty Webhooks\",\n \"campaign_type\": \"LOYALTY_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"voucher\": {\n \"type\": \"LOYALTY_CARD\",\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n },\n \"is_referral_code\": false\n },\n \"auto_join\": false,\n \"join_once\": false,\n \"vouchers_count\": 0,\n \"active\": true,\n \"object\": \"campaign\"\n },\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"source_id\": \"Loyal_customer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 1,\n \"total_failed\": 0,\n \"total_succeeded\": 1,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0\n },\n \"orders\": {\n \"total_amount\": 22000,\n \"total_count\": 1,\n \"average_amount\": 22000,\n \"last_order_amount\": 22000,\n \"last_order_date\": \"2021-11-12T11:42:39.633Z\"\n }\n },\n \"loyalty\": {\n \"points\": 218,\n \"referred_customers\": 0,\n \"campaigns\": {\n \"Loyalty Webhooks\": {\n \"points\": 218,\n \"referred_customers\": 0\n }\n }\n },\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-11-12T11:40:18.077Z\",\n \"updated_at\": \"2021-11-12T11:53:07.582Z\",\n \"object\": \"customer\"\n },\n \"publication\": {\n \"id\": \"pub_aFszQ4kOtT1Hori8Wl1i0az1sFQN3CRv\",\n \"created_at\": \"2021-11-12T11:53:03.172Z\",\n \"customer_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"Loyal_customer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"tracking_id\": \"Loyal_customer__01\",\n \"metadata\": {},\n \"channel\": \"API\",\n \"source_id\": null,\n \"result\": \"SUCCESS\",\n \"voucher_code\": \"xUgBLQck\",\n \"vouchers\": [\n {\n \"id\": \"v_ix6p7zxM8m7AdlgObubjP2ibDTCsnEkq\",\n \"code\": \"xUgBLQck\",\n \"campaign\": \"20% discount\",\n \"campaign_id\": \"camp_o9vZ7yIqtj5B9CbhJlKRXIZ5\",\n \"category\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"PERCENT\",\n \"percent_off\": 20,\n \"amount_limit\": 5000\n },\n \"gift\": null,\n \"loyalty_card\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX19pNCYXQ8ztNEb+OaYwP13ZoOfOMBJwzgz2RNchFxoMDPIHS47i8tY+oc3HzEpFr2SqITQ/IdD6V7RuYxsyrcfz53Je6+me6VBl9Pze3p8lTSJWwjp79tKEZHygNMggPsfIEi4Ei3Wt1A==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19pNCYXQ8ztNEb%2BOaYwP13ZoOfOMBJwzgz2RNchFxoMDPIHS47i8tY%2Boc3HzEpFr2SqITQ%2FIdD6V7RuYxsyrcfz53Je6%2Bme6VBl9Pze3p8lTSJWwjp79tKEZHygNMggPsfIEi4Ei3Wt1A%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19a0CQqRE3y6dRDn0Jyr74H85dLNo9MQrXRZFBj9fcDUlaV3Q0uG2xa4l4Ch4WVfPGQ3iEEPpYTMQGwm8xN9cynpCv/upu9ZD9iWat6+nlw+PsKH5CcyNemhfI273GhBOvh5ysRMpFUZQ==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19a0CQqRE3y6dRDn0Jyr74H85dLNo9MQrXRZFBj9fcDUlaV3Q0uG2xa4l4Ch4WVfPGQ3iEEPpYTMQGwm8xN9cynpCv%2Fupu9ZD9iWat6%2Bnlw%2BPsKH5CcyNemhfI273GhBOvh5ysRMpFUZQ%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-11-12T11:53:03.194Z\",\n \"updated_at\": null,\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"object\": \"voucher\",\n \"distributions\": null,\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/xUgBLQck/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"quantity\": 1,\n \"redeemed_quantity\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/xUgBLQck/redemptions?page=1&limit=10\"\n }\n }\n ],\n \"vouchers_id\": [\n \"v_ix6p7zxM8m7AdlgObubjP2ibDTCsnEkq\"\n ],\n \"campaign_name\": \"20% discount\",\n \"gift\": null,\n \"loyalty_card\": null,\n \"discount\": {\n \"type\": \"PERCENT\",\n \"percent_off\": 20,\n \"amount_limit\": 5000\n },\n \"is_referral_code\": false,\n \"failure_code\": null,\n \"failure_message\": null,\n \"voucher\": null\n }\n },\n \"related_object\": {\n \"id\": \"evcus_0a26bb89060c3ad8bc\",\n \"type\": \"customer.reward_redemptions.completed\",\n \"data\": {\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"Loyal_customer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"holder\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"Loyal_customer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"voucher\": {\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"code\": \"qjvEslzU\",\n \"loyalty_card\": {\n \"points\": 220,\n \"balance\": 218\n },\n \"type\": \"LOYALTY_CARD\",\n \"campaign\": \"Loyalty Webhooks\",\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"is_referral_code\": false,\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\"\n },\n \"campaign\": {\n \"id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"name\": \"Loyalty Webhooks\",\n \"campaign_type\": \"LOYALTY_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"is_referral_code\": false,\n \"voucher\": {\n \"type\": \"LOYALTY_CARD\",\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n }\n },\n \"auto_join\": false,\n \"join_once\": false,\n \"active\": true\n },\n \"reward_redemption\": {\n \"id\": \"rewr_uATcoUjIp3VJNgT5TZT5NMaT\",\n \"state\": \"COMPLETED\",\n \"created_at\": \"2021-11-12T11:53:06.025Z\",\n \"updated_at\": null,\n \"voucher_id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"customer_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"reward_assignment_id\": \"rewa_bRTNrtAqXmdHNDe4cNg7y3JC\",\n \"source_id\": \"r_Lbxqqjv59hCRLG3Nkl8E4yYk\",\n \"source_type\": \"redemption\"\n },\n \"reward\": {\n \"assignment_id\": \"rewa_bRTNrtAqXmdHNDe4cNg7y3JC\",\n \"voucher\": {\n \"id\": \"v_ix6p7zxM8m7AdlgObubjP2ibDTCsnEkq\",\n \"code\": \"xUgBLQck\",\n \"discount\": {\n \"type\": \"PERCENT\",\n \"amount_limit\": 5000,\n \"percent_off\": 20\n },\n \"type\": \"DISCOUNT_VOUCHER\",\n \"campaign\": \"20% discount\",\n \"campaign_id\": \"camp_o9vZ7yIqtj5B9CbhJlKRXIZ5\",\n \"is_referral_code\": false,\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\"\n },\n \"id\": \"rew_l7z9yeLGZHJgCsxwNX5tDXqs\",\n \"object\": \"reward\",\n \"name\": \"20% discount\",\n \"type\": \"CAMPAIGN\"\n },\n \"reward_assignment\": {\n \"id\": \"rewa_bRTNrtAqXmdHNDe4cNg7y3JC\",\n \"reward_id\": \"rew_l7z9yeLGZHJgCsxwNX5tDXqs\",\n \"related_object_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"related_object_type\": \"campaign\",\n \"parameters\": {\n \"loyalty\": {\n \"points\": 2\n }\n },\n \"created_at\": \"2021-11-12T11:39:05.504Z\",\n \"updated_at\": null,\n \"object\": \"reward_assignment\"\n },\n \"source\": {\n \"id\": \"r_Lbxqqjv59hCRLG3Nkl8E4yYk\",\n \"type\": \"redemption\"\n },\n \"balance\": null\n },\n \"created_at\": \"2021-11-12T11:53:09.910Z\"\n }\n },\n \"metadata\": {}\n}\n```", + "x-tags": [ + "EVENTS API" + ] + }, + "15_req_track_custom_event": { + "title": "Track Custom Event Request Body", + "type": "object", + "description": "Request schema for tracking a custom event.", + "properties": { + "event": { + "type": "string", + "description": "Event name. This is the same name that you used to define a custom event in the **Dashboard** > **Project Settings** > **Event Schema**." + }, + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "type": "object" + }, + "referral": { + "type": "object", + "description": "If a **conversion event** for a referral program is set to a custom event, then you need to send the referral code in the payload to make a record of the conversion event. ", + "properties": { + "code": { + "type": "string", + "description": "A code through which a new visitor has been referred to a service." + }, + "referrer_id": { + "type": "string", + "description": "Unique ID of the referring person - it is optional and not required if the referral **code** is provided.", + "example": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" + } + } + }, + "loyalty": { + "type": "object", + "description": "If an earning rule in a loyalty program is based on a custom event. This objects let's you specify the loyalty card to which the custom event should be attributed to.", + "properties": { + "code": { + "type": "string", + "description": "Code of the loyalty card to receive points based on the calculation method defined in the related earning rule. An earning rule is triggered for the loyalty card when the event passed in the `event` parameter of the request payload gets sent along with this loyalty card code." } - }, - "filters": { - "$ref": "#/components/schemas/ExportPointsExpirationFilters", - "description": "Filter conditions." } }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the event. A set of key/value pairs that you can attach to an event object. It can be useful for storing additional information about the event in a structured format. Event metadata schema is defined in the **Dashboard** > **Project Settings** > **Event Schema** > **Edit particular event** > **Metadata property definition**." + } } }, - "required": [ - "exported_object" - ] - }, - { - "title": "Export Vouchers Transactions Expiration", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "voucher_transactions" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportVoucherTransactionsOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportVoucherTransactionsFields" + "15_res_track_custom_event": { + "title": "Track Custom Event Request Body", + "type": "object", + "description": "Request schema for tracking a custom event.", + "properties": { + "object": { + "type": "string", + "default": "event", + "description": "The object represented is an `event`." + }, + "type": { + "type": "string", + "description": "The event name." + }, + "customer": { + "type": "object", + "description": "An empty customer object." + }, + "referral": { + "type": "null", + "description": "A `null` referral object." + }, + "loyalty": { + "type": "null", + "description": "A `null` loyalty object." + } + } + }, + "16_obj_export_object": { + "title": "Export Object", + "type": "object", + "description": "This is an object representing an export. \n\nThe `/exports` endpoint allows you to retrieve Voucherify objects such as [vouchers](ref:get-voucher), [redemptions](ref:list-redemptions), [publications](ref:list-publications), [customers](ref:get-customer), and [orders](ref:get-order) as a CSV file. This functionality works asynchronously and comes down to the following steps: \n* create an export object and return its `id` so you can track its `status`\n* trigger a CSV file generation, change the status to `SCHEDULED`\n* when the generation is over, store the file in S3 and change the `status` to `DONE`\n* now you can [get](ref:download-export) it\n\nWith `parameters` you can select which `fields` will be exported and `filter` out the relevant data\n\n\n```json\n{\n \"fields\": [\n \"code\",\n \"voucher_type\"\n ],\n \"filters\": {\n \"categories\": {\n \"conditions\": {\n \"$in\": [\n \"postman\"\n ]\n }\n }\n }\n}\n```\n\n\n## Fields values\nHere is a list of the fields you can export for particular objects. \n| **Object** | **Fields** |\n|:---|:---|\n| voucher | code
voucher_type
value
discount_type
campaign
category
start_date
expiration_date
gift_balance
loyalty_balance
redemption_quantity
redemption_count
active
qr_code
bar_code
id
is_referral_code
created_at
updated_at
validity_timeframe_interval
validity_timeframe_duration
validity_day_of_week
discount_amount_limit
campaign_id
additional_info
customer_id
discount_unit_type
discount_unit_effect
customer_source_id
metadata
metadata.X *where X is the name of a particular metadata property* |\n| redemption | object
date
voucher_code
campaign
promotion_tier_id
customer_id
customer_source_id
customer_name
tracking_id
order_amount
gift_amount
loyalty_points
result
failure_code
failure_message
metadata
metadata.X *where X is the name of a particular metadata property* |\n| publication | voucher_code
customer_id
customer_source_id
date
channel
campaign
is_winner
metadata
metadata.X *where X is the name of a particular metadata property* |\n| customer | name
id
description
email
source_id
created_at
address_city
address_state
address_line_1
address_line_2
address_country
address_postal_code
redemptions_total_redeemed
redemptions_total_failed
redemptions_total_succeeded
redemptions_total_rolled_back
redemptions_total_rollback_failed
redemptions_total_rollback_succeeded
orders_total_amount
orders_total_count
orders_average_amount
orders_last_order_amount
orders_last_order_date
loyalty_points
loyalty_referred_customers
updated_at
phone
birthdate
birthday
metadata
metadata.X *where X is the name of a particular metadata property* |\n| order | id
source_id
status
created_at
updated_at
amount
discount_amount
items_discount_amount
total_discount_amount
total_amount
customer_id
referrer_id
metadata
metadata.X *where X is the name of a particular metadata property* |\n| points expiration | id
campaign_id
voucher_id
expires_at
status
points |\n\n\n## Pagination and example request\nVoucherify allows you to specify the timeframe for the records you want to retrieve. Thanks to this mechanism it should be easy to implement a pagination mechanism. See the example of request body: \n\n\n```json Export Redemption Example\n{\n \"exported_object\": \"redemption\",\n \"parameters\": {\n \"order\": \"-created_at\",\n \"fields\": [\n \"id\",\n \"object\",\n \"date\",\n \"voucher_code\",\n \"customer_id\",\n \"result\"\n ],\n \"filters\": {\n \"junction\": \"and\",\n \"created_at\": {\n \"conditions\": {\n \"$after\": [\n \"2018-05-30T22:00:00.000Z\"\n ],\n \"$before\": [\n \"2018-06-29T22:00:00.000Z\"\n ]\n }\n }\n }\n }\n}\n```\n\nAn export request will almost always result in a single file being generated by the system. However, when your volume of data is large, the system may split the results into multiple chunks.", + "x-tags": [ + "EXPORTS API" + ], + "properties": { + "id": { + "type": "string", + "description": "Unique export ID.", + "example": "exp_FFfp9o7daWuJqJCKp5xqqli4" + }, + "object": { + "type": "string", + "default": "export", + "description": "The type of object being represented. This object stores information about the `export`." + }, + "created_at": { + "type": "string", + "example": "2022-04-28T11:23:20.922Z", + "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format.", + "format": "date-time" + }, + "status": { + "type": "string", + "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.", + "enum": [ + "SCHEDULED", + "IN_PROGRESS", + "DONE", + "ERROR" + ] + }, + "channel": { + "type": "string", + "description": "The channel through which the export was triggered.", + "enum": [ + "API", + "WEBSITE" + ] + }, + "exported_object": { + "type": "string", + "description": "The type of exported object.", + "enum": [ + "order", + "voucher", + "publication", + "redemption", + "customer", + "points_expiration", + "voucher_transactions" + ] + }, + "parameters": { + "anyOf": [ + { + "$ref": "#/components/schemas/16_obj_export_order" + }, + { + "$ref": "#/components/schemas/16_obj_export_voucher" + }, + { + "$ref": "#/components/schemas/16_obj_export_publication" + }, + { + "$ref": "#/components/schemas/16_obj_export_redemption" + }, + { + "$ref": "#/components/schemas/16_obj_export_customer" + }, + { + "$ref": "#/components/schemas/16_obj_export_points_expiration" + }, + { + "$ref": "#/components/schemas/16_obj_export_gift_card_transactions" + }, + { + "$ref": "#/components/schemas/16_obj_export_loyalty_card_transactions" + } + ] + }, + "result": { + "type": "object", + "description": "Contains the URL of the CSV file.", + "properties": { + "url": { + "type": "string", + "description": "URL of the CSV file location. It contains the `token` used for authorization in the [Download export](ref:download-export) method." } - }, - "filters": { - "$ref": "#/components/schemas/ExportVoucherTransactionsFilters", - "description": "Filter conditions." } }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + "user_id": { + "type": "string", + "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the `channel` value is `WEBSITE`.", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH" + } } }, - "required": [ - "exported_object" - ] - } - ], - "type": "object" - }, - "ExportBase": { - "title": "Export Base", - "type": "object", - "additionalProperties": false, - "properties": { - "id": { - "type": "string", - "description": "Unique export ID." - }, - "object": { - "type": "string", - "enum": [ - "export" - ], - "description": "The type of object being represented. This object stores information about the export." - }, - "created_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format." - }, - "status": { - "enum": [ - "SCHEDULED", - "IN_PROGRESS", - "DONE", - "ERROR" - ], - "type": "string", - "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated." - }, - "channel": { - "type": "string", - "description": "The channel through which the export was triggered." - }, - "result": { - "type": [ - "object", - "null" - ], - "required": [ - "url" - ], - "description": "Contains the URL of the CSV file.", - "properties": { - "url": { - "type": "string", - "description": "URL of the CSV file location. It contains the token used for authorization in the Download export method." - } - } - }, - "user_id": { - "type": [ - "string", - "null" - ], - "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE." - } - }, - "required": [ - "id", - "object", - "created_at", - "status", - "result", - "user_id" - ] - }, - "Export": { - "title": "Export", - "allOf": [ - { - "$ref": "#/components/schemas/ExportBase" - }, - { - "anyOf": [ - { - "$ref": "#/components/schemas/ExportVoucher" - }, - { - "$ref": "#/components/schemas/ExportRedemption" - }, - { - "$ref": "#/components/schemas/ExportCustomer" - }, - { - "$ref": "#/components/schemas/ExportPublication" - }, - { - "$ref": "#/components/schemas/ExportOrder" - }, - { - "$ref": "#/components/schemas/ExportPointsExpiration" - }, - { - "$ref": "#/components/schemas/ExportVoucherTransactionsExpiration" + "16_res_list_exports": { + "description": "Response schema for listing exports.", + "type": "object", + "title": "List Exports Response Body", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about exports.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of exports.", + "default": "exports" + }, + "exports": { + "type": "array", + "uniqueItems": true, + "description": "An array of export objects.", + "items": { + "$ref": "#/components/schemas/16_obj_export_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of exports." + } } - ] - } - ] - }, - "ExportsCreateResponseBody": { - "allOf": [ - { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique export ID." - }, - "object": { - "type": "string", - "enum": [ - "export" - ], - "description": "The type of object being represented. This object stores information about the export." - }, - "created_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format." - }, - "status": { - "type": "string", - "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.", - "enum": [ - "SCHEDULED" - ] - }, - "channel": { - "type": "string", - "description": "The channel through which the export was triggered." - }, - "result": { - "type": "null", - "description": "Contains the URL of the CSV file." - }, - "user_id": { - "type": "string", - "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE." + }, + "16_req_create_export_POST": { + "description": "Request schema for creating an export.", + "type": "object", + "title": "Create Export Request Body", + "properties": { + "exported_object": { + "type": "string", + "description": "The type of object to be exported.", + "enum": [ + "order", + "voucher", + "publication", + "redemption", + "customer", + "points_expiration", + "voucher_transactions" + ] + }, + "parameters": { + "anyOf": [ + { + "$ref": "#/components/schemas/16_obj_export_order" + }, + { + "$ref": "#/components/schemas/16_obj_export_voucher" + }, + { + "$ref": "#/components/schemas/16_obj_export_publication" + }, + { + "$ref": "#/components/schemas/16_obj_export_redemption" + }, + { + "$ref": "#/components/schemas/16_obj_export_customer" + }, + { + "$ref": "#/components/schemas/16_obj_export_points_expiration" + }, + { + "$ref": "#/components/schemas/16_obj_export_gift_card_transactions" + }, + { + "$ref": "#/components/schemas/16_obj_export_loyalty_card_transactions" + } + ] + } } }, - "required": [ - "id", - "object", - "created_at", - "status", - "result", - "user_id" - ] - }, - { - "anyOf": [ - { - "$ref": "#/components/schemas/ExportVoucher" - }, - { - "$ref": "#/components/schemas/ExportRedemption" - }, - { - "$ref": "#/components/schemas/ExportCustomer" - }, - { - "$ref": "#/components/schemas/ExportPublication" - }, - { - "$ref": "#/components/schemas/ExportOrder" - }, - { - "$ref": "#/components/schemas/ExportPointsExpiration" - }, - { - "$ref": "#/components/schemas/ExportVoucherTransactionsExpiration" + "16_obj_export_order": { + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data.", + "title": "order", + "type": "object", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "-created_at", + "created_at", + "updated_at", + "-updated_at", + "status", + "-status" + ] + }, + "fields": { + "type": "array", + "enum": [ + [ + "id", + "source_id", + "created_at", + "updated_at", + "status", + "amount", + "discount_amount", + "items_discount_amount", + "total_discount_amount", + "total_amount", + "customer_id", + "referrer_id", + "metadata" + ] + ], + "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique order ID. | ord_A69RIxEdRsPuC6i8gFGVHUft |\n| source_id | Unique order source ID. | 8638 |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the order was created. | 2022-03-09T09:16:32.521Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the order was last updated. | 2022-03-09T09:16:33.331Z |\n| status | Order status. | `PAID`, `CREATED`, `FULFILLED`, `CANCELED` |\n| amount | Total amount of order items. | 7700 |\n| discount_amount | Represents total amount of the discount applied to whole cart. | 500 |\n| items_discount_amount | Represents total amount of the discount applied to order line items. | 100 |\n| total_discount_amount | All discounts applied to the order including discounts applied to particular order line items and discounts applied to the whole cart. | 600 |\n| total_amount | Total order amount after applying all discounts. | 7100 |\n| customer_id | Customer unique ID. | cust_2G4fUQdCXUqp35nXNleav7bO |\n| referrer_id | Referrer unique ID. | cust_IkrTR674vvQvr9a4rDMiqglY |\n| metadata | Returns all order metadata. | Response will include all order metadata. |\n| metadata.X | Where X is the name of a particular order metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Order. [Read more here](https://support.voucherify.io/article/99-schema-validation-metadata). |", + "items": { + "type": "string" + } + }, + "filters": { + "anyOf": [ + { + "$ref": "#/components/schemas/16_obj_filter_order_status" + }, + { + "$ref": "#/components/schemas/16_obj_filter_order_source_id" + }, + { + "$ref": "#/components/schemas/16_obj_filter_order_amount" + }, + { + "$ref": "#/components/schemas/16_obj_filter_order_total_amount" + }, + { + "$ref": "#/components/schemas/16_obj_filter_order_discount_amount" + }, + { + "$ref": "#/components/schemas/16_obj_filter_order_total_discount_amount" + }, + { + "$ref": "#/components/schemas/16_obj_filter_order_items_discount_amount" + } + ] + } } - ] - } - ], - "title": "" - }, - "ExportVoucher": { - "title": "Export Vouchers", - "type": "object", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "voucher" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportVoucherOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportVoucherFields" + }, + "16_obj_export_voucher": { + "description": "List of available fields and filters that can be exported with a voucher along with the sorting order of the returned data.", + "title": "voucher", + "type": "object", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at", + "code", + "-code" + ] + }, + "fields": { + "type": "array", + "enum": [ + [ + "code", + "voucher_type", + "value", + "discount_type", + "campaign", + "category", + "start_date", + "expiration_date", + "gift_balance", + "loyalty_balance", + "redemption_quantity", + "redemption_count", + "active", + "qr_code", + "bar_code", + "id", + "is_referral_code", + "created_at", + "updated_at", + "validity_timeframe_interval", + "validity_timeframe_duration", + "validity_day_of_week", + "discount_amount_limit", + "campaign_id", + "additional_info", + "customer_id", + "discount_unit_type", + "discount_unit_effect", + "customer_source_id", + "metadata" + ] + ], + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique voucher ID. | v_HSnGD2vNIHYighTQxwcB4dtVAv8VOmZD |\n| code | Unique voucher code. | WELCOME100 |\n| voucher_type | Type of voucher. | `DISCOUNT_VOUCHER`, `GIFT_VOUCHER`, `LOYALTY_CARD` |\n| value | Value of voucher. | `DISCOUNT_VOUCHER` : amount, percent, unit
`GIFT_VOUCHER`: amount left to spend
`LOYALTY_CARD`: available usable points |\n| discount_type | The type of discount for a `DISCOUNT_VOUCHER`. | `AMOUNT`, `PERCENT`, `UNIT`, `FIXED` |\n| campaign | Unique campaign name. | Summer Discounts 20% off |\n| category | Tag defining the category that this voucher belongs to. | |\n| start_date | Start date defines when the code starts to be active. Activation timestamp in ISO 8601 format. Voucher is _inactive_ before this date. | 2020-12-10T23:00:00.000Z |\n| expiration_date | Expiration date defines when the code expires. Expiration timestamp in ISO 8601 format. Voucher is _inactive_ after this date. | 2023-12-31T23:00:00.000Z |\n| gift_balance | Amount left to spend. | 1000 |\n| loyalty_balance | Available usable points. | 2000 |\n| redemption_quantity | Maximum number of times a voucher can be redeemed. | 2 |\n| redemption_count | Total redemptions. | 59 |\n| active | Boolean indicating whether the voucher is available for use. | `true`, `false` |\n| qr_code | URL to QR representation of encrypted code. | |\n| bar_code | URL to barcode representation of encrypted code. | |\n| is_referral_code | Boolean indicating whether the voucher is a referral code. | `true`, `false` |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the voucher was created. | 2022-04-14T09:55:46.814Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the voucher was last updated. | 2022-04-14T10:02:18.036Z |\n| validity_timeframe_interval | Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an interval of `P2D` will be active every other day. | P2D |\n| validity_timeframe_duration | Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a duration of `PT1H` will be valid for a duration of one hour. | PT1H |\n| validity_day_of_week | Array corresponding to the particular days of the week in which the voucher is valid. | \"1,2,3,4,5\" |\n| discount_amount_limit | For `PERCENT` discount type, this is the maximum threshold allowed to be deducted. | 50 |\n| campaign_id | Parent campaign ID. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| additional_info | An optional field to keep any extra textual information about the code such as a code description and details. | |\n| customer_id | Unique customer ID of the assigned owner to whom the voucher was published. | cust_7iUa6ICKyU6gH40dBU25kQU1 |\n| discount_unit_type | For `UNIT` discount type, either a shipping or product ID for a `UNIT` discount with one product. | prod_5h1pp1ng, prod_0a9f9aeddb019a42db |\n| discount_unit_effect | `UNIT` discount effect. | `ADD_MANY_ITEMS`, `ADD_MISSING_ITEMS`,`ADD_NEW_ITEMS` |\n| customer_source_id | Unique customer source id of the assigned owner to whom the voucher was published. | name.lastname@email.com |\n| metadata | Returns all voucher metadata. | Response will include all voucher metadata. |\n| metadata.X | Where X is the name of a particular voucher metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Voucher. [Read more here](https://support.voucherify.io/article/99-schema-validation-metadata). |\n", + "items": { + "type": "string" + } + }, + "filters": { + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the export. You can filter the following parameters: \n\n - `categories`\n\n - `vouchers`\n\n - `type`\n\n - `holder_id`\n\n - `is_referral_code`\n\n - `published_for_customer_id`\n\n - `validity_timeframe`\n\n - `category_ids`" } - }, - "filters": { - "$ref": "#/components/schemas/ExportVoucherFilters", - "description": "Filter conditions." } - } - } - }, - "required": [ - "exported_object", - "parameters" - ] - }, - "FieldConditions": { - "title": "Field Conditions", - "type": "object", - "properties": { - "conditions": { - "$ref": "#/components/schemas/FiltersCondition", - "description": "Data filters used to narrow the data records to be returned in the result." - } - } - }, - "FiltersCondition": { - "title": "Filters Condition", - "type": "object", - "properties": { - "$in": { - "$ref": "#/components/schemas/Any" - }, - "$not_in": { - "$ref": "#/components/schemas/Any" - }, - "$is": { - "$ref": "#/components/schemas/Any" - }, - "$is_days_ago": { - "$ref": "#/components/schemas/Any" - }, - "$is_days_in_future": { - "$ref": "#/components/schemas/Any" - }, - "$is_not": { - "$ref": "#/components/schemas/Any" - }, - "$has_value": { - "$ref": "#/components/schemas/Any" - }, - "$is_unknown": { - "$ref": "#/components/schemas/Any" - }, - "$contains": { - "$ref": "#/components/schemas/Any" - }, - "$not_contain": { - "$ref": "#/components/schemas/Any" - }, - "$starts_with": { - "$ref": "#/components/schemas/Any" - }, - "$ends_with": { - "$ref": "#/components/schemas/Any" - }, - "$more_than": { - "$ref": "#/components/schemas/Any" - }, - "$less_than": { - "$ref": "#/components/schemas/Any" - }, - "$more_than_ago": { - "$ref": "#/components/schemas/Any" - }, - "$less_than_ago": { - "$ref": "#/components/schemas/Any" - }, - "$more_than_future": { - "$ref": "#/components/schemas/Any" - }, - "$less_than_future": { - "$ref": "#/components/schemas/Any" - }, - "$more_than_equal": { - "$ref": "#/components/schemas/Any" - }, - "$less_than_equal": { - "$ref": "#/components/schemas/Any" - }, - "$after": { - "$ref": "#/components/schemas/Any" - }, - "$before": { - "$ref": "#/components/schemas/Any" - }, - "$count": { - "$ref": "#/components/schemas/Any" - }, - "$count_less": { - "$ref": "#/components/schemas/Any" - }, - "$count_more": { - "$ref": "#/components/schemas/Any" - } - } - }, - "ExportVoucherFilters": { - "title": "Export Voucher Filters", - "type": "object", - "properties": { - "junction": { - "$ref": "#/components/schemas/Junction", - "description": "Filter by conditions set on the junction parameter indicating how the conditions should be accounted for in the query. An AND is an all-inclusive logical operator, meaning the AND operator displays a record if ALL the conditions separated by AND are TRUE, while an OR operator displays a record if ANY of the conditions separated by OR is TRUE." - }, - "code": { - "$ref": "#/components/schemas/FieldConditions" - }, - "voucher_type": { - "$ref": "#/components/schemas/FieldConditions" - }, - "value": { - "$ref": "#/components/schemas/FieldConditions" - }, - "discount_type": { - "$ref": "#/components/schemas/FieldConditions" - }, - "campaign": { - "$ref": "#/components/schemas/FieldConditions" - }, - "category": { - "$ref": "#/components/schemas/FieldConditions" - }, - "start_date": { - "$ref": "#/components/schemas/FieldConditions" - }, - "expiration_date": { - "$ref": "#/components/schemas/FieldConditions" - }, - "gift_balance": { - "$ref": "#/components/schemas/FieldConditions" - }, - "loyalty_balance": { - "$ref": "#/components/schemas/FieldConditions" - }, - "redemption_quantity": { - "$ref": "#/components/schemas/FieldConditions" - }, - "redemption_count": { - "$ref": "#/components/schemas/FieldConditions" - }, - "active": { - "$ref": "#/components/schemas/FieldConditions" - }, - "qr_code": { - "$ref": "#/components/schemas/FieldConditions" - }, - "bar_code": { - "$ref": "#/components/schemas/FieldConditions" - }, - "metadata": { - "$ref": "#/components/schemas/FieldConditions" - }, - "id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "is_referral_code": { - "$ref": "#/components/schemas/FieldConditions" - }, - "created_at": { - "$ref": "#/components/schemas/FieldConditions" - }, - "updated_at": { - "$ref": "#/components/schemas/FieldConditions" - }, - "validity_timeframe_interval": { - "$ref": "#/components/schemas/FieldConditions" - }, - "validity_timeframe_duration": { - "$ref": "#/components/schemas/FieldConditions" - }, - "validity_day_of_week": { - "$ref": "#/components/schemas/FieldConditions" - }, - "discount_amount_limit": { - "$ref": "#/components/schemas/FieldConditions" - }, - "campaign_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "additional_info": { - "$ref": "#/components/schemas/FieldConditions" - }, - "customer_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "discount_unit_type": { - "$ref": "#/components/schemas/FieldConditions" - }, - "discount_unit_effect": { - "$ref": "#/components/schemas/FieldConditions" - }, - "customer_source_id": { - "$ref": "#/components/schemas/FieldConditions" - } - } - }, - "Junction": { - "title": "Junction", - "enum": [ - "and", - "AND", - "or", - "OR" - ], - "type": "string" - }, - "ExportRedemption": { - "title": "Export Redemptions", - "type": "object", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "redemption" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportRedemptionOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportRedemptionFields" + }, + "16_obj_export_publication": { + "description": "List of available fields and filters that can be exported with a publication along with the sorting order of the returned data.", + "title": "publication", + "type": "object", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "id", + "-id", + "voucher_code", + "-voucher_code", + "tracking_id", + "-tracking_id", + "customer_id", + "-customer_id", + "created_at", + "-created_at", + "channel", + "-channel" + ] + }, + "fields": { + "type": "array", + "enum": [ + [ + "voucher_code", + "customer_id", + "customer_source_id", + "date", + "channel", + "campaign", + "is_winner", + "metadata" + ] + ], + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| voucher_code | Unique voucher code. | WELCOME100 |\n| customer_id | Customer unique ID. | cust_7iUa6ICKyU6gH40dBU25kQU1 |\n| customer_source_id | Unique customer source id of the assigned owner to whom the voucher was published. | name.lastname@email.com |\n| date | Timestamp in ISO 8601 format representing the date and time when the voucher was published. | 2022-04-28T10:19:30.792Z |\n| channel | Publication channel. | voucherify-website |\n| campaign | Unique campaign name. | Summer Discounts 20% off |\n| is_winner | | |\n| metadata | Returns all publication metadata. | Response will include all publication metadata. |\n| metadata.X | Where X is the name of a particular publication metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Publication. [Read more here](https://support.voucherify.io/article/99-schema-validation-metadata) |", + "items": { + "type": "string" + } + }, + "filters": { + "description": "Data filters used to narrow the data records to be returned in the export. You can filter the following parameters: \n\n - `failure_code`\n\n - `result`\n\n - `customer_id`\n\n - `campaign_name`\n\n - `voucher_type`\n\n - `is_referral_code`\n\n - `parent_object_id`\n\n - `related_object_id`\n\n - `source_id`", + "anyOf": [ + { + "$ref": "#/components/schemas/16_obj_filter_publication_failure_code" + }, + { + "$ref": "#/components/schemas/16_obj_filter_publication_result" + }, + { + "$ref": "#/components/schemas/16_obj_filter_publication_customer_id" + }, + { + "$ref": "#/components/schemas/16_obj_filter_publication_campaign_name" + }, + { + "$ref": "#/components/schemas/16_obj_filter_publication_voucher_type" + }, + { + "$ref": "#/components/schemas/16_obj_filter_publication_is_referral_code" + }, + { + "$ref": "#/components/schemas/16_obj_filter_publication_parent_object_id" + }, + { + "$ref": "#/components/schemas/16_obj_filter_publication_related_object_id" + }, + { + "$ref": "#/components/schemas/16_obj_filter_publication_source_id" + } + ] } - }, - "filters": { - "$ref": "#/components/schemas/ExportRedemptionFilters", - "description": "Filter conditions." } }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." - } - }, - "required": [ - "exported_object", - "parameters" - ] - }, - "ExportRedemptionFilters": { - "title": "Export Redemption Filters", - "type": "object", - "additionalProperties": false, - "properties": { - "junction": { - "$ref": "#/components/schemas/Junction" - }, - "id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "object": { - "$ref": "#/components/schemas/FieldConditions" - }, - "date": { - "$ref": "#/components/schemas/FieldConditions" - }, - "voucher_code": { - "$ref": "#/components/schemas/FieldConditions" - }, - "campaign": { - "$ref": "#/components/schemas/FieldConditions" - }, - "promotion_tier_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "customer_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "customer_source_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "customer_name": { - "$ref": "#/components/schemas/FieldConditions" - }, - "tracking_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "order_amount": { - "$ref": "#/components/schemas/FieldConditions" - }, - "gift_amount": { - "$ref": "#/components/schemas/FieldConditions" - }, - "loyalty_points": { - "$ref": "#/components/schemas/FieldConditions" - }, - "result": { - "$ref": "#/components/schemas/FieldConditions" - }, - "failure_code": { - "$ref": "#/components/schemas/FieldConditions" - }, - "failure_message": { - "$ref": "#/components/schemas/FieldConditions" - }, - "metadata": { - "$ref": "#/components/schemas/FieldConditions" - } - } - }, - "ExportCustomer": { - "title": "Export Customers", - "type": "object", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "customer" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportCustomerOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportCustomerFields" + "16_obj_export_redemption": { + "description": "List of available fields and filters that can be exported with a redemption along with the sorting order of the returned data.", + "title": "redemption", + "type": "object", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "id", + "-id", + "voucher_code", + "-voucher_code", + "tracking_id", + "-tracking_id", + "customer_id", + "-customer_id", + "created_at", + "-created_at" + ] + }, + "fields": { + "type": "array", + "enum": [ + [ + "id", + "object", + "date", + "voucher_code", + "campaign", + "promotion_tier_id", + "customer_id", + "customer_source_id", + "customer_name", + "tracking_id", + "order_amount", + "gift_amount", + "loyalty_points", + "result", + "failure_code", + "failure_message", + "metadata" + ] + ], + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique redemption ID. | r_0acf3a6dae00e679c8, rf_0acf3a495740e679b8 |\n| object | Object being exported; by default `redemption`. | redemption |\n| date | Timestamp in ISO 8601 format representing the date and time when the voucher was redeemed. | 2022-03-23T08:52:24.867Z |\n| voucher_code | Unique voucher code redeemed. | WELCOME100 |\n| campaign | Parent campaign name of voucher if applicable. | Summer Discounts 20% off |\n| promotion_tier_id | | promo_Mwy9XpA0TLctSGriM5kum0qp |\n| customer_id | Unique customer ID of redeeming customer. | cust_nk0N1uNQ1YnupAoJGOgvsODC |\n| customer_source_id | Unique source ID of redeeming customer. | name.lastname@email.com |\n| customer_name | Customer name. | John Smith |\n| tracking_id | | track_Pw6r3ejnml43kIwNS4Zj09KZ67xOfLUy |\n| order_amount | Total order amount before applying all discounts. | 1000 |\n| gift_amount | Gift credits used for redemption. | 10 |\n| loyalty_points | | 12 |\n| result | Tells you whether the redemption succeeded. | `SUCCESS`, `FAILURE` |\n| failure_code | Internal Voucherify code for reason why redemption failed. | invalid_customer |\n| failure_message | A human-readable message providing a short description explaining why the redemption failed. | Customer must be a holder of a loyalty card. |\n| metadata | Returns all redemption metadata. | Response will include all redemption metadata. |\n| metadata.X | Where X is the name of a particular redemption metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Redemption. [Read more here](https://support.voucherify.io/article/99-schema-validation-metadata) |", + "items": { + "type": "string" + } + }, + "filters": { + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the export. You can filter the following parameters: \n\n - `voucher_code`\n\n - `related_object_id`\n\n - `related_object_parent_id`\n\n - `parent_redemption_id`\n\n - `failure_code`\n\n - `result`\n\n - `object`\n\n - `customer_id`\n\n - `campaign_name`\n\n - `user_login`" } - }, - "filters": { - "$ref": "#/components/schemas/ExportCustomerFilters", - "description": "Filter conditions." } }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." - } - }, - "required": [ - "exported_object", - "parameters" - ] - }, - "ExportCustomerFilters": { - "title": "Export Customer Filters", - "type": "object", - "properties": { - "junction": { - "$ref": "#/components/schemas/Junction" - }, - "name": { - "$ref": "#/components/schemas/FieldConditions" - }, - "id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "description": { - "$ref": "#/components/schemas/FieldConditions" - }, - "email": { - "$ref": "#/components/schemas/FieldConditions" - }, - "source_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "created_at": { - "$ref": "#/components/schemas/FieldConditions" - }, - "address_city": { - "$ref": "#/components/schemas/FieldConditions" - }, - "address_state": { - "$ref": "#/components/schemas/FieldConditions" - }, - "address_line_1": { - "$ref": "#/components/schemas/FieldConditions" - }, - "address_line_2": { - "$ref": "#/components/schemas/FieldConditions" - }, - "address_country": { - "$ref": "#/components/schemas/FieldConditions" - }, - "address_postal_code": { - "$ref": "#/components/schemas/FieldConditions" - }, - "redemptions_total_redeemed": { - "$ref": "#/components/schemas/FieldConditions" - }, - "redemptions_total_failed": { - "$ref": "#/components/schemas/FieldConditions" - }, - "redemptions_total_succeeded": { - "$ref": "#/components/schemas/FieldConditions" - }, - "redemptions_total_rolled_back": { - "$ref": "#/components/schemas/FieldConditions" - }, - "redemptions_total_rollback_failed": { - "$ref": "#/components/schemas/FieldConditions" - }, - "redemptions_total_rollback_succeeded": { - "$ref": "#/components/schemas/FieldConditions" - }, - "orders_total_amount": { - "$ref": "#/components/schemas/FieldConditions" - }, - "orders_total_count": { - "$ref": "#/components/schemas/FieldConditions" - }, - "orders_average_amount": { - "$ref": "#/components/schemas/FieldConditions" - }, - "orders_last_order_amount": { - "$ref": "#/components/schemas/FieldConditions" - }, - "orders_last_order_date": { - "$ref": "#/components/schemas/FieldConditions" - }, - "loyalty_points": { - "$ref": "#/components/schemas/FieldConditions" - }, - "loyalty_referred_customers": { - "$ref": "#/components/schemas/FieldConditions" - }, - "updated_at": { - "$ref": "#/components/schemas/FieldConditions" - }, - "phone": { - "$ref": "#/components/schemas/FieldConditions" - }, - "birthday": { - "$ref": "#/components/schemas/FieldConditions" - }, - "metadata": { - "$ref": "#/components/schemas/FieldConditions" - }, - "birthdate": { - "$ref": "#/components/schemas/FieldConditions" - } - } - }, - "ExportPublication": { - "title": "Export Publications", - "type": "object", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "publication" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportPublicationOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportPublicationFields" + "16_obj_export_customer": { + "description": "List of available fields and filters that can be exported with a customer along with the sorting order of the returned data.", + "title": "customer", + "type": "object", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "name", + "-name", + "id", + "-id", + "email", + "-email", + "source_id", + "-source_id", + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + }, + "fields": { + "type": "array", + "enum": [ + [ + "name", + "id", + "description", + "email", + "source_id", + "created_at", + "address_city", + "address_state", + "address_line_1", + "address_line_2", + "address_country", + "address_postal_code", + "redemptions_total_redeemed", + "redemptions_total_failed", + "redemptions_total_succeeded", + "redemptions_total_rolled_back", + "redemptions_total_rollback_failed", + "redemptions_total_rollback_succeeded", + "orders_total_amount", + "orders_total_count", + "orders_average_amount", + "orders_last_order_amount", + "orders_last_order_date", + "loyalty_points", + "loyalty_referred_customers", + "updated_at", + "phone", + "birthday", + "metadata", + "birthdate" + ] + ], + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| name | Customer name. | John Smith |\n| id | Unique customer ID. | cust_J1CDUdbqn5Exva8ASWk1Fq0j |\n| description | An arbitrary string that you can attach to a customer object. | Customer requesting to be added to VIP tier. |\n| email | Customer's email. | name.lastname@email.com |\n| source_id | Unique custom customer identifier. | name.lastname@email.com |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the customer was created. | 2022-02-03T13:10:11.928Z |\n| address_city | City | Houston |\n| address_state | State | TX |\n| address_line_1 | First line of customer's address. | 72738 Main St |\n| address_line_2 | Second line of customer's address. | Bld 2, Apt 4 |\n| address_country | Country | United States of America |\n| address_postal_code | Postal code (ZIP code) | 77042-4143 |\n| redemptions_total_redeemed | Total customer redemptions. | 5 |\n| redemptions_total_failed | Total customer failed redemptions. | 2 |\n| redemptions_total_succeeded | Total customer succeeded redemptions. | 3 |\n| redemptions_total_rolled_back | Total customer redemptions that were rolled back. | 3 |\n| redemptions_total_rollback_failed | Total customer redemptions that were unsuccessfully rolled back. | 2 |\n| redemptions_total_rollback_succeeded | Total customer redemptions that were successfully rolled back. | 1 |\n| orders_total_amount | Total sum of order amounts over customer lifetime. Value is multiplied by 100 to precisely represent 2 decimal places. | 10000 (represents $100) |\n| orders_total_count | Total number of customer orders. Value is multiplied by 100 to precisely represent 2 decimal places. | 2 |\n| orders_average_amount | Average amount spent on orders. Value is multiplied by 100 to precisely represent 2 decimal places. | 50 |\n| orders_last_order_amount | How much did the customer spend on their last order. Value is multiplied by 100 to precisely represent 2 decimal places. | 50 |\n| orders_last_order_date | When was the last customer order; timestamp in ISO 8601 format representing the date and time. | 2022-02-03T13:17:30.630Z |\n| loyalty_points | Sum of customer's loyalty points to go across all loyalty cards. | |\n| loyalty_referred_customers | How many customers were referred by this customer. | |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the customer was updated. | 2022-02-14T14:10:14.305Z |\n| phone | Customer's phone number. | +1 (294) 752-1846 |\n| birthday | Customer's birthday. | 2022-01-01 |\n| birthdate | Customer's birthdate. | 2022-04-29 |\n| metadata | Returns all customer metadata. | Response will include all customer metadata. |\n| metadata.X | Where X is the name of a particular customer metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Customer. [Read more here](https://support.voucherify.io/article/99-schema-validation-metadata) |", + "items": { + "type": "string" + } + }, + "filters": { + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the export. You can filter the following parameters: \n\n - `name` (string)\n\n - `email` (string)\n\n - `phone` (string)\n\n - `metadata` (json)\n\n - `metadata.X` (?)\n\n - `address` (json)\n\n - `address.state` (string)\n\n - `address.country` (string)\n\n - `address.postal_code` (string)\n\n - `birthday` (string - date-time)\n\n - `birthdate` (string date-time)\n\n - `created_at` (date)\n\n - `source_id` (string)\n\n - `system.metadata` (json)\n\n - `system.metadata.source` (string)\n\n - `system.metadata.consents.unsubscribed` (boolean)\n\n - `loyalty_points` (json)\n\n - `loyalty` (json)\n\n - `summary.orders.total_amount` (json)\n\n - `summary.orders.last_order_date` (date)\n\n - `summary.orders.last_order_amount` (json)\n\n - `summary.redemptions.gift.redeemed_amount` (integer)\n\n - `summary.redemptions.total_succeeded` (integer)\n\n - `events.cart_abandoned.last_occurred` (integer)\n\n - `events.newsletter_subscribed.count` (integer)\n\n - `events.sign_up.last_occurred` (integer)" } - }, - "filters": { - "$ref": "#/components/schemas/ExportPublicationFilters", - "description": "Filter conditions." } }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." - } - }, - "required": [ - "exported_object", - "parameters" - ] - }, - "ExportPublicationFilters": { - "title": "Export Publication Filters", - "type": "object", - "properties": { - "junction": { - "$ref": "#/components/schemas/Junction" - }, - "voucher_code": { - "$ref": "#/components/schemas/FieldConditions" - }, - "customer_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "customer_source_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "date": { - "$ref": "#/components/schemas/FieldConditions" - }, - "channel": { - "$ref": "#/components/schemas/FieldConditions" - }, - "campaign": { - "$ref": "#/components/schemas/FieldConditions" - }, - "is_winner": { - "$ref": "#/components/schemas/FieldConditions" - }, - "metadata": { - "$ref": "#/components/schemas/FieldConditions" - } - } - }, - "ExportOrder": { - "title": "Export Orders", - "type": "object", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "order" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportOrderOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportOrderFields" + "16_obj_export_points_expiration": { + "description": "List of available fields and filters that can be exported with points expirations along with the sorting order of the returned data.", + "title": "points expiration", + "type": "object", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "expires_at", + "-expires_at" + ] + }, + "fields": { + "type": "array", + "enum": [ + [ + "id", + "campaign_id", + "voucher_id", + "status", + "expires_at", + "points" + ] + ], + "description": "Array of strings containing the data that was exported. These fields define the headers in the CSV file. \n\n The array can be a combintation of any of the following available fields: \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n |\n| campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 |\n| status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` |\n| expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 |\n| points | Number of points. | 1000 |", + "items": { + "type": "string" + } + }, + "filters": { + "description": "Data filters used to narrow the data records to be returned in the export. You can filter the following parameters: \n\n - `campaign_id`\n\n - `voucher_id`", + "anyOf": [ + { + "$ref": "#/components/schemas/16_obj_filter_points_expiration_campaign_id" + }, + { + "$ref": "#/components/schemas/16_obj_filter_points_expiration_voucher_id" + } + ] } - }, - "filters": { - "$ref": "#/components/schemas/ExportOrderFilters", - "description": "Filter conditions." } }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." - } - }, - "required": [ - "exported_object", - "parameters" - ] - }, - "ExportOrderFilters": { - "title": "Export Order Filters", - "type": "object", - "additionalProperties": false, - "properties": { - "junction": { - "$ref": "#/components/schemas/Junction" - }, - "id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "source_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "created_at": { - "$ref": "#/components/schemas/FieldConditions" - }, - "updated_at": { - "$ref": "#/components/schemas/FieldConditions" - }, - "status": { - "$ref": "#/components/schemas/FieldConditions" - }, - "amount": { - "$ref": "#/components/schemas/FieldConditions" - }, - "discount_amount": { - "$ref": "#/components/schemas/FieldConditions" - }, - "items_discount_amount": { - "$ref": "#/components/schemas/FieldConditions" - }, - "total_discount_amount": { - "$ref": "#/components/schemas/FieldConditions" - }, - "total_amount": { - "$ref": "#/components/schemas/FieldConditions" - }, - "customer_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "referrer_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "metadata": { - "$ref": "#/components/schemas/FieldConditions" - } - } - }, - "ExportPointsExpiration": { - "title": "Export Points Expirations", - "type": "object", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "points_expiration" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportPointsExpirationOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportPointsExpirationFields" + "16_obj_export_gift_card_transactions": { + "description": "List of available fields and filters that can be exported with gift card transactions along with the sorting order of the returned data.", + "title": "gift card transactions", + "type": "object", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "-created_at", + "created_at" + ] + }, + "fields": { + "type": "array", + "enum": [ + [ + "id", + "type", + "source_id", + "reason", + "balance", + "amount", + "created_at", + "voucher_id", + "campaign_id", + "source", + "details" + ] + ], + "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
- `CREDITS_ADDITION`
- `CREDITS_REFUND`
- `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |", + "items": { + "type": "string" + } + }, + "filters": { + "$ref": "#/components/schemas/16_obj_filter_gift_card_transactions_voucher_id" } - }, - "filters": { - "$ref": "#/components/schemas/ExportPointsExpirationFilters", - "description": "Filter conditions." } }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." - } - }, - "required": [ - "exported_object", - "parameters" - ] - }, - "ExportPointsExpirationFilters": { - "title": "Export Points Expiration Filters", - "type": "object", - "properties": { - "junction": { - "$ref": "#/components/schemas/Junction" - }, - "id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "campaign_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "voucher_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "points": { - "$ref": "#/components/schemas/FieldConditions" - }, - "status": { - "$ref": "#/components/schemas/FieldConditions" - }, - "expires_at": { - "$ref": "#/components/schemas/FieldConditions" - } - } - }, - "ExportVoucherTransactionsExpiration": { - "title": "Export Vouchers Transactions Expiration", - "type": "object", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "voucher_transactions" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportVoucherTransactionsOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportVoucherTransactionsFields" + "16_obj_export_loyalty_card_transactions": { + "description": "List of available fields and filters that can be exported with loyalty card transactions along with the sorting order of the returned data.", + "title": "loyalty card transactions", + "type": "object", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "-created_at", + "created_at" + ] + }, + "fields": { + "type": "array", + "enum": [ + [ + "id", + "type", + "source_id", + "reason", + "balance", + "amount", + "created_at", + "voucher_id", + "campaign_id", + "details", + "related_transaction_id" + ] + ], + "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID assigned by Voucherify. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `POINTS_EXPIRATION`
- `POINTS_ADDITION`
- `POINTS_REMOVAL`
- `POINTS_TRANSFER_OUT`
- `POINTS_ACCRUAL`
- `POINTS_REFUND`
- `POINTS_REDEMPTION` |\n| source_id | Custom source ID of the transaction if one was included originally. | source_id_custom |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The loyalty card balance after the transaction. | |\n| amount | The amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | - `API`
- `voucherify-web-ui`
- `Automation` |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n| related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |", + "items": { + "type": "string" + } + }, + "filters": { + "$ref": "#/components/schemas/16_obj_filter_loyalty_card_transactions_voucher_id" } - }, - "filters": { - "$ref": "#/components/schemas/ExportVoucherTransactionsFilters", - "description": "Filter conditions." } }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." - } - }, - "required": [ - "exported_object", - "parameters" - ] - }, - "ExportVoucherTransactionsFilters": { - "title": "Export Voucher Transactions Filters", - "type": "object", - "properties": { - "junction": { - "$ref": "#/components/schemas/Junction" - }, - "id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "campaign_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "voucher_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "type": { - "$ref": "#/components/schemas/FieldConditions" - }, - "source_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "reason": { - "$ref": "#/components/schemas/FieldConditions" - }, - "source": { - "$ref": "#/components/schemas/FieldConditions" - }, - "balance": { - "$ref": "#/components/schemas/FieldConditions" - }, - "amount": { - "$ref": "#/components/schemas/FieldConditions" - }, - "related_transaction_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "created_at": { - "$ref": "#/components/schemas/FieldConditions" - }, - "details": { - "$ref": "#/components/schemas/FieldConditions" - } - } - }, - "ExportsGetResponseBody": { - "$ref": "#/components/schemas/Export", - "title": "" - }, - "ExportsListResponseBody": { - "title": "Exports List Response Body", - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "description": "The type of object represented by JSON. This object stores information about exports." - }, - "data_ref": { - "type": "string", - "enum": [ - "exports" - ], - "description": "Identifies the name of the attribute that contains the array of exports." - }, - "exports": { - "type": "array", - "description": "An array of export objects.", - "items": { - "$ref": "#/components/schemas/Export" - } - }, - "total": { - "type": "integer", - "description": "Total number of exports." - } - }, - "required": [ - "object", - "data_ref", - "exports", - "total" - ] - }, - "ExportCustomerFields": { - "type": "string", - "enum": [ - "name", - "id", - "description", - "email", - "source_id", - "created_at", - "address_city", - "address_state", - "address_line_1", - "address_line_2", - "address_country", - "address_postal_code", - "redemptions_total_redeemed", - "redemptions_total_failed", - "redemptions_total_succeeded", - "redemptions_total_rolled_back", - "redemptions_total_rollback_failed", - "redemptions_total_rollback_succeeded", - "orders_total_amount", - "orders_total_count", - "orders_average_amount", - "orders_last_order_amount", - "orders_last_order_date", - "loyalty_points", - "loyalty_referred_customers", - "updated_at", - "phone", - "birthday", - "metadata", - "birthdate" - ], - "title": "Export Customer Fields" - }, - "ExportCustomerOrder": { - "title": "Export Customer Order", - "type": "string", - "enum": [ - "name", - "-name", - "id", - "-id", - "description", - "-description", - "email", - "-email", - "source_id", - "-source_id", - "created_at", - "-created_at", - "address_city", - "-address_city", - "address_state", - "-address_state", - "address_line_1", - "-address_line_1", - "address_line_2", - "-address_line_2", - "address_country", - "-address_country", - "address_postal_code", - "-address_postal_code", - "redemptions_total_redeemed", - "-redemptions_total_redeemed", - "redemptions_total_failed", - "-redemptions_total_failed", - "redemptions_total_succeeded", - "-redemptions_total_succeeded", - "redemptions_total_rolled_back", - "-redemptions_total_rolled_back", - "redemptions_total_rollback_failed", - "-redemptions_total_rollback_failed", - "redemptions_total_rollback_succeeded", - "-redemptions_total_rollback_succeeded", - "orders_total_amount", - "-orders_total_amount", - "orders_total_count", - "-orders_total_count", - "orders_average_amount", - "-orders_average_amount", - "orders_last_order_amount", - "-orders_last_order_amount", - "orders_last_order_date", - "-orders_last_order_date", - "loyalty_points", - "-loyalty_points", - "loyalty_referred_customers", - "-loyalty_referred_customers", - "updated_at", - "-updated_at", - "phone", - "-phone", - "birthday", - "-birthday", - "metadata", - "-metadata", - "birthdate", - "-birthdate" - ] - }, - "ExportPublicationFields": { - "title": "Export Publication Fields", - "type": "string", - "enum": [ - "voucher_code", - "customer_id", - "customer_source_id", - "date", - "channel", - "campaign", - "is_winner", - "metadata" - ] - }, - "ExportPublicationOrder": { - "title": "Export Publication Order", - "type": "string", - "enum": [ - "voucher_code", - "-voucher_code", - "customer_id", - "-customer_id", - "customer_source_id", - "-customer_source_id", - "date", - "-date", - "channel", - "-channel", - "campaign", - "-campaign", - "is_winner", - "-is_winner", - "metadata", - "-metadata" - ] - }, - "ExportRedemptionFields": { - "title": "Export Redemption Fields", - "type": "string", - "enum": [ - "id", - "object", - "date", - "voucher_code", - "campaign", - "promotion_tier_id", - "customer_id", - "customer_source_id", - "customer_name", - "tracking_id", - "order_amount", - "gift_amount", - "loyalty_points", - "result", - "failure_code", - "failure_message", - "metadata" - ] - }, - "ExportRedemptionOrder": { - "title": "Export Redemption Order", - "type": "string", - "enum": [ - "id", - "-id", - "object", - "-object", - "date", - "-date", - "voucher_code", - "-voucher_code", - "campaign", - "-campaign", - "promotion_tier_id", - "-promotion_tier_id", - "customer_id", - "-customer_id", - "customer_source_id", - "-customer_source_id", - "customer_name", - "-customer_name", - "tracking_id", - "-tracking_id", - "order_amount", - "-order_amount", - "gift_amount", - "-gift_amount", - "loyalty_points", - "-loyalty_points", - "result", - "-result", - "failure_code", - "-failure_code", - "failure_message", - "-failure_message", - "metadata", - "-metadata" - ] - }, - "ExportVoucherFields": { - "title": "Export Voucher Fields", - "type": "string", - "enum": [ - "code", - "voucher_type", - "value", - "discount_type", - "campaign", - "category", - "start_date", - "expiration_date", - "gift_balance", - "loyalty_balance", - "redemption_quantity", - "redemption_count", - "active", - "qr_code", - "bar_code", - "metadata", - "id", - "is_referral_code", - "created_at", - "updated_at", - "validity_timeframe_interval", - "validity_timeframe_duration", - "validity_day_of_week", - "discount_amount_limit", - "campaign_id", - "additional_info", - "customer_id", - "discount_unit_type", - "discount_unit_effect", - "customer_source_id" - ] - }, - "ExportVoucherOrder": { - "title": "Export Voucher Order", - "type": "string", - "enum": [ - "code", - "-code", - "voucher_type", - "-voucher_type", - "value", - "-value", - "discount_type", - "-discount_type", - "campaign", - "-campaign", - "category", - "-category", - "start_date", - "-start_date", - "expiration_date", - "-expiration_date", - "gift_balance", - "-gift_balance", - "loyalty_balance", - "-loyalty_balance", - "redemption_quantity", - "-redemption_quantity", - "redemption_count", - "-redemption_count", - "active", - "-active", - "qr_code", - "-qr_code", - "bar_code", - "-bar_code", - "metadata", - "-metadata", - "id", - "-id", - "is_referral_code", - "-is_referral_code", - "created_at", - "-created_at", - "updated_at", - "-updated_at", - "validity_timeframe_interval", - "-validity_timeframe_interval", - "validity_timeframe_duration", - "-validity_timeframe_duration", - "validity_day_of_week", - "-validity_day_of_week", - "discount_amount_limit", - "-discount_amount_limit", - "campaign_id", - "-campaign_id", - "additional_info", - "-additional_info", - "customer_id", - "-customer_id", - "discount_unit_type", - "-discount_unit_type", - "discount_unit_effect", - "-discount_unit_effect", - "customer_source_id", - "-customer_source_id" - ] - }, - "ExportOrderFields": { - "title": "Export Order Fields", - "type": "string", - "enum": [ - "id", - "source_id", - "created_at", - "updated_at", - "status", - "amount", - "discount_amount", - "items_discount_amount", - "total_discount_amount", - "total_amount", - "customer_id", - "referrer_id", - "metadata" - ] - }, - "ExportOrderOrder": { - "title": "Export Order Order", - "type": "string", - "enum": [ - "id", - "-id", - "source_id", - "-source_id", - "created_at", - "-created_at", - "updated_at", - "-updated_at", - "status", - "-status", - "amount", - "-amount", - "discount_amount", - "-discount_amount", - "items_discount_amount", - "-items_discount_amount", - "total_discount_amount", - "-total_discount_amount", - "total_amount", - "-total_amount", - "customer_id", - "-customer_id", - "referrer_id", - "-referrer_id", - "metadata", - "-metadata" - ] - }, - "ExportPointsExpirationFields": { - "title": "Export Points Expiration Fields", - "type": "string", - "enum": [ - "id", - "campaign_id", - "voucher_id", - "points", - "status", - "expires_at" - ] - }, - "ExportPointsExpirationOrder": { - "title": "Export Points Expiration Order", - "type": "string", - "enum": [ - "id", - "-id", - "campaign_id", - "-campaign_id", - "voucher_id", - "-voucher_id", - "points", - "-points", - "status", - "-status", - "expires_at", - "-expires_at" - ] - }, - "ExportVoucherTransactionsFields": { - "title": "Export Voucher Transactions Fields", - "type": "string", - "enum": [ - "id", - "campaign_id", - "voucher_id", - "type", - "source_id", - "reason", - "source", - "balance", - "amount", - "related_transaction_id", - "created_at", - "details" - ] - }, - "ExportVoucherTransactionsOrder": { - "title": "Export Voucher Transactions Order", - "type": "string", - "enum": [ - "id", - "-id", - "campaign_id", - "-campaign_id", - "voucher_id", - "-voucher_id", - "type", - "-type", - "source_id", - "-source_id", - "reason", - "-reason", - "source", - "-source", - "balance", - "-balance", - "amount", - "-amount", - "related_transaction_id", - "-related_transaction_id", - "created_at", - "-created_at", - "details", - "-details" - ] - }, - "Any": { - "anyOf": [ - { - "title": "array", - "type": "array", - "items": { - "anyOf": [ - { - "title": "string", - "type": "string" + "16_obj_filter_publication_failure_code": { + "description": "Filter conditions set on the publication `failure_code`. Available options are:\n\n - `not_found`,\n\n - `no_voucher_suitable_for_publication`\n\n - `voucher_already_published`\n\n - `duplicate_source_id`\n\n - `too_many_vouchers_requested`", + "title": "Filter by failure code", + "type": "object", + "properties": { + "failure_code": { + "$ref": "#/components/schemas/16_filter_conditions_string" }, - { - "title": "number", - "type": "number" + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_publication_result": { + "description": "Filter conditions set on the publication `result`. Available options are:\n\n - `SUCCESS`\n\n - `FAILURE`", + "title": "Filter by result", + "type": "object", + "properties": { + "result": { + "$ref": "#/components/schemas/16_filter_conditions_string" }, - { - "title": "object", - "type": "object" + "junction": { + "$ref": "#/components/schemas/16_filter_junction" } - ] - } - }, - { - "title": "string", - "type": "string" - }, - { - "title": "number", - "type": "number" - }, - { - "title": "object", - "type": "object" - } - ], - "title": "Any" - }, - "LoyaltiesCreateTiersRequestBody": { - "title": "Loyalties Create Tiers Request Body", - "x-stoplight": { - "id": "i1emmwlaqp7lt" - }, - "type": "array", - "items": { - "allOf": [ - { - "$ref": "#/components/schemas/LoyaltyTierBase" + } }, - { + "16_obj_filter_publication_customer_id": { + "description": "Filter conditions set on the publication `customer_id`.", + "title": "Filter by customer ID", "type": "object", "properties": { - "metadata": { - "description": "The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format.", - "type": "object" + "customer_id": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" } } - } - ] - } - }, - "LoyaltiesCreateTiersResponseBody": { - "title": "Loyalties Create Tiers Response Body", - "x-stoplight": { - "id": "ix7g5mnuwqsp6" - }, - "type": "array", - "items": { - "$ref": "#/components/schemas/LoyaltyTier" - } - }, - "LoyaltiesGetRewardAssignmentResponseBody": { - "$ref": "#/components/schemas/RewardAssignment", - "x-stoplight": { - "id": "fnbbaq9l1l9it" - } - }, - "LoyaltiesGetRewardDetailsResponseBody": { - "$ref": "#/components/schemas/Reward", - "x-stoplight": { - "id": "44hds9u0hhukf" - } - }, - "LoyaltiesListTiersRequestQuery": { - "title": "Loyalties List Tiers Request Query", - "x-stoplight": { - "id": "d5sluzqkxu8km" - }, - "type": "object", - "properties": { - "limit": { - "type": "integer", - "minimum": 1, - "multipleOf": 100, - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." - }, - "page": { - "type": "integer", - "description": "Which page of results to return." - }, - "order": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ], - "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." - } - } - }, - "LoyaltiesListLoyaltyTierEarningRulesRequestQuery": { - "title": "LoyaltiesListLoyaltyTierEarningRulesRequestQuery", - "x-stoplight": { - "id": "zs0z1cyyzac9u" - }, - "type": "object", - "properties": { - "limit": { - "type": "integer", - "minimum": 1, - "multipleOf": 100, - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." - }, - "page": { - "type": "integer", - "description": "Which page of results to return." - } - } - }, - "LoyaltiesGetTierResponseBody": { - "$ref": "#/components/schemas/LoyaltyTier", - "x-stoplight": { - "id": "hzcsijl2b4d5o" - } - }, - "LoyaltiesListTiersResponseBody": { - "title": "Loyalties List Tiers Response Body", - "x-stoplight": { - "id": "kw06g2szvv479" - }, - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "description": "The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary." - }, - "data_ref": { - "type": "string", - "enum": [ - "data" - ], - "description": "Identifies the name of the attribute that contains the array of loyalty tier objects." - }, - "data": { - "type": "array", - "description": "This is an object representing a loyalty tier. Loyalty tiers are used to create a loyalty program with different levels of membership and varied earning rules and rewards based on customer’s tiers.", - "items": { - "$ref": "#/components/schemas/LoyaltyTier" - } - }, - "total": { - "type": "integer", - "description": "Total number of loyalty tier objects." - } - }, - "required": [ - "object", - "data_ref", - "data", - "total" - ] - }, - "LoyaltiesListMemberLoyaltyTiersResponseBody": { - "title": "Loyalties List Member Loyalty Tiers Response Body", - "x-stoplight": { - "id": "s3zpgud510xl6" - }, - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "description": "The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary." - }, - "data_ref": { - "type": "string", - "enum": [ - "data" - ], - "description": "Identifies the name of the attribute that contains the array of loyalty tier objects." - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/LoyaltyTier" - } - }, - "total": { - "type": "integer", - "description": "Total number of loyalty tier objects." - } - }, - "required": [ - "object", - "data_ref", - "data", - "total" - ] - }, - "EarningRule": { - "allOf": [ - { - "$ref": "#/components/schemas/EarningRuleBase" - }, - { - "type": "object", - "properties": { - "validation_rule_id": { - "type": [ - "string", - "null" - ], - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "updated_at": { - "type": [ - "string", - "null" - ], - "format": "date-time", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format." - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date.\n\n- `true` indicates an active earning rule\n- `false` indicates an inactive earning rule" + }, + "16_obj_filter_publication_campaign_name": { + "description": "Filter conditions set on the publication `campaign_name`.", + "title": "Filter by campaign name", + "type": "object", + "properties": { + "campaign_name": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } } }, - "required": [ - "validation_rule_id", - "updated_at", - "active" - ] - } - ] - }, - "LoyaltiesListLoyaltyTierEarningRulesResponseBody": { - "title": "Loyalties List Loyalty Tier Earning Rules ResponseBody", - "x-stoplight": { - "id": "i180zbh3ffwaa" - }, - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "description": "The type of object represented by JSON. This object stores information about earning rules in a dictionary." - }, - "data_ref": { - "type": "string", - "enum": [ - "data" - ], - "description": "Identifies the name of the attribute that contains the array of earning rule objects." - }, - "data": { - "type": "array", - "description": "Contains array of earning rule objects.", - "items": { - "$ref": "#/components/schemas/EarningRule" - } - }, - "total": { - "type": "integer", - "description": "Total number of earning rule objects." - } - }, - "required": [ - "object", - "data_ref", - "data", - "total" - ] - }, - "LoyaltyTierBase": { - "title": "Loyalty Tier Base", - "x-stoplight": { - "id": "3af9422223696" - }, - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Loyalty Tier name." - }, - "earning_rules": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/MappingPoints" + "16_obj_filter_publication_voucher_type": { + "description": "Filter conditions set on the publication `voucher_type`.", + "title": "Filter by voucher type", + "type": "object", + "properties": { + "voucher_type": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } }, - "description": "Contains a list of earning rule IDs and their points mapping for the given earning rule." - }, - "rewards": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/MappingPoints" + "16_obj_filter_publication_is_referral_code": { + "description": "Filter conditions set on the publication `is_referral_code`.", + "title": "Filter if the code is a referral code", + "type": "object", + "properties": { + "is_referral_code": { + "$ref": "#/components/schemas/16_filter_conditions_boolean" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } }, - "description": "Contains a list of reward IDs and their points mapping for the given reward." - }, - "points": { - "type": "object", - "description": "Defines range of loyalty tier in points.", - "properties": { - "from": { - "type": "integer", - "description": "Bottom points threshold value." - }, - "to": { - "type": "integer", - "description": "Top points threshold value." + "16_obj_filter_publication_parent_object_id": { + "description": "Filter conditions set on the publication `parent_object_id`, which is the parent campaigns unique ID assigned by Voucherify.", + "title": "Filter by parent object ID", + "type": "object", + "properties": { + "parent_object_id": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } } - } - } - }, - "required": [ - "name", - "points" - ] - }, - "LoyaltyTier": { - "allOf": [ - { - "$ref": "#/components/schemas/LoyaltyTierBase" - }, - { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique loyalty tier ID." - }, - "campaign_id": { - "type": "string", - "description": "Unique parent campaign ID." - }, - "metadata": { - "type": [ - "object", - "null" - ], - "description": "The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format." - }, - "created_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the loyalty tier was created in ISO 8601 format." - }, - "updated_at": { - "type": [ - "string", - "null" - ], - "format": "date-time", - "description": "Timestamp representing the date and time when the loyalty tier was updated in ISO 8601 format." - }, - "config": { - "type": "object", - "description": "Defines loyalty tier range in points.", - "required": [ - "points" - ], - "properties": { - "points": { - "type": "object", - "description": "Defines range of loyalty tier in points.", - "properties": { - "from": { - "type": "integer", - "description": "Bottom points threshold value." - }, - "to": { - "type": "integer", - "description": "Top points threshold value." - } - } - } + }, + "16_obj_filter_publication_related_object_id": { + "description": "Filter conditions set on the publication `related_object_id`.", + "title": "Filter by related object ID", + "type": "object", + "properties": { + "related_object_id": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" } - }, - "expiration": { - "type": "object", - "description": "Defines loyalty tier expiration date.", - "properties": { - "customer_id": { - "type": "string" - }, - "campaign_id": { - "type": "string" - }, - "tier_id": { - "type": "string" - }, - "start_date": { - "type": "string", - "format": "date-time" - }, - "expiration_date": { - "type": "string", - "format": "date-time" - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } + } + }, + "16_obj_filter_publication_source_id": { + "description": "Filter conditions set on the publication `source_id`.", + "title": "Filter by publication source ID", + "type": "object", + "properties": { + "source_id": { + "$ref": "#/components/schemas/16_filter_conditions_string" }, - "required": [ - "customer_id", - "campaign_id", - "tier_id", - "created_at" - ] - }, - "object": { - "type": "string", - "enum": [ - "loyalty_tier" - ], - "description": "The type of object represented by JSON. This object stores information about the loyalty." + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } } }, - "required": [ - "id", - "campaign_id", - "metadata", - "created_at", - "config", - "object" - ] - } - ] - }, - "MappingMultiply": { - "title": "MappingMultiply", - "x-stoplight": { - "id": "7zrwgr2oqh4tj" - }, - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "MULTIPLY" - ], - "description": "Type of calculation." - }, - "multiplier": { - "type": "number", - "description": "Multiplication factor used to multiply the points to obtain the mapped points." - } - } - }, - "MappingFixed": { - "title": "MappingFixed", - "x-stoplight": { - "id": "86eksegayxcxa" - }, - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "CUSTOM" - ], - "description": "Type of calculation.\n\n" - }, - "points": { - "type": "integer", - "description": "Fixed number of points to be applied." - } - } - }, - "MappingPoints": { - "anyOf": [ - { - "$ref": "#/components/schemas/MappingMultiply" - }, - { - "$ref": "#/components/schemas/MappingFixed" - } - ] - }, - "a_req_importCSV": { - "type": "object", - "title": "Import CSV file", - "description": "Request body schema for importing data using a CSV file.", - "format": "binary", - "properties": { - "file": { - "type": "string", - "format": "binary", - "description": "File path." - } - }, - "required": [ - "file" - ] - }, - "a_res_async_actions": { - "type": "object", - "title": "Asynchronous Actions", - "description": "Response to requests that are processed asynchronously.", - "additionalProperties": false, - "examples": [ - { - "async_action_id": "aa_0a875d56c805df6601" - } - ], - "properties": { - "async_action_id": { - "type": "string", - "example": "aa_0a875d56c805df6601", - "description": "The ID of the scheduled asynchronous action." - } - }, - "required": [ - "async_action_id" - ] - }, - "error": { - "title": "error", - "type": "object", - "properties": {}, - "discriminator": { - "propertyName": "key", - "mapping": { - "not_enough_codes": "not_enough_codes" - } - }, - "description": "Short error response", - "examples": [] - }, - "e_error": { - "title": "Error Object", - "type": "object", - "description": "Error details", - "properties": { - "code": { - "type": "integer", - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a885062c80375740f", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - }, - "error": { - "type": "object", - "description": "Contains custom user-defined error message translation.", - "properties": { - "message": { - "type": "string", - "description": "Error message translation defined in Dashboard → Project Settings → Error Messages" + "16_obj_filter_order_status": { + "description": "Filter conditions set on the order `status`.", + "title": "Filter by status", + "type": "object", + "properties": { + "status": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_order_source_id": { + "description": "Filter conditions set on the order `source_id`.", + "title": "Filter by order source ID", + "type": "object", + "properties": { + "source_id": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_order_amount": { + "description": "Filter conditions set on the order `amount`.", + "title": "Filter by order amount", + "type": "object", + "properties": { + "amount": { + "$ref": "#/components/schemas/16_filter_conditions_number" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } } - } - } - } - }, - "e_error_expanded": { - "title": "Error Object", - "type": "object", - "description": "Error details", - "properties": { - "code": { - "type": "integer", - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a885062c80375740f", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - }, - "resource_id": { - "type": "string", - "description": "Unique resource ID that can be used in another endpoint to get more details.", - "example": "rf_0c5d710a87c8a31f86" - }, - "resource_type": { - "type": "string", - "description": "The resource type.", - "example": "redemption" - }, - "error": { - "type": "object", - "description": "Contains custom user-defined error message translation.", - "properties": { - "message": { - "type": "string", - "description": "Error message translation defined in Dashboard → Project Settings → Error Messages" + }, + "16_obj_filter_order_total_amount": { + "description": "Filter conditions set on the order `total_amount`.", + "title": "Filter by order total amount", + "type": "object", + "properties": { + "total_amount": { + "$ref": "#/components/schemas/16_filter_conditions_number" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } } - } - } - } - }, - "e_error_no_translation": { - "title": "Error Object", - "type": "object", - "description": "Error details", - "properties": { - "code": { - "type": "integer", - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a885062c80375740f", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - } - } - }, - "e_integration_key": { - "title": "Error Object", - "type": "object", - "description": "Error details", - "properties": { - "code": { - "type": "integer", - "description": "Error's HTTP status code." - }, - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the error." - }, - "key": { - "type": "string", - "description": "Short string describing the kind of error which occurred." - } - } - }, - "e_400_missing_param": { - "description": "Error: Bad Request → Missing Parameters", - "type": "object", - "title": "Missing Parameters", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "missing_param", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Missing required parameter", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "example": "Parameter 'custom_event.schema_id' is required", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a96c19b1a41c03999", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - } - } - }, - "e_400_not_enough_source_ids": { - "description": "Error: Bad Request → Missing Parameters", - "type": "object", - "title": "Not Enough Source ID's", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "not_enought_source_ids", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Not enough source_ids", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "example": "Specify at least 1 source_id", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a96c19b1a41c03999", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - } - } - }, - "e_400_invalid_payload": { - "title": "Invalid Payload", - "type": "object", - "description": "Error: Bad Request → Invalid Payload", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "invalid_payload", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Invalid payload", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a884c6be8c3756f42", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - } - } - }, - "e_400_invalid_balance": { - "title": "Invalid Balance", - "type": "object", - "description": "Error: Bad Request → Invalid Balance", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "invalid_balance", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a884c6be8c3756f42", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - } - } - }, - "e_400_resource_in_use": { - "title": "Resource in use", - "type": "object", - "description": "Error: Bad Request - Resource in use", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "resource_in_use", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Resource in use", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a884c6be8c3756f42", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - }, - "related_object_ids": { - "type": "array", - "description": "Name or ID of the resources that are related.", - "items": { - "type": "string", - "example": "rewa_5WV7H3y2lT3GGl03Xjw29IEc" - } - }, - "related_object_type": { - "type": "string", - "description": "Specifies the type of resource that is related." - } - } - }, - "e_400_invalid_export_fields": { - "title": "Invalid Export Fields", - "type": "object", - "description": "Error: Bad Request → Invalid Export Fields", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "invalid_export_fields", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Invalid Export", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a884c6be8c3756f42", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - } - } - }, - "e_400_invalid_voucher": { - "title": "Invalid Voucher", - "type": "object", - "description": "Error: Bad Request → Invalid Voucher", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "invalid_voucher", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Invalid Voucher", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a884c6be8c3756f42", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - } - } - }, - "e_400_invalid_validation_rules": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "description": "Error's HTTP status code.", - "default": 400 - }, - "key": { - "type": "string", - "default": "invalid_validation_rules", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - } - }, - "title": "Invalid Validation Rules", - "description": "Error: Bad Request → Invalid Validation Rules" - }, - "e_400_not_enough_codes": { - "title": "Not Enough Codes", - "type": "object", - "description": "Error: Bad Request → Not enough codes", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "not_enough_codes", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Not enough codes", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "example": "Specify at least 1 code in codes.", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a885062c80375740f", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - } - } - }, - "e_400_metadata_validation_failed": { - "title": "Metadata Validation Failed", - "type": "object", - "description": "Error: Bad Request → Metadata validation failed", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "metadata_validation_failed", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Metadata validation failed", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "example": "Ranking: must be a number (actual value is 'true')", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a885062c80375740f", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - } - } - }, - "e_400_missing_reward": { - "title": "Missing Reward", - "type": "object", - "description": "Error: Bad Request → Missing Reward", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "missing_reward", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Missing reward", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "example": "A reward is required when redeeming a LOYALTY_CARD", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a885062c80375740f", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - }, - "resource_id": { - "type": "string", - "example": "rf_0b3a1814550e5aaa34", - "description": "Unique resource ID that can be used in another endpoint to get more details." - }, - "resource_type": { - "type": "string", - "example": "redemption", - "description": "The resource type." - }, - "error": { - "type": "object", - "description": "Contains error message translation.", - "properties": { - "message": { - "type": "string", - "example": "Missing reward = please add one.", - "description": "Error message translation defined in Dashboard → Project Settings → Error Messages" + }, + "16_obj_filter_order_discount_amount": { + "description": "Filter conditions set on the order `discount_amount`.", + "title": "Filter by order discount amount", + "type": "object", + "properties": { + "discount_amount": { + "$ref": "#/components/schemas/16_filter_conditions_number" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } } - } - } - } - }, - "e_400_missing_order": { - "title": "Missing Order", - "type": "object", - "description": "Error: Bad Request → Missing Order", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "missing_order", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Missing order", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "example": "An order is required when redeeming a LOYALTY_CARD", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a885062c80375740f", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - }, - "resource_id": { - "type": "string", - "example": "rf_0b3a1814550e5aaa34", - "description": "Unique resource ID that can be used in another endpoint to get more details." - }, - "resource_type": { - "type": "string", - "example": "redemption", - "description": "The resource type." - }, - "error": { - "type": "object", - "description": "Contains error message translation.", - "properties": { - "message": { - "type": "string", - "example": "Missing order = please add one.", - "description": "Error message translation defined in Dashboard → Project Settings → Error Messages" + }, + "16_obj_filter_order_total_discount_amount": { + "description": "Filter conditions set on the order `total_discount_amount`.", + "title": "Filter by order total discount amount", + "type": "object", + "properties": { + "total_discount_amount": { + "$ref": "#/components/schemas/16_filter_conditions_number" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } } - } - } - } - }, - "e_400_loyalty_card_points_exceeded": { - "title": "Loyalty Card Points Exceeded", - "type": "object", - "description": "Error: Bad Request → Loyalty Card Points Exceeded", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "loyalty_card_points_exceeded", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "loyalty card points exceeded", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "example": "SoAm6kbC", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a885062c80375740f", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - }, - "resource_id": { - "type": "string", - "example": "rf_0b3a1814550e5aaa34", - "description": "Unique resource ID that can be used in another endpoint to get more details." - }, - "resource_type": { - "type": "string", - "example": "redemption", - "description": "The resource type." - }, - "error": { - "type": "object", - "description": "Contains error message translation.", - "properties": { - "message": { - "type": "string", - "example": "There are not enough loyalty points on the card.", - "description": "Error message translation defined in Dashboard → Project Settings → Error Messages" + }, + "16_obj_filter_order_items_discount_amount": { + "description": "Filter conditions set on the order `items_discount_amount`.", + "title": "Filter by order items discount amount", + "type": "object", + "properties": { + "items_discount_amount": { + "$ref": "#/components/schemas/16_filter_conditions_number" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } } - } - } - } - }, - "e_403_wrong_api_endpoint": { - "title": "Wrong API Endpoint", - "type": "object", - "description": "Error: Forbidden → Wrong API Endpoint", - "properties": { - "code": { - "type": "integer", - "default": 403, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "wrong_api_endpoint", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Wrong API endpoint", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "example": "Given project is bound to different API endpoint, you should use: https://api.voucherify.io", - "description": "A human-readable message providing more details about the error." - } - } - }, - "e_404_not_found": { - "description": "Error: Not Found", - "type": "object", - "title": "Not Found", - "properties": { - "code": { - "type": "integer", - "default": 404, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "not_found", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Resource not found", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a96cd820301c0483a", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - }, - "resource_id": { - "type": "string", - "description": "Name or ID of the resource that was not found." - }, - "resource_type": { - "type": "string", - "description": "Specifies the type of resource that was not found." - } - } - }, - "e_409_duplicate_found": { - "title": "Duplicated Resource", - "type": "object", - "description": "Error: Conflict → Duplicated resource found", - "properties": { - "code": { - "type": "integer", - "default": 409, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "duplicate_found", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Duplicated resource found", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0aa36e570e44cb3bdd", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - }, - "resource_id": { - "type": "string", - "description": "Name or ID of the resource that already exists." - }, - "resource_type": { - "type": "string", - "description": "Specifies the type of resource that already exists." - } - } - }, - "e_400_duplicate_key": { - "title": "Duplicated Key", - "type": "object", - "description": "Error: Conflict → Duplicated key found", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "duplicate_key", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Duplicate codes", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0aa36e570e44cb3bdd", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - } - } - }, - "e_400_duplicate_source_id": { - "title": "Duplicate Source ID", - "type": "object", - "description": "Error: Conflict → Duplicate source_id found", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "duplicate_source_id", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Duplicate source_id", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0aa36e570e44cb3bdd", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - } - } - }, - "product_collections_get_response_body": { - "$ref": "#/components/schemas/product_collections_collection_item", - "description": "\"Response body schema for **GET** `/product-collections/{collectionId}`.\",", - "title": "Get Product Collection Response Body" - }, - "product_collections_collection_item": { - "title": "Product Collection Object", - "description": "This is an object representing a product collection. \n\nThe products can be grouped into collections by the creation of a products collection object. You can retrieve a product collection and a list of products in the collection. Product collections are identified by a unique ID.", - "x-tags": [ - "PRODUCT COLLECTIONS API" - ], - "allOf": [ - { - "$ref": "#/components/schemas/product_collections_collection_item_base" - }, - { - "anyOf": [ - { - "$ref": "#/components/schemas/product_collections_static_collection" - }, - { - "$ref": "#/components/schemas/product_collections_dynamic_collection" + }, + "16_obj_filter_points_expiration_campaign_id": { + "description": "Filter conditions set on`the `campaign_id`.", + "title": "Filter by campaign ID", + "type": "object", + "properties": { + "campaign_id": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_points_expiration_voucher_id": { + "description": "Filter conditions set on`the `voucher_id`.", + "title": "Filter by voucher ID", + "type": "object", + "properties": { + "voucher_id": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_gift_card_transactions_voucher_id": { + "description": "Filter conditions set on`the `voucher_id`.", + "title": "Filter by voucher ID", + "type": "object", + "properties": { + "voucher_id": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_loyalty_card_transactions_voucher_id": { + "description": "Filter conditions set on`the `voucher_id`.", + "title": "Filter by voucher ID", + "type": "object", + "properties": { + "voucher_id": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_filter_junction": { + "description": "Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE.", + "title": "Logical Operator Between Filters", + "type": "string", + "enum": [ + "AND", + "OR" + ] + }, + "16_filter_conditions_string": { + "title": "Filter by conditions", + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "conditions": { + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "$in": { + "type": "array", + "description": "Array of resource values that should be included in the results. (multiple values)", + "items": { + "type": "string" + } + }, + "$not_in": { + "type": "array", + "description": "Array of resource values that should be included in the results. (multiple values)", + "items": { + "type": "string" + } + }, + "$is": { + "type": "string", + "description": "Value is exactly this value. (single value)" + }, + "$is_not": { + "type": "string", + "description": "Results omit this value. (single value)" + }, + "$has_value": { + "type": "string", + "description": "Value is NOT null. The value for this parameter is an empty string." + }, + "$is_unknown": { + "type": "string", + "description": "Value is null. The value for this parameter is an empty string." + }, + "$starts_with": { + "type": "string", + "description": "Value starts with the specified string." + }, + "$ends_with": { + "type": "string", + "description": "Value ends with the specified string." + } + } + } + } + }, + "16_filter_conditions_number": { + "title": "Filter by conditions", + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "conditions": { + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "$in": { + "type": "array", + "description": "Array of resource values that should be included in the results. (multiple values)", + "items": { + "type": "integer" + } + }, + "$not_in": { + "type": "array", + "description": "Array of resource values that should be included in the results. (multiple values)", + "items": { + "type": "integer" + } + }, + "$is": { + "type": "integer", + "description": "Value is exactly this value. (single value)" + }, + "$is_not": { + "type": "integer", + "description": "Results omit this value. (single value)" + }, + "$has_value": { + "type": "string", + "description": "Value is NOT null. The value for this parameter is an empty string." + }, + "$is_unknown": { + "type": "string", + "description": "Value is null. The value for this parameter is an empty string." + }, + "$more_than": { + "type": "integer", + "description": "Value is more than the specified number." + }, + "$more_than_equal": { + "type": "integer", + "description": "Value is more than or equal to the specified number." + }, + "$less_than": { + "type": "integer", + "description": "Value is less than the specified number." + }, + "$less_than_equal": { + "type": "integer", + "description": "Value is less than or equal to the specified number." + } + } + } + } + }, + "16_filter_conditions_array": { + "title": "Filter by conditions", + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "conditions": { + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "$in": { + "type": "array", + "description": "Array of resource values that should be included in the results. (multiple values)", + "items": { + "type": "string" + } + }, + "$not_in": { + "type": "array", + "description": "Array of resource values that should be included in the results. (multiple values)", + "items": { + "type": "string" + } + }, + "$is": { + "type": "string", + "description": "Value is exactly this value. (single value)" + }, + "$is_not": { + "type": "string", + "description": "Results omit this value. (single value)" + }, + "$has_value": { + "type": "string", + "description": "Value is NOT null. The value for this parameter is an empty string." + }, + "$is_unknown": { + "type": "string", + "description": "Value is null. The value for this parameter is an empty string." + }, + "$starts_with": { + "type": "string", + "description": "Value starts with the specified string." + }, + "$ends_with": { + "type": "string", + "description": "Value ends with the specified string." + }, + "$count": { + "type": "integer", + "description": "Value has exactly this number of elements." + }, + "$count_less": { + "type": "integer", + "description": "Value has less than this number of elements." + }, + "$count_more": { + "type": "integer", + "description": "Value has more than this number of elements." + }, + "$contains": { + "type": "string", + "description": "Array contains this element." + } + } + } } - ] - } - ] - }, - "product_collections_collection_item_base": { - "title": "Product Collection Base", - "description": "This is an object representing a product collection base. ", - "x-tags": [ - "PRODUCT COLLECTIONS API" - ], - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Product collection ID." - }, - "name": { - "type": "string", - "example": "All Products", - "description": "Unique user-defined product collection name." - }, - "created_at": { - "type": "string", - "example": "2021-12-09T12:51:29.898Z", - "description": "Timestamp representing the date and time when the product collection was created in ISO 8601 format.", - "format": "date-time" - }, - "object": { - "description": "The type of object represented by JSON. This object stores information about the static product collection.", - "enum": [ - "products_collection" - ] - } - }, - "required": [ - "id", - "name", - "created_at", - "object" - ] - }, - "product_collections_create_request_body": { - "title": "product_collections_create_request_body", - "anyOf": [ - { - "$ref": "#/components/schemas/product_collections_create_static_request_body" - }, - { - "$ref": "#/components/schemas/product_collections_create_dynamic_request_body" - } - ] - }, - "product_collections_create_static_request_body": { - "title": "Create Product Collection - Static", - "type": "object", - "properties": { - "type": { - "enum": [ - "STATIC" - ] - }, - "name": { - "type": "string" - }, - "products": { - "type": "array", - "items": { + }, + "16_filter_conditions_boolean": { + "title": "Filter by conditions", + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "conditions": { + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "$is": { + "type": "string", + "description": "Value is exactly this value. (single value)" + }, + "$is_not": { + "type": "string", + "description": "Results omit this value. (single value)" + }, + "$has_value": { + "type": "string", + "description": "Value is NOT null. The value for this parameter is an empty string." + }, + "$is_unknown": { + "type": "string", + "description": "Value is null. The value for this parameter is an empty string." + } + } + } + } + }, + "16_filter_conditions_date": { + "title": "Filter by conditions", + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "conditions": { + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "$after": { + "type": "string", + "description": "Value is after this date. Value for this parameter is in ISO 8601 format." + }, + "$before": { + "type": "string", + "description": "Value is before this date. Value for this parameter is in ISO 8601 format." + }, + "$has_value": { + "type": "string", + "description": "Value is NOT null. The value for this parameter is an empty string." + }, + "$is_unknown": { + "type": "string", + "description": "Value is null. The value for this parameter is an empty string." + } + } + } + } + }, + "16_filter_conditions_date_time": { + "title": "Filter by conditions", + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "conditions": { + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "$after": { + "type": "string", + "description": "Value is after this date. Value for this parameter is in ISO 8601 format.", + "format": "date-time" + }, + "$before": { + "type": "string", + "description": "Value is before this date. Value for this parameter is in ISO 8601 format.", + "format": "date-time" + }, + "$has_value": { + "type": "string", + "description": "Value is NOT null. The value for this parameter is an empty string." + }, + "$is_unknown": { + "type": "string", + "description": "Value is null. The value for this parameter is an empty string." + } + } + } + } + }, + "17_obj_async_action_object": { + "title": "Async Action Object", "type": "object", + "description": "This is an object representing an asynchronous action.", + "x-tags": [ + "ASYNC ACTIONS API" + ], "properties": { "id": { - "type": "string" + "type": "string", + "example": "aa_0adad13d6f057f088e", + "description": "Async action unique ID." }, - "product_id": { - "type": "string" + "type": { + "type": "string", + "description": "Type of async action.", + "enum": [ + "CAMPAIGN.VOUCHERS_IMPORT", + "CAMPAIGN.VOUCHERS_IMPORT_CSV", + "CAMPAIGN.VOUCHERS_UPDATE", + "CAMPAIGN.VOUCHERS_DELETE", + "CAMPAIGN.VOUCHERS_GENERATE", + "CAMPAIGNS.METADATA_KEY_PURGE", + "CUSTOMERS.IMPORT_CSV", + "CUSTOMERS.BULK_UPDATE", + "CUSTOMERS.METADATA_UPDATE", + "CUSTOMERS.METADATA_KEY_PURGE", + "PRODUCTS.BULK_UPDATE", + "PRODUCTS.METADATA_UPDATE", + "PRODUCTS.METADATA_KEY_PURGE", + "PRODUCTS.IMPORT_CSV", + "SKUS.IMPORT_CSV", + "VOUCHERS.IMPORT", + "VOUCHERS.IMPORT_CSV", + "VOUCHERS.BULK_UPDATE", + "VOUCHERS.METADATA_UPDATE", + "VOUCHERS.METADATA_KEY_PURGE", + "ORDERS.IMPORT", + "ORDERS.METADATA_KEY_PURGE" + ] }, - "object": { + "status": { + "type": "string", + "description": "Status of async action. Informs you whether the async action has already been completed.", "enum": [ - "sku", - "product" + "ENQUEUED", + "IN_PROGRESS", + "DONE", + "FAILED" + ] + }, + "result": { + "anyOf": [ + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_vouchers_import" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_vouchers_import_csv" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_vouchers_update" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_vouchers_delete" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_vouchers_generate" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_metadata_key_purge" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_customers_import_csv" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_customers_bulk_update" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_customers_metadata_update" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_customers_metadata_key_purge" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_products_bulk_update" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_products_metadata_update" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_products_import_csv" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_skus_import_csv" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_products_metadata_key_purge" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_vouchers_import" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_vouchers_import_csv" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_vouchers_bulk_update" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_vouchers_metadata_update" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_vouchers_metadata_key_purge" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_orders_import" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_orders_metadata_key_purge" + } ] + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the async action was scheduled in ISO 8601 format.", + "example": "2022-06-23T11:21:45.578Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2022-06-23T11:21:46.795Z", + "description": "Timestamp representing the date and time when the async action was updated in ISO 8601 format.", + "format": "date-time" + }, + "request_id": { + "type": "string", + "example": "v-0b45cee140c3c9b5ca", + "description": "Unique request ID." + }, + "processing_time": { + "type": "integer", + "example": 1217, + "description": "The length of time it took to process the request in milliseconds." + }, + "progress": { + "type": "integer", + "description": "% progress to completion of the asynchronous action.", + "minimum": 0, + "maximum": 100 + }, + "object": { + "type": "string", + "default": "async_action", + "description": "The type of object represented by JSON. This object stores information about the `async_action`." } - }, - "required": [ - "id", - "object" - ] - } - } - }, - "required": [ - "type", - "name" - ] - }, - "product_collections_create_dynamic_request_body": { - "title": "Create Product Collection - Auto Update", - "type": "object", - "properties": { - "type": { - "enum": [ - "AUTO_UPDATE" - ] - }, - "name": { - "type": "string" - }, - "filter": { - "type": "object", - "additionalProperties": false, - "required": [ - "junction" - ], - "properties": { - "junction": { - "$ref": "#/components/schemas/Junction" - }, - "id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "product_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "source_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "name": { - "$ref": "#/components/schemas/FieldConditions" - }, - "price": { - "$ref": "#/components/schemas/FieldConditions" - }, - "object": { - "$ref": "#/components/schemas/FieldConditions" - }, - "attributes": { - "$ref": "#/components/schemas/FieldConditions" - }, - "metadata": { - "$ref": "#/components/schemas/FieldConditions" - }, - "image_url": { - "$ref": "#/components/schemas/FieldConditions" - }, - "skus": { - "$ref": "#/components/schemas/FieldConditions" - }, - "created_at": { - "$ref": "#/components/schemas/FieldConditions" - }, - "updated_at": { - "$ref": "#/components/schemas/FieldConditions" } - } - } - }, - "required": [ - "type", - "name", - "filter" - ] - } - }, - "examples": { - "req_vouchers_metadata_1": { - "value": { - "codes": [ - "PROMO-CODE810", - "PROMO-CODE726" - ], - "metadata": { - "lang": "en", - "authorized_internally": true - } - } - }, - "req_vouchers_metadata_2": { - "value": { - "codes": [ - "PROMO-CODE810", - "PROMO-CODE726", - "PROMO-CODE888" - ], - "metadata": { - "lang": "en", - "authorized_internally": true - } - } - }, - "res_async_actions": { - "value": { - "async_action_id": "aa_0ab2df092385be5ca5" - } - } - } - }, - "paths": { - "/v1/voucher-object": { - "get": { - "operationId": "voucher-object", - "tags": [ - "VOUCHERS API" - ], - "summary": "Voucher Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Voucher Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_obj_voucher_object" + }, + "17_res_list_async_actions_GET": { + "description": "Response body schema for listing asynchronous actions. \n\nThe table below lists the possible types of async actions. The types are different for each endpoint generating the async action.\n\n| **Types by Context** |\n|:---|\n| **CAMPAIGN** |\n| CAMPAIGN.VOUCHERS_IMPORT
CAMPAIGN.VOUCHERS_IMPORT_CSV
CAMPAIGN.VOUCHERS_UPDATE
CAMPAIGN.VOUCHERS_DELETE
CAMPAIGN.VOUCHERS_GENERATE |\n| **CUSTOMERS** |\n| CUSTOMERS.IMPORT_CSV
CUSTOMERS.BULK_UPDATE
CUSTOMERS.METADATA_UPDATE
CUSTOMERS.METADATA_KEY_PURGE |\n| **PRODUCTS** |\n| PRODUCTS.BULK_UPDATE
PRODUCTS.METADATA_UPDATE
PRODUCTS.METADATA_KEY_PURGE
PRODUCTS.IMPORT_CSV
SKUS.IMPORT_CSV |\n| **VOUCHERS** |\n| VOUCHERS.IMPORT
VOUCHERS.IMPORT_CSV
VOUCHERS.BULK_UPDATE
VOUCHERS.METADATA_UPDATE
VOUCHERS.METADATA_KEY_PURGE |", + "type": "object", + "examples": [ + { + "object": "list", + "data_ref": "async_actions", + "async_actions": [ + { + "id": "aa_0ae2af6a38161f8c79", + "type": "CAMPAIGN.VOUCHERS_DELETE", + "status": "DONE", + "created_at": "2022-04-07T11:34:39.072Z", + "object": "async_action" + }, + { + "id": "aa_0ae27a55b696a4e0f0", + "type": "CUSTOMERS.BULK_UPDATE", + "status": "DONE", + "created_at": "2022-04-07T07:42:44.442Z", + "object": "async_action" + }, + { + "id": "aa_0adad13d6f057f088e", + "type": "CAMPAIGN.VOUCHERS_IMPORT", + "status": "DONE", + "created_at": "2022-04-01T08:54:35.196Z", + "object": "async_action" + }, + { + "id": "aa_0adacc81de057f084c", + "type": "CAMPAIGN.VOUCHERS_IMPORT", + "status": "DONE", + "created_at": "2022-04-01T08:33:54.552Z", + "object": "async_action" + } + ] + } + ], + "title": "List Async Actions Response Body", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about asynchronous actions.", + "default": "list" + }, + "data_ref": { + "type": "string", + "default": "async_actions", + "description": "Identifies the name of the JSON property that contains the array of asynchronous actions." + }, + "async_actions": { + "type": "array", + "description": "An array of async actions.", + "items": { + "type": "object", + "additionalProperties": false, + "description": "Contains an async action definition.", + "properties": { + "id": { + "type": "string", + "description": "Async action unique ID.", + "example": "aa_0ae2af6a38161f8c79" + }, + "type": { + "type": "string", + "description": "Type of async action.", + "enum": [ + "CAMPAIGN.VOUCHERS_IMPORT", + "CAMPAIGN.VOUCHERS_IMPORT_CSV", + "CAMPAIGN.VOUCHERS_UPDATE", + "CAMPAIGN.VOUCHERS_DELETE", + "CAMPAIGN.VOUCHERS_GENERATE", + "CUSTOMERS.IMPORT_CSV", + "CUSTOMERS.BULK_UPDATE", + "CUSTOMERS.METADATA_UPDATE", + "CUSTOMERS.METADATA_KEY_PURGE", + "PRODUCTS.BULK_UPDATE", + "PRODUCTS.METADATA_UPDATE", + "PRODUCTS.METADATA_KEY_PURGE", + "PRODUCTS.IMPORT_CSV", + "SKUS.IMPORT_CSV", + "VOUCHERS.IMPORT", + "VOUCHERS.IMPORT_CSV", + "VOUCHERS.BULK_UPDATE", + "VOUCHERS.METADATA_UPDATE", + "VOUCHERS.METADATA_KEY_PURGE" + ] + }, + "status": { + "type": "string", + "description": "Status of async action. Informs you whether the async action has already been completed.", + "enum": [ + "ENQUEUED", + "IN_PROGRESS", + "DONE", + "FAILED" + ] + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the async action was scheduled in ISO 8601 format.", + "example": "2022-04-07T07:42:44.442Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the async action was updated in ISO 8601 format.", + "example": "2022-06-22T07:58:21.703Z", + "format": "date-time" + }, + "request_id": { + "type": "string", + "example": "v-0ba50a7feb4998490", + "description": "Unique request ID." + }, + "progress": { + "type": "integer", + "minimum": 0, + "maximum": 100, + "description": "% progress to completion of the asynchronous action." + }, + "object": { + "type": "string", + "default": "async_action", + "description": "The type of object represented by each nested object in the JSON async_actions array. This object stores information about the `async_action`." + } + } + } } } - } - } - } - } - }, - "/v1/vouchers": { - "get": { - "operationId": "list-vouchers", - "tags": [ - "VOUCHERS API" - ], - "summary": "List Vouchers", - "description": "Returns a list of your vouchers. By default, the vouchers are returned sorted by creation date, with the most recent vouchers appearing first. A maximum of 10 vouchers are returned in the response.\n\nWhen you get a list of vouchers, you can optionally specify query parameters to customize the amount of vouchers returned per call using `limit`, which page of vouchers to return using `page`, sort the vouchers using the `order` query parameter and more.\n\nThis method will return an error when trying to return a limit of more than 100 vouchers.\n", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "$ref": "#/components/parameters/category" - }, - { - "in": "query", - "name": "campaign_id", - "description": "Limit search results to vouchers within the specified campaign", - "schema": { - "type": "string", - "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3" - } - }, - { - "$ref": "#/components/parameters/customer" - }, - { - "$ref": "#/components/parameters/campaign" - }, - { - "$ref": "#/components/parameters/created_at" - }, - { - "$ref": "#/components/parameters/updated_at" - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at", - "code", - "-code" - ] }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary that contains an array of vouchers. Each entry in the array is a separate voucher object. If no more vouchers are available (query parameter `page` incremented over and above the voucher count), the resulting array will be empty. The result can be narrowed down according to specified (or default) filters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_res_vouchers_GET" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "vouchers", - "vouchers": [ - { - "id": "v_hrMBBeT4sOP9VSGPmj5KAgJwX202UjiY", - "code": "LOYALTY-CARD-xLPbpbXR", - "campaign": "Loyalty Program Fall 2022", - "campaign_id": "camp_f7fBbQxUuTN7dI7tGOo5XMDA", - "category": "First", - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" - } - ], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 110, - "balance": 100, - "next_expiration_date": "2023-12-31", - "next_expiration_points": 100 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8/6I6hUEqtz/F6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD/DjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8%2F6I6hUEqtz%2FF6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD%2FDjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/SpYuOrU9wd6/o1wzy6E/04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ/FJtiw69djuzQk1f4HdQo8s5gaZ7fd2U+1zbaeAvi9usyvRHZE4=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FSpYuOrU9wd6%2Fo1wzy6E%2F04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ%2FFJtiw69djuzQk1f4HdQo8s5gaZ7fd2U%2B1zbaeAvi9usyvRHZE4%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-19T07:56:22.355Z", - "updated_at": "2022-09-19T08:04:22.458Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "redemption": { - "quantity": null, - "redeemed_quantity": 1, - "redeemed_points": 10, - "object": "list", - "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/publications?page=1&limit=10" - }, - "object": "voucher" - }, - { - "id": "v_OBVfpTVf24DBz0HZmKVZa5UEl1DUg2bn", - "code": "AmountDiscount", - "campaign": null, - "campaign_id": null, - "category": "First", - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" - } - ], - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 400, - "amount_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", - "effect": "APPLY_TO_ORDER" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2022-09-01T00:00:00.000Z", - "expiration_date": "2022-10-31T00:00:00.000Z", - "validity_timeframe": null, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": true, - "additional_info": "This voucher discount is based on a formula, payment must be using VISA, and order must be over $100.", - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX18tV6jdzxWPwEzjeiX4DoM06JpwaoKUNGMNx4Td5e8FwA68uIHQwPaRpJr9CUCpiP4IsSD8nEJn1YtEv6FnY83wIv7uljYoQOYmMPyhKec8Ct3zH7KurMGuj4Fhws3HNA3bqP5MYEy+aA==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX18tV6jdzxWPwEzjeiX4DoM06JpwaoKUNGMNx4Td5e8FwA68uIHQwPaRpJr9CUCpiP4IsSD8nEJn1YtEv6FnY83wIv7uljYoQOYmMPyhKec8Ct3zH7KurMGuj4Fhws3HNA3bqP5MYEy%2BaA%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX181+WljOgxIt9Jg1Urbuv226+8Ug0DIyZiI0WtThPNYKZZEodzqQpIsGSdrDGXr2chLo+4FH3Ey8G2YXCPM6nUhZRSMF5oL3+uNjcLtBvb7MF5+ynY5fIgpXolwUK0R/BuT4Pa8prhgTg==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX181%2BWljOgxIt9Jg1Urbuv226%2B8Ug0DIyZiI0WtThPNYKZZEodzqQpIsGSdrDGXr2chLo%2B4FH3Ey8G2YXCPM6nUhZRSMF5oL3%2BuNjcLtBvb7MF5%2BynY5fIgpXolwUK0R%2FBuT4Pa8prhgTg%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-12T07:51:02.145Z", - "updated_at": "2022-09-19T08:29:12.566Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "redemption": { - "quantity": null, - "redeemed_quantity": 2, - "object": "list", - "url": "/v1/vouchers/AmountDiscount/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AmountDiscount/publications?page=1&limit=10" - }, - "object": "voucher" - } - ], - "total": 2 + "17_res_obj_get_async_action_result_message": { + "title": "Message", + "type": "object", + "description": "Result schema with message.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + } + } + }, + "17_res_obj_get_async_action_result_message_failed": { + "title": "Message with Failed Array", + "type": "object", + "description": "Result schema with message and failed array.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "failed": { + "type": "array", + "description": "If any records failed during the process, this array shows the failure details.", + "items": {} + } + } + }, + "17_res_obj_get_async_action_result_code_updated_found": { + "title": "Code Updated and Found", + "type": "object", + "description": "Result schema with an array of code, updated, and found parameters.", + "properties": { + "results": { + "type": "array", + "description": "An array of statuses for each record.", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "updated": { + "type": "boolean", + "description": "Indicates whether the record was updated." + }, + "found": { + "type": "boolean", + "description": "Indicates whether the record was found." + } + } + } + } + } + }, + "17_res_obj_get_async_action_result_campaign_vouchers_import": { + "title": "CAMPAIGN.VOUCHERS_IMPORT", + "type": "object", + "description": "Result schema for a CAMPAIGN.VOUCHERS_IMPORT async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "failed": { + "type": "array", + "description": "If any records failed during the process, this array shows the failure details.", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "reason": { + "type": "string", + "description": "Detailed failure cause for the voucher code import." + } + } + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + }, + "failed_count": { + "type": "integer", + "description": "Number of resources failed to process." + } + } + }, + "17_res_obj_get_async_action_result_campaign_vouchers_import_csv": { + "title": "CAMPAIGN.VOUCHERS_IMPORT_CSV", + "type": "object", + "description": "Result schema for a CAMPAIGN.VOUCHERS_IMPORT_CSV async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "failed": { + "type": "array", + "description": "If any records failed during the process, this array shows the failure details.", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "row": { + "type": "integer", + "description": "The CSV file row number where the code definition is recorded. The row counter excludes the file headers row." + }, + "reason": { + "type": "string", + "description": "Detailed failure cause for the voucher code import." + } } } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + }, + "failed_count": { + "type": "integer", + "description": "Number of resources failed to process." } } - } - } - } - } - }, - "/v1/vouchers/{code}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "7fjWdr" - }, - "in": "path", - "name": "code", - "description": "A unique **code** that identifies the voucher.", - "required": true - } - ], - "get": { - "operationId": "get-voucher", - "tags": [ - "VOUCHERS API" - ], - "summary": "Get Voucher", - "description": "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`.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a voucher object if a valid identifier was provided. \n\nAdditionally, the response returns validation rules related to the voucher object. They can be inherited from a campaign.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_obj_voucher_object" + }, + "17_res_obj_get_async_action_result_campaign_vouchers_update": { + "title": "CAMPAIGN.VOUCHERS_UPDATE", + "type": "object", + "description": "Result schema for a CAMPAIGN.VOUCHERS_UPDATE async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." }, - "examples": { - "Loyalty Card": { - "value": { - "id": "v_hrMBBeT4sOP9VSGPmj5KAgJwX202UjiY", - "code": "LOYALTY-CARD-xLPbpbXR", - "campaign": "Loyalty Program Fall 2022", - "campaign_id": "camp_f7fBbQxUuTN7dI7tGOo5XMDA", - "category": "First", - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" - } - ], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 110, - "balance": 100, - "next_expiration_date": "2023-12-31", - "next_expiration_points": 100 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8/6I6hUEqtz/F6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD/DjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8%2F6I6hUEqtz%2FF6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD%2FDjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/SpYuOrU9wd6/o1wzy6E/04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ/FJtiw69djuzQk1f4HdQo8s5gaZ7fd2U+1zbaeAvi9usyvRHZE4=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FSpYuOrU9wd6%2Fo1wzy6E%2F04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ%2FFJtiw69djuzQk1f4HdQo8s5gaZ7fd2U%2B1zbaeAvi9usyvRHZE4%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-19T07:56:22.355Z", - "updated_at": "2022-09-19T08:04:22.458Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 1, - "redeemed_points": 10, - "object": "list", - "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/publications?page=1&limit=10" - }, - "object": "voucher" - } - }, - "Gift Card": { - "value": { - "id": "v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk", - "code": "GIFT-CARD-xwc6X7Tk", - "campaign": "Gift Cards", - "campaign_id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", - "category": null, - "category_id": null, - "type": "GIFT_VOUCHER", - "discount": null, - "gift": { - "amount": 55000, - "balance": 44700, - "effect": "APPLY_TO_ORDER" - }, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM/aTyHCYfr7kRWb2vv08WIgY/Tv53SJGW+k2keqfsTq/Ohb5shkCN3FTFsaI8gulTp616sEGn/JJoIInIoNkO9Vd1+AfrKiAjmirCmekE6cz2SVCyNAXs=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM%2FaTyHCYfr7kRWb2vv08WIgY%2FTv53SJGW%2Bk2keqfsTq%2FOhb5shkCN3FTFsaI8gulTp616sEGn%2FJJoIInIoNkO9Vd1%2BAfrKiAjmirCmekE6cz2SVCyNAXs%3D" - }, - "barcode": { - "id": "U2FsdGVkX18vWc/qplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO/199U+zicnFNWqg/jF5ZCQW+6jO1q8=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18vWc%2FqplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO%2F199U%2BzicnFNWqg%2FjF5ZCQW%2B6jO1q8%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-07-08T09:44:33.179Z", - "updated_at": "2022-08-29T09:37:20.185Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 7, - "redeemed_amount": 10300, - "object": "list", - "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/publications?page=1&limit=10" - }, - "object": "voucher" - } - }, - "Amount Discount": { - "value": { - "id": "v_OBVfpTVf24DBz0HZmKVZa5UEl1DUg2bn", - "code": "AMOUNTDISCOUNTUSINGFORMULA", - "campaign": null, - "campaign_id": null, - "category": "First", - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" - } - ], - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 400, - "amount_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", - "effect": "APPLY_TO_ORDER" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2022-09-01T00:00:00.000Z", - "expiration_date": "2022-10-31T00:00:00.000Z", - "validity_timeframe": null, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": true, - "additional_info": "This voucher discount is based on a formula, payment must be using VISA, and order must be over $100.", - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX18tV6jdzxWPwEzjeiX4DoM06JpwaoKUNGMNx4Td5e8FwA68uIHQwPaRpJr9CUCpiP4IsSD8nEJn1YtEv6FnY83wIv7uljYoQOYmMPyhKec8Ct3zH7KurMGuj4Fhws3HNA3bqP5MYEy+aA==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX18tV6jdzxWPwEzjeiX4DoM06JpwaoKUNGMNx4Td5e8FwA68uIHQwPaRpJr9CUCpiP4IsSD8nEJn1YtEv6FnY83wIv7uljYoQOYmMPyhKec8Ct3zH7KurMGuj4Fhws3HNA3bqP5MYEy%2BaA%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX181+WljOgxIt9Jg1Urbuv226+8Ug0DIyZiI0WtThPNYKZZEodzqQpIsGSdrDGXr2chLo+4FH3Ey8G2YXCPM6nUhZRSMF5oL3+uNjcLtBvb7MF5+ynY5fIgpXolwUK0R/BuT4Pa8prhgTg==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX181%2BWljOgxIt9Jg1Urbuv226%2B8Ug0DIyZiI0WtThPNYKZZEodzqQpIsGSdrDGXr2chLo%2B4FH3Ey8G2YXCPM6nUhZRSMF5oL3%2BuNjcLtBvb7MF5%2BynY5fIgpXolwUK0R%2FBuT4Pa8prhgTg%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-12T07:51:02.145Z", - "updated_at": "2022-09-19T08:29:12.566Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_tO5AuzXIkkNPTC50", - "rule_id": "val_5h0wc453_2", - "related_object_id": "v_OBVfpTVf24DBz0HZmKVZa5UEl1DUg2bn", - "related_object_type": "voucher", - "created_at": "2022-09-19T08:27:59.160Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 2, - "object": "list", - "url": "/v1/vouchers/AMOUNTDISCOUNTUSINGFORMULA/redemptions?page=1&limit=10" + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_campaign_vouchers_delete": { + "title": "CAMPAIGN.VOUCHERS_DELETE", + "type": "object", + "description": "Result schema for a CAMPAIGN.VOUCHERS_DELETE async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_campaign_vouchers_generate": { + "title": "CAMPAIGN.VOUCHERS_GENERATE", + "type": "object", + "description": "Result schema for a CAMPAIGN.VOUCHERS_GENERATE async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_campaign_metadata_key_purge": { + "title": "CAMPAIGNS.METADATA_KEY_PURGE", + "type": "object", + "description": "Result schema for a CAMPAIGNS.METADATA_KEY_PURGE async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_customers_import_csv": { + "title": "CUSTOMERS.IMPORT_CSV", + "type": "object", + "description": "Result schema for a CUSTOMERS.IMPORT_CSV async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "failed": { + "type": "array", + "description": "If any records failed during the process, this array shows the failure details.", + "items": { + "type": "object", + "properties": { + "source_id": { + "type": "string", + "description": "Unique customer ID from your inventory system as indicated in the CSV file." }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AMOUNTDISCOUNTUSINGFORMULA/publications?page=1&limit=10" + "row": { + "type": "integer", + "description": "The CSV file row number where the customer is recorded. The row counter excludes the file headers row." }, - "object": "voucher" + "reason": { + "type": "string", + "description": "Detailed failure cause for the customer import." + } } - }, - "Percent Discount": { - "value": { - "id": "v_2LcXRN4X0TNNgPoBceXIsE4LYs13kta1", - "code": "PercentDiscountUsingFormula", - "campaign": null, - "campaign_id": null, - "category": null, - "category_id": null, - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "percent_off": 3, - "percent_off_formula": "CUSTOMER_METADATA(\"age\")", - "effect": "APPLY_TO_ITEMS" - }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1+74dNbbuHNdVR+5SXVrdo6Zp2tUInlseZtheoYEvrayBBDEoJFaeDuC1BzQr+j8ayuFU7+BtCdNe25YRae4Mp+3Y1HsrkVudshKRzMBdS/43GT9Qi6tOXQDsYjHh70zNz13lMOC9bnaX6WZCVU0vRWM/VDXbYNxGZH6V1wpcGOkmkhkEYPSuIXBDF65FsgHOAwIPvKBxa/aQ==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B74dNbbuHNdVR%2B5SXVrdo6Zp2tUInlseZtheoYEvrayBBDEoJFaeDuC1BzQr%2Bj8ayuFU7%2BBtCdNe25YRae4Mp%2B3Y1HsrkVudshKRzMBdS%2F43GT9Qi6tOXQDsYjHh70zNz13lMOC9bnaX6WZCVU0vRWM%2FVDXbYNxGZH6V1wpcGOkmkhkEYPSuIXBDF65FsgHOAwIPvKBxa%2FaQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX19t8/dJWDNnnwPtxt3e0kZTDAELYiQcSHWIEO5wr6uLeDbM2KKbGYUfkKKtZRsWtiKhOQQc7zmNoCqR82UB+p0gzGM0tyXa/npbPUTe0Y5Y/arDPnomb9AaUFjK9Uq5OUBYbxi1ERqEhy/20Owr0m0e0E2I3jQmgAxkNokRm1g31zX4zheea8gTtiFwb6ZrYvGbaOhj5IxYWg==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19t8%2FdJWDNnnwPtxt3e0kZTDAELYiQcSHWIEO5wr6uLeDbM2KKbGYUfkKKtZRsWtiKhOQQc7zmNoCqR82UB%2Bp0gzGM0tyXa%2FnpbPUTe0Y5Y%2FarDPnomb9AaUFjK9Uq5OUBYbxi1ERqEhy%2F20Owr0m0e0E2I3jQmgAxkNokRm1g31zX4zheea8gTtiFwb6ZrYvGbaOhj5IxYWg%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-15T10:20:46.467Z", - "updated_at": "2022-09-15T10:43:51.116Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_EuYasM5fyDR9G2r4", - "rule_id": "val_0k19OQHjNZRT", - "related_object_id": "v_2LcXRN4X0TNNgPoBceXIsE4LYs13kta1", - "related_object_type": "voucher", - "created_at": "2022-09-15T10:20:46.460Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 3, - "object": "list", - "url": "/v1/vouchers/PercentDiscountUsingFormula/redemptions?page=1&limit=10" + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + }, + "failed_count": { + "type": "integer", + "description": "Number of resources failed to process." + } + } + }, + "17_res_obj_get_async_action_result_customers_bulk_update": { + "title": "CUSTOMERS.BULK_UPDATE", + "type": "object", + "description": "Result schema for a CUSTOMERS.BULK_UPDATE async action type.", + "properties": { + "results": { + "type": "array", + "description": "An array of statuses for each record.", + "items": { + "type": "object", + "properties": { + "source_id": { + "type": "string", + "description": "Unique customer `source_id`." }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/PercentDiscountUsingFormula/publications?page=1&limit=10" + "updated": { + "type": "boolean", + "description": "Indicates whether the record was updated." }, - "object": "voucher" + "found": { + "type": "boolean", + "description": "Indicates whether the record was found." + } } - }, - "Fixed Discount": { - "value": { - "id": "v_zXQtyi5FYQYoRXv459hmK8M5Gi2lLoDl", - "code": "FixedDiscountUsingFormula", - "campaign": null, - "campaign_id": null, - "category": null, - "category_id": null, - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "FIXED", - "effect": "APPLY_TO_ORDER", - "fixed_amount": 200, - "fixed_amount_formula": "IF(ORDER_UNITS_QUANTITY > 3;CUSTOMER_METADATA(\"age\") + 2;CUSTOMER_METADATA(\"age\") - 2)" - }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1+sY8iWRFMrrPOjY6pS7JZSqJUPIzAgFO5oy5GvTj27KrukNxucE4wrA4n9QL7pua3CfJzGWe0Hc5J6XXU2m5ktik4iUNRO6pxZmL4ZuR96C1XHJAGaIiI7lM17OjJD2b72/hyyDUi8DflzcYixFdXTOR3o1rcaPoY=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BsY8iWRFMrrPOjY6pS7JZSqJUPIzAgFO5oy5GvTj27KrukNxucE4wrA4n9QL7pua3CfJzGWe0Hc5J6XXU2m5ktik4iUNRO6pxZmL4ZuR96C1XHJAGaIiI7lM17OjJD2b72%2FhyyDUi8DflzcYixFdXTOR3o1rcaPoY%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+af+iouhzUVUL0IocB7BAWR8rB0z8/9/OgYi32EHQ9salEEtE3XYPWtseOAxi5keMRp6K3JLDyx4RvYpw3Fe5SN0ed7PEcWr4fLUoUBntHtH0lOPFOtWxpY3tAjnyWpE/CYTR/S135KZ6GIfCS/+VQNrzbS/bFXgY=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2Baf%2BiouhzUVUL0IocB7BAWR8rB0z8%2F9%2FOgYi32EHQ9salEEtE3XYPWtseOAxi5keMRp6K3JLDyx4RvYpw3Fe5SN0ed7PEcWr4fLUoUBntHtH0lOPFOtWxpY3tAjnyWpE%2FCYTR%2FS135KZ6GIfCS%2F%2BVQNrzbS%2FbFXgY%3D" - } + } + }, + "done_count": { + "type": "integer", + "description": "Number or resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_customers_metadata_update": { + "title": "CUSTOMERS.METADATA_UPDATE", + "type": "object", + "description": "Result schema for a CUSTOMERS.METADATA_UPDATE async action type.", + "properties": { + "results": { + "type": "array", + "description": "An array of statuses for each record.", + "items": { + "type": "object", + "properties": { + "source_id": { + "type": "string", + "description": "Unique customer `source_id`." }, - "is_referral_code": false, - "created_at": "2022-09-15T12:46:55.818Z", - "updated_at": "2022-09-16T10:03:25.057Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 + "updated": { + "type": "boolean", + "description": "Indicates whether the record was updated." }, - "redemption": { - "quantity": null, - "redeemed_quantity": 5, - "object": "list", - "url": "/v1/vouchers/FixedDiscountUsingFormula/redemptions?page=1&limit=10" + "found": { + "type": "boolean", + "description": "Indicates whether the record was found." + } + } + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_customers_metadata_key_purge": { + "title": "CUSTOMERS.METADATA_KEY_PURGE", + "type": "object", + "description": "Result schema for a CUSTOMERS.METADATA_KEY_PURGE async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_products_bulk_update": { + "title": "PRODUCTS.BULK_UPDATE", + "type": "object", + "description": "Result schema for a PRODUCTS.BULK_UPDATE async action type.", + "properties": { + "results": { + "type": "array", + "description": "An array of statuses for each record.", + "items": { + "type": "object", + "properties": { + "source_id": { + "type": "string", + "description": "Unique product `source_id`." }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/FixedDiscountUsingFormula/publications?page=1&limit=10" + "updated": { + "type": "boolean", + "description": "Indicates whether the record was updated." }, - "object": "voucher" + "found": { + "type": "boolean", + "description": "Indicates whether the record was found." + } } - }, - "Unit Discount": { - "value": { - "id": "v_JkjV4v9OKTsaIuHoqXGrkGijNaRGYNzm", - "code": "UnitDiscountUsingFormula", - "campaign": null, - "campaign_id": null, - "category": null, - "category_id": null, - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "UNIT", - "unit_off": 1, - "unit_off_formula": "IF(ORDER_UNITS_QUANTITY > 3;CUSTOMER_METADATA(\"age\") / 5;CUSTOMER_METADATA(\"age\") / 10)", - "unit_type": "sku_0b661e41eccd35a8e9", - "effect": "ADD_MISSING_ITEMS" - }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1+6okuUQBKDcu0jGGg0jOU3kwYUFhX79TdwYKjXyV14BX74z/lehzciL0vdtutoiMVf8Nzl+B278gSHI5TiecPsTXChbGKSjH9gYUxZkdQev0qfmR4frKHjKKHHfT9DEcRWCLwKDJ9V+b89EAmbMouLlaDvkD63bZI=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B6okuUQBKDcu0jGGg0jOU3kwYUFhX79TdwYKjXyV14BX74z%2FlehzciL0vdtutoiMVf8Nzl%2BB278gSHI5TiecPsTXChbGKSjH9gYUxZkdQev0qfmR4frKHjKKHHfT9DEcRWCLwKDJ9V%2Bb89EAmbMouLlaDvkD63bZI%3D" - }, - "barcode": { - "id": "U2FsdGVkX19E7POETWB9YO+S4gkbGFQSm4VDNXEvqdlln6cWiyWTplnWkiUbs/2XMIva3q2rHDFP4toeKrLOGeS5mqhJcdd3yVsWXjHaALwCJIis2D4l5soDvz+Ka/vTqJdFWQzqsIl0BqEpr1tLLy8JFMGN7MY5nY3nr/ciSN8=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19E7POETWB9YO%2BS4gkbGFQSm4VDNXEvqdlln6cWiyWTplnWkiUbs%2F2XMIva3q2rHDFP4toeKrLOGeS5mqhJcdd3yVsWXjHaALwCJIis2D4l5soDvz%2BKa%2FvTqJdFWQzqsIl0BqEpr1tLLy8JFMGN7MY5nY3nr%2FciSN8%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-15T13:36:27.838Z", - "updated_at": "2022-09-16T10:03:25.057Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_products_metadata_update": { + "title": "PRODUCTS.METADATA_UPDATE", + "type": "object", + "description": "Result schema for a PRODUCTS.METADATA_UPDATE async action type.", + "properties": { + "results": { + "type": "array", + "description": "An array of statuses for each record.", + "items": { + "type": "object", + "properties": { + "source_id": { + "type": "string", + "description": "Unique product `source_id`." }, - "redemption": { - "quantity": null, - "redeemed_quantity": 5, - "object": "list", - "url": "/v1/vouchers/UnitDiscountUsingFormula/redemptions?page=1&limit=10" + "updated": { + "type": "boolean", + "description": "Indicates whether the record was updated." }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/UnitDiscountUsingFormula/publications?page=1&limit=10" + "found": { + "type": "boolean", + "description": "Indicates whether the record was found." + } + } + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_products_metadata_key_purge": { + "title": "PRODUCTS.METADATA_KEY_PURGE", + "type": "object", + "description": "Result schema for a PRODUCTS.METADATA_KEY_PURGE async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "done_count": { + "type": "integer", + "description": "Number of resources updated successfully." + } + } + }, + "17_res_obj_get_async_action_result_products_import_csv": { + "title": "PRODUCTS.IMPORT_CSV", + "type": "object", + "description": "Result schema for a PRODUCTS.IMPORT_CSV async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "failed": { + "type": "array", + "description": "If any records failed during the process, this array shows the failure details.", + "items": { + "type": "object", + "description": "Contains the details regarding a CSV file line item failed import.", + "properties": { + "row": { + "type": "integer", + "description": "The CSV file row number where the product definition is recorded. The row counter excludes the file headers row." }, - "object": "voucher" + "reason": { + "type": "string", + "description": "Detailed failure cause for the product import." + } } - }, - "Multiple Unit Discount": { - "value": { - "id": "v_5Xgi5ht4sw432LQ7bwmyjKnUAYtOrJAh", - "code": "UnitDiscountUsingFormulaForMultipleProductVariants", - "campaign": null, - "campaign_id": null, - "category": null, - "category_id": null, - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "UNIT", - "effect": "ADD_MANY_ITEMS", - "units": [ - { - "unit_off": 3, - "unit_off_formula": "IF(ORDER_AMOUNT > 100;CUSTOMER_METADATA(\"age\");CUSTOMER_METADATA(\"age\") / 2)", - "unit_type": "sku_0b661e41fc8d35a8f7", - "effect": "ADD_MISSING_ITEMS" - }, - { - "unit_off": 4, - "unit_off_formula": "IF(ORDER_AMOUNT > 100;CUSTOMER_METADATA(\"age\") + 2;CUSTOMER_METADATA(\"age\") - -2)", - "unit_type": "sku_0b661e41fc8d35a8f6", - "effect": "ADD_NEW_ITEMS" - } - ] + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + }, + "failed_count": { + "type": "integer", + "description": "Number of resources failed to process." + } + } + }, + "17_res_obj_get_async_action_result_skus_import_csv": { + "title": "SKUS.IMPORT_CSV", + "type": "object", + "description": "Result schema for a SKUS.IMPORT_CSV async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result.", + "example": "2 sku(s) imported successfully, 6 failed." + }, + "failed": { + "type": "array", + "description": "If any records failed during the process, this array shows the failure details.", + "items": { + "type": "object", + "description": "Contains the details regarding a CSV file line item failed import.", + "properties": { + "row": { + "type": "integer", + "description": "The CSV file row number where the SKU definition is recorded. The row counter excludes the file headers row.", + "example": 2 }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1+qkwm+Yu29uhfotQxirJftPuWjA1P9WGxHqqmOHsU9esf6R5Ln7AeiqX8l9iIpy+D3yav5GmF2UrY6PD6fS9Y+yu+7yTVQu+agFZqdN1jvWw4DBOCHKPgynaMiNS29Cv4EIOFCY9Ux+4Lp8aVdalItCVCEH25DxWD+HUKq1lE31Y0DfWssg95oO2m73ZeGa8je7zd09eW7cg==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bqkwm%2BYu29uhfotQxirJftPuWjA1P9WGxHqqmOHsU9esf6R5Ln7AeiqX8l9iIpy%2BD3yav5GmF2UrY6PD6fS9Y%2Byu%2B7yTVQu%2BagFZqdN1jvWw4DBOCHKPgynaMiNS29Cv4EIOFCY9Ux%2B4Lp8aVdalItCVCEH25DxWD%2BHUKq1lE31Y0DfWssg95oO2m73ZeGa8je7zd09eW7cg%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+poCeZMw207p8HWtpoeokpaPfUQQoRIxpGXmqi5ic2ZPhQwKrUnujPDW4Sw1ODgHV6nLWQQQ9g7j3S4793YfzHDi1H8L3kZroH0TwWFNBgzQkV/QLqc387xUUckr0fvmhTBCarpsB+dWPOwlaNuVivTVB+Yyh/1FcbGbjvbj1Sm12wVNom2KZ3m1K/lJ6vBoGkXqq0jutytA==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BpoCeZMw207p8HWtpoeokpaPfUQQoRIxpGXmqi5ic2ZPhQwKrUnujPDW4Sw1ODgHV6nLWQQQ9g7j3S4793YfzHDi1H8L3kZroH0TwWFNBgzQkV%2FQLqc387xUUckr0fvmhTBCarpsB%2BdWPOwlaNuVivTVB%2BYyh%2F1FcbGbjvbj1Sm12wVNom2KZ3m1K%2FlJ6vBoGkXqq0jutytA%3D%3D" - } + "reason": { + "type": "string", + "description": "Detailed failure cause for the SKU import.", + "example": "Resource sku with id size-small is in use by products with ids [prod_0b0e3441c2462eff2c]" + } + } + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + }, + "failed_count": { + "type": "integer", + "description": "Number of resources failed to process." + } + } + }, + "17_res_obj_get_async_action_result_vouchers_import": { + "title": "VOUCHERS.IMPORT", + "type": "object", + "description": "Result schema for a VOUCHERS.IMPORT async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "failed": { + "description": "If any records failed during the process, this array shows the failure details.", + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "reason": { + "type": "string", + "description": "Detailed failure cause for the voucher code import." + } + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + }, + "failed_count": { + "type": "integer", + "description": "Number of resources failed to process." + } + } + }, + "17_res_obj_get_async_action_result_vouchers_import_csv": { + "title": "VOUCHERS.IMPORT_CSV", + "type": "object", + "description": "Result schema for a VOUCHERS.IMPORT_CSV async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "failed": { + "type": "array", + "description": "If any records failed during the process, this array shows the failure details.", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Unique voucher code." }, - "is_referral_code": false, - "created_at": "2022-09-16T05:44:50.722Z", - "updated_at": "2022-09-19T09:25:17.303Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 + "row": { + "type": "integer", + "description": "The CSV file row number where the code definition is recorded. The row counter excludes the file headers row." }, - "redemption": { - "quantity": null, - "redeemed_quantity": 3, - "object": "list", - "url": "/v1/vouchers/UnitDiscountUsingFormulaForMultipleProductVariants/redemptions?page=1&limit=10" + "reason": { + "type": "string", + "description": "Detailed failure cause for the voucher code import." + } + } + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + }, + "failed_count": { + "type": "integer", + "description": "Number of resources failed to process." + } + } + }, + "17_res_obj_get_async_action_result_vouchers_bulk_update": { + "title": "VOUCHERS.BULK_UPDATE", + "type": "object", + "description": "Result schema for a VOUCHERS.BULK_UPDATE async action type.", + "properties": { + "results": { + "type": "array", + "description": "An array of statuses for each record.", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Unique voucher code." }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/UnitDiscountUsingFormulaForMultipleProductVariants/publications?page=1&limit=10" + "updated": { + "type": "boolean", + "description": "Indicates whether the record was updated." }, - "object": "voucher" + "found": { + "type": "boolean", + "description": "Indicates whether the record was found." + } } - }, - "Free Shipping": { - "value": { - "id": "v_gO13ON60WqVmP1DASWuJRF83Xt5KrVNL", - "code": "FreeShipping", - "campaign": null, - "campaign_id": null, - "category": null, - "category_id": null, - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "UNIT", - "unit_off": 1, - "unit_type": "prod_5h1pp1ng", - "effect": "ADD_MISSING_ITEMS" - }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX19R0AaZSL8eog8GYSGvRcADkJ24Hhr52Awb2KNF11CE7oyTHVBq+S3gexrVR8PxHgEz/jR1Hh2YfM5h0k5CYPD24I/pXJYQVTa1CpXFBrrxVET9QyK48z5hxu2nsHHBsV7g0zK1nIVibsw06db8x1F1zaR7Un9oq6A=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19R0AaZSL8eog8GYSGvRcADkJ24Hhr52Awb2KNF11CE7oyTHVBq%2BS3gexrVR8PxHgEz%2FjR1Hh2YfM5h0k5CYPD24I%2FpXJYQVTa1CpXFBrrxVET9QyK48z5hxu2nsHHBsV7g0zK1nIVibsw06db8x1F1zaR7Un9oq6A%3D" - }, - "barcode": { - "id": "U2FsdGVkX19XHGrCUHCfcSz/VLWmN1UU13QmDsH9ezEYtzHAUAeaLvN12Yv5eBJ7h7R2Og2pNm7mdHxfMR8gBJWEgHuBkodwXch1llhO6hNy9KXebNU+McRx9iEB/DqSzagjaxCiUNB1xitLgXDlUH5cH9naOCOtCHGMrEQW4h0=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19XHGrCUHCfcSz%2FVLWmN1UU13QmDsH9ezEYtzHAUAeaLvN12Yv5eBJ7h7R2Og2pNm7mdHxfMR8gBJWEgHuBkodwXch1llhO6hNy9KXebNU%2BMcRx9iEB%2FDqSzagjaxCiUNB1xitLgXDlUH5cH9naOCOtCHGMrEQW4h0%3D" - } + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_vouchers_metadata_update": { + "title": "VOUCHERS.METADATA_UPDATE", + "type": "object", + "description": "Result schema for a VOUCHERS.METADATA_UPDATE async action type.", + "properties": { + "results": { + "type": "array", + "description": "An array of statuses for each record.", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Unique voucher code." }, - "is_referral_code": false, - "created_at": "2022-09-16T07:19:53.945Z", - "updated_at": "2022-09-16T07:26:35.361Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 + "updated": { + "type": "boolean", + "description": "Indicates whether the record was updated." }, - "redemption": { - "quantity": null, - "redeemed_quantity": 2, - "object": "list", - "url": "/v1/vouchers/FreeShipping/redemptions?page=1&limit=10" + "found": { + "type": "boolean", + "description": "Indicates whether the record was found." + } + } + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_vouchers_metadata_key_purge": { + "title": "VOUCHERS.METADATA_KEY_PURGE", + "type": "object", + "description": "Result schema for a VOUCHERS.METADATA_KEY_PURGE async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_orders_import": { + "title": "ORDERS.IMPORT", + "type": "object", + "description": "Result schema for a ORDERS.IMPORT async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "failed": { + "description": "If any records failed during the process, this array shows the failure details.", + "type": "object", + "properties": { + "source_id": { + "type": "string", + "description": "Unique order source ID." + }, + "reason": { + "type": "string", + "description": "Detailed failure cause for the voucher code import." + } + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + }, + "failed_count": { + "type": "integer", + "description": "Number of resources failed to process." + } + } + }, + "17_res_obj_get_async_action_result_orders_metadata_key_purge": { + "title": "ORDERS.METADATA_KEY_PURGE", + "type": "object", + "description": "Result schema for a ORDERS.METADATA_KEY_PURGE async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "18_res_list_consents_GET": { + "description": "Response body schema for listing consents.", + "type": "object", + "examples": [ + { + "groups": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "cnstgr_3c7Z3rcOLv51bsXlRtTZPYj8", + "name": "Consent group", + "description": "Consent group", + "consents": [ + "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", + "cnst_VCmucIvAsmDYw2PPAok6bcYy" + ], + "created_at": "2022-04-13T09:12:47.743Z", + "updated_at": "2022-04-13T09:45:46.616Z", + "object": "consent_group" }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/FreeShipping/publications?page=1&limit=10" + { + "id": "cnstgr_EAIakTj5lNG2ZpiQEauGqBlY", + "name": "Consent group 2", + "description": "Consent group 2", + "consents": [ + "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", + "cnst_VCmucIvAsmDYw2PPAok6bcYy" + ], + "created_at": "2022-04-13T10:03:46.564Z", + "updated_at": null, + "object": "consent_group" + } + ], + "total": 2 + }, + "consents": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", + "name": "Consent", + "description": "Consent for marketing", + "category": "New", + "created_at": "2022-04-13T09:11:27.037Z", + "updated_at": null, + "object": "consent" }, - "object": "voucher" + { + "id": "cnst_VCmucIvAsmDYw2PPAok6bcYy", + "name": "Consent 2", + "description": "Consent 2", + "category": "Trial", + "created_at": "2022-04-13T09:45:37.597Z", + "updated_at": null, + "object": "consent" + } + ], + "total": 2 + } + } + ], + "title": "List Consents Response Body", + "properties": { + "groups": { + "type": "object", + "description": "Contains marketing permission groups' definitions.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "Stores information about marketing permission groups." + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of marketing permission groups." + }, + "data": { + "type": "array", + "description": "An array of marketing permission groups.", + "items": { + "type": "object", + "additionalProperties": false, + "description": "Contains a marketing permission group's definition.", + "properties": { + "id": { + "type": "string", + "example": "cnstgr_3c7Z3rcOLv51bsXlRtTZPYj8", + "description": "Unique group ID." + }, + "name": { + "type": "string", + "description": "Marketing permission group name." + }, + "description": { + "type": "string", + "description": "Marketing permission group category." + }, + "consents": { + "type": "array", + "description": "List of consents that are assigned to the group.", + "items": { + "type": "string" + } + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-04-13T09:12:47.743Z", + "description": "Timestamp representing the date and time when the group was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-05-14T09:11:27.037Z", + "description": "Timestamp representing the date and time when the group was updated in ISO 8601 format." + }, + "object": { + "type": "string", + "default": "consent_group", + "description": "Stores information about a marketing permission group." + } + } + } + }, + "total": { + "type": "integer", + "description": "Total number of groups." + } + } + }, + "consents": { + "type": "object", + "description": "Contains opt-in consents' definitions.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "Stores information about opt-in consents." + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of opt-in consents." + }, + "data": { + "type": "array", + "description": "An array of consents.", + "items": { + "type": "object", + "additionalProperties": false, + "description": "Contains an opt-in consent definition.", + "properties": { + "id": { + "type": "string", + "example": "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", + "description": "Unique consent ID." + }, + "name": { + "type": "string", + "description": "Consent name." + }, + "description": { + "type": "string", + "description": "Consent description." + }, + "category": { + "type": "string", + "description": "Consent category." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-04-13T09:11:27.037Z", + "description": "Timestamp representing the date and time when the consent was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-05-14T09:11:27.037Z", + "description": "Timestamp representing the date and time when the consent was updated in ISO 8601 format." + }, + "object": { + "type": "string", + "default": "consent", + "description": "Stores information about an opt-in consent." + } + } + } + }, + "total": { + "type": "integer", + "description": "Total number of consents." } } } } - } - }, - "404": { - "description": "Returns an error when requesting the code of a voucher that has been deleted or does not exist.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + }, + "20_res_list_categories": { + "type": "object", + "title": "List Categories Response Body", + "description": "Response schema for **GET** `/categories`.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about categories in a dictionary." + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of category objects.", + "default": "data" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/20_obj_category_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of categories." + } + } + }, + "20_obj_category_object": { + "type": "object", + "title": "Category Object", + "description": "This is an object representing a category.", + "x-tags": [ + "CATEGORIES API" + ], + "properties": { + "id": { + "type": "string", + "description": "Unique category ID assigned by Voucherify." + }, + "name": { + "type": "string", + "description": "Category name." + }, + "hierarchy": { + "type": "integer", + "description": "Category hierarchy." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the category was created in ISO 8601 format.", + "example": "2022-07-14T10:45:13.156Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2022-08-16T10:52:08.094Z", + "description": "Timestamp representing the date and time when the category was updated in ISO 8601 format.", + "format": "date-time" + }, + "object": { + "type": "string", + "default": "category", + "description": "The type of object represented by the JSON. This object stores information about the category." + } + }, + "examples": [ + { + "id": "cat_0b60cfe7d0d7ddbb55", + "name": "Update", + "hierarchy": 1, + "created_at": "2022-07-14T10:45:13.156Z", + "updated_at": "2022-08-16T11:03:54.727Z", + "object": "category" + } + ] + }, + "20_req_update_categories_categoryId": { + "type": "object", + "title": "Update Category Request Body", + "description": "Request schema for updating a category using **PUT** `/categories/{categoryId}`.", + "properties": { + "name": { + "type": "string", + "description": "Category name." + }, + "hierarchy": { + "type": "integer", + "description": "Category hierarchy." + } + }, + "required": [ + "name", + "hierarchy" + ] + }, + "20_req_create_category": { + "type": "object", + "title": "Create Category Request Body", + "description": "Request schema for creating a category using **POST** `/categories`.", + "properties": { + "name": { + "type": "string", + "description": "Category name." }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id v_OBVfpTVf24DBz0HZmKVZa5UEl1DUg2b", - "request_id": "v-0bb3403b9a158c87b2", - "resource_id": "v_OBVfpTVf24DBz0HZmKVZa5UEl1DUg2b", - "resource_type": "voucher" - } - } + "hierarchy": { + "type": "integer", + "description": "Category hierarchy." } - } - } - } - } - }, - "put": { - "operationId": "update-voucher", - "tags": [ - "VOUCHERS API" - ], - "summary": "Update Voucher", - "description": "Updates the specified voucher by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged.\n\nFields other than the ones listed in the request body won't be modified. Even if provided, they will be silently skipped.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "required": true, - "description": "Specify the parameters to be updated.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_req_vouchers_code_PUT" }, - "examples": { - "Percent Discount": { - "value": { - "category": "Second", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "percent_off": 45, - "percent_off_formula": "IF(ORDER_AMOUNT > 100;CUSTOMER_METADATA(\"age\");CUSTOMER_METADATA(\"age\") / 2)", - "amount_limit": 1800, - "effect": "APPLY_TO_ORDER" - }, - "start_date": "2020-02-01T00:00:00Z", - "expiration_date": "2023-12-31T23:59:59Z", - "validity_timeframe": { - "duration": "PT2H", - "interval": "P3D" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "active": false, - "additional_info": "This voucher can be used with other coupons. Please feel free to do so.", - "metadata": { - "Season": "Winter" - } - } - }, - "Gift Card": { - "value": { - "category": "Existing Customers", - "gift": { - "amount": 20000, - "effect": "APPLY_TO_ITEMS" - }, - "start_date": "2021-01-01T00:00:00Z", - "active": false, - "additional_info": "This gift card is disabled.", - "metadata": { - "test": false, - "locale": "de-en-pl" - } - } + "required": [ + "name", + "hierarchy" + ] + }, + "20_res_create_category": { + "type": "object", + "title": "Category Object", + "description": "This is an object representing a newly created category.", + "properties": { + "id": { + "type": "string", + "description": "Unique category ID assigned by Voucherify." }, - "Loyalty Card": { - "value": { - "category": "Existing Customers", - "loyalty_card": { - "points": 20000 - }, - "active": false, - "additional_info": "This loyalty card is being deactivated and points updated.", - "metadata": { - "test": false, - "locale": "de-en-pl" - } - } + "name": { + "type": "string", + "description": "Category name." }, - "Amount Discount": { - "value": { - "category": "Existing Customers", - "discount": { - "amount_off": 2000, - "type": "AMOUNT", - "effect": "APPLY_TO_ITEMS" - }, - "start_date": "2021-01-01T00:00:00Z" - } + "hierarchy": { + "type": "integer", + "description": "Category hierarchy." }, - "Fixed Discount": { - "value": { - "category": "Existing Customers", - "discount": { - "type": "FIXED", - "fixed_amount": 2000, - "effect": "APPLY_TO_ITEMS" - }, - "start_date": "2021-01-01T00:00:00Z" - } + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the category was created in ISO 8601 format.", + "example": "2022-07-14T10:45:13.156Z", + "format": "date-time" }, - "Unit Discount": { - "value": { - "discount": { - "type": "UNIT", - "effect": "ADD_MANY_ITEMS", - "units": [ - { - "unit_off": 2, - "unit_type": "prod_0a9f9ab4ab019a42d5", - "effect": "ADD_MISSING_ITEMS" - }, - { - "unit_off": 1, - "unit_type": "prod_0a9f9aeddb019a42db", - "effect": "ADD_MISSING_ITEMS" - } - ] - } - } + "object": { + "type": "string", + "default": "category", + "description": "The type of object represented by the JSON. This object stores information about the category." } } - } - } - }, - "responses": { - "200": { - "description": "Returns the voucher object if the update succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_obj_voucher_object" + }, + "21_obj_metadata_schema_object": { + "type": "object", + "title": "Metadata Schema Object", + "description": "This is an object representing a metadata schema.", + "properties": { + "id": { + "type": "string", + "description": "Unique metadata schema ID.", + "example": "ms_OF36L2rk4EqhdxvZs56IW9iE" }, - "examples": { - "Percent Discount": { - "value": { - "id": "v_9PbXndxO3S8xfztwMtIvuMXReonF248m", - "code": "percent1", - "campaign": null, - "campaign_id": null, - "category": "Second", - "category_id": "cat_0bb81a481615a37b5e", - "categories": [ - { - "id": "cat_0bb81a481615a37b5e", - "name": "Second", - "hierarchy": 2, - "created_at": "2022-09-20T05:58:01.561Z", - "object": "category" - } - ], - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "amount_limit": 1800, - "percent_off": 45, - "percent_off_formula": "IF(ORDER_AMOUNT > 100;CUSTOMER_METADATA(\"age\");CUSTOMER_METADATA(\"age\") / 2)", - "effect": "APPLY_TO_ORDER" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2020-02-01T00:00:00.000Z", - "expiration_date": "2023-12-31T23:59:59.000Z", - "validity_timeframe": { - "interval": "P3D", - "duration": "PT2H" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "active": false, - "additional_info": "This voucher can be used with other coupons. Please feel free to do so.", - "metadata": { - "Season": "Winter" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX19MPtNCPjoG/pKloolK+BZH/OCIpjYqj+B6IVJJmTYKeBINcB0JioL/tSw3iuK4FvgF8VyDyTfL26IpzbT81DDOnKeFIDUJraQDJiKxWcrG/RCFsVky4olBJ+GZFb9pLpN5gC/rn0pqYw==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19MPtNCPjoG%2FpKloolK%2BBZH%2FOCIpjYqj%2BB6IVJJmTYKeBINcB0JioL%2FtSw3iuK4FvgF8VyDyTfL26IpzbT81DDOnKeFIDUJraQDJiKxWcrG%2FRCFsVky4olBJ%2BGZFb9pLpN5gC%2Frn0pqYw%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/J73XXWgMf2BsVM21kpnFLQak5dpGzThYNTYPT62U6q+5RDlh/CXylkTrhegRnWJw1HA7iehT8iUoV4M4cV0KBdp5WgJ3lXeFZcpX3Mpu0T02PRcYbdCIiSO1kO50Y8Hg/heHcshw22Q==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FJ73XXWgMf2BsVM21kpnFLQak5dpGzThYNTYPT62U6q%2B5RDlh%2FCXylkTrhegRnWJw1HA7iehT8iUoV4M4cV0KBdp5WgJ3lXeFZcpX3Mpu0T02PRcYbdCIiSO1kO50Y8Hg%2FheHcshw22Q%3D%3D" + "related_object": { + "type": "string", + "description": "The resource type. There is an infinite number of possibilities for the resource type because you can define custom metadata schemas. Some examples are included here to show you the standard metadata schema resource types.", + "enum": [ + "campaign", + "customer", + "earning_rule", + "loyalty_tier", + "order", + "order_item", + "product", + "promotion_tier", + "publication", + "redemption", + "reward", + "voucher" + ] + }, + "properties": { + "description": "Contains the metadata definitions. There can be many properties within this object.", + "anyOf": [ + { + "properties": { + "custom_property_name": { + "type": "object", + "description": "Custom property name. This is defined in **Project Settings** > **Metadata Schema** in the Dashboard.", + "properties": { + "type": { + "type": "string", + "enum": [ + "string", + "number", + "object", + "date", + "datetime", + "geopoint", + "boolean", + "image_url" + ] + }, + "array": { + "type": "boolean", + "description": "Indicates whether the definition is an array." + }, + "optional": { + "type": "boolean", + "description": "Indicates whether this definition is optional or not optional for the resource." + }, + "objectType": { + "type": [ + "string", + "null" + ], + "description": "Returns the name of the custom resource if the resource was previously defined in the Dashboard as a custom (non-standard) Nested object." + }, + "eq": { + "type": "array", + "description": "Array of possible values when the setting for `is equal to any of` in the Dashboard is defined explicitly.", + "items": {} + }, + "ne": { + "type": "array", + "description": "Array of values that are not allowed when the setting for `is not equal to any of` in the Dashboard is defined explicitly.", + "items": {} + }, + "lt": { + "type": "integer", + "description": "A property of `number` type must have `less than` this value." + }, + "lte": { + "type": "integer", + "description": "A property of `number` type must be `less than or equal` to this value." + }, + "gt": { + "type": "integer", + "description": "A property of `number` type must be `greater than` this value." + }, + "gte": { + "type": "integer", + "description": "A property of `number` type must be `greater than or equal` to this value." + }, + "deleted": { + "type": "boolean", + "description": "Indicates whether the definition was deleted from the schema." + }, + "maxLength": { + "type": "integer", + "description": "Value for maximum length when the setting for `has maximum length of` in the Dashboard is defined explicitly." + }, + "minLength": { + "type": "integer", + "description": "Value indicating minimum length when the setting for `has minimum length of` in the Dashboard is defined explicitly." + }, + "exactLength": { + "type": "integer", + "description": "Value indicating exact length when the setting for `has exact length of` in the Dashboard is defined explicitly." + } + } } - }, - "is_referral_code": false, - "created_at": "2022-09-19T14:41:30.976Z", - "updated_at": "2022-09-20T06:00:50.202Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": 101, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/percent1/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/percent1/publications?page=1&limit=10" - }, - "object": "voucher" + } } - }, - "Gift Card": { - "value": { - "id": "v_7xaObxyK5LG62Rp0Xqpez7lqiBFL62pL", - "code": "welcomegiftcard", - "campaign": null, - "campaign_id": null, - "category": "Existing Customers", - "type": "GIFT_VOUCHER", - "discount": null, - "gift": { - "amount": 20000, - "balance": 20000, - "effect": "APPLY_TO_ITEMS" - }, - "loyalty_card": null, - "start_date": "2021-01-01T00:00:00.000Z", - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": false, - "additional_info": "This gift card is disabled.", - "metadata": { - "test": false, - "locale": "de-en-pl" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+mTbI2MdzBdMJ7AsOPKvGGgRB7O4oHZv5qq8I3M/OBPJm4PV8bTtBgR+oXOU4Jv1ucbIV7yg1mzC86LVFKjO7Ptnj+63mS9QdHvvILEAulBuZZQ+hZ0HmFXjDl4Quz/kUqGwffKGTziQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BmTbI2MdzBdMJ7AsOPKvGGgRB7O4oHZv5qq8I3M%2FOBPJm4PV8bTtBgR%2BoXOU4Jv1ucbIV7yg1mzC86LVFKjO7Ptnj%2B63mS9QdHvvILEAulBuZZQ%2BhZ0HmFXjDl4Quz%2FkUqGwffKGTziQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX184KgQ11OfpqB4WkJuH9ushSwZb0YrcN+8OaGPHxBQMiBr2axwnvQlZYv6YhqWtnc5iHByHrkg+6qYHxOLBPRMWCysIhcuUEB57IDhgYUHRPyM2bWjQadVHngGfVGCQ0CUy4PO/71RdMw==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX184KgQ11OfpqB4WkJuH9ushSwZb0YrcN%2B8OaGPHxBQMiBr2axwnvQlZYv6YhqWtnc5iHByHrkg%2B6qYHxOLBPRMWCysIhcuUEB57IDhgYUHRPyM2bWjQadVHngGfVGCQ0CUy4PO%2F71RdMw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-02-17T09:09:49.665Z", - "updated_at": "2022-02-17T11:11:48.071Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "redeemed_amount": 0, - "object": "list", - "url": "/v1/vouchers/welcomegiftcard/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/welcomegiftcard/publications?page=1&limit=10" - }, - "object": "voucher" + ], + "type": "object" + }, + "allow_defined_only": { + "type": "boolean", + "description": "Restricts the creation of metadata fields when set to `true`. In other words, it indicates whether or not you are allowed to create new metadata definitions; for example, in the campaign manager or publication manager. If it is set to true, then only the defined fields will be available for assigning values.\t" + }, + "created_at": { + "type": "string", + "example": "2021-12-03T13:33:44.556Z", + "description": "Timestamp representing the date and time when the metadata schema was created in ISO 8601 format.\t", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2022-08-11T08:05:30.695Z", + "description": "Timestamp representing the date and time when the metadata schema was updated in ISO 8601 format.\t", + "format": "date-time" + }, + "object": { + "type": "string", + "default": "metadata_schema", + "description": "The type of object represented by the JSON. This object stores information about the metadata schema." + } + }, + "x-tags": [ + "METADATA SCHEMAS API" + ], + "examples": [ + { + "id": "ms_27vMXZqBAkkqBoOuw8EYTRLn", + "related_object": "earning_rule", + "properties": { + "channel_id": { + "type": "string", + "array": true, + "optional": true, + "objectType": null, + "exactLength": 5 + }, + "channel_name": { + "eq": [ + "instagram", + "facebook", + "google", + "twitter", + "linkedin", + "website" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null } }, - "Loyalty Card": { - "value": { - "id": "v_l84t3fy3keMUiOeaHbN1cbTdW8O5eUlm", - "code": "welcomeloyalty", - "campaign": "Loyalty Campaign", - "campaign_id": "camp_E87CubZLZ8eoQt3c4kAEZsx0", - "category": "Existing Customers", - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 20000, - "balance": 20000 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": false, - "additional_info": "This loyalty card is being deactivated and points updated.", - "metadata": { - "test": false, - "locale": "de-en-pl" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX186PCWooyrNsjfI+nb+Y9ziUZ1k7xe+nJQ53Ms1ynNJOX6JXC6SwxS1WDhYwAKX5FxaDoKyuPf5MkQrkeB6u5bSx333ldAyLypNnqwBD2N17S64WFnTqV7eXUk3hS30wDYcz0cQAJFDcQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186PCWooyrNsjfI%2Bnb%2BY9ziUZ1k7xe%2BnJQ53Ms1ynNJOX6JXC6SwxS1WDhYwAKX5FxaDoKyuPf5MkQrkeB6u5bSx333ldAyLypNnqwBD2N17S64WFnTqV7eXUk3hS30wDYcz0cQAJFDcQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/FWUg0RbOU7R7Zqg7/8Ba6oYuXrmIl7EdXGgaPMPfpePNGRzxBu4LP2dNEUO9h1Sh37MR1PxOoaemPwlgTDo/1G8dX1JjSppNoaTHhkzk2w4yutNhP7o8cq3ZBbT3TNMTKb2H3fUMc7A==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FFWUg0RbOU7R7Zqg7%2F8Ba6oYuXrmIl7EdXGgaPMPfpePNGRzxBu4LP2dNEUO9h1Sh37MR1PxOoaemPwlgTDo%2F1G8dX1JjSppNoaTHhkzk2w4yutNhP7o8cq3ZBbT3TNMTKb2H3fUMc7A%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-02-17T09:12:01.428Z", - "updated_at": "2022-02-17T11:20:12.447Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "redeemed_points": 0, - "object": "list", - "url": "/v1/vouchers/welcomeloyalty/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/welcomeloyalty/publications?page=1&limit=10" - }, - "object": "voucher" + "allow_defined_only": false, + "created_at": "2022-08-25T13:09:59.970Z", + "updated_at": "2022-08-25T13:11:15.704Z", + "object": "metadata_schema" + }, + { + "id": "ms_psGSDpVl6JcPilPA7toZ83Kj", + "related_object": "campaign", + "properties": { + "region": { + "eq": [ + "EMEA", + "AMER", + "APAC" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null } }, - "Amount Discount": { - "value": { - "id": "v_jMIjKfG2oJ7vCwIPhsLsbXYGTdPLlbJd", - "code": "WelcomeDiscountAmount", - "campaign": null, - "campaign_id": null, - "category": "Existing Customers", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 2000, - "effect": "APPLY_TO_ITEMS" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2021-01-01T00:00:00.000Z", - "expiration_date": "2022-12-31T23:59:59.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "PT1H" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 + "allow_defined_only": false, + "created_at": "2022-08-25T13:12:58.447Z", + "updated_at": null, + "object": "metadata_schema" + }, + { + "id": "ms_f0r4hm3ta6a4a5ch3ma", + "related_object": "customer", + "properties": { + "age": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "city_id": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "location": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "favorite_brands": { + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "acquisition_channel": { + "eq": [ + "Facebook", + "Twitter", + "Website" ], - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", - "metadata": { - "test": true, - "locale": "de-en" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+TcEE9sZP6aMfAW3NZv9GWlCnUNn+SiK4FIbMRWWjN5hzTR7Yc/73yfldUb6SMgIvUNL551Nz/nPjrMY2iauia1MSWX21MItsSPfy8qccrC+WAlvpGK/1ZklnxYaeKqxTqwSXl7ppSlgcuEejbFiaqEDajvYUZsF4=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BTcEE9sZP6aMfAW3NZv9GWlCnUNn%2BSiK4FIbMRWWjN5hzTR7Yc%2F73yfldUb6SMgIvUNL551Nz%2FnPjrMY2iauia1MSWX21MItsSPfy8qccrC%2BWAlvpGK%2F1ZklnxYaeKqxTqwSXl7ppSlgcuEejbFiaqEDajvYUZsF4%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/AhpZMq/h+Phi8JZF9m4qL8/U/Z5AST82jaAOnnhdHdbaGjB1+/0VFIdGBA8w2+3JX5qd61Dfk6yfiLCraVw7lYjQddCHF5SKtJs4hqsLHZevQTCzpZkeIHC3ThsG/fLZTsaNn8tjewd/W4qn/2Cc5NgTdv7fqui4=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FAhpZMq%2Fh%2BPhi8JZF9m4qL8%2FU%2FZ5AST82jaAOnnhdHdbaGjB1%2B%2F0VFIdGBA8w2%2B3JX5qd61Dfk6yfiLCraVw7lYjQddCHF5SKtJs4hqsLHZevQTCzpZkeIHC3ThsG%2FfLZTsaNn8tjewd%2FW4qn%2F2Cc5NgTdv7fqui4%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-02-17T11:41:05.236Z", - "updated_at": "2022-02-17T11:45:29.269Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_tDN7MJNayjrf1wyn", - "rule_id": "val_4j7DCRm2IS59", - "related_object_id": "v_jMIjKfG2oJ7vCwIPhsLsbXYGTdPLlbJd", - "related_object_type": "voucher", - "created_at": "2022-02-17T11:41:05.210Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - }, - "redemption": { - "quantity": 10, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/WelcomeDiscountAmount/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/WelcomeDiscountAmount/publications?page=1&limit=10" - }, - "object": "voucher" + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "customer_life_time_value": { + "type": "number", + "array": false, + "optional": true, + "objectType": null } }, - "Fixed Discount": { - "value": { - "id": "v_B1Pe7QPTjXCHm8IcDkJAQs4g6Zc08UlK", - "code": "wou4w1Og", - "campaign": "Fixed", - "campaign_id": "camp_2jVA6EKGSAe6scyc3i1q9ROD", - "category": "Existing Customers", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "FIXED", - "effect": "APPLY_TO_ITEMS", - "fixed_amount": 2000 - }, - "gift": null, - "loyalty_card": null, - "start_date": "2021-01-01T00:00:00.000Z", - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX18zxYPpRIYeGHCoCAp3ZAPEUM0qacHQIIW/82oGOW24bFMA06kahjkZKVA/1mqqJsqh83C29Jhdz82KrRsM2zl9nzplu5hrmn7m0twnf5NQaTTcovEvnBV8Kej9tGhzc/dPwqE+xEKuDg==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX18zxYPpRIYeGHCoCAp3ZAPEUM0qacHQIIW%2F82oGOW24bFMA06kahjkZKVA%2F1mqqJsqh83C29Jhdz82KrRsM2zl9nzplu5hrmn7m0twnf5NQaTTcovEvnBV8Kej9tGhzc%2FdPwqE%2BxEKuDg%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX18tsK1tz0X2IQWbFHCY4wZBDjoysFt1fBlWo/9bm/HNTci1Q3bSFuIzqIQqlU2TkSacFBgOWGuVG08XboZsqNSXXsAgST9tyoxpaOJ22B2EwWspdvuwJqvZh4PpEyh3BBDS7eOWsr3+Sw==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18tsK1tz0X2IQWbFHCY4wZBDjoysFt1fBlWo%2F9bm%2FHNTci1Q3bSFuIzqIQqlU2TkSacFBgOWGuVG08XboZsqNSXXsAgST9tyoxpaOJ22B2EwWspdvuwJqvZh4PpEyh3BBDS7eOWsr3%2BSw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-02-17T11:54:37.766Z", - "updated_at": "2022-02-17T12:04:53.346Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": 1, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/wou4w1Og/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/wou4w1Og/publications?page=1&limit=10" - }, - "object": "voucher" + "allow_defined_only": false, + "created_at": "2021-12-01T08:00:48.889Z", + "updated_at": "2022-09-12T07:34:49.163Z", + "object": "metadata_schema" + }, + { + "id": "ms_jHUoFlgepKVEftxK1pKPGZlO", + "related_object": "loyalty_tier", + "properties": { + "level_name": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "audience_restricted": { + "type": "boolean", + "array": false, + "optional": true, + "objectType": null } }, - "Unit Discount": { - "value": { - "id": "v_cu8nyozvTDA413H17bH5BLha0cjxt7s8", - "code": "MultipleUnitTypesUnitDiscount", - "campaign": null, - "campaign_id": null, - "category": "New Customers", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "UNIT", - "effect": "ADD_MANY_ITEMS", - "units": [ - { - "unit_off": 2, - "unit_type": "prod_0a9f9ab4ab019a42d5", - "effect": "ADD_MISSING_ITEMS" - }, - { - "unit_off": 1, - "unit_type": "prod_0a9f9aeddb019a42db", - "effect": "ADD_MISSING_ITEMS" - } - ] - }, - "gift": null, - "loyalty_card": null, - "start_date": "2020-01-01T00:00:00.000Z", - "expiration_date": "2022-12-31T23:59:59.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "PT1H" - }, - "validity_day_of_week": [ + "allow_defined_only": false, + "created_at": "2022-08-25T13:14:54.954Z", + "updated_at": "2022-08-25T13:15:24.436Z", + "object": "metadata_schema" + }, + { + "id": "ms_f1r5Tm3ta6a4a5ch3ma", + "related_object": "order", + "properties": { + "card": { + "eq": [ + "Visa", + "MasterCard", + "Other" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "currency": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "location": { + "ne": [ 1, 2, - 3, - 4, - 5 + 18, + 22 ], - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", - "metadata": { - "test": true, - "locale": "de-en" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+ocJBtZ9NqT97gZ/QTfOz54TAoRoKO3tnCYBtHZWMghEHT0b2aFrPSL1lqMyf6fYy6DH2/DkH5p5Vd8dOozW1LV6wPVatWpa1lZMeMIB0OcARCW3q+3QydoW2KdliLKyksFwumH9C7Fsnj6HTaEbUjSttTZE/be+o=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BocJBtZ9NqT97gZ%2FQTfOz54TAoRoKO3tnCYBtHZWMghEHT0b2aFrPSL1lqMyf6fYy6DH2%2FDkH5p5Vd8dOozW1LV6wPVatWpa1lZMeMIB0OcARCW3q%2B3QydoW2KdliLKyksFwumH9C7Fsnj6HTaEbUjSttTZE%2Fbe%2Bo%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+Sly3IYj3EbZFHGGNxV6Ns4j76O8d0kRQe3WriJz5qY6s4GBIwlsdy13AciaQuiVt232HlOlZ4TzGaSSk3+ZMldwBGaTp/fIN9SGBW/NVUtfDOI2sIDLZCBBrdK7WVvtCQQ+1Y+6qClYg/QurJExCFRkDeKpKjDug=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BSly3IYj3EbZFHGGNxV6Ns4j76O8d0kRQe3WriJz5qY6s4GBIwlsdy13AciaQuiVt232HlOlZ4TzGaSSk3%2BZMldwBGaTp%2FfIN9SGBW%2FNVUtfDOI2sIDLZCBBrdK7WVvtCQQ%2B1Y%2B6qClYg%2FQurJExCFRkDeKpKjDug%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-02-18T06:27:45.619Z", - "updated_at": "2022-02-18T06:31:08.630Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": 5, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/publications?page=1&limit=10" - }, - "object": "voucher" + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "store_city": { + "eq": [ + "Hampden", + "San Francisco", + "Warsaw" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "location_id": { + "eq": [ + "L1", + "L2", + "L3" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "payment_mean": { + "eq": [ + "credit-card", + "wire-transfer", + "paypal" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "booking_end_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + }, + "booking_start_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null } - } - } - } - } - }, - "400": { - "description": "Returns an error if, for example, the AMOUNT type discount doesn't have the `type` attribute defined.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" + }, + "allow_defined_only": false, + "created_at": "2021-12-01T08:00:47.575Z", + "updated_at": "2022-10-25T10:05:18.978Z", + "object": "metadata_schema" }, - "examples": { - "Invalid Voucher": { - "value": { - "code": 400, - "key": "invalid_voucher", - "message": "Invalid Voucher", - "details": "It is not possible to change Voucher discount type", - "request_id": "b7f5149d-83e5-46ef-93ad-ef191a87b185" + { + "id": "ms_7ux44AEnt82bqo8ww5V1SXzV", + "related_object": "order_item", + "properties": { + "manufacturer_id": { + "gte": 15, + "type": "number", + "array": false, + "optional": true, + "objectType": null } - } - } - } - } - } - } - }, - "delete": { - "operationId": "delete-voucher", - "tags": [ - "VOUCHERS API" - ], - "summary": "Delete Voucher", - "description": "Deletes a voucher. This operation cannot be undone. Additionally, this operation removes any redemptions on the voucher.", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "force", - "description": "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." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." - }, - "404": { - "description": "Returns an error indicating that the voucher with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + }, + "allow_defined_only": false, + "created_at": "2022-08-25T13:16:03.167Z", + "updated_at": null, + "object": "metadata_schema" }, - "examples": { - "Voucher Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id 10OFF", - "request_id": "v-0ae28d3cec96bb1b7e", - "resource_id": "10OFF", - "resource_type": "voucher" - } - } - } - } - } - } - } - }, - "post": { - "operationId": "create-voucher", - "tags": [ - "VOUCHERS API" - ], - "summary": "Create Voucher", - "description": "Create a standalone voucher. You can choose to create a `GIFT_VOUCHER`, a `DISCOUNT_VOUCHER`, or a `LOYALTY_CARD`. The code path parameter can use all letters of the English alphabet, Arabic numerals and special characters. \n\nWhen you create a new voucher, you can specify a type to create it.\nCreating a new voucher will create a new stand alone voucher if no `campaign` name or `campaign_id` is provided. In case of the loyalty card, a campaign name is required.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the details of the voucher that you would like to create.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_req_vouchers_code_POST" - }, - "examples": { - "Percentage Discount": { - "value": { - "category": "New Customers", - "type": "DISCOUNT_VOUCHER", - "discount": { - "percent_off": 10, - "type": "PERCENT", - "effect": "APPLY_TO_ORDER" - }, - "start_date": "2022-01-01T00:00:00Z", - "expiration_date": "2022-12-31T23:59:59Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P2D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", - "redemption": { - "quantity": 10 + { + "id": "ms_s3c0N6m3ta6a4a5ch3ma", + "related_object": "product", + "properties": { + "vendor": { + "type": "string", + "array": false, + "optional": true, + "objectType": null }, - "metadata": { - "test": true, - "locale": "de-en" + "category": { + "type": "string", + "array": false, + "optional": true, + "objectType": null }, - "validation_rules": [ - "val_4j7DCRm2IS59" - ] - } + "location": { + "type": "geopoint", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2021-12-01T08:00:48.298Z", + "updated_at": "2022-07-14T15:53:29.226Z", + "object": "metadata_schema" }, - "Gift Card": { - "value": { - "category": "New Customers", - "type": "GIFT_VOUCHER", - "gift": { - "amount": 10000, - "effect": "APPLY_TO_ORDER" - }, - "start_date": "2022-01-01T00:00:00Z", - "active": true, - "additional_info": "This gift card is enabled immediately upon creation.", - "metadata": { - "test": true, - "locale": "de-en" + { + "id": "ms_dNb5aLMzU0VBCiRuxLOeMNwn", + "related_object": "promotion_tier", + "properties": { + "level": { + "type": "string", + "array": false, + "optional": true, + "objectType": null } - } + }, + "allow_defined_only": false, + "created_at": "2022-01-24T10:42:04.937Z", + "updated_at": "2022-09-23T08:51:46.266Z", + "object": "metadata_schema" }, - "Loyalty Card": { - "value": { - "category": "New Customers", - "campaign": "camp_E87CubZLZ8eoQt3c4kAEZsx0", - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 10000 + { + "id": "ms_fzvWNh7sU4LeykEQ2Abpg6jG", + "related_object": "publication", + "properties": { + "file_uploaded": { + "type": "image_url", + "array": false, + "optional": true, + "objectType": null }, - "additional_info": "This loyalty card is enabled immediately upon creation.", - "metadata": { - "test": true, - "locale": "de-en" + "publication_method": { + "type": "string", + "array": false, + "optional": true, + "objectType": null } - } + }, + "allow_defined_only": false, + "created_at": "2022-08-25T13:16:35.534Z", + "updated_at": "2022-09-12T10:26:31.135Z", + "object": "metadata_schema" }, - "Amount Discount with Formula": { - "value": { - "category": "First", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 100, - "amount_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", - "effect": "APPLY_TO_ORDER" - }, - "start_date": "2020-01-01T00:00:00Z", - "expiration_date": "2022-12-31T23:59:59Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P2D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": true, - "additional_info": "This voucher can be used with other coupons.", - "redemption": { - "quantity": 100 + { + "id": "ms_t4ir0Dm3ta6a4a5ch3ma", + "related_object": "redemption", + "properties": { + "location_id": { + "eq": [ + "L1", + "L2", + "L3" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null }, - "metadata": { - "Season": "Spring" + "redemption_location": { + "type": "object", + "array": false, + "optional": true, + "objectType": "Location" } - } + }, + "allow_defined_only": false, + "created_at": "2021-12-01T08:00:48.794Z", + "updated_at": "2022-08-25T13:19:50.497Z", + "object": "metadata_schema" }, - "Percent Discount with Formula": { - "value": { - "category": "First", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "percent_off": 40, - "percent_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", - "amount_limit": 1700, - "effect": "APPLY_TO_ORDER" - }, - "start_date": "2020-01-01T00:00:00Z", - "expiration_date": "2022-12-31T23:59:59Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P2D" + { + "id": "ms_PwrAtwqCFXeH4Qix22gEkqhl", + "related_object": "reward", + "properties": { + "reward_type": { + "eq": [ + "MATERIAL", + "PAY-WITH-POINTS", + "DISCOUNT-COUPON", + "GIFT-CARD-CREDITS", + "LOYALTY POINTS" + ], + "type": "string", + "array": false, + "optional": false, + "objectType": null + } + }, + "allow_defined_only": true, + "created_at": "2022-08-25T13:07:13.689Z", + "updated_at": "2022-08-25T13:08:26.696Z", + "object": "metadata_schema" + }, + { + "id": "ms_9uE6eP17Jvoxl46mCqL6Q3Ut", + "related_object": "voucher", + "properties": { + "lang": { + "type": "string", + "array": false, + "optional": true, + "objectType": null }, - "validity_day_of_week": [ - 0, - 1 - ], - "active": true, - "additional_info": "This voucher can be used with other coupons.", - "redemption": { - "quantity": 101 + "Season": { + "eq": [ + "Spring", + "Summer", + "Fall", + "Winter" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null }, - "metadata": { - "Season": "Fall" + "marketing_text": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "ProductionVoucherCodeMetaData": { + "type": "string", + "array": false, + "deleted": true, + "optional": true, + "objectType": null } - } + }, + "allow_defined_only": false, + "created_at": "2022-01-24T10:42:23.994Z", + "updated_at": "2022-09-19T14:13:30.590Z", + "object": "metadata_schema" } - } - } - } - }, - "responses": { - "200": { - "description": "Returns a voucher object if the call succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_obj_voucher_object" + ] + }, + "21_res_list_metadata_shemas": { + "title": "List Metadata Schemas Response Body", + "type": "object", + "description": "Response schema for listing metadata schemas using **GET** `/metadata-schemas`.", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about metadata schemas in a dictionary.", + "default": "list" }, - "examples": { - "Percentage Discount": { - "value": { - "id": "v_MBOEmHelKwvykVZ8JcT4TE5Kla5IMJyc", - "code": "welcome", - "campaign": null, - "campaign_id": null, - "category": "New Customers", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "percent_off": 10, - "effect": "APPLY_TO_ORDER" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2022-01-01T00:00:00.000Z", - "expiration_date": "2022-12-31T23:59:59.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "PT1H" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", - "metadata": { - "test": true, - "locale": "de-en" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+by33CNzWu6xXjCrLKRr1+H9K3I9wOSa7idiHrMYJe0HlrWiy7INhaJf1BnaKJjLKcUC+4/hCbILtJ9lHXZWhewG5q5rmx29gK0IH2eRauw1qCZKIlXfqeGTG2T5ftPsEl1D4xf8W2MA==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bby33CNzWu6xXjCrLKRr1%2BH9K3I9wOSa7idiHrMYJe0HlrWiy7INhaJf1BnaKJjLKcUC%2B4%2FhCbILtJ9lHXZWhewG5q5rmx29gK0IH2eRauw1qCZKIlXfqeGTG2T5ftPsEl1D4xf8W2MA%3D%3D" + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of metadata schema objects.", + "default": "schemas" + }, + "schemas": { + "type": "array", + "description": "Array of metadata schema objects.", + "items": { + "$ref": "#/components/schemas/21_obj_metadata_schema_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of metadata schemas." + } + }, + "examples": [ + { + "object": "list", + "data_ref": "schemas", + "schemas": [ + { + "id": "ms_yqMHRHH6S1KYIHPmQHealNf4", + "related_object": "Payment", + "properties": { + "payment_tax": { + "type": "number", + "array": false, + "optional": true, + "objectType": null }, - "barcode": { - "id": "U2FsdGVkX19wOdFeXYXZ4Xu22L0Ummk03Urz/ZTnXUFeHeehtK4L6RTvNgVeSR+McTZR4DYNLEGydZ+Fo2xEqqM1UWyl8Bx22Pi1CxghADOcy3bAvSca7EEPpvKrCY403UWUDvaO/OEAjvVoiEuaHA==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19wOdFeXYXZ4Xu22L0Ummk03Urz%2FZTnXUFeHeehtK4L6RTvNgVeSR%2BMcTZR4DYNLEGydZ%2BFo2xEqqM1UWyl8Bx22Pi1CxghADOcy3bAvSca7EEPpvKrCY403UWUDvaO%2FOEAjvVoiEuaHA%3D%3D" + "payment_method": { + "type": "string", + "array": false, + "optional": true, + "objectType": null } }, - "is_referral_code": false, - "created_at": "2022-02-17T09:05:34.668Z", - "updated_at": null, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_74F7QZoYbUoljwQO", - "rule_id": "val_4j7DCRm2IS59", - "related_object_id": "v_MBOEmHelKwvykVZ8JcT4TE5Kla5IMJyc", - "related_object_type": "voucher", - "created_at": "2022-02-17T09:05:34.642Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - }, - "redemption": { - "quantity": 10, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/welcome/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/welcome/publications?page=1&limit=10" - }, - "object": "voucher" - } - }, - "Gift Card": { - "value": { - "id": "v_7xaObxyK5LG62Rp0Xqpez7lqiBFL62pL", - "code": "welcomegiftcard", - "campaign": null, - "campaign_id": null, - "category": "New Customers", - "type": "GIFT_VOUCHER", - "discount": null, - "gift": { - "amount": 10000, - "balance": 10000, - "effect": "APPLY_TO_ORDER" - }, - "loyalty_card": null, - "start_date": "2022-01-01T00:00:00.000Z", - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": "This gift card is enabled immediately upon creation.", - "metadata": { - "test": true, - "locale": "de-en" + "allow_defined_only": true, + "created_at": "2022-03-07T11:01:01.747Z", + "updated_at": "2022-03-07T11:01:44.785Z", + "object": "metadata_schema" + }, + { + "id": "ms_DwUjpX32sY3fJEoQELpS7bN3", + "related_object": "campaign", + "properties": { + "Store": { + "type": "string", + "array": false, + "deleted": true, + "optional": true, + "objectType": null + }, + "locale": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "date_tag": { + "type": "date", + "array": false, + "optional": true, + "objectType": null + }, + "store_names": { + "eq": [ + "Store 1 - New York - Broadway", + "Store 2 - Florida - Miami", + "Store 3 - London - Heathrow", + "Store 4 - Berlin - Alexanderplatz" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "date_time_tag": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + }, + "favorite_brands": { + "type": "string", + "array": true, + "deleted": true, + "optional": true, + "objectType": null + }, + "height_customer_number": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "location_country_string": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + } }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+mTbI2MdzBdMJ7AsOPKvGGgRB7O4oHZv5qq8I3M/OBPJm4PV8bTtBgR+oXOU4Jv1ucbIV7yg1mzC86LVFKjO7Ptnj+63mS9QdHvvILEAulBuZZQ+hZ0HmFXjDl4Quz/kUqGwffKGTziQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BmTbI2MdzBdMJ7AsOPKvGGgRB7O4oHZv5qq8I3M%2FOBPJm4PV8bTtBgR%2BoXOU4Jv1ucbIV7yg1mzC86LVFKjO7Ptnj%2B63mS9QdHvvILEAulBuZZQ%2BhZ0HmFXjDl4Quz%2FkUqGwffKGTziQ%3D%3D" + "allow_defined_only": false, + "created_at": "2021-12-03T13:33:44.556Z", + "updated_at": "2022-07-26T13:57:42.288Z", + "object": "metadata_schema" + }, + { + "id": "ms_f0r4hm3ta6a4a5ch3ma", + "related_object": "customer", + "properties": { + "birth_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + }, + "CRM_created_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + }, + "customer_location": { + "type": "geopoint", + "array": false, + "optional": true, + "objectType": null + }, + "acquisition_channel": { + "eq": [ + "Facebook", + "Twitter", + "Website" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null }, - "barcode": { - "id": "U2FsdGVkX184KgQ11OfpqB4WkJuH9ushSwZb0YrcN+8OaGPHxBQMiBr2axwnvQlZYv6YhqWtnc5iHByHrkg+6qYHxOLBPRMWCysIhcuUEB57IDhgYUHRPyM2bWjQadVHngGfVGCQ0CUy4PO/71RdMw==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX184KgQ11OfpqB4WkJuH9ushSwZb0YrcN%2B8OaGPHxBQMiBr2axwnvQlZYv6YhqWtnc5iHByHrkg%2B6qYHxOLBPRMWCysIhcuUEB57IDhgYUHRPyM2bWjQadVHngGfVGCQ0CUy4PO%2F71RdMw%3D%3D" + "customer_life_time_value": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2021-12-03T06:33:45.894Z", + "updated_at": "2022-07-14T15:15:34.928Z", + "object": "metadata_schema" + }, + { + "id": "ms_7X7krsG84H6MeNuIaKkb4LXN", + "related_object": "earning_rule", + "properties": { + "Type": { + "type": "string", + "array": false, + "optional": true, + "minLength": 6, + "objectType": null } }, - "is_referral_code": false, - "created_at": "2022-02-17T09:09:49.665Z", + "allow_defined_only": false, + "created_at": "2022-07-27T08:54:07.980Z", "updated_at": null, - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "redeemed_amount": 0, - "object": "list", - "url": "/v1/vouchers/welcomegiftcard/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/welcomegiftcard/publications?page=1&limit=10" - }, - "object": "voucher" - } - }, - "Loyalty Card": { - "value": { - "id": "v_l84t3fy3keMUiOeaHbN1cbTdW8O5eUlm", - "code": "welcomeloyalty", - "campaign": "Loyalty Campaign", - "campaign_id": "camp_E87CubZLZ8eoQt3c4kAEZsx0", - "category": "New Customers", - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 10000, - "balance": 10000 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": "This loyalty card is enabled immediately upon creation.", - "metadata": { - "test": true, - "locale": "de-en" + "object": "metadata_schema" + }, + { + "id": "ms_OF36L2rk4EqhdxvZs56IW9iE", + "related_object": "loyalty_tier", + "properties": { + "has_funds": { + "type": "boolean", + "array": false, + "optional": true, + "objectType": null + } }, - "assets": { - "qr": { - "id": "U2FsdGVkX186PCWooyrNsjfI+nb+Y9ziUZ1k7xe+nJQ53Ms1ynNJOX6JXC6SwxS1WDhYwAKX5FxaDoKyuPf5MkQrkeB6u5bSx333ldAyLypNnqwBD2N17S64WFnTqV7eXUk3hS30wDYcz0cQAJFDcQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186PCWooyrNsjfI%2Bnb%2BY9ziUZ1k7xe%2BnJQ53Ms1ynNJOX6JXC6SwxS1WDhYwAKX5FxaDoKyuPf5MkQrkeB6u5bSx333ldAyLypNnqwBD2N17S64WFnTqV7eXUk3hS30wDYcz0cQAJFDcQ%3D%3D" + "allow_defined_only": false, + "created_at": "2022-03-30T06:22:16.685Z", + "updated_at": "2022-07-27T08:55:01.628Z", + "object": "metadata_schema" + }, + { + "id": "ms_f1r5Tm3ta6a4a5ch3ma", + "related_object": "order", + "properties": { + "Payment": { + "type": "object", + "array": false, + "deleted": true, + "optional": true, + "objectType": "Payment" + }, + "day_of_week": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "location_id": { + "eq": [ + "L1", + "L2", + "L3" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "payment_mean": { + "eq": [ + "credit-card", + "wire-transfer", + "paypal" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "booking_end_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null }, - "barcode": { - "id": "U2FsdGVkX1/FWUg0RbOU7R7Zqg7/8Ba6oYuXrmIl7EdXGgaPMPfpePNGRzxBu4LP2dNEUO9h1Sh37MR1PxOoaemPwlgTDo/1G8dX1JjSppNoaTHhkzk2w4yutNhP7o8cq3ZBbT3TNMTKb2H3fUMc7A==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FFWUg0RbOU7R7Zqg7%2F8Ba6oYuXrmIl7EdXGgaPMPfpePNGRzxBu4LP2dNEUO9h1Sh37MR1PxOoaemPwlgTDo%2F1G8dX1JjSppNoaTHhkzk2w4yutNhP7o8cq3ZBbT3TNMTKb2H3fUMc7A%3D%3D" + "booking_start_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + }, + "number_of_store_visits": { + "type": "number", + "array": false, + "optional": true, + "objectType": null } }, - "is_referral_code": false, - "created_at": "2022-02-17T09:12:01.428Z", - "updated_at": null, - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "redeemed_points": 0, - "object": "list", - "url": "/v1/vouchers/welcomeloyalty/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/welcomeloyalty/publications?page=1&limit=10" - }, - "object": "voucher" - } - }, - "Amount Discount with Formula": { - "value": { - "id": "v_pmjVYKEDFzMqwNroHTlFcI1yKLqUcVVS", - "code": "amount1", - "campaign": null, - "campaign_id": null, - "category": "First", - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" + "allow_defined_only": false, + "created_at": "2021-12-03T06:33:45.798Z", + "updated_at": "2022-04-20T06:47:10.350Z", + "object": "metadata_schema" + }, + { + "id": "ms_0qgIlxP7bYb8H59DqpnWBCUN", + "related_object": "order_item", + "properties": { + "Size": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "Color": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "Thickness": { + "eq": [ + "Thin", + "Medium", + "Thick" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null } - ], - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 100, - "amount_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", - "effect": "APPLY_TO_ORDER" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2020-01-01T00:00:00.000Z", - "expiration_date": "2022-12-31T23:59:59.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "PT1H" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": true, - "additional_info": "This voucher can be used with other coupons.", - "metadata": { - "Season": "Spring" }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+aMFY2yoGxlWkhulvTPR8RlMZtfOaWXnL6PCnegsV73aCTsue+JlUrQsbh+dmp2gJigaVixgvyC7/zUxQjf8tnVT4R79G4LmUkltHMqHsaf++fsP1G07nDl9/2WHh/QVb6z4KP/DX5Dw==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BaMFY2yoGxlWkhulvTPR8RlMZtfOaWXnL6PCnegsV73aCTsue%2BJlUrQsbh%2Bdmp2gJigaVixgvyC7%2FzUxQjf8tnVT4R79G4LmUkltHMqHsaf%2B%2BfsP1G07nDl9%2F2WHh%2FQVb6z4KP%2FDX5Dw%3D%3D" + "allow_defined_only": false, + "created_at": "2022-03-11T13:32:55.029Z", + "updated_at": "2022-05-23T13:46:01.463Z", + "object": "metadata_schema" + }, + { + "id": "ms_s3c0N6m3ta6a4a5ch3ma", + "related_object": "product", + "properties": { + "color": { + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "origin": { + "type": "string", + "array": false, + "optional": true, + "minLength": 1, + "objectType": null + }, + "product_location": { + "type": "geopoint", + "array": false, + "optional": true, + "objectType": null + }, + "metadata_attribute_name_with_date_property": { + "type": "date", + "array": false, + "optional": true, + "objectType": null + }, + "metadata_attribute_name_with_number_property": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "metadata_attribute_name_with_boolean_property": { + "type": "boolean", + "array": false, + "optional": true, + "objectType": null }, - "barcode": { - "id": "U2FsdGVkX1+X2OimwSCEmGvGrZXXK+b4OrStQELVsHRup8Su+uISCOBz7xWdbpoLVJlSFepcRxSNUUdjcbpgKH7YNfaclrta8Ig6/GK/4YFlh0cPKCGOG5WWyXWzxxmVgVqRdI7KR8/hdaq2FCQeWA==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BX2OimwSCEmGvGrZXXK%2Bb4OrStQELVsHRup8Su%2BuISCOBz7xWdbpoLVJlSFepcRxSNUUdjcbpgKH7YNfaclrta8Ig6%2FGK%2F4YFlh0cPKCGOG5WWyXWzxxmVgVqRdI7KR8%2Fhdaq2FCQeWA%3D%3D" + "metadata_attribute_name_with_datetime_property": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null } }, - "is_referral_code": false, - "created_at": "2022-09-19T14:22:50.552Z", - "updated_at": null, - "redemption": { - "quantity": 100, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/amount1/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/amount1/publications?page=1&limit=10" + "allow_defined_only": false, + "created_at": "2021-12-03T06:33:45.880Z", + "updated_at": "2022-07-14T15:46:47.994Z", + "object": "metadata_schema" + }, + { + "id": "ms_th8YHt9yFYY1yAA99XOasT5W", + "related_object": "promotion_tier", + "properties": { + "has_budget": { + "type": "boolean", + "array": false, + "optional": true, + "objectType": null + } }, - "object": "voucher" - } - }, - "Percent Discount with Formula": { - "value": { - "id": "v_9PbXndxO3S8xfztwMtIvuMXReonF248m", - "code": "percent1", - "campaign": null, - "campaign_id": null, - "category": "First", - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" + "allow_defined_only": false, + "created_at": "2022-01-24T07:22:21.523Z", + "updated_at": "2022-07-27T08:54:42.909Z", + "object": "metadata_schema" + }, + { + "id": "ms_Z7niydc0OpGjDRL4yB40niXn", + "related_object": "publication", + "properties": { + "year": { + "type": "number", + "array": false, + "optional": true, + "objectType": null } - ], - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "amount_limit": 1700, - "percent_off": 40, - "percent_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", - "effect": "APPLY_TO_ORDER" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2020-01-01T00:00:00.000Z", - "expiration_date": "2022-12-31T23:59:59.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "PT1H" - }, - "validity_day_of_week": [ - 0, - 1 - ], - "active": true, - "additional_info": "This voucher can be used with other coupons.", - "metadata": { - "Season": "Fall" }, - "assets": { - "qr": { - "id": "U2FsdGVkX19MPtNCPjoG/pKloolK+BZH/OCIpjYqj+B6IVJJmTYKeBINcB0JioL/tSw3iuK4FvgF8VyDyTfL26IpzbT81DDOnKeFIDUJraQDJiKxWcrG/RCFsVky4olBJ+GZFb9pLpN5gC/rn0pqYw==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19MPtNCPjoG%2FpKloolK%2BBZH%2FOCIpjYqj%2BB6IVJJmTYKeBINcB0JioL%2FtSw3iuK4FvgF8VyDyTfL26IpzbT81DDOnKeFIDUJraQDJiKxWcrG%2FRCFsVky4olBJ%2BGZFb9pLpN5gC%2Frn0pqYw%3D%3D" + "allow_defined_only": false, + "created_at": "2022-03-30T06:23:49.715Z", + "updated_at": "2022-04-19T10:28:24.568Z", + "object": "metadata_schema" + }, + { + "id": "ms_t4ir0Dm3ta6a4a5ch3ma", + "related_object": "redemption", + "properties": { + "location_id": { + "eq": [ + "L1", + "L2", + "L3" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null }, - "barcode": { - "id": "U2FsdGVkX1/J73XXWgMf2BsVM21kpnFLQak5dpGzThYNTYPT62U6q+5RDlh/CXylkTrhegRnWJw1HA7iehT8iUoV4M4cV0KBdp5WgJ3lXeFZcpX3Mpu0T02PRcYbdCIiSO1kO50Y8Hg/heHcshw22Q==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FJ73XXWgMf2BsVM21kpnFLQak5dpGzThYNTYPT62U6q%2B5RDlh%2FCXylkTrhegRnWJw1HA7iehT8iUoV4M4cV0KBdp5WgJ3lXeFZcpX3Mpu0T02PRcYbdCIiSO1kO50Y8Hg%2FheHcshw22Q%3D%3D" + "store_names": { + "eq": [ + "Store 1 - New York - Broadway", + "Store 2 - Florida - Miami", + "Store 3 - London - Heathrow", + "Store 4 - Berlin - Alexanderplatz" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null } }, - "is_referral_code": false, - "created_at": "2022-09-19T14:41:30.976Z", - "updated_at": null, - "redemption": { - "quantity": 101, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/percent1/redemptions?page=1&limit=10" + "allow_defined_only": false, + "created_at": "2021-12-03T06:33:45.890Z", + "updated_at": "2022-07-26T14:58:24.546Z", + "object": "metadata_schema" + }, + { + "id": "ms_EnSASZVEIDsZAYa8Z0nG8Rlg", + "related_object": "reward", + "properties": { + "Type": { + "type": "string", + "array": false, + "optional": true, + "objectType": null, + "exactLength": 4 + } }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/percent1/publications?page=1&limit=10" + "allow_defined_only": false, + "created_at": "2022-07-27T08:53:32.257Z", + "updated_at": "2022-07-27T08:53:48.542Z", + "object": "metadata_schema" + }, + { + "id": "ms_xUHvkRBPvVJAlWcTkVzufKx4", + "related_object": "voucher", + "properties": { + "unit": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "Region": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "Season": { + "eq": [ + "Spring", + "Summer", + "Fall", + "Winter" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "CATEGORY": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "active_on_calendar_month": { + "eq": [ + 1, + 2, + 3, + 5, + 7, + 9, + 10, + 11, + 12 + ], + "type": "number", + "array": false, + "optional": true, + "objectType": null + } }, - "object": "voucher" - } - } - } - } - } - }, - "409": { - "description": "Returns an error if a voucher code already exists.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" - }, - "examples": { - "Duplicate Code": { - "value": { - "code": 409, - "key": "duplicate_found", - "message": "Duplicated resource found", - "details": "Duplicated voucher exists with id CODE", - "request_id": "v-0ae786a8f786b73dfa", - "resource_id": "CODE", - "resource_type": "voucher" + "allow_defined_only": false, + "created_at": "2022-01-24T07:22:01.281Z", + "updated_at": "2022-06-22T07:22:09.577Z", + "object": "metadata_schema" } - } + ], + "total": 13 } - } - } - } - } - } - }, - "/v1/vouchers/": { - "post": { - "operationId": "generate-random-code", - "tags": [ - "VOUCHERS API" - ], - "summary": "Generate Random Code", - "description": "Create a standalone voucher. You can choose to create a `GIFT_VOUCHER`, a `DISCOUNT_VOUCHER`, or a `LOYALTY_CARD`. \n\nWhen you create a new voucher, you can specify a type to create it.\nCreating a new voucher will create a new stand alone voucher if no `campaign` name or `campaign_id` is provided. In case of the loyalty card, a campaign name is required.\n\nYou can optionally use the `code` parameter to define a specific code or the `code_config` parameter to design rules for Voucherify API to create a random code. If neither of the two parameters are passed, then a random code is generated by the Voucherify API.\n\nThis method will return an error when trying to create a voucher that already exists.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the details of the voucher that you would like to create.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_req_vouchers__POST" - }, - "examples": { - "Percentage Discount": { - "value": { - "category": "New Customers", - "code": "NEW-WELCOME-COUPON", - "type": "DISCOUNT_VOUCHER", - "campaign_id": "camp_Y6dLsYIZloGqP8izufXY6SSJ", - "discount": { - "percent_off": 10, - "type": "PERCENT", - "effect": "APPLY_TO_ORDER" - }, - "start_date": "2016-01-01T00:00:00Z", - "expiration_date": "2022-12-31T23:59:59Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P2D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", - "redemption": { - "quantity": 10 - }, - "metadata": { - "test": true, - "locale": "de-en" - }, - "validation_rules": [ - "val_4j7DCRm2IS59" - ] - } + ] + }, + "22_res_list_locations": { + "title": "List Locations Response Body", + "type": "object", + "description": "Response schema for listing locations using **GET** `/locations`.", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about locations in a dictionary.", + "default": "list" }, - "Gift Card": { - "value": { - "category": "New Customers", - "type": "GIFT_VOUCHER", - "gift": { - "amount": 10000, - "effect": "APPLY_TO_ORDER" - }, - "start_date": "2022-01-01T00:00:00Z", - "active": true, - "additional_info": "This gift card is enabled immediately upon creation.", - "metadata": { - "test": true, - "locale": "de-en" - }, - "code_config": { - "pattern": "GIFT-CARD-##########", - "prefix": "New-", - "postfix": "0", - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" - } - } + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of metadata schema objects.", + "default": "data" }, - "Loyalty Card": { - "value": { - "category": "New Customers", - "campaign": "camp_E87CubZLZ8eoQt3c4kAEZsx0", - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 10000 - }, - "additional_info": "This loyalty card is enabled immediately upon creation.", - "metadata": { - "test": true, - "locale": "de-en" - }, - "code_config": { - "pattern": "LOYALTY-CARD-##", - "prefix": "New-", - "postfix": "1", - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" - } + "data": { + "type": "array", + "description": "Array of location objects.", + "items": { + "$ref": "#/components/schemas/22_obj_location_object" } }, - "Unit Discount Multiple Items": { - "value": { - "category": "New Customers", - "code": "MultipleUnitTypesUnitDiscount", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "UNIT", - "effect": "ADD_MANY_ITEMS", - "units": [ - { - "unit_off": 1, - "unit_type": "prod_0a9f9ab4ab019a42d5", - "effect": "ADD_NEW_ITEMS" - }, - { - "unit_off": 1, - "unit_type": "prod_0a9f9aeddb019a42db", - "effect": "ADD_MISSING_ITEMS" - } - ] - }, - "start_date": "2020-01-01T00:00:00Z", - "expiration_date": "2022-12-31T23:59:59Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P2D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", - "redemption": { - "quantity": 5 - }, - "metadata": { - "test": true, - "locale": "de-en" - } - } + "total": { + "type": "integer", + "description": "Total number of locations." }, - "Unit Discount Single Item": { - "value": { - "category": "New Customers", - "code": "AddMissingItemDiscount", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "UNIT", - "unit_off": 1, - "unit_type": "prod_0a9f9ab4ab019a42d5", - "effect": "ADD_MISSING_ITEMS" - }, - "start_date": "2020-01-01T00:00:00Z", - "expiration_date": "2022-12-31T23:59:59Z", - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", - "redemption": { - "quantity": 3 - } - } + "has_more": { + "type": "boolean", + "description": "As query results are always limited (by the limit parameter), the `has_more` flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different end date filter) to get more records returned in the results." } - } - } - } - }, - "responses": { - "200": { - "description": "Returns a voucher object if the call succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_obj_voucher_object" - }, - "examples": { - "Percentage Discount": { - "value": { - "id": "v_YJYfeKoR0XAGIvaM7k51wTbDjU4WIpC5", - "code": "NEW-WELCOME-COUPON", - "campaign": "Bug fix", - "campaign_id": "camp_Y6dLsYIZloGqP8izufXY6SSJ", - "category": "New Customers", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "percent_off": 10, - "effect": "APPLY_TO_ORDER" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2016-01-01T00:00:00.000Z", - "expiration_date": "2022-12-31T23:59:59.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "PT1H" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", - "metadata": { - "test": true, - "locale": "de-en" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX180g6GhUA0kT47tHGvZ5thjCgY5nbsPtiecixkkEznFVg2v3SDG9dpCbXR6BSUdM/d78Wm/zru1ybT4+AQ2X0JnEy86N7TZ/aoezZORjcBRUfyVM/scUUF/vmD4Ezn+Elp2+V9AFcAXN/WthaRMl9e7xvEeIEQ5nao=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX180g6GhUA0kT47tHGvZ5thjCgY5nbsPtiecixkkEznFVg2v3SDG9dpCbXR6BSUdM%2Fd78Wm%2Fzru1ybT4%2BAQ2X0JnEy86N7TZ%2FaoezZORjcBRUfyVM%2FscUUF%2FvmD4Ezn%2BElp2%2BV9AFcAXN%2FWthaRMl9e7xvEeIEQ5nao%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/AynivxYCEIxfTnf3A1lO0xsNihOlbUMo6Y6873LQ2qpmkk90aUFnaFKd7pVumcirRweblzGVSxy24Phhd174VSPaLxxmSKp0FPv0dRos/XWBg8zu0Kta0pA/yvFK3WWGlNoPPPnvEhVWKKzOr09Gj94SMrr+TGlI=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FAynivxYCEIxfTnf3A1lO0xsNihOlbUMo6Y6873LQ2qpmkk90aUFnaFKd7pVumcirRweblzGVSxy24Phhd174VSPaLxxmSKp0FPv0dRos%2FXWBg8zu0Kta0pA%2FyvFK3WWGlNoPPPnvEhVWKKzOr09Gj94SMrr%2BTGlI%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-02-17T07:14:40.096Z", - "updated_at": null, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_COu5PJAsWmAwuCqR", - "rule_id": "val_4j7DCRm2IS59", - "related_object_id": "v_YJYfeKoR0XAGIvaM7k51wTbDjU4WIpC5", - "related_object_type": "voucher", - "created_at": "2022-02-17T07:14:40.280Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - }, - "redemption": { - "quantity": 10, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/NEW-WELCOME-COUPON/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/NEW-WELCOME-COUPON/publications?page=1&limit=10" - }, - "object": "voucher" - } - }, - "Gift Voucher": { - "value": { - "id": "v_yAZyBimXtF9yQ2C5BEF9WMhNzOMJNfz6", - "code": "New-GIFT-CARD-8tqB6FcyhE0", - "campaign": null, - "campaign_id": null, - "category": "New Customers", - "type": "GIFT_VOUCHER", - "discount": null, - "gift": { - "amount": 10000, - "balance": 10000, - "effect": "APPLY_TO_ORDER" - }, - "loyalty_card": null, - "start_date": "2022-01-01T00:00:00.000Z", - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": "This gift card is enabled immediately upon creation.", - "metadata": { - "test": true, - "locale": "de-en" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+pm0q3U4i/KrjResuZpwDigEa5WcDOlwYS/bj3rsesZXDpJF5MNHMUsKqy0+wn5tY3QbjPGv0dwbqRn/OjrIRgNlP99azD0n0n9C/chiTABp8BxlJmMKKFo5AggBbQu4+Mw8Cv8V3+0Ga7ETzeehS+Yrj6c+3ioxg=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bpm0q3U4i%2FKrjResuZpwDigEa5WcDOlwYS%2Fbj3rsesZXDpJF5MNHMUsKqy0%2Bwn5tY3QbjPGv0dwbqRn%2FOjrIRgNlP99azD0n0n9C%2FchiTABp8BxlJmMKKFo5AggBbQu4%2BMw8Cv8V3%2B0Ga7ETzeehS%2BYrj6c%2B3ioxg%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/UaGX0zV8oXbpYah2G76V1ljYSy6hDSnWAZhpz5v10vRibGaOJUahyLcClMyxAsUhU9WXWi4BUGWIEEu510AxzxyGHOTDTjavJH0Q79PI0ciLHdujNFOgLOXWe9Ffwzj+Kvjmbhb22/SVZd/xzQlUBJcv7XboJYU0=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FUaGX0zV8oXbpYah2G76V1ljYSy6hDSnWAZhpz5v10vRibGaOJUahyLcClMyxAsUhU9WXWi4BUGWIEEu510AxzxyGHOTDTjavJH0Q79PI0ciLHdujNFOgLOXWe9Ffwzj%2BKvjmbhb22%2FSVZd%2FxzQlUBJcv7XboJYU0%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-02-17T07:49:10.834Z", - "updated_at": null, - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "redeemed_amount": 0, - "object": "list", - "url": "/v1/vouchers/New-GIFT-CARD-8tqB6FcyhE0/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/New-GIFT-CARD-8tqB6FcyhE0/publications?page=1&limit=10" - }, - "object": "voucher" - } - }, - "Loyalty Card": { - "value": { - "id": "v_tVkcOhjHCz9W7q8QnuJnTGPBR2hdaYrC", - "code": "New-LOYALTY-CARD-UC1", - "campaign": "Loyalty Campaign", - "campaign_id": "camp_E87CubZLZ8eoQt3c4kAEZsx0", - "category": "New Customers", - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 10000, - "balance": 10000 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": "This loyalty card is enabled immediately upon creation.", - "metadata": { - "test": true, - "locale": "de-en" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+6lGBFlqtS9OoY2wbAsoSupV43qa+g5sGu+R0IDTq2k85LIfbKfV9sDSYv80pP9ucsazJ6qGI9ineqQyhv9VVHdsJ2qGRiuZzpw/vRkSA0a7J9N1MpANgzqpIULZHLjYtrCQ/2el72nZ6Hpr2NkWtk19JTpNwB8tk=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B6lGBFlqtS9OoY2wbAsoSupV43qa%2Bg5sGu%2BR0IDTq2k85LIfbKfV9sDSYv80pP9ucsazJ6qGI9ineqQyhv9VVHdsJ2qGRiuZzpw%2FvRkSA0a7J9N1MpANgzqpIULZHLjYtrCQ%2F2el72nZ6Hpr2NkWtk19JTpNwB8tk%3D" - }, - "barcode": { - "id": "U2FsdGVkX180bvJVsyZvpAqwYXTnm4MvvH4Rur+ZhM+Mbmnva/fgYUcUbOttsFXPY/PMZ9Xi8pomVp26a7amIPguNimD8w4PMZLMavMtH7EtJ4k+0V0Wp7JUkudIKeRw2fDnQ3/0cgqvK6PMReUwFWb5nUT3ABpZDAdaOVoMDhE=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX180bvJVsyZvpAqwYXTnm4MvvH4Rur%2BZhM%2BMbmnva%2FfgYUcUbOttsFXPY%2FPMZ9Xi8pomVp26a7amIPguNimD8w4PMZLMavMtH7EtJ4k%2B0V0Wp7JUkudIKeRw2fDnQ3%2F0cgqvK6PMReUwFWb5nUT3ABpZDAdaOVoMDhE%3D" + }, + "examples": [ + { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "loc_NoMGXmHO9OUs7iz9mGWpamma", + "object": "location", + "name": "Belleville", + "shape": { + "type": "circle", + "format": "distance", + "distance": { + "center": "geo:40.79372699823857,-74.15092132694554", + "radius": "1.54 km" } }, - "is_referral_code": false, - "created_at": "2022-02-17T08:06:41.091Z", - "updated_at": null, - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "redeemed_points": 0, - "object": "list", - "url": "/v1/vouchers/New-LOYALTY-CARD-UC1/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/New-LOYALTY-CARD-UC1/publications?page=1&limit=10" - }, - "object": "voucher" - } - }, - "Unit Discount Multiple Items": { - "value": { - "id": "v_cu8nyozvTDA413H17bH5BLha0cjxt7s8", - "code": "MultipleUnitTypesUnitDiscount", - "campaign": null, - "campaign_id": null, - "category": "New Customers", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "UNIT", - "effect": "ADD_MANY_ITEMS", - "units": [ - { - "unit_off": 1, - "unit_type": "prod_0a9f9ab4ab019a42d5", - "effect": "ADD_NEW_ITEMS" - }, - { - "unit_off": 1, - "unit_type": "prod_0a9f9aeddb019a42db", - "effect": "ADD_MISSING_ITEMS" - } - ] - }, - "gift": null, - "loyalty_card": null, - "start_date": "2020-01-01T00:00:00.000Z", - "expiration_date": "2022-12-31T23:59:59.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "PT1H" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", - "metadata": { - "test": true, - "locale": "de-en" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+ocJBtZ9NqT97gZ/QTfOz54TAoRoKO3tnCYBtHZWMghEHT0b2aFrPSL1lqMyf6fYy6DH2/DkH5p5Vd8dOozW1LV6wPVatWpa1lZMeMIB0OcARCW3q+3QydoW2KdliLKyksFwumH9C7Fsnj6HTaEbUjSttTZE/be+o=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BocJBtZ9NqT97gZ%2FQTfOz54TAoRoKO3tnCYBtHZWMghEHT0b2aFrPSL1lqMyf6fYy6DH2%2FDkH5p5Vd8dOozW1LV6wPVatWpa1lZMeMIB0OcARCW3q%2B3QydoW2KdliLKyksFwumH9C7Fsnj6HTaEbUjSttTZE%2Fbe%2Bo%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+Sly3IYj3EbZFHGGNxV6Ns4j76O8d0kRQe3WriJz5qY6s4GBIwlsdy13AciaQuiVt232HlOlZ4TzGaSSk3+ZMldwBGaTp/fIN9SGBW/NVUtfDOI2sIDLZCBBrdK7WVvtCQQ+1Y+6qClYg/QurJExCFRkDeKpKjDug=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BSly3IYj3EbZFHGGNxV6Ns4j76O8d0kRQe3WriJz5qY6s4GBIwlsdy13AciaQuiVt232HlOlZ4TzGaSSk3%2BZMldwBGaTp%2FfIN9SGBW%2FNVUtfDOI2sIDLZCBBrdK7WVvtCQQ%2B1Y%2B6qClYg%2FQurJExCFRkDeKpKjDug%3D" + "created_at": "2022-07-15T06:04:36.924Z", + "updated_at": null + }, + { + "id": "loc_ae2gKWpAFMsuRhyMqGx2FZFF", + "object": "location", + "name": "New York", + "shape": { + "type": "polygon", + "format": "geojson", + "geojson": { + "type": "Polygon", + "coordinates": [ + [ + [ + -74.016167, + 40.703186 + ], + [ + -74.008687, + 40.750656 + ], + [ + -73.943597, + 40.851838 + ], + [ + -73.928559, + 40.845285 + ], + [ + -73.936152, + 40.8356 + ], + [ + -73.934298, + 40.810015 + ], + [ + -73.92711, + 40.795145 + ], + [ + -73.978623, + 40.710432 + ], + [ + -74.013201, + 40.701619 + ], + [ + -74.016167, + 40.703186 + ] + ] + ] } }, - "is_referral_code": false, - "created_at": "2022-02-18T06:27:45.619Z", - "updated_at": null, - "redemption": { - "quantity": 5, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/publications?page=1&limit=10" - }, - "object": "voucher" - } - }, - "Unit Discount Single Item": { - "value": { - "id": "v_NQdraO4fXWYvMMWYL9OY22hRernr553n", - "code": "AddMissingItemDiscount", - "campaign": null, - "campaign_id": null, - "category": "New Customers", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "UNIT", - "unit_off": 1, - "unit_type": "prod_0a9f9ab4ab019a42d5", - "effect": "ADD_MISSING_ITEMS" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2020-01-01T00:00:00.000Z", - "expiration_date": "2022-12-31T23:59:59.000Z", - "validity_timeframe": null, - "validity_day_of_week": null, - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX19Yh7LTNyOVKSXQ+ceTr023saElWAUeucwOgjTH50x1SoSF/PP1aoGBr6sSxHZNZOvBGumWNHjsF85y7cPY7La/4a0d1kWqnAiBWeWnGOgDFeQFqthGswypFOK1jdAzUPqLSbxW3O6q936N6Bsmoz4QHYE//kfWFhs=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19Yh7LTNyOVKSXQ%2BceTr023saElWAUeucwOgjTH50x1SoSF%2FPP1aoGBr6sSxHZNZOvBGumWNHjsF85y7cPY7La%2F4a0d1kWqnAiBWeWnGOgDFeQFqthGswypFOK1jdAzUPqLSbxW3O6q936N6Bsmoz4QHYE%2F%2FkfWFhs%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+RqzgyYsIJzAEBxmQt1OZLu4+PSUDQBldDKK1o5XsEoBSQEMPWHis1wJSg4ZNqJ9ZdJ0Ukc+K6X1fjg0ggDsCdXP2ZxpyGPD8/1ReggJZ/tq823ji7A5pzhG1TljA6+vmISuHvs2wkcum0djN9AWuAlB0F/vbXexo=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BRqzgyYsIJzAEBxmQt1OZLu4%2BPSUDQBldDKK1o5XsEoBSQEMPWHis1wJSg4ZNqJ9ZdJ0Ukc%2BK6X1fjg0ggDsCdXP2ZxpyGPD8%2F1ReggJZ%2Ftq823ji7A5pzhG1TljA6%2BvmISuHvs2wkcum0djN9AWuAlB0F%2FvbXexo%3D" + "created_at": "2022-07-15T05:37:45.299Z", + "updated_at": null + }, + { + "id": "loc_f5HqjVaiq7g9ISlmivpytxSf", + "object": "location", + "name": "Germany", + "shape": { + "type": "circle", + "format": "distance", + "distance": { + "center": "geo:51.303908897065064,10.222253628401518", + "radius": "192.37 km" } }, - "is_referral_code": false, - "created_at": "2022-02-18T06:46:44.536Z", - "updated_at": null, - "redemption": { - "quantity": 3, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/AddMissingItemDiscount/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/AddMissingItemDiscount/publications?page=1&limit=10" + "created_at": "2022-07-14T15:51:39.265Z", + "updated_at": null + }, + { + "id": "loc_RcYz537sV07e1t5aG5tIH9FD", + "object": "location", + "name": "Poland", + "shape": { + "type": "polygon", + "format": "geojson", + "geojson": { + "type": "Polygon", + "coordinates": [ + [ + [ + 18.553923, + 50.559107 + ], + [ + 18.528805, + 51.087437 + ], + [ + 19.591667, + 50.832424 + ], + [ + 19.425109, + 50.497984 + ], + [ + 19.375814, + 50.330652 + ], + [ + 19.398107, + 50.111652 + ], + [ + 18.73906, + 49.981498 + ], + [ + 18.272477, + 50.088707 + ], + [ + 18.553923, + 50.559107 + ] + ] + ] + } }, - "object": "voucher" + "created_at": "2022-07-14T15:21:55.085Z", + "updated_at": null } - } + ], + "total": 4, + "has_more": false } - } - } - } - } - } - }, - "/v1/vouchers/{code}/enable": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "2CpRCE2c" - }, - "name": "code", - "in": "path", - "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. `v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u`.", - "required": true - } - ], - "post": { - "operationId": "enable-voucher", - "tags": [ - "VOUCHERS API" - ], - "summary": "Enable Voucher", - "description": "There are various times when you'll want to manage a voucher's accessibility. This can be done by two API methods for managing the voucher state - *enable* and *disable*. \n___\nThe 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.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a voucher object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_obj_voucher_object" + ] + }, + "22_obj_location_object": { + "title": "Location object", + "type": "object", + "description": "This is an object representing a location.", + "x-tags": [ + "LOCATIONS API" + ], + "properties": { + "id": { + "type": "string", + "description": "Unique location ID, assigned by the Voucherify API.", + "example": "loc_NoMGXmHO9OUs7iz9mGWpamma" }, - "examples": { - "Example": { - "value": { - "id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "code": "2CpRCE2c", - "campaign": null, - "campaign_id": null, - "category": null, - "category_id": null, - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 300, - "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" - }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1+ro/6HLsfI9E/rz0QEoYv+rcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz+WQtg4nKpjUS0wcA7AuIbz2zb870YfJO/r5UBS5gCqQ==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bro%2F6HLsfI9E%2Frz0QEoYv%2BrcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz%2BWQtg4nKpjUS0wcA7AuIbz2zb870YfJO%2Fr5UBS5gCqQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3/4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ+aTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3%2F4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ%2BaTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-19T10:06:07.932Z", - "updated_at": "2022-09-19T11:54:17.248Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_HesdqEzt5e9c0T56", - "rule_id": "val_gZft0NKZSUWK", - "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "related_object_type": "voucher", - "created_at": "2022-09-19T10:06:07.934Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/2CpRCE2c/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/2CpRCE2c/publications?page=1&limit=10" - }, - "object": "voucher" - } - } - } - } - } - }, - "404": { - "description": "Returns an error if the voucher code does not exist or has been deleted.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about a `location`.", + "default": "location" + }, + "name": { + "type": "string", + "description": "Location name." }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id IrKORhS", - "request_id": "v-0a96cd820301c0483a", - "resource_id": "IrKORhS", - "resource_type": "voucher" + "shape": { + "type": "object", + "description": "Defines the shape and boundaries of the location.", + "anyOf": [ + { + "$ref": "#/components/schemas/22_obj_location_object_shape_circle" + }, + { + "$ref": "#/components/schemas/22_obj_location_object_shape_polygon" } - } + ] + }, + "created_at": { + "type": "string", + "example": "2022-02-14T15:12:06.817Z", + "description": "Timestamp representing the date and time when the location was created in ISO 8601 format.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2022-03-14T15:12:06.817Z", + "description": "Timestamp representing the date and time when the location was updated in ISO 8601 format.", + "format": "date-time" } } - } - } - } - } - }, - "/v1/vouchers/{code}/disable": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "2CpRCE2c" - }, - "name": "code", - "in": "path", - "required": true, - "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. `v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u`." - } - ], - "post": { - "operationId": "disable-voucher", - "tags": [ - "VOUCHERS API" - ], - "summary": "Disable Voucher", - "description": "There are various times when you'll want to manage a voucher's accessibility. This can be done by two API methods for managing the voucher state - *enable* and *disable*. \n___\nThis method sets the voucher state to **inactive**. The voucher cannot be redeemed.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a voucher object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_obj_voucher_object" + }, + "22_obj_location_object_shape_circle": { + "title": "Circle", + "type": "object", + "description": "This is an object representing a circular shape.", + "properties": { + "type": { + "type": "string", + "description": "The type of shape being defined is a `circle`.", + "default": "circle" }, - "examples": { - "Example": { - "value": { - "id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "code": "2CpRCE2c", - "campaign": null, - "campaign_id": null, - "category": null, - "category_id": null, - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 300, - "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" - }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": false, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1+ro/6HLsfI9E/rz0QEoYv+rcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz+WQtg4nKpjUS0wcA7AuIbz2zb870YfJO/r5UBS5gCqQ==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bro%2F6HLsfI9E%2Frz0QEoYv%2BrcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz%2BWQtg4nKpjUS0wcA7AuIbz2zb870YfJO%2Fr5UBS5gCqQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3/4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ+aTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3%2F4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ%2BaTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-19T10:06:07.932Z", - "updated_at": "2022-09-19T11:53:23.452Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_HesdqEzt5e9c0T56", - "rule_id": "val_gZft0NKZSUWK", - "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "related_object_type": "voucher", - "created_at": "2022-09-19T10:06:07.934Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/2CpRCE2c/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/2CpRCE2c/publications?page=1&limit=10" - }, - "object": "voucher" + "format": { + "type": "string", + "description": "The location is defined in terms of a `distance` object.", + "default": "distance" + }, + "distance": { + "type": "object", + "title": "Distance", + "description": "Defines the parameters for the circle.", + "properties": { + "center": { + "type": "string", + "description": "Center of the circle identified by GPS coordinates in decimal degrees.", + "example": "geo:40.79372699823857,-74.15092132694554" + }, + "radius": { + "type": "string", + "description": "Defines the radius of the circle." } } } } - } - }, - "404": { - "description": "Returns an error if the voucher code does not exist or has been deleted.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + }, + "22_obj_location_object_shape_polygon": { + "title": "Polygon", + "type": "object", + "description": "This is an object representing a polygon.", + "properties": { + "type": { + "type": "string", + "description": "The type of shape being defined is a `polygon`.", + "default": "polygon" + }, + "format": { + "type": "string", + "description": "The location is defined in terms of a `geojson` object.", + "default": "geojson" }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id IrKORhS", - "request_id": "v-0a96cd820301c0483a", - "resource_id": "IrKORhS", - "resource_type": "voucher" + "distance": { + "type": "object", + "title": "Geojson", + "description": "Defines the parameters for the polygon.", + "properties": { + "type": { + "type": "string", + "description": "Type of geojson coordinates, i.e. `Polygon`.", + "default": "Polygon" + }, + "coordinates": { + "type": "array", + "description": "Contains array of GeoJSON coordinate arrays.", + "items": { + "$ref": "#/components/schemas/22_geojson_array" + } } } } } - } - } - } - } - }, - "/v1/vouchers/{code}/balance": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "GIFT-CARD-1" - }, - "name": "code", - "in": "path", - "required": true, - "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. `v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u`." - } - ], - "post": { - "operationId": "add-remove-gift-voucher-balance", - "tags": [ - "VOUCHERS API" - ], - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "summary": "Add or Remove Gift Card Balance", - "description": "Add balance to an existing gift card.", - "requestBody": { - "required": true, - "description": "Provide the amount to be added to/subtracted from the gift card.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_req_vouchers_code_balance" + }, + "22_geojson_array": { + "title": "GeoJSON coordinate array.", + "type": "array", + "description": "GeoJSON coordinate array.", + "items": { + "$ref": "#/components/schemas/22_geojson_coordinates" + } + }, + "22_geojson_coordinates": { + "title": "GeoJSON coordinate.", + "type": "array", + "description": "GeoJSON coordinate.", + "items": { + "type": "integer" + } + }, + "22_filter_updated_at": { + "type": "object", + "title": "Updated at", + "properties": { + "updated_at": { + "$ref": "#/components/schemas/16_filter_conditions_date_time" + } }, - "examples": { - "Example": { - "value": { - "amount": 10000 - } + "description": "A filter on the list based on the object `updated_at` field. The value is a dictionary with the following options: `before`, `after`. A date value must be presented in ISO 8601 format (`2016-11-16T14:14:31Z` or `2016-11-16`). An example: `[updated_at][before]=2017-09-08T13:52:18.227Z`" + }, + "22_filter_created_at": { + "type": "object", + "title": "Created at", + "properties": { + "created_at": { + "$ref": "#/components/schemas/16_filter_conditions_date_time" } - } - } - } - }, - "responses": { - "200": { - "description": "Returns a balance object if the operation succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_res_vouchers_code_balance" - }, - "examples": { - "Example": { - "value": { - "amount": 10000, - "total": 20100, - "balance": 20100, - "type": "gift_voucher", - "object": "balance", - "related_object": { - "type": "voucher", - "id": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - } - } - } + }, + "description": "A filter on the list based on the object `created_at` field. The value is a dictionary with the following options: `before`, `after`. A date value must be presented in ISO 8601 format (`2016-11-16T14:14:31Z` or `2016-11-16`). An example: `[created_at][before]=2017-09-08T13:52:18.227Z`" + }, + "22_filter_name": { + "type": "object", + "title": "Name", + "properties": { + "name": { + "$ref": "#/components/schemas/16_filter_conditions_string" } - } - } - }, - "404": { - "description": "Returns an error if the voucher code does not exist or has been deleted.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + }, + "description": "A filter on the list based on the name field." + }, + "22_filter_id": { + "type": "object", + "title": "ID", + "properties": { + "id": { + "$ref": "#/components/schemas/16_filter_conditions_string" + } + }, + "description": "A filter on the list based on the id of the location." + }, + "23_obj_qualification_object": { + "title": "Qualification object", + "type": "object", + "description": "This is an object representing a qualification.", + "x-tags": [ + "QUALIFICATIONS API" + ], + "properties": { + "redeemables": { + "$ref": "#/components/schemas/23_obj_qualification_redeemables" }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id IrKORhS", - "request_id": "v-0a96cd820301c0483a", - "resource_id": "IrKORhS", - "resource_type": "voucher" - } - } + "tracking_id": { + "type": "string", + "description": "This identifier is generated during voucher qualification based on your internal id (e.g., email, database ID). This is a hashed customer source ID." + }, + "order": { + "type": "object", + "description": "The order object sent in the request.", + "$ref": "#/components/schemas/23_obj_order_object" + }, + "stacking_rules": { + "$ref": "#/components/schemas/23_obj_qualification_object_stacking_rules" } } - } - } - } - } - }, - "/v1/vouchers/{code}/transactions": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "GIFT-CARD-1" - }, - "name": "code", - "in": "path", - "required": true, - "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. `v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u`." - } - ], - "get": { - "operationId": "list-gift-card-transactions", - "tags": [ - "VOUCHERS API" - ], - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "summary": "List Gift Card Transactions", - "description": "List transactions that are associated with credit movements on a gift card.", - "responses": { - "200": { - "description": "Returns a dictionary of transaction objects", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_res_vouchers_code_transactions" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "vtx_0c9dccc4d5813e71bd", - "source_id": "20230317_subtract_1", - "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "source": "API", - "reason": "Subtracting credits from card", - "type": "CREDITS_REMOVAL", - "details": { - "balance": { - "type": "gift_voucher", - "total": 128020, - "amount": -2000, - "object": "balance", - "balance": 121020, - "related_object": { - "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "type": "voucher" - } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-17T15:50:00.786Z" - }, - { - "id": "vtx_0c9dcc920ac0e9ef82", - "source_id": "20230317_add_1", - "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "source": "API", - "reason": "Adding more points to card", - "type": "CREDITS_ADDITION", - "details": { - "balance": { - "type": "gift_voucher", - "total": 130020, - "amount": 20, - "object": "balance", - "balance": 123020, - "related_object": { - "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "type": "voucher" - } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-17T15:49:08.768Z" - }, - { - "id": "vtx_0c94f018d30bef6689", - "source_id": "HRwc0oHz_reward", - "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "source": "voucherify-web-ui", - "reason": "cash reward", - "type": "CREDITS_ADDITION", - "details": { - "balance": { - "type": "gift_voucher", - "total": 130000, - "amount": 2000, - "object": "balance", - "balance": 123000, - "related_object": { - "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "type": "voucher" - } - } + }, + "23_obj_order_object": { + "type": "object", + "title": "Order object", + "description": "This is an object representing an order. \n\nThe purchase transactions can be tracked in Voucherify by the creation of an order object. You can create, retrieve, and pay individual orders, as well as list and export all of them in a CSV format. Orders are identified by a unique ID.\n\nOrders are automatically created during the [redeem voucher](ref:redeem-voucher) and [redeem promotion](redeem-promotion) call.\n\n\n> #### order.id and order session\n>\n> If you use the same order.id in more than one redemption request, all valid discounts provided in the redemption payload will be applied to the given order.\n> \n> Each time you use particular order in your requests, the API will automatically trigger a new session linked to the order.id. The session is active during the request and ends asynchronously after the request is completed. The session mechanism ensures that the particular order.id can be used in one API request at once.", + "x-tags": [ + "ORDERS API" + ], + "properties": { + "id": { + "type": "string", + "description": "Unique order ID, assigned by Voucherify.", + "example": "ord_GFDbbv2I0wnO0sFUBOOOXPj2" + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the order was created in ISO 8601 format.", + "example": "2022-03-09T11:19:04.819Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2022-08-12T13:34:10.681Z", + "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format.", + "format": "date-time" + }, + "status": { + "type": "string", + "description": "Order status.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULFILLED" + ] + }, + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "discount_amount": { + "type": "integer", + "description": "Sum of all order-level discounts applied to the order." + }, + "items_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" + }, + "total_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`\t" + }, + "total_amount": { + "type": "integer", + "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", + "items": { + "type": "object", + "properties": { + "object": { + "type": "string", + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." + }, + "product_id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "sku_id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + }, + "discount_amount": { + "type": "integer", + "description": "The item-level discount applied to the item." + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" + }, + "product": { + "type": "object", + "description": "This object stores more information about the related product.", + "properties": { + "id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, - "related_transaction_id": null, - "created_at": "2023-03-10T18:38:02.055Z" - }, - { - "id": "vtx_0c94edbbaccbef5db6", - "source_id": null, - "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "source": null, - "reason": null, - "type": "CREDITS_REFUND", - "details": { - "balance": { - "type": "gift_voucher", - "total": 128000, - "amount": 44, - "object": "balance", - "balance": 121000, - "related_object": { - "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "type": "voucher" - } - }, - "order": { - "id": "ord_jj5EzDxDOd2xFPsAJJ18IaZK", - "source_id": null - }, - "redemption": { - "id": "r_0c94ed583fcafc31c1" - }, - "rollback": { - "id": "rr_0c94edbb8d0bef5d9e" - } + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" }, - "related_transaction_id": null, - "created_at": "2023-03-10T18:27:42.389Z" - }, - { - "id": "vtx_0c94ed584f4afc31da", - "source_id": null, - "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "source": null, - "reason": null, - "type": "CREDITS_REDEMPTION", - "details": { - "balance": { - "type": "gift_voucher", - "total": 128000, - "amount": -44, - "object": "balance", - "balance": 120956, - "related_object": { - "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "type": "voucher" - } - }, - "order": { - "id": "ord_jj5EzDxDOd2xFPsAJJ18IaZK", - "source_id": null - }, - "redemption": { - "id": "r_0c94ed583fcafc31c1" - } + "name": { + "type": "string", + "example": "Brewing System", + "description": "Product name." }, - "related_transaction_id": null, - "created_at": "2023-03-10T18:26:00.640Z" - }, - { - "id": "vtx_0c94e9432c4afc2134", - "source_id": "HRwc0oHz_removal", - "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "source": "voucherify-web-ui", - "reason": "removal", - "type": "CREDITS_REMOVAL", - "details": { - "balance": { - "type": "gift_voucher", - "total": 128000, - "amount": -2000, - "object": "balance", - "balance": 121000, - "related_object": { - "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "type": "voucher" - } - } + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + }, + "sku": { + "type": "object", + "description": "This object stores more information about the related SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." }, - "related_transaction_id": null, - "created_at": "2023-03-10T18:08:10.413Z" - }, - { - "id": "vtx_0c94e8100f8afc1c6c", - "source_id": null, - "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "source": null, - "reason": null, - "type": "CREDITS_REDEMPTION", - "details": { - "balance": { - "type": "gift_voucher", - "total": 130000, - "amount": -7000, - "object": "balance", - "balance": 123000, - "related_object": { - "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "type": "voucher" - } - }, - "order": { - "id": "ord_qZX3pEt5rFf5W23qRMDQcVt9", - "source_id": null - }, - "redemption": { - "id": "r_0c94e80fda4afc1c59" - } + "source_id": { + "type": "string", + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." }, - "related_transaction_id": null, - "created_at": "2023-03-10T18:02:55.935Z" - }, - { - "id": "vtx_0c94e6b82a4bef406c", - "source_id": "walmart", - "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "source": "voucherify-web-ui", - "reason": "return", - "type": "CREDITS_ADDITION", - "details": { - "balance": { - "type": "gift_voucher", - "total": 130000, - "amount": 5000, - "object": "balance", - "balance": 130000, - "related_object": { - "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "type": "voucher" - } - } + "sku": { + "type": "string", + "description": "SKU name." }, - "related_transaction_id": null, - "created_at": "2023-03-10T17:57:03.758Z" + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } } - ], - "has_more": false + } } } - } - } - } - }, - "404": { - "description": "Returns an error if the voucher code does not exist or has been deleted.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id IrKORhS", - "request_id": "v-0a96cd820301c0483a", - "resource_id": "IrKORhS", - "resource_type": "voucher" - } - } - } - } - } - } - } - } - }, - "/v1/vouchers/{code}/transactions/export": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "GIFT-CARD-1" - }, - "name": "code", - "in": "path", - "required": true, - "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. `v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u`." - } - ], - "post": { - "operationId": "export-gift-card-transactions", - "tags": [ - "VOUCHERS API" - ], - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "summary": "Export Gift Card Transactions", - "description": "Export transactions that are associated with credit movements on a gift card.\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
- `CREDITS_ADDITION`
- `CREDITS_REFUND`
- `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |", - "requestBody": { - "description": "Specify the parameters for the transaction export.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_req_create_gift_card_transactions_export" - }, - "examples": { - "Example": { - "value": { - "parameters": { - "order": "-created_at", - "fields": [ - "id", - "type", - "source_id", - "reason", - "balance", - "amount", - "created_at", - "voucher_id", - "campaign_id", - "details", - "source" - ] + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are attached to an order object. Stores additional information about the order in a structured format." + }, + "customer": { + "type": "object", + "description": "Object containing information about the customer that is making the purchase.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique customer ID of the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `customer` object." } } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns an export object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_obj_export_transactions_object" - }, - "examples": { - "Example": { - "value": { - "id": "exp_ARi2UbRjgfrHQJoVcKFrBUgA", - "object": "export", - "created_at": "2023-05-16T08:30:21.496Z", - "status": "SCHEDULED", - "channel": "API", - "exported_object": "voucher_transactions", - "parameters": { - "order": "-created_at", - "fields": [ - "id", - "type", - "source_id", - "reason", - "balance", - "amount", - "created_at", - "voucher_id", - "campaign_id", - "details", - "related_transaction_id", - "source" - ], - "filters": { - "voucher_id": { - "conditions": { - "$in": [ - "HRwc0oHz" - ] - } - } - } - }, - "result": null, - "user_id": null - } - }, - "No request body": { - "value": { - "id": "exp_ExEE5A6OIK4tssuNswr5O6SU", - "object": "export", - "created_at": "2023-03-21T13:34:57.034Z", - "status": "SCHEDULED", - "channel": "API", - "exported_object": "voucher_transactions", - "parameters": { - "filters": { - "voucher_id": { - "conditions": { - "$in": [ - "HRwc0oHz" - ] - } - } - } - }, - "result": null, - "user_id": null + }, + "referrer": { + "type": "object", + "description": "Object containing information about the referrer.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique referrer ID, who referred the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the referrer object." } } + }, + "customer_id": { + "type": "string", + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" + }, + "referrer_id": { + "type": "string", + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." } } - } - }, - "404": { - "description": "Returns an error if the voucher code does not exist or has been deleted.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + }, + "23_obj_qualification_object_stacking_rules": { + "type": "object", + "title": "Examine Qualification Stacking Rules", + "description": "Defines stacking rules for the redeemables.", + "properties": { + "redeemables_limit": { + "type": "integer", + "description": "Defines how many redeemables can be sent with one stacking request. We have extended the maximum value from 5 to 30 (comment: but more redeemables means more processing time!). Default limit is `30`.", + "default": 30 }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id IrKORhS", - "request_id": "v-0a96cd820301c0483a", - "resource_id": "IrKORhS", - "resource_type": "voucher" - } - } + "applicable_redeemables_limit": { + "type": "integer", + "description": "Defines how many of sent redeemables will be actually applied to the order (e.g. user can select 30 discounts but only 5 will be applied to the order, the remaining will be marked as SKIPPED). Default limit is `5`.", + "default": 5 } } - } - } - } - } - }, - "/v1/vouchers/import": { - "post": { - "operationId": "import-vouchers", - "tags": [ - "VOUCHERS API" - ], - "summary": "Import Vouchers", - "description": "Import standalone vouchers and gift cards into the repository.\n\n\n\n> 📘 Important notes\n>\n> - **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z.\n> - Custom code attributes (not supported by-default) need to be added as code **metadata**.\n> - You **cannot import the same codes** to a single Voucherify Project.\n\nAny parameters not provided in the payload will be left blank or null.\n\nFor both **standalone discount vouchers and gift cards**, you can import the following fields: \n\n- code\n- category\n- active\n- type\n- start_date\n- expiration_date\n- redemption.quantity\n- additional_info\n- metadata\n\nFor **gift cards**, you can also import the following field:\n\n- gift.amount\n\nFor **discount vouchers**, you can import the `discount` object. The object will slightly vary depending on the type of discount. Each discount type **requires** the `type` to be defined in the import.\n\n| **Discount Type** | **Required fields** |\n|:---|:---|\n| Amount | amount_off, effect |\n| Percent | percent_off, effect |\n| Fixed | fixed_amount, effect |\n| Unit - One item | unit_off, unit_type, effect |\n| Unit - Multiple items | unit_off, unit_type, effect |\n| Shipping | unit_off, unit_type, effect |\n\nFields other than the ones listed above won't be imported. Even if provided, they will be silently skipped.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "required": true, - "description": "The request body is an array of objects. Each object contains details about a specific voucher. ", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_req_vouchers_import" - }, - "examples": { - "Example": { - "value": [ - { - "code": "PROMO-CODE30OFF-NO-EFFECT", - "category": "new customer acquisition", - "type": "DISCOUNT_VOUCHER", - "active": true, - "discount": { - "amount_off": 3000, - "type": "AMOUNT" - }, - "start_date": "2020-12-01T23:00:00Z", - "expiration_date": "2023-12-19T23:00:00Z", - "redemption": { - "quantity": 1 - }, - "metadata": { - "unit": "EUR" - }, - "additional_info": "secret-code1" - }, - { - "code": "PROMO-CODE30-PERCENT-NO-EFFECT", - "type": "DISCOUNT_VOUCHER", - "active": false, - "discount": { - "percent_off": 30, - "type": "PERCENT" - }, - "start_date": "2020-12-10T23:00:00Z", - "expiration_date": "2023-12-31T23:00:00Z", - "redemption": { - "quantity": 1 - }, - "metadata": { - "unit": "EUR" - }, - "additional_info": "secret-code2" - }, + }, + "23_req_create_qualification": { + "type": "object", + "title": "Examine Qualification Request Body", + "description": "Request body schema for examining a qualification`.", + "properties": { + "customer": { + "anyOf": [ { - "code": "GIFT-CARD-100", - "type": "GIFT_VOUCHER", - "active": true, - "category": "new customer acquisition", - "gift": { - "amount": 10000 - }, - "start_date": "2020-12-10T23:00:00Z", - "expiration_date": "2023-12-31T23:00:00Z", - "redemption": { - "quantity": 5 - }, - "metadata": { - "unit": "EUR" - }, - "additional_info": "secret-GIFT-code2" + "$ref": "#/components/schemas/23_req_create_qualification_customer_id" }, { - "code": "PROMO-CODE1-PERCENT-EFFECT-ORDER", - "type": "DISCOUNT_VOUCHER", - "active": false, - "discount": { - "percent_off": 30, - "type": "PERCENT", - "effect": "APPLY_TO_ORDER" - }, - "start_date": "2020-12-10T23:00:00Z", - "expiration_date": "2023-12-31T23:00:00Z", - "redemption": { - "quantity": 1 - }, - "metadata": { - "unit": "EUR" - }, - "additional_info": "secret-code2" + "$ref": "#/components/schemas/23_req_create_qualification_customer_source_id" }, { - "code": "PROMO-CODE2-PERCENT-EFFECT-ITEM", - "type": "DISCOUNT_VOUCHER", - "active": false, - "discount": { - "percent_off": 30, - "type": "PERCENT", - "effect": "APPLY_TO_ITEMS" - }, - "start_date": "2020-12-10T23:00:00Z", - "expiration_date": "2023-12-31T23:00:00Z", - "redemption": { - "quantity": 1 - }, - "metadata": { - "unit": "EUR" - }, - "additional_info": "secret-code2" - }, + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ { - "code": "PROMO-CODE1-PERCENT-NO-EFFECT-REDEEMED-QUANTITY-ATTRIBUTE-DOESNT-GET-PASSED", - "type": "DISCOUNT_VOUCHER", - "active": false, - "discount": { - "percent_off": 30, - "type": "PERCENT" - }, - "start_date": "2020-12-10T23:00:00Z", - "expiration_date": "2023-12-31T23:00:00Z", - "redemption": { - "quantity": 1, - "redeemed_quantity": 1 - }, - "metadata": { - "unit": "EUR" - }, - "additional_info": "secret-code2" + "$ref": "#/components/schemas/23_req_create_qualification_order_id" }, { - "code": "PROMO-CODE1-AMOUNT-EFFECT-ITEMS-PROPORTIONALLY", - "type": "DISCOUNT_VOUCHER", - "active": false, - "discount": { - "amount_off": 30, - "type": "AMOUNT", - "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" - }, - "start_date": "2020-12-10T23:00:00Z", - "expiration_date": "2023-12-31T23:00:00Z", - "redemption": { - "quantity": 1 - }, - "metadata": { - "unit": "EUR" - }, - "additional_info": "secret-code2" + "$ref": "#/components/schemas/23_req_create_qualification_order_source_id" }, { - "code": "PROMO-CODE1-FIXED-EFFECT-ORDER", - "type": "DISCOUNT_VOUCHER", - "active": false, - "discount": { - "fixed_amount": 30, - "type": "FIXED", - "effect": "APPLY_TO_ORDER" - }, - "start_date": "2020-12-10T23:00:00Z", - "expiration_date": "2023-12-31T23:00:00Z", - "redemption": { - "quantity": 1 - }, - "metadata": { - "unit": "EUR" - }, - "additional_info": "secret-code2" + "$ref": "#/components/schemas/10_req_create_order" + } + ], + "description": "Order information. This object enables you to pass purchase transaction data. Read what properties you can use in the [Order object](ref:get-order)." + }, + "options": { + "type": "object", + "description": "Configure parameters returned in the response.", + "properties": { + "expand": { + "type": "array", + "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. \n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"redeemable\"] | - Returns the redeemables' metadata. |\n| [\"category\"] | - Returns an expanded `categories` object, showing details about the category. |", + "items": { + "type": "string", + "enum": [ + "redeemable", + "category" + ] + } }, - { - "code": "PROMO-CODE1-UNIT-SINGLE-ITEM-EFFECT-MISSING", - "type": "DISCOUNT_VOUCHER", - "active": false, - "discount": { - "unit_off": 1, - "unit_type": "prod_0a9f9aeddb019a42db", - "type": "UNIT", - "effect": "ADD_MISSING_ITEMS" - }, - "start_date": "2020-12-10T23:00:00Z", - "expiration_date": "2023-12-31T23:00:00Z", - "redemption": { - "quantity": 1 - }, - "metadata": { - "unit": "EUR" - }, - "additional_info": "secret-code2" + "limit": { + "type": "integer", + "description": "The maximum number of redeemables to be returned in the API request. The actual number of returned redeemables will be determined by the API. The default value is set to 5, and the maximum value is 50.", + "maximum": 50 }, - { - "code": "PROMO-CODE2-UNIT-MULTIPLE-ITEMS", - "type": "DISCOUNT_VOUCHER", - "active": true, - "discount": { - "type": "UNIT", - "effect": "ADD_MANY_ITEMS", - "units": [ - { - "unit_off": 1, - "unit_type": "prod_0a9f9aeddb019a42db", - "effect": "ADD_MISSING_ITEMS" - }, - { - "unit_off": 1, - "unit_type": "prod_0a9f9aeddb019a42db", - "effect": "ADD_NEW_ITEMS" - } - ] - }, - "start_date": "2020-12-10T23:00:00Z", - "expiration_date": "2023-12-31T23:00:00Z", - "redemption": { - "quantity": 1 - }, - "metadata": { - "unit": "EUR" - }, - "additional_info": "secret-code2" + "starting_after": { + "type": "string", + "example": "2021-09-08T13:52:18.227Z", + "format": "date-time", + "description": "Curser used for paging." }, - { - "code": "PROMO-CODE1-SHIPPING", - "type": "DISCOUNT_VOUCHER", - "active": false, - "discount": { - "type": "UNIT", - "unit_off": 1, - "unit_type": "prod_5h1pp1ng", - "effect": "ADD_MISSING_ITEMS" - }, - "start_date": "2020-12-10T23:00:00Z", - "expiration_date": "2023-12-31T23:00:00Z", - "redemption": { - "quantity": 1 - }, - "metadata": { - "unit": "EUR" - }, - "additional_info": "secret-code2" + "filters": { + "description": "A set of fiters to return only a specific category or type of redeemable.", + "anyOf": [ + { + "$ref": "#/components/schemas/23_obj_filter_resource_type" + }, + { + "$ref": "#/components/schemas/23_obj_filter_category_id" + } + ] } + } + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against redeemables requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the [Create Validation Rules](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "mode": { + "type": "string", + "description": "Defines which resources Voucherify will use. Currently, `BASIC` is supported." + }, + "scenario": { + "type": "string", + "description": "Defines the scenario Voucherify should consider during the qualification process.\n\n- `ALL` - Scenario that returns all redeemables available for the customer in one API request.\n- `CUSTOMER_WALLET` - returns vouchers applicable to the customer’s cart based on the vouchers assigned to the customer’s profile.\n- `AUDIENCE_ONLY` - returns all vouchers, promotion tiers, and campaigns available to the customer. Voucherify validates the rules based on the customer profile only.\n- `PRODUCTS` - returns all promotions available for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule).\n- `PRODUCTS_DISCOUNT` - returns all promotions available for products when a discount is defined as applicable to specific item(s).\n- `PROMOTION_STACKS` - returns the applicable promotion stacks.\n- `PRODUCTS_BY_CUSTOMER` - returns all promotions available for a customer for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule).\n- `PRODUCTS_DISCOUNT_BY_CUSTOMER` - returns all promotions available for a customer for products when a discount is defined as applicable to specific item(s).", + "enum": [ + "ALL", + "CUSTOMER_WALLET", + "AUDIENCE_ONLY", + "PRODUCTS", + "PRODUCTS_DISCOUNT", + "PROMOTION_STACKS", + "PRODUCTS_BY_CUSTOMER", + "PRODUCTS_DISCOUNT_BY_CUSTOMER" ] } } - } - } - }, - "responses": { - "202": { - "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and vouchers will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" - }, - "examples": { - "Example": { - "value": { - "async_action_id": "aa_0aac93c6af84485df3" - } - } + }, + "23_req_create_qualification_customer_id": { + "title": "Customer ID", + "description": "You can pass the unique customer ID that was assigned by Voucherify.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The ID of an existing customer that will be linked to redemption in this request.", + "example": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" } } - } - } - } - } - }, - "/v1/vouchers/importCSV": { - "post": { - "operationId": "import-vouchers-using-csv", - "tags": [ - "VOUCHERS API" - ], - "summary": "Import Vouchers using CSV", - "description": "Import standalone vouchers into the repository using a CSV file.\n\nThe 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. \n\nYou can find an example CSV file [here](https://support.voucherify.io/article/45-import-codes-and-share-them-digitally#coupons).\n___\n\n```cURL cURL example\ncurl -X POST \\\n https://api.voucherify.io/v1/vouchers/importCSV \\\n -F file=@/path/to/vouchers.csv \\\n -H \"X-App-Id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n -H \"X-App-Token: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n```\n\n\n\n> 📘 Standard voucher fields mapping\n>\n> - Go to the [import vouchers](ref:import-vouchers) endpoint to see all standard CSV fields description (body params section).\n> - 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\n>- **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z. \n> - `YYYY-MM-DD`\n> - `YYYY-MM-DDTHH`\n> - `YYYY-MM-DDTHH:mm`\n> - `YYYY-MM-DDTHH:mm:ss`\n> - `YYYY-MM-DDTHH:mm:ssZ`\n> - `YYYY-MM-DDTHH:mm:ssZ`\n> - `YYYY-MM-DDTHH:mm:ss.SSSZ`\n> - Custom code attributes (not supported by-default) need to be added as code **metadata**.\n> - You **cannot import the same codes** to a single Voucherify Project.\n\n\n\n> 📘 Categories\n>\n> 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](ref:list-vouchers) endpoint.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "The file path is stored in the form `file` header.", - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/a_req_importCSV" + }, + "23_req_create_qualification_customer_source_id": { + "title": "Customer Source ID", + "description": "You can send the source ID that you used to create the customer in Voucherify.", + "type": "object", + "properties": { + "source_id": { + "type": "string", + "description": "A unique identifier of a customer. It can be a customer ID or email from a CRM system, database or 3rd-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored." + } } - } - } - }, - "responses": { - "202": { - "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and vouchers will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the **response** and pass it using the [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" - }, - "examples": { - "Example": { - "value": { - "async_action_id": "aa_0a875d56c805df6601" - } - } + }, + "23_req_create_qualification_order_id": { + "title": "Order ID", + "description": "You can pass the unique order ID that was assigned by Voucherify.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request." } } - } - }, - "400": { - "description": "Invalid payload. You may receive this error if you have incorrectly or have not specified the content type as `multipart/form-data` in the headers.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" + }, + "23_req_create_qualification_order_source_id": { + "title": "Order Source ID", + "description": "You can send the source ID that you used to create the order in Voucherify.", + "type": "object", + "properties": { + "source_id": { + "type": "string", + "description": "Unique source ID of an existing order that will be linked to the redemption of this request." + } + } + }, + "23_obj_filter_resource_type": { + "description": "Filter conditions set on the resource `type`. The resource types include: `voucher`, `promotion_tier`, `campaign`.", + "title": "Filter by type", + "type": "object", + "properties": { + "resource_type": { + "$ref": "#/components/schemas/16_filter_conditions_string" }, - "examples": { - "Example 1": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Payload should have required property 'file'", - "request_id": "74e4bb71-5b6d-49b9-98eb-239691c9d67a" - } - } + "junction": { + "$ref": "#/components/schemas/16_filter_junction" } } - } - } - } - } - }, - "/v1/vouchers/qualification": { - "post": { - "operationId": "examine-vouchers-qualification", - "deprecated": true, - "tags": [ - "VOUCHERS API" - ], - "summary": "Examine Qualification [Deprecated]", - "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for qualification, and we do not recommend using it. The new [Qualifications API](ref:examine-qualification) introduces additional features and improvements while maintaining backward compatibility. 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. \n\nDisplay vouchers qualified to the given customer and context (e.g., order, loyalty reward). Checks up to 50 **standalone vouchers**. \n\n> 👍 Prevailing assumption\n> You data is synced with Voucherify.\n\n ## How does this endpoint work? \n\n A property's value that does not meet a validation rule requirement will disqualify that particular voucher and it will not be listed in the results.\n\nAs a sample use case, you can imagine a requirement of displaying coupons available for the customer below the shopping cart. The customer can choose and apply the proposed voucher.\n\n ## What's excluded? \n\n The verification logic won't run against _coupons from bulk unique code campaigns_. For campaigns with multiple unique codes, you should run a [dedicated function](ref:examine-campaigns-qualification) for searching and identifying qualified campaigns.\n\n ## Customizing the response\n\n> 📘 Query parameters let you sort and filter the returned vouchers\n>\n> Customize your response:\n> - If you only care about verifying a customer, use `audienceRulesOnly` set to `true`. \n>- If you want to limit the number of vouchers to be returned from the entire pool of eligible vouchers, set a `limit`. This will return vouchers sorted by `-created_at`, by default beginning with the most recent vouchers listed at the top.\n> - If you have a preference on the sorting order of the returned vouchers, you can use `order` to customize your response.\n\n ## Sending the request body payload\n\n\n ## Customer\n\nYou have the option of sending customer data via the dedicated `customer` object in the request body or a nested `customer` object within the `order` object.\n ### Available options:\n\n - You can either pass a customer `id` (Voucherify system generated),\n\n - a `source_id` (your own unique internal customer identifier e.g., email, database ID, CRM id), \n\n - a combination of the remaining parameters in the customer object, \n\n - a combination of customer `id` and remaining parameters excluding `source_id`, or\n\n - a combination of `source_id` and remaining parameters excluding `id`\n\n #### Note:\n\n For the latter two options, if you pass the `source_id` or the `id` with the other parameters, the logic will run independently for parameters explicitly passed in the request body versus those not explicitly passed in the request body. For _parameters not explicitly listed in the payload_, the verification will be against the data stored for that customer in the system. On the other hand, for any _parameter values explicitly passed in the payload_, the logic will ignore those stored in the system and will use the new values provided in the qualification request body. \n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). \n\n## Order\n\n ### Available options:\n\n - You can either pass an order `id` (Voucherify system generated),\n\n - a `source_id` (your own unique internal order identifier), \n\n - a combination of the remaining parameters in the order object, \n\n - a combination of order `id` and remaining parameters excluding `source_id`, or\n\n - a combination of `source_id` and remaining parameters excluding `id`\n\n #### Note:\n\n For the latter two options, if you pass the `source_id` or the `id` with the other parameters, the logic will run independently for parameters explicitly passed in the request body versus those not explicitly passed in the request body. For _parameters not explicitly listed in the payload_, the verification will be against the data stored for that order in the system. On the other hand, for any _parameter values explicitly passed in the payload_, the logic will ignore those stored in the system and will use the new values provided in the qualification request body. \n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).\n\n## Guidelines:\n\nTo validate against vouchers with total order `amount` requirements, make sure to include the total order `amount` in the order object or alternatively the `amount` for _every_ order item (the application will then add each amount to get the total and perform the qualification checks). If the total order `amount` is provided along with the individual items' amounts, the total order `amount` will take precedence.\n\n\n| **Case** | **Order-Level Parameter Included** | **Item-Level Parameter Included** | **Precedence** | **Calculation Result** | **Parameter included in payload accounts for checks against requirements in these validation rules** |\n|:---:|:---:|:---:|:---:|---|---|\n| **1** | `amount` | `amount` | Order-level | Uses order-level `amount` | - Total order amount |\n| **2** | | `amount` | Item-level | Sums each item-level `amount` | - Total order amount
- subtotal of matched items |\n| **3** | | `price`
`quantity` | Item-level | Multiplies each item's (`price` x `quantity`) to get item `amount` and then adds each item's `amount` to get total order `amount` | - Total order amount
- Subtotal of matched items
- Unit price of any matching order line
- Price of each item/Price of any item |\n| **4** | | `amount`
`price`
`quantity` | Item-level `amount` | Uses item-level `amount` for total order `amount` calculation, ignores (`price` x `quantity`) calculation | - Total order amount (uses item `amount` if provided or `price` x `quantity` for items without `amount` property; `amount` takes precedence in case all 3 properties are provided for an item)
- Subtotal of matched items (uses item `amount`, takes precedence if all 3 properties are provided)
- Unit price of any matching order line
- Price of each item/Price of any item |\n| **5** | `amount` | `amount`
`price`
`quantity` | Order-level | Uses order-level `amount` for total order `amount` | - Total order amount (uses order-level `amount`).
- Subtotal of matched items (see case **4** for details).
- Unit price of any matching order line
- Price of each item/Price of any item |\n \n\n## Reward\n\n ## Gift Card", - "parameters": [ - { - "$ref": "#/components/parameters/audienceRulesOnly" - }, - { - "schema": { - "type": "integer", - "maximum": 50 }, - "in": "query", - "name": "limit", - "description": "The number of vouchers to be qualified." - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at", - "code", - "-code" - ] + "23_obj_filter_category_id": { + "description": "Filter conditions set on the resource `category_id`.", + "title": "Filter by category ID", + "type": "object", + "properties": { + "category_id": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash `-` means sorting in a descending order." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "required": true, - "description": "Should contain given customer and context such as an order.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_req_vouchers_qualification" - }, - "examples": { - "Example": { - "value": { - "customer": { - "source_id": "source-id", - "metadata": { - "key": "value" - } - }, - "order": { - "amount": 10000, - "items": [ - { - "product_id": "product-id", - "quantity": "1", - "price": 10000, - "related_object": "product", - "product": { - "metadata": { - "key": "value" - } - } - } - ] - }, - "metadata": { - "key": "value" - } - } + "23_obj_qualification_redeemables": { + "title": "Redeemables", + "type": "object", + "description": "List or redeemables for examine qualification.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. Default is `list`." }, - "Qualify product using product_id": { - "value": { - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" - }, - "order": { - "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", - "source_id": "string", - "amount": 10000, - "items": [ - { - "source_id": "product_1234", - "product_id": "prod_0a9f9aeddb019a42db", - "amount": 10000, - "quantity": 1, - "price": 10000, - "metadata": {}, - "related_object": "product", - "product": { - "source_id": "product_1234", - "name": "Phone", - "price": 10000, - "metadata": {} - } - } - ], - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" - }, - "referrer": {}, - "metadata": "string" - }, - "reward": { - "points": 0, - "assignment_id": "string", - "id": "string" - }, - "metadata": {} + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of qualified redeemables." + }, + "data": { + "type": "array", + "description": "Array of qualified redeemables.", + "items": { + "allOf": [] } }, - "Qualify product using source_id": { - "value": { - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" - }, - "order": { - "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", - "source_id": "string", - "amount": 10000, - "items": [ - { - "source_id": "product_1234", - "product_id": "prod_0a9f9aeddb019a42db", - "amount": 10000, - "quantity": 1, - "price": 10000, - "metadata": {}, - "related_object": "product", - "product": { - "source_id": "product_1234", - "name": "Phone", - "price": 10000, - "metadata": {} + "total": { + "type": "integer", + "example": 5, + "description": "The number of redeemables returned in the API request." + }, + "has_more": { + "type": "boolean", + "description": "As results are always limited, the `has_more` flag indicates whether there are more records for given parameters. This let's you know if you are able to run another request (with different options) to get more records returned in the results." + } + } + }, + "LoyaltiesGetPointsExpirationResponseBody": { + "title": "Loyalties Get Points Expiration Response Body", + "type": "object", + "properties": { + "object": { + "type": "string", + "pattern": "list", + "enum": [ + "list" + ], + "description": "The type of object represented by JSON. This object stores information about loyalty points expiration buckets in a dictionary." + }, + "data_ref": { + "type": "string", + "pattern": "data", + "enum": [ + "data" + ], + "description": "Identifies the name of the attribute that contains the array of loyalty points expiration bucket objects." + }, + "data": { + "type": "array", + "description": "Contains array of loyalty points expiration buckets.", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique loyalty points bucket ID." + }, + "voucher_id": { + "type": "string", + "description": "Unique parent loyalty card ID." + }, + "campaign_id": { + "type": "string", + "description": "\nUnique parent campaign ID." + }, + "bucket": { + "type": "object", + "required": [ + "total_points" + ], + "description": "Defines the number of points stored in the given loyalty points bucket.", + "properties": { + "total_points": { + "type": "integer", + "description": "Total number of points in the loyalty points bucket." } } - ], - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" }, - "referrer": {}, - "metadata": "string" - }, - "reward": { - "points": 0, - "assignment_id": "string", - "id": "string" + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the loyalty points bucket object was created in ISO 8601 format.", + "format": "date-time" + }, + "status": { + "type": "string", + "description": "Loyalty points bucket point status." + }, + "expires_at": { + "type": "string", + "format": "date-time", + "description": "Date when the number of points defined in the bucket object are due to expire." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the loyalty points bucket object was updated in ISO 8601 format." + }, + "object": { + "type": "string", + "pattern": "loyalty_points_bucket", + "enum": [ + "loyalty_points_bucket" + ], + "description": "The type of object represented by JSON. This object stores information about the loyalty points bucket." + } }, - "metadata": {} + "required": [ + "id", + "voucher_id", + "campaign_id", + "bucket", + "created_at", + "status", + "expires_at", + "object" + ] } }, - "Qualify SKU using sku_id": { - "value": { - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" - }, - "order": { - "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", - "source_id": "string", - "amount": 10000, - "items": [ - { - "source_id": "product_1234", - "product_id": "prod_0a9f9aeddb019a42db", - "amount": 10000, - "quantity": 1, - "price": 10000, - "metadata": {}, - "related_object": "product", - "product": { - "source_id": "product_1234", - "name": "Phone", - "price": 10000, - "metadata": {} - } - } + "total": { + "type": "integer", + "description": "Total number of point expiration buckets." + } + }, + "required": [ + "object", + "data_ref", + "data", + "total" + ] + }, + "LoyaltiesGetEarningRuleResponseBody": { + "$ref": "#/components/schemas/EarningRule" + }, + "LoyaltiesEnableEarningRulesResponseBody": { + "allOf": [ + { + "$ref": "#/components/schemas/EarningRuleBase" + }, + { + "type": "object", + "properties": { + "updated_at": { + "type": [ + "string", + "null" ], - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" - }, - "referrer": {}, - "metadata": "string" - }, - "reward": { - "points": 0, - "assignment_id": "string", - "id": "string" + "format": "date-time", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format." }, - "metadata": {} - } + "active": { + "type": "boolean", + "default": true, + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date." + } + }, + "required": [ + "updated_at", + "active" + ] + } + ] + }, + "LoyaltiesDisableEarningRulesResponseBody": { + "allOf": [ + { + "$ref": "#/components/schemas/EarningRuleBase" }, - "Qualify SKU using source_id": { - "value": { - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" - }, - "order": { - "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", - "source_id": "string", - "amount": 10000, - "items": [ - { - "source_id": "product_1234", - "product_id": "prod_0a9f9aeddb019a42db", - "amount": 10000, - "quantity": 1, - "price": 10000, - "metadata": {}, - "related_object": "product", - "product": { - "source_id": "product_1234", - "name": "Phone", - "price": 10000, - "metadata": {} - } - } + { + "type": "object", + "properties": { + "updated_at": { + "type": [ + "string", + "null" ], - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" - }, - "referrer": {}, - "metadata": "string" - }, - "reward": { - "points": 0, - "assignment_id": "string", - "id": "string" + "format": "date-time", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format." }, - "metadata": {} - } + "active": { + "type": "boolean", + "default": false, + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date." + } + }, + "required": [ + "updated_at", + "active" + ] + } + ] + }, + "EarningRuleBase": { + "title": "EarningRuleBase", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Assigned by the Voucherify API, identifies the earning rule object." }, - "Qualify redemption metadata": { - "value": { - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format." + }, + "loyalty": { + "anyOf": [ + { + "$ref": "#/components/schemas/EarningRuleFixed" }, - "order": { - "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", - "source_id": "string", - "amount": 10000, - "items": [ - { - "source_id": "product_1234", - "product_id": "prod_0a9f9aeddb019a42db", - "amount": 10000, - "quantity": 1, - "price": 10000, - "metadata": {}, - "related_object": "product", - "product": { - "source_id": "product_1234", - "name": "Phone", - "price": 10000, - "metadata": {} - } - } - ], - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" - }, - "referrer": {}, - "metadata": "string" + { + "$ref": "#/components/schemas/EarningRuleProportional" + } + ] + }, + "event": { + "$ref": "#/components/schemas/EarningRuleEvent", + "description": "Defines the event which triggers the earning rule to add points to a loyalty card." + }, + "custom_event": { + "type": "object", + "properties": { + "schema_id": { + "type": "string" + } + }, + "required": [ + "schema_id" + ] + }, + "segment": { + "type": "object", + "description": "Contains the id of a customer segment. Required for the customer.segment.entered option in event.", + "properties": { + "id": { + "type": "string", + "description": "Contains a unique identifier of a customer segment. Assigned by the Voucherify API." + } + }, + "required": [ + "id" + ] + }, + "source": { + "type": "object", + "required": [ + "object_id", + "object_type" + ], + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." }, - "reward": { - "points": 0, - "assignment_id": "string", - "id": "string" + "object_id": { + "type": "string", + "description": "A unique campaign identifier assigned by the Voucherify API." }, - "metadata": {} + "object_type": { + "type": "string", + "description": "Defines the object associated with the earning rule. Defaults to `campaign`.", + "enum": [ + "campaign" + ] + } } }, - "Qualify order line item metadata": { - "value": { - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" - }, - "order": { - "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", - "source_id": "string", - "amount": 10000, - "items": [ - { - "source_id": "product_1234", - "product_id": "prod_0a9f9aeddb019a42db", - "amount": 10000, - "quantity": 1, - "price": 10000, - "metadata": {}, - "related_object": "product", - "product": { - "source_id": "product_1234", - "name": "Phone", - "price": 10000, - "metadata": {} - } - } - ], - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" - }, - "referrer": {}, - "metadata": "string" - }, - "reward": { - "points": 0, - "assignment_id": "string", - "id": "string" + "object": { + "type": "string", + "enum": [ + "earning_rule" + ], + "description": "The type of object represented by JSON. Default is earning_rule." + }, + "automation_id": { + "type": "string", + "description": "For internal use by Voucherify." + }, + "start_date": { + "type": "string", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is inactive before this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default." + }, + "expiration_date": { + "type": "string", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is inactive after this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.start_date required when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a duration of PT1H will be valid for a duration of one hour." }, - "metadata": {} + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an interval of P2D will be valid every other day." + } + }, + "required": [ + "duration", + "interval" + ] + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday\n- `1` Monday\n- `2` Tuesday\n- `3` Wednesday\n- `4` Thursday\n- `5` Friday\n- `6` Saturday", + "items": { + "type": "integer", + "minimum": 0, + "maximum": 6 } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." } - } - } - } - }, - "responses": { - "200": { - "description": "This operation returns the list of valid and active vouchers based on the qualification of given context (e.g., customer profile, redemptions metadata, order).", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_res_vouchers_qualification" - } - } - } - } - } - } - }, - "/v1/vouchers/bulk/async": { - "post": { - "operationId": "update-vouchers-in-bulk", - "tags": [ - "VOUCHERS API" - ], - "summary": "Update Vouchers in bulk", - "description": "Use this endpoint to update specific metadata parameters for each code, respectively. You can update each code's metadata property separately. \n\n- Update up to **100 records** in one request.\n- Upserts are not supported. \n\n> 🚧 \n> \n> Currently only **metadata** updates are supported.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "required": true, - "description": "List of objects, each containing a code that is being updated and the metadata key/value pairs for that code.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_req_vouchers_bulk_async" }, - "examples": { - "Example": { - "value": [ - { - "code": "example_code", - "metadata": { - "lang": "en", - "test": false, - "MetadataTest": "Update metadata", - "update_value": 1, - "next_update_date": "2022-11-11T09:00:00.000Z" - } - }, - { - "code": "example_code2", - "metadata": { - "lang": "pl", - "test": false, - "MetadataTest": "Update metadata", - "update_value": 2 - } - } - ] + "required": [ + "id", + "created_at", + "loyalty", + "source", + "object", + "automation_id", + "metadata" + ] + }, + "EarningRuleEvent": { + "title": "EarningRuleEvent", + "type": "string", + "enum": [ + "order.paid", + "customer.segment.entered", + "custom_event", + "customer.loyalty.tier.upgraded", + "customer.loyalty.tier.downgraded", + "customer.loyalty.tier.prolonged", + "customer.loyalty.tier.joined", + "customer.loyalty.tier.left" + ] + }, + "EarningRuleFixed": { + "title": "Define fixed amount of points", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "FIXED" + ], + "description": "The number of points to be added to the loyalty card." + }, + "points": { + "type": "integer", + "description": "Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points." } } - } - } - }, - "responses": { - "202": { - "description": "Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the voucher(s) will be updated in the repository asynchronously. To check the status and result, copy the `async_action_id` from the response and pass it using [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" + }, + "EarningRuleProportionalOrder": { + "anyOf": [ + { + "$ref": "#/components/schemas/EarningRuleProportionalOrderAmount" + }, + { + "$ref": "#/components/schemas/EarningRuleProportionalOrderTotalAmount" + }, + { + "$ref": "#/components/schemas/EarningRuleProportionalOrderMetadata" + } + ], + "title": "Order" + }, + "EarningRuleProportionalOrderAmount": { + "title": "Order Amount", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "PROPORTIONAL" + ], + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + }, + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_AMOUNT" + ], + "description": "`ORDER_AMOUNT`: Pre-discount order amount (X points for every Y spent excluding discounts)" }, - "examples": { - "Example": { - "$ref": "#/components/examples/res_async_actions" + "order": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "type": "object", + "required": [ + "every", + "points" + ], + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", + "properties": { + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + } + } + } } } - } - } - } - } - } - }, - "/v1/vouchers/metadata/async": { - "post": { - "operationId": "update-vouchers-metadata-in-bulk", - "tags": [ - "VOUCHERS API" - ], - "summary": "Update Vouchers' metadata in bulk", - "description": "Use this endpoint to update the same metadata parameters for a list of codes. \nUpdate up to **100 records** in one request. Upserts are not supported. \n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "required": true, - "description": "Request to update vouchers metadata in bulk. Provide an array of voucher codes in the `codes` parameter along with the `metadata` object. The `metadata` object should contain the key value pairs that you would like to update for all the vouchers included in the `codes` parameter.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_req_vouchers_metadata_async" }, - "examples": { - "Example": { - "value": { - "codes": [ - "PROMO-CODE810", - "PROMO-CODE726" - ], - "metadata": { - "lang": "en", - "authorized_internally": true + "required": [ + "type", + "calculation_type", + "order" + ] + }, + "EarningRuleProportionalOrderTotalAmount": { + "title": "Order Total Amount", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "PROPORTIONAL" + ], + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + }, + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_TOTAL_AMOUNT" + ], + "description": "`ORDER_TOTAL_AMOUNT`: Total order amount (X points for every Y spent including discount)" + }, + "order": { + "type": "object", + "required": [ + "total_amount" + ], + "properties": { + "total_amount": { + "type": "object", + "required": [ + "every", + "points" + ], + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", + "properties": { + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + } + } } } } - } - } - } - }, - "responses": { - "202": { - "description": "Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the voucher(s) will be updated in the repository asynchronously. To check the status and result, copy the `async_action_id` from the response and pass it using [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" + }, + "required": [ + "type", + "calculation_type", + "order" + ] + }, + "EarningRuleProportionalOrderMetadata": { + "title": "Order Metadata", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "PROPORTIONAL" + ], + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." }, - "examples": { - "Example": { - "$ref": "#/components/examples/res_async_actions" - } - } - } - } - }, - "400": { - "description": "Returns an error indicating the reason for an unsuccessfull operation.", - "content": { - "application/json": { - "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/e_400_invalid_payload" - }, - { - "$ref": "#/components/schemas/e_400_not_enough_codes" - }, - { - "$ref": "#/components/schemas/e_400_metadata_validation_failed" - } + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_METADATA" ], - "discriminator": { - "propertyName": "key" - } + "description": "`ORDER_METADATA`: Order Metadata (X points for every Y in metadata attribute, defined in the property key under the order.metadata object)" }, - "examples": { - "Not enough codes": { - "value": { - "code": 400, - "key": "not_enough_codes", - "message": "Not enough codes", - "details": "Specify at least 1 code in codes.", - "request_id": "v-0c4b067a8f161e120f" + "order": { + "type": "object", + "required": [ + "metadata" + ], + "description": "Defines the formula for calculating points proportionally.", + "properties": { + "metadata": { + "type": "object", + "required": [ + "every", + "points", + "property" + ], + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points.", + "properties": { + "every": { + "type": "integer", + "description": "For how many increments of the order metadata property to grant points for." + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + }, + "property": { + "type": "string", + "description": "Order metadata property." + } + } } } } - } - } - } - } - } - }, - "/v1/vouchers/{code}/sessions/{sessionKey}": { - "parameters": [ - { - "name": "code", - "in": "path", - "schema": { - "type": "string", - "example": "7fjWdr" - }, - "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify.", - "required": true - }, - { - "schema": { - "type": "string", - "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" - }, - "name": "sessionKey", - "in": "path", - "required": true, - "description": "A unique session identifier." - } - ], - "delete": { - "operationId": "release-validation-session", - "tags": [ - "VOUCHERS API" - ], - "summary": "Release Validation Session", - "description": "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](doc:locking-validation-session). \n\n> 📘 Release Session using Dashboard\n>\n> You can also use the Validations Manager in the Dashboard to unlock sessions. [Read more](https://support.voucherify.io/article/16-dashboard-sections#validations).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if the validation session was released successfully." - } - } - } - }, - "/v1/campaign-object": { - "get": { - "operationId": "campaign-object", - "tags": [ - "CAMPAIGNS API" - ], - "summary": "Campaign Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Campaign Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_obj_campaign_object" - } - } - } - } - } - } - }, - "/v1/campaigns": { - "post": { - "operationId": "create-campaign", - "tags": [ - "CAMPAIGNS API", - "PROMOTIONS API" - ], - "summary": "Create Campaign", - "description": "Method to create a batch of vouchers aggregated in one campaign. You can choose a variety of voucher types and define a unique pattern for generating codes. \n\n\n> 📘 Global uniqueness\n>\n> All campaign codes are unique across the whole project. Voucherify will not allow you to generate 2 campaigns with the same coupon code. \n\n> 🚧 Code generation status\n>\n> This is an asynchronous action; you can't read or modify a newly created campaign until the code generation is completed. See the `creation_status` field in the [campaign object](ref:get-campaign) description.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the details of the campaign that you would like to create.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_req_create_campaign" }, - "examples": { - "Discount Campaign": { - "value": { - "name": "Discount Campaign 4", - "campaign_type": "DISCOUNT_COUPONS", - "join_once": true, - "type": "AUTO_UPDATE", - "category_id": "cat_0bb343dee3cdb5ec0c", - "start_date": "2020-08-16T00:00:00Z", - "expiration_date": "2023-12-26T00:00:00Z", - "vouchers_count": 3, - "voucher": { - "type": "DISCOUNT_VOUCHER", - "discount": { - "percent_off": 10, - "type": "PERCENT" - }, - "redemption": { - "quantity": 10 - }, - "code_config": { - "pattern": "10OFF-#######" - } - }, - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "activity_duration_after_publishing": "P24D", - "use_voucher_metadata_schema": false, - "metadata": { - "region": "AMER" - } - } + "required": [ + "type", + "calculation_type", + "order" + ] + }, + "EarningRuleProportionalOrderItemsQuantity": { + "title": "Order Items Quantity", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "PROPORTIONAL" + ], + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." }, - "Gift Card Campaign": { - "value": { - "name": "Gift Card Campaign", - "campaign_type": "GIFT_VOUCHERS", - "join_once": true, - "type": "AUTO_UPDATE", - "category_id": "cat_0bb343dee3cdb5ec0c", - "start_date": "2020-08-16T00:00:00Z", - "expiration_date": "2023-12-26T00:00:00Z", - "vouchers_count": 2, - "voucher": { - "type": "GIFT_VOUCHER", - "gift": { - "amount": 1000, - "effect": "APPLY_TO_ORDER" - }, - "redemption": { - "quantity": 10 - }, - "code_config": { - "pattern": "GIFT-CARD-#######" - } - }, - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "activity_duration_after_publishing": "P24D", - "use_voucher_metadata_schema": false, - "metadata": { - "region": "APAC" - } - } + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_ITEMS_QUANTITY" + ], + "description": "`ORDER_ITEMS_QUANTITY`: Quantity of items defined in order_items.quantity.object & .id (X points for every Y items excluding free items)" }, - "Loyalty Program": { - "value": { - "name": "Loyalty Campaign", - "campaign_type": "LOYALTY_PROGRAM", - "auto_join": true, - "join_once": true, - "type": "AUTO_UPDATE", - "category_id": "cat_0bb343dee3cdb5ec0c", - "start_date": "2020-08-16T00:00:00Z", - "expiration_date": "2023-12-26T00:00:00Z", - "vouchers_count": 2, - "voucher": { - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 1000, - "expiration_rules": { - "period_type": "MONTH", - "period_value": 3, - "rounding_type": "END_OF_YEAR" - } - }, - "redemption": { - "quantity": 10 - }, - "code_config": { - "pattern": "LOYALTY-CARD-#######" - } - }, - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "activity_duration_after_publishing": "P24D", - "use_voucher_metadata_schema": false, - "metadata": { - "region": "APAC" - } - } - }, - "Promotion": { - "value": { - "name": "Promotion - API - 4", - "campaign_type": "PROMOTION", - "type": "STATIC", - "category_id": "cat_0bb343dee3cdb5ec0c", - "use_voucher_metadata_schema": false, - "start_date": "2020-08-16T00:00:00Z", - "expiration_date": "2023-12-26T00:00:00Z", - "active": false, - "promotion": { - "tiers": [ - { - "name": "Percent Discount", - "banner": "Get 40% off", - "action": { - "discount": { - "type": "PERCENT", - "percent_off": 40, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": { - "level": "B" - }, - "active": false, - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4 - ], - "validation_rules": [ - "val_q8qUBMOh5qIQ" - ] + "order_items": { + "type": "object", + "required": [ + "quantity" + ], + "properties": { + "quantity": { + "type": "object", + "required": [ + "every", + "points", + "object", + "id" + ], + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", + "properties": { + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." }, - { - "name": "Order more than $100", - "banner": "Get $30 off", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 3000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": { - "level": "A" - }, - "active": false, - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4 - ], - "validation_rules": [ - "val_q8qUBMOh5qIQ" + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + }, + "object": { + "type": "string", + "description": "Type of object taken under consideration.", + "enum": [ + "products_collection", + "product", + "sku" ] + }, + "id": { + "type": "string", + "description": "Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619." } - ] - }, - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "activity_duration_after_publishing": "P24D", - "metadata": { - "region": "APAC" - } - } - }, - "Referral Program": { - "value": { - "name": "Referral Campaign 2", - "campaign_type": "REFERRAL_PROGRAM", - "join_once": true, - "type": "AUTO_UPDATE", - "category_id": "cat_0bb343dee3cdb5ec0c", - "start_date": "2020-08-16T00:00:00Z", - "expiration_date": "2023-12-26T00:00:00Z", - "vouchers_count": 2, - "referral_program": { - "conversion_event_type": "redemption" - }, - "voucher": { - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "percent_off": 45, - "effect": "APPLY_TO_ORDER", - "amount_limit": 15 - }, - "redemption": { - "quantity": 10 - }, - "code_config": { - "pattern": "REFERRAL-CODE-#######" - }, - "is_referral_code": true - }, - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "activity_duration_after_publishing": "P24D", - "use_voucher_metadata_schema": false, - "metadata": { - "region": "APAC" + } } } } - } - } - } - }, - "responses": { - "200": { - "description": "Returns a campaign object if the call succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_obj_campaign_object" + }, + "required": [ + "type", + "calculation_type", + "order_items" + ] + }, + "EarningRuleProportionalOrderItemsAmount": { + "title": "Order Items Amount", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "PROPORTIONAL" + ], + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + }, + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_ITEMS_AMOUNT" + ], + "description": "ORDER_ITEMS_AMOUNT; Pre-discount amount spent on items defined in the order_items.amount.object & .id (X points for every Y spent on items excluding discounts)" }, - "examples": { - "Discount Campaign": { - "value": { - "id": "camp_NdBCAQk1AAZcMcv6kt6X164Q", - "name": "Discount Campaign 4", - "campaign_type": "DISCOUNT_COUPONS", - "type": "AUTO_UPDATE", - "voucher": { - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "percent_off": 10 + "order_items": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "type": "object", + "required": [ + "every", + "points", + "object", + "id" + ], + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", + "properties": { + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." }, - "redemption": { - "quantity": 10 + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." }, - "code_config": { - "length": 7, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "10OFF-#######" + "object": { + "type": "string", + "description": "Type of object taken under consideration.", + "enum": [ + "products_collection", + "product", + "sku" + ] }, - "is_referral_code": false, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - } - }, - "auto_join": false, - "join_once": true, - "use_voucher_metadata_schema": false, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "activity_duration_after_publishing": "P24D", - "vouchers_count": 0, - "active": true, - "metadata": { - "region": "AMER" - }, - "created_at": "2022-09-21T09:25:49.617Z", - "category": "First", - "creation_status": "IN_PROGRESS", - "vouchers_generation_status": "IN_PROGRESS", - "protected": false, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" + "id": { + "type": "string", + "description": "Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619." } - ], - "object": "campaign" + } } - }, - "Gift Card Campaign": { - "value": { - "id": "camp_B2Gx83JsSbmvj05MOwxYbNm6", - "name": "Gift Card Campaign", - "campaign_type": "GIFT_VOUCHERS", - "type": "AUTO_UPDATE", - "voucher": { - "type": "GIFT_VOUCHER", - "gift": { - "amount": 1000, - "effect": "APPLY_TO_ORDER" + } + } + }, + "required": [ + "type", + "calculation_type", + "order_items" + ] + }, + "EarningRuleProportionalOrderItemsSubtotalAmount": { + "title": "Order Items Subtotal Amount", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "PROPORTIONAL" + ], + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + }, + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_ITEMS_SUBTOTAL_AMOUNT" + ], + "description": "ORDER_ITEMS_SUBTOTAL_AMOUNT; Amount spent on items defined in the order_items.subtotal_amount.object & .id (X points for every Y spent on items including discounts)" + }, + "order_items": { + "type": "object", + "required": [ + "subtotal_amount" + ], + "properties": { + "subtotal_amount": { + "type": "object", + "required": [ + "every", + "points", + "object", + "id" + ], + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", + "properties": { + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." }, - "redemption": { - "quantity": 10 + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." }, - "code_config": { - "length": 7, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "GIFT-CARD-#######" + "object": { + "type": "string", + "description": "Type of object taken under consideration.", + "enum": [ + "products_collection", + "product", + "sku" + ] }, - "is_referral_code": false, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - } - }, - "auto_join": false, - "join_once": true, - "use_voucher_metadata_schema": false, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "activity_duration_after_publishing": "P24D", - "vouchers_count": 0, - "active": true, - "metadata": { - "region": "APAC" - }, - "created_at": "2022-09-21T09:31:16.266Z", - "category": "First", - "creation_status": "IN_PROGRESS", - "vouchers_generation_status": "IN_PROGRESS", - "protected": false, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" + "id": { + "type": "string", + "description": "Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619." } - ], - "object": "campaign" + } } - }, - "Loyalty Program": { - "value": { - "id": "camp_FZL4iTTdZw36nZOoXYQ172fQ", - "name": "Loyalty Campaign", - "campaign_type": "LOYALTY_PROGRAM", - "type": "AUTO_UPDATE", - "voucher": { - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 1000, - "expiration_rules": { - "period_type": "MONTH", - "period_value": 3, - "rounding_type": "END_OF_YEAR" - } - }, - "redemption": { - "quantity": 10 + } + } + }, + "required": [ + "type", + "calculation_type", + "order_items" + ] + }, + "EarningRuleProportionalCustomerMetadata": { + "title": "Customer Metadata", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "PROPORTIONAL" + ], + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + }, + "calculation_type": { + "type": "string", + "enum": [ + "CUSTOMER_METADATA" + ], + "description": "CUSTOMER_METADATA: Customer Metadata (X points for every Y in metadata attribute, defined in the property key under the customer.metadata object)" + }, + "customer": { + "type": "object", + "required": [ + "metadata" + ], + "properties": { + "metadata": { + "type": "object", + "required": [ + "every", + "points", + "property" + ], + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points.", + "properties": { + "every": { + "type": "integer", + "description": "For how many increments of the customer metadata property to grant points for." }, - "code_config": { - "length": 7, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "LOYALTY-CARD-#######" + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." }, - "is_referral_code": false, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - } - }, - "auto_join": true, - "join_once": true, - "use_voucher_metadata_schema": false, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "activity_duration_after_publishing": "P24D", - "vouchers_count": 0, - "active": true, - "metadata": { - "region": "APAC" - }, - "created_at": "2022-09-21T09:39:45.479Z", - "category": "First", - "creation_status": "IN_PROGRESS", - "vouchers_generation_status": "IN_PROGRESS", - "protected": false, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" + "property": { + "type": "string", + "description": "Customer metadata property." } - ], - "object": "campaign" + } } - }, - "Promotion": { - "value": { - "id": "camp_ru1B8mQjY75KxXupt7RPZcb8", - "name": "Promotion - API - 4", - "campaign_type": "PROMOTION", - "type": "STATIC", - "auto_join": false, - "join_once": false, - "use_voucher_metadata_schema": false, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "activity_duration_after_publishing": "P24D", - "active": true, - "metadata": { - "region": "APAC" - }, - "created_at": "2022-09-23T08:54:38.281Z", - "category": "First", - "creation_status": "DONE", - "vouchers_generation_status": "DONE", - "protected": false, - "promotion": { - "object": "list", - "data_ref": "tiers", - "tiers": [ - { - "id": "promo_M4OfmMgSUyN12JPAw3l4hWjD", - "created_at": "2022-09-23T08:54:38.286Z", - "name": "Percent Discount", - "banner": "Get 40% off", - "action": { - "discount": { - "type": "PERCENT", - "percent_off": 40, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": { - "level": "B" - }, - "hierarchy": 1, - "promotion_id": "camp_ru1B8mQjY75KxXupt7RPZcb8", - "campaign": { - "id": "camp_ru1B8mQjY75KxXupt7RPZcb8", - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "active": true, - "category_id": "cat_0bb343dee3cdb5ec0c", - "object": "campaign" - }, - "campaign_id": "camp_ru1B8mQjY75KxXupt7RPZcb8", - "active": false, - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4 - ], - "summary": { - "redemptions": { - "total_redeemed": 0 - }, - "orders": { - "total_amount": 0, - "total_discount_amount": 0 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_dr3oXeN98YfiTF60", - "rule_id": "val_q8qUBMOh5qIQ", - "related_object_id": "promo_M4OfmMgSUyN12JPAw3l4hWjD", - "related_object_type": "promotion_tier", - "created_at": "2022-09-23T08:54:38.286Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - } - }, - { - "id": "promo_uMSxvzhxXDp3Ijs3659npqb2", - "created_at": "2022-09-23T08:54:38.314Z", - "name": "Order more than $100", - "banner": "Get $30 off", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 3000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": { - "level": "A" - }, - "hierarchy": 2, - "promotion_id": "camp_ru1B8mQjY75KxXupt7RPZcb8", - "campaign": { - "id": "camp_ru1B8mQjY75KxXupt7RPZcb8", - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "active": true, - "category_id": "cat_0bb343dee3cdb5ec0c", - "object": "campaign" - }, - "campaign_id": "camp_ru1B8mQjY75KxXupt7RPZcb8", - "active": false, - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4 - ], - "summary": { - "redemptions": { - "total_redeemed": 0 - }, - "orders": { - "total_amount": 0, - "total_discount_amount": 0 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_jgJlWms7GVK59iNR", - "rule_id": "val_q8qUBMOh5qIQ", - "related_object_id": "promo_uMSxvzhxXDp3Ijs3659npqb2", - "related_object_type": "promotion_tier", - "created_at": "2022-09-23T08:54:38.314Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - } - } - ], - "total": 2, - "has_more": false - }, - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" - } + } + } + }, + "required": [ + "type", + "calculation_type", + "customer" + ] + }, + "EarningRuleProportionalCustomEvent": { + "title": "Custom Event", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "PROPORTIONAL" + ], + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + }, + "calculation_type": { + "type": "string", + "enum": [ + "CUSTOM_EVENT_METADATA" + ], + "description": "CUSTOM_EVENT_METADATA: Custom event metadata (X points for every Y in metadata attribute)." + }, + "custom_event": { + "type": "object", + "required": [ + "metadata" + ], + "properties": { + "metadata": { + "type": "object", + "required": [ + "every", + "points", + "property" ], - "object": "campaign" - } - }, - "Referral Program": { - "value": { - "id": "camp_N8rztKAqOYIdFxNLr9eNIjyB", - "name": "Referral Campaign 2", - "campaign_type": "REFERRAL_PROGRAM", - "type": "AUTO_UPDATE", - "voucher": { - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "amount_limit": 15, - "percent_off": 45, - "effect": "APPLY_TO_ORDER" - }, - "redemption": { - "quantity": 10 + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points.", + "properties": { + "every": { + "type": "integer", + "description": "For how many increments of the customer metadata property to grant points for." }, - "code_config": { - "length": 7, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "REFERRAL-CODE-#######" + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." }, - "is_referral_code": true, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - } - }, - "referral_program": { - "conversion_event_type": "redemption" - }, - "auto_join": false, - "join_once": true, - "use_voucher_metadata_schema": false, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "activity_duration_after_publishing": "P24D", - "vouchers_count": 0, - "active": true, - "metadata": { - "region": "APAC" - }, - "created_at": "2022-09-23T09:06:41.757Z", - "category": "First", - "creation_status": "IN_PROGRESS", - "vouchers_generation_status": "IN_PROGRESS", - "protected": false, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" + "property": { + "type": "string", + "description": "\nCustom event metadata property." } - ], - "object": "campaign" + } } } } + }, + "required": [ + "type", + "calculation_type", + "custom_event" + ] + }, + "EarningRuleProportional": { + "anyOf": [ + { + "$ref": "#/components/schemas/EarningRuleProportionalOrder" + }, + { + "$ref": "#/components/schemas/EarningRuleProportionalOrderItems" + }, + { + "$ref": "#/components/schemas/EarningRuleProportionalCustomerMetadata" + }, + { + "$ref": "#/components/schemas/EarningRuleProportionalCustomEvent" + } + ], + "title": "Calculate points proportionally" + }, + "EarningRuleProportionalOrderItems": { + "anyOf": [ + { + "$ref": "#/components/schemas/EarningRuleProportionalOrderItemsQuantity" + }, + { + "$ref": "#/components/schemas/EarningRuleProportionalOrderItemsAmount" + }, + { + "$ref": "#/components/schemas/EarningRuleProportionalOrderItemsSubtotalAmount" + } + ], + "title": "Order Items" + }, + "LoyaltiesListMemberRewardsRequestQuery": { + "title": "Loyalties List Member Rewards Request Query", + "type": "object", + "properties": { + "affordable_only": { + "type": "string" + }, + "limit": { + "type": "integer" + }, + "page": { + "type": "integer" + } } - } - }, - "400": { - "description": "Returns an error if an incomplete request body is provided.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" + }, + "LoyaltiesGetPointsExpirationRequestQuery": { + "title": "Loyalties Get Points Expiration Request Query", + "type": "object", + "properties": { + "limit": { + "type": "integer", + "minimum": 1, + "multipleOf": 100 }, - "examples": { - "Example": { - "value": { - "code": 400, - "key": "invalid_campaign", - "message": "Invalid Campaign", - "details": "Property 'discount' is required for REFERRAL_PROGRAM campaign", - "request_id": "v-0bb99c9213425fa250" - } - } + "page": { + "type": "integer" } } - } - }, - "404": { - "description": "When a payload value is not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + }, + "LoyaltiesListCardTransactionsRequestQuery": { + "title": "Loyalties List Card Transactions Request Query", + "type": "object", + "properties": { + "limit": { + "type": "integer", + "minimum": 1, + "multipleOf": 100 }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find category with id cat_0bb343dee3cdb5ec0c", - "request_id": "v-0c55671ed1cb0f1a27", - "resource_id": "cat_0bb343dee3cdb5ec0c", - "resource_type": "category" - } - } + "page": { + "type": "integer" } } - } - }, - "409": { - "description": "Returns an error if a campaign with the same name already exists.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" + }, + "LoyaltiesListCardTransactionsResponseBody": { + "title": "Loyalties List Card Transactions Response Body", + "type": "object", + "properties": { + "object": { + "type": "string", + "pattern": "list", + "enum": [ + "list" + ], + "description": "The type of object represented by JSON." }, - "examples": { - "Example": { - "value": { - "code": 409, - "key": "duplicate_found", - "message": "Duplicated resource found", - "details": "Duplicated campaign exists with name Discount Campaign", - "request_id": "v-0bb98f8c6552250aab", - "resource_id": "Discount Campaign", - "resource_type": "campaign" - } + "data_ref": { + "type": "string", + "pattern": "data", + "enum": [ + "data" + ], + "description": "Identifies the name of the attribute that contains the array of transaction objects." + }, + "data": { + "type": "array", + "description": "A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object.", + "items": { + "$ref": "#/components/schemas/LoyaltyCardTransaction" } + }, + "has_more": { + "type": "boolean", + "description": "As query results are always limited (by the limit parameter), the has_more flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results." } - } - } - } - } - }, - "get": { - "operationId": "list-campaigns", - "tags": [ - "CAMPAIGNS API" - ], - "summary": "List Campaigns", - "description": "Retrieve a list of campaigns in a project. \n\nThe campaigns are returned sorted by creation date, with the most recent campaigns appearing first. \n\nWhen you get a list of campaigns, you can optionally specify query parameters to customize the amount of campaigns returned per call using `limit`, which page of campaigns to return using `page`, sort the campaigns using the `order` query parameter and filter the results by the `campaign_type`.\n\nThis method will return an error when trying to return a limit of more than 100 campaigns.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "$ref": "#/components/parameters/campaign_type" - }, - { - "schema": { - "type": "string", - "default": "category" + }, + "required": [ + "object", + "data_ref", + "data", + "has_more" + ] }, - "in": "query", - "name": "expand", - "description": "Include an expanded `categories` object in the response." - }, - { - "schema": { + "LoyaltyCardTransactionsType": { "type": "string", "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" + "POINTS_ACCRUAL", + "POINTS_CANCELLATION", + "POINTS_REDEMPTION", + "POINTS_REFUND", + "POINTS_ADDITION", + "POINTS_REMOVAL", + "POINTS_EXPIRATION", + "POINTS_TRANSFER_IN", + "POINTS_TRANSFER_OUT" ] }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary with a `campaign` property that contains an array of campaigns. The maximum number of campaigns returned is determined by the `limit` query parameter. Each entry in the array is a separate campaign object. If no more campaigns are available, the resulting array on a given page will be empty.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_res_list_campaigns" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "campaigns", - "campaigns": [ - { - "id": "camp_SibPsDRKQvg3SUtptgPZCNZb", - "name": "Voucher Metadata", - "campaign_type": "DISCOUNT_COUPONS", - "type": "AUTO_UPDATE", - "voucher": { - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "amount_limit": 4400, - "percent_off": 30, - "effect": "APPLY_TO_ORDER" - }, - "redemption": { - "quantity": null - }, - "code_config": { - "length": 9, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "#########", - "prefix": "Discount-", - "postfix": "YY" - }, - "is_referral_code": false, - "start_date": "2022-09-20T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P3D", - "duration": "P1D" - } - }, - "auto_join": false, - "join_once": false, - "use_voucher_metadata_schema": false, - "start_date": "2022-09-20T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P3D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4 + "SimpleLoyaltyVoucher": { + "title": "Simple Loyalty Voucher", + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "loyalty_card": { + "type": "object", + "required": [ + "points", + "balance" + ], + "properties": { + "points": { + "type": "string" + }, + "balance": { + "type": "string" + }, + "next_expiration_date": { + "type": "string" + }, + "next_expiration_points": { + "type": "string" + } + } + }, + "type": { + "type": "string", + "enum": [ + "LOYALTY_CARD" + ] + }, + "campaign": { + "type": "string" + }, + "campaign_id": { + "type": "string" + }, + "is_referral_code": { + "type": "boolean" + }, + "holder_id": { + "type": "string" + }, + "referrer_id": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "object": { + "type": "string", + "pattern": "voucher", + "enum": [ + "voucher" + ] + } + }, + "required": [ + "id", + "code", + "loyalty_card", + "type", + "campaign", + "campaign_id", + "object" + ] + }, + "LoyaltyCardTransaction": { + "title": "Loyalty Card Transaction", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique transaction ID." + }, + "source_id": { + "type": [ + "string", + "null" + ], + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is null." + }, + "voucher_id": { + "type": "string", + "description": "Unique voucher ID." + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes." + }, + "source": { + "type": [ + "string", + "null" + ], + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is null." + }, + "reason": { + "type": [ + "string", + "null" + ], + "description": "Reason why the transaction occurred. In case of a redemption, this value is null." + }, + "type": { + "$ref": "#/components/schemas/LoyaltyCardTransactionsType", + "description": "Type of transaction." + }, + "details": { + "type": "object", + "description": "Contains the detailed information about the transaction.", + "properties": { + "balance": { + "type": "object", + "description": "Contains information on how the balance was affected by the transaction.", + "properties": { + "type": { + "type": "string", + "pattern": "loyalty_card", + "enum": [ + "loyalty_card" ], - "activity_duration_after_publishing": "P24D", - "vouchers_count": 1, - "active": true, - "metadata": { - "region": "AMER" - }, - "created_at": "2022-09-20T09:32:29.530Z", - "creation_status": "DONE", - "vouchers_generation_status": "DONE", - "protected": false, - "category_id": null, - "object": "campaign" + "description": "The type of voucher whose balance is being adjusted due to the transaction." }, - { - "id": "camp_HgsbCKauXmEoPnnh8aas0ISe", - "name": "Static Campaign", - "campaign_type": "DISCOUNT_COUPONS", - "type": "STATIC", - "voucher": { - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 3000, - "effect": "APPLY_TO_ORDER" - }, - "redemption": { - "quantity": 1 - }, - "code_config": { - "length": 8, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "########" - }, - "is_referral_code": false - }, - "auto_join": false, - "join_once": true, - "use_voucher_metadata_schema": true, - "vouchers_count": 1, - "active": true, - "metadata": {}, - "created_at": "2022-09-20T07:52:34.499Z", - "updated_at": "2022-09-20T11:38:13.501Z", - "creation_status": "DONE", - "vouchers_generation_status": "DONE", - "protected": false, - "category_id": null, - "object": "campaign" + "total": { + "type": "integer", + "description": "The available points prior to the transaction." }, - { - "id": "camp_f7fBbQxUuTN7dI7tGOo5XMDA", - "name": "Loyalty Program Fall 2022", - "campaign_type": "LOYALTY_PROGRAM", - "type": "AUTO_UPDATE", - "voucher": { - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 0, - "expiration_rules": { - "period_type": "MONTH", - "period_value": 7, - "rounding_type": "END_OF_YEAR" - } - }, - "redemption": { - "quantity": null - }, - "code_config": { - "length": 8, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "########", - "prefix": "LOYALTY-CARD-" - }, - "is_referral_code": false - }, - "auto_join": true, - "join_once": true, - "use_voucher_metadata_schema": true, - "vouchers_count": 1, - "active": true, - "metadata": {}, - "created_at": "2022-09-19T07:56:22.103Z", - "creation_status": "DONE", - "vouchers_generation_status": "DONE", - "protected": false, - "category_id": "cat_0bb343dee3cdb5ec0c", - "object": "campaign" + "object": { + "type": "string", + "pattern": "balance", + "enum": [ + "balance" + ], + "description": "The type of object represented by the JSON." }, - { - "id": "camp_4tHsQEDUOER6PeW8SoMdnHH6", - "name": "Dynamic Discounts", - "campaign_type": "DISCOUNT_COUPONS", - "type": "AUTO_UPDATE", - "voucher": { - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "percent_off": 5, - "percent_off_formula": "IF(ORDER_AMOUNT > 300;15;5)", - "effect": "APPLY_TO_ORDER" - }, - "redemption": { - "quantity": null - }, - "code_config": { - "length": 8, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "########", - "prefix": "DYNAMIC-" - }, - "is_referral_code": false - }, - "auto_join": false, - "join_once": false, - "use_voucher_metadata_schema": true, - "vouchers_count": 1, - "active": true, - "metadata": { - "marketing_text": "Purchases above $300 are eligible for a 15% discount." - }, - "created_at": "2022-07-12T15:12:02.575Z", - "updated_at": "2022-07-20T10:48:05.617Z", - "category": "test", - "creation_status": "DONE", - "vouchers_generation_status": "DONE", - "protected": false, - "category_id": "cat_0b688929a2476386a8", - "object": "campaign" + "points": { + "type": "integer", + "description": "The amount of points being used up in the transaction." }, - { - "id": "camp_JlsseNSDO7l4neFtev6p6945", - "name": "$20 OFF Entire Order", - "campaign_type": "DISCOUNT_COUPONS", - "type": "AUTO_UPDATE", - "voucher": { - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 2000, - "effect": "APPLY_TO_ORDER" - }, - "redemption": { - "quantity": null - }, - "code_config": { - "length": 8, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "########", - "prefix": "$20OFFORDER-" - }, - "is_referral_code": false - }, - "auto_join": false, - "join_once": false, - "use_voucher_metadata_schema": true, - "vouchers_count": 1, - "active": true, - "metadata": {}, - "created_at": "2022-07-11T09:43:36.057Z", - "creation_status": "DONE", - "vouchers_generation_status": "DONE", - "protected": false, - "category_id": null, - "object": "campaign" + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." }, - { - "id": "camp_Uj3cNbWSgt7Zl4AyHM7Sa5Qk", - "name": "3% OFF Entire Order", - "campaign_type": "DISCOUNT_COUPONS", - "type": "AUTO_UPDATE", - "voucher": { - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "percent_off": 3, - "effect": "APPLY_TO_ORDER" - }, - "redemption": { - "quantity": null - }, - "code_config": { - "length": 8, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "########", - "prefix": "3%OFFORDER-" + "related_object": { + "type": "object", + "required": [ + "id", + "type" + ], + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API." }, - "is_referral_code": false - }, - "auto_join": false, - "join_once": false, - "use_voucher_metadata_schema": true, - "vouchers_count": 1, - "active": true, - "metadata": {}, - "created_at": "2022-07-11T09:41:12.087Z", - "creation_status": "DONE", - "vouchers_generation_status": "DONE", - "protected": false, - "category_id": null, - "object": "campaign" + "type": { + "type": "string", + "pattern": "voucher", + "enum": [ + "voucher" + ], + "description": "The object being modified, i.e. voucher." + } + } } - ], - "total": 6 - } - } - } - } - } - } - } - } - }, - "/v1/campaigns/{campaignId}": { - "parameters": [ - { - "in": "path", - "name": "campaignId", - "description": "You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.", - "schema": { - "type": "string", - "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" - }, - "required": true - } - ], - "get": { - "operationId": "get-campaign", - "tags": [ - "CAMPAIGNS API" - ], - "summary": "Get Campaign", - "description": "Retrieves the campaign with the given campaign ID or campaign name.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a campaign object if a valid identifier was provided.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_obj_campaign_object" - }, - "examples": { - "Example": { - "value": { - "id": "camp_JlsseNSDO7l4neFtev6p6945", - "name": "$20 OFF Entire Order", - "campaign_type": "DISCOUNT_COUPONS", - "type": "AUTO_UPDATE", - "voucher": { - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 2000, - "effect": "APPLY_TO_ORDER" + }, + "required": [ + "type", + "total", + "object", + "points", + "balance", + "related_object" + ] + }, + "order": { + "type": "object", + "description": "Contains information about the original order.", + "properties": { + "id": { + "type": "string", + "description": "Unique order ID." }, - "redemption": { - "quantity": null + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + } + }, + "required": [ + "id", + "source_id" + ] + }, + "event": { + "type": "object", + "description": "Contains information about the event that triggers the point accrual.", + "properties": { + "id": { + "type": "string", + "description": "Unique event ID." + }, + "type": { + "type": "string", + "description": "Type of event." + } + }, + "required": [ + "id", + "type" + ] + }, + "earning_rule": { + "type": "object", + "description": "Contains information about the earning rule.", + "properties": { + "id": { + "type": "string", + "description": "Unique earning rule ID." + }, + "source": { + "type": "object", + "required": [ + "banner" + ], + "description": "Contains the custom earning rule name.", + "properties": { + "banner": { + "type": "string", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + } + } + } + }, + "required": [ + "id", + "source" + ] + }, + "segment": { + "type": "object", + "description": "Contains information about the segment.", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "id", + "name" + ] + }, + "loyalty_tier": { + "type": "object", + "description": "Contains information about the loyalty tier.", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "required": [ + "id", + "name" + ] + }, + "redemption": { + "type": "object", + "description": "Contains information about the original redemption.", + "properties": { + "id": { + "type": "string", + "description": "Unique redemption ID." + } + }, + "required": [ + "id" + ] + }, + "rollback": { + "type": "object", + "description": "Contains information about the redemption rollback.", + "properties": { + "id": { + "type": "string", + "description": "Unique redemption rollback ID." + } + }, + "required": [ + "id" + ] + }, + "custom_event": { + "type": "object", + "description": "Contains information about the custom event that triggers the point accrual.", + "properties": { + "id": { + "type": "string", + "description": "Unique event ID." }, - "code_config": { - "length": 8, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "########", - "prefix": "$20OFFORDER-" + "type": { + "type": "string", + "description": "Type of custom event." + } + }, + "required": [ + "id", + "type" + ] + }, + "event_schema": { + "type": "object", + "description": "Contains information about the custom event metadata schema.", + "properties": { + "id": { + "type": "string", + "description": "Unique metadata schema ID." }, - "is_referral_code": false + "name": { + "type": "string", + "description": "Type of custom event." + } }, - "auto_join": false, - "join_once": false, - "use_voucher_metadata_schema": true, - "vouchers_count": 1, - "active": true, - "metadata": {}, - "created_at": "2022-07-11T09:43:36.057Z", - "creation_status": "DONE", - "vouchers_generation_status": "DONE", - "protected": false, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 + "required": [ + "id", + "name" + ] + }, + "reward": { + "type": "object", + "description": "Contains information about the pay with points reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique reward ID." + }, + "name": { + "type": "string", + "description": "Reward name." + } }, - "category_id": null, - "object": "campaign" + "required": [ + "id", + "name" + ] + }, + "source_voucher": { + "$ref": "#/components/schemas/SimpleLoyaltyVoucher", + "description": "Contains information on how the balance on the donor loyalty card was affected by the transaction." + }, + "destination_voucher": { + "$ref": "#/components/schemas/SimpleLoyaltyVoucher", + "description": "Contains information on how the balance on the receiving loyalty card was affected by the transaction." } } - } - } - } - }, - "404": { - "description": "Returns an error when requesting the campaign that has been deleted or cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id camp_jcErmtGAOmHUAy0oUgkwKnP", - "request_id": "v-0bb8694614d58bf2a8", - "resource_id": "camp_jcErmtGAOmHUAy0oUgkwKnP", - "resource_type": "campaign" - } - } + "related_transaction_id": { + "type": [ + "string", + "null" + ], + "description": "The related transaction ID on the receiving card." + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format.\n\n" } - } - } - } - } - }, - "put": { - "operationId": "update-campaign", - "tags": [ - "CAMPAIGNS API" - ], - "summary": "Update Campaign", - "description": "Updates the specified campaign by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. \n\nFields other than the ones listed in the request body won't be modified. Even if provided, they will be silently skipped. \n\n> #### Vouchers will be affected\n>\n> This method will update vouchers aggregated in the campaign. It will affect all vouchers that are not published or redeemed yet.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the campaign parameters to be updated.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_req_update_campaign" }, - "examples": { - "Example": { - "value": { - "description": "New description" + "required": [ + "id", + "source_id", + "voucher_id", + "campaign_id", + "source", + "reason", + "type", + "details", + "related_transaction_id", + "created_at" + ] + }, + "LoyaltyCardTransactionsFields": { + "type": "string", + "enum": [ + "id", + "campaign_id", + "voucher_id", + "type", + "source_id", + "reason", + "source", + "balance", + "amount", + "related_transaction_id", + "created_at", + "details" + ] + }, + "LoyaltiesExportCardTransactionsRequestBody": { + "title": "Loyalties Export Card Transactions Request Body", + "type": "object", + "properties": { + "order": { + "type": "string", + "enum": [ + "created_at", + "-created_at" + ], + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/LoyaltyCardTransactionsFields" } } } - } - } - }, - "responses": { - "200": { - "description": "Returns the campaign object if the update succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_obj_campaign_object" + }, + "LoyaltiesExportCardTransactionsResponseBody": { + "title": "Loyalties Export Card Transactions Response Body", + "type": "object", + "description": "", + "properties": { + "id": { + "type": "string", + "description": "Unique export ID." }, - "examples": { - "Example": { - "value": { - "id": "camp_FZL4iTTdZw36nZOoXYQ172fQ", - "name": "Loyalty Campaign", - "campaign_type": "LOYALTY_PROGRAM", - "type": "AUTO_UPDATE", - "voucher": { - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 1000, - "expiration_rules": { - "period_type": "MONTH", - "period_value": 3, - "rounding_type": "END_OF_YEAR" - } - }, - "redemption": { - "quantity": 10 - }, - "code_config": { - "length": 7, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "LOYALTY-CARD-#######" - }, - "is_referral_code": false, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - } - }, - "auto_join": false, - "join_once": false, - "use_voucher_metadata_schema": false, - "description": "New description", - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2 + "object": { + "type": "string", + "pattern": "export", + "enum": [ + "export" + ], + "description": "The type of object being represented. This object stores information about the export." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format.", + "format": "date-time" + }, + "status": { + "type": "string", + "pattern": "SCHEDULED", + "enum": [ + "SCHEDULED" + ], + "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated." + }, + "channel": { + "type": "string", + "description": "The channel through which the export was triggered." + }, + "exported_object": { + "type": "string", + "pattern": "voucher_transactions", + "enum": [ + "voucher_transactions" + ], + "description": "The type of exported object." + }, + "parameters": { + "type": "object", + "required": [ + "filters" + ], + "description": "List of available fields and filters that can be exported with loyalty card transactions along with the sorting order of the returned data.", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.\n\n`id`, `campaign_id`, `voucher_id`, `type`, `source_id`, `reason`, `source`, `balance`, `amount`, `related_transaction_id`, `created_at`, `details`", + "items": { + "$ref": "#/components/schemas/LoyaltyCardTransactionsFields" + } + }, + "filters": { + "type": "object", + "required": [ + "voucher_id" ], - "activity_duration_after_publishing": "P24D", - "vouchers_count": 2, - "active": true, - "metadata": { - "region": "APAC" - }, - "created_at": "2022-09-21T09:39:45.479Z", - "updated_at": "2022-09-23T09:47:00.205Z", - "category": "First", - "creation_status": "MODIFYING", - "vouchers_generation_status": "MODIFYING", - "protected": false, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" + "description": "Filter condition.", + "properties": { + "voucher_id": { + "type": "object", + "required": [ + "conditions" + ], + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "conditions": { + "type": "object", + "required": [ + "$in" + ], + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "$in": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string", + "minLength": 1, + "maxLength": 1 + } + } + } + } + } } - ], - "object": "campaign" + } } } + }, + "result": { + "type": "null", + "description": "Contains the URL of the CSV file." + }, + "user_id": { + "type": [ + "string", + "null" + ], + "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE." } - } - } - } - } - }, - "delete": { - "operationId": "delete-campaign", - "tags": [ - "CAMPAIGNS API" - ], - "summary": "Delete Campaign", - "description": "Permanently deletes a campaign and all related vouchers. This action cannot be undone. Also, this method immediately removes any redemptions on the voucher.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [ - { - "schema": { - "type": "boolean" + }, + "required": [ + "id", + "object", + "created_at", + "status", + "channel", + "exported_object", + "parameters", + "result", + "user_id" + ] }, - "in": "query", - "description": "If this flag is set to `true`, the campaign and related vouchers will be removed permanently. Going forward, the user will be able to create the next campaign with exactly the same name.", - "name": "force" - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "202": { - "description": "Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the campaign will be deleted from the repository asynchronously. To check the deletion status and result, copy the `async_action_id` from the response and pass it using [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" + "RewardAssignment": { + "title": "Reward Assignment", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique reward assignment ID, assigned by Voucherify." }, - "examples": { - "Delete Campaign": { - "$ref": "#/components/examples/res_async_actions" - } - } - } - } - }, - "404": { - "description": "Returns an error indicating that the campaign with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + "reward_id": { + "type": "string", + "description": "Associated reward ID." + }, + "related_object_id": { + "type": "string", + "description": "Related object ID to which the reward was assigned." + }, + "related_object_type": { + "type": "string", + "description": "Related object type to which the reward was assigned." }, - "examples": { - "Campaign Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id Spring Campaign", - "request_id": "v-0adac46be8cdbfd921", - "resource_id": "Spring Campaign", - "resource_type": "campaign" + "parameters": { + "type": "object", + "description": "Defines the cost of the reward.", + "properties": { + "loyalty": { + "type": "object", + "description": "Defines the equivalent points value of the reward.", + "properties": { + "points": { + "type": "integer", + "description": "The number of points required to redeem the reward." + } + }, + "required": [ + "points" + ] } } + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the reward assignment was created in ISO 8601 format.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format.", + "format": "date-time" + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the reward assignment." } - } - } - } - } - } - }, - "/v1/campaigns/{campaignId}/vouchers": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the campaign to which voucher(s) will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value." - } - ], - "post": { - "operationId": "add-vouchers-to-campaign", - "tags": [ - "CAMPAIGNS API" - ], - "summary": "Add Vouchers to Campaign", - "description": "This method gives the possibility to push new vouchers to an existing campaign. New vouchers will inherit properties from the campaign profile. However, it is possible to overwrite some of them in the request body. If you provide an optional `code_config` parameter with a voucher code configuration, then it will be used to generate new voucher codes. Otherwise, the voucher code configuration from the campaign will be used.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [ - { - "schema": { - "type": "integer" - }, - "in": "query", - "name": "vouchers_count", - "description": "Number of vouchers that should be added." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the voucher parameters that you would like to overwrite.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_req_add_vouchers_to_campaign" }, - "examples": { - "Example": { - "value": { - "category_id": "cat_0bb81a481615a37b5e", - "start_date": "2022-09-24T00:00:00Z", - "expiration_date": "2022-09-25T23:59:59Z", - "active": false, - "redemption": { - "quantity": null + "required": [ + "id", + "reward_id", + "created_at", + "object" + ] + }, + "Reward": { + "allOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique reward ID, assigned by Voucherify." }, - "code_config": { - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "length": 8, - "prefix": "Add-", - "pattern": null, - "postfix": "-API" + "name": { + "type": "string", + "description": "Reward name." }, - "additional_info": "Voucher added using API", - "metadata": { - "Season": "Fall" + "stock": { + "type": "integer", + "description": "Configurable for material rewards. The number of units of the product that you want to share as reward." + }, + "redeemed": { + "type": "integer", + "description": "Defines the number of already invoked (successful) reward redemptions." + }, + "attributes": { + "type": "object", + "description": "These properties are configurable for material rewards.", + "properties": { + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file." + }, + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a material reward." + } + } + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the reward was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the reward was updated in ISO 8601 format." + }, + "object": { + "type": "string", + "default": "reward", + "pattern": "reward", + "description": "The type of object represented by the JSON. This object stores information about the reward." } - } + }, + "required": [ + "id", + "created_at", + "object" + ] + }, + { + "$ref": "#/components/schemas/RewardType" } - } - } - } - }, - "responses": { - "200": { - "description": "Returns a voucher object if the call succeeded for a voucher count of 1.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_obj_voucher_object" + ] + }, + "RewardType": { + "title": "Reward Type", + "anyOf": [ + { + "$ref": "#/components/schemas/RewardTypeCampaign" + }, + { + "$ref": "#/components/schemas/RewardTypeCoin" + }, + { + "$ref": "#/components/schemas/RewardTypeCoin" + } + ] + }, + "RewardTypeCoin": { + "title": "Reward Type Coin", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "COIN" + ], + "description": "Reward type." }, - "examples": { - "Example": { - "value": { - "async_action_id": "aa_0bb96ebb7ec3720252" + "parameters": { + "type": "object", + "required": [ + "coin" + ], + "description": "Defines how the reward is generated.", + "properties": { + "coin": { + "type": "object", + "required": [ + "exchange_ratio" + ], + "description": "Defines the ratio by mapping the number of loyalty points in points_ratio to a predefined cash amount in exchange_ratio.", + "properties": { + "exchange_ratio": { + "type": "number", + "description": "The cash equivalent of the points defined in the points_ratio property." + }, + "points_ratio": { + "type": "integer", + "description": "The number of loyalty points that will map to the predefined cash amount defined by the exchange_ratio property." + } + } } } } - } - } - }, - "202": { - "description": "Returns an `async_action_id` if the request was made to create more than 1 voucher.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" - } - } - } - } - } - } - }, - "/v1/campaigns/{campaignId}/vouchers/{code}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the campaign to which voucher will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value." - }, - { - "schema": { - "type": "string" - }, - "name": "code", - "in": "path", - "required": true, - "description": "A custom **code** that identifies the voucher." - } - ], - "post": { - "operationId": "add-voucher-with-specific-code-to-campaign", - "tags": [ - "CAMPAIGNS API" - ], - "summary": "Add Voucher with Specific Code to Campaign", - "description": "This method gives a possibility to add a new voucher to an existing campaign. The voucher definition will be inherited from the definition kept in the campaign profile. However, you are able to overwrite a few properties inherited from the campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the voucher parameters that you would like to overwrite.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_req_add_vouchers_with_specific_code_to_campaign" }, - "examples": { - "Example": { - "value": { - "category_id": "cat_0bb81a481615a37b5e", - "start_date": "2022-09-24T00:00:00Z", - "expiration_date": "2022-09-25T23:59:59Z", - "active": false, - "redemption": { - "quantity": null - }, - "additional_info": "Voucher added using API", - "metadata": { - "Season": "Fall" + "required": [ + "type", + "parameters" + ] + }, + "RewardTypeMaterial": { + "title": "Reward Type Material", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "MATERIAL" + ], + "description": "Reward type." + }, + "parameters": { + "type": "object", + "required": [ + "product" + ], + "description": "Defines how the reward is generated.", + "properties": { + "product": { + "type": "object", + "required": [ + "id", + "sku" + ], + "description": "Contains information about the product given as a reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique product ID, assigned by Voucherify." + }, + "sku": { + "type": [ + "string", + "null" + ], + "description": "Unique SKU ID, assigned by Voucherify, of the SKU given as a reward." + } + } } } } - } - } - } - }, - "responses": { - "200": { - "description": "Returns a voucher object if the call succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_obj_voucher_object" + }, + "required": [ + "type", + "parameters" + ] + }, + "RewardTypeCampaign": { + "title": "Reward Type Campaign", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "CAMPAIGN" + ], + "description": "Reward type." }, - "examples": { - "Example": { - "value": { - "id": "v_EJwB9Wy2aOIsDpWhnl2QBY51OqjQ5Ukg", - "code": "Code3", - "campaign": "Add Vouchers to Campaign", - "campaign_id": "camp_xxpmFyWO9h9s5cEe7HtmOK5B", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "amount_limit": 2000, - "percent_off": 30, - "effect": "APPLY_TO_ORDER" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2022-09-24T00:00:00.000Z", - "expiration_date": "2022-09-25T23:59:59.000Z", - "validity_timeframe": null, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 + "parameters": { + "type": "object", + "required": [ + "campaign" + ], + "description": "Defines how the reward is generated.", + "properties": { + "campaign": { + "type": "object", + "required": [ + "id", + "type" ], - "active": true, - "additional_info": "Voucher added using API", - "metadata": { - "Season": "Fall" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+p2kdatp7KAUZxgSATC1gRWgsb1Q3RQyClNOBrfUrRKpTjSPSzBuUSZzb45TIpfWRISSiaz1QXGh8z9sVSHIWQsGLO6+1N81zXuY6/pnC7gRBa4edwMaRoCAwzqO9JDw148AGk4XrXLg==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bp2kdatp7KAUZxgSATC1gRWgsb1Q3RQyClNOBrfUrRKpTjSPSzBuUSZzb45TIpfWRISSiaz1QXGh8z9sVSHIWQsGLO6%2B1N81zXuY6%2FpnC7gRBa4edwMaRoCAwzqO9JDw148AGk4XrXLg%3D%3D" + "description": "Objects stores information about the campaign related to the reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique campaign ID, assigned by Voucherify." + }, + "balance": { + "type": "integer", + "description": "The incremental amout to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." }, - "barcode": { - "id": "U2FsdGVkX19wrLVWzIOgoVd9an76OxiJWB5/u9yWGoD7cqN6Qd1K9noNyR1YwvHnBrcN5fa5qtY+sOXonn7WsynAWeR289gA0XobsHHE2VWe8BzNZ7h2kH90SsiW+NCQg6Ts8clYWWP5lrGyV/fzoA==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19wrLVWzIOgoVd9an76OxiJWB5%2Fu9yWGoD7cqN6Qd1K9noNyR1YwvHnBrcN5fa5qtY%2BsOXonn7WsynAWeR289gA0XobsHHE2VWe8BzNZ7h2kH90SsiW%2BNCQg6Ts8clYWWP5lrGyV%2FfzoA%3D%3D" + "type": { + "type": "string", + "enum": [ + "DISCOUNT_COUPONS", + "PROMOTION", + "GIFT_VOUCHERS", + "REFERRAL_PROGRAM" + ], + "description": "Campaign type." } - }, - "is_referral_code": false, - "created_at": "2022-09-21T07:14:28.217Z", - "updated_at": null, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/Code3/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/Code3/publications?page=1&limit=10" - }, - "object": "voucher" + } } } } - } - } - }, - "409": { - "description": "Returns an error if a voucher with the same code already exists.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" + }, + "required": [ + "type", + "parameters" + ] + }, + "LoyaltiesAddOrRemoveCardBalanceResponseBody": { + "title": "Loyalties Add Or Remove Card Balance Response Body", + "type": "object", + "description": "Response schema for adding or removing points from a loyalty card.", + "properties": { + "points": { + "type": "integer", + "description": "The incremental points removed or added to the current balance on the loyalty card." + }, + "total": { + "type": "integer", + "description": "The total of points accrued over the lifetime of the loyalty card." + }, + "balance": { + "type": "integer", + "minimum": 0, + "description": "The balance after adding/removing points." + }, + "type": { + "type": "string", + "enum": [ + "LOYALTY_CARD", + "GIFT_VOUCHER" + ], + "description": "The type of voucher being modified." + }, + "object": { + "type": "string", + "pattern": "balance", + "enum": [ + "balance" + ], + "description": "The type of object represented by JSON. Default is balance." }, - "examples": { - "Duplicate": { - "value": { - "code": 409, - "key": "duplicate_found", - "message": "Duplicated resource found", - "details": "Duplicated voucher exists with id Code1", - "request_id": "v-0bb974be99d22504cd", - "resource_id": "Code1", - "resource_type": "voucher" + "related_object": { + "type": "object", + "required": [ + "type", + "id" + ], + "description": "Defines the object that is being modified with the values that are returned in the balance object.", + "properties": { + "type": { + "type": "string", + "enum": [ + "voucher" + ], + "description": "The object being modified." + }, + "id": { + "type": "string", + "description": "Identifies the loyalty card that is being modified, this is the ID that was assigned by the Voucherify API." } } + }, + "operation_type": { + "type": "string", + "enum": [ + "MANUAL", + "AUTOMATIC" + ] } - } - } - } - } - } - }, - "/v1/campaigns/{campaignId}/import": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The ID of an existing campaign to which you're importing the codes. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value." - } - ], - "post": { - "operationId": "import-vouchers-to-campaign", - "tags": [ - "CAMPAIGNS API" - ], - "summary": "Import Vouchers to Campaign", - "description": "Imports vouchers to an **existing** campaign.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Discount type, expiration date and the remaining attributes will be taken from the [Campaign](ref:get-campaign) settings.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_req_import_vouchers_to_campaign" }, - "examples": { - "Example": { - "value": [ - { - "code": "CODE7", - "category": "First", - "redemption": { - "quantity": 1 - }, - "metadata": { - "season": "Fall" - }, - "additional_info": "secret-code1", - "active": true + "required": [ + "points", + "total", + "balance", + "type", + "object", + "related_object" + ] + }, + "LoyaltiesTransferPointsResponseBody": { + "title": "Loyalties Transfer Points Response Body", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Assigned by the Voucherify API, identifies the voucher." + }, + "code": { + "type": "string", + "description": "A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters." + }, + "campaign": { + "type": "string", + "description": "A unique campaign name, identifies the voucher's parent campaign." + }, + "campaign_id": { + "type": "string", + "description": "Assigned by the Voucherify API, identifies the voucher's parent campaign." + }, + "category": { + "type": [ + "string", + "null" + ], + "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint." + }, + "category_id": { + "type": [ + "string", + "null" + ], + "description": "Unique category ID assigned by Voucherify." + }, + "categories": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Category" + } + }, + "type": { + "type": "string", + "enum": [ + "LOYALTY_CARD" + ], + "description": "Defines the type of voucher." + }, + "loyalty_card": { + "type": "object", + "description": "Object representing loyalty card parameters. Child attributes are present only if type is LOYALTY_CARD.", + "required": [ + "points", + "balance" + ], + "properties": { + "points": { + "type": "integer", + "description": "Total points incurred over lifespan of loyalty card." }, - { - "code": "CODE8", - "category": "Second", - "redemption": { - "quantity": 18 - }, - "metadata": { - "season": "Fall" - }, - "additional_info": "secret-code1", - "active": true + "balance": { + "type": "integer", + "description": "Points available for reward redemption." + }, + "next_expiration_date": { + "type": "string", + "description": "The next closest date when the next set of points are due to expire." + }, + "next_expiration_points": { + "type": "integer", + "description": "The amount of points that are set to expire next." + } + } + }, + "start_date": { + "type": [ + "string", + "null" + ], + "description": "Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is inactive before this date.", + "format": "date-time" + }, + "expiration_date": { + "type": [ + "string", + "null" + ], + "description": "Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is inactive after this date.", + "format": "date-time" + }, + "validity_timeframe": { + "type": [ + "object", + "null" + ], + "description": "Set recurrent time periods when the voucher is valid. For example, valid for 1 hour every other day.start_date required when including the validity_timeframe.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a duration of PT1H will be valid for a duration of one hour." }, - { - "code": "CODE9", - "category_id": "cat_0bb343dee3cdb5ec0c", - "redemption": { - "quantity": 4 - }, - "metadata": { - "season": "Fall" - }, - "additional_info": "secret-code1", - "active": true + "duration": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an interval of P2D will be active every other day." } - ] + } }, - "Gift Cards": { - "value": [ - { - "code": "CODE13", - "category": "First", - "redemption": { - "quantity": 1 - }, - "metadata": { - "season": "Fall" - }, - "additional_info": "secret-code1", - "gift": { - "amount": 500 - }, - "active": true + "validity_day_of_week": { + "type": [ + "array", + "null" + ], + "description": "Integer array corresponding to the particular days of the week in which the voucher is valid.\n\n- `0` Sunday\n- `1` Monday\n- `2` Tuesday\n- `3` Wednesday\n- `4` Thursday\n- `5` Friday\n- `6` Saturday", + "items": { + "type": "integer", + "minimum": 0, + "maximum": 6 + } + }, + "publish": { + "type": "object", + "description": "This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or publish voucher API method.", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute." }, - { - "code": "CODE14", - "category": "Second", - "redemption": { - "quantity": 18 - }, - "metadata": { - "season": "Fall" - }, - "additional_info": "secret-code1", - "gift": { - "amount": 2000 - }, - "active": true + "count": { + "type": "integer", + "description": "Publication events counter." }, - { - "code": "CODE15", - "category_id": "cat_0bb343dee3cdb5ec0c", - "redemption": { - "quantity": 4 - }, - "metadata": { - "season": "Fall" - }, - "additional_info": "secret-code1", - "active": false + "entries": { + "type": "array", + "items": { + "type": "string" + } + }, + "url": { + "type": "string", + "description": "The endpoint where this list of publications can be accessed using a GET method. /v1/vouchers/{voucher_code}/publications" } + }, + "required": [ + "object" ] }, - "Loyalty Cards": { - "value": [ - { - "code": "CODE10", - "category": "First", - "redemption": { - "quantity": 1 - }, - "metadata": { - "season": "Fall" - }, - "additional_info": "secret-code1", - "loyalty_card": { - "points": 300 - }, - "active": true + "redemption": { + "type": "object", + "description": "Stores a summary of redemptions that have been applied to the voucher.", + "properties": { + "quantity": { + "type": [ + "integer", + "null" + ], + "description": "How many times a voucher can be redeemed. A null value means unlimited." }, - { - "code": "CODE11", - "category": "Second", - "redemption": { - "quantity": 18 - }, - "metadata": { - "season": "Fall" - }, - "additional_info": "secret-code1", - "loyalty_card": { - "points": 2000 - }, - "active": true + "redeemed_points": { + "type": "integer", + "description": "Total loyalty points redeemed." }, - { - "code": "CODE12", - "category_id": "cat_0bb343dee3cdb5ec0c", - "redemption": { - "quantity": 4 - }, - "metadata": { - "season": "Fall" - }, - "additional_info": "secret-code1", - "active": true - } - ] - } - } - } - } - }, - "responses": { - "202": { - "description": "Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the vouchers will be imported 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](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" - }, - "examples": { - "Example": { - "$ref": "#/components/examples/res_async_actions" - } - } - } - } - }, - "400": { - "description": "Returns an error if the request includes incorrect data, e.g. a wrong data type or duplicated codes.", - "content": { - "application/json": { - "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/e_400_invalid_voucher" + "redeemed_quantity": { + "type": "integer", + "description": "How many times a voucher has already been redeemed." }, - { - "$ref": "#/components/schemas/e_400_duplicate_key" + "redemption_entries": { + "type": "array", + "items": { + "type": "string" + } + }, + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute." + }, + "url": { + "type": "string", + "description": "The endpoint where this list of redemptions can be accessed using a GET method. /v1/vouchers/{voucher_code}/redemptions" } + }, + "required": [ + "quantity" ] }, - "examples": { - "Duplicate Codes": { - "value": { - "code": 400, - "key": "duplicate_key", - "message": "Duplicate codes", - "details": "2 voucher codes(s) already exist.", - "request_id": "v-0adaccaba61502e4b3" - } - }, - "Missing Code": { - "value": { - "code": 400, - "key": "invalid_voucher", - "message": "Invalid Voucher", - "details": "Found 1 voucher(s) without 'code' value", - "request_id": "v-0bbc38ce088c8b2f9a" - } - }, - "Invalid Payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Property .redemption.quantity should be number,null", - "request_id": "v-0c545db3808418908f" - } - } - } - } - } - } - } - } - }, - "/v1/campaigns/{campaignId}/importCSV": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value." - } - ], - "post": { - "operationId": "import-vouchers-to-campaign-using-csv", - "tags": [ - "CAMPAIGNS API" - ], - "summary": "Import Vouchers to Campaign by CSV", - "description": "Imports vouchers to an **existing** campaign. \n\n\nThe CSV file has to include headers in the first line. \n\nCurl Example\n\n```cURL\ncurl -X POST \\\n https://api.voucherify.io/v1/campaigns/TEST-CAMPAIGN/importCSV \\\n -F file=@/path/to/campaigns.csv \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\"\n```\n\nYou can import values for the following fields: `Code` (**required**), `Category`, `Active`. In a gift cards import, you can also include the current card balance using the `Gift Amount` header and the amount that was redeemed using the `Redeemed Amount` header. In a loyalty cards import, you can also include the current loyalty card score in points using the `Loyalty Points` header. Remaining CSV columns will be mapped to metadata properties. \n\nDiscount type, time limits, and validation rules will be taken from the [campaign object](ref:get-campaign) settings. \n\n\n| **Active** | **Code** | **Loyalty Points** | **Gift Amount** | **Redeemed Amount** | **Redeemed Quantity** | **Category** | **Custom_metadata_property** |\n|---|---|---|---|---|---|---|---|\n| Use `true` or `false` to enable or disable the voucher; this flag can be used to turn off the ability to redeem a voucher even though it is within the campaign's start/end validity timeframe. | The unique voucher code. | The number of points to be added to the loyalty card. If you leave this undefined, then the initial number of points will be set according to the campaign settings.
Context: `LOYALTY_PROGRAM` | The initial gift card balance.
Context: `GIFT_VOUCHERS` | The amount that was redeemed from the available balance on a gift card. | The number of times the voucher has been redeemed. | A custom tag for the voucher to help you filter codes; you can either import the category name or a unique Voucherify-assigned category ID. | Any additional data that you would like to store for the given loyalty card as a Custom attribute. Remember to define the metadata schema in the Dashboard prior to importing codes. |\n|\n\n> 📘 Active\n>\n> The CSV file is allowed in two versions; either with or without a column titled `Active`. It indicates whether the voucher is enabled after the import event. \n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/a_req_importCSV" - } - } - }, - "description": "The file path is stored in the form `file` header." - }, - "responses": { - "200": { - "description": "Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the vouchers will be imported 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](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" + "active": { + "type": "string", + "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the start_date and expiration_date.\n\n- `true` indicates an active voucher\n- `false` indicates an inactive voucher" }, - "examples": { - "Example": { - "$ref": "#/components/examples/res_async_actions" - } - } - } - } - }, - "404": { - "description": "Returns an error if the campaign cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + "additional_info": { + "type": [ + "string", + "null" + ], + "description": "An optional field to keep any extra textual information about the code such as a code description and details." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." }, - "examples": { - "Example": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id camp_FZL4iTTdZw36nZOoXYQ172fQ", - "request_id": "v-0bc26adad888b6fed1", - "resource_id": "camp_FZL4iTTdZw36nZOoXYQ172fQ", - "resource_type": "campaign" + "assets": { + "type": "object", + "description": "Stores links to images of QR and barcode that correspond to an encrypted voucher code.", + "properties": { + "qr": { + "type": "object", + "description": "Stores Quick Response (QR) representation of encrypted code.", + "properties": { + "id": { + "type": "string", + "example": "U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK+t4pp7U7oFzjGJzj9q/bmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg+BaZk5QwXMf8k/OzSlOEVybpwSq+AiqPoNtjeuqtIgkDyvT6Q==", + "description": "Encrypted voucher code ID." + }, + "url": { + "type": "string", + "example": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK%2Bt4pp7U7oFzjGJzj9q%2FbmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg%2BBaZk5QwXMf8k%2FOzSlOEVybpwSq%2BAiqPoNtjeuqtIgkDyvT6Q%3D%3D", + "description": "URL to QR code \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" + } + } + }, + "barcode": { + "type": "object", + "description": "Stores barcode representation of encrypted code.", + "properties": { + "id": { + "type": "string", + "example": "U2FsdGVkX19eJhGfWwUrH9+tulBkON+AnMktic+N6CVWzZ9+fHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ+kJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6/pFs61apEn9SJx32ttCF6d3oxKISQQ==", + "description": "Encrypted voucher code ID." + }, + "url": { + "type": "string", + "example": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19eJhGfWwUrH9%2BtulBkON%2BAnMktic%2BN6CVWzZ9%2BfHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ%2BkJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6%2FpFs61apEn9SJx32ttCF6d3oxKISQQ%3D%3D", + "description": "URL to barcode \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" + } + } } } + }, + "is_referral_code": { + "type": "boolean", + "description": "Flag indicating whether this voucher is a referral code." + }, + "holder_id": { + "type": "string", + "description": "Unique customer ID of voucher owner." + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.", + "format": "date-time" + }, + "created_at": { + "type": "string", + "format": "date-time" } - } - } - } - } - } - }, - "/v1/campaigns/qualification": { - "post": { - "operationId": "examine-campaigns-qualification", - "deprecated": true, - "tags": [ - "CAMPAIGNS API" - ], - "summary": "Examine Qualification [Deprecated]", - "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for qualification, and we do not recommend using it. The new [Qualifications API](ref:examine-qualification) introduces additional features and improvements while maintaining backward compatibility. 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. \n\nThe method can be used for sending a request to display all campaigns qualified to the given customer and context (e.g., order). \n\nThe maximum number of **returned campaigns is 50**.\n\n## What campaign types are included in the response?\n\n- `DISCOUNT_COUPONS`\n- `GIFT_VOUCHERS`\n- `REFERRAL_PROGRAM`\n\n## What's excluded?\n\nA checking logic will be run only among campaigns and will ignore _standalone vouchers_. For standalone vouchers, you should run a [dedicated endpoint](ref:examine-vouchers-qualification) for searching and identifing vouchers. \n\n## Subsequent Steps\n\nAs a recommended subsequent step after selecting a qualified campaign is to publish a voucher code from that campaign. The [API method for publishing](ref:create-publication) will return a unique code which will belong to a given customer.\n\n## Sample use case\n\nAs a sample use case, you can imagine a requirement of displaying coupons (grouped in campaigns) that a customer is eligible to use. The customer should get assigned to the particular voucher from the campaign and then may redeem that particular code when he/she places an order.\n\n[Read](doc:checking-eligibility-for-coupons) about Qualification API limits before you start.", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "audienceRulesOnly", - "description": "This parameter set to true will ask only for verifying vouchers' validation rules only against conditions applied to audiences' attributes (belonging into segment and Customer metadata)" - }, - { - "schema": { - "type": "integer", - "maximum": 50 - }, - "in": "query", - "name": "limit", - "description": "The number of campaigns to be qualified. The maximum number is 50." - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at", - "type", - "-type", + }, + "required": [ + "id", "code", - "-code", "category", - "-category", - "campaign", - "-campaign" + "category_id", + "type", + "loyalty_card", + "start_date", + "expiration_date", + "validity_timeframe", + "validity_day_of_week", + "active", + "additional_info", + "metadata", + "is_referral_code", + "created_at" ] }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash `-` means sorting in a descending order." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_req_examine_qualification" - }, - "examples": { - "Example": { - "value": { - "customer": { - "source_id": "source-id", - "metadata": { - "key": "value" - } - }, - "order": { - "amount": 10000, - "items": [ - { - "product_id": "product-id", - "quantity": "1", - "price": 10000, - "related_object": "product", - "product": { - "metadata": { - "key": "value" - } - } - } - ] - }, - "metadata": { - "key": "value" - } - } - } - } - } - } - }, - "responses": { - "200": { - "description": "This operation returns the list of valid and active campaigns based on the qualification of a given context (e.g., customer profile, redemptions metadata, order).\n\n[Read](doc:checking-eligibility-for-coupons) about Qualification API limits before you start.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_res_examine_qualification" - } - } - } - } - } - } - }, - "/v1/campaigns/{campaignId}/enable": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value." - } - ], - "post": { - "operationId": "enable-campaign", - "tags": [ - "CAMPAIGNS API" - ], - "summary": "Enable Campaign", - "description": "There are various times when you'll want to manage a campaign's accessibility. This can be done by two API methods for managing the campaign state - *enable* and *disable*. \n\nSets campaign state to **active**. The vouchers in this campaign can be redeemed - only if the redemption occurs after the start date of the campaign and voucher and the voucher and campaign are not expired.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns an empty json `{}`.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/res_empty_json" + "LoyaltiesTransferPoints": { + "title": "Loyalties Transfer Points", + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Unique loyalty card code from which the user wants to transfer loyalty points (source)." }, - "examples": { - "Empty JSON": { - "value": {} - } - } - } - } - }, - "404": { - "description": "Returns an error if the campaign cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + "points": { + "type": "integer", + "description": "The number of loyalty points that the user wants to transfer to another loyalty card. The number of points cannot be higher than the current balance on the loyalty card (source)." }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id camp_h8RyP6FV94F3Ev2odP24j5p", - "request_id": "v-0adaf4847c9502879b", - "resource_id": "camp_h8RyP6FV94F3Ev2odP24j5p", - "resource_type": "campaign" - } - } - } - } - } - } - } - } - }, - "/v1/campaigns/{campaignId}/disable": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the campaign being disabled. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value." - } - ], - "post": { - "operationId": "disable-campaign", - "tags": [ - "CAMPAIGNS API" - ], - "summary": "Disable Campaign", - "description": "There are various times when you'll want to manage a campaign's accessibility. This can be done by two API methods for managing the campaign state - *enable* and *disable*. \n\nSets campaign state to **inactive**. The vouchers in this campaign can no longer be redeemed.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns an empty json `{}`.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/res_empty_json" + "reason": { + "type": "string", + "description": "Reason for the transfer." }, - "examples": { - "Empty JSON": { - "value": {} - } + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." } + }, + "required": [ + "code", + "points", + "source_id" + ] + }, + "LoyaltiesTransferPointsRequestBody": { + "title": "Loyalties Transfer Points Request Body", + "type": "array", + "items": { + "$ref": "#/components/schemas/LoyaltiesTransferPoints" } - } - }, - "404": { - "description": "Returns an error if the campaign cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + }, + "LoyaltiesAddOrRemoveCardBalanceRequestBody": { + "title": "Loyalties Add Or Remove Card Balance Request Body", + "type": "object", + "properties": { + "points": { + "type": "integer", + "description": "Incremental balance to be added to/subtracted from the loyalty card.\n\n- To add points: 100\n- To subtract points, add a minus: -100" }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id Spring Campaign", - "request_id": "v-0adaf3735116bb298b", - "resource_id": "Spring Campaign", - "resource_type": "campaign" - } - } - } - } - } - } - } - } - }, - "/v1/promotion-tier-object": { - "get": { - "operationId": "promotion-tier-object", - "tags": [ - "PROMOTIONS API" - ], - "summary": "Promotion Tier Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Promotion Tier Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_obj_promotion_tier_object" + "expiration_type": { + "$ref": "#/components/schemas/PointsExpirationTypes", + "description": "Set the type of expiration for added points.\n\n`PROGRAM_RULES`: Inherit rules from campaign.\n`NON_EXPIRING`: Points never expire.\n`CUSTOM_DATE`: Points expire on a particular date. Requires expiration_date parameter." + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Set expiration date for added points, i.e. `YYYY-MM-DD`. This parameter is required only when expiration_type is set to `CUSTOM_DATE`." + }, + "reason": { + "type": "string", + "description": "Reason for the transfer." + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." } - } - } - } - } - } - }, - "/v1/promotions/tiers": { - "get": { - "operationId": "list-promotion-tiers", - "tags": [ - "PROMOTIONS API" - ], - "summary": "List Promotion Tiers", - "description": "This method enables you to list promotion tiers.", - "parameters": [ - { - "schema": { - "type": "boolean" - }, - "in": "query", - "name": "is_available", - "description": "This parameter allows filtering promotions that are only available at the moment. When set to `true`, it selects only non-expired and active promotions." - }, - { - "schema": { - "type": "integer" - }, - "in": "query", - "name": "limit", - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." - }, - { - "schema": { - "type": "string" + }, + "required": [ + "points" + ] }, - "in": "query", - "description": "Which page of results to return.", - "name": "page" - }, - { - "schema": { + "PointsExpirationTypes": { + "title": "Points Expiration Types", "type": "string", "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" + "PROGRAM_RULES", + "CUSTOM_DATE", + "NON_EXPIRING" ] }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary with a `tiers` property that contains an array of promotion tiers.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_res_list_promotion_tiers" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "tiers", - "tiers": [ - { - "id": "promo_NzjTc3ZXTe7md5SziK3uYtei", - "created_at": "2022-09-21T11:38:34.962Z", - "name": "Order more than $100", - "banner": "Order more than $100", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 3000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "hierarchy": 1, - "promotion_id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "campaign": { - "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P3D", - "duration": "P2D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": true, - "category_id": "cat_0bb81a481615a37b5e", - "object": "campaign" - }, - "campaign_id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "active": true, - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P3D", - "duration": "P2D" - }, - "validity_day_of_week": [ - 1, - 2 - ], - "summary": { - "redemptions": { - "total_redeemed": 0 - }, - "orders": { - "total_amount": 0, - "total_discount_amount": 0 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": null - }, - { - "id": "promo_RaYHtUBre5jU8frUXOvYBtlN", - "created_at": "2021-12-15T11:34:01.358Z", - "updated_at": "2022-02-09T09:20:08.619Z", - "name": "Hot Promotion - Tier 2", - "banner": "Get Tier 2 Discount $20 Off", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 2000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "hierarchy": 2, - "promotion_id": "camp_5h0wc453_5", - "campaign": { - "id": "camp_5h0wc453_5", - "start_date": null, - "expiration_date": null, - "active": true, - "category_id": "cat_0b688929a2476386a6", - "object": "campaign" - }, - "campaign_id": "camp_5h0wc453_5", - "active": true, - "summary": { - "redemptions": { - "total_redeemed": 33 - }, - "orders": { - "total_amount": 519200, - "total_discount_amount": 66000 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_pEe1inoYSfmO12p7", - "rule_id": "val_5h0wc453_5", - "related_object_id": "promo_RaYHtUBre5jU8frUXOvYBtlN", - "related_object_type": "promotion_tier", - "created_at": "2021-12-15T11:34:01.358Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - } - }, - { - "id": "promo_63fYCt81Aw0h7lzyRkrGZh9p", - "created_at": "2021-12-15T11:34:01.333Z", - "updated_at": "2022-02-09T09:20:05.603Z", - "name": "Hot Promotion - Tier 1", - "banner": "Get Tier 1 Discount 10zl", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 1000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": { - "ProductionMetaData": "Hot Promotion - Tier 1" - }, - "hierarchy": 1, - "promotion_id": "camp_5h0wc453_5", - "campaign": { - "id": "camp_5h0wc453_5", - "start_date": null, - "expiration_date": null, - "active": true, - "category_id": "cat_0b688929a2476386a6", - "object": "campaign" - }, - "campaign_id": "camp_5h0wc453_5", - "active": true, - "summary": { - "redemptions": { - "total_redeemed": 11 - }, - "orders": { - "total_amount": 1414979, - "total_discount_amount": 11000 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_QqYs7GGVy7cuh3L9", - "rule_id": "val_5h0wc453_4", - "related_object_id": "promo_63fYCt81Aw0h7lzyRkrGZh9p", - "related_object_type": "promotion_tier", - "created_at": "2021-12-15T11:34:01.333Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - } - } - ], - "total": 3 - } - } - } - } - } - } - } - } - }, - "/client/v1/promotions/tiers": { - "get": { - "operationId": "list-promotion-tiers-client-side", - "tags": [ - "PROMOTIONS API" - ], - "summary": "List Promotion Tiers (client-side)", - "description": "This method enables you to list promotion tiers.", - "parameters": [ - { - "schema": { - "type": "boolean" - }, - "in": "query", - "name": "is_available", - "description": "This parameter allows filtering promotions that are only available at the moment. When set to `true`, it selects only non-expired and active promotions." - }, - { - "schema": { - "type": "integer" - }, - "in": "query", - "name": "limit", - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "description": "Which page of results to return.", - "name": "page" - }, - { - "schema": { - "type": "string", - "enum": [ + "Category": { + "title": "Category", + "type": "object", + "description": "This is an object representing a category.", + "properties": { + "id": { + "type": "string", + "description": "Unique category ID assigned by Voucherify." + }, + "name": { + "type": "string", + "description": "Category name." + }, + "hierarchy": { + "type": "integer", + "description": "Category hierarchy." + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the category was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the category was updated in ISO 8601 format." + }, + "object": { + "type": "string", + "enum": [ + "category" + ], + "description": "The type of object represented by the JSON. This object stores information about the category." + } + }, + "required": [ + "id", + "name", + "hierarchy", "created_at", - "-created_at", - "updated_at", - "-updated_at" + "object" ] }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." - }, - { - "$ref": "#/components/parameters/origin" - } - ], - "security": [ - { - "X-Client-Application-Id-1": [], - "X-Client-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary with a `tiers` property that contains an array of promotion tiers.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_res_list_promotion_tiers" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "tiers", - "tiers": [ - { - "id": "promo_NzjTc3ZXTe7md5SziK3uYtei", - "created_at": "2022-09-21T11:38:34.962Z", - "name": "Order more than $100", - "banner": "Order more than $100", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 3000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "hierarchy": 1, - "promotion_id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "campaign": { - "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P3D", - "duration": "P2D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": true, - "category_id": "cat_0bb81a481615a37b5e", - "object": "campaign" - }, - "campaign_id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "active": true, - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P3D", - "duration": "P2D" - }, - "validity_day_of_week": [ - 1, - 2 - ], - "summary": { - "redemptions": { - "total_redeemed": 0 - }, - "orders": { - "total_amount": 0, - "total_discount_amount": 0 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": null + "ExportsCreateRequestBody": { + "anyOf": [ + { + "title": "Export Vouchers", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "voucher" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportVoucherOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." }, - { - "id": "promo_RaYHtUBre5jU8frUXOvYBtlN", - "created_at": "2021-12-15T11:34:01.358Z", - "updated_at": "2022-02-09T09:20:08.619Z", - "name": "Hot Promotion - Tier 2", - "banner": "Get Tier 2 Discount $20 Off", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 2000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "hierarchy": 2, - "promotion_id": "camp_5h0wc453_5", - "campaign": { - "id": "camp_5h0wc453_5", - "start_date": null, - "expiration_date": null, - "active": true, - "category_id": "cat_0b688929a2476386a6", - "object": "campaign" - }, - "campaign_id": "camp_5h0wc453_5", - "active": true, - "summary": { - "redemptions": { - "total_redeemed": 33 - }, - "orders": { - "total_amount": 519200, - "total_discount_amount": 66000 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_pEe1inoYSfmO12p7", - "rule_id": "val_5h0wc453_5", - "related_object_id": "promo_RaYHtUBre5jU8frUXOvYBtlN", - "related_object_type": "promotion_tier", - "created_at": "2021-12-15T11:34:01.358Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportVoucherFields" } }, - { - "id": "promo_63fYCt81Aw0h7lzyRkrGZh9p", - "created_at": "2021-12-15T11:34:01.333Z", - "updated_at": "2022-02-09T09:20:05.603Z", - "name": "Hot Promotion - Tier 1", - "banner": "Get Tier 1 Discount 10zl", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 1000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": { - "ProductionMetaData": "Hot Promotion - Tier 1" - }, - "hierarchy": 1, - "promotion_id": "camp_5h0wc453_5", - "campaign": { - "id": "camp_5h0wc453_5", - "start_date": null, - "expiration_date": null, - "active": true, - "category_id": "cat_0b688929a2476386a6", - "object": "campaign" - }, - "campaign_id": "camp_5h0wc453_5", - "active": true, - "summary": { - "redemptions": { - "total_redeemed": 11 - }, - "orders": { - "total_amount": 1414979, - "total_discount_amount": 11000 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_QqYs7GGVy7cuh3L9", - "rule_id": "val_5h0wc453_4", - "related_object_id": "promo_63fYCt81Aw0h7lzyRkrGZh9p", - "related_object_type": "promotion_tier", - "created_at": "2021-12-15T11:34:01.333Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - } + "filters": { + "$ref": "#/components/schemas/ExportVoucherFilters", + "description": "Filter conditions." } - ], - "total": 3 + }, + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." } - } - } - } - } - } - } - } - }, - "/v1/promotions/{campaignId}/tiers": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID assigned by Voucherify." - } - ], - "get": { - "operationId": "list-promotion-tiers-from-campaign", - "tags": [ - "PROMOTIONS API" - ], - "summary": "List Promotion Tiers from Campaign", - "description": "This method enables you to list promotion tiers from a specified campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary with a `tiers` property that contains an array of promotion tiers.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_res_list_promotion_tiers_from_campaign" + }, + "required": [ + "exported_object" + ] }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "tiers", - "tiers": [ - { - "id": "promo_xyOKjAmysZrwt3aqq1dMUwMU", - "created_at": "2022-04-07T08:43:53.730Z", - "updated_at": "2022-08-26T05:22:43.220Z", - "name": "Amount", - "banner": "Get $10 off entire order", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 1000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "hierarchy": 2, - "promotion_id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", - "campaign": { - "id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", - "start_date": null, - "expiration_date": null, - "active": true, - "category_id": "cat_0b5f67863083bf7c05", - "object": "campaign" - }, - "campaign_id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", - "active": true, - "summary": { - "redemptions": { - "total_redeemed": 1 - }, - "orders": { - "total_amount": 2187, - "total_discount_amount": 1000 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": null + { + "title": "Export Redemptions", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "redemption" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportRedemptionOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." }, - { - "id": "promo_CQonGnrsFAdEJfJQ3oKB3a8G", - "created_at": "2022-04-07T08:43:53.581Z", - "updated_at": "2022-08-26T05:22:43.008Z", - "name": "Percentage", - "banner": "Get 10% OFF on entire order", - "action": { - "discount": { - "type": "PERCENT", - "percent_off": 10, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "hierarchy": 1, - "promotion_id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", - "campaign": { - "id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", - "start_date": null, - "expiration_date": null, - "active": true, - "category_id": "cat_0b5f67863083bf7c05", - "object": "campaign" - }, - "campaign_id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", - "active": true, - "summary": { - "redemptions": { - "total_redeemed": 1 - }, - "orders": { - "total_amount": 71600, - "total_discount_amount": 7160 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": null + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportRedemptionFields" + } + }, + "filters": { + "$ref": "#/components/schemas/ExportRedemptionFilters", + "description": "Filter conditions." } - ], - "total": 2, - "has_more": false + }, + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." } - } - } - } - } - } - } - }, - "post": { - "operationId": "add-promotion-tier-to-campaign", - "tags": [ - "PROMOTIONS API" - ], - "summary": "Add Promotion Tier to Campaign", - "description": "This method allows you to add a new promotion tier to an existing campaign. The tier hierarchy will be set as the next consequtive integer following the lowest ranking tier.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the promotion tier parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_req_add_promotion_tier_to_campaign" - }, - "examples": { - "Example": { - "value": { - "name": "Order more than $100", - "banner": "Order more than $100", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 3000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "active": true, - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4 - ], - "validation_rules": [ - "val_q8qUBMOh5qIQ" - ] - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns a promotion tier object if the promotion tier was successfully added to the campaign.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_obj_promotion_tier_object" + }, + "required": [ + "exported_object" + ] }, - "examples": { - "Example": { - "value": { - "id": "promo_JcYGIKJsnv0SpZcx2njZm69x", - "created_at": "2022-09-22T11:21:57.808Z", - "name": "Order more than $100", - "banner": "Order more than $100", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 3000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "hierarchy": 6, - "campaign": { - "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": true, - "object": "campaign" - }, - "campaign_id": null, - "active": true, - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4 + { + "title": "Export Customers", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "customer" ], - "summary": { - "redemptions": { - "total_redeemed": 0 + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportCustomerOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportCustomerFields" + } }, - "orders": { - "total_amount": 0, - "total_discount_amount": 0 + "filters": { + "$ref": "#/components/schemas/ExportCustomerFilters", + "description": "Filter conditions." } }, - "object": "promotion_tier", - "validation_rule_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_AmeYPmiLZKaIxq01", - "rule_id": "val_q8qUBMOh5qIQ", - "related_object_id": "promo_JcYGIKJsnv0SpZcx2njZm69x", - "related_object_type": "promotion_tier", - "created_at": "2022-09-22T11:21:57.808Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - } + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." } - } - } - } - } - } - } - } - }, - "/v1/promotions/tiers/{promotionTierId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "promo_2EnAik6Jt7dKTOMkRTIgEjZH" - }, - "name": "promotionTierId", - "in": "path", - "required": true, - "description": "Unique promotion tier ID." - } - ], - "get": { - "operationId": "get-promotion-tier", - "tags": [ - "PROMOTIONS API" - ], - "summary": "Get Promotion Tier", - "description": "This method enables you to retrieve a specific promotion tier.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a promotion tier object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_obj_promotion_tier_object" - } - } - } - } - } - }, - "put": { - "operationId": "update-promotion-tier", - "tags": [ - "PROMOTIONS API" - ], - "summary": "Update Promotion Tier", - "description": "This method updates a promotion tier.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the promotion tier parameters that you would like to update.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_req_update_promotion_tier" - }, - "examples": { - "Example": { - "value": { - "name": "Order more than $100 USD", - "banner": "Order more than $100 USD", - "action": { - "discount": { - "type": "PERCENT", - "percent_off": 25, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": { - "level": "A-21" - }, - "hierarchy": 1, - "start_date": "2022-09-22T00:00:00.000Z", - "expiration_date": "2022-09-29T00:00:00.000Z", - "validity_timeframe": { - "interval": "P3D", - "duration": "P2D" - }, - "validity_day_of_week": [ - 1, - 2, - 3 - ] - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns a promotion tier object if the update was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_obj_promotion_tier_object" + }, + "required": [ + "exported_object" + ] }, - "examples": { - "Example": { - "value": { - "id": "promo_hINAfBAVhmFuSAzi3vptfyxW", - "created_at": "2022-09-22T12:40:23.286Z", - "updated_at": "2022-09-22T12:40:58.626Z", - "name": "Order more than $100 USD", - "banner": "Order more than $100 USD", - "action": { - "discount": { - "type": "PERCENT", - "percent_off": 25, - "effect": "APPLY_TO_ORDER" + { + "title": "Export Publications", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "publication" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportPublicationOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportPublicationFields" + } + }, + "filters": { + "$ref": "#/components/schemas/ExportPublicationFilters", + "description": "Filter conditions." } }, - "metadata": { - "level": "A-21" + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object" + ] + }, + { + "title": "Export Order", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "order" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportOrderOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportOrderFields" + } + }, + "filters": { + "$ref": "#/components/schemas/ExportOrderFilters", + "description": "Filter conditions." + } }, - "hierarchy": 1, - "campaign": { - "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": true, - "object": "campaign" - }, - "campaign_id": null, - "active": false, - "start_date": "2022-09-22T00:00:00.000Z", - "expiration_date": "2022-09-29T00:00:00.000Z", - "validity_timeframe": { - "interval": "P3D", - "duration": "P2D" - }, - "validity_day_of_week": [ - 1, - 2, - 3 + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object" + ] + }, + { + "title": "Export Points Expirations", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "points_expiration" ], - "summary": { - "redemptions": { - "total_redeemed": 0 + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportPointsExpirationOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportPointsExpirationFields" + } }, - "orders": { - "total_amount": 0, - "total_discount_amount": 0 + "filters": { + "$ref": "#/components/schemas/ExportPointsExpirationFilters", + "description": "Filter conditions." } }, - "object": "promotion_tier", - "validation_rule_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_8e3e53ZgDNcoRGAI", - "rule_id": "val_q8qUBMOh5qIQ", - "related_object_id": "promo_hINAfBAVhmFuSAzi3vptfyxW", - "related_object_type": "promotion_tier", - "created_at": "2022-09-22T12:40:23.286Z", - "object": "validation_rules_assignment" + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object" + ] + }, + { + "title": "Export Vouchers Transactions Expiration", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "voucher_transactions" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportVoucherTransactionsOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportVoucherTransactionsFields" } - ], - "total": 1 - } + }, + "filters": { + "$ref": "#/components/schemas/ExportVoucherTransactionsFilters", + "description": "Filter conditions." + } + }, + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object" + ] + } + ], + "type": "object" + }, + "ExportBase": { + "title": "Export Base", + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "type": "string", + "description": "Unique export ID." + }, + "object": { + "type": "string", + "enum": [ + "export" + ], + "description": "The type of object being represented. This object stores information about the export." + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format." + }, + "status": { + "enum": [ + "SCHEDULED", + "IN_PROGRESS", + "DONE", + "ERROR" + ], + "type": "string", + "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated." + }, + "channel": { + "type": "string", + "description": "The channel through which the export was triggered." + }, + "result": { + "type": [ + "object", + "null" + ], + "required": [ + "url" + ], + "description": "Contains the URL of the CSV file.", + "properties": { + "url": { + "type": "string", + "description": "URL of the CSV file location. It contains the token used for authorization in the Download export method." } } + }, + "user_id": { + "type": [ + "string", + "null" + ], + "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE." } - } - } - } - } - }, - "delete": { - "operationId": "delete-promotion-tier", - "tags": [ - "PROMOTIONS API" - ], - "summary": "Delete Promotion Tier", - "description": "This method deletes a promotion tier.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." - }, - "404": { - "description": "Returns an error indicating that the promotion tier with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + }, + "required": [ + "id", + "object", + "created_at", + "status", + "result", + "user_id" + ] + }, + "Export": { + "title": "Export", + "allOf": [ + { + "$ref": "#/components/schemas/ExportBase" }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find promotion_tier with id promo_2EnAik6Jt7dKTOMkRTIgEjZ", - "request_id": "v-0ae284707e9027a79d", - "resource_id": "promo_2EnAik6Jt7dKTOMkRTIgEjZ", - "resource_type": "promotion_tier" + { + "anyOf": [ + { + "$ref": "#/components/schemas/ExportVoucher" + }, + { + "$ref": "#/components/schemas/ExportRedemption" + }, + { + "$ref": "#/components/schemas/ExportCustomer" + }, + { + "$ref": "#/components/schemas/ExportPublication" + }, + { + "$ref": "#/components/schemas/ExportOrder" + }, + { + "$ref": "#/components/schemas/ExportPointsExpiration" + }, + { + "$ref": "#/components/schemas/ExportVoucherTransactionsExpiration" + } + ] + } + ] + }, + "ExportsCreateResponseBody": { + "allOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique export ID." + }, + "object": { + "type": "string", + "enum": [ + "export" + ], + "description": "The type of object being represented. This object stores information about the export." + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format." + }, + "status": { + "type": "string", + "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.", + "enum": [ + "SCHEDULED" + ] + }, + "channel": { + "type": "string", + "description": "The channel through which the export was triggered." + }, + "result": { + "type": "null", + "description": "Contains the URL of the CSV file." + }, + "user_id": { + "type": "string", + "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE." } - } - } - } - } - } - } - } - }, - "/v1/promotions/tiers/{promotionTierId}/enable": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" - }, - "name": "promotionTierId", - "in": "path", - "required": true, - "description": "Unique promotion tier ID." - } - ], - "post": { - "operationId": "enable-promotion-tier", - "tags": [ - "PROMOTIONS API" - ], - "summary": "Enable Promotion Tier", - "description": "This method enables a promotion tier, i.e. makes the `active` parameter = `true`.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns the promotion tier object with an updated `active` parameter.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_obj_promotion_tier_object" + }, + "required": [ + "id", + "object", + "created_at", + "status", + "result", + "user_id" + ] }, - "examples": { - "Example": { - "value": { - "id": "promo_NzjTc3ZXTe7md5SziK3uYtei", - "created_at": "2022-09-21T11:38:34.962Z", - "updated_at": "2022-09-22T10:32:07.712Z", - "name": "Order more than $100", - "banner": "Order more than $100", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 3000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "hierarchy": 1, - "campaign": { - "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": true, - "object": "campaign" - }, - "campaign_id": null, - "active": true, - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "summary": { - "redemptions": { - "total_redeemed": 2 - }, - "orders": { - "total_amount": 37650, - "total_discount_amount": 6000 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": null + { + "anyOf": [ + { + "$ref": "#/components/schemas/ExportVoucher" + }, + { + "$ref": "#/components/schemas/ExportRedemption" + }, + { + "$ref": "#/components/schemas/ExportCustomer" + }, + { + "$ref": "#/components/schemas/ExportPublication" + }, + { + "$ref": "#/components/schemas/ExportOrder" + }, + { + "$ref": "#/components/schemas/ExportPointsExpiration" + }, + { + "$ref": "#/components/schemas/ExportVoucherTransactionsExpiration" } - } + ] } - } - } - }, - "404": { - "description": "Returns an error if the promotion tier cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + ], + "title": "" + }, + "ExportVoucher": { + "title": "Export Vouchers", + "type": "object", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "voucher" + ], + "description": "The type of object to be exported." }, - "examples": { - "Example": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find promotion_tier with id promo_NzjTc3ZXTe7md5SziK3uYte", - "request_id": "v-0bbaea52be14cc9782", - "resource_id": "promo_NzjTc3ZXTe7md5SziK3uYte", - "resource_type": "promotion_tier" + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportVoucherOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportVoucherFields" + } + }, + "filters": { + "$ref": "#/components/schemas/ExportVoucherFilters", + "description": "Filter conditions." } } } + }, + "required": [ + "exported_object", + "parameters" + ] + }, + "FieldConditions": { + "title": "Field Conditions", + "type": "object", + "properties": { + "conditions": { + "$ref": "#/components/schemas/FiltersCondition", + "description": "Data filters used to narrow the data records to be returned in the result." + } } - } - } - } - } - }, - "/v1/promotions/tiers/{promotionTierId}/disable": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" - }, - "name": "promotionTierId", - "in": "path", - "required": true, - "description": "Unique promotion tier ID." - } - ], - "post": { - "operationId": "disable-promotion-tier", - "tags": [ - "PROMOTIONS API" - ], - "summary": "Disable Promotion Tier", - "description": "This method disables a promotion tier, i.e. makes the `active` parameter = `false`.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns the promotion tier object with an updated `active` parameter.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_obj_promotion_tier_object" + }, + "FiltersCondition": { + "title": "Filters Condition", + "type": "object", + "properties": { + "$in": { + "$ref": "#/components/schemas/Any" }, - "examples": { - "Example": { - "value": { - "id": "promo_NzjTc3ZXTe7md5SziK3uYtei", - "created_at": "2022-09-21T11:38:34.962Z", - "updated_at": "2022-09-22T10:34:09.529Z", - "name": "Order more than $100", - "banner": "Order more than $100", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 3000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "hierarchy": 1, - "campaign": { - "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": true, - "object": "campaign" - }, - "campaign_id": null, - "active": false, - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "summary": { - "redemptions": { - "total_redeemed": 2 - }, - "orders": { - "total_amount": 37650, - "total_discount_amount": 6000 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": null - } - } + "$not_in": { + "$ref": "#/components/schemas/Any" + }, + "$is": { + "$ref": "#/components/schemas/Any" + }, + "$is_days_ago": { + "$ref": "#/components/schemas/Any" + }, + "$is_days_in_future": { + "$ref": "#/components/schemas/Any" + }, + "$is_not": { + "$ref": "#/components/schemas/Any" + }, + "$has_value": { + "$ref": "#/components/schemas/Any" + }, + "$is_unknown": { + "$ref": "#/components/schemas/Any" + }, + "$contains": { + "$ref": "#/components/schemas/Any" + }, + "$not_contain": { + "$ref": "#/components/schemas/Any" + }, + "$starts_with": { + "$ref": "#/components/schemas/Any" + }, + "$ends_with": { + "$ref": "#/components/schemas/Any" + }, + "$more_than": { + "$ref": "#/components/schemas/Any" + }, + "$less_than": { + "$ref": "#/components/schemas/Any" + }, + "$more_than_ago": { + "$ref": "#/components/schemas/Any" + }, + "$less_than_ago": { + "$ref": "#/components/schemas/Any" + }, + "$more_than_future": { + "$ref": "#/components/schemas/Any" + }, + "$less_than_future": { + "$ref": "#/components/schemas/Any" + }, + "$more_than_equal": { + "$ref": "#/components/schemas/Any" + }, + "$less_than_equal": { + "$ref": "#/components/schemas/Any" + }, + "$after": { + "$ref": "#/components/schemas/Any" + }, + "$before": { + "$ref": "#/components/schemas/Any" + }, + "$count": { + "$ref": "#/components/schemas/Any" + }, + "$count_less": { + "$ref": "#/components/schemas/Any" + }, + "$count_more": { + "$ref": "#/components/schemas/Any" } } - } - }, - "404": { - "description": "Returns an error if the promotion tier cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + }, + "ExportVoucherFilters": { + "title": "Export Voucher Filters", + "type": "object", + "properties": { + "junction": { + "$ref": "#/components/schemas/Junction", + "description": "Filter by conditions set on the junction parameter indicating how the conditions should be accounted for in the query. An AND is an all-inclusive logical operator, meaning the AND operator displays a record if ALL the conditions separated by AND are TRUE, while an OR operator displays a record if ANY of the conditions separated by OR is TRUE." }, - "examples": { - "Example": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find promotion_tier with id promo_NzjTc3ZXTe7md5SziK3uYte", - "request_id": "v-0bbaea52be14cc9782", - "resource_id": "promo_NzjTc3ZXTe7md5SziK3uYte", - "resource_type": "promotion_tier" - } - } + "code": { + "$ref": "#/components/schemas/FieldConditions" + }, + "voucher_type": { + "$ref": "#/components/schemas/FieldConditions" + }, + "value": { + "$ref": "#/components/schemas/FieldConditions" + }, + "discount_type": { + "$ref": "#/components/schemas/FieldConditions" + }, + "campaign": { + "$ref": "#/components/schemas/FieldConditions" + }, + "category": { + "$ref": "#/components/schemas/FieldConditions" + }, + "start_date": { + "$ref": "#/components/schemas/FieldConditions" + }, + "expiration_date": { + "$ref": "#/components/schemas/FieldConditions" + }, + "gift_balance": { + "$ref": "#/components/schemas/FieldConditions" + }, + "loyalty_balance": { + "$ref": "#/components/schemas/FieldConditions" + }, + "redemption_quantity": { + "$ref": "#/components/schemas/FieldConditions" + }, + "redemption_count": { + "$ref": "#/components/schemas/FieldConditions" + }, + "active": { + "$ref": "#/components/schemas/FieldConditions" + }, + "qr_code": { + "$ref": "#/components/schemas/FieldConditions" + }, + "bar_code": { + "$ref": "#/components/schemas/FieldConditions" + }, + "metadata": { + "$ref": "#/components/schemas/FieldConditions" + }, + "id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "is_referral_code": { + "$ref": "#/components/schemas/FieldConditions" + }, + "created_at": { + "$ref": "#/components/schemas/FieldConditions" + }, + "updated_at": { + "$ref": "#/components/schemas/FieldConditions" + }, + "validity_timeframe_interval": { + "$ref": "#/components/schemas/FieldConditions" + }, + "validity_timeframe_duration": { + "$ref": "#/components/schemas/FieldConditions" + }, + "validity_day_of_week": { + "$ref": "#/components/schemas/FieldConditions" + }, + "discount_amount_limit": { + "$ref": "#/components/schemas/FieldConditions" + }, + "campaign_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "additional_info": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "discount_unit_type": { + "$ref": "#/components/schemas/FieldConditions" + }, + "discount_unit_effect": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_source_id": { + "$ref": "#/components/schemas/FieldConditions" } } - } - } - } - } - }, - "/v1/promotions/stacks": { - "get": { - "operationId": "list-all-promotion-stacks", - "tags": [ - "PROMOTIONS API" - ], - "summary": "List Promotion Stacks", - "description": "This method enables you to list promotion stacks irrespective of the campaign they are associated with. \n\nYou can use filters in the query parameters to specify the stacks to be returned in the response.\n\n## Advanced filters for fetching promotion stacks\n\n| **Filters** | **Examples** |\n| :--- | :--- |\n| Created Before | - `[created_at][before]=2021-12-30T13:52:18.227Z`
- `[filters][created_at][conditions][$before][0]=2021-12-30T13:52:18.227Z` |\n| Created After | - `[created_at][after]=2021-12-30T13:52:18.227Z`
- `[filters][created_at][conditions][$after][0]=2021-12-30T13:52:18.227Z` |\n| Updated Before | - `[updated_at][before]=2021-12-30T13:52:18.227Z`
- `[filters][updated_at][conditions][$before][0]=2021-12-30T13:52:18.227Z` |\n| Updated After | - `[updated_at][after]=2021-12-30T13:52:18.227Z`
- `[filters][updated_at][conditions][$after][0]=2021-12-30T13:52:18.227Z` |", - "parameters": [ - { - "schema": { - "type": "integer" }, - "in": "query", - "name": "limit", - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." - }, - { - "schema": { + "Junction": { + "title": "Junction", + "enum": [ + "and", + "AND", + "or", + "OR" + ], "type": "string" }, - "in": "query", - "description": "Which page of results to return.", - "name": "page" - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at", - "name", - "-name" + "ExportRedemption": { + "title": "Export Redemptions", + "type": "object", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "redemption" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportRedemptionOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportRedemptionFields" + } + }, + "filters": { + "$ref": "#/components/schemas/ExportRedemptionFilters", + "description": "Filter conditions." + } + }, + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object", + "parameters" ] }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." - }, - { - "$ref": "#/components/parameters/created_at" - }, - { - "$ref": "#/components/parameters/updated_at" - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary with a `data` property that contains an array of promotion stacks across all your campaigns.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_res_list_promotion_stacks" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "stack_SLuhQrAt3mXwHg776lYkzZO8", - "name": "Stack 2", - "created_at": "2022-11-03T10:18:58.356Z", - "campaign_id": "camp_h8RyP6FV94F3Ev2odP24j5p1", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_Mfww2TuoeU23enqSmnz0f3rh", - "promo_vU5IHaLKS7mmZ3ylABET6ikb", - "promo_TeHA11JlfN29mUftDcpqIWWq", - "promo_bhKBsIX3tO7yqmpTLCLLuaud" - ], - "hierarchy_mode": "MANUAL" - } - }, - { - "id": "stack_twQWp1TyaxX5RlSqn061xGVy", - "name": "First stack", - "created_at": "2021-12-27T11:59:21.838Z", - "updated_at": "2022-12-16T08:22:51.970Z", - "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_Vet0vCNyyo5pOddHfu2X3FCB", - "promo_PoIyRVFA5c0Jk514xCpzKHga", - "promo_Mwy9XpA0TLctSGriM5kum0qp" - ], - "hierarchy_mode": "MANUAL" - } - }, - { - "id": "stack_vhCqN5PY7rmPw8yACRvHRZaz", - "name": "Second stack", - "created_at": "2021-12-27T11:55:47.431Z", - "updated_at": "2022-12-16T08:22:52.221Z", - "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_Vet0vCNyyo5pOddHfu2X3FCB", - "promo_PoIyRVFA5c0Jk514xCpzKHga", - "promo_Mwy9XpA0TLctSGriM5kum0qp" - ], - "hierarchy_mode": "MANUAL" - } - }, - { - "id": "stack_zwChew7GY1AnDZJQ6GVP2sdT", - "name": "Third stack", - "created_at": "2021-12-27T11:54:26.283Z", - "updated_at": "2022-12-16T08:22:52.483Z", - "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_Vet0vCNyyo5pOddHfu2X3FCB", - "promo_Mwy9XpA0TLctSGriM5kum0qp", - "promo_PoIyRVFA5c0Jk514xCpzKHga" - ], - "hierarchy_mode": "MANUAL" - } - }, - { - "id": "stack_NS5hEUznL9XPa89rbrOZYMey", - "name": "Fourth stack", - "created_at": "2021-12-27T11:48:43.982Z", - "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_Vet0vCNyyo5pOddHfu2X3FCB", - "promo_Mwy9XpA0TLctSGriM5kum0qp", - "promo_PoIyRVFA5c0Jk514xCpzKHga" - ], - "hierarchy_mode": "MANUAL" - } - }, - { - "id": "stack_Rz0NvFtCZOObS3J5R68KET17", - "name": "Third stack", - "created_at": "2021-12-27T11:40:57.426Z", - "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_Vet0vCNyyo5pOddHfu2X3FCB", - "promo_PoIyRVFA5c0Jk514xCpzKHga" - ], - "hierarchy_mode": "MANUAL" - } - }, - { - "id": "stack_e8pH0nIuANmYRPE0x8hwDrpm", - "name": "Second stack", - "created_at": "2021-12-27T08:43:13.875Z", - "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_Mwy9XpA0TLctSGriM5kum0qp", - "promo_PoIyRVFA5c0Jk514xCpzKHga" - ], - "hierarchy_mode": "MANUAL" - } - }, - { - "id": "stack_3Q4EJpZqg3DI5IRwgBYfsb37", - "name": "First stack", - "created_at": "2021-12-27T08:43:13.498Z", - "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_Vet0vCNyyo5pOddHfu2X3FCB", - "promo_PoIyRVFA5c0Jk514xCpzKHga" - ], - "hierarchy_mode": "MANUAL" - } - }, - { - "id": "stack_KxSD0GahLUg9ULB6TseGfUHJ", - "name": "Stack 1", - "created_at": "2021-12-23T12:28:38.881Z", - "campaign_id": "camp_h8RyP6FV94F3Ev2odP24j5p1", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_NMex647s5UushvbBUJmYT2Fc", - "promo_4TqHr24boFISDrcOHSlfAxwm" - ], - "hierarchy_mode": "MANUAL" - } - } - ], - "total": 9 - } - } + "ExportRedemptionFilters": { + "title": "Export Redemption Filters", + "type": "object", + "additionalProperties": false, + "properties": { + "junction": { + "$ref": "#/components/schemas/Junction" + }, + "id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "object": { + "$ref": "#/components/schemas/FieldConditions" + }, + "date": { + "$ref": "#/components/schemas/FieldConditions" + }, + "voucher_code": { + "$ref": "#/components/schemas/FieldConditions" + }, + "campaign": { + "$ref": "#/components/schemas/FieldConditions" + }, + "promotion_tier_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_source_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_name": { + "$ref": "#/components/schemas/FieldConditions" + }, + "tracking_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "order_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "gift_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "loyalty_points": { + "$ref": "#/components/schemas/FieldConditions" + }, + "result": { + "$ref": "#/components/schemas/FieldConditions" + }, + "failure_code": { + "$ref": "#/components/schemas/FieldConditions" + }, + "failure_message": { + "$ref": "#/components/schemas/FieldConditions" + }, + "metadata": { + "$ref": "#/components/schemas/FieldConditions" } } - } - } - } - } - }, - "/v1/promotions/{campaignId}/stacks": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID." - } - ], - "get": { - "operationId": "list-promotion-stacks-in-campaign", - "tags": [ - "PROMOTIONS API" - ], - "summary": "List Promotion Stacks in Campaign", - "description": "This method enables you to list promotion stacks from a specified campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a list of promotion stack objects.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_res_list_promotion_stacks" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "stack_p0WhtyyDU95crobleMpRabhH", - "name": "First stack", - "created_at": "2022-09-22T13:03:25.740Z", - "campaign_id": "camp_99HUWI53bVyLzPN1Fg5TBLWX", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_dJNhAEeV5sR5oPQq1UrUdnMC", - "promo_aaAF8mVAzA0PF1igia2OC63d" - ], - "hierarchy_mode": "MANUAL" - } - }, - { - "id": "stack_XAzn8AFR3Ks3DBPLAQxV7zHe", - "name": "Second stack", - "created_at": "2022-09-22T13:03:25.903Z", - "campaign_id": "camp_99HUWI53bVyLzPN1Fg5TBLWX", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_aaAF8mVAzA0PF1igia2OC63d", - "promo_dJNhAEeV5sR5oPQq1UrUdnMC" - ], - "hierarchy_mode": "MANUAL" - } - } - ], - "total": 2 + }, + "ExportCustomer": { + "title": "Export Customers", + "type": "object", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "customer" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportCustomerOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportCustomerFields" + } + }, + "filters": { + "$ref": "#/components/schemas/ExportCustomerFilters", + "description": "Filter conditions." } - } + }, + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." } - } - } - } - } - }, - "post": { - "operationId": "create-promotion-stack", - "tags": [ - "PROMOTIONS API" - ], - "summary": "Create Promotion Stack", - "description": "This method creates one promotion stack. The sequence of promotion tier IDs will determine the promotion stacking order.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the order of promotion tiers for the promotion stack.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_req_create_promotion_stack" }, - "examples": { - "Example": { - "value": { - "name": "Fifth Stack", - "tiers": { - "ids": [ - "promo_aaAF8mVAzA0PF1igia2OC63d", - "promo_t9zdL6XMFk7B8fQ23zxELtdE", - "promo_dJNhAEeV5sR5oPQq1UrUdnMC" - ], - "hierarchy_mode": "MANUAL" - } - } + "required": [ + "exported_object", + "parameters" + ] + }, + "ExportCustomerFilters": { + "title": "Export Customer Filters", + "type": "object", + "properties": { + "junction": { + "$ref": "#/components/schemas/Junction" + }, + "name": { + "$ref": "#/components/schemas/FieldConditions" + }, + "id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "description": { + "$ref": "#/components/schemas/FieldConditions" + }, + "email": { + "$ref": "#/components/schemas/FieldConditions" + }, + "source_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "created_at": { + "$ref": "#/components/schemas/FieldConditions" + }, + "address_city": { + "$ref": "#/components/schemas/FieldConditions" + }, + "address_state": { + "$ref": "#/components/schemas/FieldConditions" + }, + "address_line_1": { + "$ref": "#/components/schemas/FieldConditions" + }, + "address_line_2": { + "$ref": "#/components/schemas/FieldConditions" + }, + "address_country": { + "$ref": "#/components/schemas/FieldConditions" + }, + "address_postal_code": { + "$ref": "#/components/schemas/FieldConditions" + }, + "redemptions_total_redeemed": { + "$ref": "#/components/schemas/FieldConditions" + }, + "redemptions_total_failed": { + "$ref": "#/components/schemas/FieldConditions" + }, + "redemptions_total_succeeded": { + "$ref": "#/components/schemas/FieldConditions" + }, + "redemptions_total_rolled_back": { + "$ref": "#/components/schemas/FieldConditions" + }, + "redemptions_total_rollback_failed": { + "$ref": "#/components/schemas/FieldConditions" + }, + "redemptions_total_rollback_succeeded": { + "$ref": "#/components/schemas/FieldConditions" + }, + "orders_total_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "orders_total_count": { + "$ref": "#/components/schemas/FieldConditions" + }, + "orders_average_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "orders_last_order_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "orders_last_order_date": { + "$ref": "#/components/schemas/FieldConditions" + }, + "loyalty_points": { + "$ref": "#/components/schemas/FieldConditions" + }, + "loyalty_referred_customers": { + "$ref": "#/components/schemas/FieldConditions" + }, + "updated_at": { + "$ref": "#/components/schemas/FieldConditions" + }, + "phone": { + "$ref": "#/components/schemas/FieldConditions" + }, + "birthday": { + "$ref": "#/components/schemas/FieldConditions" + }, + "metadata": { + "$ref": "#/components/schemas/FieldConditions" + }, + "birthdate": { + "$ref": "#/components/schemas/FieldConditions" } } - } - } - }, - "responses": { - "200": { - "description": "Returns a new stack object if a valid promotion campaign identifier was provided in the path and available promotion IDs in the payload.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_obj_promotion_stack_object" - }, - "examples": { - "Example": { - "value": { - "id": "stack_q2AmzFvOMCmg4Wdu5bDBlME6", - "name": "Fifth Stack", - "created_at": "2022-09-23T07:44:53.888Z", - "campaign_id": "camp_99HUWI53bVyLzPN1Fg5TBLWX", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_aaAF8mVAzA0PF1igia2OC63d", - "promo_t9zdL6XMFk7B8fQ23zxELtdE", - "promo_dJNhAEeV5sR5oPQq1UrUdnMC" - ], - "hierarchy_mode": "MANUAL" + }, + "ExportPublication": { + "title": "Export Publications", + "type": "object", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "publication" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportPublicationOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportPublicationFields" } - } - } - } - } - } - }, - "404": { - "description": "Returns an error if the campaign or promotion tier cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Campaign Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id camp_99HUWI53bVyLzPN1Fg5TBLW", - "request_id": "v-0bbc10de5886137afd", - "resource_id": "camp_99HUWI53bVyLzPN1Fg5TBLW", - "resource_type": "campaign" + }, + "filters": { + "$ref": "#/components/schemas/ExportPublicationFilters", + "description": "Filter conditions." } }, - "Promotion Tier Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find promotion_tier with id promo_dJNhAEeV5sR5oPQq1UrUdnM", - "request_id": "v-0bbc11186303fa288a", - "resource_id": "promo_dJNhAEeV5sR5oPQq1UrUdnM", - "resource_type": "promotion_tier" - } - } + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object", + "parameters" + ] + }, + "ExportPublicationFilters": { + "title": "Export Publication Filters", + "type": "object", + "properties": { + "junction": { + "$ref": "#/components/schemas/Junction" + }, + "voucher_code": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_source_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "date": { + "$ref": "#/components/schemas/FieldConditions" + }, + "channel": { + "$ref": "#/components/schemas/FieldConditions" + }, + "campaign": { + "$ref": "#/components/schemas/FieldConditions" + }, + "is_winner": { + "$ref": "#/components/schemas/FieldConditions" + }, + "metadata": { + "$ref": "#/components/schemas/FieldConditions" } } - } - } - } - } - }, - "/v1/promotions/{campaignId}/stacks/{stackId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty Campaign`. " - }, - { - "schema": { - "type": "string", - "example": "stack_KOIde7AUf08at12lZ1r3OfFL" - }, - "name": "stackId", - "in": "path", - "required": true, - "description": "Promotion stack ID." - } - ], - "get": { - "operationId": "get-promotion-stack", - "tags": [ - "PROMOTIONS API" - ], - "summary": "Get Promotion Stack", - "description": "This method returns the details of a promotion stack, including the promotion tiers grouped within the stack.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a stack object if valid identifiers were provided in the path.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_obj_promotion_stack_object" - }, - "examples": { - "Example": { - "value": { - "id": "stack_p0WhtyyDU95crobleMpRabhH", - "name": "First stack", - "created_at": "2022-09-22T13:03:25.740Z", - "campaign_id": "camp_99HUWI53bVyLzPN1Fg5TBLWX", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_dJNhAEeV5sR5oPQq1UrUdnMC", - "promo_aaAF8mVAzA0PF1igia2OC63d" - ], - "hierarchy_mode": "MANUAL" + }, + "ExportOrder": { + "title": "Export Orders", + "type": "object", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "order" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportOrderOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportOrderFields" } + }, + "filters": { + "$ref": "#/components/schemas/ExportOrderFilters", + "description": "Filter conditions." } - } + }, + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object", + "parameters" + ] + }, + "ExportOrderFilters": { + "title": "Export Order Filters", + "type": "object", + "additionalProperties": false, + "properties": { + "junction": { + "$ref": "#/components/schemas/Junction" + }, + "id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "source_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "created_at": { + "$ref": "#/components/schemas/FieldConditions" + }, + "updated_at": { + "$ref": "#/components/schemas/FieldConditions" + }, + "status": { + "$ref": "#/components/schemas/FieldConditions" + }, + "amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "discount_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "items_discount_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "total_discount_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "total_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "referrer_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "metadata": { + "$ref": "#/components/schemas/FieldConditions" } } - } - }, - "404": { - "description": "Returns an error if the campaign or promotion stack cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Stack Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find promotion_stack with id stack_p0WhtyyDU95crobleMpRabh", - "request_id": "v-0bbc0a659591f99d65", - "resource_id": "stack_p0WhtyyDU95crobleMpRabh", - "resource_type": "promotion_stack" + }, + "ExportPointsExpiration": { + "title": "Export Points Expirations", + "type": "object", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "points_expiration" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportPointsExpirationOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportPointsExpirationFields" + } + }, + "filters": { + "$ref": "#/components/schemas/ExportPointsExpirationFilters", + "description": "Filter conditions." } }, - "Campaign Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id camp_99HUWI53bVyLzPN1Fg5TBLW", - "request_id": "v-0bbc0aa77a0c8b78e8", - "resource_id": "camp_99HUWI53bVyLzPN1Fg5TBLW", - "resource_type": "campaign" - } - } + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." } - } - } - } - } - }, - "put": { - "operationId": "update-promotion-stack", - "tags": [ - "PROMOTIONS API" - ], - "summary": "Update Promotion Stack", - "description": "This methods allows for editing an existing stack.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the promotion stack parameters that you would like to update.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_req_create_promotion_stack" }, - "examples": { - "Example": { - "value": { - "name": "Fifth Stack Modified", - "tiers": { - "ids": [ - "promo_aaAF8mVAzA0PF1igia2OC63d", - "promo_t9zdL6XMFk7B8fQ23zxELtdE" - ], - "hierarchy_mode": "MANUAL" - } - } + "required": [ + "exported_object", + "parameters" + ] + }, + "ExportPointsExpirationFilters": { + "title": "Export Points Expiration Filters", + "type": "object", + "properties": { + "junction": { + "$ref": "#/components/schemas/Junction" + }, + "id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "campaign_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "voucher_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "points": { + "$ref": "#/components/schemas/FieldConditions" + }, + "status": { + "$ref": "#/components/schemas/FieldConditions" + }, + "expires_at": { + "$ref": "#/components/schemas/FieldConditions" } } - } - } - }, - "responses": { - "200": { - "description": "Returns a promotion stack with updated parameters if the update was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_obj_promotion_stack_object" - }, - "examples": { - "Example": { - "value": { - "id": "stack_q2AmzFvOMCmg4Wdu5bDBlME6", - "name": "Fifth Stack Modified", - "created_at": "2022-09-23T07:44:53.888Z", - "updated_at": "2022-09-23T07:59:44.172Z", - "campaign_id": "camp_99HUWI53bVyLzPN1Fg5TBLWX", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_aaAF8mVAzA0PF1igia2OC63d", - "promo_t9zdL6XMFk7B8fQ23zxELtdE" - ], - "hierarchy_mode": "MANUAL" + }, + "ExportVoucherTransactionsExpiration": { + "title": "Export Vouchers Transactions Expiration", + "type": "object", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "voucher_transactions" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportVoucherTransactionsOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportVoucherTransactionsFields" } - } - } - } - } - } - } - } - }, - "delete": { - "operationId": "delete-promotion-stack", - "tags": [ - "PROMOTIONS API" - ], - "summary": "Delete Promotion Stack", - "description": "This method deletes a promotion stack.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." - }, - "404": { - "description": "Returns an error indicating that the stack or campaign with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Stack Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find promotion_stack with id stack_KOIde7AUf08at12lZ1r3OfFp", - "request_id": "v-0ae289ca779027b030", - "resource_id": "stack_KOIde7AUf08at12lZ1r3OfFp", - "resource_type": "promotion_stack" + }, + "filters": { + "$ref": "#/components/schemas/ExportVoucherTransactionsFilters", + "description": "Filter conditions." } }, - "Campaign Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id Summer % Promotion", - "request_id": "v-0ae28a621c46af534b", - "resource_id": "Summer % Promotion", - "resource_type": "campaign" - } - } - } - } - } - } - } - } - }, - "/v1/reward-object": { - "get": { - "operationId": "reward-object", - "tags": [ - "REWARDS API" - ], - "summary": "Reward Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Reward object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_obj_reward_object" + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." } - } - } - } - } - } - }, - "/v1/reward-assignment-object": { - "get": { - "operationId": "reward-assignment-object", - "tags": [ - "REWARDS API" - ], - "summary": "Reward Assignment Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Reward Assignment Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" + }, + "required": [ + "exported_object", + "parameters" + ] + }, + "ExportVoucherTransactionsFilters": { + "title": "Export Voucher Transactions Filters", + "type": "object", + "properties": { + "junction": { + "$ref": "#/components/schemas/Junction" + }, + "id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "campaign_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "voucher_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "type": { + "$ref": "#/components/schemas/FieldConditions" + }, + "source_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "reason": { + "$ref": "#/components/schemas/FieldConditions" + }, + "source": { + "$ref": "#/components/schemas/FieldConditions" + }, + "balance": { + "$ref": "#/components/schemas/FieldConditions" + }, + "amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "related_transaction_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "created_at": { + "$ref": "#/components/schemas/FieldConditions" + }, + "details": { + "$ref": "#/components/schemas/FieldConditions" } } - } - } - } - } - }, - "/v1/rewards": { - "get": { - "operationId": "list-rewards", - "tags": [ - "REWARDS API" - ], - "summary": "List Rewards", - "description": "Retrieve rewards.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "schema": { - "type": "string", - "example": "rewa_m9hEAu10KsPcLhGXiHG85aY0" }, - "in": "query", - "name": "assignment_id", - "description": "A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary of reward objects.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_res_list_rewards" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "rew_3e7IqghVtTR7L3xQMSCxjFu2", - "name": "Get $10", - "type": "CAMPAIGN", - "parameters": { - "campaign": { - "id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "balance": 1000, - "type": "GIFT_VOUCHERS" - } - }, - "stock": null, - "redeemed": null, - "attributes": {}, - "created_at": "2022-03-10T08:40:20.917Z", - "updated_at": "2022-08-17T07:52:56.965Z", - "metadata": null, - "object": "reward" - }, - { - "id": "rew_nIy4gHpQHle2c3pNMwuj7G6j", - "name": "Get 100 Points", - "type": "CAMPAIGN", - "parameters": { - "campaign": { - "id": "camp_E87CubZLZ8eoQt3c4kAEZsx0", - "balance": 100, - "type": "LOYALTY_PROGRAM" - } - }, - "stock": null, - "redeemed": null, - "attributes": {}, - "created_at": "2022-02-28T11:56:13.764Z", - "updated_at": null, - "metadata": null, - "object": "reward" - }, - { - "id": "rew_BNZ3van6AF2AiquWp8Lfw0xq", - "name": "30% discount", - "type": "CAMPAIGN", - "parameters": { - "campaign": { - "id": "camp_ZtHLATYVpItqmuSqmaz1rZ2Y", - "type": "DISCOUNT_COUPONS" - } - }, - "stock": null, - "redeemed": null, - "attributes": {}, - "created_at": "2022-08-11T09:48:50.609Z", - "updated_at": null, - "metadata": {}, - "object": "reward" - }, - { - "id": "rew_nlV8bgWU1jNO9YWQ7CdZmzq7", - "name": "1 point = $0.01", - "type": "COIN", - "parameters": { - "coin": { - "exchange_ratio": 0.01, - "points_ratio": 1 - } - }, - "stock": null, - "redeemed": null, - "attributes": {}, - "created_at": "2022-08-11T16:45:21.582Z", - "updated_at": null, - "metadata": { - "Type": "0.01" - }, - "object": "reward" - }, - { - "id": "rew_x6FmF1KFdDs06hYPr9lK6ajf", - "name": "Material Reward", - "type": "MATERIAL", - "parameters": { - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619" - } - }, - "stock": "4", - "redeemed": "1", - "attributes": { - "image_url": "https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_wJHdZUAVSpWtYM6ORq4up3I2.png", - "description": "Get a Comic Book in Archie's series." - }, - "created_at": "2022-08-17T07:13:32.781Z", - "updated_at": null, - "metadata": { - "Type": "Personal" - }, - "object": "reward" - } - ], - "total": 5 - } + "ExportsGetResponseBody": { + "$ref": "#/components/schemas/Export", + "title": "" + }, + "ExportsListResponseBody": { + "title": "Exports List Response Body", + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object represented by JSON. This object stores information about exports." + }, + "data_ref": { + "type": "string", + "enum": [ + "exports" + ], + "description": "Identifies the name of the attribute that contains the array of exports." + }, + "exports": { + "type": "array", + "description": "An array of export objects.", + "items": { + "$ref": "#/components/schemas/Export" } + }, + "total": { + "type": "integer", + "description": "Total number of exports." } - } - } - } - } - }, - "post": { - "operationId": "create-reward", - "tags": [ - "REWARDS API" - ], - "summary": "Create Reward", - "description": "Create a new reward.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Define parameters of the new reward.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_req_create_reward" }, - "examples": { - "Gift card credits": { - "value": { - "name": "Digital - Gift Card Reward", - "type": "CAMPAIGN", - "metadata": { - "Type": "Gift" - }, - "parameters": { - "campaign": { - "id": "camp_hC2GdqYtOmTT45zfhib62cK1", - "balance": 3000 - } - } - } - }, - "Discount Coupon": { - "value": { - "name": "Digital - Discount Coupon", - "type": "CAMPAIGN", - "metadata": { - "Type": "Discount" - }, - "parameters": { - "campaign": { - "id": "camp_hC2GdqYtOmTT45zfhib62cK1" + "required": [ + "object", + "data_ref", + "exports", + "total" + ] + }, + "ExportCustomerFields": { + "type": "string", + "enum": [ + "name", + "id", + "description", + "email", + "source_id", + "created_at", + "address_city", + "address_state", + "address_line_1", + "address_line_2", + "address_country", + "address_postal_code", + "redemptions_total_redeemed", + "redemptions_total_failed", + "redemptions_total_succeeded", + "redemptions_total_rolled_back", + "redemptions_total_rollback_failed", + "redemptions_total_rollback_succeeded", + "orders_total_amount", + "orders_total_count", + "orders_average_amount", + "orders_last_order_amount", + "orders_last_order_date", + "loyalty_points", + "loyalty_referred_customers", + "updated_at", + "phone", + "birthday", + "metadata", + "birthdate" + ], + "title": "Export Customer Fields" + }, + "ExportCustomerOrder": { + "title": "Export Customer Order", + "type": "string", + "enum": [ + "name", + "-name", + "id", + "-id", + "description", + "-description", + "email", + "-email", + "source_id", + "-source_id", + "created_at", + "-created_at", + "address_city", + "-address_city", + "address_state", + "-address_state", + "address_line_1", + "-address_line_1", + "address_line_2", + "-address_line_2", + "address_country", + "-address_country", + "address_postal_code", + "-address_postal_code", + "redemptions_total_redeemed", + "-redemptions_total_redeemed", + "redemptions_total_failed", + "-redemptions_total_failed", + "redemptions_total_succeeded", + "-redemptions_total_succeeded", + "redemptions_total_rolled_back", + "-redemptions_total_rolled_back", + "redemptions_total_rollback_failed", + "-redemptions_total_rollback_failed", + "redemptions_total_rollback_succeeded", + "-redemptions_total_rollback_succeeded", + "orders_total_amount", + "-orders_total_amount", + "orders_total_count", + "-orders_total_count", + "orders_average_amount", + "-orders_average_amount", + "orders_last_order_amount", + "-orders_last_order_amount", + "orders_last_order_date", + "-orders_last_order_date", + "loyalty_points", + "-loyalty_points", + "loyalty_referred_customers", + "-loyalty_referred_customers", + "updated_at", + "-updated_at", + "phone", + "-phone", + "birthday", + "-birthday", + "metadata", + "-metadata", + "birthdate", + "-birthdate" + ] + }, + "ExportPublicationFields": { + "title": "Export Publication Fields", + "type": "string", + "enum": [ + "voucher_code", + "customer_id", + "customer_source_id", + "date", + "channel", + "campaign", + "is_winner", + "metadata" + ] + }, + "ExportPublicationOrder": { + "title": "Export Publication Order", + "type": "string", + "enum": [ + "voucher_code", + "-voucher_code", + "customer_id", + "-customer_id", + "customer_source_id", + "-customer_source_id", + "date", + "-date", + "channel", + "-channel", + "campaign", + "-campaign", + "is_winner", + "-is_winner", + "metadata", + "-metadata" + ] + }, + "ExportRedemptionFields": { + "title": "Export Redemption Fields", + "type": "string", + "enum": [ + "id", + "object", + "date", + "voucher_code", + "campaign", + "promotion_tier_id", + "customer_id", + "customer_source_id", + "customer_name", + "tracking_id", + "order_amount", + "gift_amount", + "loyalty_points", + "result", + "failure_code", + "failure_message", + "metadata" + ] + }, + "ExportRedemptionOrder": { + "title": "Export Redemption Order", + "type": "string", + "enum": [ + "id", + "-id", + "object", + "-object", + "date", + "-date", + "voucher_code", + "-voucher_code", + "campaign", + "-campaign", + "promotion_tier_id", + "-promotion_tier_id", + "customer_id", + "-customer_id", + "customer_source_id", + "-customer_source_id", + "customer_name", + "-customer_name", + "tracking_id", + "-tracking_id", + "order_amount", + "-order_amount", + "gift_amount", + "-gift_amount", + "loyalty_points", + "-loyalty_points", + "result", + "-result", + "failure_code", + "-failure_code", + "failure_message", + "-failure_message", + "metadata", + "-metadata" + ] + }, + "ExportVoucherFields": { + "title": "Export Voucher Fields", + "type": "string", + "enum": [ + "code", + "voucher_type", + "value", + "discount_type", + "campaign", + "category", + "start_date", + "expiration_date", + "gift_balance", + "loyalty_balance", + "redemption_quantity", + "redemption_count", + "active", + "qr_code", + "bar_code", + "metadata", + "id", + "is_referral_code", + "created_at", + "updated_at", + "validity_timeframe_interval", + "validity_timeframe_duration", + "validity_day_of_week", + "discount_amount_limit", + "campaign_id", + "additional_info", + "customer_id", + "discount_unit_type", + "discount_unit_effect", + "customer_source_id" + ] + }, + "ExportVoucherOrder": { + "title": "Export Voucher Order", + "type": "string", + "enum": [ + "code", + "-code", + "voucher_type", + "-voucher_type", + "value", + "-value", + "discount_type", + "-discount_type", + "campaign", + "-campaign", + "category", + "-category", + "start_date", + "-start_date", + "expiration_date", + "-expiration_date", + "gift_balance", + "-gift_balance", + "loyalty_balance", + "-loyalty_balance", + "redemption_quantity", + "-redemption_quantity", + "redemption_count", + "-redemption_count", + "active", + "-active", + "qr_code", + "-qr_code", + "bar_code", + "-bar_code", + "metadata", + "-metadata", + "id", + "-id", + "is_referral_code", + "-is_referral_code", + "created_at", + "-created_at", + "updated_at", + "-updated_at", + "validity_timeframe_interval", + "-validity_timeframe_interval", + "validity_timeframe_duration", + "-validity_timeframe_duration", + "validity_day_of_week", + "-validity_day_of_week", + "discount_amount_limit", + "-discount_amount_limit", + "campaign_id", + "-campaign_id", + "additional_info", + "-additional_info", + "customer_id", + "-customer_id", + "discount_unit_type", + "-discount_unit_type", + "discount_unit_effect", + "-discount_unit_effect", + "customer_source_id", + "-customer_source_id" + ] + }, + "ExportOrderFields": { + "title": "Export Order Fields", + "type": "string", + "enum": [ + "id", + "source_id", + "created_at", + "updated_at", + "status", + "amount", + "discount_amount", + "items_discount_amount", + "total_discount_amount", + "total_amount", + "customer_id", + "referrer_id", + "metadata" + ] + }, + "ExportOrderOrder": { + "title": "Export Order Order", + "type": "string", + "enum": [ + "id", + "-id", + "source_id", + "-source_id", + "created_at", + "-created_at", + "updated_at", + "-updated_at", + "status", + "-status", + "amount", + "-amount", + "discount_amount", + "-discount_amount", + "items_discount_amount", + "-items_discount_amount", + "total_discount_amount", + "-total_discount_amount", + "total_amount", + "-total_amount", + "customer_id", + "-customer_id", + "referrer_id", + "-referrer_id", + "metadata", + "-metadata" + ] + }, + "ExportPointsExpirationFields": { + "title": "Export Points Expiration Fields", + "type": "string", + "enum": [ + "id", + "campaign_id", + "voucher_id", + "points", + "status", + "expires_at" + ] + }, + "ExportPointsExpirationOrder": { + "title": "Export Points Expiration Order", + "type": "string", + "enum": [ + "id", + "-id", + "campaign_id", + "-campaign_id", + "voucher_id", + "-voucher_id", + "points", + "-points", + "status", + "-status", + "expires_at", + "-expires_at" + ] + }, + "ExportVoucherTransactionsFields": { + "title": "Export Voucher Transactions Fields", + "type": "string", + "enum": [ + "id", + "campaign_id", + "voucher_id", + "type", + "source_id", + "reason", + "source", + "balance", + "amount", + "related_transaction_id", + "created_at", + "details" + ] + }, + "ExportVoucherTransactionsOrder": { + "title": "Export Voucher Transactions Order", + "type": "string", + "enum": [ + "id", + "-id", + "campaign_id", + "-campaign_id", + "voucher_id", + "-voucher_id", + "type", + "-type", + "source_id", + "-source_id", + "reason", + "-reason", + "source", + "-source", + "balance", + "-balance", + "amount", + "-amount", + "related_transaction_id", + "-related_transaction_id", + "created_at", + "-created_at", + "details", + "-details" + ] + }, + "Any": { + "anyOf": [ + { + "title": "array", + "type": "array", + "items": { + "anyOf": [ + { + "title": "string", + "type": "string" + }, + { + "title": "number", + "type": "number" + }, + { + "title": "object", + "type": "object" } - } + ] } }, - "Loyalty Points": { - "value": { - "name": "Digital - Loyalty Points Reward", - "type": "CAMPAIGN", - "metadata": { - "Type": "Loyalty Points" - }, - "parameters": { - "campaign": { - "id": "camp_hC2GdqYtOmTT45zfhib62cK1", - "balance": 100 - } - } - } + { + "title": "string", + "type": "string" }, - "Pay with Points": { - "value": { - "name": "Pay with Points Reward", - "type": "COIN", - "metadata": { - "Type": "Coin" - }, - "parameters": { - "coin": { - "exchange_ratio": 900, - "points_ratio": 8000 - } - } - } + { + "title": "number", + "type": "number" }, - "Material Reward": { - "value": { - "name": "Get a Comic Book", - "metadata": { - "Type": "Material" - }, - "type": "MATERIAL", - "parameters": { - "product": { - "id": "prod_0b15f6b9f650c16990", - "sku_id": "sku_0b1621b319d248b79f" + { + "title": "object", + "type": "object" + } + ], + "title": "Any" + }, + "LoyaltiesCreateTiersRequestBody": { + "title": "Loyalties Create Tiers Request Body", + "type": "array", + "items": { + "allOf": [ + { + "$ref": "#/components/schemas/LoyaltyTierBase" + }, + { + "type": "object", + "properties": { + "metadata": { + "description": "The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format.", + "type": "object" } - }, - "stock": 2, - "attributes": { - "image_url": "https://www.website.com/img_fPHsk9Ob.png", - "description": "Archie's Series" } } - } + ] } - } - } - }, - "responses": { - "200": { - "description": "Returns a reward object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_obj_reward_object" + }, + "LoyaltiesCreateTiersResponseBody": { + "title": "Loyalties Create Tiers Response Body", + "type": "array", + "items": { + "$ref": "#/components/schemas/LoyaltyTier" + } + }, + "LoyaltiesGetRewardAssignmentResponseBody": { + "$ref": "#/components/schemas/RewardAssignment" + }, + "LoyaltiesGetRewardDetailsResponseBody": { + "$ref": "#/components/schemas/Reward" + }, + "LoyaltiesListTiersRequestQuery": { + "title": "Loyalties List Tiers Request Query", + "type": "object", + "properties": { + "limit": { + "type": "integer", + "minimum": 1, + "multipleOf": 100, + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." }, - "examples": { - "Material": { - "value": { - "id": "rew_Crmu3hu2FKZWZIML59AeAs1n", - "name": "Material Reward", - "type": "MATERIAL", - "parameters": { - "product": { - "id": "prod_0b15f6b9f650c16990", - "sku_id": "sku_0b1621b319d248b79f" - } - }, - "stock": "2", - "redeemed": null, - "attributes": { - "image_url": "https://www.website.com/img_fPH9oOb.png", - "description": "Archie's Series" - }, - "created_at": "2022-08-25T11:20:58.172Z", - "updated_at": null, - "metadata": { - "Type": "Material" - }, - "object": "reward" - } - } + "page": { + "type": "integer", + "description": "Which page of results to return." + }, + "order": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ], + "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." } } - } - } - } - } - }, - "/v1/rewards/{rewardId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "rew_2erjvECLs92GYzKbak3QkyTV" - }, - "name": "rewardId", - "in": "path", - "required": true, - "description": "A unique reward ID." - } - ], - "get": { - "operationId": "get-reward", - "tags": [ - "REWARDS API" - ], - "summary": "Get Reward", - "description": "Retrieve a reward by the reward ID.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a reward object if a valid identifier was provided. ", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_obj_reward_object" + }, + "LoyaltiesListLoyaltyTierEarningRulesRequestQuery": { + "title": "LoyaltiesListLoyaltyTierEarningRulesRequestQuery", + "type": "object", + "properties": { + "limit": { + "type": "integer", + "minimum": 1, + "multipleOf": 100, + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." + }, + "page": { + "type": "integer", + "description": "Which page of results to return." } } - } - }, - "404": { - "description": "Not Found. When requesting a reward that has been deleted or does not exist, the resource will not be returned.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + }, + "LoyaltiesGetTierResponseBody": { + "$ref": "#/components/schemas/LoyaltyTier" + }, + "LoyaltiesListTiersResponseBody": { + "title": "Loyalties List Tiers Response Body", + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary." }, - "examples": { - "Not found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find reward with id rew_C7wS9eHFDN4CIbXI5PpLSkG", - "request_id": "v-0b8c77bcc890215e35", - "resource_id": "rew_C7wS9eHFDN4CIbXI5PpLSkG", - "resource_type": "reward" - } + "data_ref": { + "type": "string", + "enum": [ + "data" + ], + "description": "Identifies the name of the attribute that contains the array of loyalty tier objects." + }, + "data": { + "type": "array", + "description": "This is an object representing a loyalty tier. Loyalty tiers are used to create a loyalty program with different levels of membership and varied earning rules and rewards based on customer’s tiers.", + "items": { + "$ref": "#/components/schemas/LoyaltyTier" } + }, + "total": { + "type": "integer", + "description": "Total number of loyalty tier objects." } - } - } - } - } - }, - "put": { - "operationId": "update-reward", - "tags": [ - "REWARDS API" - ], - "summary": "Update Reward", - "description": "Update the details of a reward.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Define the parameters to be updated for the reward.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_req_update_reward" }, - "examples": { - "Gift card credits": { - "value": { - "name": "Digital - Gift Card Reward", - "metadata": { - "Type": "Gift" - }, - "parameters": { - "campaign": { - "id": "camp_hC2GdqYtOmTT45zfhib62cK1", - "balance": 3000 - } - } - } + "required": [ + "object", + "data_ref", + "data", + "total" + ] + }, + "LoyaltiesListMemberLoyaltyTiersResponseBody": { + "title": "Loyalties List Member Loyalty Tiers Response Body", + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary." }, - "Discount Coupon": { - "value": { - "name": "Digital - Discount Coupon", - "metadata": { - "Type": "Discount" - }, - "parameters": { - "campaign": { - "id": "camp_hC2GdqYtOmTT45zfhib62cK1" - } - } - } + "data_ref": { + "type": "string", + "enum": [ + "data" + ], + "description": "Identifies the name of the attribute that contains the array of loyalty tier objects." }, - "Loyalty points": { - "value": { - "name": "Digital - Loyalty Points Reward", - "metadata": { - "Type": "Loyalty Points" - }, - "parameters": { - "campaign": { - "id": "camp_hC2GdqYtOmTT45zfhib62cK1", - "balance": 100 - } - } + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LoyaltyTier" } }, - "Pay with Points": { - "value": { - "name": "Pay with Points Reward", - "metadata": { - "Type": "Coin" - }, - "parameters": { - "coin": { - "exchange_ratio": 900, - "points_ratio": 8000 - } - } - } + "total": { + "type": "integer", + "description": "Total number of loyalty tier objects." + } + }, + "required": [ + "object", + "data_ref", + "data", + "total" + ] + }, + "EarningRule": { + "allOf": [ + { + "$ref": "#/components/schemas/EarningRuleBase" }, - "Material Reward": { - "value": { - "name": "Get a Comic Book", - "metadata": { - "Type": "Physical product" + { + "type": "object", + "properties": { + "validation_rule_id": { + "type": [ + "string", + "null" + ], + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." }, - "parameters": { - "product": { - "id": "prod_0b15f6b9f650c16990", - "sku_id": "sku_0b1621b319d248b79f" - } + "updated_at": { + "type": [ + "string", + "null" + ], + "format": "date-time", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format." }, - "stock": 2, - "attributes": { - "image_url": "https://www.website.com/img_fPH9.png", - "description": "Comic book" - } - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns an updated reward object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_obj_reward_object" - }, - "examples": { - "Material": { - "value": { - "id": "rew_wg2pvCr5LDhCq4uVQZ9LhuZm", - "name": "Get a Comic Book", - "type": "MATERIAL", - "parameters": { - "product": { - "id": "prod_0b15f6b9f650c16990", - "sku_id": "sku_0b1621b319d248b79f" - } - }, - "stock": "2", - "redeemed": null, - "attributes": { - "image_url": "https://www.website.com/img_fPH9.png", - "description": "Comic book" - }, - "created_at": "2022-08-25T10:00:12.794Z", - "updated_at": "2022-08-25T10:06:30.655Z", - "metadata": { - "Type": "Physical product" - }, - "object": "reward" + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date.\n\n- `true` indicates an active earning rule\n- `false` indicates an inactive earning rule" } - } + }, + "required": [ + "validation_rule_id", + "updated_at", + "active" + ] } - } - } - }, - "400": { - "description": "Returns an error if the balance parameter is not defined correctly.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_400_invalid_balance" + ] + }, + "LoyaltiesListLoyaltyTierEarningRulesResponseBody": { + "title": "Loyalties List Loyalty Tier Earning Rules ResponseBody", + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object represented by JSON. This object stores information about earning rules in a dictionary." }, - "examples": { - "Invalid Balance": { - "value": { - "code": 400, - "key": "invalid_balance", - "message": "Property 'parameters.campaign.balance' is invalid", - "details": "Property 'parameters.campaign.balance' must be greater than zero for campaign type: GIFT_VOUCHERS", - "request_id": "v-0b96d2b90dce48855f" - } - } - } - } - } - } - } - }, - "delete": { - "operationId": "delete-reward", - "tags": [ - "REWARDS API" - ], - "summary": "Delete Reward", - "description": "Delete a reward.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." - }, - "400": { - "description": "Bad Request. Returns an error indicating that the reward with given ID is assigned to a resource.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_400_resource_in_use" - }, - "examples": { - "Example": { - "value": { - "code": 400, - "key": "resource_in_use", - "message": "Resource in use", - "details": "Resource reward with id rew_fcYALROsORec6cP0VBItCVfq is in use by reward_assignments with ids [rewa_5WV7H3y2lT3GGl03Xjw29IEc]", - "request_id": "v-0b8c7b967950216291", - "related_object_ids": [ - "rewa_5WV7H3y2lT3GGl03Xjw29IEc" - ], - "related_object_type": "reward_assignment" - } - } - } - } - } - }, - "404": { - "description": "Returns an error indicating that the reward with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + "data_ref": { + "type": "string", + "enum": [ + "data" + ], + "description": "Identifies the name of the attribute that contains the array of earning rule objects." }, - "examples": { - "Reward Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find reward with id rew_2erjvECLs92GYzKbak3QkyT", - "request_id": "v-0ae29895e8c6b7781a", - "resource_id": "rew_2erjvECLs92GYzKbak3QkyT", - "resource_type": "reward" - } - } - } - } - } - } - } - } - }, - "/v1/rewards/{rewardId}/assignments": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "rewardId", - "in": "path", - "required": true, - "description": "A unique reward ID." - } - ], - "get": { - "operationId": "list-reward-assignments", - "tags": [ - "REWARDS API" - ], - "summary": "List Reward Assignments", - "description": "Retrieve reward assignments by the reward ID.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary of reward assignment objects. Each object contains information regarding the resource to which the reward was assigned and the cost in loyalty points for the reward.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_res_list_reward_assignments" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "rewa_PbIRoMXpwe5QhobW4JKu0VjH", - "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", - "related_object_id": "camp_wciTvaOfYmAa3EmIIW3QpXXZ", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 15 - } - }, - "created_at": "2022-08-17T08:13:02.507Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_pJYQBXSitK2OVPK3XMXZK76X", - "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", - "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 20 - } - }, - "created_at": "2022-08-24T11:40:22.418Z", - "updated_at": null, - "object": "reward_assignment" - } - ], - "total": 2 - } + "data": { + "type": "array", + "description": "Contains array of earning rule objects.", + "items": { + "$ref": "#/components/schemas/EarningRule" } - } - } - } - }, - "404": { - "description": "Returns an error if the given reward is missing, does not exist or was deleted.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find reward with id rew_C7wS9eHFDN4CIbXI5PpLSkGYi", - "request_id": "v-0b95a68c678ad5c765", - "resource_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGYi", - "resource_type": "reward" - } - } + "total": { + "type": "integer", + "description": "Total number of earning rule objects." } - } - } - } - } - }, - "post": { - "operationId": "create-reward-assignment", - "tags": [ - "REWARDS API" - ], - "summary": "Create Reward Assignment", - "description": "Assigns a reward to a specified loyalty campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Provide the campaign ID of the campaign to which the reward is to be assigned and define the cost of the reward in terms of loyalty points.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_req_create_reward_assignment" }, - "examples": { - "Example": { - "value": { - "campaign": "camp_OTuGGP90PivbvROsRvfM65El", - "parameters": { - "loyalty": { - "points": 39 - } - } - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns a reward assignment object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" + "required": [ + "object", + "data_ref", + "data", + "total" + ] + }, + "LoyaltyTierBase": { + "title": "Loyalty Tier Base", + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Loyalty Tier name." }, - "examples": { - "Example": { - "value": { - "id": "rewa_cqD2XE5x8LcD2c1FLlvqikti", - "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", - "related_object_id": "camp_OTuGGP90PivbvROsRvfM65El", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 39 - } - }, - "created_at": "2022-08-24T13:44:42.610Z", - "updated_at": null, - "object": "reward_assignment" - } - } - } - } - } - }, - "400": { - "description": "Returns an error if request body parameters are missing.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_400_missing_param" + "earning_rules": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/MappingPoints" + }, + "description": "Contains a list of earning rule IDs and their points mapping for the given earning rule." }, - "examples": { - "Missing Parameter": { - "value": { - "code": 400, - "key": "missing_param", - "message": "Missing required parameter", - "details": "Parameter 'parameters.loyalty' is required", - "request_id": "v-0b95c7f3684ad5f06d" - } - } - } - } - } - }, - "404": { - "description": "Returns an error when creating a reward assignment for a reward that has been deleted or does not exist.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Reward Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find reward with id rew_C7wS9eHFDN4CIbXI5PpLSkGYi", - "request_id": "v-0b95c0bedf46fcbe83", - "resource_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGYi", - "resource_type": "reward" - } + "rewards": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/MappingPoints" }, - "Missing Campaign": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id null", - "request_id": "v-0b95c68b12cad5eebb", - "resource_id": null, - "resource_type": "campaign" - } - } - } - } - } - }, - "409": { - "description": "Returns an error if a conflict is found, i.e. an assignment for the reward has already been created.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" + "description": "Contains a list of reward IDs and their points mapping for the given reward." }, - "examples": { - "Duplicate Found": { - "value": { - "code": 409, - "key": "duplicate_found", - "message": "Duplicated resource found", - "details": "Duplicated reward_assignment exists with id rewa_q1Ad955TUZS4nVIxplOw9pL3", - "request_id": "v-0b95c78daa06fcc6bb", - "resource_id": "rewa_q1Ad955TUZS4nVIxplOw9pL3", - "resource_type": "reward_assignment" + "points": { + "type": "object", + "description": "Defines range of loyalty tier in points.", + "properties": { + "from": { + "type": "integer", + "description": "Bottom points threshold value." + }, + "to": { + "type": "integer", + "description": "Top points threshold value." } } } - } - } - } - } - } - }, - "/v1/rewards/{rewardId}/assignments/{assignmentId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "rew_2erjvECLs92GYzKbak3QkyTV" - }, - "name": "rewardId", - "in": "path", - "required": true, - "description": "A unique reward ID." - }, - { - "schema": { - "type": "string", - "example": "rewa_YkwQ5ezNYTQV2geodMVhTpy4" - }, - "name": "assignmentId", - "in": "path", - "required": true, - "description": "A unique reward assignment ID." - } - ], - "put": { - "operationId": "update-reward-assignment", - "tags": [ - "REWARDS API" - ], - "summary": "Update Reward Assignment", - "description": "Update the number of points needed to successfully redeem the reward.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Define the number of points required to exchange for the reward.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_req_update_reward_assignment" }, - "examples": { - "Example": { - "value": { - "parameters": { - "loyalty": { - "points": 35 - } - } - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns the updated reward assignment object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" + "required": [ + "name", + "points" + ] + }, + "LoyaltyTier": { + "allOf": [ + { + "$ref": "#/components/schemas/LoyaltyTierBase" }, - "examples": { - "Example": { - "value": { - "id": "rewa_pJYQBXSitK2OVPK3XMXZK76X", - "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", - "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 35 + { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique loyalty tier ID." + }, + "campaign_id": { + "type": "string", + "description": "Unique parent campaign ID." + }, + "metadata": { + "type": [ + "object", + "null" + ], + "description": "The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format." + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the loyalty tier was created in ISO 8601 format." + }, + "updated_at": { + "type": [ + "string", + "null" + ], + "format": "date-time", + "description": "Timestamp representing the date and time when the loyalty tier was updated in ISO 8601 format." + }, + "config": { + "type": "object", + "description": "Defines loyalty tier range in points.", + "required": [ + "points" + ], + "properties": { + "points": { + "type": "object", + "description": "Defines range of loyalty tier in points.", + "properties": { + "from": { + "type": "integer", + "description": "Bottom points threshold value." + }, + "to": { + "type": "integer", + "description": "Top points threshold value." + } + } + } + } + }, + "expiration": { + "type": "object", + "description": "Defines loyalty tier expiration date.", + "properties": { + "customer_id": { + "type": "string" + }, + "campaign_id": { + "type": "string" + }, + "tier_id": { + "type": "string" + }, + "start_date": { + "type": "string", + "format": "date-time" + }, + "expiration_date": { + "type": "string", + "format": "date-time" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" } }, - "created_at": "2022-08-24T11:40:22.418Z", - "updated_at": "2022-08-24T13:02:32.262Z", - "object": "reward_assignment" - } - } - } - } - } - }, - "404": { - "description": "Returns an error indicating that the reward assignment with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find reward_assignment with id rewa_pJYQBXSitK2OVPK3XMXZK76XI", - "request_id": "v-0b95b8760a4ad5dda1", - "resource_id": "rewa_pJYQBXSitK2OVPK3XMXZK76XI", - "resource_type": "reward_assignment" - } - } - } - } - } - } - } - }, - "delete": { - "operationId": "delete-reward-assignment", - "tags": [ - "REWARDS API" - ], - "summary": "Delete Reward Assignment", - "description": "This method deletes a reward assignment for a particular reward.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." - }, - "404": { - "description": "Returns an error indicating that the reward or reward assignment with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Reward Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find reward with id rew_2erjvECLs92GYzKbak3QkyT", - "request_id": "v-0ae29f325e1027cde8", - "resource_id": "rew_2erjvECLs92GYzKbak3QkyT", - "resource_type": "reward" + "required": [ + "customer_id", + "campaign_id", + "tier_id", + "created_at" + ] + }, + "object": { + "type": "string", + "enum": [ + "loyalty_tier" + ], + "description": "The type of object represented by JSON. This object stores information about the loyalty." } }, - "Reward Assignment Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find reward_assignment with id rewa_YkwQ5ezNYTQV2geodMVhTpy", - "request_id": "v-0ae2a0588b9027cf95", - "resource_id": "rewa_YkwQ5ezNYTQV2geodMVhTpy", - "resource_type": "reward_assignment" - } - } - } - } - } - } - } - }, - "get": { - "operationId": "get-reward-assignment", - "tags": [ - "REWARDS API" - ], - "summary": "Get Reward Assignment", - "description": "Retrieve a reward assignment.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a reward assignment object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" + "required": [ + "id", + "campaign_id", + "metadata", + "created_at", + "config", + "object" + ] } - } - } - }, - "404": { - "description": "Returns an error indicating that the reward assignment with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + ] + }, + "MappingMultiply": { + "title": "MappingMultiply", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "MULTIPLY" + ], + "description": "Type of calculation." }, - "examples": { - "Reward Assignment Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find reward_assignment with id rewa_pJYQBXSitK2OVPK3XMXZK76X", - "request_id": "v-0b95b596e98ad5da24", - "resource_id": "rewa_pJYQBXSitK2OVPK3XMXZK76X", - "resource_type": "reward_assignment" - } - } + "multiplier": { + "type": "number", + "description": "Multiplication factor used to multiply the points to obtain the mapped points." } } - } - } - } - } - }, - "/v1/publication-object": { - "get": { - "operationId": "publication-object", - "tags": [ - "PUBLICATIONS API" - ], - "summary": "Publication Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Publication Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/5_obj_publication_object" + }, + "MappingFixed": { + "title": "MappingFixed", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "CUSTOM" + ], + "description": "Type of calculation.\n\n" + }, + "points": { + "type": "integer", + "description": "Fixed number of points to be applied." } } - } - } - } - } - }, - "/v1/publications/create": { - "get": { - "operationId": "create-publication-1", - "tags": [ - "PUBLICATIONS API" - ], - "summary": "Create Publication", - "description": "This method selects vouchers that are suitable for publication, adds a publish entry and returns the publication.\n\nA voucher is suitable for publication when it's active and hasn't been published yet.\n> ❗️ Limited access\n>\n> Access to this endpoint is limited. This endpoint is designed for specific integrations and the API keys need to be configured to access this endpoint. Navigate to the **Dashboard** → **Project Settings** → **General** → **Integration Keys** to set up a pair of API keys and use them to send the request. \n\n\n> 🚧 Clearly define the source of the voucher\n>\n> You must clearly define which source you want to publish the voucher code from. It can either be a code from a campaign or a specific voucher identified by a code. \n\n> 🚧 Publish multiple vouchers\n> This endpoint does not support the publishing of multiple vouchers from a single campaign. In case you want to publish multiple vouchers within a single publication, you need to use a [dedicated endpoint](ref:create-publication). \n\n\n> 📘 Specifying the voucher to be published\n>\n> - In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use an **auto-update** campaign and in the query parameters specify the `campaign` without specifying the voucher.\n> - If you would like to publish a specific code from a specific campaign, then you need to provide the `campaign` and the `voucher` parameters.\n> - If you would like to publish a standalone voucher, then omit the campaign parameter and simply provide the `voucher` parameter. \n\n## Example Request \n```markdown Publication Query \n/publications/create?campaign=camp_T0bUgWGCAV6S0X3smH4MEboG&metadata[year]=2&metadata[Date]=2023-03-03&metadata[DateTime]=2023-03-03T14:06:08.311Z&metadata[Flag]=true&metadata[Number]=222&metadata[String]=stringy&metadata[ImageURL]=https://user-images.githubusercontent.com/95409292/222734777-a6d9e41a-de3a-42a8-8cc7-24f31e857edd.png&metadata[Object][payment][payment_tax]=9&metadata[Object][payment][payment_method]=Visa&metadata[Object][payment][payment_date]=2023-03-03&metadata[Object][payment][payment_datetime]=2023-03-03T14:06:08.311Z&metadata[Object][payment][payment_completed]=true&metadata[Object][payment][payment_url]=https://user-images.githubusercontent.com/95409292/222734777-a6d9e41a-de3a-42a8-8cc7-24f31e857edd.png&customer[source_id]=try-new-12&customer[name]=John%20Jimmy&customer[description]=This is testing the publication endpoint.&customer[email]=johnjimy2%40email.com&customer[phone]=%2B48%20123%20333%20333&customer[address][city]=Warsaw&customer[address][state]=Mazowieckie&customer[address][line_1]=4499%20Main%20St.&customer[address][line_2]=Blg%202%20APT%204&customer[address][country]=Poland&customer[address][postal_code]=122333&customer[birthday]=2222-01-22&customer[metadata][paid_bill]=true&customer[metadata][age]=22&customer[metadata][location]=Poland&customer[metadata][acquisition_date]=2022-09-09&customer[metadata][birth_date]=2023-03-20T18:44:19.215Z&customer[metadata][ImageURL]=https://user-images.githubusercontent.com/95409292/222734777-a6d9e41a-de3a-42a8-8cc7-24f31e857edd.png&customer[metadata][location-unknown][city]=Katowice&customer[metadata][location-unknown][state]=slask&customer[metadata][location-unknown][number]=2&customer[metadata][location-unknown][date]=2034-09-11&customer[metadata][location-unknown][dateTime]=2023-03-20T18:44:19.215Z&customer[metadata][Object][payment][payment_date]=2023-03-03&customer[metadata][Object][payment][payment_datetime]=2023-03-03T14:06:08.311Z&customer[metadata][Object][payment][payment_completed]=true&customer[metadata][Object][payment][payment_url]=https://user-images.githubusercontent.com/95409292/222734777-a6d9e41a-de3a-42a8-8cc7-24f31e857edd.png&customer[metadata][Object][payment][payment_tax]=9&customer[metadata][Object][payment][payment_method]=Visa```", - "parameters": [ - { - "schema": { - "type": "string", - "example": "custom_publication_source_id" - }, - "in": "query", - "name": "source_id", - "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service." - }, - { - "schema": { - "type": "string", - "example": "PROMO-1LwwzYI" }, - "in": "query", - "name": "voucher", - "description": "Code of voucher being published. If there is a particular code that you would like to publish, then you can use this parameter to specify the code. You can omit this parameter if you would like to publish a random code from a campaign, where the campaign is in `AUTO_UPDATE` mode." - }, - { - "name": "metadata", - "in": "query", - "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format.", - "style": "deepObject", - "explode": true, - "schema": { - "type": "object" - } - }, - { - "name": "customer", - "in": "query", - "required": true, - "description": "Specify the customer who is to receive a code. You can either directly provide the respective ID's as strings or provide them in the form of an object.", - "style": "deepObject", - "explode": true, - "schema": { + "MappingPoints": { "anyOf": [ { - "$ref": "#/components/schemas/5_req_create_publication_customer" - }, - { - "$ref": "#/components/schemas/5_res_create_publication_customer_id" - }, - { - "$ref": "#/components/schemas/5_res_create_publication_customer_source_id" + "$ref": "#/components/schemas/MappingMultiply" }, { - "$ref": "#/components/schemas/9_req_create_customer" + "$ref": "#/components/schemas/MappingFixed" } ] - } - }, - { - "name": "campaign", - "in": "query", - "required": true, - "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`. You can use this parameter without having to specify a particular `voucher` code if the campaign is in `AUTO_UPDATE` mode. This parameter not required for a standalone code, however, if you intend to use a code from a campaign, then this parameter is required.", - "style": "deepObject", - "explode": true, - "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/5_req_create_publication_campaign" - }, - { - "$ref": "#/components/schemas/5_req_create_publication_campaign_id" - }, + }, + "a_req_importCSV": { + "type": "object", + "title": "Import CSV file", + "description": "Request body schema for importing data using a CSV file.", + "format": "binary", + "properties": { + "file": { + "type": "string", + "format": "binary", + "description": "File path." + } + }, + "required": [ + "file" + ] + }, + "a_res_async_actions": { + "type": "object", + "title": "Asynchronous Actions", + "description": "Response to requests that are processed asynchronously.", + "additionalProperties": false, + "examples": [ { - "$ref": "#/components/schemas/5_req_create_publication_campaign_name" + "async_action_id": "aa_0a875d56c805df6601" + } + ], + "properties": { + "async_action_id": { + "type": "string", + "example": "aa_0a875d56c805df6601", + "description": "The ID of the scheduled asynchronous action." } + }, + "required": [ + "async_action_id" ] - } - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a publication object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/5_res_create_publication" - }, - "examples": { - "Example": { - "value": { - "id": "pub_ocaXCa023ayJ3WL1ARxUeKgIvg3JcEGh", - "object": "publication", - "created_at": "2022-09-30T16:30:32.924Z", - "customer_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", - "tracking_id": "pub_source_customer_5", - "metadata": { - "year": 2022 - }, - "channel": "myown", - "source_id": "publication_source_ID_10", - "result": "SUCCESS", - "customer": { - "id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", - "name": "Bob Jones", - "email": "bob.smith@email.com", - "source_id": "pub_source_customer_5", - "metadata": { - "lang": "en", - "test": true - }, - "object": "customer" - }, - "voucher": { - "id": "v_6Hy5FdNlu3dP65fJu5BgXma31Sl3rgkf", - "code": "cEsMn0uA", - "campaign": "Test - Discount Effect - Amount - Items", - "campaign_id": "camp_dphuwqH7BOVkgh4JmpDtS32l", - "category": null, - "category_id": null, - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 300, - "effect": "APPLY_TO_ITEMS" - }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX188XVmOotyCyR2j3G8sJR8HzS3DQ+6J1OElPWSmjlEnthuJc7rkc7WIVxjT4pTl1JVVkHEuGXNXdzRik11H8S18HQeQFJFiuwLZ2mzEC2zZitEinyUxtZwhnEHoi0eGAgYCG7iVMNuOQA==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX188XVmOotyCyR2j3G8sJR8HzS3DQ%2B6J1OElPWSmjlEnthuJc7rkc7WIVxjT4pTl1JVVkHEuGXNXdzRik11H8S18HQeQFJFiuwLZ2mzEC2zZitEinyUxtZwhnEHoi0eGAgYCG7iVMNuOQA%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX18wDd9CcLM0Ef7aBfUSXZUoCQpuNpk4CHGOipbn+wFkfzcIZGBtUlxrI2KsXciCqF+c93AKzsymq5Yw8eEAFF/FK5f94z4/sgzaLDvyBmPCXHuS11Ew9S4ZEMjdTkUJftER2IlxWaCARA==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18wDd9CcLM0Ef7aBfUSXZUoCQpuNpk4CHGOipbn%2BwFkfzcIZGBtUlxrI2KsXciCqF%2Bc93AKzsymq5Yw8eEAFF%2FFK5f94z4%2FsgzaLDvyBmPCXHuS11Ew9S4ZEMjdTkUJftER2IlxWaCARA%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-30T16:30:32.956Z", - "updated_at": null, - "holder_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", - "redemption": { - "quantity": 1, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/cEsMn0uA/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/cEsMn0uA/publications?page=1&limit=10" - }, - "object": "voucher" - }, - "vouchers_id": [ - "v_6Hy5FdNlu3dP65fJu5BgXma31Sl3rgkf" - ] - } - } + }, + "error": { + "title": "error", + "type": "object", + "properties": {}, + "discriminator": { + "propertyName": "key", + "mapping": { + "not_enough_codes": "not_enough_codes" } - } - } - }, - "400": { - "description": "Returns an error if the query parameters are incomplete.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" + }, + "description": "Short error response", + "examples": [] + }, + "e_error": { + "title": "Error Object", + "type": "object", + "description": "Error details", + "properties": { + "code": { + "type": "integer", + "description": "Error's HTTP status code." }, - "examples": { - "Missing customer": { - "value": { - "code": 400, - "key": "invalid_query_params", - "message": "Invalid query params", - "details": "Query should have required property 'customer'", - "request_id": "v-0c8b6423f3c80ed3e4" - } - }, - "Missing vouchers": { - "value": { - "code": 400, - "key": "missing_vouchers", - "message": "Missing vouchers", - "details": "Either Campaign or Voucher is required" - } - }, - "Voucher cannot be published": { - "value": { - "code": 400, - "key": "voucher_cannot_be_published", - "message": "Voucher cannot be published", - "details": "Voucher cannot be published. Customer already joined program.", - "request_id": "v-0c8b763544080efed2" - } - }, - "Voucher already published": { - "value": { - "code": 400, - "key": "voucher_already_published", - "message": "Voucher already published", - "details": "Voucher 'v_vM7vQZmgV86k0wuz05cFAOfarj4s8BQE' has already been published", - "request_id": "v-0c8baebc67c80e97a0" - } - }, - "Duplicate source ID": { - "value": { - "code": 400, - "key": "duplicate_source_id", - "message": "Duplicate source_id", - "details": "Publication with source_id: 'test_publication_source_id_test_voucher' already exists", - "request_id": "v-0c8b7e8f78c80e94a2" - } - }, - "Too many vouchers requested": { - "value": { - "code": 400, - "key": "too_many_vouchers_requested", - "message": "Too many vouchers requested", - "details": "Only up to 1 can be published", - "request_id": "v-0c8bac9a25c80e912d" - } - }, - "Metadata validation failed": { - "value": { - "code": 400, - "key": "metadata_validation_failed", - "message": "Metadata validation failed", - "details": "ImageURL: must be a URL pointing to JPG/JPEG or PNG resource (actual value is 'http.com')", - "request_id": "v-0c8bcbd742080ee807" + "key": { + "type": "string", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a885062c80375740f", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + }, + "error": { + "type": "object", + "description": "Contains custom user-defined error message translation.", + "properties": { + "message": { + "type": "string", + "description": "Error message translation defined in Dashboard → Project Settings → Error Messages" } } } } - } - }, - "403": { - "description": "Returns an error if you don't have a specific credentials set up. Navigate to the **Dashboard** → **Project Settings** → **General** → **Integration Keys** to set up a pair of API keys and use them to send the request.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_integration_key" + }, + "e_error_expanded": { + "title": "Error Object", + "type": "object", + "description": "Error details", + "properties": { + "code": { + "type": "integer", + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a885062c80375740f", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + }, + "resource_id": { + "type": "string", + "description": "Unique resource ID that can be used in another endpoint to get more details.", + "example": "rf_0c5d710a87c8a31f86" }, - "examples": { - "Example": { - "value": { - "code": 403, - "message": "Forbidden", - "key": "integration_api_key_required" + "resource_type": { + "type": "string", + "description": "The resource type.", + "example": "redemption" + }, + "error": { + "type": "object", + "description": "Contains custom user-defined error message translation.", + "properties": { + "message": { + "type": "string", + "description": "Error message translation defined in Dashboard → Project Settings → Error Messages" } } } } - } - }, - "404": { - "description": "Returns an error if a resource is not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + }, + "e_error_no_translation": { + "title": "Error Object", + "type": "object", + "description": "Error details", + "properties": { + "code": { + "type": "integer", + "description": "Error's HTTP status code." }, - "examples": { - "Resource not found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find customer with id cust_xqA7DGj5eYPHg6PHVKwYRWiA", - "request_id": "v-0c8b6b35294af6f192", - "resource_id": "cust_xqA7DGj5eYPHg6PHVKwYRWiA", - "resource_type": "customer" - } - } + "key": { + "type": "string", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a885062c80375740f", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." } } - } - } - } - } - }, - "/v1/publications": { - "get": { - "operationId": "list-publications", - "tags": [ - "PUBLICATIONS API" - ], - "summary": "List Publications", - "description": "Retrieve a list of publications. To return a **particular** publication, you can use the `source_id` query parameter and provide the `source_id` of the publication you are looking for specifically.\n\n## Pagination\n\n\n> 🚧 Important!\n>\n> If you want to scroll through a huge set of records, it is recommended to use the [Exports API](ref:create-export). This API will return an error `page_over_limit` if you reach a page above 1000.\n\n## Filter Query\n\nThe `filters` query parameter allows for joining multiple parameters with logical operators. The syntax looks as follows:\n\n\n```url\nfilters[][conditions][][]=\n```\n\n### Operators:\n\n\n```\n \"$in\"\n \"$not_in\"\n \"$is\"\n \"$is_not\"\n \"$has_value\"\n \"$is_unknown\"\n \"$contains\"\n \"$starts_with\"\n \"$ends_with\"\n \"$more_than\"\n \"$less_than\"\n \"$more_than_equal\"\n \"$less_than_equal\"\n```\n\n### Examples\n\n\n```url\nGET /v1/publications?filters[customer_id][conditions][$is][0]=cust_lUET6gRpO5Wxlg5p2j2gRCgL\n```\n\n```url\nGET /v1/publications?filters[customer_id][conditions][$in][0]=cust_lUET6gRpO5Wxlg5p2j2gRCgL&filters[customer_id][conditions][$in][1]=cust_aR7NfHusxT7PdTMAKMfWDXnc\n```\n\n```url\nGET /v1/publications?filters[customer_id][conditions][$is][0]=cust_lUET6gRpO5Wxlg5p2j2gRCgL&filters[customer_id][conditions][$is][1]=cust_aR7NfHusxT7PdTMAKMfWDXnc&filters[junction]=OR\n```", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "schema": { - "type": "string", - "enum": [ - "id", - "-id", - "voucher_code", - "-voucher_code", - "tracking_id", - "-tracking_id", - "customer_id", - "-customer_id", - "created_at", - "-created_at", - "channel", - "-channel" - ] - }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "campaign", - "description": "Filters by a given campaign name." - }, - { - "schema": { - "type": "string", - "example": "cust_jl33V8ZDQJp4goU1z8DmFioo" - }, - "in": "query", - "name": "customer", - "description": "Filters by a unique customer ID." - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "voucher", - "description": "Filters by a given voucher code." - }, - { - "schema": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ] - }, - "in": "query", - "name": "result", - "description": "Filters by a publication result." - }, - { - "schema": { - "type": "string", - "enum": [ - "discount", - "loyalty", - "lucky_draw" - ] }, - "in": "query", - "name": "voucher_type", - "description": "Filters by a voucher type." - }, - { - "schema": { - "type": "boolean" + "e_integration_key": { + "title": "Error Object", + "type": "object", + "description": "Error details", + "properties": { + "code": { + "type": "integer", + "description": "Error's HTTP status code." + }, + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the error." + }, + "key": { + "type": "string", + "description": "Short string describing the kind of error which occurred." + } + } }, - "in": "query", - "name": "is_referral_code", - "description": "This filter works only for the `true` option. If set to `true`, the query returns only publications of codes from referral campaigns. " - }, - { - "schema": { - "type": "string" + "e_400_missing_param": { + "description": "Error: Bad Request → Missing Parameters", + "type": "object", + "title": "Missing Parameters", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "missing_param", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Missing required parameter", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "example": "Parameter 'custom_event.schema_id' is required", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a96c19b1a41c03999", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + } + } }, - "in": "query", - "name": "filters", - "description": "Allows for combining the filters mentioned in the endpoint description." - }, - { - "schema": { - "type": "string" + "e_400_not_enough_source_ids": { + "description": "Error: Bad Request → Missing Parameters", + "type": "object", + "title": "Not Enough Source ID's", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "not_enought_source_ids", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Not enough source_ids", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "example": "Specify at least 1 source_id", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a96c19b1a41c03999", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + } + } }, - "in": "query", - "name": "source_id", - "description": "Using this endpoint with a particular publication `source_id`, which was sent with the original request to create a publication, returns in the response, exactly the same code published initially because the code was assigned to the given publication. As a result, you can use this endpoint as a reference and return a code that was assigned in a publication by using a particular `source_id`." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a list of publications you’ve previously created with [create publication](ref:create-publication) or implicitly by the distribution manager. The publications are returned in sorted order, with the most recent ones appearing first.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/5_res_list_publications" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "publications", - "publications": [ - { - "id": "pub_QzQT50e5i2y3bRoEVvhFgrKbZ7t6BRwu", - "object": "publication", - "created_at": "2022-09-28T13:31:23.522Z", - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "tracking_id": "cindy.jones@email.com", - "metadata": { - "distribution_id": "distr_WXm0CBttar2ug2hBx3EdPtS8Ei", - "source_type": "distribution", - "source_id": "distr_WXm0CBttar2ug2hBx3EdPtS8Ei" - }, - "channel": "Automation", - "source_id": null, - "result": "SUCCESS", - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "name": "Cindy Jones", - "email": "cindy.jones@email.com", - "source_id": "cindy.jones@email.com", - "metadata": { - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "voucher": { - "code": "FNV5IrtY", - "object": "voucher", - "campaign": "Loyalty Campaign", - "loyalty_card": { - "points": 0, - "balance": 0 - }, - "is_referral_code": false - }, - "vouchers_id": [ - "v_i3HOzVClfJUDia0qCu7TSuGfDj7c0dgD" - ] - }, - { - "id": "pub_8KOKHObAjuemuI0b6225emIhmWDL1ZoX", - "object": "publication", - "created_at": "2022-09-28T13:31:02.766Z", - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "tracking_id": "sandy.jones@email.com", - "metadata": {}, - "channel": "voucherify-website", - "source_id": null, - "result": "SUCCESS", - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "name": "Sandy Jones", - "email": "sandy.jones@email.com", - "source_id": "sandy.jones@email.com", - "metadata": { - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "voucher": { - "code": "Voucher-1", - "object": "voucher", - "campaign": null, - "discount": { - "type": "AMOUNT", - "amount_off": 200, - "amount_off_formula": "IF(VOUCHER_PUBLISH_COUNT = 1;25;5)", - "effect": "APPLY_TO_ORDER" - }, - "is_referral_code": false - }, - "vouchers_id": [ - "v_1iEL92K634EIOqeYJw6AHrnjEhGPEdpu" - ] - }, - { - "id": "pub_DcQPfyVYzomtkQGXFW7dcdyNoJ6vQ4NV", - "object": "publication", - "created_at": "2022-09-13T06:15:08.249Z", - "customer_id": "cust_ur1hIPGflbaAe14mLlLdon3G", - "tracking_id": "1", - "metadata": {}, - "channel": "voucherify-website", - "source_id": null, - "result": "SUCCESS", - "customer": { - "id": "cust_ur1hIPGflbaAe14mLlLdon3G", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "1", - "metadata": { - "accepts_marketing": false - }, - "object": "customer" - }, - "voucher": { - "code": "GIFT-WOZaK5YF1Fs87tAX", - "object": "voucher", - "campaign": "Gift Cards", - "gift": { - "amount": 0, - "balance": 0 - }, - "is_referral_code": false - }, - "vouchers_id": [ - "v_yzOeb7vw63vbPfA30215dFm7aRXa8Xoc" - ] - } - ], - "total": 3 - } - } + "e_400_invalid_payload": { + "title": "Invalid Payload", + "type": "object", + "description": "Error: Bad Request → Invalid Payload", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "invalid_payload", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Invalid payload", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a884c6be8c3756f42", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." } } - } - }, - "400": { - "description": "Returns an error if you request a page higher than 1000.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" + }, + "e_400_invalid_balance": { + "title": "Invalid Balance", + "type": "object", + "description": "Error: Bad Request → Invalid Balance", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." }, - "examples": { - "Example": { - "value": { - "code": 400, - "key": "page_over_limit", - "message": "Listing resource above 1000 page is not supported", - "details": "Property .page cannot be higher than 1000", - "request_id": "v-0bc2a39574c61362af" - } - } + "key": { + "type": "string", + "default": "invalid_balance", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a884c6be8c3756f42", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." } } - } - } - } - }, - "post": { - "operationId": "create-publication", - "tags": [ - "PUBLICATIONS API" - ], - "summary": "Create Publication", - "description": "This method selects vouchers that are suitable for publication, adds a publish entry and returns the publication.\n\nA voucher is suitable for publication when it's active and hasn't been published yet. \n\n\n> 🚧 Clearly define the source of the voucher\n>\n> You must clearly define which source you want to publish the voucher code from. It can either be a code from a campaign or a specific voucher identified by a code. \n\n> 🚧 Publish multiple vouchers\n> In case you want to publish multiple vouchers within a single publication, you need to specify the campaign name and number of vouchers you want to publish. \n\n\n> 📘 Auto-update campaign\n>\n> In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use an **auto-update** campaign.", - "parameters": [ - { - "schema": { - "type": "boolean" }, - "in": "query", - "name": "join_once", - "description": "Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the publication parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/5_req_create_publication" - }, - "examples": { - "Example - Specific Voucher": { - "value": { - "campaign": { - "name": "campaign-name" - }, - "customer": { - "source_id": "source-id", - "Name": "Customer Name", - "email": "customer email" - }, - "voucher": "voucher-code", - "metadata": { - "key": "value" - } - } + "e_400_resource_in_use": { + "title": "Resource in use", + "type": "object", + "description": "Error: Bad Request - Resource in use", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." }, - "Example - Random Voucher": { - "value": { - "campaign": { - "name": "campaign-name", - "count": 1 - }, - "customer": { - "source_id": "source-id", - "Name": "Customer Name", - "email": "customer email" - }, - "voucher": "voucher-code", - "metadata": { - "key": "value" - } - } + "key": { + "type": "string", + "default": "resource_in_use", + "description": "Short string describing the kind of error which occurred." }, - "Example 3": { - "value": { - "source_id": "publication_source_ID_10", - "campaign": "Test - Discount Effect - Amount - Items", - "channel": "myown", - "customer": { - "source_id": "pub_source_customer_5", - "name": "Bob Jones", - "description": "A frequent customer", - "email": "bob.smith@email.com", - "phone": "+1 933 222 3333", - "address": { - "city": "New York", - "country": "United States", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 5", - "postal_code": "10001", - "state": "NY" - }, - "metadata": { - "lang": "en", - "test": true - }, - "birthday": "1901-12-01" - }, - "metadata": { - "year": 2022 - } + "message": { + "type": "string", + "default": "Resource in use", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a884c6be8c3756f42", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + }, + "related_object_ids": { + "type": "array", + "description": "Name or ID of the resources that are related.", + "items": { + "type": "string", + "example": "rewa_5WV7H3y2lT3GGl03Xjw29IEc" } + }, + "related_object_type": { + "type": "string", + "description": "Specifies the type of resource that is related." } } - } - } - }, - "responses": { - "200": { - "description": "Returns a publication object if a valid identifier was provided.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/5_res_create_publication" - }, - "examples": { - "Example": { - "value": { - "id": "pub_ocaXCa023ayJ3WL1ARxUeKgIvg3JcEGh", - "object": "publication", - "created_at": "2022-09-30T16:30:32.924Z", - "customer_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", - "tracking_id": "pub_source_customer_5", - "metadata": { - "year": 2022 - }, - "channel": "myown", - "source_id": "publication_source_ID_10", - "result": "SUCCESS", - "customer": { - "id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", - "name": "Bob Jones", - "email": "bob.smith@email.com", - "source_id": "pub_source_customer_5", - "metadata": { - "lang": "en", - "test": true - }, - "object": "customer" - }, - "voucher": { - "id": "v_6Hy5FdNlu3dP65fJu5BgXma31Sl3rgkf", - "code": "cEsMn0uA", - "campaign": "Test - Discount Effect - Amount - Items", - "campaign_id": "camp_dphuwqH7BOVkgh4JmpDtS32l", - "category": null, - "category_id": null, - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 300, - "effect": "APPLY_TO_ITEMS" - }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX188XVmOotyCyR2j3G8sJR8HzS3DQ+6J1OElPWSmjlEnthuJc7rkc7WIVxjT4pTl1JVVkHEuGXNXdzRik11H8S18HQeQFJFiuwLZ2mzEC2zZitEinyUxtZwhnEHoi0eGAgYCG7iVMNuOQA==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX188XVmOotyCyR2j3G8sJR8HzS3DQ%2B6J1OElPWSmjlEnthuJc7rkc7WIVxjT4pTl1JVVkHEuGXNXdzRik11H8S18HQeQFJFiuwLZ2mzEC2zZitEinyUxtZwhnEHoi0eGAgYCG7iVMNuOQA%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX18wDd9CcLM0Ef7aBfUSXZUoCQpuNpk4CHGOipbn+wFkfzcIZGBtUlxrI2KsXciCqF+c93AKzsymq5Yw8eEAFF/FK5f94z4/sgzaLDvyBmPCXHuS11Ew9S4ZEMjdTkUJftER2IlxWaCARA==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18wDd9CcLM0Ef7aBfUSXZUoCQpuNpk4CHGOipbn%2BwFkfzcIZGBtUlxrI2KsXciCqF%2Bc93AKzsymq5Yw8eEAFF%2FFK5f94z4%2FsgzaLDvyBmPCXHuS11Ew9S4ZEMjdTkUJftER2IlxWaCARA%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-30T16:30:32.956Z", - "updated_at": null, - "holder_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", - "redemption": { - "quantity": 1, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/cEsMn0uA/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/cEsMn0uA/publications?page=1&limit=10" - }, - "object": "voucher" - }, - "vouchers_id": [ - "v_6Hy5FdNlu3dP65fJu5BgXma31Sl3rgkf" - ] - } - } + }, + "e_400_invalid_export_fields": { + "title": "Invalid Export Fields", + "type": "object", + "description": "Error: Bad Request → Invalid Export Fields", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "invalid_export_fields", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Invalid Export", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a884c6be8c3756f42", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." } } - } - }, - "400": { - "description": "Returns an error if a publication with the same source ID already exists in the system or some request body parameter is missing.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" + }, + "e_400_invalid_voucher": { + "title": "Invalid Voucher", + "type": "object", + "description": "Error: Bad Request → Invalid Voucher", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." }, - "examples": { - "Missing Parameters": { - "value": { - "code": 400, - "key": "missing_vouchers", - "message": "Missing vouchers", - "details": "Either Campaign or Voucher is required" - } - }, - "Already published": { - "value": { - "code": 400, - "key": "voucher_already_published", - "message": "Voucher already published", - "details": "Voucher 'v_Y5P4UZ1yilkiYOIJmAAgWazUi1wfkNwF' has already been published", - "request_id": "v-0bc40bb800d5651137" - } - }, - "Duplicate Source ID": { - "value": { - "code": 400, - "key": "duplicate_source_id", - "message": "Duplicate source_id", - "details": "Publication with source_id: 'publication_source_ID_1' already exists", - "request_id": "v-0bc40bf81555651191" - } - } + "key": { + "type": "string", + "default": "invalid_voucher", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Invalid Voucher", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a884c6be8c3756f42", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." } } - } - }, - "404": { - "description": "Returns an error if a resource is not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + }, + "e_400_invalid_validation_rules": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "description": "Error's HTTP status code.", + "default": 400 + }, + "key": { + "type": "string", + "default": "invalid_validation_rules", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + } + }, + "title": "Invalid Validation Rules", + "description": "Error: Bad Request → Invalid Validation Rules" + }, + "e_400_not_enough_codes": { + "title": "Not Enough Codes", + "type": "object", + "description": "Error: Bad Request → Not enough codes", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." }, - "examples": { - "Campaign Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id 1", - "request_id": "v-0bc40546e5d56508e5", - "resource_id": "1", - "resource_type": "campaign" - } - } + "key": { + "type": "string", + "default": "not_enough_codes", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Not enough codes", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "example": "Specify at least 1 code in codes.", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a885062c80375740f", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." } } - } - } - } - } - }, - "/v1/validation-object": { - "get": { - "operationId": "validation-object", - "tags": [ - "VALIDATIONS API" - ], - "summary": "Validation Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Validation Object", - "content": { - "application/json": { - "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_voucher_false" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher" - } - ] + }, + "e_400_metadata_validation_failed": { + "title": "Metadata Validation Failed", + "type": "object", + "description": "Error: Bad Request → Metadata validation failed", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "metadata_validation_failed", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Metadata validation failed", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "example": "Ranking: must be a number (actual value is 'true')", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a885062c80375740f", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." } } - } - } - } - } - }, - "/v1/vouchers/{code}/validate": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "Testing7fjWdr" - }, - "name": "code", - "in": "path", - "required": true, - "description": "A code that identifies the voucher." - } - ], - "post": { - "operationId": "validate-voucher", - "deprecated": true, - "tags": [ - "VALIDATIONS API" - ], - "summary": "Validate Voucher [Deprecated]", - "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for voucher validation, and we do not recommend using it. The new [Stackable Discounts API](ref:validate-stacked-discounts) 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. \n\nTo verify a voucher code given by a customer, you can use this method. It is designed for a server side integration, which means that is accessible only through private keys. \n\n\n> ❗️ Important \n>\n> This endpoint supports the validation of a single promo code. If you need to validate more than one incentive, you can use the [Stackable discounts API](ref:stackable-discounts-api). The stacking discounts API lets you validate up to 5 incentives per call. Before integrating Voucherify, choose which validation endpoint you prefer to use.\n\n#### Gift Vouchers - validate Gift Card and control amount to redeem\nVoucherify also gives the possibility to create a gift card, which allows using credits to fulfill the order. A user can specify how many credits he wants to use from the gift card. The available balance of credits is counted based on policy rules attached to the Gift Voucher definition. \n\nThis operation returns information about the validity of the code. Moreover, it returns a hashed source identifier which can be used as a tracking ID in future calls.\n\nIf a validation session is established, then the session details will be returned as well. Read more about sessions [here](doc:locking-validation-session).\n\nVoucher validation might fail because of one of these reasons:\n* `voucher not found` - voucher doesn't exist or was [deleted](ref:delete-voucher)\n* `voucher expired` - voucher is out of start date - expiration date time frame\n* `voucher is disabled` - learn more about a [disabled voucher](ref:disable-voucher)\n* `customer does not match segment rules` - learn more [customer tracking](doc:customers#customer-tracking) \n* `order does not match validation rules` - learn more about [validation rules](doc:validation-rules)", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the voucher validation context using the request body parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/6_req_validate_voucher" - }, - "examples": { - "Free Shipping": { - "value": { - "customer": { - "id": "cust_4vMj8Twr5nBzvTrNCgipMb6M" - }, - "order": { - "items": [ - { - "product_id": "prod_0ba621bae5d39762ce", - "quantity": "1" - }, - { - "product_id": "prod_0b661d404787ec6d3b", - "quantity": "1", - "price": 3100 - } - ] - } - } - }, - "Multiple Product Variants": { - "value": { - "customer": { - "source_id": "08dd9b5a-26de-44aa-a1d4-d9adfa9e8ec2" - }, - "order": { - "id": "ord_FDdsDI3FppuiqHa4s7drZEMP" - } - } + }, + "e_400_missing_reward": { + "title": "Missing Reward", + "type": "object", + "description": "Error: Bad Request → Missing Reward", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." }, - "Unit - Add order items": { - "value": { - "customer": { - "source_id": "08dd9b5a-26de-44aa-a1d4-d9adfa9e8ec2" - }, - "order": { - "source_id": "47f491d1-a697-4f92-95ca-2ba1f463efa8" - }, - "session": { - "type": "LOCK", - "ttl_unit": "NANOSECONDS", - "ttl": 1 - } - } + "key": { + "type": "string", + "default": "missing_reward", + "description": "Short string describing the kind of error which occurred." }, - "Fixed": { - "value": { - "customer": { - "source_id": "08dd9b5a-26de-44aa-a1d4-d9adfa9e8ec2" - }, - "order": { - "items": [ - { - "source_id": "webinar_BF_sweater_pink_sweater", - "quantity": "1", - "price": 6500, - "related_object": "product" - }, - { - "source_id": "webinar_BF_pants_navy_sweat_pants", - "quantity": "1", - "price": 6000, - "related_object": "product" - }, - { - "source_id": "5h1pp1ng", - "quantity": "1", - "price": 2000, - "related_object": "product" - }, - { - "source_id": "webinar_BF_pants_gray_sweat_pants", - "quantity": "2", - "price": 5000, - "related_object": "product" - }, - { - "source_id": "webinar_BF_sweater_pearl", - "quantity": "2", - "price": 11000, - "related_object": "product" - } - ] - }, - "session": { - "type": "LOCK" - } - } + "message": { + "type": "string", + "default": "Missing reward", + "description": "A human-readable message providing a short description about the error." }, - "Percentage": { - "value": { - "customer": { - "source_id": "your_customer_source_ID", - "name": "Bob Smith", - "description": "A frequent customer", - "email": "bob.smith@email.com", - "phone": "+1 933 222 3333", - "address": { - "city": "New York", - "country": "United States", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 5", - "postal_code": "10001", - "state": "NY" - }, - "metadata": { - "lang": "en", - "test": true - }, - "birthday": "1960-12-01" - }, - "order": { - "items": [ - { - "source_id": "webinar_BF_sweater_pink_sweater", - "quantity": "1", - "price": 6500, - "related_object": "product" - }, - { - "source_id": "webinar_BF_pants_navy_sweat_pants", - "quantity": "1", - "price": 6000, - "related_object": "product" - }, - { - "source_id": "5h1pp1ng", - "quantity": "1", - "price": 2000, - "related_object": "product" - }, - { - "source_id": "webinar_BF_pants_gray_sweat_pants", - "quantity": "2", - "price": 5000, - "related_object": "product" - }, - { - "source_id": "webinar_BF_sweater_pearl", - "quantity": "2", - "price": 11000, - "related_object": "product" - } - ] - }, - "session": { - "type": "LOCK", - "key": "your_custom_key", - "ttl_unit": "NANOSECONDS", - "ttl": 1 - } - } + "details": { + "type": "string", + "example": "A reward is required when redeeming a LOYALTY_CARD", + "description": "A human-readable message providing more details about the error." }, - "Amount": { - "value": { - "customer": { - "source_id": "your_customer_source_ID", - "name": "Bob Smith", - "description": "A frequent customer", - "email": "bob.smith@email.com", - "phone": "+1 933 222 3333", - "address": { - "city": "New York", - "country": "United States", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 5", - "postal_code": "10001", - "state": "NY" - }, - "metadata": { - "lang": "en", - "test": true - }, - "birthday": "1960-12-01" - }, - "order": { - "items": [ - { - "source_id": "webinar_BF_sweater_pink_sweater", - "quantity": "1", - "price": 6500, - "related_object": "product" - }, - { - "source_id": "webinar_BF_pants_navy_sweat_pants", - "quantity": "1", - "price": 6000, - "related_object": "product" - }, - { - "source_id": "5h1pp1ng", - "quantity": "1", - "price": 2000, - "related_object": "product" - }, - { - "source_id": "webinar_BF_pants_gray_sweat_pants", - "quantity": "2", - "price": 5000, - "related_object": "product" - }, - { - "source_id": "webinar_BF_sweater_pearl", - "quantity": "2", - "price": 11000, - "related_object": "product" - } - ], - "metadata": { - "currency": "EUR" - } - }, - "session": { - "type": "LOCK", - "key": "your_custom_key", - "ttl_unit": "NANOSECONDS", - "ttl": 1 - } - } + "request_id": { + "type": "string", + "example": "v-0a885062c80375740f", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." }, - "Loyalty Card": { - "value": { - "order": { - "items": [ - { - "product_id": "prod_0bd76fc58f8038b043", - "quantity": "1" - }, - { - "product_id": "prod_0bd76bd0e204542738", - "quantity": "1" - } - ] - }, - "reward": { - "id": "rew_4ZF6Y69U2PXE3GLIZxfozgg1", - "points": 10 - } - } + "resource_id": { + "type": "string", + "example": "rf_0b3a1814550e5aaa34", + "description": "Unique resource ID that can be used in another endpoint to get more details." }, - "Gift Card": { - "value": { - "customer": { - "source_id": "286401dc-6f4c-4ebb-8ca2-9f78b3e84c7d" - }, - "order": { - "amount": 1000, - "metadata": { - "currency": "USD" - } - }, - "gift": { - "credits": 2 - }, - "metadata": { - "location_id": [ - "L1" - ] - } - } + "resource_type": { + "type": "string", + "example": "redemption", + "description": "The resource type." }, - "Referral Code": { - "value": { - "customer": { - "source_id": "earlybirdcust" - }, - "order": { - "amount": 20000, - "metadata": { - "currency": "USD" - } - }, - "metadata": { - "location_id": [ - "L1" - ] + "error": { + "type": "object", + "description": "Contains error message translation.", + "properties": { + "message": { + "type": "string", + "example": "Missing reward = please add one.", + "description": "Error message translation defined in Dashboard → Project Settings → Error Messages" } } } } - } - } - }, - "responses": { - "200": { - "description": "Returns information whether the voucher is valid in the context of the parameter values provided in the request body.", - "content": { - "application/json": { - "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_voucher" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_false" - } - ] + }, + "e_400_missing_order": { + "title": "Missing Order", + "type": "object", + "description": "Error: Bad Request → Missing Order", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." }, - "examples": { - "False": { - "value": { - "valid": false, - "reason": "redemption does not match validation rules", - "error": { - "code": 400, - "key": "redemption_rules_violated", - "message": "redemption does not match validation rules", - "details": "Gift Card cannot be redeemed because of violated validation rules: val_wvipKm99CJuL", - "request_id": "v-0bccef7a9585cf63b6" - }, - "tracking_id": "track_ZGPtmYcM+Mw=", - "code": "vBQvYFEM", - "metadata": {} - } - }, - "Free Shipping": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_rynPcKGW2z7+kd2Vry4p12+Rx2NtyXZyiApdGWEXPrdX+44Fg6LRBQ==", - "order": { - "amount": 4300, - "total_amount": 4300, - "items": [ - { - "object": "order_item", - "product_id": "prod_0ba621bae5d39762ce", - "quantity": 1, - "amount": 1200, - "price": 1200, - "subtotal_amount": 1200, - "product": { - "id": "prod_0ba621bae5d39762ce", - "source_id": "arabica_plus", - "name": "Arabica Coffee 250g", - "price": 1200 - } - }, - { - "object": "order_item", - "product_id": "prod_0b661d404787ec6d3b", - "quantity": 1, - "amount": 3100, - "price": 3100, - "subtotal_amount": 3100, - "product": { - "id": "prod_0b661d404787ec6d3b", - "source_id": "7717f389-4621-4c7a-a6db-d4acfe051a97", - "name": "Kate Moss by Mario Testino" - } - }, - { - "object": "order_item", - "product_id": "prod_5h1pp1ng", - "quantity": 1, - "discount_quantity": 1, - "initial_quantity": 0, - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping" - } - } - ], - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "code": "Test - Discount - Free Shipping", - "discount": { - "type": "UNIT", - "effect": "ADD_MISSING_ITEMS", - "unit_off": 1, - "unit_type": "prod_5h1pp1ng", - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping" - } - }, - "metadata": {} - } - }, - "Multiple Product Varients": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_rynPcKGW2z7+kd2Vry4p12+Rx2NtyXZyiApdGWEXPrdX+44Fg6LRBQ==", - "order": { - "id": "ord_FDdsDI3FppuiqHa4s7drZEMP", - "source_id": "47f491d1-a697-4f92-95ca-2ba1f463efa8", - "created_at": "2022-09-21T13:09:25.773Z", - "updated_at": "2022-09-21T13:09:27.139Z", - "status": "PAID", - "amount": 237300, - "initial_amount": 28000, - "discount_amount": 8400, - "items_discount_amount": 209300, - "total_discount_amount": 217700, - "total_amount": 19600, - "items_applied_discount_amount": 209300, - "total_applied_discount_amount": 209300, - "items": [ - { - "object": "order_item", - "source_id": "A0E20000000295J", - "related_object": "sku", - "product_id": "prod_0b661d31134b299cc2", - "quantity": 1, - "amount": 9500, - "price": 9500, - "subtotal_amount": 9500, - "product": { - "id": "prod_0b661d31134b299cc2", - "source_id": "2c446063-d582-4d7e-9651-23971b3e56f7", - "name": "Keychain D‘Amico" - }, - "sku": { - "id": "sku_0b661d6265cb29ae52", - "source_id": "A0E20000000295J", - "sku": "Keychain D‘Amico", - "metadata": {}, - "price": 9500 - } - }, - { - "object": "order_item", - "source_id": "M0E20000000EAT6", - "related_object": "sku", - "quantity": 1, - "amount": 18500, - "price": 18500, - "subtotal_amount": 18500, - "product": { - "name": "Jogging pants Paolo Pecora light grey" - }, - "sku": { - "sku": "Jogging pants Paolo Pecora light grey", - "metadata": {} - } - }, - { - "object": "order_item", - "product_id": "prod_5h1pp1ng", - "quantity": 1, - "discount_quantity": 1, - "initial_quantity": 0, - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping" - } - }, - { - "object": "order_item", - "product_id": "prod_0b661d4bd2c7ec7d1f", - "sku_id": "sku_0b661e41fc8d35a8f7", - "quantity": 3, - "discount_quantity": 3, - "initial_quantity": 0, - "amount": 89700, - "discount_amount": 89700, - "initial_amount": 0, - "applied_discount_amount": 89700, - "price": 29900, - "subtotal_amount": 0, - "product": { - "id": "prod_0b661d4bd2c7ec7d1f", - "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", - "name": "Casual jacket Michael Kors beige" - }, - "sku": { - "id": "sku_0b661e41fc8d35a8f7", - "source_id": "M0E20000000ELDG", - "sku": "Casual jacket Michael Kors beige", - "price": 29900 - } - }, - { - "object": "order_item", - "product_id": "prod_0b661d4bd2c7ec7d1f", - "sku_id": "sku_0b661e41fc8d35a8f6", - "quantity": 4, - "discount_quantity": 4, - "initial_quantity": 0, - "amount": 119600, - "discount_amount": 119600, - "initial_amount": 0, - "applied_discount_amount": 119600, - "price": 29900, - "subtotal_amount": 0, - "product": { - "id": "prod_0b661d4bd2c7ec7d1f", - "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", - "name": "Casual jacket Michael Kors beige" - }, - "sku": { - "id": "sku_0b661e41fc8d35a8f6", - "source_id": "M0E20000000ELDF", - "sku": "Casual jacket Michael Kors beige", - "price": 29900 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "object": "customer" - }, - "customer_id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0bb9c69ca9d5a364b2": { - "date": "2022-09-21T13:09:25.799Z", - "related_object_type": "redemption", - "related_object_id": "r_0bb9c69ca9d5a364b2", - "stacked": [ - "r_0bb9c69ca9d5a364b3", - "r_0bb9c69ca9d5a364b4" - ] - } - } - }, - "code": "Test - Discount - Unit - Multiple - Product Variants", - "discount": { - "type": "UNIT", - "effect": "ADD_MANY_ITEMS", - "units": [ - { - "effect": "ADD_MISSING_ITEMS", - "unit_off": 3, - "unit_type": "sku_0b661e41fc8d35a8f7", - "sku": { - "id": "sku_0b661e41fc8d35a8f7", - "source_id": "M0E20000000ELDG", - "sku": "Casual jacket Michael Kors beige" - }, - "product": { - "id": "prod_0b661d4bd2c7ec7d1f", - "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", - "name": "Casual jacket Michael Kors beige" - } - }, - { - "effect": "ADD_NEW_ITEMS", - "unit_off": 4, - "unit_type": "sku_0b661e41fc8d35a8f6", - "sku": { - "id": "sku_0b661e41fc8d35a8f6", - "source_id": "M0E20000000ELDF", - "sku": "Casual jacket Michael Kors beige" - }, - "product": { - "id": "prod_0b661d4bd2c7ec7d1f", - "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", - "name": "Casual jacket Michael Kors beige" - } - } - ] - }, - "metadata": {} - } - }, - "Unit - Add order items": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_rynPcKGW2z7+kd2Vry4p12+Rx2NtyXZyiApdGWEXPrdX+44Fg6LRBQ==", - "session": { - "key": "ssn_K7DV3RbAGNCRVrPNZxJfld3FdwAQwOGl", - "type": "LOCK", - "ttl": 1, - "ttl_unit": "NANOSECONDS" - }, - "order": { - "id": "ord_FDdsDI3FppuiqHa4s7drZEMP", - "source_id": "47f491d1-a697-4f92-95ca-2ba1f463efa8", - "created_at": "2022-09-21T13:09:25.773Z", - "updated_at": "2022-09-21T13:09:27.139Z", - "status": "PAID", - "amount": 117700, - "initial_amount": 28000, - "discount_amount": 8400, - "items_discount_amount": 89700, - "total_discount_amount": 98100, - "total_amount": 19600, - "items_applied_discount_amount": 89700, - "total_applied_discount_amount": 89700, - "items": [ - { - "object": "order_item", - "source_id": "A0E20000000295J", - "related_object": "sku", - "product_id": "prod_0b661d31134b299cc2", - "quantity": 1, - "amount": 9500, - "price": 9500, - "subtotal_amount": 9500, - "product": { - "id": "prod_0b661d31134b299cc2", - "source_id": "2c446063-d582-4d7e-9651-23971b3e56f7", - "name": "Keychain D‘Amico" - }, - "sku": { - "id": "sku_0b661d6265cb29ae52", - "source_id": "A0E20000000295J", - "sku": "Keychain D‘Amico", - "metadata": {}, - "price": 9500 - } - }, - { - "object": "order_item", - "source_id": "M0E20000000EAT6", - "related_object": "sku", - "quantity": 1, - "amount": 18500, - "price": 18500, - "subtotal_amount": 18500, - "product": { - "name": "Jogging pants Paolo Pecora light grey" - }, - "sku": { - "sku": "Jogging pants Paolo Pecora light grey", - "metadata": {} - } - }, - { - "object": "order_item", - "product_id": "prod_5h1pp1ng", - "quantity": 1, - "discount_quantity": 1, - "initial_quantity": 0, - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping" - } - }, - { - "object": "order_item", - "product_id": "prod_0b661d4bd2c7ec7d1f", - "sku_id": "sku_0b661e41fc8d35a8f8", - "quantity": 3, - "discount_quantity": 3, - "initial_quantity": 0, - "amount": 89700, - "discount_amount": 89700, - "initial_amount": 0, - "applied_discount_amount": 89700, - "price": 29900, - "subtotal_amount": 0, - "product": { - "id": "prod_0b661d4bd2c7ec7d1f", - "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", - "name": "Casual jacket Michael Kors beige" - }, - "sku": { - "id": "sku_0b661e41fc8d35a8f8", - "source_id": "M0E20000000ELDH", - "sku": "Casual jacket Michael Kors beige", - "price": 29900 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "object": "customer" - }, - "customer_id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0bb9c69ca9d5a364b2": { - "date": "2022-09-21T13:09:25.799Z", - "related_object_type": "redemption", - "related_object_id": "r_0bb9c69ca9d5a364b2", - "stacked": [ - "r_0bb9c69ca9d5a364b3", - "r_0bb9c69ca9d5a364b4" - ] - } - } - }, - "code": "Test - Discount - Unit - Add new order items", - "discount": { - "type": "UNIT", - "effect": "ADD_NEW_ITEMS", - "unit_off": 3, - "unit_type": "sku_0b661e41fc8d35a8f8", - "sku": { - "id": "sku_0b661e41fc8d35a8f8", - "source_id": "M0E20000000ELDH", - "sku": "Casual jacket Michael Kors beige" - }, - "product": { - "id": "prod_0b661d4bd2c7ec7d1f", - "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", - "name": "Casual jacket Michael Kors beige" - } - }, - "metadata": {} - } - }, - "Fixed": { - "value": { - "valid": true, - "applicable_to": { - "data": [ - { - "object": "product", - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "strict": false, - "price": 2000, - "price_formula": "IF(ORDER_AMOUNT > 400;0;20)", - "effect": "APPLY_TO_EVERY" - }, - { - "object": "products_collection", - "id": "pc_2KWKXn09Dk8neCfymqd4xOq8", - "strict": false, - "price": 99900, - "price_formula": "IF(ORDER_AMOUNT > 300;ORDER_ITEM_PRICE * 0.8;ORDER_ITEM_PRICE)", - "effect": "APPLY_TO_EVERY" - }, - { - "object": "products_collection", - "id": "pc_x7HELQo52g2uI6nDuuOTRjAW", - "strict": false, - "price": 99900, - "price_formula": "IF(ORDER_AMOUNT > 200;ORDER_ITEM_PRICE * 0.9;ORDER_ITEM_PRICE)", - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0bd76ca337954ca116", - "source_id": "webinar_BF_sweater_pink_sweater", - "strict": true, - "price": 99900, - "price_formula": "IF(ORDER_AMOUNT > 300;ORDER_ITEM_PRICE * 0.8;ORDER_ITEM_PRICE)", - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0bd76bd0e204542738", - "source_id": "webinar_BF_pants_navy_sweat_pants", - "strict": true, - "price": 99900, - "price_formula": "IF(ORDER_AMOUNT > 200;ORDER_ITEM_PRICE * 0.9;ORDER_ITEM_PRICE)", - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0bd76b8656956a183f", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "strict": true, - "price": 99900, - "price_formula": "IF(ORDER_AMOUNT > 200;ORDER_ITEM_PRICE * 0.9;ORDER_ITEM_PRICE)", - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0bd76f59f98617518e", - "source_id": "webinar_BF_sweater_pearl", - "strict": true, - "price": 99900, - "price_formula": "IF(ORDER_AMOUNT > 300;ORDER_ITEM_PRICE * 0.8;ORDER_ITEM_PRICE)", - "effect": "APPLY_TO_EVERY" - } - ], - "total": 7, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_rynPcKGW2z7+kd2Vry4p12+Rx2NtyXZyiApdGWEXPrdX+44Fg6LRBQ==", - "session": { - "key": "ssn_u8rvi3Ac70S5ZRELWrxYsR2bnolpVWNg", - "type": "LOCK", - "ttl": 7, - "ttl_unit": "DAYS" - }, - "order": { - "amount": 46500, - "items_discount_amount": 9300, - "total_discount_amount": 9300, - "total_amount": 37200, - "items_applied_discount_amount": 9300, - "total_applied_discount_amount": 9300, - "items": [ - { - "object": "order_item", - "source_id": "webinar_BF_sweater_pink_sweater", - "related_object": "product", - "quantity": 1, - "amount": 6500, - "discount_amount": 1300, - "applied_discount_amount": 1300, - "price": 6500, - "subtotal_amount": 5200, - "product": { - "id": "prod_0bd76ca337954ca116", - "source_id": "webinar_BF_sweater_pink_sweater", - "name": "Pink Sweater", - "price": 6500 - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_pants_navy_sweat_pants", - "related_object": "product", - "quantity": 1, - "amount": 6000, - "discount_amount": 600, - "applied_discount_amount": 600, - "price": 6000, - "subtotal_amount": 5400, - "product": { - "id": "prod_0bd76bd0e204542738", - "source_id": "webinar_BF_pants_navy_sweat_pants", - "name": "Navy Sweat Pants", - "price": 6000 - } - }, - { - "object": "order_item", - "source_id": "5h1pp1ng", - "related_object": "product", - "quantity": 1, - "amount": 2000, - "discount_amount": 2000, - "applied_discount_amount": 2000, - "price": 2000, - "subtotal_amount": 0, - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping", - "price": 0 - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "related_object": "product", - "quantity": 2, - "amount": 10000, - "discount_amount": 1000, - "applied_discount_amount": 1000, - "price": 5000, - "subtotal_amount": 9000, - "product": { - "id": "prod_0bd76b8656956a183f", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "name": "Gray Sweat Pants", - "price": 5000 - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_sweater_pearl", - "related_object": "product", - "quantity": 2, - "amount": 22000, - "discount_amount": 4400, - "applied_discount_amount": 4400, - "price": 11000, - "subtotal_amount": 17600, - "product": { - "id": "prod_0bd76f59f98617518e", - "source_id": "webinar_BF_sweater_pearl", - "name": "Pearl Sweater", - "price": 11000 - } - } - ], - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "code": "SPENDMOREGETMORE-DaIXFJvn", - "discount": { - "type": "FIXED", - "effect": "APPLY_TO_ITEMS" - }, - "metadata": { - "shoutout": "Order more than 200€ to get 10% off pants, more than 300€ to get 20% off sweaters, and more than 400€ to get free shipping." - }, - "campaign": "SPENDMOREGETMORE", - "campaign_id": "camp_Nwb2mppeDTtk23s1FVo6riwp" - } - }, - "Voucher expired": { - "value": { - "valid": false, - "reason": "voucher expired", - "error": { - "code": 400, - "key": "voucher_expired", - "message": "voucher expired", - "details": "EarlyBird-tB6zCApA", - "request_id": "v-0be43067028abb6ca8" - }, - "tracking_id": "track_4Wb/eeza4PDXKElxYR/QtlDQOVFpY9mP", - "code": "EarlyBird-tB6zCApA", - "metadata": { - "shoutout": "Get an early bird special. The earlier you order, the better discount you will get." - } - } - }, - "Percentage": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_4Wb/eeza4PDXKElxYR/QtlDQOVFpY9mP", - "session": { - "key": "your_custom_key", - "type": "LOCK", - "ttl": 1, - "ttl_unit": "NANOSECONDS" - }, - "order": { - "amount": 46500, - "discount_amount": 4650, - "total_discount_amount": 4650, - "total_amount": 41850, - "applied_discount_amount": 4650, - "total_applied_discount_amount": 4650, - "items": [ - { - "object": "order_item", - "source_id": "webinar_BF_sweater_pink_sweater", - "related_object": "product", - "quantity": 1, - "amount": 6500, - "price": 6500, - "subtotal_amount": 6500, - "product": { - "id": "prod_0bd76ca337954ca116", - "source_id": "webinar_BF_sweater_pink_sweater", - "name": "Pink Sweater", - "price": 6500 - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_pants_navy_sweat_pants", - "related_object": "product", - "quantity": 1, - "amount": 6000, - "price": 6000, - "subtotal_amount": 6000, - "product": { - "id": "prod_0bd76bd0e204542738", - "source_id": "webinar_BF_pants_navy_sweat_pants", - "name": "Navy Sweat Pants", - "price": 6000 - } - }, - { - "object": "order_item", - "source_id": "5h1pp1ng", - "related_object": "product", - "quantity": 1, - "amount": 2000, - "price": 2000, - "subtotal_amount": 2000, - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping", - "price": 0 - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "related_object": "product", - "quantity": 2, - "amount": 10000, - "price": 5000, - "subtotal_amount": 10000, - "product": { - "id": "prod_0bd76b8656956a183f", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "name": "Gray Sweat Pants", - "price": 5000 - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_sweater_pearl", - "related_object": "product", - "quantity": 2, - "amount": 22000, - "price": 11000, - "subtotal_amount": 22000, - "product": { - "id": "prod_0bd76f59f98617518e", - "source_id": "webinar_BF_sweater_pearl", - "name": "Pearl Sweater", - "price": 11000 - } - } - ], - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "code": "EarlyBird-tB6zCApA", - "discount": { - "type": "PERCENT", - "effect": "APPLY_TO_ORDER", - "percent_off": 10 - }, - "expiration_date": "2022-10-29T00:00:00.000Z", - "metadata": { - "shoutout": "Get an early bird special. The earlier you order, the better discount you will get." - }, - "campaign": "Webinar - Early Bird Scenario", - "campaign_id": "camp_z1g3iFqQe5qiZ9TTYFVpMwC0" - } - }, - "Amount": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_4Wb/eeza4PDXKElxYR/QtlDQOVFpY9mP", - "session": { - "key": "your_custom_key", - "type": "LOCK", - "ttl": 1, - "ttl_unit": "NANOSECONDS" - }, - "order": { - "amount": 46500, - "discount_amount": 1000, - "total_discount_amount": 1000, - "total_amount": 45500, - "applied_discount_amount": 1000, - "total_applied_discount_amount": 1000, - "items": [ - { - "object": "order_item", - "source_id": "webinar_BF_sweater_pink_sweater", - "related_object": "product", - "quantity": 1, - "amount": 6500, - "price": 6500, - "subtotal_amount": 6500, - "product": { - "id": "prod_0bd76ca337954ca116", - "source_id": "webinar_BF_sweater_pink_sweater", - "name": "Pink Sweater", - "price": 6500 - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_pants_navy_sweat_pants", - "related_object": "product", - "quantity": 1, - "amount": 6000, - "price": 6000, - "subtotal_amount": 6000, - "product": { - "id": "prod_0bd76bd0e204542738", - "source_id": "webinar_BF_pants_navy_sweat_pants", - "name": "Navy Sweat Pants", - "price": 6000 - } - }, - { - "object": "order_item", - "source_id": "5h1pp1ng", - "related_object": "product", - "quantity": 1, - "amount": 2000, - "price": 2000, - "subtotal_amount": 2000, - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping", - "price": 0 - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "related_object": "product", - "quantity": 2, - "amount": 10000, - "price": 5000, - "subtotal_amount": 10000, - "product": { - "id": "prod_0bd76b8656956a183f", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "name": "Gray Sweat Pants", - "price": 5000 - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_sweater_pearl", - "related_object": "product", - "quantity": 2, - "amount": 22000, - "price": 11000, - "subtotal_amount": 22000, - "product": { - "id": "prod_0bd76f59f98617518e", - "source_id": "webinar_BF_sweater_pearl", - "name": "Pearl Sweater", - "price": 11000 - } - } - ], - "metadata": { - "currency": "EUR" - }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "code": "PAYINEUROS", - "discount": { - "type": "AMOUNT", - "effect": "APPLY_TO_ORDER", - "amount_off": 1000 - }, - "metadata": { - "shoutout": "Pay in euros to get 10 Euros off, any other currency to get 5 off in that currency." - } - } - }, - "Loyalty points exceeded": { - "value": { - "valid": false, - "reason": "loyalty card points exceeded", - "error": { - "code": 400, - "key": "loyalty_card_points_exceeded", - "message": "loyalty card points exceeded", - "details": "LOYALTY-CARD-ng3Kb9tM", - "request_id": "v-0be434ae35cabb018a" - }, - "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", - "code": "LOYALTY-CARD-ng3Kb9tM", - "metadata": {} - } - }, - "Loyalty Card": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", - "order": { - "amount": 14500, - "discount_amount": 50, - "total_discount_amount": 50, - "total_amount": 14450, - "applied_discount_amount": 50, - "total_applied_discount_amount": 50, - "items": [ - { - "object": "order_item", - "product_id": "prod_0bd76fc58f8038b043", - "quantity": 1, - "amount": 8500, - "price": 8500, - "subtotal_amount": 8500, - "product": { - "id": "prod_0bd76fc58f8038b043", - "source_id": "webinar_BF_sweater_yellow", - "name": "Yellow Sweater", - "price": 8500 - } - }, - { - "object": "order_item", - "product_id": "prod_0bd76bd0e204542738", - "quantity": 1, - "amount": 6000, - "price": 6000, - "subtotal_amount": 6000, - "product": { - "id": "prod_0bd76bd0e204542738", - "source_id": "webinar_BF_pants_navy_sweat_pants", - "name": "Navy Sweat Pants", - "price": 6000 - } - } - ], - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "code": "LOYALTY-CARD-ng3Kb9tM", - "loyalty": { - "points_cost": 10 - }, - "reward": { - "id": "rew_4ZF6Y69U2PXE3GLIZxfozgg1", - "assignment_id": "rewa_WkeBlLhj0sRae70J5AAvLbmy", - "points": 10 - }, - "metadata": {}, - "campaign": "Loyalty Campaign", - "campaign_id": "camp_ZNb23Xtw1WuGCm7gdax84PUi" - } - }, - "Voucher disabled": { - "value": { - "valid": false, - "reason": "voucher is disabled", - "error": { - "code": 400, - "key": "voucher_disabled", - "message": "voucher is disabled", - "details": "GIFT-CARD-kW4aEsfB", - "request_id": "v-0be43817d7121a437d" - }, - "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", - "code": "GIFT-CARD-kW4aEsfB", - "metadata": {} - } - }, - "Gift Card": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", - "order": { - "amount": 1000, - "discount_amount": 2, - "total_discount_amount": 2, - "total_amount": 998, - "applied_discount_amount": 2, - "total_applied_discount_amount": 2, - "metadata": { - "currency": "USD" - }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "code": "GIFT-CARD-kW4aEsfB", - "gift": { - "amount": 32000, - "balance": 21500, - "effect": "APPLY_TO_ORDER" - }, - "metadata": {}, - "campaign": "Gift Card Campaign", - "campaign_id": "camp_ZjoZEdmnyUCPYwMPN0IVbvDK" - } - }, - "Cannot be redeemed by referrer": { - "value": { - "valid": false, - "reason": "voucher cannot be redeemed by referrer", - "error": { - "code": 400, - "key": "referrer_not_permitted_to_redeem", - "message": "voucher cannot be redeemed by referrer", - "details": "REFERRAL-CODE-OxBakPYf", - "request_id": "v-0be43a8a110abb1bd3" - }, - "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", - "code": "REFERRAL-CODE-OxBakPYf", - "metadata": {} - } - }, - "Referral Code": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_p6hPsnZj2VSvyXDjH9o6aQ==", - "order": { - "amount": 20000, - "discount_amount": 6000, - "total_discount_amount": 6000, - "total_amount": 14000, - "applied_discount_amount": 6000, - "total_applied_discount_amount": 6000, - "metadata": { - "currency": "USD" - }, - "referrer": { - "id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "object": "customer" - }, - "customer_id": null, - "referrer_id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "object": "order" - }, - "code": "REFERRAL-CODE-OxBakPYf", - "discount": { - "type": "PERCENT", - "effect": "APPLY_TO_ORDER", - "percent_off": 30 - }, - "metadata": {}, - "campaign": "Referral Campaign", - "campaign_id": "camp_TnOf5NB4Jtjxwoq38WckMJfy" + "key": { + "type": "string", + "default": "missing_order", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Missing order", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "example": "An order is required when redeeming a LOYALTY_CARD", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a885062c80375740f", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + }, + "resource_id": { + "type": "string", + "example": "rf_0b3a1814550e5aaa34", + "description": "Unique resource ID that can be used in another endpoint to get more details." + }, + "resource_type": { + "type": "string", + "example": "redemption", + "description": "The resource type." + }, + "error": { + "type": "object", + "description": "Contains error message translation.", + "properties": { + "message": { + "type": "string", + "example": "Missing order = please add one.", + "description": "Error message translation defined in Dashboard → Project Settings → Error Messages" } } } } - } - }, - "400": { - "description": "Returns an error if request body is missing parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error" - }, - "examples": { - "Missing reward": { - "value": { - "code": 400, - "key": "missing_reward", - "message": "Missing reward", - "details": "A reward is required when redeeming a LOYALTY_CARD", - "request_id": "v-0bcb925c6d90f7f8fc", - "error": { - "message": "Missing reward = please add one." - } - } - }, - "Missing Parameter": { - "value": { - "code": 400, - "key": "missing_order_items_amount", - "message": "Missing applicable order items", - "details": "At least one applicable order item with amount is required to redeem this GIFT_VOUCHER", - "request_id": "v-0bcccfd04085cf2540", - "error": { - "message": "Request should contain an amount for the item." - } - } - }, - "Metadata Validation Failed": { - "value": { - "code": 400, - "key": "metadata_validation_failed", - "message": "Metadata validation failed", - "details": "location_id: must be an array, and every element: must be a string, must be equal to one of L1,L2,L3 (actual value is 'L1')", - "request_id": "v-0bcced27715305d3fa" + }, + "e_400_loyalty_card_points_exceeded": { + "title": "Loyalty Card Points Exceeded", + "type": "object", + "description": "Error: Bad Request → Loyalty Card Points Exceeded", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "loyalty_card_points_exceeded", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "loyalty card points exceeded", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "example": "SoAm6kbC", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a885062c80375740f", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + }, + "resource_id": { + "type": "string", + "example": "rf_0b3a1814550e5aaa34", + "description": "Unique resource ID that can be used in another endpoint to get more details." + }, + "resource_type": { + "type": "string", + "example": "redemption", + "description": "The resource type." + }, + "error": { + "type": "object", + "description": "Contains error message translation.", + "properties": { + "message": { + "type": "string", + "example": "There are not enough loyalty points on the card.", + "description": "Error message translation defined in Dashboard → Project Settings → Error Messages" } } } } - } - } - } - } - }, - "/client/v1/validate": { - "get": { - "operationId": "validate-voucher-client-side", - "deprecated": true, - "tags": [ - "VALIDATIONS API" - ], - "summary": "Validate Voucher (client-side) [Deprecated]", - "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for voucher validation, and we do not recommend using it. The new [Stackable Discounts API](ref:validate-stacked-discounts-client-side) 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. \n\nTo verify a voucher code given by customer, you can use this method. It is designed for client side integration which means that is accessible only through public keys. This method is designed to be run directly either in web browsers or mobile apps.\n\n> ❗️ Specifying gift credits and loyalty points\n>\n> This endpoint does not support specifying the specific amount of gift credits to apply to an order nor the specific amount of loyalty points to an order. It calculates the amount that is available on the card and applies as much credits or points as possible to cover the total amount. \n\n### Set customer identity (optional)\n\nVoucherify can help you track anonymous customers. Once you integrate Voucherify into your web app and call the validate method, Voucherify will return a tracking ID and the script will store it in a cookie. Each subsequent validate call will use the same tracking ID.\n\nVoucherify tracks a user using a tracking ID to see if the user who is validating vouchers is the same as the one who consuming them. Voucherify does this by setting up an identity for the user. A `tracking_id` will be generated on the server side, unless you specify your own `tracking_id`. In both cases, you will receive the `tracking_id` in the validation response.\n\nThe returned `tracking_id` field should be used as the customer `source_id` in subsequent redemption requests. Moreover, the `tracking_id` returned from Validation API is encoded. Voucherify will recognize both values for identifying customer - the one before encryption sent as a query parameter to the **GET** `/validate` request, and the version encrypted and returned as part of the validation request.\n\n### Sample workflow\n\nCustomer tracking workflow in a nutshell:\n\n**Client-side:**\n * A customer visits your website.\n * A customer validates a voucher code. That triggers a validate request to be sent to Voucherify. In the request, you pass the tracking_id or customer.source_id. As a result, the API call to this endpoint returns an **encoded** `tracking_id`.\n\n**Backend:**\n * Once the customer finishes the checkout process, your website passes the `tracking_id` to your backend during a redemption call. The `tracking_id` is sent as a value assigned to the property *source_id* in a customer object.\n * A customer object is created and within the redemption response, you get a customer `id`.\n * You can use the customer `id` or the customer `source_id` to fetch or modify the customer details.\n \nA customer is created (upserted) automatically with a redemption call. Alternatively, you can create a new profile by creating a customer via a dedicated API method. Take a look at the customer object to understand the [entity's structure](ref:get-customer). \n\n\n\n> 📘 Customer identifier\n>\n> The source id of the customer may either be an already hashed version of the `tracking_id`, which you received in a response from a validation request or a custom ID you predefined (i.e. an email address). Nevertheless, we recommend using identifiers delivered by Voucherify API.\n\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -H \"origin: yourdomain.com\" \\\n 'https://api.voucherify.io/client/v1/validate?code=PAYINEUROS&session_type=LOCK&session_key=A&session_ttl=1&session_ttl_unit=NANOSECONDS&customer=cust_4vMj8Twr5nBzvTrNCgipMb6M&[order][metadata][currency]=EUR&[metadata][location_id][0]=L1&[item][0][source_id]=webinar_BF_sweater_pink_sweater&[item][0][quantity]=2&[item][0][related_object]=product'\n```\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -H \"origin: yourdomain.com\" \\\n 'https://api.voucherify.io/client/v1/validate?code=LOYALTY-CARD-ng3Kb9tM&session_type=LOCK&session_key=A&session_ttl=1&session_ttl_unit=NANOSECONDS&customer[source_id]=286401dc-6f4c-4ebb-8ca2-9f78b3e84c7d&[order][metadata][currency]=EUR&[customer][metadata][age]=24&[customer][metadata][acquisition_channel]=Facebook&[metadata][location_id][0]=L1&[item][0][source_id]=webinar_BF_sweater_pink_sweater&[item][0][quantity]=2&[item][0][related_object]=product&[item][1][source_id]=webinar_BF_pants_gray_sweat_pants&[item][1][quantity]=2&[item][1][related_object]=product&[item][2][product_id]=prod_0bd76bb4aa003890cb&[item][2][quantity]=2&[item][3][source_id]=M0E20000000ELDH&[item][3][quantity]=3&[item][3][related_object]=sku'\n```\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -H \"origin: yourdomain.com\" \\\n 'https://api.voucherify.io/client/v1/validate?code=GIFT-CARD-kW4aEsfB&session_type=LOCK&session_key=A&session_ttl=1&session_ttl_unit=NANOSECONDS&customer[source_id]=286401dc-6f4c-4ebb-8ca2-9f78b3e84c7d&[order][metadata][currency]=EUR&[customer][metadata][age]=24&[customer][metadata][acquisition_channel]=Facebook&[metadata][location_id][0]=L1&[item][0][source_id]=webinar_BF_sweater_pink_sweater&[item][0][quantity]=2&[item][0][related_object]=product&[item][1][source_id]=webinar_BF_pants_gray_sweat_pants&[item][1][quantity]=2&[item][1][related_object]=product&[item][2][product_id]=prod_0bd76bb4aa003890cb&[item][2][quantity]=2&[item][3][source_id]=M0E20000000ELDH&[item][3][quantity]=3&[item][3][related_object]=sku&[item][4][sku_id]=sku_0b661e41fc0d35a8f1&[item][4][quantity]=4'\n```\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -H \"origin: yourdomain.com\" \\\n 'https://api.voucherify.io/client/v1/validate?code=REFERRAL-CODE-OxBakPYf&amount=10000'\n```\n\n### [JSFiddle Example](https://jsfiddle.net/voucherify/gfu2bgn5/)\n\n```javascript\n\n\n\n```\n\n### Examples with Query Parameters\n\n| **Query Parameters** | **Example URL** |\n|:---|:---|\n| Shortcut - `customer` query param instead of `customer[source_id]` | `https://api.voucherify.io/client/v1/validate?code=sKKFCKLZ&amount=10100&customer=customer_id` |\n| Pass `customer`'s and `redemption`'s context `metadata` in query parameters | `https://api.voucherify.io/client/v1/validate?code=sKKFCKLZ&amount=10100&customer=sure_he_is_new&metadata[shop]=1&customer[metadata][propsy]=2&metadata[test]=true` |\n| Use `tracking_id` instead of `source_id` | `https://api.voucherify.io/client/v1/validate?code=IKU-mvS-JOG&amount=10100&tracking_id=sure_he_is_new_5&metadata[shop]=1&metadata[test]=true` |\n\n### Reasons why a validation might fail\n\nVoucher validation might fail because of one of these reasons:\n\n* `voucher not found` - voucher doesn't exist or was [deleted](ref:delete-voucher)\n* `voucher expired` - voucher is out of [start date - expiration date] timeframe\n* `voucher is disabled` - learn more about [disabled vouchers](ref:disable-voucher)\n* `customer does not match segment rules` - learn more customer tracking LINK\n* `order does not match validation rules` - learn more about validation rules LINK", - "parameters": [ - { - "$ref": "#/components/parameters/origin" - }, - { - "schema": { - "type": "string", - "example": "7fjWdr" }, - "in": "query", - "name": "code", - "description": "A code that identifies the voucher." - }, - { - "schema": { - "type": "string" + "e_403_wrong_api_endpoint": { + "title": "Wrong API Endpoint", + "type": "object", + "description": "Error: Forbidden → Wrong API Endpoint", + "properties": { + "code": { + "type": "integer", + "default": 403, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "wrong_api_endpoint", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Wrong API endpoint", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "example": "Given project is bound to different API endpoint, you should use: https://api.voucherify.io", + "description": "A human-readable message providing more details about the error." + } + } }, - "in": "query", - "name": "tracking_id", - "description": "A tracking identifier of a user that validated the voucher. This identifier is generated during voucher validation based on your internal ID (e.g., email, database ID) during the first request. This is a hashed customer source ID. If the request is performed for the first time, pass the internal ID to track the customer. **Although not all information is required, the extra information helps prevent fraud.**" - }, - { - "schema": { - "type": "string" + "e_404_not_found": { + "description": "Error: Not Found", + "type": "object", + "title": "Not Found", + "properties": { + "code": { + "type": "integer", + "default": 404, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "not_found", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Resource not found", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a96cd820301c0483a", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + }, + "resource_id": { + "type": "string", + "description": "Name or ID of the resource that was not found." + }, + "resource_type": { + "type": "string", + "description": "Specifies the type of resource that was not found." + } + } }, - "in": "query", - "name": "amount", - "description": "A positive integer in the smallest currency unit (that is, 100 cents for $1.00) representing the total amount of the order. This amount is the sum of the order items' amounts." - }, - { - "schema": { - "type": "string", - "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" + "e_409_duplicate_found": { + "title": "Duplicated Resource", + "type": "object", + "description": "Error: Conflict → Duplicated resource found", + "properties": { + "code": { + "type": "integer", + "default": 409, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "duplicate_found", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Duplicated resource found", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0aa36e570e44cb3bdd", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + }, + "resource_id": { + "type": "string", + "description": "Name or ID of the resource that already exists." + }, + "resource_type": { + "type": "string", + "description": "Specifies the type of resource that already exists." + } + } }, - "in": "query", - "name": "session_key", - "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated." - }, - { - "schema": { - "type": "integer" + "e_400_duplicate_key": { + "title": "Duplicated Key", + "type": "object", + "description": "Error: Conflict → Duplicated key found", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "duplicate_key", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Duplicate codes", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0aa36e570e44cb3bdd", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + } + } }, - "in": "query", - "name": "session_ttl", - "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session_ttl_unit` parameter." - }, - { - "schema": { - "type": "string", - "enum": [ - "HOURS", - "DAYS", - "MINUTES", - "SECONDS", - "MILLISECONDS", - "MICROSECONDS", - "NANOSECONDS" - ] + "e_400_duplicate_source_id": { + "title": "Duplicate Source ID", + "type": "object", + "description": "Error: Conflict → Duplicate source_id found", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "duplicate_source_id", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Duplicate source_id", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0aa36e570e44cb3bdd", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + } + } }, - "in": "query", - "name": "session_ttl_unit", - "description": "Defines the type of unit in which the session time is counted." - }, - { - "$ref": "#/components/parameters/metadata" - }, - { - "$ref": "#/components/parameters/item" - }, - { - "schema": { - "type": "string" + "product_collections_get_response_body": { + "$ref": "#/components/schemas/product_collections_collection_item", + "description": "\"Response body schema for **GET** `/product-collections/{collectionId}`.\",", + "title": "Get Product Collection Response Body" }, - "in": "query", - "name": "session_type", - "description": "The session is required to establish a session between multiple parallel validation and redemption requests. This parameter is required to establish a new session. The session locks the **redemption quantity by 1** and additionally the redemption **gift credits** specified within the request for a gift card and the **loyalty points** for a loyalty card." - }, - { - "name": "customer", - "in": "query", - "required": false, - "schema": { - "anyOf": [ + "product_collections_collection_item": { + "title": "Product Collection Object", + "description": "This is an object representing a product collection. \n\nThe products can be grouped into collections by the creation of a products collection object. You can retrieve a product collection and a list of products in the collection. Product collections are identified by a unique ID.", + "x-tags": [ + "PRODUCT COLLECTIONS API" + ], + "allOf": [ { - "type": "object", - "title": "Customer details", - "description": "Customer source ID and/or customer metadata.", - "properties": { - "source_id": { - "type": "string", - "description": "Customer source ID.", - "example": "name.lastname@email.com" - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments.", - "style": "deepObject", - "explode": true - } - }, - "style": "deepObject", - "explode": true + "$ref": "#/components/schemas/product_collections_collection_item_base" }, { - "type": "string", - "title": "Customer ID", - "description": "Unique customer ID assigned by Voucherify, i.e. `cust_eWgXlBBiY6THFRJwX45Iakv4`.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + "anyOf": [ + { + "$ref": "#/components/schemas/product_collections_static_collection" + }, + { + "$ref": "#/components/schemas/product_collections_dynamic_collection" + } + ] } ] }, - "description": "Customer details." - }, - { - "name": "order", - "in": "query", - "required": false, - "schema": { + "product_collections_collection_item_base": { + "title": "Product Collection Base", + "description": "This is an object representing a product collection base. ", + "x-tags": [ + "PRODUCT COLLECTIONS API" + ], "type": "object", - "title": "Order details", - "description": "Order details.", "properties": { - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are attached to an order object. Stores additional information about the order in a structured format.", - "style": "deepObject", - "explode": true + "id": { + "type": "string", + "description": "Product collection ID." + }, + "name": { + "type": "string", + "example": "All Products", + "description": "Unique user-defined product collection name." + }, + "created_at": { + "type": "string", + "example": "2021-12-09T12:51:29.898Z", + "description": "Timestamp representing the date and time when the product collection was created in ISO 8601 format.", + "format": "date-time" + }, + "object": { + "description": "The type of object represented by JSON. This object stores information about the static product collection.", + "enum": [ + "products_collection" + ] } }, - "style": "deepObject", - "explode": true + "required": [ + "id", + "name", + "created_at", + "object" + ] }, - "description": "Order details." - } - ], - "security": [ - { - "X-Client-Application-Id-1": [], - "X-Client-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns information whether the voucher is valid in the context of the parameter values provided in the query parameters. Moreover, it returns a hashed source identifier which can be used as tracking ID in future calls. If a validation session is established, then the session details will be returned as well. Read more on [validation sessions](doc:locking-validation-session).", - "content": { - "application/json": { - "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_voucher" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_false" - } + "product_collections_create_request_body": { + "title": "product_collections_create_request_body", + "anyOf": [ + { + "$ref": "#/components/schemas/product_collections_create_static_request_body" + }, + { + "$ref": "#/components/schemas/product_collections_create_dynamic_request_body" + } + ] + }, + "product_collections_create_static_request_body": { + "title": "Create Product Collection - Static", + "type": "object", + "properties": { + "type": { + "enum": [ + "STATIC" ] }, - "examples": { - "Wrong customer": { - "value": { - "valid": false, - "reason": "customer does not match validation rules", - "error": { - "message": "Only the gift card owner can apply credits from the gift card to the order." - }, - "tracking_id": "track_0nmdnu/6xIb6NTN0Ea40oFmM4wD5QYlxAgKdSn6wh+o", - "code": "GIFT-CARD-kW4aEsfB", - "metadata": {} - } - }, - "Validation Rule Not Satisfied": { - "value": { - "valid": false, - "reason": "redemption does not match validation rules", - "error": { - "code": 400, - "key": "redemption_rules_violated", - "message": "redemption does not match validation rules", - "details": "Discount Coupon cannot be redeemed because of violated validation rules: val_WuupvE7OVXyo", - "request_id": "v-0be54f4afa0357c12f" - }, - "tracking_id": "track_0nmdnu/6xIb6NTN0Ea40oFmM4wD5QYlxAgKdSn6wh+oychk", - "code": "PAYINEUROS", - "metadata": { - "shoutout": "Pay in euros to get 10 Euros off, any other currency to get 5 off in that currency." - } - } - }, - "Validate Discount Coupon": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_rynPcKGW2z7+kd2Vry4p12+Rx2NtyXZyiApdGWEXPrdX+44Fg6LRBQ==", - "session": { - "key": "A", - "type": "LOCK", - "ttl": 1, - "ttl_unit": "NANOSECONDS" - }, - "order": { - "amount": 13000, - "discount_amount": 1000, - "total_discount_amount": 1000, - "total_amount": 12000, - "applied_discount_amount": 1000, - "total_applied_discount_amount": 1000, - "items": [ - { - "object": "order_item", - "source_id": "webinar_BF_sweater_pink_sweater", - "related_object": "product", - "quantity": 2, - "amount": 13000, - "price": 6500, - "subtotal_amount": 13000, - "product": { - "id": "prod_0bd76ca337954ca116", - "source_id": "webinar_BF_sweater_pink_sweater", - "name": "Pink Sweater", - "price": 6500 - } - } - ], - "metadata": { - "currency": "EUR" - }, - "customer_id": null, - "referrer_id": null, - "object": "order" + "name": { + "type": "string" + }, + "products": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" }, - "code": "PAYINEUROS", - "discount": { - "type": "AMOUNT", - "effect": "APPLY_TO_ORDER", - "amount_off": 1000 + "product_id": { + "type": "string" }, - "metadata": { - "shoutout": "Pay in euros to get 10 Euros off, any other currency to get 5 off in that currency." + "object": { + "enum": [ + "sku", + "product" + ] } - } - }, - "Validate Loyalty Card": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", - "session": { - "key": "A", - "type": "LOCK", - "ttl": 1, - "ttl_unit": "NANOSECONDS" - }, - "order": { - "amount": 121700, - "discount_amount": 5000, - "total_discount_amount": 5000, - "total_amount": 116700, - "applied_discount_amount": 5000, - "total_applied_discount_amount": 5000, - "items": [ - { - "object": "order_item", - "source_id": "webinar_BF_sweater_pink_sweater", - "related_object": "product", - "quantity": 2, - "amount": 13000, - "price": 6500, - "subtotal_amount": 13000, - "product": { - "id": "prod_0bd76ca337954ca116", - "source_id": "webinar_BF_sweater_pink_sweater", - "name": "Pink Sweater", - "price": 6500 - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "related_object": "product", - "quantity": 2, - "amount": 10000, - "price": 5000, - "subtotal_amount": 10000, - "product": { - "id": "prod_0bd76b8656956a183f", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "name": "Gray Sweat Pants", - "price": 5000 - } - }, - { - "object": "order_item", - "product_id": "prod_0bd76bb4aa003890cb", - "quantity": 2, - "amount": 9000, - "price": 4500, - "subtotal_amount": 9000, - "product": { - "id": "prod_0bd76bb4aa003890cb", - "source_id": "webinar_BF_pants_black_sweat_pants", - "name": "Black Sweat Pants", - "price": 4500 - } - }, - { - "object": "order_item", - "source_id": "M0E20000000ELDH", - "related_object": "sku", - "product_id": "prod_0b661d4bd2c7ec7d1f", - "quantity": 3, - "amount": 89700, - "price": 29900, - "subtotal_amount": 89700, - "product": { - "id": "prod_0b661d4bd2c7ec7d1f", - "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", - "name": "Casual jacket Michael Kors beige" - }, - "sku": { - "id": "sku_0b661e41fc8d35a8f8", - "source_id": "M0E20000000ELDH", - "sku": "Casual jacket Michael Kors beige", - "price": 29900 - } - } - ], - "metadata": { - "currency": "EUR" - }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "code": "LOYALTY-CARD-ng3Kb9tM", - "loyalty": { - "points_cost": 1000 - }, - "reward": { - "id": "rew_4ZF6Y69U2PXE3GLIZxfozgg1", - "assignment_id": "rewa_WkeBlLhj0sRae70J5AAvLbmy" - }, - "metadata": {}, - "campaign": "Loyalty Campaign", - "campaign_id": "camp_ZNb23Xtw1WuGCm7gdax84PUi" - } - }, - "Validate Gift Card": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", - "session": { - "key": "A", - "type": "LOCK", - "ttl": 1, - "ttl_unit": "NANOSECONDS" - }, - "order": { - "amount": 165700, - "discount_amount": 21500, - "total_discount_amount": 21500, - "total_amount": 144200, - "applied_discount_amount": 21500, - "total_applied_discount_amount": 21500, - "items": [ - { - "object": "order_item", - "source_id": "webinar_BF_sweater_pink_sweater", - "related_object": "product", - "quantity": 2, - "amount": 13000, - "price": 6500, - "subtotal_amount": 13000, - "product": { - "id": "prod_0bd76ca337954ca116", - "source_id": "webinar_BF_sweater_pink_sweater", - "name": "Pink Sweater", - "price": 6500 - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "related_object": "product", - "quantity": 2, - "amount": 10000, - "price": 5000, - "subtotal_amount": 10000, - "product": { - "id": "prod_0bd76b8656956a183f", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "name": "Gray Sweat Pants", - "price": 5000 - } - }, - { - "object": "order_item", - "product_id": "prod_0bd76bb4aa003890cb", - "quantity": 2, - "amount": 9000, - "price": 4500, - "subtotal_amount": 9000, - "product": { - "id": "prod_0bd76bb4aa003890cb", - "source_id": "webinar_BF_pants_black_sweat_pants", - "name": "Black Sweat Pants", - "price": 4500 - } - }, - { - "object": "order_item", - "source_id": "M0E20000000ELDH", - "related_object": "sku", - "product_id": "prod_0b661d4bd2c7ec7d1f", - "quantity": 3, - "amount": 89700, - "price": 29900, - "subtotal_amount": 89700, - "product": { - "id": "prod_0b661d4bd2c7ec7d1f", - "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", - "name": "Casual jacket Michael Kors beige" - }, - "sku": { - "id": "sku_0b661e41fc8d35a8f8", - "source_id": "M0E20000000ELDH", - "sku": "Casual jacket Michael Kors beige", - "price": 29900 - } - }, - { - "object": "order_item", - "product_id": "prod_0b661d4bd347ec7d26", - "sku_id": "sku_0b661e41fc0d35a8f1", - "quantity": 4, - "amount": 44000, - "price": 11000, - "subtotal_amount": 44000, - "product": { - "id": "prod_0b661d4bd347ec7d26", - "source_id": "975193eb-1911-444a-a0f0-f567efce1a8b", - "name": "Pumps ”Flex” Michael Kors black" - }, - "sku": { - "id": "sku_0b661e41fc0d35a8f1", - "source_id": "M0E20000000DMVX", - "sku": "Pumps ”Flex” Michael Kors black", - "price": 11000 - } - } - ], - "metadata": { - "currency": "EUR" - }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "code": "GIFT-CARD-kW4aEsfB", - "gift": { - "amount": 32000, - "balance": 21500, - "effect": "APPLY_TO_ORDER" - }, - "metadata": {}, - "campaign": "Gift Card Campaign", - "campaign_id": "camp_ZjoZEdmnyUCPYwMPN0IVbvDK" - } - }, - "Validate Referral Code": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_p6hPsnZj2VSvyXDjH9o6aQ==", - "order": { - "amount": 10000, - "discount_amount": 3000, - "total_discount_amount": 3000, - "total_amount": 7000, - "applied_discount_amount": 3000, - "total_applied_discount_amount": 3000, - "items": [], - "metadata": {}, - "referrer": { - "id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "object": "customer" - }, - "customer_id": null, - "referrer_id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "object": "order" - }, - "code": "REFERRAL-CODE-OxBakPYf", - "discount": { - "type": "PERCENT", - "effect": "APPLY_TO_ORDER", - "percent_off": 30 - }, - "metadata": {}, - "campaign": "Referral Campaign", - "campaign_id": "camp_TnOf5NB4Jtjxwoq38WckMJfy" - } - } - } - } - } - }, - "400": { - "description": "Returns an error if missing required parameters or tracking IDs come from the same origin.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Missing customer": { - "value": { - "code": 400, - "key": "missing_customer", - "message": "Missing customer", - "details": "Customer is required to validate rules", - "request_id": "v-0be548ae620abb0a73" - } - }, - "Ambiguous tracking ID": { - "value": { - "code": 400, - "key": "ambiguous_tracking_id", - "message": "Ambiguous trackingId ('track_0nmdnu/6xIb6NTN0Ea40oFmM4wD5QYlxAgKdSn6wh+oychkbEcMNB5RhcTj+zcKBEcGnUZkAXxg=' vs. 'track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==')", - "details": "The customer cannot be identified as two different identifiers have been used between requests from same origin.", - "request_id": "v-0be550a5a84abb30f8" - } + }, + "required": [ + "id", + "object" + ] } } - } - } - } - } - } - }, - "/v1/promotions/validation": { - "post": { - "operationId": "validate-promotions", - "deprecated": true, - "tags": [ - "VALIDATIONS API" - ], - "summary": "Validate Promotions [Deprecated]", - "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for qualification, and we do not recommend using it. The new [Qualifications API](ref:examine-qualification) introduces additional features and improvements while maintaining backward compatibility. 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. \n\nUse this method to get valid promotions for a given customer and order.\n\n### Advanced validation filters\n\nYou can narrow down a validation to a specific promotion ID or tier metadata. Here are the examples of filtering queries you can use:\n\n| **Filter** | **Example** |\n|:---|:---|\n| promotion_id | [filters][promotion_id][conditions][$is]={{campaign_id}} |\n| tier metadata | [filters][metadata.{{promotion tier metadata key}}][conditions][$is]={{promotion tier metadata value}} |\n\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"customer\": {\n \"id\": \"cust_gN9KgORZECfdhG9qT6n82Zr7\"\n },\n \"order\": {\n \"items\": [\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9aeddb019a42db\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": \"1\"\n },\n {\n \"sku_id\": \"sku_0b7d7dfb090be5c619\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b72b0bd64d198e3ae\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b7d7c4e814be5c502\",\n \"quantity\": 1\n }\n ],\n \"metadata\":{\n \"payment_mean\": [\"credit-card\"]\n }\n },\n \"options\": {\n \"expand\": [\n \"category\"\n ]\n }\n }'/\n 'https://api.voucherify.io/v1/promotions/validation?audienceRulesOnly=true'\n```\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -d `{\n \"customer\": {\n \"id\": \"cust_gN9KgORZECfdhG9qT6n82Zr7\"\n },\n \"order\": {\n \"items\": [\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9aeddb019a42db\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": \"1\"\n },\n {\n \"sku_id\": \"sku_0b7d7dfb090be5c619\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b72b0bd64d198e3ae\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b7d7c4e814be5c502\",\n \"quantity\": 1\n }\n ],\n \"metadata\":{\n \"payment_mean\": [\"credit-card\"]\n }\n },\n \"options\": {\n \"expand\": [\n \"category\"\n ]\n },\n \"metadata\": {\n \"store_names\": \"Store 1 - New York - Broadway\"\n }\n }`\\\n 'https://api.voucherify.io/v1/promotions/validation?[filters][promotion_id][conditions][$is]=camp_nYcAyjFXmEaBU0nB7EQ4hVTr'\n```\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -d `{\n \"customer\": {\n \"id\": \"cust_gN9KgORZECfdhG9qT6n82Zr7\"\n },\n \"order\": {\n \"items\": [\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9aeddb019a42db\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": \"1\"\n },\n {\n \"sku_id\": \"sku_0b7d7dfb090be5c619\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b72b0bd64d198e3ae\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b7d7c4e814be5c502\",\n \"quantity\": 1\n }\n ],\n \"metadata\":{\n \"payment_mean\": [\"credit-card\"]\n }\n },\n \"options\": {\n \"expand\": [\n \"category\"\n ]\n }\n }`\\\n 'https://api.voucherify.io/v1/promotions/validation?[filters][metadata.has_budget][conditions][$is]=true'\n```", - "parameters": [ - { - "schema": { - "type": "string" + }, + "required": [ + "type", + "name" + ] }, - "in": "query", - "name": "audienceRulesOnly", - "description": "If you add a query param AudienceRulesOnly=true, the request will be validated against customer-related rules only, the rest of attached limits and rules will be ignored." - }, - { - "name": "filters", - "in": "query", - "required": false, - "schema": { + "product_collections_create_dynamic_request_body": { + "title": "Create Product Collection - Auto Update", "type": "object", - "title": "Promotion filters", - "description": "Promotion filter conditions.", "properties": { - "metadata": { - "type": "object", - "description": "Allows you to create a filter based on the conditions set for promotion metadata values. The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that are attached to a promotion tier object. Stores additional information about the promotion tier in a structured format.", - "style": "deepObject", - "explode": true + "type": { + "enum": [ + "AUTO_UPDATE" + ] + }, + "name": { + "type": "string" }, - "promotion_id": { + "filter": { "type": "object", - "description": "Allows you to create a filter based on the unique promotion ID.", - "style": "deepObject", - "explode": true - } - }, - "style": "deepObject", - "explode": true - }, - "description": "Filter conditions." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Provide the customer and order context.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/6_req_validate_promotion" - }, - "examples": { - "Example": { - "value": { - "customer": { - "source_id": "source-id", - "metadata": { - "key": "value" - } + "additionalProperties": false, + "required": [ + "junction" + ], + "properties": { + "junction": { + "$ref": "#/components/schemas/Junction" }, - "options": { - "expand": [ - "category" - ] + "id": { + "$ref": "#/components/schemas/FieldConditions" }, - "order": { - "amount": 10000, - "items": [ - { - "product_id": "product-id", - "quantity": "1", - "price": 10000, - "related_object": "product", - "product": { - "metadata": { - "key": "value" - } - } - } - ] + "product_id": { + "$ref": "#/components/schemas/FieldConditions" }, - "metadata": { - "key": "value" - } - } - }, - "Customer Rules Only": { - "value": { - "customer": { - "id": "cust_gN9KgORZECfdhG9qT6n82Zr7" + "source_id": { + "$ref": "#/components/schemas/FieldConditions" }, - "order": { - "items": [ - { - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1 - }, - { - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1 - }, - { - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": "1" - }, - { - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1 - }, - { - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1 - }, - { - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1 - } - ], - "metadata": { - "payment_mean": [ - "credit-card" - ] - } + "name": { + "$ref": "#/components/schemas/FieldConditions" }, - "options": { - "expand": [ - "category" - ] - } - } - }, - "Campaign Specific": { - "value": { - "customer": { - "source_id": "test-user@email.com" + "price": { + "$ref": "#/components/schemas/FieldConditions" }, - "order": { - "items": [ - { - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1 - }, - { - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1 - }, - { - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": "1" - }, - { - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1 - }, - { - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1 - }, - { - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1 - } - ], - "metadata": { - "payment_mean": [ - "credit-card" - ] - } + "object": { + "$ref": "#/components/schemas/FieldConditions" }, - "options": { - "expand": [ - "category" - ] + "attributes": { + "$ref": "#/components/schemas/FieldConditions" }, "metadata": { - "store_names": "Store 1 - New York - Broadway" - } - } - }, - "Promotion Tier Metadata": { - "value": { - "customer": { - "name": "Joe McDonald", - "email": "joey@email.com", - "source_id": "123_source_id" + "$ref": "#/components/schemas/FieldConditions" }, - "order": { - "items": [ - { - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1 - }, - { - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1 - }, - { - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": "1" - }, - { - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1 - }, - { - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1 - }, - { - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1 - } - ], - "metadata": { - "payment_mean": [ - "credit-card" - ] - } + "image_url": { + "$ref": "#/components/schemas/FieldConditions" }, - "options": { - "expand": [ - "category" - ] + "skus": { + "$ref": "#/components/schemas/FieldConditions" + }, + "created_at": { + "$ref": "#/components/schemas/FieldConditions" + }, + "updated_at": { + "$ref": "#/components/schemas/FieldConditions" } } } + }, + "required": [ + "type", + "name", + "filter" + ] + } + }, + "examples": { + "req_vouchers_metadata_1": { + "value": { + "codes": [ + "PROMO-CODE810", + "PROMO-CODE726" + ], + "metadata": { + "lang": "en", + "authorized_internally": true + } + } + }, + "req_vouchers_metadata_2": { + "value": { + "codes": [ + "PROMO-CODE810", + "PROMO-CODE726", + "PROMO-CODE888" + ], + "metadata": { + "lang": "en", + "authorized_internally": true + } + } + }, + "res_async_actions": { + "value": { + "async_action_id": "aa_0ab2df092385be5ca5" } } } }, - "responses": { - "200": { - "description": "Returns a list of valid promotions for a given context (customer and order). You can then choose which promotion to apply, i.e. the highest discount amount.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/6_res_validate_promotion" - }, - "examples": { - "Customer Rules Only": { - "value": { - "valid": true, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "promotions": [ - { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "order": { - "amount": 9351000, - "initial_amount": 72100, - "items_discount_amount": 9340400, - "total_discount_amount": 9340400, - "total_amount": 10600, - "items_applied_discount_amount": 9340400, - "total_applied_discount_amount": 9340400, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1, - "amount": 3100, - "price": 3100, - "subtotal_amount": 3100, - "product": { - "id": "prod_0a9f9aeddb019a42db", - "name": "Blue T-Shirt", - "price": 3100 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, + "paths": { + "/v1/voucher-object": { + "get": { + "operationId": "voucher-object", + "tags": [ + "VOUCHERS API" + ], + "summary": "Voucher Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Voucher Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_obj_voucher_object" + } + } + } + } + } + } + }, + "/v1/vouchers": { + "get": { + "operationId": "list-vouchers", + "tags": [ + "VOUCHERS API" + ], + "summary": "List Vouchers", + "description": "Returns a list of your vouchers. By default, the vouchers are returned sorted by creation date, with the most recent vouchers appearing first. A maximum of 10 vouchers are returned in the response.\n\nWhen you get a list of vouchers, you can optionally specify query parameters to customize the amount of vouchers returned per call using `limit`, which page of vouchers to return using `page`, sort the vouchers using the `order` query parameter and more.\n\nThis method will return an error when trying to return a limit of more than 100 vouchers.\n", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "$ref": "#/components/parameters/category" + }, + { + "in": "query", + "name": "campaign_id", + "description": "Limit search results to vouchers within the specified campaign", + "schema": { + "type": "string", + "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3" + } + }, + { + "$ref": "#/components/parameters/customer" + }, + { + "$ref": "#/components/parameters/campaign" + }, + { + "$ref": "#/components/parameters/created_at" + }, + { + "$ref": "#/components/parameters/updated_at" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at", + "code", + "-code" + ] + }, + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary that contains an array of vouchers. Each entry in the array is a separate voucher object. If no more vouchers are available (query parameter `page` incremented over and above the voucher count), the resulting array will be empty. The result can be narrowed down according to specified (or default) filters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_res_vouchers_GET" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "vouchers", + "vouchers": [ { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 23, - "discount_quantity": 22, - "initial_quantity": 1, - "amount": 39100, - "discount_amount": 37400, - "initial_amount": 1700, - "applied_discount_amount": 37400, - "price": 1700, - "subtotal_amount": 1700, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100 + "id": "v_hrMBBeT4sOP9VSGPmj5KAgJwX202UjiY", + "code": "LOYALTY-CARD-xLPbpbXR", + "campaign": "Loyalty Program Fall 2022", + "campaign_id": "camp_f7fBbQxUuTN7dI7tGOo5XMDA", + "category": "First", + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" + } + ], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 110, + "balance": 100, + "next_expiration_date": "2023-12-31", + "next_expiration_points": 100 }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1700 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 222, - "discount_quantity": 222, - "initial_quantity": 1, - "amount": 333000, - "discount_amount": 333000, - "initial_amount": 1500, - "applied_discount_amount": 333000, - "price": 1500, - "subtotal_amount": 0, - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage", - "price": 1500 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 111, - "discount_quantity": 111, - "initial_quantity": 1, - "amount": 6660000, - "discount_amount": 6660000, - "initial_amount": 60000, - "applied_discount_amount": 6660000, - "price": 60000, - "subtotal_amount": 0, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "price": 60000 - } - }, - { - "object": "order_item", - "product_id": "prod_0bae2dc5a090fd0184", - "sku_id": "sku_0bae3b28f610fd0da1", - "quantity": 11, - "discount_quantity": 11, - "initial_quantity": 0, - "amount": 2310000, - "discount_amount": 2310000, - "initial_amount": 0, - "applied_discount_amount": 2310000, - "price": 210000, - "subtotal_amount": 0, - "product": { - "id": "prod_0bae2dc5a090fd0184", - "source_id": "first_product", - "name": "Samsung Phone 1", - "price": 220000 + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8/6I6hUEqtz/F6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD/DjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8%2F6I6hUEqtz%2FF6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD%2FDjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/SpYuOrU9wd6/o1wzy6E/04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ/FJtiw69djuzQk1f4HdQo8s5gaZ7fd2U+1zbaeAvi9usyvRHZE4=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FSpYuOrU9wd6%2Fo1wzy6E%2F04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ%2FFJtiw69djuzQk1f4HdQo8s5gaZ7fd2U%2B1zbaeAvi9usyvRHZE4%3D" + } }, - "sku": { - "id": "sku_0bae3b28f610fd0da1", - "source_id": "first_product_sku_1", - "sku": "Samsung phone 256GB", - "price": 210000 - } - } - ], - "metadata": { - "payment_mean": [ - "credit-card" - ] - }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "id": "promo_ByIIAHC1Mz9ouJsitzAWsush", - "name": "Multiple", - "discount": { - "type": "UNIT", - "effect": "ADD_MANY_ITEMS", - "units": [ - { - "effect": "ADD_MISSING_ITEMS", - "unit_off": 11, - "unit_type": "sku_0bae3b28f610fd0da1", - "sku": { - "id": "sku_0bae3b28f610fd0da1", - "source_id": "first_product_sku_1", - "sku": "Samsung phone 256GB" + "is_referral_code": false, + "created_at": "2022-09-19T07:56:22.355Z", + "updated_at": "2022-09-19T08:04:22.458Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "redeemed_points": 10, + "object": "list", + "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/redemptions?page=1&limit=10" }, - "product": { - "id": "prod_0bae2dc5a090fd0184", - "source_id": "first_product", - "name": "Samsung Phone 1" - } - }, - { - "effect": "ADD_NEW_ITEMS", - "unit_off": 22, - "unit_type": "sku_0b7d7dfb090be5c619", - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1" + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/publications?page=1&limit=10" }, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1" - } - }, - { - "effect": "ADD_MISSING_ITEMS", - "unit_off": 111, - "unit_type": "prod_0b7d7c4e814be5c502", - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12" - } - }, - { - "effect": "ADD_MISSING_ITEMS", - "unit_off": 222, - "unit_type": "prod_0b72b0bd64d198e3ae", - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage" - } - } - ] - }, - "campaign": { - "id": "camp_JtoaZ8Qgpf6FkMAy2wWiOJWH", - "start_date": null, - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "hierarchy": 1, - "discount_amount": 9340400, - "applied_discount_amount": 9340400, - "metadata": {}, - "object": "promotion_tier" - }, - { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "order": { - "amount": 9522100, - "initial_amount": 72100, - "items_discount_amount": 9450000, - "total_discount_amount": 9450000, - "total_amount": 72100, - "items_applied_discount_amount": 9450000, - "total_applied_discount_amount": 9450000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1, - "amount": 3100, - "price": 3100, - "subtotal_amount": 3100, - "product": { - "id": "prod_0a9f9aeddb019a42db", - "name": "Blue T-Shirt", - "price": 3100 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } + "object": "voucher" }, { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1700, - "price": 1700, - "subtotal_amount": 1700, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100 + "id": "v_OBVfpTVf24DBz0HZmKVZa5UEl1DUg2bn", + "code": "AmountDiscount", + "campaign": null, + "campaign_id": null, + "category": "First", + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" + } + ], + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 400, + "amount_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", + "effect": "APPLY_TO_ORDER" }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1700 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1, - "amount": 1500, - "price": 1500, - "subtotal_amount": 1500, - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage", - "price": 1500 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 60000, - "price": 60000, - "subtotal_amount": 60000, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "price": 60000 - } - }, - { - "object": "order_item", - "product_id": "prod_0bae2dc5a090fd0184", - "sku_id": "sku_0bae3b28f610fd0da1", - "quantity": 45, - "discount_quantity": 45, - "initial_quantity": 0, - "amount": 9450000, - "discount_amount": 9450000, - "initial_amount": 0, - "applied_discount_amount": 9450000, - "price": 210000, - "subtotal_amount": 0, - "product": { - "id": "prod_0bae2dc5a090fd0184", - "source_id": "first_product", - "name": "Samsung Phone 1", - "price": 220000 + "gift": null, + "loyalty_card": null, + "start_date": "2022-09-01T00:00:00.000Z", + "expiration_date": "2022-10-31T00:00:00.000Z", + "validity_timeframe": null, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": true, + "additional_info": "This voucher discount is based on a formula, payment must be using VISA, and order must be over $100.", + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX18tV6jdzxWPwEzjeiX4DoM06JpwaoKUNGMNx4Td5e8FwA68uIHQwPaRpJr9CUCpiP4IsSD8nEJn1YtEv6FnY83wIv7uljYoQOYmMPyhKec8Ct3zH7KurMGuj4Fhws3HNA3bqP5MYEy+aA==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX18tV6jdzxWPwEzjeiX4DoM06JpwaoKUNGMNx4Td5e8FwA68uIHQwPaRpJr9CUCpiP4IsSD8nEJn1YtEv6FnY83wIv7uljYoQOYmMPyhKec8Ct3zH7KurMGuj4Fhws3HNA3bqP5MYEy%2BaA%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX181+WljOgxIt9Jg1Urbuv226+8Ug0DIyZiI0WtThPNYKZZEodzqQpIsGSdrDGXr2chLo+4FH3Ey8G2YXCPM6nUhZRSMF5oL3+uNjcLtBvb7MF5+ynY5fIgpXolwUK0R/BuT4Pa8prhgTg==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX181%2BWljOgxIt9Jg1Urbuv226%2B8Ug0DIyZiI0WtThPNYKZZEodzqQpIsGSdrDGXr2chLo%2B4FH3Ey8G2YXCPM6nUhZRSMF5oL3%2BuNjcLtBvb7MF5%2BynY5fIgpXolwUK0R%2FBuT4Pa8prhgTg%3D%3D" + } }, - "sku": { - "id": "sku_0bae3b28f610fd0da1", - "source_id": "first_product_sku_1", - "sku": "Samsung phone 256GB", - "price": 210000 - } - } - ], - "metadata": { - "payment_mean": [ - "credit-card" - ] - }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "id": "promo_ZWkx6R0I1Ts3N9HL4kfTdxOm", - "name": "Add new SKU", - "discount": { - "type": "UNIT", - "effect": "ADD_NEW_ITEMS", - "unit_off": 45, - "unit_type": "sku_0bae3b28f610fd0da1", - "sku": { - "id": "sku_0bae3b28f610fd0da1", - "source_id": "first_product_sku_1", - "sku": "Samsung phone 256GB" - }, - "product": { - "id": "prod_0bae2dc5a090fd0184", - "source_id": "first_product", - "name": "Samsung Phone 1" - } - }, - "campaign": { - "id": "camp_40LC42P5NFbkkD4RWoJ4btks", - "start_date": null, - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "hierarchy": 4, - "discount_amount": 9450000, - "applied_discount_amount": 9450000, - "metadata": {}, - "object": "promotion_tier" - }, - { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "order": { - "amount": 109500, - "initial_amount": 72100, - "items_discount_amount": 39100, - "total_discount_amount": 39100, - "total_amount": 70400, - "items_applied_discount_amount": 39100, - "total_applied_discount_amount": 39100, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1, - "amount": 3100, - "price": 3100, - "subtotal_amount": 3100, - "product": { - "id": "prod_0a9f9aeddb019a42db", - "name": "Blue T-Shirt", - "price": 3100 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 23, - "discount_quantity": 23, - "initial_quantity": 1, - "amount": 39100, - "discount_amount": 39100, - "initial_amount": 1700, - "applied_discount_amount": 39100, - "price": 1700, - "subtotal_amount": 0, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100 + "is_referral_code": false, + "created_at": "2022-09-12T07:51:02.145Z", + "updated_at": "2022-09-19T08:29:12.566Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "redemption": { + "quantity": null, + "redeemed_quantity": 2, + "object": "list", + "url": "/v1/vouchers/AmountDiscount/redemptions?page=1&limit=10" }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1700 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1, - "amount": 1500, - "price": 1500, - "subtotal_amount": 1500, - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage", - "price": 1500 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 60000, - "price": 60000, - "subtotal_amount": 60000, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "price": 60000 - } - } - ], - "metadata": { - "payment_mean": [ - "credit-card" - ] - }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "id": "promo_NcdD0zLo6FUhKWpNrNuP3Pte", - "name": "Add missing SKU", - "discount": { - "type": "UNIT", - "effect": "ADD_MISSING_ITEMS", - "unit_off": 23, - "unit_type": "sku_0b7d7dfb090be5c619", - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1" - }, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1" - } - }, - "campaign": { - "id": "camp_40LC42P5NFbkkD4RWoJ4btks", - "start_date": null, - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "hierarchy": 3, - "discount_amount": 39100, - "applied_discount_amount": 39100, - "metadata": {}, - "object": "promotion_tier" - }, - { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "order": { - "amount": 76100, - "initial_amount": 72100, - "items_discount_amount": 4000, - "total_discount_amount": 4000, - "total_amount": 72100, - "items_applied_discount_amount": 4000, - "total_applied_discount_amount": 4000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1, - "amount": 3100, - "price": 3100, - "subtotal_amount": 3100, - "product": { - "id": "prod_0a9f9aeddb019a42db", - "name": "Blue T-Shirt", - "price": 3100 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1700, - "price": 1700, - "subtotal_amount": 1700, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100 + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AmountDiscount/publications?page=1&limit=10" }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1700 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1, - "amount": 1500, - "price": 1500, - "subtotal_amount": 1500, - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage", - "price": 1500 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 60000, - "price": 60000, - "subtotal_amount": 60000, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "price": 60000 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b00ffed198e344", - "quantity": 8, - "discount_quantity": 8, - "initial_quantity": 0, - "amount": 4000, - "discount_amount": 4000, - "initial_amount": 0, - "applied_discount_amount": 4000, - "price": 500, - "subtotal_amount": 0, - "product": { - "id": "prod_0b72b00ffed198e344", - "source_id": "roses_1", - "name": "Bouquet - Romantic Roses", - "price": 500 - } + "object": "voucher" } ], - "metadata": { - "payment_mean": [ - "credit-card" - ] - }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "id": "promo_nGr1SWuy9vduABkbbJkl8cHb", - "name": "Add new order items", - "banner": "Add Romantic Roses", - "discount": { - "type": "UNIT", - "effect": "ADD_NEW_ITEMS", - "unit_off": 8, - "unit_type": "prod_0b72b00ffed198e344", - "product": { - "id": "prod_0b72b00ffed198e344", - "source_id": "roses_1", - "name": "Bouquet - Romantic Roses" - } - }, - "campaign": { - "id": "camp_40LC42P5NFbkkD4RWoJ4btks", - "start_date": null, - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "hierarchy": 2, - "discount_amount": 4000, - "applied_discount_amount": 4000, - "metadata": {}, - "object": "promotion_tier" - }, - { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "order": { - "amount": 78100, - "initial_amount": 72100, - "items_discount_amount": 7500, - "total_discount_amount": 7500, - "total_amount": 70600, - "items_applied_discount_amount": 7500, - "total_applied_discount_amount": 7500, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1, - "amount": 3100, - "price": 3100, - "subtotal_amount": 3100, - "product": { - "id": "prod_0a9f9aeddb019a42db", - "name": "Blue T-Shirt", - "price": 3100 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1700, - "price": 1700, - "subtotal_amount": 1700, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100 - }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1700 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 5, - "discount_quantity": 5, - "initial_quantity": 1, - "amount": 7500, - "discount_amount": 7500, - "initial_amount": 1500, - "applied_discount_amount": 7500, - "price": 1500, - "subtotal_amount": 0, - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage", - "price": 1500 - } - }, + "total": 2 + } + } + } + } + } + } + } + } + }, + "/v1/vouchers/{code}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "7fjWdr" + }, + "in": "path", + "name": "code", + "description": "A unique **code** that identifies the voucher.", + "required": true + } + ], + "get": { + "operationId": "get-voucher", + "tags": [ + "VOUCHERS API" + ], + "summary": "Get Voucher", + "description": "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`.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a voucher object if a valid identifier was provided. \n\nAdditionally, the response returns validation rules related to the voucher object. They can be inherited from a campaign.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_obj_voucher_object" + }, + "examples": { + "Loyalty Card": { + "value": { + "id": "v_hrMBBeT4sOP9VSGPmj5KAgJwX202UjiY", + "code": "LOYALTY-CARD-xLPbpbXR", + "campaign": "Loyalty Program Fall 2022", + "campaign_id": "camp_f7fBbQxUuTN7dI7tGOo5XMDA", + "category": "First", + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 60000, - "price": 60000, - "subtotal_amount": 60000, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "price": 60000 - } + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" } ], - "metadata": { - "payment_mean": [ - "credit-card" - ] + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 110, + "balance": 100, + "next_expiration_date": "2023-12-31", + "next_expiration_points": 100 }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "id": "promo_R50x0A66V6jmPhM7YYOcFZfL", - "name": "Add missing order items", - "banner": "Add Boho Vintage", - "discount": { - "type": "UNIT", - "effect": "ADD_MISSING_ITEMS", - "unit_off": 5, - "unit_type": "prod_0b72b0bd64d198e3ae", - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage" - } - }, - "campaign": { - "id": "camp_40LC42P5NFbkkD4RWoJ4btks", "start_date": null, "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, "active": true, - "object": "campaign" - }, - "hierarchy": 1, - "discount_amount": 7500, - "applied_discount_amount": 7500, - "metadata": {}, - "object": "promotion_tier" + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8/6I6hUEqtz/F6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD/DjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8%2F6I6hUEqtz%2FF6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD%2FDjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/SpYuOrU9wd6/o1wzy6E/04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ/FJtiw69djuzQk1f4HdQo8s5gaZ7fd2U+1zbaeAvi9usyvRHZE4=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FSpYuOrU9wd6%2Fo1wzy6E%2F04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ%2FFJtiw69djuzQk1f4HdQo8s5gaZ7fd2U%2B1zbaeAvi9usyvRHZE4%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-19T07:56:22.355Z", + "updated_at": "2022-09-19T08:04:22.458Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "redeemed_points": 10, + "object": "list", + "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/publications?page=1&limit=10" + }, + "object": "voucher" + } }, - { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "order": { - "amount": 72100, - "total_amount": 72100, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } + "Gift Card": { + "value": { + "id": "v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk", + "code": "GIFT-CARD-xwc6X7Tk", + "campaign": "Gift Cards", + "campaign_id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", + "category": null, + "category_id": null, + "type": "GIFT_VOUCHER", + "discount": null, + "gift": { + "amount": 55000, + "balance": 44700, + "effect": "APPLY_TO_ORDER" + }, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM/aTyHCYfr7kRWb2vv08WIgY/Tv53SJGW+k2keqfsTq/Ohb5shkCN3FTFsaI8gulTp616sEGn/JJoIInIoNkO9Vd1+AfrKiAjmirCmekE6cz2SVCyNAXs=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM%2FaTyHCYfr7kRWb2vv08WIgY%2FTv53SJGW%2Bk2keqfsTq%2FOhb5shkCN3FTFsaI8gulTp616sEGn%2FJJoIInIoNkO9Vd1%2BAfrKiAjmirCmekE6cz2SVCyNAXs%3D" }, + "barcode": { + "id": "U2FsdGVkX18vWc/qplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO/199U+zicnFNWqg/jF5ZCQW+6jO1q8=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18vWc%2FqplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO%2F199U%2BzicnFNWqg%2FjF5ZCQW%2B6jO1q8%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-07-08T09:44:33.179Z", + "updated_at": "2022-08-29T09:37:20.185Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 7, + "redeemed_amount": 10300, + "object": "list", + "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Amount Discount": { + "value": { + "id": "v_OBVfpTVf24DBz0HZmKVZa5UEl1DUg2bn", + "code": "AMOUNTDISCOUNTUSINGFORMULA", + "campaign": null, + "campaign_id": null, + "category": "First", + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1, - "amount": 3100, - "price": 3100, - "subtotal_amount": 3100, - "product": { - "id": "prod_0a9f9aeddb019a42db", - "name": "Blue T-Shirt", - "price": 3100 - } + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" + } + ], + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 400, + "amount_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", + "effect": "APPLY_TO_ORDER" + }, + "gift": null, + "loyalty_card": null, + "start_date": "2022-09-01T00:00:00.000Z", + "expiration_date": "2022-10-31T00:00:00.000Z", + "validity_timeframe": null, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": true, + "additional_info": "This voucher discount is based on a formula, payment must be using VISA, and order must be over $100.", + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX18tV6jdzxWPwEzjeiX4DoM06JpwaoKUNGMNx4Td5e8FwA68uIHQwPaRpJr9CUCpiP4IsSD8nEJn1YtEv6FnY83wIv7uljYoQOYmMPyhKec8Ct3zH7KurMGuj4Fhws3HNA3bqP5MYEy+aA==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX18tV6jdzxWPwEzjeiX4DoM06JpwaoKUNGMNx4Td5e8FwA68uIHQwPaRpJr9CUCpiP4IsSD8nEJn1YtEv6FnY83wIv7uljYoQOYmMPyhKec8Ct3zH7KurMGuj4Fhws3HNA3bqP5MYEy%2BaA%3D%3D" }, - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 + "barcode": { + "id": "U2FsdGVkX181+WljOgxIt9Jg1Urbuv226+8Ug0DIyZiI0WtThPNYKZZEodzqQpIsGSdrDGXr2chLo+4FH3Ey8G2YXCPM6nUhZRSMF5oL3+uNjcLtBvb7MF5+ynY5fIgpXolwUK0R/BuT4Pa8prhgTg==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX181%2BWljOgxIt9Jg1Urbuv226%2B8Ug0DIyZiI0WtThPNYKZZEodzqQpIsGSdrDGXr2chLo%2B4FH3Ey8G2YXCPM6nUhZRSMF5oL3%2BuNjcLtBvb7MF5%2BynY5fIgpXolwUK0R%2FBuT4Pa8prhgTg%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-12T07:51:02.145Z", + "updated_at": "2022-09-19T08:29:12.566Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_tO5AuzXIkkNPTC50", + "rule_id": "val_5h0wc453_2", + "related_object_id": "v_OBVfpTVf24DBz0HZmKVZa5UEl1DUg2bn", + "related_object_type": "voucher", + "created_at": "2022-09-19T08:27:59.160Z", + "object": "validation_rules_assignment" } + ], + "total": 1 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 2, + "object": "list", + "url": "/v1/vouchers/AMOUNTDISCOUNTUSINGFORMULA/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AMOUNTDISCOUNTUSINGFORMULA/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Percent Discount": { + "value": { + "id": "v_2LcXRN4X0TNNgPoBceXIsE4LYs13kta1", + "code": "PercentDiscountUsingFormula", + "campaign": null, + "campaign_id": null, + "category": null, + "category_id": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "percent_off": 3, + "percent_off_formula": "CUSTOMER_METADATA(\"age\")", + "effect": "APPLY_TO_ITEMS" + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1+74dNbbuHNdVR+5SXVrdo6Zp2tUInlseZtheoYEvrayBBDEoJFaeDuC1BzQr+j8ayuFU7+BtCdNe25YRae4Mp+3Y1HsrkVudshKRzMBdS/43GT9Qi6tOXQDsYjHh70zNz13lMOC9bnaX6WZCVU0vRWM/VDXbYNxGZH6V1wpcGOkmkhkEYPSuIXBDF65FsgHOAwIPvKBxa/aQ==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B74dNbbuHNdVR%2B5SXVrdo6Zp2tUInlseZtheoYEvrayBBDEoJFaeDuC1BzQr%2Bj8ayuFU7%2BBtCdNe25YRae4Mp%2B3Y1HsrkVudshKRzMBdS%2F43GT9Qi6tOXQDsYjHh70zNz13lMOC9bnaX6WZCVU0vRWM%2FVDXbYNxGZH6V1wpcGOkmkhkEYPSuIXBDF65FsgHOAwIPvKBxa%2FaQ%3D%3D" }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1700, - "price": 1700, - "subtotal_amount": 1700, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100 - }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1700 + "barcode": { + "id": "U2FsdGVkX19t8/dJWDNnnwPtxt3e0kZTDAELYiQcSHWIEO5wr6uLeDbM2KKbGYUfkKKtZRsWtiKhOQQc7zmNoCqR82UB+p0gzGM0tyXa/npbPUTe0Y5Y/arDPnomb9AaUFjK9Uq5OUBYbxi1ERqEhy/20Owr0m0e0E2I3jQmgAxkNokRm1g31zX4zheea8gTtiFwb6ZrYvGbaOhj5IxYWg==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19t8%2FdJWDNnnwPtxt3e0kZTDAELYiQcSHWIEO5wr6uLeDbM2KKbGYUfkKKtZRsWtiKhOQQc7zmNoCqR82UB%2Bp0gzGM0tyXa%2FnpbPUTe0Y5Y%2FarDPnomb9AaUFjK9Uq5OUBYbxi1ERqEhy%2F20Owr0m0e0E2I3jQmgAxkNokRm1g31zX4zheea8gTtiFwb6ZrYvGbaOhj5IxYWg%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-15T10:20:46.467Z", + "updated_at": "2022-09-15T10:43:51.116Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_EuYasM5fyDR9G2r4", + "rule_id": "val_0k19OQHjNZRT", + "related_object_id": "v_2LcXRN4X0TNNgPoBceXIsE4LYs13kta1", + "related_object_type": "voucher", + "created_at": "2022-09-15T10:20:46.460Z", + "object": "validation_rules_assignment" } + ], + "total": 1 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 3, + "object": "list", + "url": "/v1/vouchers/PercentDiscountUsingFormula/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/PercentDiscountUsingFormula/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Fixed Discount": { + "value": { + "id": "v_zXQtyi5FYQYoRXv459hmK8M5Gi2lLoDl", + "code": "FixedDiscountUsingFormula", + "campaign": null, + "campaign_id": null, + "category": null, + "category_id": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "FIXED", + "effect": "APPLY_TO_ORDER", + "fixed_amount": 200, + "fixed_amount_formula": "IF(ORDER_UNITS_QUANTITY > 3;CUSTOMER_METADATA(\"age\") + 2;CUSTOMER_METADATA(\"age\") - 2)" + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1+sY8iWRFMrrPOjY6pS7JZSqJUPIzAgFO5oy5GvTj27KrukNxucE4wrA4n9QL7pua3CfJzGWe0Hc5J6XXU2m5ktik4iUNRO6pxZmL4ZuR96C1XHJAGaIiI7lM17OjJD2b72/hyyDUi8DflzcYixFdXTOR3o1rcaPoY=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BsY8iWRFMrrPOjY6pS7JZSqJUPIzAgFO5oy5GvTj27KrukNxucE4wrA4n9QL7pua3CfJzGWe0Hc5J6XXU2m5ktik4iUNRO6pxZmL4ZuR96C1XHJAGaIiI7lM17OjJD2b72%2FhyyDUi8DflzcYixFdXTOR3o1rcaPoY%3D" }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1, - "amount": 1500, - "price": 1500, - "subtotal_amount": 1500, - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage", - "price": 1500 - } + "barcode": { + "id": "U2FsdGVkX1+af+iouhzUVUL0IocB7BAWR8rB0z8/9/OgYi32EHQ9salEEtE3XYPWtseOAxi5keMRp6K3JLDyx4RvYpw3Fe5SN0ed7PEcWr4fLUoUBntHtH0lOPFOtWxpY3tAjnyWpE/CYTR/S135KZ6GIfCS/+VQNrzbS/bFXgY=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2Baf%2BiouhzUVUL0IocB7BAWR8rB0z8%2F9%2FOgYi32EHQ9salEEtE3XYPWtseOAxi5keMRp6K3JLDyx4RvYpw3Fe5SN0ed7PEcWr4fLUoUBntHtH0lOPFOtWxpY3tAjnyWpE%2FCYTR%2FS135KZ6GIfCS%2F%2BVQNrzbS%2FbFXgY%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-15T12:46:55.818Z", + "updated_at": "2022-09-16T10:03:25.057Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 5, + "object": "list", + "url": "/v1/vouchers/FixedDiscountUsingFormula/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/FixedDiscountUsingFormula/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Unit Discount": { + "value": { + "id": "v_JkjV4v9OKTsaIuHoqXGrkGijNaRGYNzm", + "code": "UnitDiscountUsingFormula", + "campaign": null, + "campaign_id": null, + "category": null, + "category_id": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "UNIT", + "unit_off": 1, + "unit_off_formula": "IF(ORDER_UNITS_QUANTITY > 3;CUSTOMER_METADATA(\"age\") / 5;CUSTOMER_METADATA(\"age\") / 10)", + "unit_type": "sku_0b661e41eccd35a8e9", + "effect": "ADD_MISSING_ITEMS" + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1+6okuUQBKDcu0jGGg0jOU3kwYUFhX79TdwYKjXyV14BX74z/lehzciL0vdtutoiMVf8Nzl+B278gSHI5TiecPsTXChbGKSjH9gYUxZkdQev0qfmR4frKHjKKHHfT9DEcRWCLwKDJ9V+b89EAmbMouLlaDvkD63bZI=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B6okuUQBKDcu0jGGg0jOU3kwYUFhX79TdwYKjXyV14BX74z%2FlehzciL0vdtutoiMVf8Nzl%2BB278gSHI5TiecPsTXChbGKSjH9gYUxZkdQev0qfmR4frKHjKKHHfT9DEcRWCLwKDJ9V%2Bb89EAmbMouLlaDvkD63bZI%3D" }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 60000, - "price": 60000, - "subtotal_amount": 60000, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "price": 60000 + "barcode": { + "id": "U2FsdGVkX19E7POETWB9YO+S4gkbGFQSm4VDNXEvqdlln6cWiyWTplnWkiUbs/2XMIva3q2rHDFP4toeKrLOGeS5mqhJcdd3yVsWXjHaALwCJIis2D4l5soDvz+Ka/vTqJdFWQzqsIl0BqEpr1tLLy8JFMGN7MY5nY3nr/ciSN8=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19E7POETWB9YO%2BS4gkbGFQSm4VDNXEvqdlln6cWiyWTplnWkiUbs%2F2XMIva3q2rHDFP4toeKrLOGeS5mqhJcdd3yVsWXjHaALwCJIis2D4l5soDvz%2BKa%2FvTqJdFWQzqsIl0BqEpr1tLLy8JFMGN7MY5nY3nr%2FciSN8%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-15T13:36:27.838Z", + "updated_at": "2022-09-16T10:03:25.057Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 5, + "object": "list", + "url": "/v1/vouchers/UnitDiscountUsingFormula/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/UnitDiscountUsingFormula/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Multiple Unit Discount": { + "value": { + "id": "v_5Xgi5ht4sw432LQ7bwmyjKnUAYtOrJAh", + "code": "UnitDiscountUsingFormulaForMultipleProductVariants", + "campaign": null, + "campaign_id": null, + "category": null, + "category_id": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "UNIT", + "effect": "ADD_MANY_ITEMS", + "units": [ + { + "unit_off": 3, + "unit_off_formula": "IF(ORDER_AMOUNT > 100;CUSTOMER_METADATA(\"age\");CUSTOMER_METADATA(\"age\") / 2)", + "unit_type": "sku_0b661e41fc8d35a8f7", + "effect": "ADD_MISSING_ITEMS" + }, + { + "unit_off": 4, + "unit_off_formula": "IF(ORDER_AMOUNT > 100;CUSTOMER_METADATA(\"age\") + 2;CUSTOMER_METADATA(\"age\") - -2)", + "unit_type": "sku_0b661e41fc8d35a8f6", + "effect": "ADD_NEW_ITEMS" } + ] + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1+qkwm+Yu29uhfotQxirJftPuWjA1P9WGxHqqmOHsU9esf6R5Ln7AeiqX8l9iIpy+D3yav5GmF2UrY6PD6fS9Y+yu+7yTVQu+agFZqdN1jvWw4DBOCHKPgynaMiNS29Cv4EIOFCY9Ux+4Lp8aVdalItCVCEH25DxWD+HUKq1lE31Y0DfWssg95oO2m73ZeGa8je7zd09eW7cg==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bqkwm%2BYu29uhfotQxirJftPuWjA1P9WGxHqqmOHsU9esf6R5Ln7AeiqX8l9iIpy%2BD3yav5GmF2UrY6PD6fS9Y%2Byu%2B7yTVQu%2BagFZqdN1jvWw4DBOCHKPgynaMiNS29Cv4EIOFCY9Ux%2B4Lp8aVdalItCVCEH25DxWD%2BHUKq1lE31Y0DfWssg95oO2m73ZeGa8je7zd09eW7cg%3D%3D" }, - { - "object": "order_item", - "product_id": "prod_5h1pp1ng", - "quantity": 1, - "discount_quantity": 1, - "initial_quantity": 0, - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping" - } + "barcode": { + "id": "U2FsdGVkX1+poCeZMw207p8HWtpoeokpaPfUQQoRIxpGXmqi5ic2ZPhQwKrUnujPDW4Sw1ODgHV6nLWQQQ9g7j3S4793YfzHDi1H8L3kZroH0TwWFNBgzQkV/QLqc387xUUckr0fvmhTBCarpsB+dWPOwlaNuVivTVB+Yyh/1FcbGbjvbj1Sm12wVNom2KZ3m1K/lJ6vBoGkXqq0jutytA==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BpoCeZMw207p8HWtpoeokpaPfUQQoRIxpGXmqi5ic2ZPhQwKrUnujPDW4Sw1ODgHV6nLWQQQ9g7j3S4793YfzHDi1H8L3kZroH0TwWFNBgzQkV%2FQLqc387xUUckr0fvmhTBCarpsB%2BdWPOwlaNuVivTVB%2BYyh%2F1FcbGbjvbj1Sm12wVNom2KZ3m1K%2FlJ6vBoGkXqq0jutytA%3D%3D" } - ], - "metadata": { - "payment_mean": [ - "credit-card" - ] }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "id": "promo_jp2l6wRcTL4cARG5E8XRo42A", - "name": "Get", - "banner": "Free shipping", - "discount": { - "type": "UNIT", - "effect": "ADD_MISSING_ITEMS", - "unit_off": 1, - "unit_type": "prod_5h1pp1ng", - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping" - } - }, - "campaign": { - "id": "camp_wCEdu2igBcyv7CNna9ughGKc", + "is_referral_code": false, + "created_at": "2022-09-16T05:44:50.722Z", + "updated_at": "2022-09-19T09:25:17.303Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 3, + "object": "list", + "url": "/v1/vouchers/UnitDiscountUsingFormulaForMultipleProductVariants/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/UnitDiscountUsingFormulaForMultipleProductVariants/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Free Shipping": { + "value": { + "id": "v_gO13ON60WqVmP1DASWuJRF83Xt5KrVNL", + "code": "FreeShipping", + "campaign": null, + "campaign_id": null, + "category": null, + "category_id": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "UNIT", + "unit_off": 1, + "unit_type": "prod_5h1pp1ng", + "effect": "ADD_MISSING_ITEMS" + }, + "gift": null, + "loyalty_card": null, "start_date": null, "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, "active": true, - "object": "campaign" + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX19R0AaZSL8eog8GYSGvRcADkJ24Hhr52Awb2KNF11CE7oyTHVBq+S3gexrVR8PxHgEz/jR1Hh2YfM5h0k5CYPD24I/pXJYQVTa1CpXFBrrxVET9QyK48z5hxu2nsHHBsV7g0zK1nIVibsw06db8x1F1zaR7Un9oq6A=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19R0AaZSL8eog8GYSGvRcADkJ24Hhr52Awb2KNF11CE7oyTHVBq%2BS3gexrVR8PxHgEz%2FjR1Hh2YfM5h0k5CYPD24I%2FpXJYQVTa1CpXFBrrxVET9QyK48z5hxu2nsHHBsV7g0zK1nIVibsw06db8x1F1zaR7Un9oq6A%3D" + }, + "barcode": { + "id": "U2FsdGVkX19XHGrCUHCfcSz/VLWmN1UU13QmDsH9ezEYtzHAUAeaLvN12Yv5eBJ7h7R2Og2pNm7mdHxfMR8gBJWEgHuBkodwXch1llhO6hNy9KXebNU+McRx9iEB/DqSzagjaxCiUNB1xitLgXDlUH5cH9naOCOtCHGMrEQW4h0=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19XHGrCUHCfcSz%2FVLWmN1UU13QmDsH9ezEYtzHAUAeaLvN12Yv5eBJ7h7R2Og2pNm7mdHxfMR8gBJWEgHuBkodwXch1llhO6hNy9KXebNU%2BMcRx9iEB%2FDqSzagjaxCiUNB1xitLgXDlUH5cH9naOCOtCHGMrEQW4h0%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-16T07:19:53.945Z", + "updated_at": "2022-09-16T07:26:35.361Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 2, + "object": "list", + "url": "/v1/vouchers/FreeShipping/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/FreeShipping/publications?page=1&limit=10" + }, + "object": "voucher" + } + } + } + } + } + }, + "404": { + "description": "Returns an error when requesting the code of a voucher that has been deleted or does not exist.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id v_OBVfpTVf24DBz0HZmKVZa5UEl1DUg2b", + "request_id": "v-0bb3403b9a158c87b2", + "resource_id": "v_OBVfpTVf24DBz0HZmKVZa5UEl1DUg2b", + "resource_type": "voucher" + } + } + } + } + } + } + } + }, + "put": { + "operationId": "update-voucher", + "tags": [ + "VOUCHERS API" + ], + "summary": "Update Voucher", + "description": "Updates the specified voucher by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged.\n\nFields other than the ones listed in the request body won't be modified. Even if provided, they will be silently skipped.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "required": true, + "description": "Specify the parameters to be updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_req_vouchers_code_PUT" + }, + "examples": { + "Percent Discount": { + "value": { + "category": "Second", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "percent_off": 45, + "percent_off_formula": "IF(ORDER_AMOUNT > 100;CUSTOMER_METADATA(\"age\");CUSTOMER_METADATA(\"age\") / 2)", + "amount_limit": 1800, + "effect": "APPLY_TO_ORDER" }, - "hierarchy": 1, + "start_date": "2020-02-01T00:00:00Z", + "expiration_date": "2023-12-31T23:59:59Z", + "validity_timeframe": { + "duration": "PT2H", + "interval": "P3D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "active": false, + "additional_info": "This voucher can be used with other coupons. Please feel free to do so.", "metadata": { - "has_budget": true, - "audience_restricted": false + "Season": "Winter" + } + } + }, + "Gift Card": { + "value": { + "category": "Existing Customers", + "gift": { + "amount": 20000, + "effect": "APPLY_TO_ITEMS" }, - "object": "promotion_tier" - }, - { - "valid": true, - "applicable_to": { - "data": [ - { - "object": "products_collection", - "id": "pc_a11pr0dUc75", - "strict": false, - "price": 800, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0a9f9ab4ab019a42d5", - "source_id": "prod_0a9f9ab4ab019a42d5", - "strict": true, - "price": 800, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0a9f9aeddb019a42db", - "source_id": "prod_0a9f9aeddb019a42db", - "strict": true, - "price": 800, - "effect": "APPLY_TO_EVERY" - }, + "start_date": "2021-01-01T00:00:00Z", + "active": false, + "additional_info": "This gift card is disabled.", + "metadata": { + "test": false, + "locale": "de-en-pl" + } + } + }, + "Loyalty Card": { + "value": { + "category": "Existing Customers", + "loyalty_card": { + "points": 20000 + }, + "active": false, + "additional_info": "This loyalty card is being deactivated and points updated.", + "metadata": { + "test": false, + "locale": "de-en-pl" + } + } + }, + "Amount Discount": { + "value": { + "category": "Existing Customers", + "discount": { + "amount_off": 2000, + "type": "AMOUNT", + "effect": "APPLY_TO_ITEMS" + }, + "start_date": "2021-01-01T00:00:00Z" + } + }, + "Fixed Discount": { + "value": { + "category": "Existing Customers", + "discount": { + "type": "FIXED", + "fixed_amount": 2000, + "effect": "APPLY_TO_ITEMS" + }, + "start_date": "2021-01-01T00:00:00Z" + } + }, + "Unit Discount": { + "value": { + "discount": { + "type": "UNIT", + "effect": "ADD_MANY_ITEMS", + "units": [ { - "object": "sku", - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "product_id": "prod_0b7d7dfb05cbe5c616", - "product_source_id": "Books", - "strict": true, - "price": 800, - "effect": "APPLY_TO_EVERY" + "unit_off": 2, + "unit_type": "prod_0a9f9ab4ab019a42d5", + "effect": "ADD_MISSING_ITEMS" }, { - "object": "product", - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "strict": true, - "price": 800, - "effect": "APPLY_TO_EVERY" - }, + "unit_off": 1, + "unit_type": "prod_0a9f9aeddb019a42db", + "effect": "ADD_MISSING_ITEMS" + } + ] + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns the voucher object if the update succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_obj_voucher_object" + }, + "examples": { + "Percent Discount": { + "value": { + "id": "v_9PbXndxO3S8xfztwMtIvuMXReonF248m", + "code": "percent1", + "campaign": null, + "campaign_id": null, + "category": "Second", + "category_id": "cat_0bb81a481615a37b5e", + "categories": [ { - "object": "product", - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "strict": true, - "price": 800, - "effect": "APPLY_TO_EVERY" + "id": "cat_0bb81a481615a37b5e", + "name": "Second", + "hierarchy": 2, + "created_at": "2022-09-20T05:58:01.561Z", + "object": "category" } ], - "total": 6, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "order": { - "amount": 72100, - "items_discount_amount": 67300, - "total_discount_amount": 67300, - "total_amount": 4800, - "items_applied_discount_amount": 67300, - "total_applied_discount_amount": 67300, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "discount_amount": 2100, - "applied_discount_amount": 2100, - "price": 2900, - "subtotal_amount": 800, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "amount_limit": 1800, + "percent_off": 45, + "percent_off_formula": "IF(ORDER_AMOUNT > 100;CUSTOMER_METADATA(\"age\");CUSTOMER_METADATA(\"age\") / 2)", + "effect": "APPLY_TO_ORDER" + }, + "gift": null, + "loyalty_card": null, + "start_date": "2020-02-01T00:00:00.000Z", + "expiration_date": "2023-12-31T23:59:59.000Z", + "validity_timeframe": { + "interval": "P3D", + "duration": "PT2H" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "active": false, + "additional_info": "This voucher can be used with other coupons. Please feel free to do so.", + "metadata": { + "Season": "Winter" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX19MPtNCPjoG/pKloolK+BZH/OCIpjYqj+B6IVJJmTYKeBINcB0JioL/tSw3iuK4FvgF8VyDyTfL26IpzbT81DDOnKeFIDUJraQDJiKxWcrG/RCFsVky4olBJ+GZFb9pLpN5gC/rn0pqYw==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19MPtNCPjoG%2FpKloolK%2BBZH%2FOCIpjYqj%2BB6IVJJmTYKeBINcB0JioL%2FtSw3iuK4FvgF8VyDyTfL26IpzbT81DDOnKeFIDUJraQDJiKxWcrG%2FRCFsVky4olBJ%2BGZFb9pLpN5gC%2Frn0pqYw%3D%3D" }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1, - "amount": 3100, - "discount_amount": 2300, - "applied_discount_amount": 2300, - "price": 3100, - "subtotal_amount": 800, - "product": { - "id": "prod_0a9f9aeddb019a42db", - "name": "Blue T-Shirt", - "price": 3100 - } + "barcode": { + "id": "U2FsdGVkX1/J73XXWgMf2BsVM21kpnFLQak5dpGzThYNTYPT62U6q+5RDlh/CXylkTrhegRnWJw1HA7iehT8iUoV4M4cV0KBdp5WgJ3lXeFZcpX3Mpu0T02PRcYbdCIiSO1kO50Y8Hg/heHcshw22Q==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FJ73XXWgMf2BsVM21kpnFLQak5dpGzThYNTYPT62U6q%2B5RDlh%2FCXylkTrhegRnWJw1HA7iehT8iUoV4M4cV0KBdp5WgJ3lXeFZcpX3Mpu0T02PRcYbdCIiSO1kO50Y8Hg%2FheHcshw22Q%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-19T14:41:30.976Z", + "updated_at": "2022-09-20T06:00:50.202Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": 101, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/percent1/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/percent1/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Gift Card": { + "value": { + "id": "v_7xaObxyK5LG62Rp0Xqpez7lqiBFL62pL", + "code": "welcomegiftcard", + "campaign": null, + "campaign_id": null, + "category": "Existing Customers", + "type": "GIFT_VOUCHER", + "discount": null, + "gift": { + "amount": 20000, + "balance": 20000, + "effect": "APPLY_TO_ITEMS" + }, + "loyalty_card": null, + "start_date": "2021-01-01T00:00:00.000Z", + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": false, + "additional_info": "This gift card is disabled.", + "metadata": { + "test": false, + "locale": "de-en-pl" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX1+mTbI2MdzBdMJ7AsOPKvGGgRB7O4oHZv5qq8I3M/OBPJm4PV8bTtBgR+oXOU4Jv1ucbIV7yg1mzC86LVFKjO7Ptnj+63mS9QdHvvILEAulBuZZQ+hZ0HmFXjDl4Quz/kUqGwffKGTziQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BmTbI2MdzBdMJ7AsOPKvGGgRB7O4oHZv5qq8I3M%2FOBPJm4PV8bTtBgR%2BoXOU4Jv1ucbIV7yg1mzC86LVFKjO7Ptnj%2B63mS9QdHvvILEAulBuZZQ%2BhZ0HmFXjDl4Quz%2FkUqGwffKGTziQ%3D%3D" }, - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "discount_amount": 2100, - "applied_discount_amount": 2100, - "price": 2900, - "subtotal_amount": 800, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } + "barcode": { + "id": "U2FsdGVkX184KgQ11OfpqB4WkJuH9ushSwZb0YrcN+8OaGPHxBQMiBr2axwnvQlZYv6YhqWtnc5iHByHrkg+6qYHxOLBPRMWCysIhcuUEB57IDhgYUHRPyM2bWjQadVHngGfVGCQ0CUy4PO/71RdMw==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX184KgQ11OfpqB4WkJuH9ushSwZb0YrcN%2B8OaGPHxBQMiBr2axwnvQlZYv6YhqWtnc5iHByHrkg%2B6qYHxOLBPRMWCysIhcuUEB57IDhgYUHRPyM2bWjQadVHngGfVGCQ0CUy4PO%2F71RdMw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-17T09:09:49.665Z", + "updated_at": "2022-02-17T11:11:48.071Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "redeemed_amount": 0, + "object": "list", + "url": "/v1/vouchers/welcomegiftcard/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/welcomegiftcard/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Loyalty Card": { + "value": { + "id": "v_l84t3fy3keMUiOeaHbN1cbTdW8O5eUlm", + "code": "welcomeloyalty", + "campaign": "Loyalty Campaign", + "campaign_id": "camp_E87CubZLZ8eoQt3c4kAEZsx0", + "category": "Existing Customers", + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 20000, + "balance": 20000 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": false, + "additional_info": "This loyalty card is being deactivated and points updated.", + "metadata": { + "test": false, + "locale": "de-en-pl" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX186PCWooyrNsjfI+nb+Y9ziUZ1k7xe+nJQ53Ms1ynNJOX6JXC6SwxS1WDhYwAKX5FxaDoKyuPf5MkQrkeB6u5bSx333ldAyLypNnqwBD2N17S64WFnTqV7eXUk3hS30wDYcz0cQAJFDcQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186PCWooyrNsjfI%2Bnb%2BY9ziUZ1k7xe%2BnJQ53Ms1ynNJOX6JXC6SwxS1WDhYwAKX5FxaDoKyuPf5MkQrkeB6u5bSx333ldAyLypNnqwBD2N17S64WFnTqV7eXUk3hS30wDYcz0cQAJFDcQ%3D%3D" }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1700, - "discount_amount": 900, - "applied_discount_amount": 900, - "price": 1700, - "subtotal_amount": 800, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100 - }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1700 - } + "barcode": { + "id": "U2FsdGVkX1/FWUg0RbOU7R7Zqg7/8Ba6oYuXrmIl7EdXGgaPMPfpePNGRzxBu4LP2dNEUO9h1Sh37MR1PxOoaemPwlgTDo/1G8dX1JjSppNoaTHhkzk2w4yutNhP7o8cq3ZBbT3TNMTKb2H3fUMc7A==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FFWUg0RbOU7R7Zqg7%2F8Ba6oYuXrmIl7EdXGgaPMPfpePNGRzxBu4LP2dNEUO9h1Sh37MR1PxOoaemPwlgTDo%2F1G8dX1JjSppNoaTHhkzk2w4yutNhP7o8cq3ZBbT3TNMTKb2H3fUMc7A%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-17T09:12:01.428Z", + "updated_at": "2022-02-17T11:20:12.447Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "redeemed_points": 0, + "object": "list", + "url": "/v1/vouchers/welcomeloyalty/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/welcomeloyalty/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Amount Discount": { + "value": { + "id": "v_jMIjKfG2oJ7vCwIPhsLsbXYGTdPLlbJd", + "code": "WelcomeDiscountAmount", + "campaign": null, + "campaign_id": null, + "category": "Existing Customers", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 2000, + "effect": "APPLY_TO_ITEMS" + }, + "gift": null, + "loyalty_card": null, + "start_date": "2021-01-01T00:00:00.000Z", + "expiration_date": "2022-12-31T23:59:59.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "PT1H" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": false, + "additional_info": "This voucher will remain inactive until enabled.", + "metadata": { + "test": true, + "locale": "de-en" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX1+TcEE9sZP6aMfAW3NZv9GWlCnUNn+SiK4FIbMRWWjN5hzTR7Yc/73yfldUb6SMgIvUNL551Nz/nPjrMY2iauia1MSWX21MItsSPfy8qccrC+WAlvpGK/1ZklnxYaeKqxTqwSXl7ppSlgcuEejbFiaqEDajvYUZsF4=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BTcEE9sZP6aMfAW3NZv9GWlCnUNn%2BSiK4FIbMRWWjN5hzTR7Yc%2F73yfldUb6SMgIvUNL551Nz%2FnPjrMY2iauia1MSWX21MItsSPfy8qccrC%2BWAlvpGK%2F1ZklnxYaeKqxTqwSXl7ppSlgcuEejbFiaqEDajvYUZsF4%3D" }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1, - "amount": 1500, - "discount_amount": 700, - "applied_discount_amount": 700, - "price": 1500, - "subtotal_amount": 800, - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage", - "price": 1500 + "barcode": { + "id": "U2FsdGVkX1/AhpZMq/h+Phi8JZF9m4qL8/U/Z5AST82jaAOnnhdHdbaGjB1+/0VFIdGBA8w2+3JX5qd61Dfk6yfiLCraVw7lYjQddCHF5SKtJs4hqsLHZevQTCzpZkeIHC3ThsG/fLZTsaNn8tjewd/W4qn/2Cc5NgTdv7fqui4=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FAhpZMq%2Fh%2BPhi8JZF9m4qL8%2FU%2FZ5AST82jaAOnnhdHdbaGjB1%2B%2F0VFIdGBA8w2%2B3JX5qd61Dfk6yfiLCraVw7lYjQddCHF5SKtJs4hqsLHZevQTCzpZkeIHC3ThsG%2FfLZTsaNn8tjewd%2FW4qn%2F2Cc5NgTdv7fqui4%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-17T11:41:05.236Z", + "updated_at": "2022-02-17T11:45:29.269Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_tDN7MJNayjrf1wyn", + "rule_id": "val_4j7DCRm2IS59", + "related_object_id": "v_jMIjKfG2oJ7vCwIPhsLsbXYGTdPLlbJd", + "related_object_type": "voucher", + "created_at": "2022-02-17T11:41:05.210Z", + "object": "validation_rules_assignment" } + ], + "total": 1 + }, + "redemption": { + "quantity": 10, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/WelcomeDiscountAmount/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/WelcomeDiscountAmount/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Fixed Discount": { + "value": { + "id": "v_B1Pe7QPTjXCHm8IcDkJAQs4g6Zc08UlK", + "code": "wou4w1Og", + "campaign": "Fixed", + "campaign_id": "camp_2jVA6EKGSAe6scyc3i1q9ROD", + "category": "Existing Customers", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "FIXED", + "effect": "APPLY_TO_ITEMS", + "fixed_amount": 2000 + }, + "gift": null, + "loyalty_card": null, + "start_date": "2021-01-01T00:00:00.000Z", + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX18zxYPpRIYeGHCoCAp3ZAPEUM0qacHQIIW/82oGOW24bFMA06kahjkZKVA/1mqqJsqh83C29Jhdz82KrRsM2zl9nzplu5hrmn7m0twnf5NQaTTcovEvnBV8Kej9tGhzc/dPwqE+xEKuDg==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX18zxYPpRIYeGHCoCAp3ZAPEUM0qacHQIIW%2F82oGOW24bFMA06kahjkZKVA%2F1mqqJsqh83C29Jhdz82KrRsM2zl9nzplu5hrmn7m0twnf5NQaTTcovEvnBV8Kej9tGhzc%2FdPwqE%2BxEKuDg%3D%3D" }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 60000, - "discount_amount": 59200, - "applied_discount_amount": 59200, - "price": 60000, - "subtotal_amount": 800, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "price": 60000 - } + "barcode": { + "id": "U2FsdGVkX18tsK1tz0X2IQWbFHCY4wZBDjoysFt1fBlWo/9bm/HNTci1Q3bSFuIzqIQqlU2TkSacFBgOWGuVG08XboZsqNSXXsAgST9tyoxpaOJ22B2EwWspdvuwJqvZh4PpEyh3BBDS7eOWsr3+Sw==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18tsK1tz0X2IQWbFHCY4wZBDjoysFt1fBlWo%2F9bm%2FHNTci1Q3bSFuIzqIQqlU2TkSacFBgOWGuVG08XboZsqNSXXsAgST9tyoxpaOJ22B2EwWspdvuwJqvZh4PpEyh3BBDS7eOWsr3%2BSw%3D%3D" } + }, + "is_referral_code": false, + "created_at": "2022-02-17T11:54:37.766Z", + "updated_at": "2022-02-17T12:04:53.346Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": 1, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/wou4w1Og/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/wou4w1Og/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Unit Discount": { + "value": { + "id": "v_cu8nyozvTDA413H17bH5BLha0cjxt7s8", + "code": "MultipleUnitTypesUnitDiscount", + "campaign": null, + "campaign_id": null, + "category": "New Customers", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "UNIT", + "effect": "ADD_MANY_ITEMS", + "units": [ + { + "unit_off": 2, + "unit_type": "prod_0a9f9ab4ab019a42d5", + "effect": "ADD_MISSING_ITEMS" + }, + { + "unit_off": 1, + "unit_type": "prod_0a9f9aeddb019a42db", + "effect": "ADD_MISSING_ITEMS" + } + ] + }, + "gift": null, + "loyalty_card": null, + "start_date": "2020-01-01T00:00:00.000Z", + "expiration_date": "2022-12-31T23:59:59.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "PT1H" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 ], + "active": false, + "additional_info": "This voucher will remain inactive until enabled.", "metadata": { - "payment_mean": [ - "credit-card" - ] + "test": true, + "locale": "de-en" }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "id": "promo_WEloFBBJ8JJDCxrtR1FPy6t1", - "name": "Get Amount Off", - "banner": "Every product is worth 8", + "assets": { + "qr": { + "id": "U2FsdGVkX1+ocJBtZ9NqT97gZ/QTfOz54TAoRoKO3tnCYBtHZWMghEHT0b2aFrPSL1lqMyf6fYy6DH2/DkH5p5Vd8dOozW1LV6wPVatWpa1lZMeMIB0OcARCW3q+3QydoW2KdliLKyksFwumH9C7Fsnj6HTaEbUjSttTZE/be+o=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BocJBtZ9NqT97gZ%2FQTfOz54TAoRoKO3tnCYBtHZWMghEHT0b2aFrPSL1lqMyf6fYy6DH2%2FDkH5p5Vd8dOozW1LV6wPVatWpa1lZMeMIB0OcARCW3q%2B3QydoW2KdliLKyksFwumH9C7Fsnj6HTaEbUjSttTZE%2Fbe%2Bo%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+Sly3IYj3EbZFHGGNxV6Ns4j76O8d0kRQe3WriJz5qY6s4GBIwlsdy13AciaQuiVt232HlOlZ4TzGaSSk3+ZMldwBGaTp/fIN9SGBW/NVUtfDOI2sIDLZCBBrdK7WVvtCQQ+1Y+6qClYg/QurJExCFRkDeKpKjDug=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BSly3IYj3EbZFHGGNxV6Ns4j76O8d0kRQe3WriJz5qY6s4GBIwlsdy13AciaQuiVt232HlOlZ4TzGaSSk3%2BZMldwBGaTp%2FfIN9SGBW%2FNVUtfDOI2sIDLZCBBrdK7WVvtCQQ%2B1Y%2B6qClYg%2FQurJExCFRkDeKpKjDug%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-18T06:27:45.619Z", + "updated_at": "2022-02-18T06:31:08.630Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": 5, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/publications?page=1&limit=10" + }, + "object": "voucher" + } + } + } + } + } + }, + "400": { + "description": "Returns an error if, for example, the AMOUNT type discount doesn't have the `type` attribute defined.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Invalid Voucher": { + "value": { + "code": 400, + "key": "invalid_voucher", + "message": "Invalid Voucher", + "details": "It is not possible to change Voucher discount type", + "request_id": "b7f5149d-83e5-46ef-93ad-ef191a87b185" + } + } + } + } + } + } + } + }, + "delete": { + "operationId": "delete-voucher", + "tags": [ + "VOUCHERS API" + ], + "summary": "Delete Voucher", + "description": "Deletes a voucher. This operation cannot be undone. Additionally, this operation removes any redemptions on the voucher.", + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "force", + "description": "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." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." + }, + "404": { + "description": "Returns an error indicating that the voucher with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Voucher Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id 10OFF", + "request_id": "v-0ae28d3cec96bb1b7e", + "resource_id": "10OFF", + "resource_type": "voucher" + } + } + } + } + } + } + } + }, + "post": { + "operationId": "create-voucher", + "tags": [ + "VOUCHERS API" + ], + "summary": "Create Voucher", + "description": "Create a standalone voucher. You can choose to create a `GIFT_VOUCHER`, a `DISCOUNT_VOUCHER`, or a `LOYALTY_CARD`. The code path parameter can use all letters of the English alphabet, Arabic numerals and special characters. \n\nWhen you create a new voucher, you can specify a type to create it.\nCreating a new voucher will create a new stand alone voucher if no `campaign` name or `campaign_id` is provided. In case of the loyalty card, a campaign name is required.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the details of the voucher that you would like to create.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_req_vouchers_code_POST" + }, + "examples": { + "Percentage Discount": { + "value": { + "category": "New Customers", + "type": "DISCOUNT_VOUCHER", "discount": { - "type": "FIXED", - "effect": "APPLY_TO_ITEMS" + "percent_off": 10, + "type": "PERCENT", + "effect": "APPLY_TO_ORDER" }, - "campaign": { - "id": "camp_Ds2u0MSFGuKhDuR3jEa5dHBx", - "start_date": null, - "expiration_date": null, - "active": true, - "object": "campaign" + "start_date": "2022-01-01T00:00:00Z", + "expiration_date": "2022-12-31T23:59:59Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P2D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": false, + "additional_info": "This voucher will remain inactive until enabled.", + "redemption": { + "quantity": 10 }, - "hierarchy": 2, - "discount_amount": 67300, - "applied_discount_amount": 67300, "metadata": { - "has_budget": true, - "audience_restricted": false + "test": true, + "locale": "de-en" }, - "object": "promotion_tier" + "validation_rules": [ + "val_4j7DCRm2IS59" + ] } - ] - } - }, - "Campaign specific": { - "value": { - "valid": true, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "promotions": [ - { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" + }, + "Gift Card": { + "value": { + "category": "New Customers", + "type": "GIFT_VOUCHER", + "gift": { + "amount": 10000, + "effect": "APPLY_TO_ORDER" }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "order": { - "amount": 72100, - "discount_amount": 100, - "total_discount_amount": 100, - "total_amount": 72000, - "applied_discount_amount": 100, - "total_applied_discount_amount": 100, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1, - "amount": 3100, - "price": 3100, - "subtotal_amount": 3100, - "product": { - "id": "prod_0a9f9aeddb019a42db", - "name": "Blue T-Shirt", - "price": 3100 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1700, - "price": 1700, - "subtotal_amount": 1700, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100 - }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1700 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1, - "amount": 1500, - "price": 1500, - "subtotal_amount": 1500, - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage", - "price": 1500 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 60000, - "price": 60000, - "subtotal_amount": 60000, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "price": 60000 - } - } - ], - "metadata": { - "payment_mean": [ - "credit-card" - ] - }, - "customer_id": null, - "referrer_id": null, - "object": "order" + "start_date": "2022-01-01T00:00:00Z", + "active": true, + "additional_info": "This gift card is enabled immediately upon creation.", + "metadata": { + "test": true, + "locale": "de-en" + } + } + }, + "Loyalty Card": { + "value": { + "category": "New Customers", + "campaign": "camp_E87CubZLZ8eoQt3c4kAEZsx0", + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 10000 }, - "id": "promo_g83qUzYZpfX0OMAFOVoQuOYG", - "name": "1", + "additional_info": "This loyalty card is enabled immediately upon creation.", + "metadata": { + "test": true, + "locale": "de-en" + } + } + }, + "Amount Discount with Formula": { + "value": { + "category": "First", + "type": "DISCOUNT_VOUCHER", "discount": { "type": "AMOUNT", - "effect": "APPLY_TO_ORDER", - "amount_off": 100 + "amount_off": 100, + "amount_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", + "effect": "APPLY_TO_ORDER" }, - "campaign": { - "id": "camp_nYcAyjFXmEaBU0nB7EQ4hVTr", - "start_date": null, - "expiration_date": null, - "active": true, - "categories": [ - { - "id": "cat_0b5f66bc97ce5be3c6", - "name": "Sixth", - "hierarchy": 6, - "created_at": "2022-07-13T08:27:14.926Z", - "object": "category" - } - ], - "object": "campaign" + "start_date": "2020-01-01T00:00:00Z", + "expiration_date": "2022-12-31T23:59:59Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P2D" }, - "hierarchy": 1, - "discount_amount": 100, - "applied_discount_amount": 100, - "metadata": {}, - "object": "promotion_tier" + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": true, + "additional_info": "This voucher can be used with other coupons.", + "redemption": { + "quantity": 100 + }, + "metadata": { + "Season": "Spring" + } } - ] - } - }, - "Promotion Tier Metadata": { - "value": { - "valid": true, - "tracking_id": "track_oNgl7cQ8tVTg/fIVul/GKA==", - "promotions": [ - { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" + }, + "Percent Discount with Formula": { + "value": { + "category": "First", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "percent_off": 40, + "percent_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", + "amount_limit": 1700, + "effect": "APPLY_TO_ORDER" }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" + "start_date": "2020-01-01T00:00:00Z", + "expiration_date": "2022-12-31T23:59:59Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P2D" }, - "tracking_id": "track_oNgl7cQ8tVTg/fIVul/GKA==", - "order": { - "amount": 72100, - "total_amount": 72100, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1, - "amount": 3100, - "price": 3100, - "subtotal_amount": 3100, - "product": { - "id": "prod_0a9f9aeddb019a42db", - "name": "Blue T-Shirt", - "price": 3100 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1700, - "price": 1700, - "subtotal_amount": 1700, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100 - }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1700 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1, - "amount": 1500, - "price": 1500, - "subtotal_amount": 1500, - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage", - "price": 1500 - } + "validity_day_of_week": [ + 0, + 1 + ], + "active": true, + "additional_info": "This voucher can be used with other coupons.", + "redemption": { + "quantity": 101 + }, + "metadata": { + "Season": "Fall" + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a voucher object if the call succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_obj_voucher_object" + }, + "examples": { + "Percentage Discount": { + "value": { + "id": "v_MBOEmHelKwvykVZ8JcT4TE5Kla5IMJyc", + "code": "welcome", + "campaign": null, + "campaign_id": null, + "category": "New Customers", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "percent_off": 10, + "effect": "APPLY_TO_ORDER" + }, + "gift": null, + "loyalty_card": null, + "start_date": "2022-01-01T00:00:00.000Z", + "expiration_date": "2022-12-31T23:59:59.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "PT1H" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": false, + "additional_info": "This voucher will remain inactive until enabled.", + "metadata": { + "test": true, + "locale": "de-en" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX1+by33CNzWu6xXjCrLKRr1+H9K3I9wOSa7idiHrMYJe0HlrWiy7INhaJf1BnaKJjLKcUC+4/hCbILtJ9lHXZWhewG5q5rmx29gK0IH2eRauw1qCZKIlXfqeGTG2T5ftPsEl1D4xf8W2MA==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bby33CNzWu6xXjCrLKRr1%2BH9K3I9wOSa7idiHrMYJe0HlrWiy7INhaJf1BnaKJjLKcUC%2B4%2FhCbILtJ9lHXZWhewG5q5rmx29gK0IH2eRauw1qCZKIlXfqeGTG2T5ftPsEl1D4xf8W2MA%3D%3D" }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 60000, - "price": 60000, - "subtotal_amount": 60000, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "price": 60000 + "barcode": { + "id": "U2FsdGVkX19wOdFeXYXZ4Xu22L0Ummk03Urz/ZTnXUFeHeehtK4L6RTvNgVeSR+McTZR4DYNLEGydZ+Fo2xEqqM1UWyl8Bx22Pi1CxghADOcy3bAvSca7EEPpvKrCY403UWUDvaO/OEAjvVoiEuaHA==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19wOdFeXYXZ4Xu22L0Ummk03Urz%2FZTnXUFeHeehtK4L6RTvNgVeSR%2BMcTZR4DYNLEGydZ%2BFo2xEqqM1UWyl8Bx22Pi1CxghADOcy3bAvSca7EEPpvKrCY403UWUDvaO%2FOEAjvVoiEuaHA%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-17T09:05:34.668Z", + "updated_at": null, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_74F7QZoYbUoljwQO", + "rule_id": "val_4j7DCRm2IS59", + "related_object_id": "v_MBOEmHelKwvykVZ8JcT4TE5Kla5IMJyc", + "related_object_type": "voucher", + "created_at": "2022-02-17T09:05:34.642Z", + "object": "validation_rules_assignment" } + ], + "total": 1 + }, + "redemption": { + "quantity": 10, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/welcome/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/welcome/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Gift Card": { + "value": { + "id": "v_7xaObxyK5LG62Rp0Xqpez7lqiBFL62pL", + "code": "welcomegiftcard", + "campaign": null, + "campaign_id": null, + "category": "New Customers", + "type": "GIFT_VOUCHER", + "discount": null, + "gift": { + "amount": 10000, + "balance": 10000, + "effect": "APPLY_TO_ORDER" + }, + "loyalty_card": null, + "start_date": "2022-01-01T00:00:00.000Z", + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": "This gift card is enabled immediately upon creation.", + "metadata": { + "test": true, + "locale": "de-en" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX1+mTbI2MdzBdMJ7AsOPKvGGgRB7O4oHZv5qq8I3M/OBPJm4PV8bTtBgR+oXOU4Jv1ucbIV7yg1mzC86LVFKjO7Ptnj+63mS9QdHvvILEAulBuZZQ+hZ0HmFXjDl4Quz/kUqGwffKGTziQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BmTbI2MdzBdMJ7AsOPKvGGgRB7O4oHZv5qq8I3M%2FOBPJm4PV8bTtBgR%2BoXOU4Jv1ucbIV7yg1mzC86LVFKjO7Ptnj%2B63mS9QdHvvILEAulBuZZQ%2BhZ0HmFXjDl4Quz%2FkUqGwffKGTziQ%3D%3D" }, - { - "object": "order_item", - "product_id": "prod_5h1pp1ng", - "quantity": 1, - "discount_quantity": 1, - "initial_quantity": 0, - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping" - } + "barcode": { + "id": "U2FsdGVkX184KgQ11OfpqB4WkJuH9ushSwZb0YrcN+8OaGPHxBQMiBr2axwnvQlZYv6YhqWtnc5iHByHrkg+6qYHxOLBPRMWCysIhcuUEB57IDhgYUHRPyM2bWjQadVHngGfVGCQ0CUy4PO/71RdMw==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX184KgQ11OfpqB4WkJuH9ushSwZb0YrcN%2B8OaGPHxBQMiBr2axwnvQlZYv6YhqWtnc5iHByHrkg%2B6qYHxOLBPRMWCysIhcuUEB57IDhgYUHRPyM2bWjQadVHngGfVGCQ0CUy4PO%2F71RdMw%3D%3D" } - ], - "metadata": { - "payment_mean": [ - "credit-card" - ] }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "id": "promo_jp2l6wRcTL4cARG5E8XRo42A", - "name": "Get", - "banner": "Free shipping", - "discount": { - "type": "UNIT", - "effect": "ADD_MISSING_ITEMS", - "unit_off": 1, - "unit_type": "prod_5h1pp1ng", - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping" - } - }, - "campaign": { - "id": "camp_wCEdu2igBcyv7CNna9ughGKc", + "is_referral_code": false, + "created_at": "2022-02-17T09:09:49.665Z", + "updated_at": null, + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "redeemed_amount": 0, + "object": "list", + "url": "/v1/vouchers/welcomegiftcard/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/welcomegiftcard/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Loyalty Card": { + "value": { + "id": "v_l84t3fy3keMUiOeaHbN1cbTdW8O5eUlm", + "code": "welcomeloyalty", + "campaign": "Loyalty Campaign", + "campaign_id": "camp_E87CubZLZ8eoQt3c4kAEZsx0", + "category": "New Customers", + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 10000, + "balance": 10000 + }, "start_date": null, "expiration_date": null, - "active": true, - "object": "campaign" - }, - "hierarchy": 1, - "metadata": { - "has_budget": true, - "audience_restricted": false - }, - "object": "promotion_tier" - }, - { - "valid": true, - "applicable_to": { - "data": [ - { - "object": "products_collection", - "id": "pc_a11pr0dUc75", - "strict": false, - "price": 800, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0a9f9ab4ab019a42d5", - "source_id": "prod_0a9f9ab4ab019a42d5", - "strict": true, - "price": 800, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0a9f9aeddb019a42db", - "source_id": "prod_0a9f9aeddb019a42db", - "strict": true, - "price": 800, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "sku", - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "product_id": "prod_0b7d7dfb05cbe5c616", - "product_source_id": "Books", - "strict": true, - "price": 800, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "strict": true, - "price": 800, - "effect": "APPLY_TO_EVERY" + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": "This loyalty card is enabled immediately upon creation.", + "metadata": { + "test": true, + "locale": "de-en" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX186PCWooyrNsjfI+nb+Y9ziUZ1k7xe+nJQ53Ms1ynNJOX6JXC6SwxS1WDhYwAKX5FxaDoKyuPf5MkQrkeB6u5bSx333ldAyLypNnqwBD2N17S64WFnTqV7eXUk3hS30wDYcz0cQAJFDcQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186PCWooyrNsjfI%2Bnb%2BY9ziUZ1k7xe%2BnJQ53Ms1ynNJOX6JXC6SwxS1WDhYwAKX5FxaDoKyuPf5MkQrkeB6u5bSx333ldAyLypNnqwBD2N17S64WFnTqV7eXUk3hS30wDYcz0cQAJFDcQ%3D%3D" }, + "barcode": { + "id": "U2FsdGVkX1/FWUg0RbOU7R7Zqg7/8Ba6oYuXrmIl7EdXGgaPMPfpePNGRzxBu4LP2dNEUO9h1Sh37MR1PxOoaemPwlgTDo/1G8dX1JjSppNoaTHhkzk2w4yutNhP7o8cq3ZBbT3TNMTKb2H3fUMc7A==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FFWUg0RbOU7R7Zqg7%2F8Ba6oYuXrmIl7EdXGgaPMPfpePNGRzxBu4LP2dNEUO9h1Sh37MR1PxOoaemPwlgTDo%2F1G8dX1JjSppNoaTHhkzk2w4yutNhP7o8cq3ZBbT3TNMTKb2H3fUMc7A%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-17T09:12:01.428Z", + "updated_at": null, + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "redeemed_points": 0, + "object": "list", + "url": "/v1/vouchers/welcomeloyalty/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/welcomeloyalty/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Amount Discount with Formula": { + "value": { + "id": "v_pmjVYKEDFzMqwNroHTlFcI1yKLqUcVVS", + "code": "amount1", + "campaign": null, + "campaign_id": null, + "category": "First", + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ { - "object": "product", - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "strict": true, - "price": 800, - "effect": "APPLY_TO_EVERY" + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" } ], - "total": 6, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_oNgl7cQ8tVTg/fIVul/GKA==", - "order": { - "amount": 72100, - "items_discount_amount": 67300, - "total_discount_amount": 67300, - "total_amount": 4800, - "items_applied_discount_amount": 67300, - "total_applied_discount_amount": 67300, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "discount_amount": 2100, - "applied_discount_amount": 2100, - "price": 2900, - "subtotal_amount": 800, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1, - "amount": 3100, - "discount_amount": 2300, - "applied_discount_amount": 2300, - "price": 3100, - "subtotal_amount": 800, - "product": { - "id": "prod_0a9f9aeddb019a42db", - "name": "Blue T-Shirt", - "price": 3100 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "discount_amount": 2100, - "applied_discount_amount": 2100, - "price": 2900, - "subtotal_amount": 800, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1700, - "discount_amount": 900, - "applied_discount_amount": 900, - "price": 1700, - "subtotal_amount": 800, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100 - }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1700 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1, - "amount": 1500, - "discount_amount": 700, - "applied_discount_amount": 700, - "price": 1500, - "subtotal_amount": 800, - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage", - "price": 1500 - } + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 100, + "amount_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", + "effect": "APPLY_TO_ORDER" + }, + "gift": null, + "loyalty_card": null, + "start_date": "2020-01-01T00:00:00.000Z", + "expiration_date": "2022-12-31T23:59:59.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "PT1H" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": true, + "additional_info": "This voucher can be used with other coupons.", + "metadata": { + "Season": "Spring" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX1+aMFY2yoGxlWkhulvTPR8RlMZtfOaWXnL6PCnegsV73aCTsue+JlUrQsbh+dmp2gJigaVixgvyC7/zUxQjf8tnVT4R79G4LmUkltHMqHsaf++fsP1G07nDl9/2WHh/QVb6z4KP/DX5Dw==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BaMFY2yoGxlWkhulvTPR8RlMZtfOaWXnL6PCnegsV73aCTsue%2BJlUrQsbh%2Bdmp2gJigaVixgvyC7%2FzUxQjf8tnVT4R79G4LmUkltHMqHsaf%2B%2BfsP1G07nDl9%2F2WHh%2FQVb6z4KP%2FDX5Dw%3D%3D" }, + "barcode": { + "id": "U2FsdGVkX1+X2OimwSCEmGvGrZXXK+b4OrStQELVsHRup8Su+uISCOBz7xWdbpoLVJlSFepcRxSNUUdjcbpgKH7YNfaclrta8Ig6/GK/4YFlh0cPKCGOG5WWyXWzxxmVgVqRdI7KR8/hdaq2FCQeWA==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BX2OimwSCEmGvGrZXXK%2Bb4OrStQELVsHRup8Su%2BuISCOBz7xWdbpoLVJlSFepcRxSNUUdjcbpgKH7YNfaclrta8Ig6%2FGK%2F4YFlh0cPKCGOG5WWyXWzxxmVgVqRdI7KR8%2Fhdaq2FCQeWA%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-19T14:22:50.552Z", + "updated_at": null, + "redemption": { + "quantity": 100, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/amount1/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/amount1/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Percent Discount with Formula": { + "value": { + "id": "v_9PbXndxO3S8xfztwMtIvuMXReonF248m", + "code": "percent1", + "campaign": null, + "campaign_id": null, + "category": "First", + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 60000, - "discount_amount": 59200, - "applied_discount_amount": 59200, - "price": 60000, - "subtotal_amount": 800, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "price": 60000 - } + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" } ], - "metadata": { - "payment_mean": [ - "credit-card" - ] + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "amount_limit": 1700, + "percent_off": 40, + "percent_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", + "effect": "APPLY_TO_ORDER" }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "id": "promo_WEloFBBJ8JJDCxrtR1FPy6t1", - "name": "Get Amount Off", - "banner": "Every product is worth 8", - "discount": { - "type": "FIXED", - "effect": "APPLY_TO_ITEMS" - }, - "campaign": { - "id": "camp_Ds2u0MSFGuKhDuR3jEa5dHBx", - "start_date": null, - "expiration_date": null, + "gift": null, + "loyalty_card": null, + "start_date": "2020-01-01T00:00:00.000Z", + "expiration_date": "2022-12-31T23:59:59.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "PT1H" + }, + "validity_day_of_week": [ + 0, + 1 + ], "active": true, - "object": "campaign" - }, - "hierarchy": 2, - "discount_amount": 67300, - "applied_discount_amount": 67300, - "metadata": { - "has_budget": true, - "audience_restricted": false - }, - "object": "promotion_tier" + "additional_info": "This voucher can be used with other coupons.", + "metadata": { + "Season": "Fall" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX19MPtNCPjoG/pKloolK+BZH/OCIpjYqj+B6IVJJmTYKeBINcB0JioL/tSw3iuK4FvgF8VyDyTfL26IpzbT81DDOnKeFIDUJraQDJiKxWcrG/RCFsVky4olBJ+GZFb9pLpN5gC/rn0pqYw==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19MPtNCPjoG%2FpKloolK%2BBZH%2FOCIpjYqj%2BB6IVJJmTYKeBINcB0JioL%2FtSw3iuK4FvgF8VyDyTfL26IpzbT81DDOnKeFIDUJraQDJiKxWcrG%2FRCFsVky4olBJ%2BGZFb9pLpN5gC%2Frn0pqYw%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/J73XXWgMf2BsVM21kpnFLQak5dpGzThYNTYPT62U6q+5RDlh/CXylkTrhegRnWJw1HA7iehT8iUoV4M4cV0KBdp5WgJ3lXeFZcpX3Mpu0T02PRcYbdCIiSO1kO50Y8Hg/heHcshw22Q==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FJ73XXWgMf2BsVM21kpnFLQak5dpGzThYNTYPT62U6q%2B5RDlh%2FCXylkTrhegRnWJw1HA7iehT8iUoV4M4cV0KBdp5WgJ3lXeFZcpX3Mpu0T02PRcYbdCIiSO1kO50Y8Hg%2FheHcshw22Q%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-19T14:41:30.976Z", + "updated_at": null, + "redemption": { + "quantity": 101, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/percent1/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/percent1/publications?page=1&limit=10" + }, + "object": "voucher" + } } - ] - } - } - } - } - } - } - } - } - }, - "/v1/promotions/tiers/{tierId}/validation": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "tierId", - "in": "path", - "required": true, - "description": "Unique promotion tier ID." - } - ], - "post": { - "operationId": "validate-promotion-tier", - "deprecated": true, - "tags": [ - "VALIDATIONS API" - ], - "summary": "Validate Promotion Tier [Deprecated]", - "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for promotion tier redemption, and we do not recommend using it. The new [Stackable Discounts API](ref:redeem-stacked-discounts) 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. \n\nTo verify whether the promotion tier discount can be applied to an order. This method is designed for server side integration which means that it is accessible only through private keys.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Provide the customer and order context.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/6_req_validate_promotion_tier" - }, - "examples": { - "Using IDs": { - "value": { - "customer": { - "source_id": "test-user@email.io" - }, - "order": { - "id": "ord_71uW6qnB5CFZlLHCeCNC4qtS" + } } } }, - "Using Redemption Metadata": { - "value": { - "customer": { - "source_id": "test-user@email.com" - }, - "order": { - "amount": 200000, - "items": [ - { - "product_id": "prod_anJ03RZZq74z4v", - "quantity": 2 - }, - { - "sku_id": "sku_0KtP4rvwEECQ2U", - "related_object": "sku", - "quantity": 1 + "409": { + "description": "Returns an error if a voucher code already exists.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_409_duplicate_found" + }, + "examples": { + "Duplicate Code": { + "value": { + "code": 409, + "key": "duplicate_found", + "message": "Duplicated resource found", + "details": "Duplicated voucher exists with id CODE", + "request_id": "v-0ae786a8f786b73dfa", + "resource_id": "CODE", + "resource_type": "voucher" + } } - ] - }, - "metadata": { - "store_names": "Store 1 - New York - Broadway" + } } } } } } - } - }, - "responses": { - "200": { - "description": "Returns validation result in `valid` key of the promotion tier object. Returns `true` if the promotion tier rules and validation rules are satisfied given the request body parameters. Returns `false` if the data provided in the payload does not meet validation rules or promotion tier requirements.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/6_res_validate_promotion_tier" - }, - "examples": { - "Promotion Valid": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_OWyBVb1mg1qnieLLNygh19A0Ia7FsJck", - "order": { - "id": "ord_71uW6qnB5CFZlLHCeCNC4qtS", - "source_id": null, - "created_at": "2022-11-17T12:17:55.096Z", - "updated_at": null, - "status": "CREATED", - "amount": 9918200, - "initial_amount": 468200, - "items_discount_amount": 9450000, - "total_discount_amount": 9450000, - "total_amount": 468200, - "items_applied_discount_amount": 9450000, - "total_applied_discount_amount": 9450000, - "items": [ - { - "object": "order_item", - "source_id": "webinar_BF_sweater_pink_sweater", - "related_object": "product", - "quantity": 1, - "amount": 6500, - "price": 6500, - "subtotal_amount": 6500 - }, - { - "object": "order_item", - "source_id": "webinar_BF_pants_navy_sweat_pants", - "related_object": "product", - "quantity": 1, - "amount": 6000, - "price": 6000, - "subtotal_amount": 6000 - }, - { - "object": "order_item", - "source_id": "5h1pp1ng", - "related_object": "product", - "quantity": 1, - "amount": 2000, - "price": 2000, - "subtotal_amount": 2000, - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping" - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "related_object": "product", - "quantity": 2, - "amount": 10000, - "price": 5000, - "subtotal_amount": 10000 + }, + "/v1/vouchers/": { + "post": { + "operationId": "generate-random-code", + "tags": [ + "VOUCHERS API" + ], + "summary": "Generate Random Code", + "description": "Create a standalone voucher. You can choose to create a `GIFT_VOUCHER`, a `DISCOUNT_VOUCHER`, or a `LOYALTY_CARD`. \n\nWhen you create a new voucher, you can specify a type to create it.\nCreating a new voucher will create a new stand alone voucher if no `campaign` name or `campaign_id` is provided. In case of the loyalty card, a campaign name is required.\n\nYou can optionally use the `code` parameter to define a specific code or the `code_config` parameter to design rules for Voucherify API to create a random code. If neither of the two parameters are passed, then a random code is generated by the Voucherify API.\n\nThis method will return an error when trying to create a voucher that already exists.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the details of the voucher that you would like to create.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_req_vouchers__POST" + }, + "examples": { + "Percentage Discount": { + "value": { + "category": "New Customers", + "code": "NEW-WELCOME-COUPON", + "type": "DISCOUNT_VOUCHER", + "campaign_id": "camp_Y6dLsYIZloGqP8izufXY6SSJ", + "discount": { + "percent_off": 10, + "type": "PERCENT", + "effect": "APPLY_TO_ORDER" }, - { - "object": "order_item", - "source_id": "webinar_BF_sweater_pearl", - "related_object": "product", - "quantity": 2, - "amount": 22000, - "price": 11000, - "subtotal_amount": 22000 + "start_date": "2016-01-01T00:00:00Z", + "expiration_date": "2022-12-31T23:59:59Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P2D" }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1700, - "price": 1700, - "subtotal_amount": 1700, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100 - }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1700 - } + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": false, + "additional_info": "This voucher will remain inactive until enabled.", + "redemption": { + "quantity": 10 }, - { - "object": "order_item", - "product_id": "prod_0bae32322150fd0546", - "quantity": 2, - "amount": 420000, - "price": 210000, - "subtotal_amount": 420000, - "product": { - "id": "prod_0bae32322150fd0546", - "name": "Samsung Phone", - "price": 210000 - } + "metadata": { + "test": true, + "locale": "de-en" }, - { - "object": "order_item", - "product_id": "prod_0bae2dc5a090fd0184", - "sku_id": "sku_0bae3b28f610fd0da1", - "quantity": 45, - "discount_quantity": 45, - "initial_quantity": 0, - "amount": 9450000, - "discount_amount": 9450000, - "initial_amount": 0, - "applied_discount_amount": 9450000, - "price": 210000, - "subtotal_amount": 0, - "product": { - "id": "prod_0bae2dc5a090fd0184", - "source_id": "first_product", - "name": "Samsung Phone 1", - "price": 220000 - }, - "sku": { - "id": "sku_0bae3b28f610fd0da1", - "source_id": "first_product_sku_1", - "sku": "Samsung phone 256GB", - "price": 210000 - } - } - ], - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "id": "promo_ZWkx6R0I1Ts3N9HL4kfTdxOm", - "name": "Add new SKU", - "discount": { - "type": "UNIT", - "effect": "ADD_NEW_ITEMS", - "unit_off": 45, - "unit_type": "sku_0bae3b28f610fd0da1", - "sku": { - "id": "sku_0bae3b28f610fd0da1", - "source_id": "first_product_sku_1", - "sku": "Samsung phone 256GB" - }, - "product": { - "id": "prod_0bae2dc5a090fd0184", - "source_id": "first_product", - "name": "Samsung Phone 1" + "validation_rules": [ + "val_4j7DCRm2IS59" + ] } }, - "campaign": { - "id": "camp_40LC42P5NFbkkD4RWoJ4btks", - "start_date": null, - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "hierarchy": 4, - "discount_amount": 9450000, - "applied_discount_amount": 9450000, - "metadata": {}, - "object": "promotion_tier" - } - }, - "Promotion Invalid with Error Message": { - "value": { - "valid": false, - "reason": "redemption does not match validation rules", - "error": { - "code": 400, - "key": "redemption_rules_violated", - "message": "redemption does not match validation rules", - "details": "Promotion Tier cannot be redeemed because of violated validation rules: val_eqSA1dXOv491", - "request_id": "v-0c034585fd16cf6958" - }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "id": "promo_R50x0A66V6jmPhM7YYOcFZfL", - "name": "Add missing order items", - "banner": "Add Boho Vintage", - "discount": { - "type": "UNIT", - "effect": "ADD_MISSING_ITEMS", - "unit_off": 5, - "unit_type": "prod_0b72b0bd64d198e3ae" - }, - "campaign": { - "id": "camp_40LC42P5NFbkkD4RWoJ4btks", - "start_date": null, - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "hierarchy": 1, - "metadata": { - "has_budget": true - }, - "object": "promotion_tier" - } - }, - "Promotion Invalid with Custom Message": { - "value": { - "valid": false, - "reason": "Inactive Promotion", - "error": { - "message": "Promotion is inactive this weekend." - }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "id": "promo_R50x0A66V6jmPhM7YYOcFZfL", - "name": "Add missing order items", - "banner": "Add Boho Vintage", - "discount": { - "type": "UNIT", - "effect": "ADD_MISSING_ITEMS", - "unit_off": 5, - "unit_type": "prod_0b72b0bd64d198e3ae" - }, - "campaign": { - "id": "camp_40LC42P5NFbkkD4RWoJ4btks", - "start_date": null, - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "hierarchy": 1, - "metadata": { - "has_budget": true - }, - "object": "promotion_tier" - } - } - } - } - } - } - } - } - }, - "/v1/redemption-object": { - "get": { - "operationId": "redemption-object", - "tags": [ - "REDEMPTIONS API" - ], - "summary": "Redemption Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Redemption Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/7_obj_redemption_object" - } - } - } - } - } - } - }, - "/v1/rollback-redemption-object": { - "get": { - "operationId": "rollback-redemption-object", - "tags": [ - "REDEMPTIONS API" - ], - "summary": "Rollback Redemption Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Rollback Redemption Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/7_obj_rollback_redemption_object_extended" - } - } - } - } - } - } - }, - "/v1/stackable-redemptions-object": { - "get": { - "operationId": "stackable-redemptions-object", - "tags": [ - "STACKABLE DISCOUNTS API" - ], - "summary": "Stackable Redemptions Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Stackable Redemptions Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/19_res_redemptions_POST" - } - } - } - } - } - } - }, - "/v1/redemptions": { - "get": { - "operationId": "list-redemptions", - "tags": [ - "REDEMPTIONS API" - ], - "summary": "List Redemptions", - "description": "Returns a list of redemptions previously created. The redemptions are returned in a sorted order, with the most recent redemptions appearing first. The response returns a list of redemptions of all vouchers. \n\n## Filtering results\nThe result can be narrowed according to specified (or default) filters, for example, you can sort redemptions by date:\n`https://api.voucherify.io/v1/redemptions?limit=3&[created_at][before]=2017-09-08T13:52:18.227Z`. A filter based on the object `created_at` field narrows down the results and lists redemptions done before or after a particular date time. You can use the following options: `[created_at][after]`, `[created_at][before]`. A date value must be presented in ISO 8601 format (`2016-11-16T14:14:31Z` or `2016-11-16`). An example: `[created_at][before]=2017-09-08T13:52:18.227Z`.\n\n## Failed Redemptions\n\nA redemption may fail for various reasons. You can figure out an exact reason from the `failure_code`:\n- `resource_not_found` - voucher with given code does not exist\n- `voucher_not_active` - voucher is not active yet (before start date)\n- `voucher_expired` - voucher has already expired (after expiration date)\n- `voucher_disabled` - voucher has been disabled (`active: false`)\n- `quantity_exceeded` - voucher's redemptions limit has been exceeded\n- `gift_amount_exceeded` - gift amount has been exceeded\n- `customer_rules_violated` - customer did not match the segment\n- `order_rules_violated` - order did not match validation rules\n- `invalid_order` - order was specified incorrectly\n- `invalid_amount` - order amount was specified incorrectly\n- `missing_amount` - order amount was not specified\n- `missing_order_items` - order items were not specified\n- `missing_customer` - customer was not specified", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "result", - "description": "A filter on the list based on the redemption result. Available options are: `SUCCESS`, `FAILURE`. You can provide multiple values by repeating the param." - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "campaign", - "description": "A filter by the campaign **name** that the redemption resources originate from." - }, - { - "schema": { - "type": "string", - "example": "cust_IkrTR674vvQvr9a4rDMiqglY" - }, - "in": "query", - "name": "customer", - "description": "Return redemptions performed by the customer with given `id`." - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "id", - "-id", - "voucher_code", - "-voucher_code", - "tracking_id", - "-tracking_id", - "customer_id", - "-customer_id" - ] - }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." - }, - { - "$ref": "#/components/parameters/created_at" - }, - { - "name": "filters", - "in": "query", - "schema": { - "type": "object", - "properties": { - "voucher_code": { - "type": "object", - "description": "Unique voucher code.", - "style": "deepObject", - "explode": true, - "properties": { - "conditions": { - "$ref": "#/components/schemas/7_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "related_object_id": { - "type": "object", - "description": "Unique related object ID, i.e. v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk.", - "style": "deepObject", - "explode": true, - "properties": { - "conditions": { - "$ref": "#/components/schemas/7_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "related_object_parent_id": { - "type": "object", - "description": "Unique related object parent ID, i.e. camp_22noMlhTADb7Fq2UL3vWu3d1.", - "style": "deepObject", - "explode": true, - "properties": { - "conditions": { - "$ref": "#/components/schemas/7_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "parent_redemption_id": { - "type": "object", - "description": "Unique parent redemption ID, i.e. r_0c5952900bcbfd54b6.", - "style": "deepObject", - "explode": true, - "properties": { - "conditions": { - "$ref": "#/components/schemas/7_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "failure_code": { - "type": "object", - "description": "Failure code, i.e. quantity_exceeded.", - "style": "deepObject", - "explode": true, - "properties": { - "conditions": { - "$ref": "#/components/schemas/7_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "result": { - "type": "object", - "description": "Result, i.e. `SUCCESS` or `FAILURE`.", - "style": "deepObject", - "explode": true, - "properties": { - "conditions": { - "$ref": "#/components/schemas/7_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "object": { - "type": "object", - "description": "Specify which type of object to return, i.e. `redemption` or `redemption_rollback`.", - "style": "deepObject", - "explode": true, - "properties": { - "conditions": { - "$ref": "#/components/schemas/7_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "customer_id": { - "type": "object", - "description": "Unique customer ID, i.e. cust_sehkNIi8Uq2qQuRqSr7xn4Zi.", - "style": "deepObject", - "explode": true, - "properties": { - "conditions": { - "$ref": "#/components/schemas/7_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "campaign_name": { - "type": "object", - "description": "Campaign name.", - "style": "deepObject", - "explode": true, - "properties": { - "conditions": { - "$ref": "#/components/schemas/7_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "user_login": { - "type": "object", - "description": "User login used to login to Voucherify, i.e. name.lastname@email.com", - "style": "deepObject", - "explode": true, - "properties": { - "conditions": { - "$ref": "#/components/schemas/7_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - } - } - }, - "description": "Filters for listing responses.", - "style": "deepObject", - "explode": true - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a list of redemption objects. Each entry in the array is a separate redemption object. If no more redemptions are available, the resulting array will be empty. If you provide a non-existent customer ID, this call returns an empty object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/7_res_list_redemptions" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "redemptions", - "redemptions": [ - { - "id": "r_0c0469eaf705889d99", - "object": "redemption", - "date": "2022-11-18T12:30:32.622Z", - "customer_id": "cust_qBwHpagDOFu71Z3F22UzR80X", - "tracking_id": "track_5DQxXbK0C0pvAaHk7mnulhyMBo7VratI", - "metadata": { - "store_names": "Store 2 - Florida - Miami" - }, - "result": "SUCCESS", - "order": { - "id": "ord_ndw5rQJt12zvZ4upF72a3ljh", - "source_id": null, - "created_at": "2022-11-18T12:30:31.338Z", - "updated_at": null, - "status": "PAID", - "amount": 9680000, - "items_discount_amount": 9450000, - "total_discount_amount": 9450000, - "total_amount": 230000, - "items_applied_discount_amount": 9450000, - "total_applied_discount_amount": 9450000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0bae45ffc7003ffc52", - "quantity": 1, - "amount": 230000, - "price": 230000, - "subtotal_amount": 230000, - "product": { - "id": "prod_0bae45ffc7003ffc52", - "source_id": "second_product", - "name": "Samsung Phone 2", - "price": 230000 - } - }, - { - "object": "order_item", - "product_id": "prod_0bae2dc5a090fd0184", - "sku_id": "sku_0bae3b28f610fd0da1", - "quantity": 45, - "discount_quantity": 45, - "initial_quantity": 0, - "amount": 9450000, - "discount_amount": 9450000, - "initial_amount": 0, - "applied_discount_amount": 9450000, - "price": 210000, - "subtotal_amount": 0, - "product": { - "id": "prod_0bae2dc5a090fd0184", - "source_id": "first_product", - "name": "Samsung Phone 1", - "price": 220000 - }, - "sku": { - "id": "sku_0bae3b28f610fd0da1", - "source_id": "first_product_sku_1", - "sku": "Samsung phone 256GB", - "price": 210000 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_qBwHpagDOFu71Z3F22UzR80X", - "object": "customer" - }, - "customer_id": "cust_qBwHpagDOFu71Z3F22UzR80X", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c0469eaf705889d99": { - "date": "2022-11-18T12:30:31.388Z", - "related_object_type": "promotion_tier", - "related_object_id": "promo_ZWkx6R0I1Ts3N9HL4kfTdxOm", - "related_object_parent_id": "camp_40LC42P5NFbkkD4RWoJ4btks" - } - } + "Gift Card": { + "value": { + "category": "New Customers", + "type": "GIFT_VOUCHER", + "gift": { + "amount": 10000, + "effect": "APPLY_TO_ORDER" }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" + "start_date": "2022-01-01T00:00:00Z", + "active": true, + "additional_info": "This gift card is enabled immediately upon creation.", + "metadata": { + "test": true, + "locale": "de-en" }, - "customer": { - "id": "cust_qBwHpagDOFu71Z3F22UzR80X", - "name": "Bob Jones", - "email": "bob.smith@email.com", - "source_id": "pub_source_customer_5_a", - "metadata": { - "lang": "en", - "test": true - }, - "object": "customer" + "code_config": { + "pattern": "GIFT-CARD-##########", + "prefix": "New-", + "postfix": "0", + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + } + } + }, + "Loyalty Card": { + "value": { + "category": "New Customers", + "campaign": "camp_E87CubZLZ8eoQt3c4kAEZsx0", + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 10000 }, - "related_object_type": "promotion_tier", - "related_object_id": "promo_ZWkx6R0I1Ts3N9HL4kfTdxOm", - "voucher": null, - "promotion_tier": { - "id": "promo_ZWkx6R0I1Ts3N9HL4kfTdxOm", - "campaign": { - "id": "camp_40LC42P5NFbkkD4RWoJ4btks" - } + "additional_info": "This loyalty card is enabled immediately upon creation.", + "metadata": { + "test": true, + "locale": "de-en" + }, + "code_config": { + "pattern": "LOYALTY-CARD-##", + "prefix": "New-", + "postfix": "1", + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" } - }, - { - "id": "r_0bf9cf0a8b12dc5ba6", - "object": "redemption", - "date": "2022-11-10T06:49:03.835Z", - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "tracking_id": "track_fxEMFisanb4sbl4Z4yCnJyDW013IrRbJmqKByTNHbXE=", - "metadata": {}, - "amount": 200, - "result": "SUCCESS", - "order": { - "id": "ord_jAifScsbOqxgb12hLu7hXrLU", - "source_id": null, - "created_at": "2022-11-10T06:49:02.703Z", - "updated_at": null, - "status": "PAID", - "amount": 4500, - "discount_amount": 4000, - "total_discount_amount": 4000, - "total_amount": 500, - "applied_discount_amount": 4000, - "total_applied_discount_amount": 4000, - "items": [ + } + }, + "Unit Discount Multiple Items": { + "value": { + "category": "New Customers", + "code": "MultipleUnitTypesUnitDiscount", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "UNIT", + "effect": "ADD_MANY_ITEMS", + "units": [ { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 3, - "amount": 4500, - "price": 1500, - "subtotal_amount": 4500, - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage", - "price": 1500 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "object": "customer" - }, - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0bf9cf0a8b12dc5ba6": { - "date": "2022-11-10T06:49:02.764Z", - "related_object_type": "voucher", - "related_object_id": "v_Xak3ViMbxCH8Lb4ZG0lWwC0goMRBXWB4", - "related_object_parent_id": "camp_fkZ28pe7DUAEmmabofkxHI8N" + "unit_off": 1, + "unit_type": "prod_0a9f9ab4ab019a42d5", + "effect": "ADD_NEW_ITEMS" + }, + { + "unit_off": 1, + "unit_type": "prod_0a9f9aeddb019a42db", + "effect": "ADD_MISSING_ITEMS" } - } + ] }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" + "start_date": "2020-01-01T00:00:00Z", + "expiration_date": "2022-12-31T23:59:59Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P2D" }, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "name": "Bobby McDonald", - "email": "bobby.mcdonald@email.com", - "source_id": "bobby.mcdonald@email.com", - "metadata": { - "acquisition_channel": "Facebook", - "customer_life_time_value": 100 - }, - "object": "customer" + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": false, + "additional_info": "This voucher will remain inactive until enabled.", + "redemption": { + "quantity": 5 }, - "related_object_type": "voucher", - "related_object_id": "v_Xak3ViMbxCH8Lb4ZG0lWwC0goMRBXWB4", - "voucher": { - "id": "v_Xak3ViMbxCH8Lb4ZG0lWwC0goMRBXWB4", - "code": "LT1-wMPnRhxb", - "campaign": "Loyalty Campaign - Tiers - 1", - "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N" + "metadata": { + "test": true, + "locale": "de-en" + } + } + }, + "Unit Discount Single Item": { + "value": { + "category": "New Customers", + "code": "AddMissingItemDiscount", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "UNIT", + "unit_off": 1, + "unit_type": "prod_0a9f9ab4ab019a42d5", + "effect": "ADD_MISSING_ITEMS" }, - "reward": { - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "name": "Bobby McDonald", - "email": "bobby.mcdonald@email.com", - "source_id": "bobby.mcdonald@email.com", - "metadata": { - "acquisition_channel": "Facebook", - "customer_life_time_value": 100 + "start_date": "2020-01-01T00:00:00Z", + "expiration_date": "2022-12-31T23:59:59Z", + "active": false, + "additional_info": "This voucher will remain inactive until enabled.", + "redemption": { + "quantity": 3 + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a voucher object if the call succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_obj_voucher_object" + }, + "examples": { + "Percentage Discount": { + "value": { + "id": "v_YJYfeKoR0XAGIvaM7k51wTbDjU4WIpC5", + "code": "NEW-WELCOME-COUPON", + "campaign": "Bug fix", + "campaign_id": "camp_Y6dLsYIZloGqP8izufXY6SSJ", + "category": "New Customers", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "percent_off": 10, + "effect": "APPLY_TO_ORDER" + }, + "gift": null, + "loyalty_card": null, + "start_date": "2016-01-01T00:00:00.000Z", + "expiration_date": "2022-12-31T23:59:59.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "PT1H" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": false, + "additional_info": "This voucher will remain inactive until enabled.", + "metadata": { + "test": true, + "locale": "de-en" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX180g6GhUA0kT47tHGvZ5thjCgY5nbsPtiecixkkEznFVg2v3SDG9dpCbXR6BSUdM/d78Wm/zru1ybT4+AQ2X0JnEy86N7TZ/aoezZORjcBRUfyVM/scUUF/vmD4Ezn+Elp2+V9AFcAXN/WthaRMl9e7xvEeIEQ5nao=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX180g6GhUA0kT47tHGvZ5thjCgY5nbsPtiecixkkEznFVg2v3SDG9dpCbXR6BSUdM%2Fd78Wm%2Fzru1ybT4%2BAQ2X0JnEy86N7TZ%2FaoezZORjcBRUfyVM%2FscUUF%2FvmD4Ezn%2BElp2%2BV9AFcAXN%2FWthaRMl9e7xvEeIEQ5nao%3D" }, - "object": "customer" + "barcode": { + "id": "U2FsdGVkX1/AynivxYCEIxfTnf3A1lO0xsNihOlbUMo6Y6873LQ2qpmkk90aUFnaFKd7pVumcirRweblzGVSxy24Phhd174VSPaLxxmSKp0FPv0dRos/XWBg8zu0Kta0pA/yvFK3WWGlNoPPPnvEhVWKKzOr09Gj94SMrr+TGlI=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FAynivxYCEIxfTnf3A1lO0xsNihOlbUMo6Y6873LQ2qpmkk90aUFnaFKd7pVumcirRweblzGVSxy24Phhd174VSPaLxxmSKp0FPv0dRos%2FXWBg8zu0Kta0pA%2FyvFK3WWGlNoPPPnvEhVWKKzOr09Gj94SMrr%2BTGlI%3D" + } }, - "assignment_id": "rewa_nMXB59qGTNYawMT8eP8M4oUp", - "id": "rew_MVXA2kV7lZ1zC057WUaTrvNz", - "object": "reward", - "name": "100 Points = $20", - "created_at": "2022-09-09T06:41:54.496Z", + "is_referral_code": false, + "created_at": "2022-02-17T07:14:40.096Z", "updated_at": null, - "parameters": { - "coin": { - "exchange_ratio": 20, - "points_ratio": 100 - } + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_COu5PJAsWmAwuCqR", + "rule_id": "val_4j7DCRm2IS59", + "related_object_id": "v_YJYfeKoR0XAGIvaM7k51wTbDjU4WIpC5", + "related_object_type": "voucher", + "created_at": "2022-02-17T07:14:40.280Z", + "object": "validation_rules_assignment" + } + ], + "total": 1 }, - "type": "COIN" - }, - "loyalty_card": { - "points": 200 + "redemption": { + "quantity": 10, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/NEW-WELCOME-COUPON/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/NEW-WELCOME-COUPON/publications?page=1&limit=10" + }, + "object": "voucher" } }, - { - "id": "rf_0bf9caf744d2dc593a", - "object": "redemption", - "date": "2022-11-10T06:31:15.477Z", - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "tracking_id": "track_fxEMFisanb4sbl4Z4yCnJyDW013IrRbJmqKByTNHbXE=", - "metadata": {}, - "result": "FAILURE", - "failure_code": "loyalty_card_points_exceeded", - "failure_message": "loyalty card points exceeded", - "order": null, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "name": "Bobby McDonald", - "email": "bobby.mcdonald@email.com", - "source_id": "bobby.mcdonald@email.com", + "Gift Voucher": { + "value": { + "id": "v_yAZyBimXtF9yQ2C5BEF9WMhNzOMJNfz6", + "code": "New-GIFT-CARD-8tqB6FcyhE0", + "campaign": null, + "campaign_id": null, + "category": "New Customers", + "type": "GIFT_VOUCHER", + "discount": null, + "gift": { + "amount": 10000, + "balance": 10000, + "effect": "APPLY_TO_ORDER" + }, + "loyalty_card": null, + "start_date": "2022-01-01T00:00:00.000Z", + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": "This gift card is enabled immediately upon creation.", "metadata": { - "acquisition_channel": "Facebook", - "customer_life_time_value": 100 + "test": true, + "locale": "de-en" }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_Xak3ViMbxCH8Lb4ZG0lWwC0goMRBXWB4", - "voucher": { - "id": "v_Xak3ViMbxCH8Lb4ZG0lWwC0goMRBXWB4", - "code": "LT1-wMPnRhxb", - "campaign": "Loyalty Campaign - Tiers - 1", - "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N" + "assets": { + "qr": { + "id": "U2FsdGVkX1+pm0q3U4i/KrjResuZpwDigEa5WcDOlwYS/bj3rsesZXDpJF5MNHMUsKqy0+wn5tY3QbjPGv0dwbqRn/OjrIRgNlP99azD0n0n9C/chiTABp8BxlJmMKKFo5AggBbQu4+Mw8Cv8V3+0Ga7ETzeehS+Yrj6c+3ioxg=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bpm0q3U4i%2FKrjResuZpwDigEa5WcDOlwYS%2Fbj3rsesZXDpJF5MNHMUsKqy0%2Bwn5tY3QbjPGv0dwbqRn%2FOjrIRgNlP99azD0n0n9C%2FchiTABp8BxlJmMKKFo5AggBbQu4%2BMw8Cv8V3%2B0Ga7ETzeehS%2BYrj6c%2B3ioxg%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/UaGX0zV8oXbpYah2G76V1ljYSy6hDSnWAZhpz5v10vRibGaOJUahyLcClMyxAsUhU9WXWi4BUGWIEEu510AxzxyGHOTDTjavJH0Q79PI0ciLHdujNFOgLOXWe9Ffwzj+Kvjmbhb22/SVZd/xzQlUBJcv7XboJYU0=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FUaGX0zV8oXbpYah2G76V1ljYSy6hDSnWAZhpz5v10vRibGaOJUahyLcClMyxAsUhU9WXWi4BUGWIEEu510AxzxyGHOTDTjavJH0Q79PI0ciLHdujNFOgLOXWe9Ffwzj%2BKvjmbhb22%2FSVZd%2FxzQlUBJcv7XboJYU0%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-17T07:49:10.834Z", + "updated_at": null, + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "redeemed_amount": 0, + "object": "list", + "url": "/v1/vouchers/New-GIFT-CARD-8tqB6FcyhE0/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/New-GIFT-CARD-8tqB6FcyhE0/publications?page=1&limit=10" + }, + "object": "voucher" } }, - { - "id": "rf_0bf8c023eb4d4aa4ad", - "object": "redemption", - "date": "2022-11-09T11:05:28.074Z", - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "tracking_id": "track_fxEMFisanb4sbl4Z4yCnJyDW013IrRbJmqKByTNHbXE=", - "metadata": {}, - "result": "FAILURE", - "failure_code": "customer_rules_violated", - "failure_message": "customer does not match validation rules", - "order": null, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "name": "Bob Smith", - "email": "bob.smith@email.com", - "source_id": "bob.smith@email.com", + "Loyalty Card": { + "value": { + "id": "v_tVkcOhjHCz9W7q8QnuJnTGPBR2hdaYrC", + "code": "New-LOYALTY-CARD-UC1", + "campaign": "Loyalty Campaign", + "campaign_id": "camp_E87CubZLZ8eoQt3c4kAEZsx0", + "category": "New Customers", + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 10000, + "balance": 10000 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": "This loyalty card is enabled immediately upon creation.", "metadata": { - "acquisition_channel": "Facebook" + "test": true, + "locale": "de-en" }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_FGQjOjqasEbbdpnySdCpUoalJio3OHWK", - "voucher": { - "id": "v_FGQjOjqasEbbdpnySdCpUoalJio3OHWK", - "code": "3rqWOTAh", - "campaign_id": null + "assets": { + "qr": { + "id": "U2FsdGVkX1+6lGBFlqtS9OoY2wbAsoSupV43qa+g5sGu+R0IDTq2k85LIfbKfV9sDSYv80pP9ucsazJ6qGI9ineqQyhv9VVHdsJ2qGRiuZzpw/vRkSA0a7J9N1MpANgzqpIULZHLjYtrCQ/2el72nZ6Hpr2NkWtk19JTpNwB8tk=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B6lGBFlqtS9OoY2wbAsoSupV43qa%2Bg5sGu%2BR0IDTq2k85LIfbKfV9sDSYv80pP9ucsazJ6qGI9ineqQyhv9VVHdsJ2qGRiuZzpw%2FvRkSA0a7J9N1MpANgzqpIULZHLjYtrCQ%2F2el72nZ6Hpr2NkWtk19JTpNwB8tk%3D" + }, + "barcode": { + "id": "U2FsdGVkX180bvJVsyZvpAqwYXTnm4MvvH4Rur+ZhM+Mbmnva/fgYUcUbOttsFXPY/PMZ9Xi8pomVp26a7amIPguNimD8w4PMZLMavMtH7EtJ4k+0V0Wp7JUkudIKeRw2fDnQ3/0cgqvK6PMReUwFWb5nUT3ABpZDAdaOVoMDhE=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX180bvJVsyZvpAqwYXTnm4MvvH4Rur%2BZhM%2BMbmnva%2FfgYUcUbOttsFXPY%2FPMZ9Xi8pomVp26a7amIPguNimD8w4PMZLMavMtH7EtJ4k%2B0V0Wp7JUkudIKeRw2fDnQ3%2F0cgqvK6PMReUwFWb5nUT3ABpZDAdaOVoMDhE%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-17T08:06:41.091Z", + "updated_at": null, + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "redeemed_points": 0, + "object": "list", + "url": "/v1/vouchers/New-LOYALTY-CARD-UC1/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/New-LOYALTY-CARD-UC1/publications?page=1&limit=10" + }, + "object": "voucher" } }, - { - "id": "r_0ba9fa02fcd28ed8f1", - "object": "redemption", - "date": "2022-09-09T06:38:20.085Z", - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "tracking_id": "track_fxEMFisanb4sbl4Z4yCnJyDW013IrRbJmqKByTNHbXE=", - "metadata": {}, - "amount": 300, - "result": "SUCCESS", - "order": { - "id": "ord_G9LBb5SOPa36pHdwxUvzkw4P", - "source_id": null, - "created_at": "2022-09-09T06:38:17.984Z", - "updated_at": null, - "status": "PAID", - "amount": 4600, - "items_discount_amount": 300, - "total_discount_amount": 300, - "total_amount": 4300, - "items_applied_discount_amount": 300, - "total_applied_discount_amount": 300, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1600, - "price": 1600, - "subtotal_amount": 1600, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 1600 + "Unit Discount Multiple Items": { + "value": { + "id": "v_cu8nyozvTDA413H17bH5BLha0cjxt7s8", + "code": "MultipleUnitTypesUnitDiscount", + "campaign": null, + "campaign_id": null, + "category": "New Customers", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "UNIT", + "effect": "ADD_MANY_ITEMS", + "units": [ + { + "unit_off": 1, + "unit_type": "prod_0a9f9ab4ab019a42d5", + "effect": "ADD_NEW_ITEMS" }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1600 - } - }, - { - "object": "order_item", - "product_id": "prod_0a65b3ff8592d7a5b5", - "quantity": 1, - "amount": 3000, - "discount_amount": 300, - "applied_discount_amount": 300, - "price": 3000, - "subtotal_amount": 2700, - "product": { - "id": "prod_0a65b3ff8592d7a5b5", - "name": "Koffee Cup", - "price": 3000 + { + "unit_off": 1, + "unit_type": "prod_0a9f9aeddb019a42db", + "effect": "ADD_MISSING_ITEMS" } - } + ] + }, + "gift": null, + "loyalty_card": null, + "start_date": "2020-01-01T00:00:00.000Z", + "expiration_date": "2022-12-31T23:59:59.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "PT1H" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 ], - "metadata": {}, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "object": "customer" + "active": false, + "additional_info": "This voucher will remain inactive until enabled.", + "metadata": { + "test": true, + "locale": "de-en" }, - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0ba9fa02fcd28ed8f1": { - "date": "2022-09-09T06:38:18.099Z", - "related_object_type": "voucher", - "related_object_id": "v_KqP2NOSb4dJb1D6UBhcq7ScPZXun0y40", - "related_object_parent_id": "camp_hC2GdqYtOmTT45zfhib62cK1" + "assets": { + "qr": { + "id": "U2FsdGVkX1+ocJBtZ9NqT97gZ/QTfOz54TAoRoKO3tnCYBtHZWMghEHT0b2aFrPSL1lqMyf6fYy6DH2/DkH5p5Vd8dOozW1LV6wPVatWpa1lZMeMIB0OcARCW3q+3QydoW2KdliLKyksFwumH9C7Fsnj6HTaEbUjSttTZE/be+o=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BocJBtZ9NqT97gZ%2FQTfOz54TAoRoKO3tnCYBtHZWMghEHT0b2aFrPSL1lqMyf6fYy6DH2%2FDkH5p5Vd8dOozW1LV6wPVatWpa1lZMeMIB0OcARCW3q%2B3QydoW2KdliLKyksFwumH9C7Fsnj6HTaEbUjSttTZE%2Fbe%2Bo%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+Sly3IYj3EbZFHGGNxV6Ns4j76O8d0kRQe3WriJz5qY6s4GBIwlsdy13AciaQuiVt232HlOlZ4TzGaSSk3+ZMldwBGaTp/fIN9SGBW/NVUtfDOI2sIDLZCBBrdK7WVvtCQQ+1Y+6qClYg/QurJExCFRkDeKpKjDug=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BSly3IYj3EbZFHGGNxV6Ns4j76O8d0kRQe3WriJz5qY6s4GBIwlsdy13AciaQuiVt232HlOlZ4TzGaSSk3%2BZMldwBGaTp%2FfIN9SGBW%2FNVUtfDOI2sIDLZCBBrdK7WVvtCQQ%2B1Y%2B6qClYg%2FQurJExCFRkDeKpKjDug%3D" } - } - }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "name": "Bob Smith", - "email": "bob.smith@email.com", - "source_id": "bob.smith@email.com", - "metadata": {}, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_KqP2NOSb4dJb1D6UBhcq7ScPZXun0y40", - "voucher": { - "id": "v_KqP2NOSb4dJb1D6UBhcq7ScPZXun0y40", - "code": "vTcguVLE", - "campaign": "SL-Gift", - "campaign_id": "camp_hC2GdqYtOmTT45zfhib62cK1" - }, - "gift": { - "amount": 300 + }, + "is_referral_code": false, + "created_at": "2022-02-18T06:27:45.619Z", + "updated_at": null, + "redemption": { + "quantity": 5, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/publications?page=1&limit=10" + }, + "object": "voucher" } }, - { - "id": "rf_0bf8bfe0808d4aa473", - "object": "redemption", - "date": "2022-11-09T11:04:19.062Z", - "customer_id": null, - "tracking_id": null, - "metadata": {}, - "result": "FAILURE", - "failure_code": "missing_customer", - "failure_message": "Missing customer", - "order": null, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": null, - "related_object_type": "voucher", - "related_object_id": "v_FGQjOjqasEbbdpnySdCpUoalJio3OHWK", - "voucher": { - "id": "v_FGQjOjqasEbbdpnySdCpUoalJio3OHWK", - "code": "3rqWOTAh", - "campaign_id": null + "Unit Discount Single Item": { + "value": { + "id": "v_NQdraO4fXWYvMMWYL9OY22hRernr553n", + "code": "AddMissingItemDiscount", + "campaign": null, + "campaign_id": null, + "category": "New Customers", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "UNIT", + "unit_off": 1, + "unit_type": "prod_0a9f9ab4ab019a42d5", + "effect": "ADD_MISSING_ITEMS" + }, + "gift": null, + "loyalty_card": null, + "start_date": "2020-01-01T00:00:00.000Z", + "expiration_date": "2022-12-31T23:59:59.000Z", + "validity_timeframe": null, + "validity_day_of_week": null, + "active": false, + "additional_info": "This voucher will remain inactive until enabled.", + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX19Yh7LTNyOVKSXQ+ceTr023saElWAUeucwOgjTH50x1SoSF/PP1aoGBr6sSxHZNZOvBGumWNHjsF85y7cPY7La/4a0d1kWqnAiBWeWnGOgDFeQFqthGswypFOK1jdAzUPqLSbxW3O6q936N6Bsmoz4QHYE//kfWFhs=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19Yh7LTNyOVKSXQ%2BceTr023saElWAUeucwOgjTH50x1SoSF%2FPP1aoGBr6sSxHZNZOvBGumWNHjsF85y7cPY7La%2F4a0d1kWqnAiBWeWnGOgDFeQFqthGswypFOK1jdAzUPqLSbxW3O6q936N6Bsmoz4QHYE%2F%2FkfWFhs%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+RqzgyYsIJzAEBxmQt1OZLu4+PSUDQBldDKK1o5XsEoBSQEMPWHis1wJSg4ZNqJ9ZdJ0Ukc+K6X1fjg0ggDsCdXP2ZxpyGPD8/1ReggJZ/tq823ji7A5pzhG1TljA6+vmISuHvs2wkcum0djN9AWuAlB0F/vbXexo=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BRqzgyYsIJzAEBxmQt1OZLu4%2BPSUDQBldDKK1o5XsEoBSQEMPWHis1wJSg4ZNqJ9ZdJ0Ukc%2BK6X1fjg0ggDsCdXP2ZxpyGPD8%2F1ReggJZ%2Ftq823ji7A5pzhG1TljA6%2BvmISuHvs2wkcum0djN9AWuAlB0F%2FvbXexo%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-18T06:46:44.536Z", + "updated_at": null, + "redemption": { + "quantity": 3, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/AddMissingItemDiscount/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/AddMissingItemDiscount/publications?page=1&limit=10" + }, + "object": "voucher" } } - ], - "total": 6 + } } } } } } - } - } - }, - "post": { - "operationId": "redeem-stacked-discounts", - "tags": [ - "STACKABLE DISCOUNTS API" - ], - "summary": "Redeem Stackable Discounts", - "description": "Use this method to redeem up to 5 redeemables in a single API request.\n\n## How API returns calculated discounts and order amounts in the response\n\nIn the table below, you can see the logic the API follows to calculate discounts and amounts:\n\n| **Field** | **Calculation** | **Description** |\n|:---|:---|:---|\n| amount | N/A | This field shows the order amount before applying any discount |\n| total_amount | `total_amount` = `amount` - `total_discount_amount` | This field shows the order amount after applying all the discounts |\n| 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. |\n| items_discount_amount | sum(items, i => i.discount_amount) | This field sums up all product-specific discounts |\n| total_discount_amount | `total_discount_amount` = `discount_amount` + `items_discount_amount` | This field sums up all order-level and all product-specific discounts |\n| applied_discount_amount | N/A | This field shows the order-level discount applied in a particular request |\n| items_applied_discount_amount | sum(items, i => i.applied_discount_amount) | This field sums up all product-specific discounts applied in a particular request |\n| 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 |\n\n\n> 📘 Rollbacks\n>\n> 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](ref:rollback-stacked-redemptions). \n\n\n> 📘 Also available on client-side\n>\n> This method is also accessible through public keys which you can use in client-side​ apps: mobile and web browser apps. Go to the dedicated [endpoint](ref:redeem-stacked-discounts-client-side) to learn more.\n> - Use `X-Client-Application-Id` as the application ID header.\n> - Use `X-Client-Token` as the appliction secret key header.\n> - Use client-side base URL.\n> - Use an `origin` header for your custom domain.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "## Expanded Response\n\nResponses will vary depending on the strings passed in the `options.expand` string array.\n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redemption object.
- Metadata not included for each discount type. |\n| [\"order\", \"redemption\"] | - Returns redemption object `metadata`.
- Order data with calculated discounts are listed in each child redemption object. |\n| [\"redeemable\", \"redemption\"] | - Returns each discount type's `metadata` in each child redemption object.
- Returns redemption object `metadata`. |\n| [\"redemption\"] | - Returns redemption object `metadata`. |\n| [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object
- Returns redemption object `metadata`.
- Returns an expanded `categories` object, showing details about the category. |", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/19_req_redemptions" - }, - "examples": { - "Example": { - "value": { - "customer": { - "source_id": "sample_customer", - "metadata": { - "key": "value" - } - }, - "options": { - "expand": [ - "order", - "redeemable", - "category" - ] - }, - "redeemables": [ - { - "object": "voucher", - "id": "voucher-code" - } - ], - "session": { - "type": "LOCK", - "key": "session_key" - }, - "order": { - "amount": 55000, - "status": "PAID", - "items": [ - { - "quantity": 2, - "price": 20000, - "source_id": "sample product1", - "related_object": "product", - "product": { - "metadata": { - "key": "value" - } + }, + "/v1/vouchers/{code}/enable": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "2CpRCE2c" + }, + "name": "code", + "in": "path", + "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. `v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u`.", + "required": true + } + ], + "post": { + "operationId": "enable-voucher", + "tags": [ + "VOUCHERS API" + ], + "summary": "Enable Voucher", + "description": "There are various times when you'll want to manage a voucher's accessibility. This can be done by two API methods for managing the voucher state - *enable* and *disable*. \n___\nThe 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.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a voucher object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_obj_voucher_object" + }, + "examples": { + "Example": { + "value": { + "id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "code": "2CpRCE2c", + "campaign": null, + "campaign_id": null, + "category": null, + "category_id": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 300, + "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1+ro/6HLsfI9E/rz0QEoYv+rcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz+WQtg4nKpjUS0wcA7AuIbz2zb870YfJO/r5UBS5gCqQ==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bro%2F6HLsfI9E%2Frz0QEoYv%2BrcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz%2BWQtg4nKpjUS0wcA7AuIbz2zb870YfJO%2Fr5UBS5gCqQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3/4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ+aTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3%2F4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ%2BaTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-19T10:06:07.932Z", + "updated_at": "2022-09-19T11:54:17.248Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_HesdqEzt5e9c0T56", + "rule_id": "val_gZft0NKZSUWK", + "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "related_object_type": "voucher", + "created_at": "2022-09-19T10:06:07.934Z", + "object": "validation_rules_assignment" + } + ], + "total": 1 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/2CpRCE2c/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/2CpRCE2c/publications?page=1&limit=10" + }, + "object": "voucher" } - }, - { - "quantity": 1, - "price": 15000, - "source_id": "sample product2", - "related_object": "product", - "product": { - "metadata": { - "key": "value" - } + } + } + } + } + }, + "404": { + "description": "Returns an error if the voucher code does not exist or has been deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id IrKORhS", + "request_id": "v-0a96cd820301c0483a", + "resource_id": "IrKORhS", + "resource_type": "voucher" } } - ], - "metadata": { - "key": "value" } } } } } } - } - }, - "responses": { - "200": { - "description": "All promo codes and tiers provided in redeemables are redeemed during the request and returned in the API response. As a result, there are child `redemptions` related to redemptions of each redeemable and a `parent_redemption` that presents the final effect of redeeming all redeemables and stores the list of child redemptions. \n\n| Response Parameter | Description |\n|:---|:---|\n| redemptions
`array of objects` | This array lists all child redemptions that were executed during the request. Each child redemption returns a redemption object with detailed information on how each discount/code was applied to the order. You can see the effect of each consecutive redemption within the order object of each redemption, specifically the `total_discount_amount` parameter. This is why the sequence in which the discounts were provided in the request body matters. Each subsequent redemption object contains the order object which combines the effect of the previously applied discounts. |\n| parent_redemption
`object` | Represents the final effect of all child redemptions executed during the request. |\n| order
`object` | Represents order details after all discounts are applied. |", - "content": { - "application/json": { + }, + "/v1/vouchers/{code}/disable": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/19_res_redemptions_POST" + "type": "string", + "example": "2CpRCE2c" + }, + "name": "code", + "in": "path", + "required": true, + "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. `v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u`." + } + ], + "post": { + "operationId": "disable-voucher", + "tags": [ + "VOUCHERS API" + ], + "summary": "Disable Voucher", + "description": "There are various times when you'll want to manage a voucher's accessibility. This can be done by two API methods for managing the voucher state - *enable* and *disable*. \n___\nThis method sets the voucher state to **inactive**. The voucher cannot be redeemed.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a voucher object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_obj_voucher_object" + }, + "examples": { + "Example": { + "value": { + "id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "code": "2CpRCE2c", + "campaign": null, + "campaign_id": null, + "category": null, + "category_id": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 300, + "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": false, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1+ro/6HLsfI9E/rz0QEoYv+rcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz+WQtg4nKpjUS0wcA7AuIbz2zb870YfJO/r5UBS5gCqQ==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bro%2F6HLsfI9E%2Frz0QEoYv%2BrcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz%2BWQtg4nKpjUS0wcA7AuIbz2zb870YfJO%2Fr5UBS5gCqQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3/4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ+aTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3%2F4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ%2BaTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-19T10:06:07.932Z", + "updated_at": "2022-09-19T11:53:23.452Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_HesdqEzt5e9c0T56", + "rule_id": "val_gZft0NKZSUWK", + "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "related_object_type": "voucher", + "created_at": "2022-09-19T10:06:07.934Z", + "object": "validation_rules_assignment" + } + ], + "total": 1 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/2CpRCE2c/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/2CpRCE2c/publications?page=1&limit=10" + }, + "object": "voucher" + } + } + } + } + } + }, + "404": { + "description": "Returns an error if the voucher code does not exist or has been deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id IrKORhS", + "request_id": "v-0a96cd820301c0483a", + "resource_id": "IrKORhS", + "resource_type": "voucher" + } + } + } + } + } } } } - } - } - } - }, - "/v1/redemptions/{redemptionId}": { - "parameters": [ - { - "schema": { - "type": "string" }, - "name": "redemptionId", - "in": "path", - "required": true, - "description": "ID of previously created redemption." - } - ], - "get": { - "operationId": "get-redemption", - "tags": [ - "REDEMPTIONS API" - ], - "summary": "Get Redemption", - "description": "Return a redemption or redemption rollback object. This object can either be a successfull or failed redemption or redemption rollback.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a redemption object.", - "content": { - "application/json": { + "/v1/vouchers/{code}/balance": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/7_res_get_redemption" - }, - "examples": { - "Discount Voucher": { - "value": { - "id": "r_0bade27c428db5873e", - "object": "redemption", - "date": "2022-09-12T07:29:28.211Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": {}, - "result": "SUCCESS", - "order": { - "id": "ord_ebmAU9uv3dTE2Khqyh7i5ka7", - "source_id": null, - "created_at": "2022-09-12T07:29:26.245Z", - "updated_at": null, - "status": "PAID", - "amount": 22500, - "discount_amount": 300, - "total_discount_amount": 300, - "total_amount": 22200, - "applied_discount_amount": 300, - "total_applied_discount_amount": 300, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b2c36568000039138", - "quantity": 1, - "amount": 22500, - "price": 22500, - "subtotal_amount": 22500, - "product": { - "id": "prod_0b2c36568000039138", - "source_id": "86", - "name": "[Sample] Able Brewing System", - "price": 22500 + "type": "string", + "example": "GIFT-CARD-1" + }, + "name": "code", + "in": "path", + "required": true, + "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. `v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u`." + } + ], + "post": { + "operationId": "add-remove-gift-voucher-balance", + "tags": [ + "VOUCHERS API" + ], + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "summary": "Add or Remove Gift Card Balance", + "description": "Add balance to an existing gift card.", + "requestBody": { + "required": true, + "description": "Provide the amount to be added to/subtracted from the gift card.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_req_vouchers_code_balance" + }, + "examples": { + "Example": { + "value": { + "amount": 10000 + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a balance object if the operation succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_res_vouchers_code_balance" + }, + "examples": { + "Example": { + "value": { + "amount": 10000, + "total": 20100, + "balance": 20100, + "type": "gift_voucher", + "object": "balance", + "related_object": { + "type": "voucher", + "id": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" } } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0bade27c428db5873e": { - "date": "2022-09-12T07:29:26.282Z", - "related_object_type": "voucher", - "related_object_id": "v_c1yOEjZXOyVIe89VAYiRvL3QimZjXo8h" - } } - }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "accepts_marketing": false - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_c1yOEjZXOyVIe89VAYiRvL3QimZjXo8h", - "voucher": { - "id": "v_c1yOEjZXOyVIe89VAYiRvL3QimZjXo8h", - "code": "FB-metadata-string", - "campaign": null, - "campaign_id": null, - "category": null, - "categories": [], - "discount": null, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "additional_info": null, - "assets": { - "qr": {}, - "barcode": {} - }, - "updated_at": null, - "object": "voucher" } } - }, - "Loyalty Card - Material Reward Product Type": { - "value": { - "id": "r_0c5bf0e6d601c7d7de", - "object": "redemption", - "date": "2023-01-25T12:08:09.503Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": {}, - "amount": 4, - "result": "SUCCESS", - "order": { - "id": "ord_dSOsWkNCRT24lHPkMu8o5QbX", - "source_id": null, - "created_at": "2023-01-25T12:08:07.750Z", - "updated_at": null, - "status": "PAID", - "items": [], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5bf0e6d601c7d7de": { - "date": "2023-01-25T12:08:07.768Z", - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + } + }, + "404": { + "description": "Returns an error if the voucher code does not exist or has been deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id IrKORhS", + "request_id": "v-0a96cd820301c0483a", + "resource_id": "IrKORhS", + "resource_type": "voucher" } } - }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "categories": [], - "discount": null, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "additional_info": null, - "assets": { - "qr": {}, - "barcode": {} - }, - "updated_at": null, - "object": "voucher" - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" + } + } + } + } + } + } + }, + "/v1/vouchers/{code}/transactions": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "GIFT-CARD-1" + }, + "name": "code", + "in": "path", + "required": true, + "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. `v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u`." + } + ], + "get": { + "operationId": "list-voucher-transactions", + "tags": [ + "VOUCHERS API" + ], + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "summary": "List Voucher Transactions", + "description": "List transactions that are associated with credit movements on a gift card or loyalty card.", + "responses": { + "200": { + "description": "Returns a dictionary of transaction objects", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/vouchers_list_transactions_response_body" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "vtx_0c9dccc4d5813e71bd", + "source_id": "20230317_subtract_1", + "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", + "source": "API", + "reason": "Subtracting credits from card", + "type": "CREDITS_REMOVAL", + "details": { + "balance": { + "type": "gift_voucher", + "total": 128020, + "amount": -2000, + "object": "balance", + "balance": 121020, + "related_object": { + "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "type": "voucher" + } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-17T15:50:00.786Z" + }, + { + "id": "vtx_0c9dcc920ac0e9ef82", + "source_id": "20230317_add_1", + "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", + "source": "API", + "reason": "Adding more points to card", + "type": "CREDITS_ADDITION", + "details": { + "balance": { + "type": "gift_voucher", + "total": 130020, + "amount": 20, + "object": "balance", + "balance": 123020, + "related_object": { + "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "type": "voucher" + } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-17T15:49:08.768Z" + }, + { + "id": "vtx_0c94f018d30bef6689", + "source_id": "HRwc0oHz_reward", + "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", + "source": "voucherify-web-ui", + "reason": "cash reward", + "type": "CREDITS_ADDITION", + "details": { + "balance": { + "type": "gift_voucher", + "total": 130000, + "amount": 2000, + "object": "balance", + "balance": 123000, + "related_object": { + "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "type": "voucher" + } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-10T18:38:02.055Z" + }, + { + "id": "vtx_0c94edbbaccbef5db6", + "source_id": null, + "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", + "source": null, + "reason": null, + "type": "CREDITS_REFUND", + "details": { + "balance": { + "type": "gift_voucher", + "total": 128000, + "amount": 44, + "object": "balance", + "balance": 121000, + "related_object": { + "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "type": "voucher" + } + }, + "order": { + "id": "ord_jj5EzDxDOd2xFPsAJJ18IaZK", + "source_id": null + }, + "redemption": { + "id": "r_0c94ed583fcafc31c1" + }, + "rollback": { + "id": "rr_0c94edbb8d0bef5d9e" + } + }, + "related_transaction_id": null, + "created_at": "2023-03-10T18:27:42.389Z" + }, + { + "id": "vtx_0c94ed584f4afc31da", + "source_id": null, + "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", + "source": null, + "reason": null, + "type": "CREDITS_REDEMPTION", + "details": { + "balance": { + "type": "gift_voucher", + "total": 128000, + "amount": -44, + "object": "balance", + "balance": 120956, + "related_object": { + "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "type": "voucher" + } + }, + "order": { + "id": "ord_jj5EzDxDOd2xFPsAJJ18IaZK", + "source_id": null + }, + "redemption": { + "id": "r_0c94ed583fcafc31c1" + } + }, + "related_transaction_id": null, + "created_at": "2023-03-10T18:26:00.640Z" + }, + { + "id": "vtx_0c94e9432c4afc2134", + "source_id": "HRwc0oHz_removal", + "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", + "source": "voucherify-web-ui", + "reason": "removal", + "type": "CREDITS_REMOVAL", + "details": { + "balance": { + "type": "gift_voucher", + "total": 128000, + "amount": -2000, + "object": "balance", + "balance": 121000, + "related_object": { + "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "type": "voucher" + } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-10T18:08:10.413Z" + }, + { + "id": "vtx_0c94e8100f8afc1c6c", + "source_id": null, + "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", + "source": null, + "reason": null, + "type": "CREDITS_REDEMPTION", + "details": { + "balance": { + "type": "gift_voucher", + "total": 130000, + "amount": -7000, + "object": "balance", + "balance": 123000, + "related_object": { + "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "type": "voucher" + } + }, + "order": { + "id": "ord_qZX3pEt5rFf5W23qRMDQcVt9", + "source_id": null + }, + "redemption": { + "id": "r_0c94e80fda4afc1c59" + } + }, + "related_transaction_id": null, + "created_at": "2023-03-10T18:02:55.935Z" + }, + { + "id": "vtx_0c94e6b82a4bef406c", + "source_id": "walmart", + "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", + "source": "voucherify-web-ui", + "reason": "return", + "type": "CREDITS_ADDITION", + "details": { + "balance": { + "type": "gift_voucher", + "total": 130000, + "amount": 5000, + "object": "balance", + "balance": 130000, + "related_object": { + "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "type": "voucher" + } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-10T17:57:03.758Z" + } ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_LRx3Y1iHFWTt217NVrknkpi5", - "product": { - "id": "prod_0b2c2ddf35150b83bb", - "source_id": "97", - "name": "[Sample] Tiered Wire Basket", - "price": 11995, - "attributes": [], - "metadata": { - "source": "bigcommerce", - "bigcommerce_product_categories": [ - 21, - 23 - ] - }, - "image_url": null, - "created_at": "2022-06-03T13:36:16.084Z", - "updated_at": "2022-06-07T09:10:44.644Z", - "object": "product" - }, - "id": "rew_EPx1hCTpqzF0HW1z9NKckZH4", - "object": "reward", - "name": "Present", - "created_at": "2022-06-13T06:59:01.694Z", - "updated_at": null, - "parameters": { - "product": { - "id": "prod_0b2c2ddf35150b83bb", - "sku_id": null - } - }, - "type": "MATERIAL" - }, - "loyalty_card": { - "points": 4 + "has_more": false + } + } } } - }, - "Loyalty Card - Material Reward SKU Type": { - "value": { - "id": "r_0c5bf18dad48a34392", - "object": "redemption", - "date": "2023-01-25T12:11:00.543Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": {}, - "amount": 6, - "result": "SUCCESS", - "order": { - "id": "ord_dwb6bpqjIlMuXFS71NuHed9S", - "source_id": null, - "created_at": "2023-01-25T12:10:58.598Z", - "updated_at": null, - "status": "PAID", - "items": [], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5bf18dad48a34392": { - "date": "2023-01-25T12:10:58.613Z", - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + } + }, + "404": { + "description": "Returns an error if the voucher code does not exist or has been deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id IrKORhS", + "request_id": "v-0a96cd820301c0483a", + "resource_id": "IrKORhS", + "resource_type": "voucher" } } - }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "categories": [], - "discount": null, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "additional_info": null, - "assets": { - "qr": {}, - "barcode": {} - }, - "updated_at": null, - "object": "voucher" - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_gfpRNkOT0pwzF7P5tXWXOs4H", - "product": { - "id": "prod_5h0wc453_2", - "source_id": "jonah-nystrom-bourbon", - "name": "Johan & Nyström - Bourbon", - "price": null, - "attributes": [ - "categories", - "description", - "weight" - ], - "metadata": { - "company": "Johan & Nyström", - "showcase": true - }, - "image_url": null, - "created_at": "2021-12-01T08:00:49.418Z", - "updated_at": null, - "object": "product" - }, - "sku": { - "id": "sku_0a3efc9044dd121803", - "source_id": "jonah-nystrom-bourbon-250g", - "product_id": "prod_5h0wc453_2", - "sku": "250g", - "price": 1750, - "currency": null, - "attributes": { - "categories": "Coffee, Whole Bean", - "description": "Background for this blend comes from the longing for a real dark roasting of high-quality coffee beans. Although the beans are dark roasted, they keep their clear and intense aroma. This coffee has a smoky flavour with a slight hint of sweetness and loads of fruit notes. Thanks to the experience in the dark roasting of coffee, the beans still retain most of their aromas. Its aftertaste is clear and remains for a long time. This coffee is perfect for a Dripper, French Press, Moka coffee maker and the traditional espresso brewing method.", - "weight": 250 - }, - "image_url": null, - "metadata": {}, - "created_at": "2021-12-01T08:00:49.427Z", - "updated_at": null, - "object": "sku" - }, - "id": "rew_SfQCsap5R8UBTVbdMTRx10x8", - "object": "reward", - "name": "Present - SKU", - "created_at": "2023-01-25T12:10:16.060Z", - "updated_at": null, - "parameters": { - "product": { - "id": "prod_5h0wc453_2", - "sku_id": "sku_0a3efc9044dd121803" - } - }, - "type": "MATERIAL" - }, - "loyalty_card": { - "points": 6 } } - }, - "Loyalty Card - Pay with Points": { - "value": { - "id": "r_0b5e402ad54a3afe9c", - "object": "redemption", - "date": "2022-07-12T11:00:26.247Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 5, - "redemption": "r_0b5e402ad50a3afe98", - "result": "SUCCESS", - "order": { - "id": "ord_9akjPYZNskEhKZ4zCZt6TKwq", - "source_id": null, - "created_at": "2022-07-12T11:00:26.224Z", - "amount": 20000, - "discount_amount": 5100, - "total_discount_amount": 5100, - "total_amount": 14900, - "applied_discount_amount": 500, - "total_applied_discount_amount": 500, - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "channel": { - "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", - "channel_type": "API" - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "accepts_marketing": false - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_pQZDYaH8LzoOvgh3234DqZQjGJgbPov6", - "voucher": { - "id": "v_pQZDYaH8LzoOvgh3234DqZQjGJgbPov6", - "code": "LOYALTY-CARD-zOR2sV9Q", - "campaign": "Loyalty Program", - "campaign_id": "camp_Hpt5hPTA8kSKRWGxBGw8Y0So", - "category": null, - "categories": [], - "discount": null, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "additional_info": null, - "assets": { - "qr": {}, - "barcode": {} - }, - "updated_at": null, - "object": "voucher" - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "accepts_marketing": false - }, - "object": "customer" - }, - "assignment_id": "rewa_X3jnD5XFxP6GXCzPZUNknDck", - "id": "rew_6rhNwuuWFQJLvTPO34ilg6jq", - "object": "reward", - "name": "Pay with Points", - "created_at": "2022-07-11T08:18:18.205Z", - "updated_at": null, - "parameters": { - "coin": { - "exchange_ratio": 1, - "points_ratio": 1 + } + } + } + } + }, + "/v1/vouchers/{code}/transactions/export": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "GIFT-CARD-1" + }, + "name": "code", + "in": "path", + "required": true, + "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. `v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u`." + } + ], + "post": { + "operationId": "export-gift-card-transactions", + "tags": [ + "VOUCHERS API" + ], + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "summary": "Export Gift Card Transactions", + "description": "Export transactions that are associated with credit movements on a gift card.\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
- `CREDITS_ADDITION`
- `CREDITS_REFUND`
- `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |", + "requestBody": { + "description": "Specify the parameters for the transaction export.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_req_create_gift_card_transactions_export" + }, + "examples": { + "Example": { + "value": { + "parameters": { + "order": "-created_at", + "fields": [ + "id", + "type", + "source_id", + "reason", + "balance", + "amount", + "created_at", + "voucher_id", + "campaign_id", + "details", + "source" + ] } - }, - "type": "COIN" - }, - "loyalty_card": { - "points": 5 + } } } - }, - "Loyalty Card - Digital Reward - Discount Voucher": { - "value": { - "id": "r_0c5bf3323008a35032", - "object": "redemption", - "date": "2023-01-25T12:18:10.707Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": { - "redemption_location": { - "city": "Warsaw", - "state": "Polyork" - } + } + } + }, + "responses": { + "200": { + "description": "Returns an export object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_obj_export_transactions_object" }, - "amount": 2, - "result": "SUCCESS", - "order": { - "id": "ord_dqxr4uzaYWkTZnrSEMoQtCF8", - "source_id": null, - "created_at": "2023-01-25T12:18:09.203Z", - "updated_at": null, - "status": "PAID", - "amount": 2100, - "total_amount": 2100, - "items": [ - { - "object": "order_item", - "product_id": "prod_0bc3bd8a4e072c5275", - "quantity": 3, - "amount": 2100, - "price": 700, - "subtotal_amount": 2100, - "product": { - "id": "prod_0bc3bd8a4e072c5275", - "name": "Bouquet - Romantic Roses", - "price": 700 - } + "examples": { + "Example": { + "value": { + "id": "exp_ARi2UbRjgfrHQJoVcKFrBUgA", + "object": "export", + "created_at": "2023-05-16T08:30:21.496Z", + "status": "SCHEDULED", + "channel": "API", + "exported_object": "voucher_transactions", + "parameters": { + "order": "-created_at", + "fields": [ + "id", + "type", + "source_id", + "reason", + "balance", + "amount", + "created_at", + "voucher_id", + "campaign_id", + "details", + "related_transaction_id", + "source" + ], + "filters": { + "voucher_id": { + "conditions": { + "$in": [ + "HRwc0oHz" + ] + } + } + } + }, + "result": null, + "user_id": null } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5bf3323008a35032": { - "date": "2023-01-25T12:18:09.216Z", - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + "No request body": { + "value": { + "id": "exp_ExEE5A6OIK4tssuNswr5O6SU", + "object": "export", + "created_at": "2023-03-21T13:34:57.034Z", + "status": "SCHEDULED", + "channel": "API", + "exported_object": "voucher_transactions", + "parameters": { + "filters": { + "voucher_id": { + "conditions": { + "$in": [ + "HRwc0oHz" + ] + } + } + } + }, + "result": null, + "user_id": null } } - }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "categories": [], - "discount": null, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "additional_info": null, - "assets": { - "qr": {}, - "barcode": {} - }, - "updated_at": null, - "object": "voucher" - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_0ZwLAHgeU9IrI2V1ofYRmW7g", - "voucher": { - "id": "v_4GaEX7clyqMaveT7vHhoyRpsIgxv95Q6", - "code": "HAPPY-ORDER5My", - "campaign": "$20 off the entire order", - "campaign_id": "camp_5h0wc453_4", - "category": null, - "category_id": "cat_0b688929a2476386a6", - "categories": [], - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 2000, - "effect": "APPLY_TO_ORDER" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2022-09-20T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "21ceb848-4869-4dac-ba41-f854bda3a101", - "url": "https://dl.voucherify.io/api/v1/assets/qr/21ceb848-4869-4dac-ba41-f854bda3a101" - }, - "barcode": { - "id": "1dba9cb2-fb28-4c8d-8548-5edb2eb01f5a", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/1dba9cb2-fb28-4c8d-8548-5edb2eb01f5a" - } - }, - "is_referral_code": false, - "created_at": "2023-01-25T12:18:09.256Z", - "updated_at": null, - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/HAPPY-ORDER5My/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/HAPPY-ORDER5My/publications?page=1&limit=10" - }, - "object": "voucher" - }, - "id": "rew_MF4hKh1IKYgJkPjbcFbH94Ho", - "object": "reward", - "name": "Digital Present", - "created_at": "2023-01-25T12:16:44.557Z", - "updated_at": null, - "parameters": { - "campaign": { - "id": "camp_5h0wc453_4", - "type": "DISCOUNT_COUPONS" - } - }, - "type": "CAMPAIGN" - }, - "loyalty_card": { - "points": 2 } } - }, - "Loyalty Card - Digital Reward - Credits on Gift Card": { - "value": { - "id": "r_0c5c1435d053202118", - "object": "redemption", - "date": "2023-01-25T14:42:25.206Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": {}, - "amount": 1, - "result": "SUCCESS", - "order": { - "id": "ord_v0r7JfUQgWRpw28UJm9Z5AaH", - "source_id": null, - "created_at": "2023-01-25T14:42:23.637Z", - "updated_at": null, - "status": "PAID", - "amount": 22500, - "total_amount": 22500, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b2c36568000039138", - "quantity": 1, - "amount": 22500, - "price": 22500, - "subtotal_amount": 22500, - "product": { - "id": "prod_0b2c36568000039138", - "source_id": "86", - "name": "[Sample] Able Brewing System", - "price": 22500 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5c1435d053202118": { - "date": "2023-01-25T14:42:23.681Z", - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + } + }, + "404": { + "description": "Returns an error if the voucher code does not exist or has been deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id IrKORhS", + "request_id": "v-0a96cd820301c0483a", + "resource_id": "IrKORhS", + "resource_type": "voucher" } } - }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "categories": [], - "discount": null, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "additional_info": null, - "assets": { - "qr": {}, - "barcode": {} - }, - "updated_at": null, - "object": "voucher" - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_U554pL2BhDIDZOvZ8y9YQ9hA", - "voucher": { - "id": "v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk", - "code": "GIFT-CARD-xwc6X7Tk", - "campaign": "Gift Cards", - "campaign_id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "GIFT_VOUCHER", - "discount": null, - "gift": { - "amount": 55080, - "balance": 44780 + } + } + } + } + } + } + }, + "/v1/vouchers/import": { + "post": { + "operationId": "import-vouchers", + "tags": [ + "VOUCHERS API" + ], + "summary": "Import Vouchers", + "description": "Import standalone vouchers and gift cards into the repository.\n\n\n\n> 📘 Important notes\n>\n> - **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z.\n> - Custom code attributes (not supported by-default) need to be added as code **metadata**.\n> - You **cannot import the same codes** to a single Voucherify Project.\n\nAny parameters not provided in the payload will be left blank or null.\n\nFor both **standalone discount vouchers and gift cards**, you can import the following fields: \n\n- code\n- category\n- active\n- type\n- start_date\n- expiration_date\n- redemption.quantity\n- additional_info\n- metadata\n\nFor **gift cards**, you can also import the following field:\n\n- gift.amount\n\nFor **discount vouchers**, you can import the `discount` object. The object will slightly vary depending on the type of discount. Each discount type **requires** the `type` to be defined in the import.\n\n| **Discount Type** | **Required fields** |\n|:---|:---|\n| Amount | amount_off, effect |\n| Percent | percent_off, effect |\n| Fixed | fixed_amount, effect |\n| Unit - One item | unit_off, unit_type, effect |\n| Unit - Multiple items | unit_off, unit_type, effect |\n| Shipping | unit_off, unit_type, effect |\n\nFields other than the ones listed above won't be imported. Even if provided, they will be silently skipped.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "required": true, + "description": "The request body is an array of objects. Each object contains details about a specific voucher. ", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_req_vouchers_import" + }, + "examples": { + "Example": { + "value": [ + { + "code": "PROMO-CODE30OFF-NO-EFFECT", + "category": "new customer acquisition", + "type": "DISCOUNT_VOUCHER", + "active": true, + "discount": { + "amount_off": 3000, + "type": "AMOUNT" + }, + "start_date": "2020-12-01T23:00:00Z", + "expiration_date": "2023-12-19T23:00:00Z", + "redemption": { + "quantity": 1 + }, + "metadata": { + "unit": "EUR" + }, + "additional_info": "secret-code1" }, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM/aTyHCYfr7kRWb2vv08WIgY/Tv53SJGW+k2keqfsTq/Ohb5shkCN3FTFsaI8gulTp616sEGn/JJoIInIoNkO9Vd1+AfrKiAjmirCmekE6cz2SVCyNAXs=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM%2FaTyHCYfr7kRWb2vv08WIgY%2FTv53SJGW%2Bk2keqfsTq%2FOhb5shkCN3FTFsaI8gulTp616sEGn%2FJJoIInIoNkO9Vd1%2BAfrKiAjmirCmekE6cz2SVCyNAXs%3D" - }, - "barcode": { - "id": "U2FsdGVkX18vWc/qplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO/199U+zicnFNWqg/jF5ZCQW+6jO1q8=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18vWc%2FqplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO%2F199U%2BzicnFNWqg%2FjF5ZCQW%2B6jO1q8%3D" - } + { + "code": "PROMO-CODE30-PERCENT-NO-EFFECT", + "type": "DISCOUNT_VOUCHER", + "active": false, + "discount": { + "percent_off": 30, + "type": "PERCENT" + }, + "start_date": "2020-12-10T23:00:00Z", + "expiration_date": "2023-12-31T23:00:00Z", + "redemption": { + "quantity": 1 + }, + "metadata": { + "unit": "EUR" + }, + "additional_info": "secret-code2" }, - "is_referral_code": false, - "created_at": "2022-07-08T09:44:33.179Z", - "updated_at": "2023-01-11T15:23:02.789Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "redemption": { - "quantity": null, - "redeemed_quantity": 7, - "redeemed_amount": 10300, - "object": "list", - "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/redemptions?page=1&limit=10" + { + "code": "GIFT-CARD-100", + "type": "GIFT_VOUCHER", + "active": true, + "category": "new customer acquisition", + "gift": { + "amount": 10000 + }, + "start_date": "2020-12-10T23:00:00Z", + "expiration_date": "2023-12-31T23:00:00Z", + "redemption": { + "quantity": 5 + }, + "metadata": { + "unit": "EUR" + }, + "additional_info": "secret-GIFT-code2" }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/publications?page=1&limit=10" + { + "code": "PROMO-CODE1-PERCENT-EFFECT-ORDER", + "type": "DISCOUNT_VOUCHER", + "active": false, + "discount": { + "percent_off": 30, + "type": "PERCENT", + "effect": "APPLY_TO_ORDER" + }, + "start_date": "2020-12-10T23:00:00Z", + "expiration_date": "2023-12-31T23:00:00Z", + "redemption": { + "quantity": 1 + }, + "metadata": { + "unit": "EUR" + }, + "additional_info": "secret-code2" }, - "object": "voucher" - }, - "id": "rew_6bvM4vnaVdbPVQxYpuN37rhH", - "object": "reward", - "name": "Present Credits on Gift Card", - "created_at": "2023-01-25T14:41:31.858Z", - "updated_at": null, - "parameters": { - "campaign": { - "id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", - "balance": 4000, - "type": "GIFT_VOUCHERS" - } - }, - "type": "CAMPAIGN" - }, - "loyalty_card": { - "points": 1 - } - } - }, - "Loyalty Card - Digital Reward - Points on Loyalty Card": { - "value": { - "id": "r_0c5c226f498f1a93f0", - "object": "redemption", - "date": "2023-01-25T15:44:34.317Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": {}, - "amount": 1, - "result": "SUCCESS", - "order": { - "id": "ord_1fv4ITwpUQra6iDTHFPVfnRR", - "source_id": null, - "created_at": "2023-01-25T15:44:32.494Z", - "updated_at": null, - "status": "PAID", - "amount": 700, - "total_amount": 700, - "items": [ { - "object": "order_item", - "product_id": "prod_0bc3bd8a4e072c5275", - "quantity": 1, - "amount": 700, - "price": 700, - "subtotal_amount": 700, - "product": { - "id": "prod_0bc3bd8a4e072c5275", - "name": "Bouquet - Romantic Roses", - "price": 700 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5c226f498f1a93f0": { - "date": "2023-01-25T15:44:32.550Z", - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" - } - } - }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "categories": [], - "discount": null, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "additional_info": null, - "assets": { - "qr": {}, - "barcode": {} - }, - "updated_at": null, - "object": "voucher" - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" + "code": "PROMO-CODE2-PERCENT-EFFECT-ITEM", + "type": "DISCOUNT_VOUCHER", + "active": false, + "discount": { + "percent_off": 30, + "type": "PERCENT", + "effect": "APPLY_TO_ITEMS" + }, + "start_date": "2020-12-10T23:00:00Z", + "expiration_date": "2023-12-31T23:00:00Z", + "redemption": { + "quantity": 1 + }, + "metadata": { + "unit": "EUR" + }, + "additional_info": "secret-code2" }, - "object": "customer" - }, - "assignment_id": "rewa_BpytIepuSekuXXwb9qkLJfCU", - "voucher": { - "id": "v_pQZDYaH8LzoOvgh3234DqZQjGJgbPov6", - "code": "LOYALTY-CARD-zOR2sV9Q", - "campaign": "Loyalty Program", - "campaign_id": "camp_Hpt5hPTA8kSKRWGxBGw8Y0So", - "category": null, - "category_id": null, - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 1000, - "balance": 870 + { + "code": "PROMO-CODE1-PERCENT-NO-EFFECT-REDEEMED-QUANTITY-ATTRIBUTE-DOESNT-GET-PASSED", + "type": "DISCOUNT_VOUCHER", + "active": false, + "discount": { + "percent_off": 30, + "type": "PERCENT" + }, + "start_date": "2020-12-10T23:00:00Z", + "expiration_date": "2023-12-31T23:00:00Z", + "redemption": { + "quantity": 1, + "redeemed_quantity": 1 + }, + "metadata": { + "unit": "EUR" + }, + "additional_info": "secret-code2" }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/THRRj1QegAan0r5U+wRoHuFEA6FR7TrvZm8N+8cK7niF/8uAqFdVYTU1JD0/CdoSXlYqiGgz3PAFOGWFSJt8vkM50fcMtMNLsaudU+YrPDeT2HCB7o0Ts7h1FnbD85+0F7lwrbKmkGW6kub0mjCaRdJYS/axIAq4=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FTHRRj1QegAan0r5U%2BwRoHuFEA6FR7TrvZm8N%2B8cK7niF%2F8uAqFdVYTU1JD0%2FCdoSXlYqiGgz3PAFOGWFSJt8vkM50fcMtMNLsaudU%2BYrPDeT2HCB7o0Ts7h1FnbD85%2B0F7lwrbKmkGW6kub0mjCaRdJYS%2FaxIAq4%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+yREd0zRAfZY9uwtMZsl4eDd8+LeiKGVI5OzOQRpjhtV91IuEe7/SXEW8m4F2Llg2//yieX2zsP3UtWasWxw8ZkHMRSIdxfxzSdSj8ap0dI5xwKW4OE1Q6Sgsb+kZVfCKUHbwXCcd8y5a6xTpVIg97y74Ng1Vg2PY=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2ByREd0zRAfZY9uwtMZsl4eDd8%2BLeiKGVI5OzOQRpjhtV91IuEe7%2FSXEW8m4F2Llg2%2F%2FyieX2zsP3UtWasWxw8ZkHMRSIdxfxzSdSj8ap0dI5xwKW4OE1Q6Sgsb%2BkZVfCKUHbwXCcd8y5a6xTpVIg97y74Ng1Vg2PY%3D" - } + { + "code": "PROMO-CODE1-AMOUNT-EFFECT-ITEMS-PROPORTIONALLY", + "type": "DISCOUNT_VOUCHER", + "active": false, + "discount": { + "amount_off": 30, + "type": "AMOUNT", + "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" + }, + "start_date": "2020-12-10T23:00:00Z", + "expiration_date": "2023-12-31T23:00:00Z", + "redemption": { + "quantity": 1 + }, + "metadata": { + "unit": "EUR" + }, + "additional_info": "secret-code2" }, - "is_referral_code": false, - "created_at": "2022-07-11T08:19:28.780Z", - "updated_at": "2022-10-01T00:02:05.604Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "redemption": { - "quantity": null, - "redeemed_quantity": 26, - "redeemed_points": 130, - "object": "list", - "url": "/v1/vouchers/LOYALTY-CARD-zOR2sV9Q/redemptions?page=1&limit=10" + { + "code": "PROMO-CODE1-FIXED-EFFECT-ORDER", + "type": "DISCOUNT_VOUCHER", + "active": false, + "discount": { + "fixed_amount": 30, + "type": "FIXED", + "effect": "APPLY_TO_ORDER" + }, + "start_date": "2020-12-10T23:00:00Z", + "expiration_date": "2023-12-31T23:00:00Z", + "redemption": { + "quantity": 1 + }, + "metadata": { + "unit": "EUR" + }, + "additional_info": "secret-code2" }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/LOYALTY-CARD-zOR2sV9Q/publications?page=1&limit=10" + { + "code": "PROMO-CODE1-UNIT-SINGLE-ITEM-EFFECT-MISSING", + "type": "DISCOUNT_VOUCHER", + "active": false, + "discount": { + "unit_off": 1, + "unit_type": "prod_0a9f9aeddb019a42db", + "type": "UNIT", + "effect": "ADD_MISSING_ITEMS" + }, + "start_date": "2020-12-10T23:00:00Z", + "expiration_date": "2023-12-31T23:00:00Z", + "redemption": { + "quantity": 1 + }, + "metadata": { + "unit": "EUR" + }, + "additional_info": "secret-code2" }, - "object": "voucher" - }, - "id": "rew_7ZM476Q77dH5KvHk4KzoRNvF", - "object": "reward", - "name": "Present on Loyalty Card", - "created_at": "2023-01-25T15:43:40.716Z", - "updated_at": null, - "parameters": { - "campaign": { - "id": "camp_Hpt5hPTA8kSKRWGxBGw8Y0So", - "balance": 20, - "type": "LOYALTY_PROGRAM" - } - }, - "type": "CAMPAIGN" - }, - "loyalty_card": { - "points": 1 - } - } - }, - "Gift Card": { - "value": { - "id": "r_0b5e7d29ba4fb72ee4", - "object": "redemption", - "date": "2022-07-12T15:26:52.777Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 5000, - "redemption": "r_0b5e7d29ba0fb72ee2", - "result": "SUCCESS", - "order": { - "id": "ord_5iOTjTG4I3Yo2G2bH1qHk66a", - "source_id": null, - "created_at": "2022-07-12T15:26:52.773Z", - "amount": 30200, - "discount_amount": 9530, - "total_discount_amount": 9530, - "total_amount": 20670, - "applied_discount_amount": 5000, - "total_applied_discount_amount": 5000, - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "channel": { - "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", - "channel_type": "API" - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "accepts_marketing": false - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk", - "voucher": { - "id": "v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk", - "code": "GIFT-CARD-xwc6X7Tk", - "campaign": "Gift Cards", - "campaign_id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", - "category": null, - "categories": [], - "discount": null, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "additional_info": null, - "assets": { - "qr": {}, - "barcode": {} - }, - "updated_at": null, - "object": "voucher" - }, - "gift": { - "amount": 5000 - } - } - }, - "Promotion Tier": { - "value": { - "id": "r_0c5d6689b35320059a", - "object": "redemption", - "date": "2023-01-26T15:20:35.916Z", - "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==", - "metadata": null, - "result": "SUCCESS", - "order": { - "id": "ord_4kVJ1PiXP3TNfik3pM79KZsn", - "source_id": null, - "created_at": "2023-01-26T15:20:34.216Z", - "updated_at": null, - "status": "PAID", - "amount": 200000, - "discount_amount": 80000, - "total_discount_amount": 80000, - "total_amount": 120000, - "applied_discount_amount": 80000, - "total_applied_discount_amount": 80000, - "items": [ { - "object": "order_item", - "source_id": "apple534", - "related_object": "product", - "product_id": "prod_anJ03RZZq74z4v", - "quantity": 2, - "amount": 100000, - "price": 50000, - "subtotal_amount": 100000, - "product": { - "name": "Apple iPhone 8", - "metadata": { - "shop": "citycenter", - "category": "electronics" - } + "code": "PROMO-CODE2-UNIT-MULTIPLE-ITEMS", + "type": "DISCOUNT_VOUCHER", + "active": true, + "discount": { + "type": "UNIT", + "effect": "ADD_MANY_ITEMS", + "units": [ + { + "unit_off": 1, + "unit_type": "prod_0a9f9aeddb019a42db", + "effect": "ADD_MISSING_ITEMS" + }, + { + "unit_off": 1, + "unit_type": "prod_0a9f9aeddb019a42db", + "effect": "ADD_NEW_ITEMS" + } + ] + }, + "start_date": "2020-12-10T23:00:00Z", + "expiration_date": "2023-12-31T23:00:00Z", + "redemption": { + "quantity": 1 }, "metadata": { - "series": "2022-783CV" - } + "unit": "EUR" + }, + "additional_info": "secret-code2" }, { - "object": "order_item", - "source_id": "apple534-ihd5", - "related_object": "sku", - "sku_id": "sku_0KtP4rvwEECQ2U", - "quantity": 1, - "amount": 100000, - "price": 100000, - "subtotal_amount": 100000, - "sku": { - "sku": "Apple iPad 10 Silver 64GB", - "metadata": { - "category": "electronics" - } - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "object": "customer" - }, - "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5d6689b35320059a": { - "date": "2023-01-26T15:20:34.253Z", - "related_object_type": "promotion_tier", - "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "related_object_parent_id": "camp_w7BUstntAm8jbIDjfM49volj" + "code": "PROMO-CODE1-SHIPPING", + "type": "DISCOUNT_VOUCHER", + "active": false, + "discount": { + "type": "UNIT", + "unit_off": 1, + "unit_type": "prod_5h1pp1ng", + "effect": "ADD_MISSING_ITEMS" + }, + "start_date": "2020-12-10T23:00:00Z", + "expiration_date": "2023-12-31T23:00:00Z", + "redemption": { + "quantity": 1 + }, + "metadata": { + "unit": "EUR" + }, + "additional_info": "secret-code2" } - } - }, - "channel": { - "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", - "channel_type": "API" - }, - "customer": { - "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "name": "Annie Lemon", - "email": "annie@lemon.com", - "source_id": "annie@lemon.com", - "object": "customer" + ] + } + } + } + } + }, + "responses": { + "202": { + "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and vouchers will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" }, - "related_object_type": "promotion_tier", - "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "voucher": null, - "promotion_tier": { - "id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "action": null, - "campaign": { - "id": "camp_w7BUstntAm8jbIDjfM49volj", - "start_date": null, - "expiration_date": null, - "object": "campaign" - }, - "campaign_id": null, - "summary": { - "redemptions": { - "total_redeemed": 0 - }, - "orders": { - "total_amount": 0, - "total_discount_amount": 0 + "examples": { + "Example": { + "value": { + "async_action_id": "aa_0aac93c6af84485df3" } - }, - "object": "promotion_tier", - "validation_rule_assignments": null + } } } - }, - "Stacked Redemption": { - "value": { - "id": "r_0b5e3e2b7f851d0192", - "object": "redemption", - "date": "2022-07-12T10:51:33.098Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "result": "SUCCESS", - "order": { - "id": "ord_qjnno0eUQ1fs0RMjejfbZp7q", - "source_id": null, - "created_at": "2022-07-12T10:51:31.687Z", - "updated_at": null, - "status": "PAID", - "amount": 20000, - "discount_amount": 6100, - "total_discount_amount": 6100, - "total_amount": 13900, - "applied_discount_amount": 6100, - "total_applied_discount_amount": 6100, - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0b5e3e2b7f851d0192": { - "date": "2022-07-12T10:51:31.711Z", - "related_object_type": "redemption", - "related_object_id": "r_0b5e3e2b7f851d0192", - "stacked": [ - "r_0b5e3e2b7f851d0193", - "r_0b5e3e2b7fc51d0194", - "r_0b5e3e2b7fc51d0195", - "r_0b5e3e2b7fc51d0196", - "r_0b5e3e2b7fc51d0197" - ] + } + } + } + } + }, + "/v1/vouchers/importCSV": { + "post": { + "operationId": "import-vouchers-using-csv", + "tags": [ + "VOUCHERS API" + ], + "summary": "Import Vouchers using CSV", + "description": "Import standalone vouchers into the repository using a CSV file.\n\nThe 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. \n\nYou can find an example CSV file [here](https://support.voucherify.io/article/45-import-codes-and-share-them-digitally#coupons).\n___\n\n```cURL cURL example\ncurl -X POST \\\n https://api.voucherify.io/v1/vouchers/importCSV \\\n -F file=@/path/to/vouchers.csv \\\n -H \"X-App-Id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n -H \"X-App-Token: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n```\n\n\n\n> 📘 Standard voucher fields mapping\n>\n> - Go to the [import vouchers](ref:import-vouchers) endpoint to see all standard CSV fields description (body params section).\n> - 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\n>- **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z. \n> - `YYYY-MM-DD`\n> - `YYYY-MM-DDTHH`\n> - `YYYY-MM-DDTHH:mm`\n> - `YYYY-MM-DDTHH:mm:ss`\n> - `YYYY-MM-DDTHH:mm:ssZ`\n> - `YYYY-MM-DDTHH:mm:ssZ`\n> - `YYYY-MM-DDTHH:mm:ss.SSSZ`\n> - Custom code attributes (not supported by-default) need to be added as code **metadata**.\n> - You **cannot import the same codes** to a single Voucherify Project.\n\n\n\n> 📘 Categories\n>\n> 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](ref:list-vouchers) endpoint.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "The file path is stored in the form `file` header.", + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/a_req_importCSV" + } + } + } + }, + "responses": { + "202": { + "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and vouchers will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the **response** and pass it using the [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" + }, + "examples": { + "Example": { + "value": { + "async_action_id": "aa_0a875d56c805df6601" } } - }, - "channel": { - "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", - "channel_type": "API" - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "accepts_marketing": false - }, - "object": "customer" - }, - "related_object_type": "redemption", - "related_object_id": "r_0b5e3e2b7f851d0192", - "voucher": null - } - }, - "Failed Voucher": { - "value": { - "id": "rf_0c5bd3c15701c78243", - "object": "redemption", - "date": "2023-01-25T10:00:47.812Z", - "customer_id": "cust_w1aRTTkpzeTGtOauISc8CKUN", - "tracking_id": "track_hr0jh/qNQqZWu7gkCEcVwEg27bNVrn2+", - "metadata": { - "location_id": [], - "redemption_location": { - "city": "Albany", - "state": "New York" - } - }, - "result": "FAILURE", - "failure_code": "voucher_disabled", - "failure_message": "voucher is disabled", - "order": null, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_w1aRTTkpzeTGtOauISc8CKUN", - "name": "Bobby's Friend", - "email": null, - "source_id": "create_order_referrer_1", - "metadata": {}, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_zr4XJD6b6JtldZq9EorHf4jxRbahjkfi", - "voucher": { - "id": "v_zr4XJD6b6JtldZq9EorHf4jxRbahjkfi", - "code": "PROMO-CODE2", - "campaign": null, - "campaign_id": null, - "category": null, - "categories": [], - "discount": null, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "additional_info": null, - "assets": { - "qr": {}, - "barcode": {} - }, - "updated_at": null, - "object": "voucher" } } - }, - "Failed Promotion Tier": { - "value": { - "id": "rf_0c5d6e47050156bfc2", - "object": "redemption", - "date": "2023-01-26T15:54:23.508Z", - "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==", - "metadata": null, - "result": "FAILURE", - "failure_code": "promotion_inactive", - "failure_message": "Inactive Promotion", - "order": null, - "channel": { - "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", - "channel_type": "API" - }, - "customer": { - "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "name": "Annie Lemon", - "email": "annie@lemon.com", - "source_id": "annie@lemon.com", - "metadata": { - "age": 2 - }, - "object": "customer" - }, - "related_object_type": "promotion_tier", - "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "voucher": null, - "promotion_tier": { - "id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "action": null, - "campaign": { - "id": "camp_w7BUstntAm8jbIDjfM49volj", - "start_date": null, - "expiration_date": null, - "object": "campaign" - }, - "campaign_id": null, - "summary": { - "redemptions": { - "total_redeemed": 0 - }, - "orders": { - "total_amount": 0, - "total_discount_amount": 0 + } + }, + "400": { + "description": "Invalid payload. You may receive this error if you have incorrectly or have not specified the content type as `multipart/form-data` in the headers.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Example 1": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Payload should have required property 'file'", + "request_id": "74e4bb71-5b6d-49b9-98eb-239691c9d67a" } - }, - "object": "promotion_tier", - "validation_rule_assignments": null + } } } - }, - "Failed Redemption": { - "value": { - "id": "rf_0c5bde8dfc0156f0e3", - "object": "redemption", - "date": "2023-01-25T10:47:58.578Z", - "customer_id": null, - "tracking_id": null, - "metadata": null, - "result": "FAILURE", - "failure_code": "not_found", - "failure_message": "Resource not found", - "order": null, - "channel": { - "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", - "channel_type": "API" - }, - "customer": null, - "related_object_type": "redemption", - "related_object_id": "rf_0c5bde8dfc0156f0e3", - "voucher": null - } } } } } - } - } - } - }, - "/v1/vouchers/{code}/redemption": { - "parameters": [ - { - "$ref": "#/components/parameters/code" - } - ], - "get": { - "operationId": "get-voucher-redemptions", - "tags": [ - "REDEMPTIONS API" - ], - "summary": "Get Voucher's Redemptions", - "description": "Retrieve the number of times a voucher was redeemed and each of the redemption details.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "A dictionary with a `redemption_entries` property that contains an array of voucher's redemptions.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/7_res_get_vouchers_redemptions" - }, - "examples": { - "Example": { - "value": { - "quantity": null, - "redeemed_quantity": 6, - "object": "list", - "url": "/v1/vouchers/Test - FB - Vouchers - 9/redemptions?page=1&limit=10", - "data_ref": "redemption_entries", - "total": 6, - "redemption_entries": [ - { - "id": "r_0bc92f81a6801f9bca", - "object": "redemption", - "date": "2022-10-03T12:24:58.008Z", - "customer_id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "tracking_id": "track_fxEMFisanb6bqeHALcTMxy9fmc+1Azdq951CZwGFCweQF8eGLowFHg==", - "metadata": {}, - "result": "SUCCESS", + }, + "/v1/vouchers/qualification": { + "post": { + "operationId": "examine-vouchers-qualification", + "deprecated": true, + "tags": [ + "VOUCHERS API" + ], + "summary": "Examine Qualification [Deprecated]", + "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for qualification, and we do not recommend using it. The new [Qualifications API](ref:examine-qualification) introduces additional features and improvements while maintaining backward compatibility. 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. \n\nDisplay vouchers qualified to the given customer and context (e.g., order, loyalty reward). Checks up to 50 **standalone vouchers**. \n\n> 👍 Prevailing assumption\n> You data is synced with Voucherify.\n\n ## How does this endpoint work? \n\n A property's value that does not meet a validation rule requirement will disqualify that particular voucher and it will not be listed in the results.\n\nAs a sample use case, you can imagine a requirement of displaying coupons available for the customer below the shopping cart. The customer can choose and apply the proposed voucher.\n\n ## What's excluded? \n\n The verification logic won't run against _coupons from bulk unique code campaigns_. For campaigns with multiple unique codes, you should run a [dedicated function](ref:examine-campaigns-qualification) for searching and identifying qualified campaigns.\n\n ## Customizing the response\n\n> 📘 Query parameters let you sort and filter the returned vouchers\n>\n> Customize your response:\n> - If you only care about verifying a customer, use `audienceRulesOnly` set to `true`. \n>- If you want to limit the number of vouchers to be returned from the entire pool of eligible vouchers, set a `limit`. This will return vouchers sorted by `-created_at`, by default beginning with the most recent vouchers listed at the top.\n> - If you have a preference on the sorting order of the returned vouchers, you can use `order` to customize your response.\n\n ## Sending the request body payload\n\n\n ## Customer\n\nYou have the option of sending customer data via the dedicated `customer` object in the request body or a nested `customer` object within the `order` object.\n ### Available options:\n\n - You can either pass a customer `id` (Voucherify system generated),\n\n - a `source_id` (your own unique internal customer identifier e.g., email, database ID, CRM id), \n\n - a combination of the remaining parameters in the customer object, \n\n - a combination of customer `id` and remaining parameters excluding `source_id`, or\n\n - a combination of `source_id` and remaining parameters excluding `id`\n\n #### Note:\n\n For the latter two options, if you pass the `source_id` or the `id` with the other parameters, the logic will run independently for parameters explicitly passed in the request body versus those not explicitly passed in the request body. For _parameters not explicitly listed in the payload_, the verification will be against the data stored for that customer in the system. On the other hand, for any _parameter values explicitly passed in the payload_, the logic will ignore those stored in the system and will use the new values provided in the qualification request body. \n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). \n\n## Order\n\n ### Available options:\n\n - You can either pass an order `id` (Voucherify system generated),\n\n - a `source_id` (your own unique internal order identifier), \n\n - a combination of the remaining parameters in the order object, \n\n - a combination of order `id` and remaining parameters excluding `source_id`, or\n\n - a combination of `source_id` and remaining parameters excluding `id`\n\n #### Note:\n\n For the latter two options, if you pass the `source_id` or the `id` with the other parameters, the logic will run independently for parameters explicitly passed in the request body versus those not explicitly passed in the request body. For _parameters not explicitly listed in the payload_, the verification will be against the data stored for that order in the system. On the other hand, for any _parameter values explicitly passed in the payload_, the logic will ignore those stored in the system and will use the new values provided in the qualification request body. \n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).\n\n## Guidelines:\n\nTo validate against vouchers with total order `amount` requirements, make sure to include the total order `amount` in the order object or alternatively the `amount` for _every_ order item (the application will then add each amount to get the total and perform the qualification checks). If the total order `amount` is provided along with the individual items' amounts, the total order `amount` will take precedence.\n\n\n| **Case** | **Order-Level Parameter Included** | **Item-Level Parameter Included** | **Precedence** | **Calculation Result** | **Parameter included in payload accounts for checks against requirements in these validation rules** |\n|:---:|:---:|:---:|:---:|---|---|\n| **1** | `amount` | `amount` | Order-level | Uses order-level `amount` | - Total order amount |\n| **2** | | `amount` | Item-level | Sums each item-level `amount` | - Total order amount
- subtotal of matched items |\n| **3** | | `price`
`quantity` | Item-level | Multiplies each item's (`price` x `quantity`) to get item `amount` and then adds each item's `amount` to get total order `amount` | - Total order amount
- Subtotal of matched items
- Unit price of any matching order line
- Price of each item/Price of any item |\n| **4** | | `amount`
`price`
`quantity` | Item-level `amount` | Uses item-level `amount` for total order `amount` calculation, ignores (`price` x `quantity`) calculation | - Total order amount (uses item `amount` if provided or `price` x `quantity` for items without `amount` property; `amount` takes precedence in case all 3 properties are provided for an item)
- Subtotal of matched items (uses item `amount`, takes precedence if all 3 properties are provided)
- Unit price of any matching order line
- Price of each item/Price of any item |\n| **5** | `amount` | `amount`
`price`
`quantity` | Order-level | Uses order-level `amount` for total order `amount` | - Total order amount (uses order-level `amount`).
- Subtotal of matched items (see case **4** for details).
- Unit price of any matching order line
- Price of each item/Price of any item |\n \n\n## Reward\n\n ## Gift Card", + "parameters": [ + { + "$ref": "#/components/parameters/audienceRulesOnly" + }, + { + "schema": { + "type": "integer", + "maximum": 50 + }, + "in": "query", + "name": "limit", + "description": "The number of vouchers to be qualified." + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at", + "code", + "-code" + ] + }, + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash `-` means sorting in a descending order." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "required": true, + "description": "Should contain given customer and context such as an order.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_req_vouchers_qualification" + }, + "examples": { + "Example": { + "value": { + "customer": { + "source_id": "source-id", + "metadata": { + "key": "value" + } + }, "order": { - "id": "ord_bhp1EH2SDz7UwkkurPFPLPhi", - "source_id": null, - "created_at": "2022-10-03T12:24:56.179Z", - "updated_at": null, - "status": "PAID", - "amount": 230000, - "discount_amount": 100, - "total_discount_amount": 100, - "total_amount": 229900, - "applied_discount_amount": 100, - "total_applied_discount_amount": 100, + "amount": 10000, "items": [ { - "object": "order_item", - "product_id": "prod_0bae45ffc7003ffc52", + "product_id": "product-id", + "quantity": "1", + "price": 10000, + "related_object": "product", + "product": { + "metadata": { + "key": "value" + } + } + } + ] + }, + "metadata": { + "key": "value" + } + } + }, + "Qualify product using product_id": { + "value": { + "customer": { + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" + }, + "metadata": {}, + "birthdate": "YYYY-MM-DD" + }, + "order": { + "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", + "source_id": "string", + "amount": 10000, + "items": [ + { + "source_id": "product_1234", + "product_id": "prod_0a9f9aeddb019a42db", + "amount": 10000, "quantity": 1, - "amount": 230000, - "price": 230000, - "subtotal_amount": 230000, + "price": 10000, + "metadata": {}, + "related_object": "product", "product": { - "id": "prod_0bae45ffc7003ffc52", - "source_id": "second_product", - "name": "Samsung Phone 2", - "price": 230000 + "source_id": "product_1234", + "name": "Phone", + "price": 10000, + "metadata": {} } } ], - "metadata": {}, "customer": { - "id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "object": "customer" - }, - "customer_id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0bc92f81a6801f9bca": { - "date": "2022-10-03T12:24:56.219Z", - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - } - } + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" + }, + "metadata": {}, + "birthdate": "YYYY-MM-DD" + }, + "referrer": {}, + "metadata": "string" }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" + "reward": { + "points": 0, + "assignment_id": "string", + "id": "string" }, + "metadata": {} + } + }, + "Qualify product using source_id": { + "value": { "customer": { - "id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "name": null, - "email": null, - "source_id": "johnnyy@email.com", + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" + }, "metadata": {}, - "object": "customer" + "birthdate": "YYYY-MM-DD" }, - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "voucher": { - "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "code": "Test - FB - Vouchers - 9", - "campaign_id": null - } - }, - { - "id": "r_0bc92e6a68050e118c", - "object": "redemption", - "date": "2022-10-03T12:20:11.873Z", - "customer_id": "cust_TzWOhveicr7BI1Qg4bCFrrQQ", - "tracking_id": "track_5DQxXbK0C0pvAaHk7mnulmKhuFqhawWj", - "metadata": {}, - "result": "SUCCESS", "order": { - "id": "ord_rBsuJYqf4eFZgqj6IxeJgEcN", - "source_id": null, - "created_at": "2022-10-03T12:20:10.222Z", - "updated_at": null, - "status": "PAID", - "amount": 230000, - "discount_amount": 100, - "total_discount_amount": 100, - "total_amount": 229900, - "applied_discount_amount": 100, - "total_applied_discount_amount": 100, + "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", + "source_id": "string", + "amount": 10000, "items": [ { - "object": "order_item", - "product_id": "prod_0bae45ffc7003ffc52", + "source_id": "product_1234", + "product_id": "prod_0a9f9aeddb019a42db", + "amount": 10000, "quantity": 1, - "amount": 230000, - "price": 230000, - "subtotal_amount": 230000, + "price": 10000, + "metadata": {}, + "related_object": "product", "product": { - "id": "prod_0bae45ffc7003ffc52", - "source_id": "second_product", - "name": "Samsung Phone 2", - "price": 230000 + "source_id": "product_1234", + "name": "Phone", + "price": 10000, + "metadata": {} } } ], - "metadata": {}, "customer": { - "id": "cust_TzWOhveicr7BI1Qg4bCFrrQQ", - "object": "customer" + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" + }, + "metadata": {}, + "birthdate": "YYYY-MM-DD" }, - "customer_id": "cust_TzWOhveicr7BI1Qg4bCFrrQQ", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0bc92e6a68050e118c": { - "date": "2022-10-03T12:20:10.272Z", - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - } - } + "referrer": {}, + "metadata": "string" }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" + "reward": { + "points": 0, + "assignment_id": "string", + "id": "string" }, + "metadata": {} + } + }, + "Qualify SKU using sku_id": { + "value": { "customer": { - "id": "cust_TzWOhveicr7BI1Qg4bCFrrQQ", - "name": "Bob Jones", - "email": "bob.smith@email.com", - "source_id": "pub_source_customer_4", - "metadata": { - "lang": "en", - "test": true + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" }, - "object": "customer" + "metadata": {}, + "birthdate": "YYYY-MM-DD" }, - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "voucher": { - "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "code": "Test - FB - Vouchers - 9", - "campaign_id": null - } - }, - { - "id": "r_0bc92db6e6001f9aa8", - "object": "redemption", - "date": "2022-10-03T12:17:07.780Z", - "customer_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", - "tracking_id": "track_5DQxXbK0C0pvAaHk7mnulmYlx396Pk4X", - "metadata": {}, - "result": "SUCCESS", "order": { - "id": "ord_JvZbg1LFcXdQ67no5SENGldH", - "source_id": null, - "created_at": "2022-10-03T12:17:06.404Z", - "updated_at": null, - "status": "PAID", - "amount": 230000, - "discount_amount": 1200, - "total_discount_amount": 1200, - "total_amount": 228800, - "applied_discount_amount": 1200, - "total_applied_discount_amount": 1200, + "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", + "source_id": "string", + "amount": 10000, "items": [ { - "object": "order_item", - "product_id": "prod_0bae45ffc7003ffc52", + "source_id": "product_1234", + "product_id": "prod_0a9f9aeddb019a42db", + "amount": 10000, "quantity": 1, - "amount": 230000, - "price": 230000, - "subtotal_amount": 230000, + "price": 10000, + "metadata": {}, + "related_object": "product", "product": { - "id": "prod_0bae45ffc7003ffc52", - "source_id": "second_product", - "name": "Samsung Phone 2", - "price": 230000 + "source_id": "product_1234", + "name": "Phone", + "price": 10000, + "metadata": {} } } ], - "metadata": {}, "customer": { - "id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", - "object": "customer" + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" + }, + "metadata": {}, + "birthdate": "YYYY-MM-DD" }, - "customer_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0bc92db6e6001f9aa8": { - "date": "2022-10-03T12:17:06.456Z", - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - } - } + "referrer": {}, + "metadata": "string" }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" + "reward": { + "points": 0, + "assignment_id": "string", + "id": "string" }, + "metadata": {} + } + }, + "Qualify SKU using source_id": { + "value": { "customer": { - "id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", - "name": "Bob Jones", - "email": "bob.smith@email.com", - "source_id": "pub_source_customer_5", - "metadata": { - "lang": "en", - "test": true + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" }, - "object": "customer" + "metadata": {}, + "birthdate": "YYYY-MM-DD" }, - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "voucher": { - "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "code": "Test - FB - Vouchers - 9", - "campaign_id": null - } - }, - { - "id": "r_0bc2dc6404426c0ab3", - "object": "redemption", - "date": "2022-09-28T14:30:56.199Z", - "customer_id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "tracking_id": "track_fxEMFisanb6bqeHALcTMxy9fmc+1Azdq951CZwGFCweQF8eGLowFHg==", - "metadata": {}, - "result": "SUCCESS", "order": { - "id": "ord_6uuhGraDuXMOpVRTJT251kKW", - "source_id": null, - "created_at": "2022-09-28T14:30:54.681Z", - "updated_at": null, - "status": "PAID", - "amount": 230000, - "discount_amount": 800, - "total_discount_amount": 800, - "total_amount": 229200, - "applied_discount_amount": 800, - "total_applied_discount_amount": 800, + "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", + "source_id": "string", + "amount": 10000, "items": [ { - "object": "order_item", - "product_id": "prod_0bae45ffc7003ffc52", + "source_id": "product_1234", + "product_id": "prod_0a9f9aeddb019a42db", + "amount": 10000, "quantity": 1, - "amount": 230000, - "price": 230000, - "subtotal_amount": 230000, + "price": 10000, + "metadata": {}, + "related_object": "product", "product": { - "id": "prod_0bae45ffc7003ffc52", - "source_id": "second_product", - "name": "Samsung Phone 2", - "price": 230000 + "source_id": "product_1234", + "name": "Phone", + "price": 10000, + "metadata": {} } } ], - "metadata": {}, "customer": { - "id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "object": "customer" + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" + }, + "metadata": {}, + "birthdate": "YYYY-MM-DD" }, - "customer_id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0bc2dc6404426c0ab3": { - "date": "2022-09-28T14:30:54.737Z", - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - } - } + "referrer": {}, + "metadata": "string" }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" + "reward": { + "points": 0, + "assignment_id": "string", + "id": "string" }, + "metadata": {} + } + }, + "Qualify redemption metadata": { + "value": { "customer": { - "id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "name": null, - "email": null, - "source_id": "jonny@email.com", + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" + }, "metadata": {}, - "object": "customer" + "birthdate": "YYYY-MM-DD" }, - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "voucher": { - "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "code": "Test - FB - Vouchers - 9", - "campaign_id": null - } - }, - { - "id": "r_0bc2d6f0ebc95f1783", - "object": "redemption", - "date": "2022-09-28T14:07:07.516Z", - "customer_id": "cust_H0nXrItO1DNV3UiPIl54HA5o", - "tracking_id": "track_ThofCMTQe4EVIo0zvvOlTor1twaQNd7E", - "metadata": {}, - "result": "SUCCESS", "order": { - "id": "ord_ZQevc2J2sBegsnp5DwanXHsa", - "source_id": null, - "created_at": "2022-09-28T14:07:06.073Z", - "updated_at": null, - "status": "PAID", - "amount": 230000, - "discount_amount": 0, - "total_discount_amount": 0, - "total_amount": 230000, - "applied_discount_amount": 0, - "total_applied_discount_amount": 0, + "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", + "source_id": "string", + "amount": 10000, "items": [ { - "object": "order_item", - "product_id": "prod_0bae45ffc7003ffc52", + "source_id": "product_1234", + "product_id": "prod_0a9f9aeddb019a42db", + "amount": 10000, "quantity": 1, - "amount": 230000, - "price": 230000, - "subtotal_amount": 230000, + "price": 10000, + "metadata": {}, + "related_object": "product", "product": { - "id": "prod_0bae45ffc7003ffc52", - "source_id": "second_product", - "name": "Samsung Phone 2", - "price": 230000 + "source_id": "product_1234", + "name": "Phone", + "price": 10000, + "metadata": {} } } ], - "metadata": {}, "customer": { - "id": "cust_H0nXrItO1DNV3UiPIl54HA5o", - "object": "customer" + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" + }, + "metadata": {}, + "birthdate": "YYYY-MM-DD" }, - "customer_id": "cust_H0nXrItO1DNV3UiPIl54HA5o", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0bc2d6f0ebc95f1783": { - "date": "2022-09-28T14:07:06.159Z", - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - } - } + "referrer": {}, + "metadata": "string" }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" + "reward": { + "points": 0, + "assignment_id": "string", + "id": "string" }, + "metadata": {} + } + }, + "Qualify order line item metadata": { + "value": { "customer": { - "id": "cust_H0nXrItO1DNV3UiPIl54HA5o", - "name": "Bob Smith", - "email": "bob.smith.1@email.com", - "source_id": "bob.smith.1@email.com", - "metadata": { - "lang": "en", - "test": false + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" }, - "object": "customer" + "metadata": {}, + "birthdate": "YYYY-MM-DD" }, - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "voucher": { - "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "code": "Test - FB - Vouchers - 9", - "campaign_id": null - } - }, - { - "id": "r_0bc2d3c4f7495f159a", - "object": "redemption", - "date": "2022-09-28T13:53:16.057Z", - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "tracking_id": "track_fxEMFisanb4sbl4Z4yCnJyDW013IrRbJmqKByTNHbXE=", - "metadata": {}, - "result": "SUCCESS", "order": { - "id": "ord_ff6rwr58kmdyuLsi5orplnVW", - "source_id": null, - "created_at": "2022-09-28T13:53:14.604Z", - "updated_at": null, - "status": "PAID", - "amount": 230000, - "discount_amount": 800, - "total_discount_amount": 800, - "total_amount": 229200, - "applied_discount_amount": 800, - "total_applied_discount_amount": 800, + "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", + "source_id": "string", + "amount": 10000, "items": [ { - "object": "order_item", - "product_id": "prod_0bae45ffc7003ffc52", + "source_id": "product_1234", + "product_id": "prod_0a9f9aeddb019a42db", + "amount": 10000, "quantity": 1, - "amount": 230000, - "price": 230000, - "subtotal_amount": 230000, + "price": 10000, + "metadata": {}, + "related_object": "product", "product": { - "id": "prod_0bae45ffc7003ffc52", - "source_id": "second_product", - "name": "Samsung Phone 2", - "price": 230000 + "source_id": "product_1234", + "name": "Phone", + "price": 10000, + "metadata": {} } } ], - "metadata": {}, "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "object": "customer" + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" + }, + "metadata": {}, + "birthdate": "YYYY-MM-DD" }, - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0bc2d3c4f7495f159a": { - "date": "2022-09-28T13:53:14.717Z", - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - } - } + "referrer": {}, + "metadata": "string" }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "name": "John Smith", - "email": "john.smith@email.com", - "source_id": "john.smith@email.com", - "metadata": { - "acquisition_channel": "Facebook" - }, - "object": "customer" + "reward": { + "points": 0, + "assignment_id": "string", + "id": "string" }, - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "voucher": { - "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "code": "Test - FB - Vouchers - 9", - "campaign_id": null - } + "metadata": {} } - ] + } + } + } + } + }, + "responses": { + "200": { + "description": "This operation returns the list of valid and active vouchers based on the qualification of given context (e.g., customer profile, redemptions metadata, order).", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_res_vouchers_qualification" + } } } } } } - } - } - }, - "post": { - "operationId": "redeem-voucher", - "deprecated": true, - "tags": [ - "REDEMPTIONS API" - ], - "summary": "Redeem Voucher [Deprecated]", - "description": "\n> ❗️ Deprecated \n>\n> 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](ref:redeem-stacked-discounts) 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. \n\nTo redeem a voucher, you create a redemption object. It increments the redemption counter and updates the history of the voucher. \n\n## How discounts and order amounts are calculated in the API response?\n\nIn the table below, you can see the logic the API follows to calculate discounts and amounts:\n\n| **Field** | **Calculation** | **Description** |\n|:---|:---|:---|\n| amount | N/A | This field shows the order amount before applying any discount |\n| total_amount | total_amount = amount - total_discount_amount | This field shows the order amount after applying all the discounts |\n| discount_amount | discount_amount = previous_discount_amount + applied_discount_amount | This field sums up all order-level discounts applied to a patricular order |\n| items_discount_amount | sum(items, i => i.discount_amount) | This field sums up all product-specific discounts applied to this order |\n| total_discount_amount | total_discount_amount = discount_amount + items_discount_amount | This field sums up all order-level and all product-specific discounts applied to this order |\n| applied_discount_amount | N/A | This field shows order-level discount applied in a particular request |\n| items_applied_discount_amount | sum(items, i => i.applied_discount_amount) | This field sums up all product-specific discounts applied in a particular request |\n| 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 |\n\n## SDKs \n\nYou can invoke the redemption endpoint with one of the official libraries: \n\n\n[block:html]\n{\n \"html\": \"
\\n\\n
\\n \\n
\\n\\n
\\n\\n
\\n\\n\\n
\\n\\n\\n\\n\\n\\n
\\n\\n
\\n
\\n\\n\"\n}\n[/block]\n\n## Customer tracking\n\nThe redeem operation is a key part of [Customer tracking] (doc:customer-tracking) workflow. There're 3 ways you can identify your end customer in Voucherify within this request. You can either provide a tracking ID (e.g. your customer's login or a generated id), a customer ID (if the customer is already stored in Voucherify) or a full `customer` object in the payload. Note that you can pass and thus store any customer-related metadata. See examples on the right.\n\n\n```json\n\"customer\": {\n \"source_id\": \"alice.morgan\",\n \"name\": \"Alice Morgan\",\n \"email\": \"alice@morgan.com\",\n \"description\": \"\",\n \"metadata\": {\n \"locale\": \"en-GB\",\n \"shoeSize\": 5,\n \"favourite_brands\": [\"Armani\", \"L’Autre Chose\", \"Vicini\"]\n }\n}\n```\n\nIf you already created a customer profile in Voucherify's database, whether it was implicitly by providing it to the redeem function or explicitly by invoking the [Create Customer](ref:create-customer) method, you can identify your customer in redemptions by a generated ID (starting with `cust_`). \n\n\n```json title=Example Customer Identifier [object]\n\"customer\": {\n \"id\": \"cust_C9qJ3xKgZFqkpMw7b21MF2ow\"\n}\n```\n\n```json title=Example Customer Identifier\n{\n \"customer\": \"cust_C9qJ3xKgZFqkpMw7b21MF2ow\"\n}\n```\n\n```json title=Example Customer Identifier by Source ID\n{\n \"customer\": \"alice.morgan\"\n}\n```\n\n\n> 📘 Redemption rollback\n>\n> Do you need to undo a redemption? You can do it with [redemption rollback](ref:rollback-redemption).\n\n## Redemption failures\n\nThere are several reasons why a redemption may fail. You will get the reason in the error key:\n - `resource_not_found` - voucher with given code does not exist\n- `voucher_not_active` - voucher is not active yet (before start date)\n- `voucher_expired` - voucher has already expired (after expiration date)\n- `voucher_disabled` - voucher has been disabled (`active: false`)\n- `quantity_exceeded` - voucher's redemptions limit has been exceeded\n- `gift_amount_exceeded` - gift amount has been exceeded\n- `customer_rules_violated` - customer did not match the segment\n- `order_rules_violated` - order did not match validation rules\n- `invalid_order` - order was specified incorrectly\n- `invalid_amount` - order amount was specified incorrectly\n- `missing_amount` - order amount was not specified\n- `missing_order_items` - order items were not specified\n- `missing_customer` - customer was not specified\n\n## Order object\n\nThe purchase of previously defined products (products are stored in Voucherify) by end customers is handled through the order object. You are obligated to pass the order object in case you use validation rules. You can learn more about the [validation rules structure] (doc:validation-rules). \n\n| **Attributes** | **Description** |\n|:---|:---|\n| amount
`integer` | A positive integer representing the total amount for the order. |\n| items
`list` | List of items constituting the order. Order items can be defined either by `product_id` or `sku_id`. Along with every item you must define the `quantity`.

Child attributes:

- `product_id` (*string*) - The ID of the associated product object for this line item.

- `sku_id` (*string*) - The ID of the associated variant (sku) object for this line item.

- `quantity` (*integer*) - A positive integer representing the number of instances of the item that are included in this order line.

- `price` (*integer*) - A positive integer representing the cost of an item.

- `amount` (*integer*) - `quantity` * `price` (you should provide it to retrieve `discount_amount` for a particular order item if the discount is applied only to this item learn more |\n\n\n\n\n> 🚧 Order ID\n>\n> If you use the same order id in more than one redemption request, all valid discounts provided in the redemption payload will be applied to the given order. [Read more in this guide] (https://docs.voucherify.io/docs/manage-stackable-discounts).\n\n\n```json title=Example Order\n\"order\": {\n \"amount\": 10000,\n \"items\": [\n {\n \"product_id\": \"prod_Bi7sRr3kwvxH2I\",\n \"quantity\": 1\n }\n ]\n}\n```\n## Gift Vouchers - redeem Gift Card and control redeemed amount\n\nIn Voucherify,you can also create a gift card for customers. Customers then can use gift card credits to fulfill the order. A user can specify how many credits he wants to use from the gift card. The available balance of credits is counted based on policy rules attached to the Gift Voucher definition.\n\nWhen the user wants to define how many gift credits are to be used from the gift card to complete the order, the `credits` property can be assigned the equivalent value in the lowest currency in the request body. The value of credits being applied to the order cannot be higher than the current balance on the gift card.\n\n\n```cURL title=Example Request - control redeemed amount\ncurl -i -X POST \\\n -H \"Content-Type:application/json\" \\\n -H \"X-App-Id:c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token:3266b9f8-e246-4f79-bdf0-833929b1380c\" \\\n -d '{\n \"order\": {\n \"amount\": 2500\n },\n \"gift\": {\n \"credits\": 1500\n }\n }' \\ \n 'https://api.voucherify.io/v1/vouchers/aDm4CRR3/redemption'\n```\n## Loyalty Coins - redeem loyalty card and pay with points\n\nVoucherify offers the possibility to set up a reward type in the Loyalty Program, which allows using loyalty points as gift credits. The available balance of credits is counted based on policy rules attached to the reward definition.\n\nIf a user configures just one reward type of paying in points, in the redemption request, there is no additional information required. Voucherify will automatically select as a proper reward definition and will calculate the discount based on the attached policy. \n\n\n```json title=Example Request\n{\n \"order\": {\n \"amount\": 25000,\n \"items\": [\n {\n \"product_id\": \"test_source_1\",\n \"quantity\": \"1\",\n \"price\": 15000\n },\n {\n \"product_id\": \"test_source_2\",\n \"quantity\": \"1\",\n \"price\": 10000\n }\n ]\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n }\n}\n```\n\n```json title=Example Response\n{\n \"id\": \"r_zv5Qn7cF68RbVX4foKxgwUi1\",\n \"object\": \"redemption\",\n \"date\": \"2020-05-24T13:44:20Z\",\n \"customer_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"amount\": 250,\n \"order\": {\n \"status\": \"PROCESSING\",\n \"items\": [\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_1\",\n \"quantity\": 1,\n \"amount\": 15000,\n \"price\": 15000\n },\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_2\",\n \"quantity\": 1,\n \"amount\": 10000,\n \"price\": 10000\n }\n ],\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"object\": \"customer\",\n \"referrals\": {\n \"campaigns\": [],\n \"total\": 0\n }\n },\n \"amount\": 25000,\n \"object\": \"order\",\n \"id\": \"ord_Tgi2ApelDyl86sm5AYDKCBMZ\",\n \"created_at\": \"2020-05-24T13:44:20Z\",\n \"discount_amount\": 25000\n },\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"reward\": {\n \"assignment_id\": \"rewa_pHilLjHWOD7oNjJZnog3VoEi\",\n \"loyalty_tier_id\": \"ltr_3q5dW6GaRC4QkA1oYmfGy1k1\",\n \"id\": \"rew_3qmzGPWJ7LfLXnPAjmbPacIl\",\n \"name\": \"1 point - 25 cents\",\n \"created_at\": \"2020-05-22T18:39:52Z\",\n \"updated_at\": \"2020-05-23T08:18:55Z\",\n \"parameters\": {\n \"automation_id\": null,\n \"coin\": {\n \"exchange_ratio\": 0.25\n }\n },\n \"type\": \"COIN\",\n \"object\": \"reward\"\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n },\n \"result\": \"SUCCESS\",\n \"tracking_id\": \"track_IWQYtuUE7phYpPzTHD5uwbyvlrO4nqyzipbQQtsHrRw=\",\n \"voucher\": {\n \"id\": \"v_wjgLC2lrQy1urPOdd35JX0RtkcOcQOmb\",\n \"code\": \"Dm1x8MuX\",\n \"campaign\": \"TestLoyalty-GivePoints\",\n \"campaign_id\": \"camp_qVVaC4vpVlof03eBi8qb5gE7\",\n \"category\": null,\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 489,\n \"balance\": 23\n },\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/Dm1x8MuX/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_quantity\": 8,\n \"url\": \"/v1/vouchers/Dm1x8MuX/redemptions?page=1&limit=10\",\n \"redeemed_points\": 466\n },\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX1+9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19NfR0ANlhLM7Df9Ec+xqTh6aTbHakk/Gzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF/BSQTyJx0YSK+HIUG9RGD+9rVhiC7+4WkSKrgAZ+NeqQBIqcespt8WWygXjfkvbyXBSF7Lg==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19NfR0ANlhLM7Df9Ec%2BxqTh6aTbHakk%2FGzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF%2FBSQTyJx0YSK%2BHIUG9RGD%2B9rVhiC7%2B4WkSKrgAZ%2BNeqQBIqcespt8WWygXjfkvbyXBSF7Lg%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"holder_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"updated_at\": \"2020-05-24T13:44:20Z\",\n \"holder\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"object\": \"voucher\",\n \"validation_rules_assignments\": {\n \"data\": [],\n \"object\": \"list\",\n \"total\": 0,\n \"data_ref\": \"data\"\n }\n }\n}\n```\n\nIn case the user wants to define how much he spends in points, it is configurable by property `points` in a request body.\n\n\n```json title=Example Request\n{\n \"reward\": {\n \"points\": 10\n },\n \"order\": {\n \"amount\": 25000,\n \"items\": [\n {\n \"product_id\": \"test_source_1\",\n \"quantity\": \"1\",\n \"price\": 15000\n },\n {\n \"product_id\": \"test_source_2\",\n \"quantity\": \"1\",\n \"price\": 10000\n }\n ]\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n }\n}\n```\n\n```json title=Example Response\n{\n \"id\": \"r_NJIfNYD8uc2lNm3YBAqXr3FF\",\n \"object\": \"redemption\",\n \"date\": \"2020-05-24T16:28:29Z\",\n \"customer_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"amount\": 10,\n \"order\": {\n \"status\": \"PROCESSING\",\n \"items\": [\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_1\",\n \"quantity\": 1,\n \"amount\": 15000,\n \"price\": 15000\n },\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_2\",\n \"quantity\": 1,\n \"amount\": 10000,\n \"price\": 10000\n }\n ],\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"object\": \"customer\",\n \"referrals\": {\n \"campaigns\": [],\n \"total\": 0\n }\n },\n \"amount\": 25000,\n \"object\": \"order\",\n \"id\": \"ord_70kKdXIKCSx5cfglKSpz9aHy\",\n \"created_at\": \"2020-05-24T16:28:29Z\",\n \"discount_amount\": 250\n },\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"reward\": {\n \"assignment_id\": \"rewa_pHilLjHWOD7oNjJZnog3VoEi\",\n \"loyalty_tier_id\": null,\n \"id\": \"rew_3qmzGPWJ7LfLXnPAjmbPacIl\",\n \"name\": \"1 point - 25 cents\",\n \"created_at\": \"2020-05-22T18:39:52Z\",\n \"updated_at\": \"2020-05-24T13:44:26Z\",\n \"parameters\": {\n \"automation_id\": null,\n \"coin\": {\n \"exchange_ratio\": 0.25\n }\n },\n \"type\": \"COIN\",\n \"object\": \"reward\"\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n },\n \"result\": \"SUCCESS\",\n \"tracking_id\": \"track_IWQYtuUE7phYpPzTHD5uwbyvlrO4nqyzipbQQtsHrRw=\",\n \"voucher\": {\n \"id\": \"v_wjgLC2lrQy1urPOdd35JX0RtkcOcQOmb\",\n \"code\": \"Dm1x8MuX\",\n \"campaign\": \"TestLoyalty-GivePoints\",\n \"campaign_id\": \"camp_qVVaC4vpVlof03eBi8qb5gE7\",\n \"category\": null,\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 539,\n \"balance\": 63\n },\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/Dm1x8MuX/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_quantity\": 9,\n \"url\": \"/v1/vouchers/Dm1x8MuX/redemptions?page=1&limit=10\",\n \"redeemed_points\": 476\n },\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX1+9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19NfR0ANlhLM7Df9Ec+xqTh6aTbHakk/Gzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF/BSQTyJx0YSK+HIUG9RGD+9rVhiC7+4WkSKrgAZ+NeqQBIqcespt8WWygXjfkvbyXBSF7Lg==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19NfR0ANlhLM7Df9Ec%2BxqTh6aTbHakk%2FGzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF%2FBSQTyJx0YSK%2BHIUG9RGD%2B9rVhiC7%2B4WkSKrgAZ%2BNeqQBIqcespt8WWygXjfkvbyXBSF7Lg%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"holder_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"updated_at\": \"2020-05-24T16:28:29Z\",\n \"holder\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"object\": \"voucher\",\n \"validation_rules_assignments\": {\n \"data\": [],\n \"object\": \"list\",\n \"total\": 0,\n \"data_ref\": \"data\"\n }\n }\n}\n```\n\nMoreover, it is possible to define many levels of reward in which collected points can be used as gift credits. Per each tier, we can implement different conversion factors. Having many options in the rewards catalog, we will need to select a coins calculation policy (reward ID) that we want to use for calculating a final discount in the redemption request.\n\n\n\n```json title=Example Request\n{\n \"reward\": {\n \"points\": 30,\n \"id\": \"rew_noP2S5H8PEBFT97mennSA531\"\n },\n \"order\": {\n \"amount\": 25000,\n \"items\": [\n {\n \"product_id\": \"test_source_1\",\n \"quantity\": \"1\",\n \"price\": 15000\n },\n {\n \"product_id\": \"test_source_2\",\n \"quantity\": \"1\",\n \"price\": 10000\n }\n ]\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n }\n}\n```\n\n```json title=Example Response\n{\n \"id\": \"r_se17sLon6YX5wMhYVzfQa2dc\",\n \"object\": \"redemption\",\n \"date\": \"2020-05-24T13:41:16Z\",\n \"customer_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"amount\": 10,\n \"order\": {\n \"status\": \"PROCESSING\",\n \"items\": [\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_1\",\n \"quantity\": 1,\n \"amount\": 15000,\n \"price\": 15000\n },\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_2\",\n \"quantity\": 1,\n \"amount\": 10000,\n \"price\": 10000\n }\n ],\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"object\": \"customer\",\n \"referrals\": {\n \"campaigns\": [],\n \"total\": 0\n }\n },\n \"amount\": 25000,\n \"object\": \"order\",\n \"id\": \"ord_EfMmve84JzQIg2MCM3cAvLgF\",\n \"created_at\": \"2020-05-24T13:41:16Z\",\n \"discount_amount\": 25000\n },\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"reward\": {\n \"assignment_id\": \"rewa_g3QQwQfhJrjBYzEa1NJkub7N\",\n \"loyalty_tier_id\": null,\n \"id\": \"rew_noP2S5H8PEBFT97mennSA531\",\n \"name\": \"1 point 25$\",\n \"created_at\": \"2020-05-24T12:57:19Z\",\n \"parameters\": {\n \"automation_id\": null,\n \"coin\": {\n \"exchange_ratio\": 25.0\n }\n },\n \"type\": \"COIN\",\n \"object\": \"reward\"\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n },\n \"result\": \"SUCCESS\",\n \"tracking_id\": \"track_IWQYtuUE7phYpPzTHD5uwbyvlrO4nqyzipbQQtsHrRw=\",\n \"voucher\": {\n \"id\": \"v_wjgLC2lrQy1urPOdd35JX0RtkcOcQOmb\",\n \"code\": \"Dm1x8MuX\",\n \"campaign\": \"TestLoyalty-GivePoints\",\n \"campaign_id\": \"camp_qVVaC4vpVlof03eBi8qb5gE7\",\n \"category\": null,\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 439,\n \"balance\": 223\n },\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/Dm1x8MuX/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_quantity\": 7,\n \"url\": \"/v1/vouchers/Dm1x8MuX/redemptions?page=1&limit=10\",\n \"redeemed_points\": 216\n },\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX1+9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19NfR0ANlhLM7Df9Ec+xqTh6aTbHakk/Gzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF/BSQTyJx0YSK+HIUG9RGD+9rVhiC7+4WkSKrgAZ+NeqQBIqcespt8WWygXjfkvbyXBSF7Lg==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19NfR0ANlhLM7Df9Ec%2BxqTh6aTbHakk%2FGzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF%2FBSQTyJx0YSK%2BHIUG9RGD%2B9rVhiC7%2B4WkSKrgAZ%2BNeqQBIqcespt8WWygXjfkvbyXBSF7Lg%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"holder_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"updated_at\": \"2020-05-24T13:41:16Z\",\n \"holder\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"object\": \"voucher\",\n \"validation_rules_assignments\": {\n \"data\": [],\n \"object\": \"list\",\n \"total\": 0,\n \"data_ref\": \"data\"\n }\n }\n}\n```", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "tracking_id", - "description": "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 returnee by [voucher validation](ref:validate-voucher), or a string identifying customer, with the options described below. **Although not all information is required, the extra info helps prevent fraud.**" - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Provide the redemption context in the request body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/7_req_redeem_voucher" - } - } - } - }, - "responses": { - "200": { - "description": "Returns a redemption object if the redeem operation succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/7_res_redeem_voucher" - }, - "examples": { - "Gift Voucher": { - "value": { - "id": "r_0c5e8a38730ccec0d5", - "object": "redemption", - "date": "2023-01-27T12:34:57.100Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 2000, - "result": "SUCCESS", - "order": { - "id": "ord_S4BvUj64TlGqVZDOeud7z3rU", - "source_id": null, - "created_at": "2023-01-27T12:34:57.086Z", - "updated_at": null, - "status": "PAID", - "amount": 6000, - "discount_amount": 2000, - "total_discount_amount": 2000, - "total_amount": 4000, - "applied_discount_amount": 2000, - "total_applied_discount_amount": 2000, - "items": [ + }, + "/v1/vouchers/bulk/async": { + "post": { + "operationId": "update-vouchers-in-bulk", + "tags": [ + "VOUCHERS API" + ], + "summary": "Update Vouchers in bulk", + "description": "Use this endpoint to update specific metadata parameters for each code, respectively. You can update each code's metadata property separately. \n\n- Update up to **100 records** in one request.\n- Upserts are not supported. \n\n> 🚧 \n> \n> Currently only **metadata** updates are supported.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "required": true, + "description": "List of objects, each containing a code that is being updated and the metadata key/value pairs for that code.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_req_vouchers_bulk_async" + }, + "examples": { + "Example": { + "value": [ { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 3300, - "price": 3000, - "subtotal_amount": 3300 + "code": "example_code", + "metadata": { + "lang": "en", + "test": false, + "MetadataTest": "Update metadata", + "update_value": 1, + "next_update_date": "2022-11-11T09:00:00.000Z" + } }, { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 2, - "amount": 3400, - "price": 3000, - "subtotal_amount": 3400 - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5e8a38730ccec0d5": { - "date": "2023-01-27T12:34:57.100Z", - "related_object_type": "voucher", - "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", - "related_object_parent_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6" + "code": "example_code2", + "metadata": { + "lang": "pl", + "test": false, + "MetadataTest": "Update metadata", + "update_value": 2 + } } - } + ] + } + } + } + } + }, + "responses": { + "202": { + "description": "Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the voucher(s) will be updated in the repository asynchronously. To check the status and result, copy the `async_action_id` from the response and pass it using [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", - "voucher": { - "id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", - "code": "CODE14", - "campaign": "Gift Card Campaign", - "campaign_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6", - "category": "Second", - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [], - "type": "GIFT_VOUCHER", - "discount": null, - "gift": { - "amount": 2000, - "balance": 0, - "effect": null - }, - "loyalty_card": null, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": "secret-code1", - "metadata": { - "region": "APAC", - "season": "Fall" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+VibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BVibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/GVIi0p5fL5hxAY/ZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd//S4R9AB+60T/x4kSKu3lgfa9KgJmbyrzXm7Ggly06/qph4/asJaZVZIXEba4WJCeHqXCEgg==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FGVIi0p5fL5hxAY%2FZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd%2F%2FS4R9AB%2B60T%2Fx4kSKu3lgfa9KgJmbyrzXm7Ggly06%2Fqph4%2FasJaZVZIXEba4WJCeHqXCEgg%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-23T11:05:42.164Z", - "updated_at": "2023-01-27T12:34:57.102Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": 18, - "redeemed_quantity": 1, - "redeemed_amount": 2000, - "object": "list", - "url": "/v1/vouchers/CODE14/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/CODE14/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" + "examples": { + "Example": { + "$ref": "#/components/examples/res_async_actions" } - }, - "gift": { - "amount": 2000 } } - }, - "Discount Coupon": { - "value": { - "id": "r_0c5e8ef10842da0aad", - "object": "redemption", - "date": "2023-01-27T12:55:34.689Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "result": "SUCCESS", - "order": { - "id": "ord_J5ogV1Gkk2yfxmBEhYIg4O65", - "source_id": null, - "created_at": "2023-01-27T12:55:34.673Z", - "updated_at": null, - "status": "PAID", - "amount": 6000, - "items_discount_amount": 300, - "total_discount_amount": 300, - "total_amount": 5700, - "items_applied_discount_amount": 300, - "total_applied_discount_amount": 300, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 3300, - "discount_amount": 148, - "applied_discount_amount": 148, - "price": 3000, - "subtotal_amount": 3152 - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 2, - "amount": 3400, - "discount_amount": 152, - "applied_discount_amount": 152, - "price": 3000, - "subtotal_amount": 3248 - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5e8ef10842da0aad": { - "date": "2023-01-27T12:55:34.689Z", - "related_object_type": "voucher", - "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u" + } + } + } + } + }, + "/v1/vouchers/metadata/async": { + "post": { + "operationId": "update-vouchers-metadata-in-bulk", + "tags": [ + "VOUCHERS API" + ], + "summary": "Update Vouchers' metadata in bulk", + "description": "Use this endpoint to update the same metadata parameters for a list of codes. \nUpdate up to **100 records** in one request. Upserts are not supported. \n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "required": true, + "description": "Request to update vouchers metadata in bulk. Provide an array of voucher codes in the `codes` parameter along with the `metadata` object. The `metadata` object should contain the key value pairs that you would like to update for all the vouchers included in the `codes` parameter.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_req_vouchers_metadata_async" + }, + "examples": { + "Example": { + "value": { + "codes": [ + "PROMO-CODE810", + "PROMO-CODE726" + ], + "metadata": { + "lang": "en", + "authorized_internally": true } } + } + } + } + } + }, + "responses": { + "202": { + "description": "Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the voucher(s) will be updated in the repository asynchronously. To check the status and result, copy the `async_action_id` from the response and pass it using [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "voucher": { - "id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "code": "2CpRCE2c", - "campaign": null, - "campaign_id": null, - "category": null, - "category_id": null, - "categories": [], - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 300, - "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" - }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1+ro/6HLsfI9E/rz0QEoYv+rcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz+WQtg4nKpjUS0wcA7AuIbz2zb870YfJO/r5UBS5gCqQ==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bro%2F6HLsfI9E%2Frz0QEoYv%2BrcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz%2BWQtg4nKpjUS0wcA7AuIbz2zb870YfJO%2Fr5UBS5gCqQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3/4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ+aTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3%2F4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ%2BaTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-19T10:06:07.932Z", - "updated_at": "2023-01-27T12:55:34.690Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_HesdqEzt5e9c0T56", - "rule_id": "val_gZft0NKZSUWK", - "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "related_object_type": "voucher", - "object": "validation_rules_assignment" - } - ], - "total": 1 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 2, - "object": "list", - "url": "/v1/vouchers/2CpRCE2c/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/2CpRCE2c/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [ - { - "object": "product", - "id": "prod_0a9f9ab4ab019a42d5", - "source_id": "prod_0a9f9ab4ab019a42d5", - "strict": true, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0a9f9aeddb019a42db", - "source_id": "prod_0a9f9aeddb019a42db", - "strict": true, - "effect": "APPLY_TO_EVERY" - } - ], - "total": 2, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" + "examples": { + "Example": { + "$ref": "#/components/examples/res_async_actions" } } } - }, - "Loyalty Card": { - "value": { - "id": "r_0c5e8f2cd78497a372", - "object": "redemption", - "date": "2023-01-27T12:56:35.934Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 300, - "result": "SUCCESS", - "order": { - "id": "ord_MGTimoN4VtSj7iT75bP01FsH", - "source_id": null, - "created_at": "2023-01-27T12:56:35.923Z", - "updated_at": null, - "status": "PAID", - "amount": 6000, - "discount_amount": 6000, - "total_discount_amount": 6000, - "total_amount": 0, - "applied_discount_amount": 6000, - "total_applied_discount_amount": 6000, - "items": [ + } + }, + "400": { + "description": "Returns an error indicating the reason for an unsuccessfull operation.", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/e_400_invalid_payload" + }, { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 3300, - "price": 3000, - "subtotal_amount": 3300 + "$ref": "#/components/schemas/e_400_not_enough_codes" }, { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 2, - "amount": 3400, - "price": 3000, - "subtotal_amount": 3400 + "$ref": "#/components/schemas/e_400_metadata_validation_failed" } ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5e8f2cd78497a372": { - "date": "2023-01-27T12:56:35.934Z", - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" - } + "discriminator": { + "propertyName": "key" } }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 6500, - "balance": 5086 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" + "examples": { + "Not enough codes": { + "value": { + "code": 400, + "key": "not_enough_codes", + "message": "Not enough codes", + "details": "Specify at least 1 code in codes.", + "request_id": "v-0c4b067a8f161e120f" } - }, - "is_referral_code": false, - "created_at": "2022-11-10T06:28:59.970Z", - "updated_at": "2023-01-27T12:56:35.935Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "holder": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 10, - "redeemed_points": 1414, - "object": "list", - "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" } - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", - "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "object": "reward", - "name": "100 = $20", - "created_at": "2022-11-10T06:28:39.582Z", - "updated_at": null, - "parameters": { - "coin": { - "exchange_ratio": 20, - "points_ratio": 100 - } - }, - "type": "COIN" - }, - "loyalty_card": { - "points": 300 } } } @@ -63141,1855 +49056,2047 @@ } } }, - "400": { - "description": "Returns an error if something goes wrong. A common source of error is an invalid or expired voucher, or a valid gift voucher with insufficient available balance.", - "content": { - "application/json": { + "/v1/vouchers/{code}/sessions/{sessionKey}": { + "parameters": [ + { + "name": "code", + "in": "path", "schema": { - "$ref": "#/components/schemas/e_error_expanded" - }, - "examples": { - "Voucher disabled": { - "value": { - "code": 400, - "key": "voucher_disabled", - "message": "voucher is disabled", - "details": "AnsvocvP", - "request_id": "v-0c5d710a63c4110ae9", - "resource_id": "rf_0c5d710a87c8a31f86", - "resource_type": "redemption", - "error": { - "message": "The voucher has been disabled and cannot be used." - } - } - }, - "Invalid Customer": { - "value": { - "code": 400, - "key": "invalid_customer", - "message": "Customer must be a holder of a loyalty card.", - "details": "AnsvocvP", - "request_id": "v-0c5e628bd14411244b", - "resource_id": "rf_0c5e628bf841c7f248", - "resource_type": "redemption", - "error": { - "message": "The customer is invalid." - } - } - }, - "Voucher Inactive": { - "value": { - "code": 400, - "key": "voucher_not_active_now", - "message": "voucher not active now", - "details": "CODE14", - "request_id": "v-0c5e89b9300d820994", - "resource_id": "rf_0c5e89b945d33b9c02", - "resource_type": "redemption", - "error": { - "message": "The voucher is not active in the given timeframe." + "type": "string", + "example": "7fjWdr" + }, + "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify.", + "required": true + }, + { + "schema": { + "type": "string", + "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" + }, + "name": "sessionKey", + "in": "path", + "required": true, + "description": "A unique session identifier." + } + ], + "delete": { + "operationId": "release-validation-session", + "tags": [ + "VOUCHERS API" + ], + "summary": "Release Validation Session", + "description": "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](doc:locking-validation-session). \n\n> 📘 Release Session using Dashboard\n>\n> You can also use the Validations Manager in the Dashboard to unlock sessions. [Read more](https://support.voucherify.io/article/16-dashboard-sections#validations).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if the validation session was released successfully." + } + } + } + }, + "/v1/campaign-object": { + "get": { + "operationId": "campaign-object", + "tags": [ + "CAMPAIGNS API" + ], + "summary": "Campaign Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Campaign Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_obj_campaign_object" } } } } } } - } - } - } - }, - "/client/v1/redeem": { - "post": { - "operationId": "redeem-voucher-client-side", - "deprecated": true, - "tags": [ - "REDEMPTIONS API" - ], - "summary": "Redeem Voucher (client-side) [Deprecated]", - "description": "\n> ❗️ Deprecated \n>\n> 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](ref:redeem-stacked-discounts-client-side) 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. \n\nTo 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). \n\nThe client-side redemption works similar to the server-side [voucher redemption](ref:redeem-voucher) endpoint. The difference lies in the authorization. For the client-side, you can use client-side keys.\n\n\n> 📘 Opt-in \n>\n> By default this feature is disabled. If you want to use it, you will need to enable the function explicitly in **Project Settings**.\n\n\n> ❗️ Security Threat \n>\n> 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.\n\n### Expand Response\nYou may expand the response by adding the following object to your request body. The expanded response will include the category details of the voucher.\n\n```json\n{\n \"options\": {\n \"expand\": [\n \"category\"\n ]\n }\n}\n```", - "parameters": [ - { - "$ref": "#/components/parameters/origin" - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "code", - "description": "Voucher code being redeemed.", - "required": true }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "tracking_id", - "description": "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](ref:validate-voucher), or a string identifying customer, with the options described below. Although not all information is required, the extra info helps prevent fraud." - } - ], - "security": [ - { - "X-Client-Application-Id-1": [], - "X-Client-Token-1": [] - } - ], - "requestBody": { - "description": "Provide the redemption context in the request body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/7_req_redeem_voucher" - } - } - } - }, - "responses": { - "200": { - "description": "Returns a redemption object if the redeem operation succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/7_res_redeem_voucher" - }, - "examples": { - "Gift Voucher": { - "value": { - "id": "r_0c5e8a38730ccec0d5", - "object": "redemption", - "date": "2023-01-27T12:34:57.100Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 2000, - "result": "SUCCESS", - "order": { - "id": "ord_S4BvUj64TlGqVZDOeud7z3rU", - "source_id": null, - "created_at": "2023-01-27T12:34:57.086Z", - "updated_at": null, - "status": "PAID", - "amount": 6000, - "discount_amount": 2000, - "total_discount_amount": 2000, - "total_amount": 4000, - "applied_discount_amount": 2000, - "total_applied_discount_amount": 2000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 3300, - "price": 3000, - "subtotal_amount": 3300 + "/v1/campaigns": { + "post": { + "operationId": "create-campaign", + "tags": [ + "CAMPAIGNS API", + "PROMOTIONS API" + ], + "summary": "Create Campaign", + "description": "Method to create a batch of vouchers aggregated in one campaign. You can choose a variety of voucher types and define a unique pattern for generating codes. \n\n\n> 📘 Global uniqueness\n>\n> All campaign codes are unique across the whole project. Voucherify will not allow you to generate 2 campaigns with the same coupon code. \n\n> 🚧 Code generation status\n>\n> This is an asynchronous action; you can't read or modify a newly created campaign until the code generation is completed. See the `creation_status` field in the [campaign object](ref:get-campaign) description.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the details of the campaign that you would like to create.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_req_create_campaign" + }, + "examples": { + "Discount Campaign": { + "value": { + "name": "Discount Campaign 4", + "campaign_type": "DISCOUNT_COUPONS", + "join_once": true, + "type": "AUTO_UPDATE", + "category_id": "cat_0bb343dee3cdb5ec0c", + "start_date": "2020-08-16T00:00:00Z", + "expiration_date": "2023-12-26T00:00:00Z", + "vouchers_count": 3, + "voucher": { + "type": "DISCOUNT_VOUCHER", + "discount": { + "percent_off": 10, + "type": "PERCENT" + }, + "redemption": { + "quantity": 10 + }, + "code_config": { + "pattern": "10OFF-#######" + } }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 2, - "amount": 3400, - "price": 3000, - "subtotal_amount": 3400 + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "activity_duration_after_publishing": "P24D", + "use_voucher_metadata_schema": false, + "metadata": { + "region": "AMER" } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5e8a38730ccec0d5": { - "date": "2023-01-27T12:34:57.100Z", - "related_object_type": "voucher", - "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", - "related_object_parent_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6" + } + }, + "Gift Card Campaign": { + "value": { + "name": "Gift Card Campaign", + "campaign_type": "GIFT_VOUCHERS", + "join_once": true, + "type": "AUTO_UPDATE", + "category_id": "cat_0bb343dee3cdb5ec0c", + "start_date": "2020-08-16T00:00:00Z", + "expiration_date": "2023-12-26T00:00:00Z", + "vouchers_count": 2, + "voucher": { + "type": "GIFT_VOUCHER", + "gift": { + "amount": 1000, + "effect": "APPLY_TO_ORDER" + }, + "redemption": { + "quantity": 10 + }, + "code_config": { + "pattern": "GIFT-CARD-#######" + } + }, + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "activity_duration_after_publishing": "P24D", + "use_voucher_metadata_schema": false, + "metadata": { + "region": "APAC" + } + } + }, + "Loyalty Program": { + "value": { + "name": "Loyalty Campaign", + "campaign_type": "LOYALTY_PROGRAM", + "auto_join": true, + "join_once": true, + "type": "AUTO_UPDATE", + "category_id": "cat_0bb343dee3cdb5ec0c", + "start_date": "2020-08-16T00:00:00Z", + "expiration_date": "2023-12-26T00:00:00Z", + "vouchers_count": 2, + "voucher": { + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 1000, + "expiration_rules": { + "period_type": "MONTH", + "period_value": 3, + "rounding_type": "END_OF_YEAR" + } + }, + "redemption": { + "quantity": 10 + }, + "code_config": { + "pattern": "LOYALTY-CARD-#######" + } + }, + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "activity_duration_after_publishing": "P24D", + "use_voucher_metadata_schema": false, + "metadata": { + "region": "APAC" + } + } + }, + "Promotion": { + "value": { + "name": "Promotion - API - 4", + "campaign_type": "PROMOTION", + "type": "STATIC", + "category_id": "cat_0bb343dee3cdb5ec0c", + "use_voucher_metadata_schema": false, + "start_date": "2020-08-16T00:00:00Z", + "expiration_date": "2023-12-26T00:00:00Z", + "active": false, + "promotion": { + "tiers": [ + { + "name": "Percent Discount", + "banner": "Get 40% off", + "action": { + "discount": { + "type": "PERCENT", + "percent_off": 40, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": { + "level": "B" + }, + "active": false, + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4 + ], + "validation_rules": [ + "val_q8qUBMOh5qIQ" + ] + }, + { + "name": "Order more than $100", + "banner": "Get $30 off", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 3000, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": { + "level": "A" + }, + "active": false, + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4 + ], + "validation_rules": [ + "val_q8qUBMOh5qIQ" + ] + } + ] + }, + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "activity_duration_after_publishing": "P24D", + "metadata": { + "region": "APAC" } } }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", - "voucher": { - "id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", - "code": "CODE14", - "campaign": "Gift Card Campaign", - "campaign_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6", - "category": "Second", - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [], - "type": "GIFT_VOUCHER", - "discount": null, - "gift": { - "amount": 2000, - "balance": 0, - "effect": null - }, - "loyalty_card": null, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": "secret-code1", - "metadata": { - "region": "APAC", - "season": "Fall" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+VibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BVibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ%3D%3D" + "Referral Program": { + "value": { + "name": "Referral Campaign 2", + "campaign_type": "REFERRAL_PROGRAM", + "join_once": true, + "type": "AUTO_UPDATE", + "category_id": "cat_0bb343dee3cdb5ec0c", + "start_date": "2020-08-16T00:00:00Z", + "expiration_date": "2023-12-26T00:00:00Z", + "vouchers_count": 2, + "referral_program": { + "conversion_event_type": "redemption" + }, + "voucher": { + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "percent_off": 45, + "effect": "APPLY_TO_ORDER", + "amount_limit": 15 + }, + "redemption": { + "quantity": 10 + }, + "code_config": { + "pattern": "REFERRAL-CODE-#######" + }, + "is_referral_code": true + }, + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" }, - "barcode": { - "id": "U2FsdGVkX1/GVIi0p5fL5hxAY/ZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd//S4R9AB+60T/x4kSKu3lgfa9KgJmbyrzXm7Ggly06/qph4/asJaZVZIXEba4WJCeHqXCEgg==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FGVIi0p5fL5hxAY%2FZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd%2F%2FS4R9AB%2B60T%2Fx4kSKu3lgfa9KgJmbyrzXm7Ggly06%2Fqph4%2FasJaZVZIXEba4WJCeHqXCEgg%3D%3D" + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "activity_duration_after_publishing": "P24D", + "use_voucher_metadata_schema": false, + "metadata": { + "region": "APAC" } - }, - "is_referral_code": false, - "created_at": "2022-09-23T11:05:42.164Z", - "updated_at": "2023-01-27T12:34:57.102Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": 18, - "redeemed_quantity": 1, - "redeemed_amount": 2000, - "object": "list", - "url": "/v1/vouchers/CODE14/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/CODE14/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" } - }, - "gift": { - "amount": 2000 } } - }, - "Discount Coupon": { - "value": { - "id": "r_0c5e8ef10842da0aad", - "object": "redemption", - "date": "2023-01-27T12:55:34.689Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "result": "SUCCESS", - "order": { - "id": "ord_J5ogV1Gkk2yfxmBEhYIg4O65", - "source_id": null, - "created_at": "2023-01-27T12:55:34.673Z", - "updated_at": null, - "status": "PAID", - "amount": 6000, - "items_discount_amount": 300, - "total_discount_amount": 300, - "total_amount": 5700, - "items_applied_discount_amount": 300, - "total_applied_discount_amount": 300, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 3300, - "discount_amount": 148, - "applied_discount_amount": 148, - "price": 3000, - "subtotal_amount": 3152 - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 2, - "amount": 3400, - "discount_amount": 152, - "applied_discount_amount": 152, - "price": 3000, - "subtotal_amount": 3248 - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5e8ef10842da0aad": { - "date": "2023-01-27T12:55:34.689Z", - "related_object_type": "voucher", - "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u" - } - } + } + } + }, + "responses": { + "200": { + "description": "Returns a campaign object if the call succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_obj_campaign_object" }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "voucher": { - "id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "code": "2CpRCE2c", - "campaign": null, - "campaign_id": null, - "category": null, - "category_id": null, - "categories": [], - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 300, - "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" - }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1+ro/6HLsfI9E/rz0QEoYv+rcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz+WQtg4nKpjUS0wcA7AuIbz2zb870YfJO/r5UBS5gCqQ==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bro%2F6HLsfI9E%2Frz0QEoYv%2BrcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz%2BWQtg4nKpjUS0wcA7AuIbz2zb870YfJO%2Fr5UBS5gCqQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3/4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ+aTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3%2F4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ%2BaTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw%3D%3D" + "examples": { + "Discount Campaign": { + "value": { + "id": "camp_NdBCAQk1AAZcMcv6kt6X164Q", + "name": "Discount Campaign 4", + "campaign_type": "DISCOUNT_COUPONS", + "type": "AUTO_UPDATE", + "voucher": { + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "percent_off": 10 + }, + "redemption": { + "quantity": 10 + }, + "code_config": { + "length": 7, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "10OFF-#######" + }, + "is_referral_code": false, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + } + }, + "auto_join": false, + "join_once": true, + "use_voucher_metadata_schema": false, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "activity_duration_after_publishing": "P24D", + "vouchers_count": 0, + "active": true, + "metadata": { + "region": "AMER" + }, + "created_at": "2022-09-21T09:25:49.617Z", + "category": "First", + "creation_status": "IN_PROGRESS", + "vouchers_generation_status": "IN_PROGRESS", + "protected": false, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" + } + ], + "object": "campaign" } }, - "is_referral_code": false, - "created_at": "2022-09-19T10:06:07.932Z", - "updated_at": "2023-01-27T12:55:34.690Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_HesdqEzt5e9c0T56", - "rule_id": "val_gZft0NKZSUWK", - "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "related_object_type": "voucher", - "object": "validation_rules_assignment" - } - ], - "total": 1 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 2, - "object": "list", - "url": "/v1/vouchers/2CpRCE2c/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/2CpRCE2c/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [ - { - "object": "product", - "id": "prod_0a9f9ab4ab019a42d5", - "source_id": "prod_0a9f9ab4ab019a42d5", - "strict": true, - "effect": "APPLY_TO_EVERY" + "Gift Card Campaign": { + "value": { + "id": "camp_B2Gx83JsSbmvj05MOwxYbNm6", + "name": "Gift Card Campaign", + "campaign_type": "GIFT_VOUCHERS", + "type": "AUTO_UPDATE", + "voucher": { + "type": "GIFT_VOUCHER", + "gift": { + "amount": 1000, + "effect": "APPLY_TO_ORDER" + }, + "redemption": { + "quantity": 10 + }, + "code_config": { + "length": 7, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "GIFT-CARD-#######" + }, + "is_referral_code": false, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + } }, - { - "object": "product", - "id": "prod_0a9f9aeddb019a42db", - "source_id": "prod_0a9f9aeddb019a42db", - "strict": true, - "effect": "APPLY_TO_EVERY" - } - ], - "total": 2, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - } - } - } - }, - "Loyalty Card": { - "value": { - "id": "r_0c5e8f2cd78497a372", - "object": "redemption", - "date": "2023-01-27T12:56:35.934Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 300, - "result": "SUCCESS", - "order": { - "id": "ord_MGTimoN4VtSj7iT75bP01FsH", - "source_id": null, - "created_at": "2023-01-27T12:56:35.923Z", - "updated_at": null, - "status": "PAID", - "amount": 6000, - "discount_amount": 6000, - "total_discount_amount": 6000, - "total_amount": 0, - "applied_discount_amount": 6000, - "total_applied_discount_amount": 6000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 3300, - "price": 3000, - "subtotal_amount": 3300 - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 2, - "amount": 3400, - "price": 3000, - "subtotal_amount": 3400 + "auto_join": false, + "join_once": true, + "use_voucher_metadata_schema": false, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "activity_duration_after_publishing": "P24D", + "vouchers_count": 0, + "active": true, + "metadata": { + "region": "APAC" + }, + "created_at": "2022-09-21T09:31:16.266Z", + "category": "First", + "creation_status": "IN_PROGRESS", + "vouchers_generation_status": "IN_PROGRESS", + "protected": false, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" + } + ], + "object": "campaign" } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5e8f2cd78497a372": { - "date": "2023-01-27T12:56:35.934Z", - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + "Loyalty Program": { + "value": { + "id": "camp_FZL4iTTdZw36nZOoXYQ172fQ", + "name": "Loyalty Campaign", + "campaign_type": "LOYALTY_PROGRAM", + "type": "AUTO_UPDATE", + "voucher": { + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 1000, + "expiration_rules": { + "period_type": "MONTH", + "period_value": 3, + "rounding_type": "END_OF_YEAR" + } + }, + "redemption": { + "quantity": 10 + }, + "code_config": { + "length": 7, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "LOYALTY-CARD-#######" + }, + "is_referral_code": false, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + } + }, + "auto_join": true, + "join_once": true, + "use_voucher_metadata_schema": false, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "activity_duration_after_publishing": "P24D", + "vouchers_count": 0, + "active": true, + "metadata": { + "region": "APAC" + }, + "created_at": "2022-09-21T09:39:45.479Z", + "category": "First", + "creation_status": "IN_PROGRESS", + "vouchers_generation_status": "IN_PROGRESS", + "protected": false, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" + } + ], + "object": "campaign" } - } - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 6500, - "balance": 5086 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" + "Promotion": { + "value": { + "id": "camp_ru1B8mQjY75KxXupt7RPZcb8", + "name": "Promotion - API - 4", + "campaign_type": "PROMOTION", + "type": "STATIC", + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": false, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "activity_duration_after_publishing": "P24D", + "active": true, + "metadata": { + "region": "APAC" + }, + "created_at": "2022-09-23T08:54:38.281Z", + "category": "First", + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "promotion": { + "object": "list", + "data_ref": "tiers", + "tiers": [ + { + "id": "promo_M4OfmMgSUyN12JPAw3l4hWjD", + "created_at": "2022-09-23T08:54:38.286Z", + "name": "Percent Discount", + "banner": "Get 40% off", + "action": { + "discount": { + "type": "PERCENT", + "percent_off": 40, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": { + "level": "B" + }, + "hierarchy": 1, + "promotion_id": "camp_ru1B8mQjY75KxXupt7RPZcb8", + "campaign": { + "id": "camp_ru1B8mQjY75KxXupt7RPZcb8", + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "active": true, + "category_id": "cat_0bb343dee3cdb5ec0c", + "object": "campaign" + }, + "campaign_id": "camp_ru1B8mQjY75KxXupt7RPZcb8", + "active": false, + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4 + ], + "summary": { + "redemptions": { + "total_redeemed": 0 + }, + "orders": { + "total_amount": 0, + "total_discount_amount": 0 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_dr3oXeN98YfiTF60", + "rule_id": "val_q8qUBMOh5qIQ", + "related_object_id": "promo_M4OfmMgSUyN12JPAw3l4hWjD", + "related_object_type": "promotion_tier", + "created_at": "2022-09-23T08:54:38.286Z", + "object": "validation_rules_assignment" + } + ], + "total": 1 + } + }, + { + "id": "promo_uMSxvzhxXDp3Ijs3659npqb2", + "created_at": "2022-09-23T08:54:38.314Z", + "name": "Order more than $100", + "banner": "Get $30 off", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 3000, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": { + "level": "A" + }, + "hierarchy": 2, + "promotion_id": "camp_ru1B8mQjY75KxXupt7RPZcb8", + "campaign": { + "id": "camp_ru1B8mQjY75KxXupt7RPZcb8", + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "active": true, + "category_id": "cat_0bb343dee3cdb5ec0c", + "object": "campaign" + }, + "campaign_id": "camp_ru1B8mQjY75KxXupt7RPZcb8", + "active": false, + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4 + ], + "summary": { + "redemptions": { + "total_redeemed": 0 + }, + "orders": { + "total_amount": 0, + "total_discount_amount": 0 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_jgJlWms7GVK59iNR", + "rule_id": "val_q8qUBMOh5qIQ", + "related_object_id": "promo_uMSxvzhxXDp3Ijs3659npqb2", + "related_object_type": "promotion_tier", + "created_at": "2022-09-23T08:54:38.314Z", + "object": "validation_rules_assignment" + } + ], + "total": 1 + } + } + ], + "total": 2, + "has_more": false + }, + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" + } + ], + "object": "campaign" } }, - "is_referral_code": false, - "created_at": "2022-11-10T06:28:59.970Z", - "updated_at": "2023-01-27T12:56:35.935Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "holder": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" + "Referral Program": { + "value": { + "id": "camp_N8rztKAqOYIdFxNLr9eNIjyB", + "name": "Referral Campaign 2", + "campaign_type": "REFERRAL_PROGRAM", + "type": "AUTO_UPDATE", + "voucher": { + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "amount_limit": 15, + "percent_off": 45, + "effect": "APPLY_TO_ORDER" + }, + "redemption": { + "quantity": 10 + }, + "code_config": { + "length": 7, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "REFERRAL-CODE-#######" + }, + "is_referral_code": true, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + } + }, + "referral_program": { + "conversion_event_type": "redemption" + }, + "auto_join": false, + "join_once": true, + "use_voucher_metadata_schema": false, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 10, - "redeemed_points": 1414, - "object": "list", - "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - } - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" + "activity_duration_after_publishing": "P24D", + "vouchers_count": 0, + "active": true, + "metadata": { + "region": "APAC" + }, + "created_at": "2022-09-23T09:06:41.757Z", + "category": "First", + "creation_status": "IN_PROGRESS", + "vouchers_generation_status": "IN_PROGRESS", + "protected": false, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" + } ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", - "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "object": "reward", - "name": "100 = $20", - "created_at": "2022-11-10T06:28:39.582Z", - "updated_at": null, - "parameters": { - "coin": { - "exchange_ratio": 20, - "points_ratio": 100 + "object": "campaign" } - }, - "type": "COIN" - }, - "loyalty_card": { - "points": 300 + } } } } - } - } - } - }, - "400": { - "description": "Returns an error if something goes wrong. A common source of error is an invalid or expired voucher, or a valid gift voucher with insufficient available balance.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_expanded" - }, - "examples": { - "Voucher disabled": { - "value": { - "code": 400, - "key": "voucher_disabled", - "message": "voucher is disabled", - "details": "AnsvocvP", - "request_id": "v-0c5d710a63c4110ae9", - "resource_id": "rf_0c5d710a87c8a31f86", - "resource_type": "redemption", - "error": { - "message": "The voucher has been disabled and cannot be used." + }, + "400": { + "description": "Returns an error if an incomplete request body is provided.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Example": { + "value": { + "code": 400, + "key": "invalid_campaign", + "message": "Invalid Campaign", + "details": "Property 'discount' is required for REFERRAL_PROGRAM campaign", + "request_id": "v-0bb99c9213425fa250" + } + } } } - }, - "Invalid Customer": { - "value": { - "code": 400, - "key": "invalid_customer", - "message": "Customer must be a holder of a loyalty card.", - "details": "AnsvocvP", - "request_id": "v-0c5e628bd14411244b", - "resource_id": "rf_0c5e628bf841c7f248", - "resource_type": "redemption", - "error": { - "message": "The customer is invalid." + } + }, + "404": { + "description": "When a payload value is not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find category with id cat_0bb343dee3cdb5ec0c", + "request_id": "v-0c55671ed1cb0f1a27", + "resource_id": "cat_0bb343dee3cdb5ec0c", + "resource_type": "category" + } + } } } - }, - "Voucher Inactive": { - "value": { - "code": 400, - "key": "voucher_not_active_now", - "message": "voucher not active now", - "details": "CODE14", - "request_id": "v-0c5e89b9300d820994", - "resource_id": "rf_0c5e89b945d33b9c02", - "resource_type": "redemption", - "error": { - "message": "The voucher is not active in the given timeframe." + } + }, + "409": { + "description": "Returns an error if a campaign with the same name already exists.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_409_duplicate_found" + }, + "examples": { + "Example": { + "value": { + "code": 409, + "key": "duplicate_found", + "message": "Duplicated resource found", + "details": "Duplicated campaign exists with name Discount Campaign", + "request_id": "v-0bb98f8c6552250aab", + "resource_id": "Discount Campaign", + "resource_type": "campaign" + } + } } } } } } - } - } - } - } - }, - "/v1/redemptions/{redemptionId}/rollback": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "redemptionId", - "in": "path", - "required": true, - "description": "The original redemption ID to be rolled back (undone)." - } - ], - "post": { - "operationId": "rollback-redemption", - "tags": [ - "REDEMPTIONS API" - ], - "summary": "Rollback Redemption", - "description": "Your business logic may include a case when you need to undo a redemption. You can revert a redemption by calling this API endpoint. \n\n ## Effect \nThe operation \n- creates a rollback entry in voucher's redemption history (`redemption.redemption_entries`) and \n- gives 1 redemption back to the pool (decreases `redeemed_quantity` by 1). \n## Returned funds \nIn case of *gift card vouchers*, this method returns funds back according to the source redemption. In case of *loyalty card vouchers*, this method returns points back according to the source redemption.", - "parameters": [ - { - "schema": { - "type": "string" }, - "in": "query", - "name": "reason", - "description": "Reason for the rollback." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/7_req_rollback_redemption" - }, - "examples": { - "Promotion": { - "value": { - "customer": { - "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "name": "Annie Lemons", - "email": "annie@lemon.com", - "phone": "+1 933 222 3334", - "birthday": "1900-12-02", - "birthdate": "1900-12-01", - "address": { - "city": "New York", - "state": "NY", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 5", - "country": "United States", - "postal_code": "100012" - }, - "metadata": { - "age": 23 + "get": { + "operationId": "list-campaigns", + "tags": [ + "CAMPAIGNS API" + ], + "summary": "List Campaigns", + "description": "Retrieve a list of campaigns in a project. \n\nThe campaigns are returned sorted by creation date, with the most recent campaigns appearing first. \n\nWhen you get a list of campaigns, you can optionally specify query parameters to customize the amount of campaigns returned per call using `limit`, which page of campaigns to return using `page`, sort the campaigns using the `order` query parameter and filter the results by the `campaign_type`.\n\nThis method will return an error when trying to return a limit of more than 100 campaigns.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "$ref": "#/components/parameters/campaign_type" + }, + { + "schema": { + "type": "string", + "default": "category" + }, + "in": "query", + "name": "expand", + "description": "Include an expanded `categories` object in the response." + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + }, + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with a `campaign` property that contains an array of campaigns. The maximum number of campaigns returned is determined by the `limit` query parameter. Each entry in the array is a separate campaign object. If no more campaigns are available, the resulting array on a given page will be empty.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_res_list_campaigns" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "campaigns", + "campaigns": [ + { + "id": "camp_SibPsDRKQvg3SUtptgPZCNZb", + "name": "Voucher Metadata", + "campaign_type": "DISCOUNT_COUPONS", + "type": "AUTO_UPDATE", + "voucher": { + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "amount_limit": 4400, + "percent_off": 30, + "effect": "APPLY_TO_ORDER" + }, + "redemption": { + "quantity": null + }, + "code_config": { + "length": 9, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "#########", + "prefix": "Discount-", + "postfix": "YY" + }, + "is_referral_code": false, + "start_date": "2022-09-20T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": { + "interval": "P3D", + "duration": "P1D" + } + }, + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": false, + "start_date": "2022-09-20T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": { + "interval": "P3D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4 + ], + "activity_duration_after_publishing": "P24D", + "vouchers_count": 1, + "active": true, + "metadata": { + "region": "AMER" + }, + "created_at": "2022-09-20T09:32:29.530Z", + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "category_id": null, + "object": "campaign" + }, + { + "id": "camp_HgsbCKauXmEoPnnh8aas0ISe", + "name": "Static Campaign", + "campaign_type": "DISCOUNT_COUPONS", + "type": "STATIC", + "voucher": { + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 3000, + "effect": "APPLY_TO_ORDER" + }, + "redemption": { + "quantity": 1 + }, + "code_config": { + "length": 8, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "########" + }, + "is_referral_code": false + }, + "auto_join": false, + "join_once": true, + "use_voucher_metadata_schema": true, + "vouchers_count": 1, + "active": true, + "metadata": {}, + "created_at": "2022-09-20T07:52:34.499Z", + "updated_at": "2022-09-20T11:38:13.501Z", + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "category_id": null, + "object": "campaign" + }, + { + "id": "camp_f7fBbQxUuTN7dI7tGOo5XMDA", + "name": "Loyalty Program Fall 2022", + "campaign_type": "LOYALTY_PROGRAM", + "type": "AUTO_UPDATE", + "voucher": { + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 0, + "expiration_rules": { + "period_type": "MONTH", + "period_value": 7, + "rounding_type": "END_OF_YEAR" + } + }, + "redemption": { + "quantity": null + }, + "code_config": { + "length": 8, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "########", + "prefix": "LOYALTY-CARD-" + }, + "is_referral_code": false + }, + "auto_join": true, + "join_once": true, + "use_voucher_metadata_schema": true, + "vouchers_count": 1, + "active": true, + "metadata": {}, + "created_at": "2022-09-19T07:56:22.103Z", + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "category_id": "cat_0bb343dee3cdb5ec0c", + "object": "campaign" + }, + { + "id": "camp_4tHsQEDUOER6PeW8SoMdnHH6", + "name": "Dynamic Discounts", + "campaign_type": "DISCOUNT_COUPONS", + "type": "AUTO_UPDATE", + "voucher": { + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "percent_off": 5, + "percent_off_formula": "IF(ORDER_AMOUNT > 300;15;5)", + "effect": "APPLY_TO_ORDER" + }, + "redemption": { + "quantity": null + }, + "code_config": { + "length": 8, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "########", + "prefix": "DYNAMIC-" + }, + "is_referral_code": false + }, + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": true, + "vouchers_count": 1, + "active": true, + "metadata": { + "marketing_text": "Purchases above $300 are eligible for a 15% discount." + }, + "created_at": "2022-07-12T15:12:02.575Z", + "updated_at": "2022-07-20T10:48:05.617Z", + "category": "test", + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "category_id": "cat_0b688929a2476386a8", + "object": "campaign" + }, + { + "id": "camp_JlsseNSDO7l4neFtev6p6945", + "name": "$20 OFF Entire Order", + "campaign_type": "DISCOUNT_COUPONS", + "type": "AUTO_UPDATE", + "voucher": { + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 2000, + "effect": "APPLY_TO_ORDER" + }, + "redemption": { + "quantity": null + }, + "code_config": { + "length": 8, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "########", + "prefix": "$20OFFORDER-" + }, + "is_referral_code": false + }, + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": true, + "vouchers_count": 1, + "active": true, + "metadata": {}, + "created_at": "2022-07-11T09:43:36.057Z", + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "category_id": null, + "object": "campaign" + }, + { + "id": "camp_Uj3cNbWSgt7Zl4AyHM7Sa5Qk", + "name": "3% OFF Entire Order", + "campaign_type": "DISCOUNT_COUPONS", + "type": "AUTO_UPDATE", + "voucher": { + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "percent_off": 3, + "effect": "APPLY_TO_ORDER" + }, + "redemption": { + "quantity": null + }, + "code_config": { + "length": 8, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "########", + "prefix": "3%OFFORDER-" + }, + "is_referral_code": false + }, + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": true, + "vouchers_count": 1, + "active": true, + "metadata": {}, + "created_at": "2022-07-11T09:41:12.087Z", + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "category_id": null, + "object": "campaign" + } + ], + "total": 6 + } + } } - }, - "order": { - "source_id": "test_rollback_8" - }, - "metadata": { - "location_id": [ - "L2" - ] } } } } } - } - }, - "responses": { - "200": { - "description": "Returns a redemption rollback object indicating the result of the rollback.", - "content": { - "application/json": { + }, + "/v1/campaigns/{campaignId}": { + "parameters": [ + { + "in": "path", + "name": "campaignId", + "description": "You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.", "schema": { - "$ref": "#/components/schemas/7_res_rollback_redemption" - }, - "examples": { - "Loyalty Card": { - "value": { - "id": "rr_0c5eba630bc4979e70", - "object": "redemption_rollback", - "date": "2023-01-27T16:05:23.631Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": -2, - "redemption": "r_0c5bf3323008a35032", - "reason": "A UI rollback to check for result in API response to listing.", - "result": "SUCCESS", - "order": { - "id": "ord_dqxr4uzaYWkTZnrSEMoQtCF8", - "source_id": null, - "created_at": "2023-01-25T12:18:09.203Z", - "updated_at": "2023-01-27T16:05:23.687Z", - "status": "CANCELED", - "amount": 2100, - "total_amount": 2100, - "items": [ - { - "object": "order_item", - "product_id": "prod_0bc3bd8a4e072c5275", - "quantity": 3, - "amount": 2100, - "price": 700, - "subtotal_amount": 2100, - "product": { - "name": "Bouquet - Romantic Roses", - "price": 700 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5bf3323008a35032": { - "date": "2023-01-25T12:18:09.216Z", - "rollback_id": "rr_0c5eba630bc4979e70", - "rollback_date": "2023-01-27T16:05:23.631Z", - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + "type": "string", + "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" + }, + "required": true + } + ], + "get": { + "operationId": "get-campaign", + "tags": [ + "CAMPAIGNS API" + ], + "summary": "Get Campaign", + "description": "Retrieves the campaign with the given campaign ID or campaign name.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a campaign object if a valid identifier was provided.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_obj_campaign_object" + }, + "examples": { + "Example": { + "value": { + "id": "camp_JlsseNSDO7l4neFtev6p6945", + "name": "$20 OFF Entire Order", + "campaign_type": "DISCOUNT_COUPONS", + "type": "AUTO_UPDATE", + "voucher": { + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 2000, + "effect": "APPLY_TO_ORDER" + }, + "redemption": { + "quantity": null + }, + "code_config": { + "length": 8, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "########", + "prefix": "$20OFFORDER-" + }, + "is_referral_code": false + }, + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": true, + "vouchers_count": 1, + "active": true, + "metadata": {}, + "created_at": "2022-07-11T09:43:36.057Z", + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "category_id": null, + "object": "campaign" } } - }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "categories": [], - "discount": null, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "additional_info": null, - "assets": { - "qr": {}, - "barcode": {} - }, - "updated_at": null, - "object": "voucher" - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_0ZwLAHgeU9IrI2V1ofYRmW7g", - "voucher": { - "id": "v_4GaEX7clyqMaveT7vHhoyRpsIgxv95Q6", - "code": "HAPPY-ORDER5My", - "campaign": "$20 off the entire order", - "campaign_id": "camp_5h0wc453_4", - "category": null, - "category_id": "cat_0b688929a2476386a6", - "categories": [], - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 2000, - "effect": "APPLY_TO_ORDER" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2022-09-20T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "21ceb848-4869-4dac-ba41-f854bda3a101", - "url": "https://dl.voucherify.io/api/v1/assets/qr/21ceb848-4869-4dac-ba41-f854bda3a101" - }, - "barcode": { - "id": "1dba9cb2-fb28-4c8d-8548-5edb2eb01f5a", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/1dba9cb2-fb28-4c8d-8548-5edb2eb01f5a" - } - }, - "is_referral_code": false, - "created_at": "2023-01-25T12:18:09.256Z", - "updated_at": null, - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/HAPPY-ORDER5My/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/HAPPY-ORDER5My/publications?page=1&limit=10" - }, - "object": "voucher" - }, - "id": "rew_MF4hKh1IKYgJkPjbcFbH94Ho", - "object": "reward", - "name": "Digital Present", - "created_at": "2023-01-25T12:16:44.557Z", - "updated_at": null, - "parameters": { - "campaign": { - "id": "camp_5h0wc453_4", - "type": "DISCOUNT_COUPONS" - } - }, - "type": "CAMPAIGN" - }, - "loyalty_card": { - "points": -2 } } - }, - "Discount Coupon": { - "value": { - "id": "rr_0c5eb002b40cce9d62", - "object": "redemption_rollback", - "date": "2023-01-27T15:20:03.536Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "redemption": "r_0c5e8ef10842da0aad", - "result": "SUCCESS", - "order": { - "id": "ord_J5ogV1Gkk2yfxmBEhYIg4O65", - "source_id": null, - "created_at": "2023-01-27T12:55:34.673Z", - "updated_at": "2023-01-27T15:20:03.743Z", - "status": "CANCELED", - "amount": 6000, - "total_amount": 6000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 3300, - "price": 3000, - "subtotal_amount": 3300 - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 2, - "amount": 3400, - "price": 3000, - "subtotal_amount": 3400 - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5e8ef10842da0aad": { - "date": "2023-01-27T12:55:34.689Z", - "rollback_id": "rr_0c5eb002b40cce9d62", - "rollback_date": "2023-01-27T15:20:03.536Z", - "related_object_type": "voucher", - "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u" + } + }, + "404": { + "description": "Returns an error when requesting the campaign that has been deleted or cannot be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id camp_jcErmtGAOmHUAy0oUgkwKnP", + "request_id": "v-0bb8694614d58bf2a8", + "resource_id": "camp_jcErmtGAOmHUAy0oUgkwKnP", + "resource_type": "campaign" } } - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "voucher": { - "id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "code": "2CpRCE2c", - "campaign": null, - "campaign_id": null, - "category": null, - "category_id": null, - "categories": [], - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 300, - "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" - }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1+ro/6HLsfI9E/rz0QEoYv+rcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz+WQtg4nKpjUS0wcA7AuIbz2zb870YfJO/r5UBS5gCqQ==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bro%2F6HLsfI9E%2Frz0QEoYv%2BrcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz%2BWQtg4nKpjUS0wcA7AuIbz2zb870YfJO%2Fr5UBS5gCqQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3/4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ+aTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3%2F4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ%2BaTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-19T10:06:07.932Z", - "updated_at": "2023-01-27T15:20:03.707Z", - "redemption": { - "quantity": null, - "redeemed_quantity": 1, - "object": "list", - "url": "/v1/vouchers/2CpRCE2c/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/2CpRCE2c/publications?page=1&limit=10" - }, - "object": "voucher" } } - }, - "Gift Card": { - "value": { - "id": "rr_0c5eb099214ccea115", - "object": "redemption_rollback", - "date": "2023-01-27T15:22:37.573Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": -2000, - "redemption": "r_0c5e8a38730ccec0d5", - "result": "SUCCESS", - "order": { - "id": "ord_S4BvUj64TlGqVZDOeud7z3rU", - "source_id": null, - "created_at": "2023-01-27T12:34:57.086Z", - "updated_at": "2023-01-27T15:22:37.628Z", - "status": "CANCELED", - "amount": 6000, - "total_amount": 6000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 3300, - "price": 3000, - "subtotal_amount": 3300 - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 2, - "amount": 3400, - "price": 3000, - "subtotal_amount": 3400 - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5e8a38730ccec0d5": { - "date": "2023-01-27T12:34:57.100Z", - "rollback_id": "rr_0c5eb099214ccea115", - "rollback_date": "2023-01-27T15:22:37.573Z", - "related_object_type": "voucher", - "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", - "related_object_parent_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6" - } + } + } + } + }, + "put": { + "operationId": "update-campaign", + "tags": [ + "CAMPAIGNS API" + ], + "summary": "Update Campaign", + "description": "Updates the specified campaign by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. \n\nFields other than the ones listed in the request body won't be modified. Even if provided, they will be silently skipped. \n\n> #### Vouchers will be affected\n>\n> This method will update vouchers aggregated in the campaign. It will affect all vouchers that are not published or redeemed yet.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the campaign parameters to be updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_req_update_campaign" + }, + "examples": { + "Example": { + "value": { + "description": "New description" } - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", - "voucher": { - "id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", - "code": "CODE14", - "campaign": "Gift Card Campaign", - "campaign_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6", - "category": "Second", - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [], - "type": "GIFT_VOUCHER", - "discount": null, - "gift": { - "amount": 2000, - "balance": 2000, - "effect": null - }, - "loyalty_card": null, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": "secret-code1", - "metadata": { - "region": "APAC", - "season": "Fall" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+VibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BVibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/GVIi0p5fL5hxAY/ZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd//S4R9AB+60T/x4kSKu3lgfa9KgJmbyrzXm7Ggly06/qph4/asJaZVZIXEba4WJCeHqXCEgg==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FGVIi0p5fL5hxAY%2FZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd%2F%2FS4R9AB%2B60T%2Fx4kSKu3lgfa9KgJmbyrzXm7Ggly06%2Fqph4%2FasJaZVZIXEba4WJCeHqXCEgg%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-23T11:05:42.164Z", - "updated_at": "2023-01-27T15:22:37.595Z", - "redemption": { - "quantity": 18, - "redeemed_quantity": 0, - "redeemed_amount": 0, - "object": "list", - "url": "/v1/vouchers/CODE14/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/CODE14/publications?page=1&limit=10" - }, - "object": "voucher" - }, - "gift": { - "amount": -2000 } } - }, - "Promotion Tier": { - "value": { - "id": "rr_0ca286e96cc03f3e76", - "object": "redemption_rollback", - "date": "2023-03-21T07:57:12.526Z", - "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==", - "metadata": { - "location_id": [ - "L2" - ] + } + } + }, + "responses": { + "200": { + "description": "Returns the campaign object if the update succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_obj_campaign_object" }, - "redemption": "r_0ca286d222d2f7dc1f", - "reason": "To undo a redemption.", - "result": "SUCCESS", - "order": { - "id": "ord_0FR01SqYIxV4ITzgs1yZjkK6", - "source_id": "test_rollback_8", - "created_at": "2023-03-21T07:56:48.634Z", - "updated_at": "2023-03-21T07:57:12.546Z", - "status": "CANCELED", - "amount": 200000, - "total_amount": 200000, - "items": [ - { - "object": "order_item", - "source_id": "apple534", - "related_object": "product", - "product_id": "prod_anJ03RZZq74z4v", - "quantity": 2, - "amount": 100000, - "price": 50000, - "subtotal_amount": 100000, - "product": { - "id": "prod_0c5d6689b39320059b", - "source_id": "prod_anJ03RZZq74z4v", - "name": "Apple iPhone 8", - "metadata": { - "shop": "citycenter", - "category": "electronics" + "examples": { + "Example": { + "value": { + "id": "camp_FZL4iTTdZw36nZOoXYQ172fQ", + "name": "Loyalty Campaign", + "campaign_type": "LOYALTY_PROGRAM", + "type": "AUTO_UPDATE", + "voucher": { + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 1000, + "expiration_rules": { + "period_type": "MONTH", + "period_value": 3, + "rounding_type": "END_OF_YEAR" + } + }, + "redemption": { + "quantity": 10 + }, + "code_config": { + "length": 7, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "LOYALTY-CARD-#######" + }, + "is_referral_code": false, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" } }, + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": false, + "description": "New description", + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "activity_duration_after_publishing": "P24D", + "vouchers_count": 2, + "active": true, "metadata": { - "series": "2022-783CV" - } - }, - { - "object": "order_item", - "source_id": "apple534-ihd5", - "related_object": "sku", - "sku_id": "sku_0KtP4rvwEECQ2U", - "quantity": 1, - "amount": 100000, - "price": 100000, - "subtotal_amount": 100000, - "sku": { - "sku": "Apple iPad 10 Silver 64GB", - "metadata": { - "category": "electronics" + "region": "APAC" + }, + "created_at": "2022-09-21T09:39:45.479Z", + "updated_at": "2022-09-23T09:47:00.205Z", + "category": "First", + "creation_status": "MODIFYING", + "vouchers_generation_status": "MODIFYING", + "protected": false, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" } - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "object": "customer" - }, - "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0ca286d222d2f7dc1f": { - "date": "2023-03-21T07:56:48.651Z", - "rollback_id": "rr_0ca286e96cc03f3e76", - "rollback_date": "2023-03-21T07:57:12.526Z", - "related_object_type": "promotion_tier", - "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "related_object_parent_id": "camp_w7BUstntAm8jbIDjfM49volj" + ], + "object": "campaign" } } - }, - "channel": { - "channel_id": "e55f3aaa-b303-421a-b562-ca8529ed341d", - "channel_type": "API" - }, - "customer": { - "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "name": "Annie Lemons", - "email": "annie@lemon.com", - "source_id": "annie@lemon.com", - "metadata": { - "age": 23 - }, - "object": "customer" - }, - "related_object_type": "promotion_tier", - "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "voucher": null, - "promotion_tier": { - "id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "created_at": "2022-09-23T08:31:23.022Z", - "updated_at": "2023-02-01T07:47:57.324Z", - "name": "Percent Discount", - "banner": "Get 40% off", - "action": { - "discount": { - "type": "PERCENT", - "percent_off": 40, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "hierarchy": 2, - "campaign": { - "id": "camp_w7BUstntAm8jbIDjfM49volj", - "start_date": "2019-08-16T00:00:00.000Z", - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "campaign_id": "camp_w7BUstntAm8jbIDjfM49volj", - "active": true, - "start_date": "2022-09-21T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "summary": { - "redemptions": { - "total_redeemed": 5 - }, - "orders": { - "total_amount": 616000, - "total_discount_amount": 246400 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": null, - "category_id": null, - "categories": [] } } } } } - } - }, - "400": { - "description": "Returns an error if the rollback redemption process failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Already rolledback": { - "value": { - "code": 400, - "key": "already_rolled_back", - "message": "Already rolled back", - "details": "Redemption has been already rolled back.", - "request_id": "v-0c5eb3bd81cd7e3a39", - "resource_id": "rrf_0c5eb3bd884497ed05", - "resource_type": "redemption_rollback" - } - }, - "Invalid Redemption Parent": { - "value": { - "code": 400, - "key": "invalid_redemption_parent", - "message": "Invalid redemption parent", - "details": "You can rollback only a redemption that does not have parent redemption.", - "request_id": "v-0c6382005e03b3bd2f" - } - }, - "Invalid Redemption": { - "value": { - "code": 400, - "key": "invalid_redemption", - "message": "Invalid redemption", - "details": "You can rollback only a single redemption. Use different endpoint for stacked redemption.", - "request_id": "v-0c675e5e2e04e31bb3" - } + }, + "delete": { + "operationId": "delete-campaign", + "tags": [ + "CAMPAIGNS API" + ], + "summary": "Delete Campaign", + "description": "Permanently deletes a campaign and all related vouchers. This action cannot be undone. Also, this method immediately removes any redemptions on the voucher.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [ + { + "schema": { + "type": "boolean" }, - "Invalid Order": { - "value": { - "code": 400, - "key": "invalid_order", - "message": "Invalid order", - "details": "Order is not related with redemption.", - "request_id": "v-0ca2770e3fc4047e25" + "in": "query", + "description": "If this flag is set to `true`, the campaign and related vouchers will be removed permanently. Going forward, the user will be able to create the next campaign with exactly the same name.", + "name": "force" + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "202": { + "description": "Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the campaign will be deleted from the repository asynchronously. To check the deletion status and result, copy the `async_action_id` from the response and pass it using [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" + }, + "examples": { + "Delete Campaign": { + "$ref": "#/components/examples/res_async_actions" + } + } } - }, - "Invalidate Customer": { - "value": { - "code": 400, - "key": "invalid_customer", - "message": "Invalid customer", - "details": "Customer is not related with redemption.", - "request_id": "v-0ca284851b0404513f" + } + }, + "404": { + "description": "Returns an error indicating that the campaign with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Campaign Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id Spring Campaign", + "request_id": "v-0adac46be8cdbfd921", + "resource_id": "Spring Campaign", + "resource_type": "campaign" + } + } + } } } } } } }, - "404": { - "description": "Returns an error if the rollback redemption process failed.", - "content": { - "application/json": { + "/v1/campaigns/{campaignId}/vouchers": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_404_not_found" + "type": "string", + "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the campaign to which voucher(s) will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value." + } + ], + "post": { + "operationId": "add-vouchers-to-campaign", + "tags": [ + "CAMPAIGNS API" + ], + "summary": "Add Vouchers to Campaign", + "description": "This method gives the possibility to push new vouchers to an existing campaign. New vouchers will inherit properties from the campaign profile. However, it is possible to overwrite some of them in the request body. If you provide an optional `code_config` parameter with a voucher code configuration, then it will be used to generate new voucher codes. Otherwise, the voucher code configuration from the campaign will be used.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [ + { + "schema": { + "type": "integer" + }, + "in": "query", + "name": "vouchers_count", + "description": "Number of vouchers that should be added." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the voucher parameters that you would like to overwrite.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_req_add_vouchers_to_campaign" + }, + "examples": { + "Example": { + "value": { + "category_id": "cat_0bb81a481615a37b5e", + "start_date": "2022-09-24T00:00:00Z", + "expiration_date": "2022-09-25T23:59:59Z", + "active": false, + "redemption": { + "quantity": null + }, + "code_config": { + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "length": 8, + "prefix": "Add-", + "pattern": null, + "postfix": "-API" + }, + "additional_info": "Voucher added using API", + "metadata": { + "Season": "Fall" + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a voucher object if the call succeeded for a voucher count of 1.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_obj_voucher_object" + }, + "examples": { + "Example": { + "value": { + "async_action_id": "aa_0bb96ebb7ec3720252" + } + } + } + } + } }, - "examples": { - "Cannot find customer": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find customer with id cust_eWgXlBBiY6THFRJwX45Iakv4s", - "request_id": "v-0c5ebc5de80a2cf1a5", - "resource_id": "cust_eWgXlBBiY6THFRJwX45Iakv4s", - "resource_type": "customer" + "202": { + "description": "Returns an `async_action_id` if the request was made to create more than 1 voucher.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" + } } } } } } - } - } - } - }, - "/v1/promotions/tiers/{promotionTierId}/redemption": { - "parameters": [ - { - "schema": { - "type": "string" }, - "name": "promotionTierId", - "in": "path", - "required": true, - "description": "ID of the promotion tier to be redeemed." - } - ], - "post": { - "operationId": "redeem-promotion", - "deprecated": true, - "tags": [ - "REDEMPTIONS API" - ], - "summary": "Redeem Promotion [Deprecated]", - "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for promotion tier redemption, and we do not recommend using it. The new [Stackable Discounts API](ref:redeem-stacked-discounts) 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. \n\nTo redeem a promotion, you create a redemption object passing a context.\n\nYou can retrieve a list of active promotions through the [Validate Promotions](ref:validate-promotions) endpoint. That validation method will return a list of active​ promotion tiers identified by thier IDs. \n\n> 📘 Redemption rollback\n>\n> Do you need to undo a redemption? You can do it with [redemption rollback](ref:rollback-redemption).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Provide the redemption context in the request body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/7_req_redeem_promotion_tier" + "/v1/campaigns/{campaignId}/vouchers/{code}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the campaign to which voucher will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value." }, - "examples": { - "One product one sku": { - "value": { - "customer": { - "source_id": "annie@lemon.com", - "name": "Annie Lemon", - "email": "annie@lemon.com" + { + "schema": { + "type": "string" + }, + "name": "code", + "in": "path", + "required": true, + "description": "A custom **code** that identifies the voucher." + } + ], + "post": { + "operationId": "add-voucher-with-specific-code-to-campaign", + "tags": [ + "CAMPAIGNS API" + ], + "summary": "Add Voucher with Specific Code to Campaign", + "description": "This method gives a possibility to add a new voucher to an existing campaign. The voucher definition will be inherited from the definition kept in the campaign profile. However, you are able to overwrite a few properties inherited from the campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the voucher parameters that you would like to overwrite.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_req_add_vouchers_with_specific_code_to_campaign" }, - "order": { - "amount": 200000, - "items": [ - { - "source_id": "apple534", - "product_id": "prod_anJ03RZZq74z4v", - "related_object": "product", - "quantity": 2, - "price": 50000, - "product": { - "override": true, - "name": "Apple iPhone 8", - "metadata": { - "shop": "citycenter", - "category": "electronics" - } + "examples": { + "Example": { + "value": { + "category_id": "cat_0bb81a481615a37b5e", + "start_date": "2022-09-24T00:00:00Z", + "expiration_date": "2022-09-25T23:59:59Z", + "active": false, + "redemption": { + "quantity": null }, + "additional_info": "Voucher added using API", "metadata": { - "series": "2022-783CV" + "Season": "Fall" } - }, - { - "sku_id": "sku_0KtP4rvwEECQ2U", - "source_id": "apple534-ihd5", - "related_object": "sku", - "quantity": 1, - "price": 100000, - "sku": { - "override": true, - "sku": "Apple iPad 10 Silver 64GB", + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a voucher object if the call succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_obj_voucher_object" + }, + "examples": { + "Example": { + "value": { + "id": "v_EJwB9Wy2aOIsDpWhnl2QBY51OqjQ5Ukg", + "code": "Code3", + "campaign": "Add Vouchers to Campaign", + "campaign_id": "camp_xxpmFyWO9h9s5cEe7HtmOK5B", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "amount_limit": 2000, + "percent_off": 30, + "effect": "APPLY_TO_ORDER" + }, + "gift": null, + "loyalty_card": null, + "start_date": "2022-09-24T00:00:00.000Z", + "expiration_date": "2022-09-25T23:59:59.000Z", + "validity_timeframe": null, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": true, + "additional_info": "Voucher added using API", "metadata": { - "category": "electronics" - } + "Season": "Fall" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX1+p2kdatp7KAUZxgSATC1gRWgsb1Q3RQyClNOBrfUrRKpTjSPSzBuUSZzb45TIpfWRISSiaz1QXGh8z9sVSHIWQsGLO6+1N81zXuY6/pnC7gRBa4edwMaRoCAwzqO9JDw148AGk4XrXLg==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bp2kdatp7KAUZxgSATC1gRWgsb1Q3RQyClNOBrfUrRKpTjSPSzBuUSZzb45TIpfWRISSiaz1QXGh8z9sVSHIWQsGLO6%2B1N81zXuY6%2FpnC7gRBa4edwMaRoCAwzqO9JDw148AGk4XrXLg%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX19wrLVWzIOgoVd9an76OxiJWB5/u9yWGoD7cqN6Qd1K9noNyR1YwvHnBrcN5fa5qtY+sOXonn7WsynAWeR289gA0XobsHHE2VWe8BzNZ7h2kH90SsiW+NCQg6Ts8clYWWP5lrGyV/fzoA==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19wrLVWzIOgoVd9an76OxiJWB5%2Fu9yWGoD7cqN6Qd1K9noNyR1YwvHnBrcN5fa5qtY%2BsOXonn7WsynAWeR289gA0XobsHHE2VWe8BzNZ7h2kH90SsiW%2BNCQg6Ts8clYWWP5lrGyV%2FfzoA%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-21T07:14:28.217Z", + "updated_at": null, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/Code3/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/Code3/publications?page=1&limit=10" + }, + "object": "voucher" } } - ] + } + } + } + }, + "409": { + "description": "Returns an error if a voucher with the same code already exists.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_409_duplicate_found" + }, + "examples": { + "Duplicate": { + "value": { + "code": 409, + "key": "duplicate_found", + "message": "Duplicated resource found", + "details": "Duplicated voucher exists with id Code1", + "request_id": "v-0bb974be99d22504cd", + "resource_id": "Code1", + "resource_type": "voucher" + } + } + } } } } } } - } - }, - "responses": { - "200": { - "description": "Returns a redemption object if the redeem operation succeeded.", - "content": { - "application/json": { + }, + "/v1/campaigns/{campaignId}/import": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/7_obj_redemption_object_promotion_tier_extended" - }, - "examples": { - "One product one sku": { - "value": { - "id": "r_0ca2699201c03f121b", - "object": "redemption", - "date": "2023-03-21T05:49:00.807Z", - "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==", - "metadata": null, - "result": "SUCCESS", - "order": { - "id": "ord_IVEF85NZCXmP4S1fGmImSTwH", - "source_id": null, - "created_at": "2023-03-21T05:49:00.772Z", - "updated_at": null, - "status": "PAID", - "amount": 200000, - "discount_amount": 80000, - "total_discount_amount": 80000, - "total_amount": 120000, - "applied_discount_amount": 80000, - "total_applied_discount_amount": 80000, - "items": [ + "type": "string", + "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "The ID of an existing campaign to which you're importing the codes. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value." + } + ], + "post": { + "operationId": "import-vouchers-to-campaign", + "tags": [ + "CAMPAIGNS API" + ], + "summary": "Import Vouchers to Campaign", + "description": "Imports vouchers to an **existing** campaign.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Discount type, expiration date and the remaining attributes will be taken from the [Campaign](ref:get-campaign) settings.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_req_import_vouchers_to_campaign" + }, + "examples": { + "Example": { + "value": [ { - "object": "order_item", - "source_id": "apple534", - "related_object": "product", - "product_id": "prod_anJ03RZZq74z4v", - "quantity": 2, - "amount": 100000, - "price": 50000, - "subtotal_amount": 100000, - "product": { - "id": "prod_0c5d6689b39320059b", - "source_id": "prod_anJ03RZZq74z4v", - "name": "Apple iPhone 8", - "metadata": { - "shop": "citycenter", - "category": "electronics" - } + "code": "CODE7", + "category": "First", + "redemption": { + "quantity": 1 }, "metadata": { - "series": "2022-783CV" - } + "season": "Fall" + }, + "additional_info": "secret-code1", + "active": true }, { - "object": "order_item", - "source_id": "apple534-ihd5", - "related_object": "sku", - "sku_id": "sku_0KtP4rvwEECQ2U", - "quantity": 1, - "amount": 100000, - "price": 100000, - "subtotal_amount": 100000, - "sku": { - "sku": "Apple iPad 10 Silver 64GB", - "metadata": { - "category": "electronics" - } - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "object": "customer" - }, - "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0ca2699201c03f121b": { - "date": "2023-03-21T05:49:00.807Z", - "related_object_type": "promotion_tier", - "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "related_object_parent_id": "camp_w7BUstntAm8jbIDjfM49volj" + "code": "CODE8", + "category": "Second", + "redemption": { + "quantity": 18 + }, + "metadata": { + "season": "Fall" + }, + "additional_info": "secret-code1", + "active": true + }, + { + "code": "CODE9", + "category_id": "cat_0bb343dee3cdb5ec0c", + "redemption": { + "quantity": 4 + }, + "metadata": { + "season": "Fall" + }, + "additional_info": "secret-code1", + "active": true } - } - }, - "channel": { - "channel_id": "e55f3aaa-b303-421a-b562-ca8529ed341d", - "channel_type": "API" + ] }, - "customer": { - "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "name": "Annie Lemon", - "email": "annie@lemon.com", - "source_id": "annie@lemon.com", - "metadata": { - "age": 2 - }, - "object": "customer" - }, - "related_object_type": "promotion_tier", - "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "voucher": null, - "promotion_tier": { - "id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "created_at": "2022-09-23T08:31:23.022Z", - "updated_at": "2023-02-01T07:47:57.324Z", - "name": "Percent Discount", - "banner": "Get 40% off", - "action": { - "discount": { - "type": "PERCENT", - "percent_off": 40, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "hierarchy": 2, - "campaign": { - "id": "camp_w7BUstntAm8jbIDjfM49volj", - "start_date": "2019-08-16T00:00:00.000Z", - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "campaign_id": "camp_w7BUstntAm8jbIDjfM49volj", - "active": true, - "start_date": "2022-09-21T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "summary": { - "redemptions": { - "total_redeemed": 5 + "Gift Cards": { + "value": [ + { + "code": "CODE13", + "category": "First", + "redemption": { + "quantity": 1 + }, + "metadata": { + "season": "Fall" + }, + "additional_info": "secret-code1", + "gift": { + "amount": 500 + }, + "active": true }, - "orders": { - "total_amount": 616000, - "total_discount_amount": 246400 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_z6MvMg2Zf2UABNWN", - "rule_id": "val_q8qUBMOh5qIQ", - "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "related_object_type": "promotion_tier", - "object": "validation_rules_assignment" - } - ], - "total": 1 - }, - "category_id": null, - "categories": [] - } - } - }, - "Example": { - "value": { - "id": "r_0c64c10b8ece60bd91", - "object": "redemption", - "date": "2023-02-01T08:25:22.235Z", - "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==", - "metadata": null, - "result": "SUCCESS", - "order": { - "id": "ord_7n58dbLV2jMG4C14XjEYEbjh", - "source_id": null, - "created_at": "2023-02-01T08:25:22.192Z", - "updated_at": null, - "status": "PAID", - "amount": 200000, - "discount_amount": 80000, - "total_discount_amount": 80000, - "total_amount": 120000, - "applied_discount_amount": 80000, - "total_applied_discount_amount": 80000, - "items": [ { - "object": "order_item", - "source_id": "apple534", - "related_object": "product", - "product_id": "prod_anJ03RZZq74z4v", - "quantity": 2, - "amount": 100000, - "price": 50000, - "subtotal_amount": 100000, - "product": { - "id": "prod_0c5d6689b39320059b", - "source_id": "prod_anJ03RZZq74z4v", - "name": "Apple iPhone 8", - "metadata": { - "shop": "citycenter", - "category": "electronics" - } + "code": "CODE14", + "category": "Second", + "redemption": { + "quantity": 18 }, "metadata": { - "series": "2022-783CV" - } + "season": "Fall" + }, + "additional_info": "secret-code1", + "gift": { + "amount": 2000 + }, + "active": true }, { - "object": "order_item", - "source_id": "apple534-ihd5", - "related_object": "sku", - "sku_id": "sku_0KtP4rvwEECQ2U", - "quantity": 1, - "amount": 100000, - "price": 100000, - "subtotal_amount": 100000, - "sku": { - "sku": "Apple iPad 10 Silver 64GB", - "metadata": { - "category": "electronics" - } - } + "code": "CODE15", + "category_id": "cat_0bb343dee3cdb5ec0c", + "redemption": { + "quantity": 4 + }, + "metadata": { + "season": "Fall" + }, + "additional_info": "secret-code1", + "active": false } - ], - "metadata": {}, - "customer": { - "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "object": "customer" - }, - "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c64c10b8ece60bd91": { - "date": "2023-02-01T08:25:22.235Z", - "related_object_type": "promotion_tier", - "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "related_object_parent_id": "camp_w7BUstntAm8jbIDjfM49volj" + ] + }, + "Loyalty Cards": { + "value": [ + { + "code": "CODE10", + "category": "First", + "redemption": { + "quantity": 1 + }, + "metadata": { + "season": "Fall" + }, + "additional_info": "secret-code1", + "loyalty_card": { + "points": 300 + }, + "active": true + }, + { + "code": "CODE11", + "category": "Second", + "redemption": { + "quantity": 18 + }, + "metadata": { + "season": "Fall" + }, + "additional_info": "secret-code1", + "loyalty_card": { + "points": 2000 + }, + "active": true + }, + { + "code": "CODE12", + "category_id": "cat_0bb343dee3cdb5ec0c", + "redemption": { + "quantity": 4 + }, + "metadata": { + "season": "Fall" + }, + "additional_info": "secret-code1", + "active": true } + ] + } + } + } + } + }, + "responses": { + "202": { + "description": "Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the vouchers will be imported 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](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" + }, + "examples": { + "Example": { + "$ref": "#/components/examples/res_async_actions" } + } + } + } + }, + "400": { + "description": "Returns an error if the request includes incorrect data, e.g. a wrong data type or duplicated codes.", + "content": { + "application/json": { + "schema": { + "anyOf": [ + { + "$ref": "#/components/schemas/e_400_invalid_voucher" + }, + { + "$ref": "#/components/schemas/e_400_duplicate_key" + } + ] }, - "customer": { - "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "name": "Annie Lemon", - "email": "annie@lemon.com", - "source_id": "annie@lemon.com", - "metadata": { - "age": 2 - }, - "object": "customer" - }, - "related_object_type": "promotion_tier", - "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "voucher": null, - "promotion_tier": { - "id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "created_at": "2022-09-23T08:31:23.022Z", - "updated_at": "2023-02-01T07:47:57.324Z", - "name": "Percent Discount", - "banner": "Get 40% off", - "action": { - "discount": { - "type": "PERCENT", - "percent_off": 40, - "effect": "APPLY_TO_ORDER" + "examples": { + "Duplicate Codes": { + "value": { + "code": 400, + "key": "duplicate_key", + "message": "Duplicate codes", + "details": "2 voucher codes(s) already exist.", + "request_id": "v-0adaccaba61502e4b3" } }, - "metadata": {}, - "hierarchy": 2, - "campaign": { - "id": "camp_w7BUstntAm8jbIDjfM49volj", - "start_date": "2019-08-16T00:00:00.000Z", - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "campaign_id": null, - "active": true, - "start_date": "2022-09-21T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "summary": { - "redemptions": { - "total_redeemed": 3 - }, - "orders": { - "total_amount": 408000, - "total_discount_amount": 163200 + "Missing Code": { + "value": { + "code": 400, + "key": "invalid_voucher", + "message": "Invalid Voucher", + "details": "Found 1 voucher(s) without 'code' value", + "request_id": "v-0bbc38ce088c8b2f9a" } }, - "object": "promotion_tier", - "validation_rule_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_z6MvMg2Zf2UABNWN", - "rule_id": "val_q8qUBMOh5qIQ", - "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "related_object_type": "promotion_tier", - "object": "validation_rules_assignment" - } - ], - "total": 1 + "Invalid Payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Property .redemption.quantity should be number,null", + "request_id": "v-0c545db3808418908f" + } } } } @@ -64998,838 +51105,1331 @@ } } }, - "400": { - "description": "Returns an error if the promotion tier is inactive.", - "content": { - "application/json": { + "/v1/campaigns/{campaignId}/importCSV": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_error_expanded" - }, - "examples": { - "Inactive Promotion": { - "value": { - "code": 400, - "key": "promotion_inactive", - "message": "Inactive Promotion", - "details": "Promotion Tier with id: promo_DE1N30D731Tg2F6NoMwNas2W is disabled.", - "request_id": "v-0c64b722160294496b", - "resource_id": "rf_0c64b7223cce60eec6", - "resource_type": "redemption", - "error": { - "message": "The promotion is inactive." - } + "type": "string", + "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value." + } + ], + "post": { + "operationId": "import-vouchers-to-campaign-using-csv", + "tags": [ + "CAMPAIGNS API" + ], + "summary": "Import Vouchers to Campaign by CSV", + "description": "Imports vouchers to an **existing** campaign. \n\n\nThe CSV file has to include headers in the first line. \n\nCurl Example\n\n```cURL\ncurl -X POST \\\n https://api.voucherify.io/v1/campaigns/TEST-CAMPAIGN/importCSV \\\n -F file=@/path/to/campaigns.csv \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\"\n```\n\nYou can import values for the following fields: `Code` (**required**), `Category`, `Active`. In a gift cards import, you can also include the current card balance using the `Gift Amount` header and the amount that was redeemed using the `Redeemed Amount` header. In a loyalty cards import, you can also include the current loyalty card score in points using the `Loyalty Points` header. Remaining CSV columns will be mapped to metadata properties. \n\nDiscount type, time limits, and validation rules will be taken from the [campaign object](ref:get-campaign) settings. \n\n\n| **Active** | **Code** | **Loyalty Points** | **Gift Amount** | **Redeemed Amount** | **Redeemed Quantity** | **Category** | **Custom_metadata_property** |\n|---|---|---|---|---|---|---|---|\n| Use `true` or `false` to enable or disable the voucher; this flag can be used to turn off the ability to redeem a voucher even though it is within the campaign's start/end validity timeframe. | The unique voucher code. | The number of points to be added to the loyalty card. If you leave this undefined, then the initial number of points will be set according to the campaign settings.
Context: `LOYALTY_PROGRAM` | The initial gift card balance.
Context: `GIFT_VOUCHERS` | The amount that was redeemed from the available balance on a gift card. | The number of times the voucher has been redeemed. | A custom tag for the voucher to help you filter codes; you can either import the category name or a unique Voucherify-assigned category ID. | Any additional data that you would like to store for the given loyalty card as a Custom attribute. Remember to define the metadata schema in the Dashboard prior to importing codes. |\n|\n\n> 📘 Active\n>\n> The CSV file is allowed in two versions; either with or without a column titled `Active`. It indicates whether the voucher is enabled after the import event. \n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/a_req_importCSV" } } - } - } - } - } - } - } - }, - "/client/v1/redemptions": { - "post": { - "operationId": "redeem-stacked-discounts-client-side", - "tags": [ - "STACKABLE DISCOUNTS API" - ], - "summary": "Redeem Stackable Discounts (client-side)", - "description": "Use this method to redeem up to 5 redeemables in a single API request. This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications.\n\n## How API returns calculated discounts and order amounts in the response\n\nIn the table below, you can see the logic the API follows to calculate discounts and amounts:\n\n| **Field** | **Calculation** | **Description** |\n|:---|:---|:---|\n| amount | N/A | This field shows the order amount before applying any discount |\n| total_amount | `total_amount` = `amount` - `total_discount_amount` | This field shows the order amount after applying all the discounts |\n| 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. |\n| items_discount_amount | sum(items, i => i.discount_amount) | This field sums up all product-specific discounts |\n| total_discount_amount | `total_discount_amount` = `discount_amount` + `items_discount_amount` | This field sums up all order-level and all product-specific discounts |\n| applied_discount_amount | N/A | This field shows the order-level discount applied in a particular request |\n| items_applied_discount_amount | sum(items, i => i.applied_discount_amount) | This field sums up all product-specific discounts applied in a particular request |\n| 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 |\n\n\n> 📘 Rollbacks\n>\n> 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](ref:rollback-stacked-redemptions).", - "parameters": [ - { - "$ref": "#/components/parameters/origin" - } - ], - "security": [ - { - "X-Client-Application-Id-1": [], - "X-Client-Token-1": [] - } - ], - "requestBody": { - "description": "## Expanded Response\n\nResponses will vary depending on the strings passed in the `options.expand` string array.\n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redemption object.
- Metadata not included for each discount type. |\n| [\"order\", \"redemption\"] | - Returns redemption object `metadata`.
- Order data with calculated discounts are listed in each child redemption object. |\n| [\"redeemable\", \"redemption\"] | - Returns each discount type's `metadata` in each child redemption object.
- Returns redemption object `metadata`. |\n| [\"redemption\"] | - Returns redemption object `metadata`. |\n| [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object
- Returns redemption object `metadata`.
- Returns an expanded `categories` object, showing details about the category. |", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/19_req_redemptions" + }, + "description": "The file path is stored in the form `file` header." }, - "examples": { - "Example": { - "value": { - "customer": { - "source_id": "sample_customer", - "metadata": { - "key": "value" - } - }, - "options": { - "expand": [ - "order", - "redeemable", - "category" - ] - }, - "redeemables": [ - { - "object": "voucher", - "id": "voucher-code" + "responses": { + "200": { + "description": "Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the vouchers will be imported 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](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" + }, + "examples": { + "Example": { + "$ref": "#/components/examples/res_async_actions" + } } - ], - "session": { - "type": "LOCK", - "key": "session_key" - }, - "order": { - "amount": 55000, - "status": "PAID", - "items": [ - { - "quantity": 2, - "price": 20000, - "source_id": "sample product1", - "related_object": "product", - "product": { - "metadata": { - "key": "value" - } - } - }, - { - "quantity": 1, - "price": 15000, - "source_id": "sample product2", - "related_object": "product", - "product": { - "metadata": { - "key": "value" - } + } + } + }, + "404": { + "description": "Returns an error if the campaign cannot be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Example": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id camp_FZL4iTTdZw36nZOoXYQ172fQ", + "request_id": "v-0bc26adad888b6fed1", + "resource_id": "camp_FZL4iTTdZw36nZOoXYQ172fQ", + "resource_type": "campaign" } } - ], - "metadata": { - "key": "value" } } } } } } - } - }, - "responses": { - "200": { - "description": "All promo codes and tiers provided in redeemables are redeemed during the request and returned in the API response. As a result, there are child `redemptions` related to redemptions of each redeemable and a `parent_redemption` that presents the final effect of redeeming all redeemables and stores the list of child redemptions. \n\n| Response Parameter | Description |\n|:---|:---|\n| redemptions
`array of objects` | This array lists all child redemptions that were executed during the request. Each child redemption returns a redemption object with detailed information on how each discount/code was applied to the order. You can see the effect of each consecutive redemption within the order object of each redemption, specifically the `total_discount_amount` parameter. This is why the sequence in which the discounts were provided in the request body matters. Each subsequent redemption object contains the order object which combines the effect of the previously applied discounts. |\n| parent_redemption
`object` | Represents the final effect of all child redemptions executed during the request. |\n| order
`object` | Represents order details after all discounts are applied. |", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/19_res_redemptions_POST" + }, + "/v1/campaigns/qualification": { + "post": { + "operationId": "examine-campaigns-qualification", + "deprecated": true, + "tags": [ + "CAMPAIGNS API" + ], + "summary": "Examine Qualification [Deprecated]", + "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for qualification, and we do not recommend using it. The new [Qualifications API](ref:examine-qualification) introduces additional features and improvements while maintaining backward compatibility. 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. \n\nThe method can be used for sending a request to display all campaigns qualified to the given customer and context (e.g., order). \n\nThe maximum number of **returned campaigns is 50**.\n\n## What campaign types are included in the response?\n\n- `DISCOUNT_COUPONS`\n- `GIFT_VOUCHERS`\n- `REFERRAL_PROGRAM`\n\n## What's excluded?\n\nA checking logic will be run only among campaigns and will ignore _standalone vouchers_. For standalone vouchers, you should run a [dedicated endpoint](ref:examine-vouchers-qualification) for searching and identifing vouchers. \n\n## Subsequent Steps\n\nAs a recommended subsequent step after selecting a qualified campaign is to publish a voucher code from that campaign. The [API method for publishing](ref:create-publication) will return a unique code which will belong to a given customer.\n\n## Sample use case\n\nAs a sample use case, you can imagine a requirement of displaying coupons (grouped in campaigns) that a customer is eligible to use. The customer should get assigned to the particular voucher from the campaign and then may redeem that particular code when he/she places an order.\n\n[Read](doc:checking-eligibility-for-coupons) about Qualification API limits before you start.", + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "audienceRulesOnly", + "description": "This parameter set to true will ask only for verifying vouchers' validation rules only against conditions applied to audiences' attributes (belonging into segment and Customer metadata)" + }, + { + "schema": { + "type": "integer", + "maximum": 50 + }, + "in": "query", + "name": "limit", + "description": "The number of campaigns to be qualified. The maximum number is 50." + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at", + "type", + "-type", + "code", + "-code", + "category", + "-category", + "campaign", + "-campaign" + ] + }, + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash `-` means sorting in a descending order." } - } - } - } - } - } - }, - "/v1/validations": { - "post": { - "operationId": "validate-stacked-discounts", - "tags": [ - "STACKABLE DISCOUNTS API" - ], - "summary": "Validate Stackable Discounts", - "description": "Verify redeemables provided in the request. This method is designed for server side integration which means that it is accessible only through private keys.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "## Expanded Response \n\nResponses will vary depending on the strings passed in the `options.expand` string array. You can customize the response by using one of the following combinations of strings.\n \n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redeemable object.
- Metadata _not_ included for each discount type. |\n| [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. |\n| [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
- Includes `metadata` for each discount type. |\n| [\"category\"] | - Returns an expanded `categories` object, showing details about the category. |", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/19_req_validations" - }, - "examples": { - "1 Redeemable": { - "value": { - "customer": { - "source_id": "sample_customer", - "metadata": { - "key": "value" - } - }, - "options": { - "expand": [ - "order", - "redeemable", - "category" - ] - }, - "redeemables": [ - { - "object": "voucher", - "id": "voucher-code" - } - ], - "session": { - "type": "LOCK" + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_req_examine_qualification" }, - "order": { - "amount": 55000, - "status": "PAID", - "items": [ - { - "quantity": 2, - "price": 20000, - "source_id": "sample product1", - "related_object": "product", - "product": { - "metadata": { - "key": "value" - } - } - }, - { - "quantity": 1, - "price": 15000, - "source_id": "sample product2", - "related_object": "product", - "product": { + "examples": { + "Example": { + "value": { + "customer": { + "source_id": "source-id", "metadata": { "key": "value" } + }, + "order": { + "amount": 10000, + "items": [ + { + "product_id": "product-id", + "quantity": "1", + "price": 10000, + "related_object": "product", + "product": { + "metadata": { + "key": "value" + } + } + } + ] + }, + "metadata": { + "key": "value" } } - ], - "metadata": { - "key": "value" } } } + } + }, + "responses": { + "200": { + "description": "This operation returns the list of valid and active campaigns based on the qualification of a given context (e.g., customer profile, redemptions metadata, order).\n\n[Read](doc:checking-eligibility-for-coupons) about Qualification API limits before you start.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_res_examine_qualification" + } + } + } + } + } + } + }, + "/v1/campaigns/{campaignId}/enable": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" }, - "5 Redeemables": { - "value": { - "customer": { - "source_id": "36_bob" - }, - "options": { - "expand": [ - "order", - "redeemable", - "category" - ] - }, - "redeemables": [ - { - "object": "voucher", - "id": "GNcuPKGe" - }, - { - "object": "voucher", - "id": "AnsvocvP", - "reward": { - "id": "rew_EPx1hCTpqzF0HW1z9NKckZH4" - } - }, - { - "object": "voucher", - "id": "M3X8IwW8", - "gift": { - "credits": 100 + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value." + } + ], + "post": { + "operationId": "enable-campaign", + "tags": [ + "CAMPAIGNS API" + ], + "summary": "Enable Campaign", + "description": "There are various times when you'll want to manage a campaign's accessibility. This can be done by two API methods for managing the campaign state - *enable* and *disable*. \n\nSets campaign state to **active**. The vouchers in this campaign can be redeemed - only if the redemption occurs after the start date of the campaign and voucher and the voucher and campaign are not expired.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns an empty json `{}`.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/res_empty_json" + }, + "examples": { + "Empty JSON": { + "value": {} } - }, - { - "object": "promotion_tier", - "id": "promo_DE1N30D731Tg2F6NoMwNas2W" - }, - { - "object": "promotion_tier", - "id": "promo_NDHgTg4VnOLYNjk9r7WOmQxf" } - ], - "session": { - "type": "LOCK" - }, - "order": { - "items": [ - { - "sku_id": "sku_0a3efc90375d1217e2", - "quantity": 1 - }, - { - "product_id": "prod_0bc3bd8a4e072c5275", - "quantity": 1 + } + } + }, + "404": { + "description": "Returns an error if the campaign cannot be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id camp_h8RyP6FV94F3Ev2odP24j5p", + "request_id": "v-0adaf4847c9502879b", + "resource_id": "camp_h8RyP6FV94F3Ev2odP24j5p", + "resource_type": "campaign" + } } - ] + } } } } } } - } - }, - "responses": { - "200": { - "description": "All codes and tiers provided in redeemables are validated during the request and the result of their validation is returned in the API response. \n\n| **Response** | **Description** |\n|:---|:---|\n| valid
`boolean` | If **all** redeemables can be applied in the given context, the API returns `true`. Otherwise, if at least one redeemable can't be applied, the API returns `false`. |\n| redeemables
`array of objects` | The `redeemables` array lists the validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"` |\n| order
`object` | The `order` object presents details of the order provided in the request after all discounts are applied. |\n", - "content": { - "application/json": { + }, + "/v1/campaigns/{campaignId}/disable": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/19_res_validations" + "type": "string", + "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" }, - "examples": { - "False": { - "value": { - "valid": false, - "redeemables": [ - { - "status": "INAPPLICABLE", - "id": "eee33463", - "object": "voucher", - "result": { - "error": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id eee33463", - "request_id": "v-0c6c6e20dc42940f0b", - "resource_id": "eee33463", - "resource_type": "voucher" - } + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the campaign being disabled. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value." + } + ], + "post": { + "operationId": "disable-campaign", + "tags": [ + "CAMPAIGNS API" + ], + "summary": "Disable Campaign", + "description": "There are various times when you'll want to manage a campaign's accessibility. This can be done by two API methods for managing the campaign state - *enable* and *disable*. \n\nSets campaign state to **inactive**. The vouchers in this campaign can no longer be redeemed.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns an empty json `{}`.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/res_empty_json" + }, + "examples": { + "Empty JSON": { + "value": {} + } + } + } + } + }, + "404": { + "description": "Returns an error if the campaign cannot be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id Spring Campaign", + "request_id": "v-0adaf3735116bb298b", + "resource_id": "Spring Campaign", + "resource_type": "campaign" } - }, - { - "status": "SKIPPED", - "id": "promo_Mwy9XpA0TLctSGriM5kum0qp", - "object": "promotion_tier", - "result": {} } - ], - "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==" + } + } + } + } + } + } + }, + "/v1/promotion-tier-object": { + "get": { + "operationId": "promotion-tier-object", + "tags": [ + "PROMOTIONS API" + ], + "summary": "Promotion Tier Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Promotion Tier Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_obj_promotion_tier_object" + } } + } + } + } + } + }, + "/v1/promotions/tiers": { + "get": { + "operationId": "list-promotion-tiers", + "tags": [ + "PROMOTIONS API" + ], + "summary": "List Promotion Tiers", + "description": "This method enables you to list promotion tiers.", + "parameters": [ + { + "schema": { + "type": "boolean" }, - "True - 5 Redeemables": { - "value": { - "valid": true, - "redeemables": [ - { - "status": "APPLICABLE", - "id": "GNcuPKGe", - "object": "voucher", - "order": { - "amount": 2700, - "items_discount_amount": 1700, - "total_discount_amount": 1700, - "total_amount": 1000, - "items_applied_discount_amount": 1700, - "total_applied_discount_amount": 1700, - "items": [ + "in": "query", + "name": "is_available", + "description": "This parameter allows filtering promotions that are only available at the moment. When set to `true`, it selects only non-expired and active promotions." + }, + { + "schema": { + "type": "integer" + }, + "in": "query", + "name": "limit", + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "description": "Which page of results to return.", + "name": "page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + }, + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with a `tiers` property that contains an array of promotion tiers.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_res_list_promotion_tiers" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "tiers", + "tiers": [ { - "object": "order_item", - "product_id": "prod_s3C0nDpr0DuC7", - "sku_id": "sku_0a3efc90375d1217e2", - "quantity": 1, - "amount": 2000, - "discount_amount": 1000, - "applied_discount_amount": 1000, - "price": 2000, - "subtotal_amount": 1000, - "product": { - "id": "prod_s3C0nDpr0DuC7", - "source_id": "test_prod_id_2", - "name": "Watchflix" + "id": "promo_NzjTc3ZXTe7md5SziK3uYtei", + "created_at": "2022-09-21T11:38:34.962Z", + "name": "Order more than $100", + "banner": "Order more than $100", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 3000, + "effect": "APPLY_TO_ORDER" + } }, - "sku": { - "id": "sku_0a3efc90375d1217e2", - "source_id": "test_standard_ultra_hd", - "sku": "Premium", - "price": 2000 - } - }, - { - "object": "order_item", - "product_id": "prod_0bc3bd8a4e072c5275", - "quantity": 1, - "amount": 700, - "discount_amount": 700, - "applied_discount_amount": 700, - "price": 700, - "subtotal_amount": 0, - "product": { - "id": "prod_0bc3bd8a4e072c5275", - "name": "Bouquet - Romantic Roses", - "price": 700 - } - } - ], - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "applicable_to": { - "data": [ - { - "object": "products_collection", - "id": "pc_a11pr0dUc75", - "strict": false, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "sku", - "id": "sku_0a3efc90375d1217e2", - "source_id": "test_standard_ultra_hd", - "product_id": "prod_s3C0nDpr0DuC7", - "product_source_id": "test_prod_id_2", - "strict": true, - "effect": "APPLY_TO_EVERY" + "metadata": {}, + "hierarchy": 1, + "promotion_id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "campaign": { + "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": { + "interval": "P3D", + "duration": "P2D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": true, + "category_id": "cat_0bb81a481615a37b5e", + "object": "campaign" + }, + "campaign_id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "active": true, + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": { + "interval": "P3D", + "duration": "P2D" + }, + "validity_day_of_week": [ + 1, + 2 + ], + "summary": { + "redemptions": { + "total_redeemed": 0 + }, + "orders": { + "total_amount": 0, + "total_discount_amount": 0 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": null }, { - "object": "product", - "id": "prod_0bc3bd8a4e072c5275", - "source_id": "prod_0bc3bd8a4e072c5275", - "strict": true, - "effect": "APPLY_TO_EVERY" - } - ], - "total": 3, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "result": { - "discount": { - "type": "AMOUNT", - "effect": "APPLY_TO_ITEMS", - "amount_off": 1000, - "is_dynamic": false - } - }, - "metadata": {}, - "categories": [] - }, - { - "status": "APPLICABLE", - "id": "AnsvocvP", - "object": "voucher", - "order": { - "amount": 2700, - "items_discount_amount": 1700, - "total_discount_amount": 1700, - "total_amount": 1000, - "items": [ - { - "object": "order_item", - "product_id": "prod_s3C0nDpr0DuC7", - "sku_id": "sku_0a3efc90375d1217e2", - "quantity": 1, - "amount": 2000, - "discount_amount": 1000, - "price": 2000, - "subtotal_amount": 1000, - "product": { - "id": "prod_s3C0nDpr0DuC7", - "source_id": "test_prod_id_2", - "name": "Watchflix" + "id": "promo_RaYHtUBre5jU8frUXOvYBtlN", + "created_at": "2021-12-15T11:34:01.358Z", + "updated_at": "2022-02-09T09:20:08.619Z", + "name": "Hot Promotion - Tier 2", + "banner": "Get Tier 2 Discount $20 Off", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 2000, + "effect": "APPLY_TO_ORDER" + } }, - "sku": { - "id": "sku_0a3efc90375d1217e2", - "source_id": "test_standard_ultra_hd", - "sku": "Premium", - "price": 2000 + "metadata": {}, + "hierarchy": 2, + "promotion_id": "camp_5h0wc453_5", + "campaign": { + "id": "camp_5h0wc453_5", + "start_date": null, + "expiration_date": null, + "active": true, + "category_id": "cat_0b688929a2476386a6", + "object": "campaign" + }, + "campaign_id": "camp_5h0wc453_5", + "active": true, + "summary": { + "redemptions": { + "total_redeemed": 33 + }, + "orders": { + "total_amount": 519200, + "total_discount_amount": 66000 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_pEe1inoYSfmO12p7", + "rule_id": "val_5h0wc453_5", + "related_object_id": "promo_RaYHtUBre5jU8frUXOvYBtlN", + "related_object_type": "promotion_tier", + "created_at": "2021-12-15T11:34:01.358Z", + "object": "validation_rules_assignment" + } + ], + "total": 1 } }, { - "object": "order_item", - "product_id": "prod_0bc3bd8a4e072c5275", - "quantity": 1, - "amount": 700, - "discount_amount": 700, - "price": 700, - "subtotal_amount": 0, - "product": { - "id": "prod_0bc3bd8a4e072c5275", - "name": "Bouquet - Romantic Roses", - "price": 700 + "id": "promo_63fYCt81Aw0h7lzyRkrGZh9p", + "created_at": "2021-12-15T11:34:01.333Z", + "updated_at": "2022-02-09T09:20:05.603Z", + "name": "Hot Promotion - Tier 1", + "banner": "Get Tier 1 Discount 10zl", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 1000, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": { + "ProductionMetaData": "Hot Promotion - Tier 1" + }, + "hierarchy": 1, + "promotion_id": "camp_5h0wc453_5", + "campaign": { + "id": "camp_5h0wc453_5", + "start_date": null, + "expiration_date": null, + "active": true, + "category_id": "cat_0b688929a2476386a6", + "object": "campaign" + }, + "campaign_id": "camp_5h0wc453_5", + "active": true, + "summary": { + "redemptions": { + "total_redeemed": 11 + }, + "orders": { + "total_amount": 1414979, + "total_discount_amount": 11000 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_QqYs7GGVy7cuh3L9", + "rule_id": "val_5h0wc453_4", + "related_object_id": "promo_63fYCt81Aw0h7lzyRkrGZh9p", + "related_object_type": "promotion_tier", + "created_at": "2021-12-15T11:34:01.333Z", + "object": "validation_rules_assignment" + } + ], + "total": 1 } } ], - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "result": { - "loyalty_card": { - "points": 4 - } - }, - "metadata": {}, - "categories": [ - { - "id": "cat_0bb81a481615a37b5e", - "name": "Second", - "hierarchy": 2, - "created_at": "2022-09-20T05:58:01.561Z", - "object": "category" - } - ] - }, - { - "status": "APPLICABLE", - "id": "M3X8IwW8", - "object": "voucher", - "order": { - "amount": 2700, - "discount_amount": 100, - "items_discount_amount": 1700, - "total_discount_amount": 1800, - "total_amount": 900, - "applied_discount_amount": 100, - "total_applied_discount_amount": 100, - "items": [ + "total": 3 + } + } + } + } + } + } + } + } + }, + "/client/v1/promotions/tiers": { + "get": { + "operationId": "list-promotion-tiers-client-side", + "tags": [ + "PROMOTIONS API" + ], + "summary": "List Promotion Tiers (client-side)", + "description": "This method enables you to list promotion tiers.", + "parameters": [ + { + "schema": { + "type": "boolean" + }, + "in": "query", + "name": "is_available", + "description": "This parameter allows filtering promotions that are only available at the moment. When set to `true`, it selects only non-expired and active promotions." + }, + { + "schema": { + "type": "integer" + }, + "in": "query", + "name": "limit", + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "description": "Which page of results to return.", + "name": "page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + }, + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." + }, + { + "$ref": "#/components/parameters/origin" + } + ], + "security": [ + { + "X-Client-Application-Id-1": [], + "X-Client-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with a `tiers` property that contains an array of promotion tiers.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_res_list_promotion_tiers" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "tiers", + "tiers": [ { - "object": "order_item", - "product_id": "prod_s3C0nDpr0DuC7", - "sku_id": "sku_0a3efc90375d1217e2", - "quantity": 1, - "amount": 2000, - "discount_amount": 1000, - "price": 2000, - "subtotal_amount": 1000, - "product": { - "id": "prod_s3C0nDpr0DuC7", - "source_id": "test_prod_id_2", - "name": "Watchflix" + "id": "promo_NzjTc3ZXTe7md5SziK3uYtei", + "created_at": "2022-09-21T11:38:34.962Z", + "name": "Order more than $100", + "banner": "Order more than $100", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 3000, + "effect": "APPLY_TO_ORDER" + } }, - "sku": { - "id": "sku_0a3efc90375d1217e2", - "source_id": "test_standard_ultra_hd", - "sku": "Premium", - "price": 2000 - } + "metadata": {}, + "hierarchy": 1, + "promotion_id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "campaign": { + "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": { + "interval": "P3D", + "duration": "P2D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": true, + "category_id": "cat_0bb81a481615a37b5e", + "object": "campaign" + }, + "campaign_id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "active": true, + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": { + "interval": "P3D", + "duration": "P2D" + }, + "validity_day_of_week": [ + 1, + 2 + ], + "summary": { + "redemptions": { + "total_redeemed": 0 + }, + "orders": { + "total_amount": 0, + "total_discount_amount": 0 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": null }, { - "object": "order_item", - "product_id": "prod_0bc3bd8a4e072c5275", - "quantity": 1, - "amount": 700, - "discount_amount": 700, - "price": 700, - "subtotal_amount": 0, - "product": { - "id": "prod_0bc3bd8a4e072c5275", - "name": "Bouquet - Romantic Roses", - "price": 700 - } - } - ], - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "result": { - "gift": { - "credits": 100 - } - }, - "metadata": {}, - "categories": [] - }, - { - "status": "APPLICABLE", - "id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "object": "promotion_tier", - "order": { - "amount": 2700, - "discount_amount": 460, - "items_discount_amount": 1700, - "total_discount_amount": 2160, - "total_amount": 540, - "applied_discount_amount": 360, - "total_applied_discount_amount": 360, - "items": [ - { - "object": "order_item", - "product_id": "prod_s3C0nDpr0DuC7", - "sku_id": "sku_0a3efc90375d1217e2", - "quantity": 1, - "amount": 2000, - "discount_amount": 1000, - "price": 2000, - "subtotal_amount": 1000, - "product": { - "id": "prod_s3C0nDpr0DuC7", - "source_id": "test_prod_id_2", - "name": "Watchflix" + "id": "promo_RaYHtUBre5jU8frUXOvYBtlN", + "created_at": "2021-12-15T11:34:01.358Z", + "updated_at": "2022-02-09T09:20:08.619Z", + "name": "Hot Promotion - Tier 2", + "banner": "Get Tier 2 Discount $20 Off", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 2000, + "effect": "APPLY_TO_ORDER" + } }, - "sku": { - "id": "sku_0a3efc90375d1217e2", - "source_id": "test_standard_ultra_hd", - "sku": "Premium", - "price": 2000 + "metadata": {}, + "hierarchy": 2, + "promotion_id": "camp_5h0wc453_5", + "campaign": { + "id": "camp_5h0wc453_5", + "start_date": null, + "expiration_date": null, + "active": true, + "category_id": "cat_0b688929a2476386a6", + "object": "campaign" + }, + "campaign_id": "camp_5h0wc453_5", + "active": true, + "summary": { + "redemptions": { + "total_redeemed": 33 + }, + "orders": { + "total_amount": 519200, + "total_discount_amount": 66000 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_pEe1inoYSfmO12p7", + "rule_id": "val_5h0wc453_5", + "related_object_id": "promo_RaYHtUBre5jU8frUXOvYBtlN", + "related_object_type": "promotion_tier", + "created_at": "2021-12-15T11:34:01.358Z", + "object": "validation_rules_assignment" + } + ], + "total": 1 } }, { - "object": "order_item", - "product_id": "prod_0bc3bd8a4e072c5275", - "quantity": 1, - "amount": 700, - "discount_amount": 700, - "price": 700, - "subtotal_amount": 0, - "product": { - "id": "prod_0bc3bd8a4e072c5275", - "name": "Bouquet - Romantic Roses", - "price": 700 + "id": "promo_63fYCt81Aw0h7lzyRkrGZh9p", + "created_at": "2021-12-15T11:34:01.333Z", + "updated_at": "2022-02-09T09:20:05.603Z", + "name": "Hot Promotion - Tier 1", + "banner": "Get Tier 1 Discount 10zl", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 1000, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": { + "ProductionMetaData": "Hot Promotion - Tier 1" + }, + "hierarchy": 1, + "promotion_id": "camp_5h0wc453_5", + "campaign": { + "id": "camp_5h0wc453_5", + "start_date": null, + "expiration_date": null, + "active": true, + "category_id": "cat_0b688929a2476386a6", + "object": "campaign" + }, + "campaign_id": "camp_5h0wc453_5", + "active": true, + "summary": { + "redemptions": { + "total_redeemed": 11 + }, + "orders": { + "total_amount": 1414979, + "total_discount_amount": 11000 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_QqYs7GGVy7cuh3L9", + "rule_id": "val_5h0wc453_4", + "related_object_id": "promo_63fYCt81Aw0h7lzyRkrGZh9p", + "related_object_type": "promotion_tier", + "created_at": "2021-12-15T11:34:01.333Z", + "object": "validation_rules_assignment" + } + ], + "total": 1 } } ], - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "applicable_to": { - "data": [ + "total": 3 + } + } + } + } + } + } + } + } + }, + "/v1/promotions/{campaignId}/tiers": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID assigned by Voucherify." + } + ], + "get": { + "operationId": "list-promotion-tiers-from-campaign", + "tags": [ + "PROMOTIONS API" + ], + "summary": "List Promotion Tiers from Campaign", + "description": "This method enables you to list promotion tiers from a specified campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with a `tiers` property that contains an array of promotion tiers.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_res_list_promotion_tiers_from_campaign" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "tiers", + "tiers": [ { - "object": "sku", - "id": "sku_0a3efc90375d1217e2", - "source_id": "test_standard_ultra_hd", - "product_id": "prod_s3C0nDpr0DuC7", - "product_source_id": "test_prod_id_2", - "strict": true, - "effect": "APPLY_TO_EVERY" + "id": "promo_xyOKjAmysZrwt3aqq1dMUwMU", + "created_at": "2022-04-07T08:43:53.730Z", + "updated_at": "2022-08-26T05:22:43.220Z", + "name": "Amount", + "banner": "Get $10 off entire order", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 1000, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": {}, + "hierarchy": 2, + "promotion_id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", + "campaign": { + "id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", + "start_date": null, + "expiration_date": null, + "active": true, + "category_id": "cat_0b5f67863083bf7c05", + "object": "campaign" + }, + "campaign_id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", + "active": true, + "summary": { + "redemptions": { + "total_redeemed": 1 + }, + "orders": { + "total_amount": 2187, + "total_discount_amount": 1000 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": null }, { - "object": "product", - "id": "prod_0bc3bd8a4e072c5275", - "source_id": "prod_0bc3bd8a4e072c5275", - "strict": true, - "effect": "APPLY_TO_EVERY" + "id": "promo_CQonGnrsFAdEJfJQ3oKB3a8G", + "created_at": "2022-04-07T08:43:53.581Z", + "updated_at": "2022-08-26T05:22:43.008Z", + "name": "Percentage", + "banner": "Get 10% OFF on entire order", + "action": { + "discount": { + "type": "PERCENT", + "percent_off": 10, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": {}, + "hierarchy": 1, + "promotion_id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", + "campaign": { + "id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", + "start_date": null, + "expiration_date": null, + "active": true, + "category_id": "cat_0b5f67863083bf7c05", + "object": "campaign" + }, + "campaign_id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", + "active": true, + "summary": { + "redemptions": { + "total_redeemed": 1 + }, + "orders": { + "total_amount": 71600, + "total_discount_amount": 7160 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": null } ], "total": 2, - "data_ref": "data", - "object": "list" + "has_more": false + } + } + } + } + } + } + } + }, + "post": { + "operationId": "add-promotion-tier-to-campaign", + "tags": [ + "PROMOTIONS API" + ], + "summary": "Add Promotion Tier to Campaign", + "description": "This method allows you to add a new promotion tier to an existing campaign. The tier hierarchy will be set as the next consequtive integer following the lowest ranking tier.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the promotion tier parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_req_add_promotion_tier_to_campaign" + }, + "examples": { + "Example": { + "value": { + "name": "Order more than $100", + "banner": "Order more than $100", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 3000, + "effect": "APPLY_TO_ORDER" + } }, - "inapplicable_to": { - "data": [ - { - "object": "product", - "id": "prod_0b2c2ddf35150b83bb", - "source_id": "97", - "strict": false, - "effect": "APPLY_TO_EVERY" + "metadata": {}, + "active": true, + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4 + ], + "validation_rules": [ + "val_q8qUBMOh5qIQ" + ] + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a promotion tier object if the promotion tier was successfully added to the campaign.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_obj_promotion_tier_object" + }, + "examples": { + "Example": { + "value": { + "id": "promo_JcYGIKJsnv0SpZcx2njZm69x", + "created_at": "2022-09-22T11:21:57.808Z", + "name": "Order more than $100", + "banner": "Order more than $100", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 3000, + "effect": "APPLY_TO_ORDER" } + }, + "metadata": {}, + "hierarchy": 6, + "campaign": { + "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": true, + "object": "campaign" + }, + "campaign_id": null, + "active": true, + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4 ], - "total": 1, - "data_ref": "data", - "object": "list" - }, - "result": { + "summary": { + "redemptions": { + "total_redeemed": 0 + }, + "orders": { + "total_amount": 0, + "total_discount_amount": 0 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_AmeYPmiLZKaIxq01", + "rule_id": "val_q8qUBMOh5qIQ", + "related_object_id": "promo_JcYGIKJsnv0SpZcx2njZm69x", + "related_object_type": "promotion_tier", + "created_at": "2022-09-22T11:21:57.808Z", + "object": "validation_rules_assignment" + } + ], + "total": 1 + } + } + } + } + } + } + } + } + } + }, + "/v1/promotions/tiers/{promotionTierId}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "promo_2EnAik6Jt7dKTOMkRTIgEjZH" + }, + "name": "promotionTierId", + "in": "path", + "required": true, + "description": "Unique promotion tier ID." + } + ], + "get": { + "operationId": "get-promotion-tier", + "tags": [ + "PROMOTIONS API" + ], + "summary": "Get Promotion Tier", + "description": "This method enables you to retrieve a specific promotion tier.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a promotion tier object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_obj_promotion_tier_object" + } + } + } + } + } + }, + "put": { + "operationId": "update-promotion-tier", + "tags": [ + "PROMOTIONS API" + ], + "summary": "Update Promotion Tier", + "description": "This method updates a promotion tier.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the promotion tier parameters that you would like to update.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_req_update_promotion_tier" + }, + "examples": { + "Example": { + "value": { + "name": "Order more than $100 USD", + "banner": "Order more than $100 USD", + "action": { "discount": { "type": "PERCENT", - "effect": "APPLY_TO_ORDER", - "percent_off": 40, - "is_dynamic": false + "percent_off": 25, + "effect": "APPLY_TO_ORDER" } }, - "metadata": {} - }, - { - "status": "APPLICABLE", - "id": "promo_NDHgTg4VnOLYNjk9r7WOmQxf", - "object": "promotion_tier", - "order": { - "amount": 2700, - "discount_amount": 490, - "items_discount_amount": 1700, - "total_discount_amount": 2190, - "total_amount": 510, - "applied_discount_amount": 30, - "total_applied_discount_amount": 30, - "items": [ - { - "object": "order_item", - "product_id": "prod_s3C0nDpr0DuC7", - "sku_id": "sku_0a3efc90375d1217e2", - "quantity": 1, - "amount": 2000, - "discount_amount": 1000, - "price": 2000, - "subtotal_amount": 1000, - "product": { - "id": "prod_s3C0nDpr0DuC7", - "source_id": "test_prod_id_2", - "name": "Watchflix" - }, - "sku": { - "id": "sku_0a3efc90375d1217e2", - "source_id": "test_standard_ultra_hd", - "sku": "Premium", - "price": 2000 - } - }, - { - "object": "order_item", - "product_id": "prod_0bc3bd8a4e072c5275", - "quantity": 1, - "amount": 700, - "discount_amount": 700, - "price": 700, - "subtotal_amount": 0, - "product": { - "id": "prod_0bc3bd8a4e072c5275", - "name": "Bouquet - Romantic Roses", - "price": 700 - } + "metadata": { + "level": "A-21" + }, + "hierarchy": 1, + "start_date": "2022-09-22T00:00:00.000Z", + "expiration_date": "2022-09-29T00:00:00.000Z", + "validity_timeframe": { + "interval": "P3D", + "duration": "P2D" + }, + "validity_day_of_week": [ + 1, + 2, + 3 + ] + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a promotion tier object if the update was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_obj_promotion_tier_object" + }, + "examples": { + "Example": { + "value": { + "id": "promo_hINAfBAVhmFuSAzi3vptfyxW", + "created_at": "2022-09-22T12:40:23.286Z", + "updated_at": "2022-09-22T12:40:58.626Z", + "name": "Order more than $100 USD", + "banner": "Order more than $100 USD", + "action": { + "discount": { + "type": "PERCENT", + "percent_off": 25, + "effect": "APPLY_TO_ORDER" } + }, + "metadata": { + "level": "A-21" + }, + "hierarchy": 1, + "campaign": { + "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": true, + "object": "campaign" + }, + "campaign_id": null, + "active": false, + "start_date": "2022-09-22T00:00:00.000Z", + "expiration_date": "2022-09-29T00:00:00.000Z", + "validity_timeframe": { + "interval": "P3D", + "duration": "P2D" + }, + "validity_day_of_week": [ + 1, + 2, + 3 ], - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "applicable_to": { - "data": [ - { - "object": "sku", - "id": "sku_0a3efc90375d1217e2", - "source_id": "test_standard_ultra_hd", - "product_id": "prod_s3C0nDpr0DuC7", - "product_source_id": "test_prod_id_2", - "strict": true, - "effect": "APPLY_TO_EVERY" + "summary": { + "redemptions": { + "total_redeemed": 0 }, - { - "object": "product", - "id": "prod_0bc3bd8a4e072c5275", - "source_id": "prod_0bc3bd8a4e072c5275", - "strict": true, - "effect": "APPLY_TO_EVERY" - } - ], - "total": 2, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [ - { - "object": "product", - "id": "prod_0b2c2ddf35150b83bb", - "source_id": "97", - "strict": false, - "effect": "APPLY_TO_EVERY" + "orders": { + "total_amount": 0, + "total_discount_amount": 0 } - ], - "total": 1, - "data_ref": "data", - "object": "list" - }, - "result": { - "discount": { - "type": "AMOUNT", - "effect": "APPLY_TO_ORDER", - "amount_off": 30, - "is_dynamic": false + }, + "object": "promotion_tier", + "validation_rule_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_8e3e53ZgDNcoRGAI", + "rule_id": "val_q8qUBMOh5qIQ", + "related_object_id": "promo_hINAfBAVhmFuSAzi3vptfyxW", + "related_object_type": "promotion_tier", + "created_at": "2022-09-22T12:40:23.286Z", + "object": "validation_rules_assignment" + } + ], + "total": 1 } - }, - "metadata": {} + } } - ], - "order": { - "amount": 2700, - "discount_amount": 490, - "items_discount_amount": 1700, - "total_discount_amount": 2190, - "total_amount": 510, - "applied_discount_amount": 490, - "items_applied_discount_amount": 1700, - "total_applied_discount_amount": 2190, - "items": [ - { - "object": "order_item", - "product_id": "prod_s3C0nDpr0DuC7", - "sku_id": "sku_0a3efc90375d1217e2", - "quantity": 1, - "amount": 2000, - "discount_amount": 1000, - "applied_discount_amount": 1000, - "price": 2000, - "subtotal_amount": 1000, - "product": { - "id": "prod_s3C0nDpr0DuC7", - "source_id": "test_prod_id_2", - "name": "Watchflix" - }, - "sku": { - "id": "sku_0a3efc90375d1217e2", - "source_id": "test_standard_ultra_hd", - "sku": "Premium", - "price": 2000 - } - }, - { - "object": "order_item", - "product_id": "prod_0bc3bd8a4e072c5275", - "quantity": 1, - "amount": 700, - "discount_amount": 700, - "applied_discount_amount": 700, - "price": 700, - "subtotal_amount": 0, - "product": { - "id": "prod_0bc3bd8a4e072c5275", - "name": "Bouquet - Romantic Roses", - "price": 700 - } + } + } + } + } + } + }, + "delete": { + "operationId": "delete-promotion-tier", + "tags": [ + "PROMOTIONS API" + ], + "summary": "Delete Promotion Tier", + "description": "This method deletes a promotion tier.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." + }, + "404": { + "description": "Returns an error indicating that the promotion tier with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find promotion_tier with id promo_2EnAik6Jt7dKTOMkRTIgEjZ", + "request_id": "v-0ae284707e9027a79d", + "resource_id": "promo_2EnAik6Jt7dKTOMkRTIgEjZ", + "resource_type": "promotion_tier" } - ], - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "session": { - "key": "ssn_pkJfPcWAgp9WyHpA62Eky8X8SzxpKub2", - "type": "LOCK", - "ttl": 7, - "ttl_unit": "DAYS" + } } } } @@ -65837,698 +52437,636 @@ } } }, - "400": { - "description": "Returns an error if the payload is missing an `\"object\"` or `\"id\"` property in the redeemables array, if you add more than one promotion stack or attempt to join stacks with vouchers/promotion tiers.", - "content": { - "application/json": { + "/v1/promotions/tiers/{promotionTierId}/enable": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_400_invalid_payload" + "type": "string", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" }, - "examples": { - "Invalid payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Property .redeemables[1] should have required property 'id'", - "request_id": "v-0b4ff38ab8c8164573" - } - }, - "Duplicated Redeemables": { - "value": { - "code": 400, - "key": "duplicated_redeemables", - "message": "Duplicated redeemables detected", - "details": "Duplicated redeemables detected in one redemption", - "request_id": "v-0b4ffecfb408165300" - } - }, - "Invalid Redeemables": { - "value": { - "code": 400, - "key": "invalid_redeemables", - "message": "Invalid redeemables", - "details": "Promotion Stack cannot be use with other redeemables", - "request_id": "v-0b5007812f48165d6b" - } - } - } + "name": "promotionTierId", + "in": "path", + "required": true, + "description": "Unique promotion tier ID." } - } - } - } - } - }, - "/client/v1/validations": { - "post": { - "operationId": "validate-stacked-discounts-client-side", - "tags": [ - "STACKABLE DISCOUNTS API" - ], - "summary": "Validate Stackable Discounts (client-side)", - "description": "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.", - "parameters": [ - { - "$ref": "#/components/parameters/origin" - } - ], - "security": [ - { - "X-Client-Application-Id-1": [], - "X-Client-Token-1": [] - } - ], - "requestBody": { - "description": "## Expanded Response \n\nResponses will vary depending on the strings passed in the `options.expand` string array. You can customize the response by using one of the following combinations of strings. \n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redeemable object.
- Metadata _not_ included for each discount type. |\n| [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. |\n| [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
- Includes `metadata` for each discount type. |\n| [\"category\"] | - Returns an expanded `categories` object, showing details about the category. |", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/19_req_validations" - }, - "examples": { - "1 Redeemable": { - "value": { - "customer": { - "source_id": "sample_customer", - "metadata": { - "key": "value" - } - }, - "options": { - "expand": [ - "order", - "redeemable", - "category" - ] - }, - "redeemables": [ - { - "object": "voucher", - "id": "voucher-code" - } - ], - "session": { - "type": "LOCK" - }, - "order": { - "amount": 55000, - "status": "PAID", - "items": [ - { - "quantity": 2, - "price": 20000, - "source_id": "sample product1", - "related_object": "product", - "product": { - "metadata": { - "key": "value" - } - } - }, - { - "quantity": 1, - "price": 15000, - "source_id": "sample product2", - "related_object": "product", - "product": { - "metadata": { - "key": "value" - } + ], + "post": { + "operationId": "enable-promotion-tier", + "tags": [ + "PROMOTIONS API" + ], + "summary": "Enable Promotion Tier", + "description": "This method enables a promotion tier, i.e. makes the `active` parameter = `true`.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns the promotion tier object with an updated `active` parameter.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_obj_promotion_tier_object" + }, + "examples": { + "Example": { + "value": { + "id": "promo_NzjTc3ZXTe7md5SziK3uYtei", + "created_at": "2022-09-21T11:38:34.962Z", + "updated_at": "2022-09-22T10:32:07.712Z", + "name": "Order more than $100", + "banner": "Order more than $100", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 3000, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": {}, + "hierarchy": 1, + "campaign": { + "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": true, + "object": "campaign" + }, + "campaign_id": null, + "active": true, + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "summary": { + "redemptions": { + "total_redeemed": 2 + }, + "orders": { + "total_amount": 37650, + "total_discount_amount": 6000 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": null } } - ], - "metadata": { - "key": "value" } } } }, - "5 Redeemables": { - "value": { - "customer": { - "source_id": "36_bob" - }, - "options": { - "expand": [ - "order", - "redeemable", - "category" - ] - }, - "redeemables": [ - { - "object": "voucher", - "id": "GNcuPKGe" - }, - { - "object": "voucher", - "id": "AnsvocvP", - "reward": { - "id": "rew_EPx1hCTpqzF0HW1z9NKckZH4" - } - }, - { - "object": "voucher", - "id": "M3X8IwW8", - "gift": { - "credits": 100 + "404": { + "description": "Returns an error if the promotion tier cannot be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Example": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find promotion_tier with id promo_NzjTc3ZXTe7md5SziK3uYte", + "request_id": "v-0bbaea52be14cc9782", + "resource_id": "promo_NzjTc3ZXTe7md5SziK3uYte", + "resource_type": "promotion_tier" + } } - }, - { - "object": "promotion_tier", - "id": "promo_DE1N30D731Tg2F6NoMwNas2W" - }, - { - "object": "promotion_tier", - "id": "promo_NDHgTg4VnOLYNjk9r7WOmQxf" } - ], - "session": { - "type": "LOCK" - }, - "order": { - "items": [ - { - "sku_id": "sku_0a3efc90375d1217e2", - "quantity": 1 - }, - { - "product_id": "prod_0bc3bd8a4e072c5275", - "quantity": 1 - } - ] } } } } } - } - }, - "responses": { - "200": { - "description": "All codes and tiers provided in redeemables are validated during the request and the result of their validation is returned in the API response. \n\n| **Response** | **Description** |\n|:---|:---|\n| valid
`boolean` | If **all** redeemables can be applied in the given context, the API returns `true`. Otherwise, if at least one redeemable can't be applied, the API returns `false`. |\n| redeemables
`array of objects` | The `redeemables` array lists the validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"` |\n| order
`object` | The `order` object presents details of the order provided in the request after all discounts are applied. |\n", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/19_res_validations" - } - } - } }, - "400": { - "description": "Returns an error if the payload is missing an `\"object\"` or `\"id\"` property in the redeemables array, if you add more than one promotion stack or attempt to join stacks with vouchers/promotion tiers.", - "content": { - "application/json": { + "/v1/promotions/tiers/{promotionTierId}/disable": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_400_invalid_payload" + "type": "string", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" }, - "examples": { - "Invalid payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Property .redeemables[1] should have required property 'id'", - "request_id": "v-0b4ff38ab8c8164573" - } - }, - "Duplicated Redeemables": { - "value": { - "code": 400, - "key": "duplicated_redeemables", - "message": "Duplicated redeemables detected", - "details": "Duplicated redeemables detected in one redemption", - "request_id": "v-0b4ffecfb408165300" + "name": "promotionTierId", + "in": "path", + "required": true, + "description": "Unique promotion tier ID." + } + ], + "post": { + "operationId": "disable-promotion-tier", + "tags": [ + "PROMOTIONS API" + ], + "summary": "Disable Promotion Tier", + "description": "This method disables a promotion tier, i.e. makes the `active` parameter = `false`.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns the promotion tier object with an updated `active` parameter.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_obj_promotion_tier_object" + }, + "examples": { + "Example": { + "value": { + "id": "promo_NzjTc3ZXTe7md5SziK3uYtei", + "created_at": "2022-09-21T11:38:34.962Z", + "updated_at": "2022-09-22T10:34:09.529Z", + "name": "Order more than $100", + "banner": "Order more than $100", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 3000, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": {}, + "hierarchy": 1, + "campaign": { + "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": true, + "object": "campaign" + }, + "campaign_id": null, + "active": false, + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "summary": { + "redemptions": { + "total_redeemed": 2 + }, + "orders": { + "total_amount": 37650, + "total_discount_amount": 6000 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": null + } + } + } } - }, - "Invalid Redeemables": { - "value": { - "code": 400, - "key": "invalid_redeemables", - "message": "Invalid redeemables", - "details": "Promotion Stack cannot be use with other redeemables", - "request_id": "v-0b5007812f48165d6b" + } + }, + "404": { + "description": "Returns an error if the promotion tier cannot be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Example": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find promotion_tier with id promo_NzjTc3ZXTe7md5SziK3uYte", + "request_id": "v-0bbaea52be14cc9782", + "resource_id": "promo_NzjTc3ZXTe7md5SziK3uYte", + "resource_type": "promotion_tier" + } + } + } } } } } } - } - } - } - }, - "/v1/redemptions/{parentRedemptionId}/rollbacks": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "parentRedemptionId", - "in": "path", - "required": true, - "description": "Unique identifier of a parent redemption, e.g. `r_JQfm73zWSJFQxs3bGxweYjgm`." - } - ], - "post": { - "operationId": "rollback-stacked-redemptions", - "tags": [ - "STACKABLE DISCOUNTS API" - ], - "summary": "Rollback Stackable Redemptions", - "description": "Rollback a stackable redemption. When you rollback a stacked redemption, all child redemptions will be rolled back. Provide the parent redemption ID as the path parameter.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns an array with the individual redemption rollback results along with the parent rollback result and related order.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/19_res_redemptions_parentRedemptionId_rollbacks" - } - } - } }, - "400": { - "description": "Returns an error indicating that the parent redemption ID is invalid.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" + "/v1/promotions/stacks": { + "get": { + "operationId": "list-all-promotion-stacks", + "tags": [ + "PROMOTIONS API" + ], + "summary": "List Promotion Stacks", + "description": "This method enables you to list promotion stacks irrespective of the campaign they are associated with. \n\nYou can use filters in the query parameters to specify the stacks to be returned in the response.\n\n## Advanced filters for fetching promotion stacks\n\n| **Filters** | **Examples** |\n| :--- | :--- |\n| Created Before | - `[created_at][before]=2021-12-30T13:52:18.227Z`
- `[filters][created_at][conditions][$before][0]=2021-12-30T13:52:18.227Z` |\n| Created After | - `[created_at][after]=2021-12-30T13:52:18.227Z`
- `[filters][created_at][conditions][$after][0]=2021-12-30T13:52:18.227Z` |\n| Updated Before | - `[updated_at][before]=2021-12-30T13:52:18.227Z`
- `[filters][updated_at][conditions][$before][0]=2021-12-30T13:52:18.227Z` |\n| Updated After | - `[updated_at][after]=2021-12-30T13:52:18.227Z`
- `[filters][updated_at][conditions][$after][0]=2021-12-30T13:52:18.227Z` |", + "parameters": [ + { + "schema": { + "type": "integer" + }, + "in": "query", + "name": "limit", + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." }, - "examples": { - "Invalid Redemption Parent": { - "value": { - "code": 400, - "key": "invalid_redemption_parent", - "message": "Invalid redemption parent", - "details": "You can rollback only a redemption that does not have parent redemption.", - "request_id": "v-0b56a1cf1e4d69b375" - } + { + "schema": { + "type": "string" + }, + "in": "query", + "description": "Which page of results to return.", + "name": "page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at", + "name", + "-name" + ] }, - "Already rolled back": { - "value": { - "code": 400, - "key": "already_rolled_back", - "message": "Already rolled back", - "details": "Redemption has been already rolled back.", - "request_id": "v-0c67af9544c4e3388f", - "resource_id": "rrf_0c67af954e039be56b", - "resource_type": "redemption_rollback" + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." + }, + { + "$ref": "#/components/parameters/created_at" + }, + { + "$ref": "#/components/parameters/updated_at" + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with a `data` property that contains an array of promotion stacks across all your campaigns.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_res_list_promotion_stacks" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "stack_SLuhQrAt3mXwHg776lYkzZO8", + "name": "Stack 2", + "created_at": "2022-11-03T10:18:58.356Z", + "campaign_id": "camp_h8RyP6FV94F3Ev2odP24j5p1", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_Mfww2TuoeU23enqSmnz0f3rh", + "promo_vU5IHaLKS7mmZ3ylABET6ikb", + "promo_TeHA11JlfN29mUftDcpqIWWq", + "promo_bhKBsIX3tO7yqmpTLCLLuaud" + ], + "hierarchy_mode": "MANUAL" + } + }, + { + "id": "stack_twQWp1TyaxX5RlSqn061xGVy", + "name": "First stack", + "created_at": "2021-12-27T11:59:21.838Z", + "updated_at": "2022-12-16T08:22:51.970Z", + "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_Vet0vCNyyo5pOddHfu2X3FCB", + "promo_PoIyRVFA5c0Jk514xCpzKHga", + "promo_Mwy9XpA0TLctSGriM5kum0qp" + ], + "hierarchy_mode": "MANUAL" + } + }, + { + "id": "stack_vhCqN5PY7rmPw8yACRvHRZaz", + "name": "Second stack", + "created_at": "2021-12-27T11:55:47.431Z", + "updated_at": "2022-12-16T08:22:52.221Z", + "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_Vet0vCNyyo5pOddHfu2X3FCB", + "promo_PoIyRVFA5c0Jk514xCpzKHga", + "promo_Mwy9XpA0TLctSGriM5kum0qp" + ], + "hierarchy_mode": "MANUAL" + } + }, + { + "id": "stack_zwChew7GY1AnDZJQ6GVP2sdT", + "name": "Third stack", + "created_at": "2021-12-27T11:54:26.283Z", + "updated_at": "2022-12-16T08:22:52.483Z", + "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_Vet0vCNyyo5pOddHfu2X3FCB", + "promo_Mwy9XpA0TLctSGriM5kum0qp", + "promo_PoIyRVFA5c0Jk514xCpzKHga" + ], + "hierarchy_mode": "MANUAL" + } + }, + { + "id": "stack_NS5hEUznL9XPa89rbrOZYMey", + "name": "Fourth stack", + "created_at": "2021-12-27T11:48:43.982Z", + "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_Vet0vCNyyo5pOddHfu2X3FCB", + "promo_Mwy9XpA0TLctSGriM5kum0qp", + "promo_PoIyRVFA5c0Jk514xCpzKHga" + ], + "hierarchy_mode": "MANUAL" + } + }, + { + "id": "stack_Rz0NvFtCZOObS3J5R68KET17", + "name": "Third stack", + "created_at": "2021-12-27T11:40:57.426Z", + "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_Vet0vCNyyo5pOddHfu2X3FCB", + "promo_PoIyRVFA5c0Jk514xCpzKHga" + ], + "hierarchy_mode": "MANUAL" + } + }, + { + "id": "stack_e8pH0nIuANmYRPE0x8hwDrpm", + "name": "Second stack", + "created_at": "2021-12-27T08:43:13.875Z", + "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_Mwy9XpA0TLctSGriM5kum0qp", + "promo_PoIyRVFA5c0Jk514xCpzKHga" + ], + "hierarchy_mode": "MANUAL" + } + }, + { + "id": "stack_3Q4EJpZqg3DI5IRwgBYfsb37", + "name": "First stack", + "created_at": "2021-12-27T08:43:13.498Z", + "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_Vet0vCNyyo5pOddHfu2X3FCB", + "promo_PoIyRVFA5c0Jk514xCpzKHga" + ], + "hierarchy_mode": "MANUAL" + } + }, + { + "id": "stack_KxSD0GahLUg9ULB6TseGfUHJ", + "name": "Stack 1", + "created_at": "2021-12-23T12:28:38.881Z", + "campaign_id": "camp_h8RyP6FV94F3Ev2odP24j5p1", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_NMex647s5UushvbBUJmYT2Fc", + "promo_4TqHr24boFISDrcOHSlfAxwm" + ], + "hierarchy_mode": "MANUAL" + } + } + ], + "total": 9 + } + } + } } } } } } - } - } - } - }, - "/v1/loyalty-campaign-object": { - "get": { - "operationId": "loyalty-campaign-object", - "tags": [ - "LOYALTIES API" - ], - "summary": "Loyalty Campaign Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Loyalty Campaign Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_loyalty_campaign_object" - } - } - } - } - } - } - }, - "/v1/loyalty-card-object": { - "get": { - "operationId": "loyalty-card-object", - "tags": [ - "LOYALTIES API" - ], - "summary": "Loyalty Card Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Loyalty Card Object", - "content": { - "application/json": { + }, + "/v1/promotions/{campaignId}/stacks": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/8_obj_loyalty_card_object_non_expanded_categories" - } + "type": "string" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID." } - } - } - } - } - }, - "/v1/loyalty-tier-object": { - "get": { - "operationId": "loyalty-tier-object", - "tags": [ - "LOYALTIES API" - ], - "summary": "Loyalty Tier Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Loyalty Tier Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_loyalty_tier_object" + ], + "get": { + "operationId": "list-promotion-stacks-in-campaign", + "tags": [ + "PROMOTIONS API" + ], + "summary": "List Promotion Stacks in Campaign", + "description": "This method enables you to list promotion stacks from a specified campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] } - } - } - } - } - } - }, - "/v1/earning-object": { - "get": { - "operationId": "earning-rule-object", - "tags": [ - "LOYALTIES API" - ], - "summary": "Earning Rule Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Earning Rule Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_earning_rule_object" + ], + "responses": { + "200": { + "description": "Returns a list of promotion stack objects.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_res_list_promotion_stacks" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "stack_p0WhtyyDU95crobleMpRabhH", + "name": "First stack", + "created_at": "2022-09-22T13:03:25.740Z", + "campaign_id": "camp_99HUWI53bVyLzPN1Fg5TBLWX", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_dJNhAEeV5sR5oPQq1UrUdnMC", + "promo_aaAF8mVAzA0PF1igia2OC63d" + ], + "hierarchy_mode": "MANUAL" + } + }, + { + "id": "stack_XAzn8AFR3Ks3DBPLAQxV7zHe", + "name": "Second stack", + "created_at": "2022-09-22T13:03:25.903Z", + "campaign_id": "camp_99HUWI53bVyLzPN1Fg5TBLWX", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_aaAF8mVAzA0PF1igia2OC63d", + "promo_dJNhAEeV5sR5oPQq1UrUdnMC" + ], + "hierarchy_mode": "MANUAL" + } + } + ], + "total": 2 + } + } + } + } + } } } - } - } - } - } - }, - "/v1/loyalties": { - "get": { - "operationId": "list-loyalty-programs", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Loyalty Campaigns", - "description": "Returns a list of your loyalty campaigns.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ] }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary with loyalty program objects. The loyalty campaigns are returned sorted by creation date, with the most recent campaigns appearing first.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_list_loyalty_campaigns" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "campaigns", - "campaigns": [ - { - "id": "camp_eTIsUtuzkRXQT6rsUQqrS5Gw", - "name": "Loyalty Campaign 1", - "campaign_type": "LOYALTY_PROGRAM", - "type": "AUTO_UPDATE", - "voucher": { - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 0 - }, - "redemption": { - "quantity": null - }, - "code_config": { - "length": 8, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "########" - }, - "is_referral_code": false - }, - "auto_join": false, - "join_once": false, - "use_voucher_metadata_schema": true, - "description": "This is a campaign description.", - "vouchers_count": 6, - "active": true, - "metadata": { - "Season": "Fall" - }, - "created_at": "2022-11-21T13:57:03.712Z", - "updated_at": "2022-11-23T09:59:49.581Z", - "creation_status": "DONE", - "vouchers_generation_status": "DONE", - "protected": false, - "category_id": "cat_0b6152ce12414820dc", - "categories": [], - "object": "campaign" - }, - { - "id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "name": "Loyalty Campaign - Tiers", - "campaign_type": "LOYALTY_PROGRAM", - "type": "AUTO_UPDATE", - "voucher": { - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 0 - }, - "redemption": { - "quantity": null - }, - "code_config": { - "length": 8, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "########", - "prefix": "LT1-", - "initial_count": 1 - }, - "is_referral_code": false, - "start_date": "2022-11-01T00:00:00.000Z" - }, - "auto_join": false, - "join_once": false, - "use_voucher_metadata_schema": true, - "start_date": "2022-11-01T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5, - 6 - ], - "vouchers_count": 3, - "active": true, - "metadata": {}, - "created_at": "2022-11-09T06:26:52.985Z", - "updated_at": "2022-11-10T08:54:46.136Z", - "creation_status": "DONE", - "vouchers_generation_status": "DONE", - "protected": false, - "category_id": "cat_0b8b5a427a0283c854", - "categories": [], - "loyalty_tiers_expiration": { - "qualification_type": "BALANCE", - "start_date": { - "type": "IMMEDIATE" - }, - "expiration_date": { - "type": "CUSTOM", - "extend": "P3M", - "rounding": { - "type": "MONTH", - "strategy": "END" - } - } - }, - "object": "campaign" - }, - { - "id": "camp_NwO6D0Z0mpZ1CDc380DnPgrW", - "name": "Loyalty Campaign Example", - "campaign_type": "LOYALTY_PROGRAM", - "type": "STATIC", - "voucher": { - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 0 - }, - "redemption": { - "quantity": null - }, - "code_config": { - "length": 8, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "########", - "initial_count": 1 - }, - "is_referral_code": false, - "start_date": "2021-12-15T00:00:00.000Z", - "expiration_date": "2021-12-31T00:00:00.000Z", - "validity_timeframe": { - "interval": "P1D", - "duration": "PT1H" - } - }, - "auto_join": true, - "join_once": true, - "use_voucher_metadata_schema": true, - "start_date": "2021-12-15T00:00:00.000Z", - "expiration_date": "2021-12-31T00:00:00.000Z", - "validity_timeframe": { - "interval": "P1D", - "duration": "PT1H" - }, - "validity_day_of_week": [ - 3, - 4, - 5, - 6 - ], - "activity_duration_after_publishing": "P24D", - "vouchers_count": 0, - "active": false, - "metadata": {}, - "created_at": "2021-12-15T08:02:52.298Z", - "updated_at": "2021-12-15T08:11:43.808Z", - "creation_status": "DRAFT", - "vouchers_generation_status": "DRAFT", - "protected": false, - "category_id": null, - "categories": [], - "object": "campaign" + "post": { + "operationId": "create-promotion-stack", + "tags": [ + "PROMOTIONS API" + ], + "summary": "Create Promotion Stack", + "description": "This method creates one promotion stack. The sequence of promotion tier IDs will determine the promotion stacking order.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the order of promotion tiers for the promotion stack.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_req_create_promotion_stack" + }, + "examples": { + "Example": { + "value": { + "name": "Fifth Stack", + "tiers": { + "ids": [ + "promo_aaAF8mVAzA0PF1igia2OC63d", + "promo_t9zdL6XMFk7B8fQ23zxELtdE", + "promo_dJNhAEeV5sR5oPQq1UrUdnMC" + ], + "hierarchy_mode": "MANUAL" + } } - ], - "total": 3 + } } } } - } - } - } - } - }, - "post": { - "operationId": "create-loyalty-program", - "tags": [ - "LOYALTIES API" - ], - "summary": "Create Loyalty Campaign", - "description": "Creates a batch of [loyalty cards](ref:get-member) aggregated in a single loyalty campaign. It also allows you to define a custom codes pattern. \n\n\n> 📘 Global uniqueness\n> All codes are unique across the whole project. Voucherify won't allow to generate the same codes in any of your campaigns.\n\n\n> 🚧 Asyncronous action!\n>\n> This is an asynchronous action, you can't read or modify a newly created campaign until the code generation is completed. See `creation_status` field in the [loyalty campaign object](ref:get-loyalty-program) description.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the loyalty campaign details.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_create_loyalty_cards" }, - "examples": { - "Example": { - "value": { - "name": "Loyalty Program 4", - "description": "This is a campaign description.", - "auto_join": true, - "join_once": true, - "use_voucher_metadata_schema": true, - "start_date": "2016-10-26T00:00:00Z", - "expiration_date": "2024-10-26T00:00:00Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "activity_duration_after_publishing": "P24D", - "category_id": "cat_0b6152ce12414820dc", - "vouchers_count": 2, - "voucher": { - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 0, - "expiration_rules": { - "period_type": "MONTH", - "period_value": 3, - "rounding_type": "END_OF_QUARTER" + "responses": { + "200": { + "description": "Returns a new stack object if a valid promotion campaign identifier was provided in the path and available promotion IDs in the payload.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_obj_promotion_stack_object" + }, + "examples": { + "Example": { + "value": { + "id": "stack_q2AmzFvOMCmg4Wdu5bDBlME6", + "name": "Fifth Stack", + "created_at": "2022-09-23T07:44:53.888Z", + "campaign_id": "camp_99HUWI53bVyLzPN1Fg5TBLWX", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_aaAF8mVAzA0PF1igia2OC63d", + "promo_t9zdL6XMFk7B8fQ23zxELtdE", + "promo_dJNhAEeV5sR5oPQq1UrUdnMC" + ], + "hierarchy_mode": "MANUAL" + } + } } - }, - "redemption": { - "quantity": 2 - }, - "code_config": { - "pattern": "L-CARD-#######" } - }, - "metadata": { - "test": true - }, - "type": "STATIC", - "loyalty_tiers_expiration": { - "qualification_type": "BALANCE", - "start_date": { - "type": "IMMEDIATE" - }, - "expiration_date": { - "type": "CUSTOM", - "extend": "P3M", - "rounding": { - "type": "MONTH", - "strategy": "END" + } + } + }, + "404": { + "description": "Returns an error if the campaign or promotion tier cannot be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Campaign Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id camp_99HUWI53bVyLzPN1Fg5TBLW", + "request_id": "v-0bbc10de5886137afd", + "resource_id": "camp_99HUWI53bVyLzPN1Fg5TBLW", + "resource_type": "campaign" + } + }, + "Promotion Tier Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find promotion_tier with id promo_dJNhAEeV5sR5oPQq1UrUdnM", + "request_id": "v-0bbc11186303fa288a", + "resource_id": "promo_dJNhAEeV5sR5oPQq1UrUdnM", + "resource_type": "promotion_tier" + } } } } @@ -66536,1294 +53074,1656 @@ } } } - } - }, - "responses": { - "200": { - "description": "Returns a campaign object with its settings but without the loyalty card codes.", - "content": { - "application/json": { + }, + "/v1/promotions/{campaignId}/stacks/{stackId}": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/8_obj_loyalty_campaign_object" - }, - "examples": { - "Example": { - "value": { - "id": "camp_wGlqXtnHddb39DvHuuhvvbxi", - "name": "Loyalty Program 4", - "campaign_type": "LOYALTY_PROGRAM", - "type": "STATIC", - "voucher": { - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 0, - "expiration_rules": { - "period_type": "MONTH", - "period_value": 3, - "rounding_type": "END_OF_QUARTER" + "type": "string", + "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty Campaign`. " + }, + { + "schema": { + "type": "string", + "example": "stack_KOIde7AUf08at12lZ1r3OfFL" + }, + "name": "stackId", + "in": "path", + "required": true, + "description": "Promotion stack ID." + } + ], + "get": { + "operationId": "get-promotion-stack", + "tags": [ + "PROMOTIONS API" + ], + "summary": "Get Promotion Stack", + "description": "This method returns the details of a promotion stack, including the promotion tiers grouped within the stack.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a stack object if valid identifiers were provided in the path.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_obj_promotion_stack_object" + }, + "examples": { + "Example": { + "value": { + "id": "stack_p0WhtyyDU95crobleMpRabhH", + "name": "First stack", + "created_at": "2022-09-22T13:03:25.740Z", + "campaign_id": "camp_99HUWI53bVyLzPN1Fg5TBLWX", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_dJNhAEeV5sR5oPQq1UrUdnMC", + "promo_aaAF8mVAzA0PF1igia2OC63d" + ], + "hierarchy_mode": "MANUAL" + } } - }, - "redemption": { - "quantity": 2 - }, - "code_config": { - "length": 7, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "L-CARD-#######" - }, - "is_referral_code": false, - "start_date": "2016-10-26T00:00:00.000Z", - "expiration_date": "2024-10-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P1D", - "duration": "PT1H" - } - }, - "auto_join": true, - "join_once": true, - "use_voucher_metadata_schema": true, - "description": "This is a campaign description.", - "start_date": "2016-10-26T00:00:00.000Z", - "expiration_date": "2024-10-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P1D", - "duration": "PT1H" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "activity_duration_after_publishing": "P24D", - "vouchers_count": 0, - "active": true, - "metadata": { - "test": true - }, - "created_at": "2022-11-29T13:10:30.848Z", - "category": "New Customers", - "creation_status": "IN_PROGRESS", - "vouchers_generation_status": "IN_PROGRESS", - "protected": false, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "category_id": "cat_0b6152ce12414820dc", - "categories": [ - { - "id": "cat_0b6152ce12414820dc", - "name": "New Customers", - "hierarchy": 0, - "created_at": "2022-07-14T20:17:07.657Z", - "object": "category" } - ], - "loyalty_tiers_expiration": { - "qualification_type": "BALANCE", - "start_date": { - "type": "IMMEDIATE" + } + } + } + }, + "404": { + "description": "Returns an error if the campaign or promotion stack cannot be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Stack Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find promotion_stack with id stack_p0WhtyyDU95crobleMpRabh", + "request_id": "v-0bbc0a659591f99d65", + "resource_id": "stack_p0WhtyyDU95crobleMpRabh", + "resource_type": "promotion_stack" + } }, - "expiration_date": { - "type": "CUSTOM", - "extend": "P3M", - "rounding": { - "type": "MONTH", - "strategy": "END" + "Campaign Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id camp_99HUWI53bVyLzPN1Fg5TBLW", + "request_id": "v-0bbc0aa77a0c8b78e8", + "resource_id": "camp_99HUWI53bVyLzPN1Fg5TBLW", + "resource_type": "campaign" } } - }, - "object": "campaign" + } } } } } - } - }, - "409": { - "description": "Returns an error if a loyalty campaign with the same name already exists.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": {} - }, - "examples": { - "Example": { - "value": { - "code": 409, - "key": "duplicate_found", - "message": "Duplicated resource found", - "details": "Duplicated campaign exists with name Loyalty Program 2", - "request_id": "v-0c12951ec58e67577e", - "resource_id": "Loyalty Program 2", - "resource_type": "campaign" + }, + "put": { + "operationId": "update-promotion-stack", + "tags": [ + "PROMOTIONS API" + ], + "summary": "Update Promotion Stack", + "description": "This methods allows for editing an existing stack.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the promotion stack parameters that you would like to update.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_req_create_promotion_stack" + }, + "examples": { + "Example": { + "value": { + "name": "Fifth Stack Modified", + "tiers": { + "ids": [ + "promo_aaAF8mVAzA0PF1igia2OC63d", + "promo_t9zdL6XMFk7B8fQ23zxELtdE" + ], + "hierarchy_mode": "MANUAL" + } + } + } } } } - } - } - } - } - } - }, - "/v1/loyalties/{campaignId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_0dJG7cCAjquzcxWmZ634bA0C" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " - } - ], - "get": { - "operationId": "get-loyalty-program", - "tags": [ - "LOYALTIES API" - ], - "summary": "Get Loyalty Campaign", - "description": "Retrieve a specific loyalty campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a loyalty campaign object for a given loyalty campaign ID. ", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_loyalty_campaign_object" - }, - "examples": { - "Example": { - "value": { - "id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "name": "Loyalty Campaign - Tiers - 1", - "campaign_type": "LOYALTY_PROGRAM", - "type": "AUTO_UPDATE", - "voucher": { - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 0 - }, - "redemption": { - "quantity": null - }, - "code_config": { - "length": 8, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "########", - "prefix": "LT1-", - "initial_count": 1 - }, - "is_referral_code": false, - "start_date": "2022-11-01T00:00:00.000Z" - }, - "auto_join": false, - "join_once": false, - "use_voucher_metadata_schema": true, - "start_date": "2022-11-01T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5, - 6 - ], - "vouchers_count": 3, - "active": true, - "metadata": {}, - "created_at": "2022-11-09T06:26:52.985Z", - "updated_at": "2022-11-10T08:54:46.136Z", - "category": "Eighth", - "creation_status": "DONE", - "vouchers_generation_status": "DONE", - "protected": false, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "category_id": "cat_0b8b5a427a0283c854", - "categories": [ - { - "id": "cat_0b8b5a427a0283c854", - "name": "Eighth", - "hierarchy": 8, - "created_at": "2022-08-16T11:45:54.171Z", - "object": "category" + }, + "responses": { + "200": { + "description": "Returns a promotion stack with updated parameters if the update was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_obj_promotion_stack_object" + }, + "examples": { + "Example": { + "value": { + "id": "stack_q2AmzFvOMCmg4Wdu5bDBlME6", + "name": "Fifth Stack Modified", + "created_at": "2022-09-23T07:44:53.888Z", + "updated_at": "2022-09-23T07:59:44.172Z", + "campaign_id": "camp_99HUWI53bVyLzPN1Fg5TBLWX", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_aaAF8mVAzA0PF1igia2OC63d", + "promo_t9zdL6XMFk7B8fQ23zxELtdE" + ], + "hierarchy_mode": "MANUAL" + } + } } - ], - "loyalty_tiers_expiration": { - "qualification_type": "BALANCE", - "start_date": { - "type": "IMMEDIATE" + } + } + } + } + } + }, + "delete": { + "operationId": "delete-promotion-stack", + "tags": [ + "PROMOTIONS API" + ], + "summary": "Delete Promotion Stack", + "description": "This method deletes a promotion stack.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." + }, + "404": { + "description": "Returns an error indicating that the stack or campaign with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Stack Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find promotion_stack with id stack_KOIde7AUf08at12lZ1r3OfFp", + "request_id": "v-0ae289ca779027b030", + "resource_id": "stack_KOIde7AUf08at12lZ1r3OfFp", + "resource_type": "promotion_stack" + } }, - "expiration_date": { - "type": "CUSTOM", - "extend": "P3M", - "rounding": { - "type": "MONTH", - "strategy": "END" + "Campaign Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id Summer % Promotion", + "request_id": "v-0ae28a621c46af534b", + "resource_id": "Summer % Promotion", + "resource_type": "campaign" } } - }, - "object": "campaign" + } } } } } } }, - "404": { - "description": "Returns an error if the campaign does not exist or has been deleted.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + "/v1/reward-object": { + "get": { + "operationId": "reward-object", + "tags": [ + "REWARDS API" + ], + "summary": "Reward Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Reward object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_obj_reward_object" + } + } + } } } } - } - } - }, - "put": { - "operationId": "update-loyalty-program", - "tags": [ - "LOYALTIES API" - ], - "summary": "Update Loyalty Campaign", - "description": "Updates a loyalty program. \n\nFields other than those specified in the allowed request body payload won't be modified (even if provided they are silently skipped). Any parameters not provided will be left unchanged. \n\nThis method will update the [loyalty cards](ref:get-member) which have not been published or redeemed yet.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the new values for the parameters that you would like to update for the given loyalty campaign.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_update_loyalty_campaign" - }, - "examples": { - "Example": { - "value": { - "description": "This is a campaign description. Updated", - "auto_join": false, - "join_once": false, - "start_date": "2013-10-26T00:00:00Z", - "expiration_date": "2025-10-26T00:00:00Z", - "validity_timeframe": { - "duration": "PT2H", - "interval": "P2D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5, - 6 - ], - "activity_duration_after_publishing": "P25D", - "category_id": "cat_0b6152ce12414820dd", - "loyalty_card": { - "points": 1, - "expiration_rules": { - "period_type": "MONTH", - "period_value": 4, - "rounding_type": "END_OF_YEAR" + }, + "/v1/reward-assignment-object": { + "get": { + "operationId": "reward-assignment-object", + "tags": [ + "REWARDS API" + ], + "summary": "Reward Assignment Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Reward Assignment Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_obj_reward_assignment_object" } - }, - "metadata": { - "test": false - }, - "type": "AUTO_UPDATE", - "loyalty_tiers_expiration": { - "qualification_type": "BALANCE", - "start_date": { - "type": "IMMEDIATE" - }, - "expiration_date": { - "type": "CUSTOM", - "extend": "P4M", - "rounding": { - "type": "CUSTOM", - "unit": "MONTH", - "value": 1 + } + } + } + } + } + }, + "/v1/rewards": { + "get": { + "operationId": "list-rewards", + "tags": [ + "REWARDS API" + ], + "summary": "List Rewards", + "description": "Retrieve rewards.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "example": "rewa_m9hEAu10KsPcLhGXiHG85aY0" + }, + "in": "query", + "name": "assignment_id", + "description": "A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary of reward objects.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_res_list_rewards" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "rew_3e7IqghVtTR7L3xQMSCxjFu2", + "name": "Get $10", + "type": "CAMPAIGN", + "parameters": { + "campaign": { + "id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", + "balance": 1000, + "type": "GIFT_VOUCHERS" + } + }, + "stock": null, + "redeemed": null, + "attributes": {}, + "created_at": "2022-03-10T08:40:20.917Z", + "updated_at": "2022-08-17T07:52:56.965Z", + "metadata": null, + "object": "reward" + }, + { + "id": "rew_nIy4gHpQHle2c3pNMwuj7G6j", + "name": "Get 100 Points", + "type": "CAMPAIGN", + "parameters": { + "campaign": { + "id": "camp_E87CubZLZ8eoQt3c4kAEZsx0", + "balance": 100, + "type": "LOYALTY_PROGRAM" + } + }, + "stock": null, + "redeemed": null, + "attributes": {}, + "created_at": "2022-02-28T11:56:13.764Z", + "updated_at": null, + "metadata": null, + "object": "reward" + }, + { + "id": "rew_BNZ3van6AF2AiquWp8Lfw0xq", + "name": "30% discount", + "type": "CAMPAIGN", + "parameters": { + "campaign": { + "id": "camp_ZtHLATYVpItqmuSqmaz1rZ2Y", + "type": "DISCOUNT_COUPONS" + } + }, + "stock": null, + "redeemed": null, + "attributes": {}, + "created_at": "2022-08-11T09:48:50.609Z", + "updated_at": null, + "metadata": {}, + "object": "reward" + }, + { + "id": "rew_nlV8bgWU1jNO9YWQ7CdZmzq7", + "name": "1 point = $0.01", + "type": "COIN", + "parameters": { + "coin": { + "exchange_ratio": 0.01, + "points_ratio": 1 + } + }, + "stock": null, + "redeemed": null, + "attributes": {}, + "created_at": "2022-08-11T16:45:21.582Z", + "updated_at": null, + "metadata": { + "Type": "0.01" + }, + "object": "reward" + }, + { + "id": "rew_x6FmF1KFdDs06hYPr9lK6ajf", + "name": "Material Reward", + "type": "MATERIAL", + "parameters": { + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619" + } + }, + "stock": "4", + "redeemed": "1", + "attributes": { + "image_url": "https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_wJHdZUAVSpWtYM6ORq4up3I2.png", + "description": "Get a Comic Book in Archie's series." + }, + "created_at": "2022-08-17T07:13:32.781Z", + "updated_at": null, + "metadata": { + "Type": "Personal" + }, + "object": "reward" + } + ], + "total": 5 + } } } } } } } - } - } - }, - "responses": { - "200": { - "description": "Returns the loyalty campaign object if the update succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_loyalty_campaign_object" - }, - "examples": { - "Example": { - "value": { - "id": "camp_wGlqXtnHddb39DvHuuhvvbxi", - "name": "Loyalty Program 4", - "campaign_type": "LOYALTY_PROGRAM", - "type": "AUTO_UPDATE", - "voucher": { - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 1, - "expiration_rules": { - "period_type": "MONTH", - "period_value": 4, - "rounding_type": "END_OF_YEAR" + }, + "post": { + "operationId": "create-reward", + "tags": [ + "REWARDS API" + ], + "summary": "Create Reward", + "description": "Create a new reward.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Define parameters of the new reward.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_req_create_reward" + }, + "examples": { + "Gift card credits": { + "value": { + "name": "Digital - Gift Card Reward", + "type": "CAMPAIGN", + "metadata": { + "Type": "Gift" + }, + "parameters": { + "campaign": { + "id": "camp_hC2GdqYtOmTT45zfhib62cK1", + "balance": 3000 + } } - }, - "redemption": { - "quantity": 2 - }, - "code_config": { - "length": 7, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "L-CARD-#######" - }, - "is_referral_code": false, - "start_date": "2013-10-26T00:00:00.000Z", - "expiration_date": "2025-10-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "PT2H" - } - }, - "auto_join": false, - "join_once": false, - "use_voucher_metadata_schema": true, - "description": "This is a campaign description. Updated", - "start_date": "2013-10-26T00:00:00.000Z", - "expiration_date": "2025-10-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "PT2H" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5, - 6 - ], - "activity_duration_after_publishing": "P25D", - "vouchers_count": 2, - "active": true, - "metadata": { - "test": false - }, - "created_at": "2022-11-29T13:10:30.848Z", - "updated_at": "2022-11-29T14:08:30.655Z", - "category": "Lorem_Ipsum", - "creation_status": "MODIFYING", - "vouchers_generation_status": "MODIFYING", - "protected": false, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "category_id": "cat_0b6152ce12414820dd", - "categories": [ - { - "id": "cat_0b6152ce12414820dd", - "name": "Lorem_Ipsum", - "hierarchy": 0, - "created_at": "2022-07-14T20:17:07.657Z", - "object": "category" } - ], - "loyalty_tiers_expiration": { - "qualification_type": "BALANCE", - "start_date": { - "type": "IMMEDIATE" - }, - "expiration_date": { - "type": "CUSTOM", - "extend": "P4M", - "rounding": { - "type": "CUSTOM", - "strategy": "END", - "unit": "MONTH", - "value": 1 + }, + "Discount Coupon": { + "value": { + "name": "Digital - Discount Coupon", + "type": "CAMPAIGN", + "metadata": { + "Type": "Discount" + }, + "parameters": { + "campaign": { + "id": "camp_hC2GdqYtOmTT45zfhib62cK1" + } + } + } + }, + "Loyalty Points": { + "value": { + "name": "Digital - Loyalty Points Reward", + "type": "CAMPAIGN", + "metadata": { + "Type": "Loyalty Points" + }, + "parameters": { + "campaign": { + "id": "camp_hC2GdqYtOmTT45zfhib62cK1", + "balance": 100 + } + } + } + }, + "Pay with Points": { + "value": { + "name": "Pay with Points Reward", + "type": "COIN", + "metadata": { + "Type": "Coin" + }, + "parameters": { + "coin": { + "exchange_ratio": 900, + "points_ratio": 8000 + } } } }, - "object": "campaign" + "Material Reward": { + "value": { + "name": "Get a Comic Book", + "metadata": { + "Type": "Material" + }, + "type": "MATERIAL", + "parameters": { + "product": { + "id": "prod_0b15f6b9f650c16990", + "sku_id": "sku_0b1621b319d248b79f" + } + }, + "stock": 2, + "attributes": { + "image_url": "https://www.website.com/img_fPHsk9Ob.png", + "description": "Archie's Series" + } + } + } } } } - } - } - } - } - }, - "delete": { - "operationId": "delete-loyalty-program", - "tags": [ - "LOYALTIES API" - ], - "summary": "Delete Loyalty Campaign", - "description": "This method permanently deletes a loyalty campaign and all related loyalty cards. This action cannot be undone. Also, it immediately removes any redemptions on loyalty cards.", - "parameters": [ - { - "schema": { - "type": "boolean" - }, - "in": "query", - "name": "force", - "description": "If this flag is set to `true`, the campaign and related vouchers will be removed permanently. Going forward, the user will be able to create the next campaign with the same name." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns the id of the scheduled asynchronous action, informing you that your request has been accepted and the loyalty campaign will be deleted from the repository asynchronously. To check the deletion status and result, copy the `async_action_id` from the response and pass it using [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" - }, - "examples": { - "Example": { - "value": { - "async_action_id": "aa_0a875d56c805df6601" + }, + "responses": { + "200": { + "description": "Returns a reward object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_obj_reward_object" + }, + "examples": { + "Material": { + "value": { + "id": "rew_Crmu3hu2FKZWZIML59AeAs1n", + "name": "Material Reward", + "type": "MATERIAL", + "parameters": { + "product": { + "id": "prod_0b15f6b9f650c16990", + "sku_id": "sku_0b1621b319d248b79f" + } + }, + "stock": "2", + "redeemed": null, + "attributes": { + "image_url": "https://www.website.com/img_fPH9oOb.png", + "description": "Archie's Series" + }, + "created_at": "2022-08-25T11:20:58.172Z", + "updated_at": null, + "metadata": { + "Type": "Material" + }, + "object": "reward" + } + } + } } } } } } }, - "404": { - "description": "Returns an error indicating that the loyalty campaign with given ID was not found.", - "content": { - "application/json": { + "/v1/rewards/{rewardId}": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_404_not_found" + "type": "string", + "example": "rew_2erjvECLs92GYzKbak3QkyTV" + }, + "name": "rewardId", + "in": "path", + "required": true, + "description": "A unique reward ID." + } + ], + "get": { + "operationId": "get-reward", + "tags": [ + "REWARDS API" + ], + "summary": "Get Reward", + "description": "Retrieve a reward by the reward ID.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a reward object if a valid identifier was provided. ", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_obj_reward_object" + } + } + } }, - "examples": { - "Loyalty Campaign Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id Summer Loyalty Perks", - "request_id": "v-0ae2b0092f50c130c7", - "resource_id": "Summer Loyalty Perks", - "resource_type": "campaign" + "404": { + "description": "Not Found. When requesting a reward that has been deleted or does not exist, the resource will not be returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find reward with id rew_C7wS9eHFDN4CIbXI5PpLSkG", + "request_id": "v-0b8c77bcc890215e35", + "resource_id": "rew_C7wS9eHFDN4CIbXI5PpLSkG", + "resource_type": "reward" + } + } + } } } } } - } - } - } - } - }, - "/v1/loyalties/{campaignId}/members": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID of the loyalty program." - } - ], - "get": { - "operationId": "list-members", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Members", - "description": "Returns a list of your loyalty cards. The loyalty cards are sorted by creation date, with the most recent loyalty cards appearing first.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "$ref": "#/components/parameters/created_at" - }, - { - "$ref": "#/components/parameters/updated_at" - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ] }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a list of loyalty cards within a campaign.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_list_members" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "vouchers", - "vouchers": [ - { - "id": "v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655", - "code": "0PmQ7JQI", - "campaign": "Loyalty Campaign", - "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "category": null, - "category_id": null, - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 0, - "balance": 0 + "put": { + "operationId": "update-reward", + "tags": [ + "REWARDS API" + ], + "summary": "Update Reward", + "description": "Update the details of a reward.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Define the parameters to be updated for the reward.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_req_update_reward" + }, + "examples": { + "Gift card credits": { + "value": { + "name": "Digital - Gift Card Reward", + "metadata": { + "Type": "Gift" }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX19RtPewWeUYb2hiCR6xEhVE3SLdMfCXj3BA/s6uqSwFl2oAKAt9K5dolsdcZcj5Jgaa/YCnKkm63TRuX6OgGJoEggbKMg+wLfCMwBSi4J2v8KXuyqM25wP4r9WAL58Z+z3B1jkALIbjtw==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19RtPewWeUYb2hiCR6xEhVE3SLdMfCXj3BA%2Fs6uqSwFl2oAKAt9K5dolsdcZcj5Jgaa%2FYCnKkm63TRuX6OgGJoEggbKMg%2BwLfCMwBSi4J2v8KXuyqM25wP4r9WAL58Z%2Bz3B1jkALIbjtw%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+hrRfaPMHRRX5aGVz2RpurRBjC2brcHcptPs4Od93qZM51vUXZe4DDzfRbnVrP+BfBtF+pyyQpxCeqbQuB/OuSnP/nzec6n0n/gTb9+XcIYLvvxcbnDbYoVdRFQEbcCxKKo4QzDlqIjQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BhrRfaPMHRRX5aGVz2RpurRBjC2brcHcptPs4Od93qZM51vUXZe4DDzfRbnVrP%2BBfBtF%2BpyyQpxCeqbQuB%2FOuSnP%2Fnzec6n0n%2FgTb9%2BXcIYLvvxcbnDbYoVdRFQEbcCxKKo4QzDlqIjQ%3D%3D" + "parameters": { + "campaign": { + "id": "camp_hC2GdqYtOmTT45zfhib62cK1", + "balance": 3000 } + } + } + }, + "Discount Coupon": { + "value": { + "name": "Digital - Discount Coupon", + "metadata": { + "Type": "Discount" }, - "is_referral_code": false, - "created_at": "2022-04-15T05:48:45.509Z", - "updated_at": "2022-07-01T00:01:57.860Z", - "holder_id": "cust_nk0N1uNQ1YnupAoJGOgvsODC", - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "redeemed_points": 0, - "object": "list", - "url": "/v1/vouchers/0PmQ7JQI/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/0PmQ7JQI/publications?page=1&limit=10" + "parameters": { + "campaign": { + "id": "camp_hC2GdqYtOmTT45zfhib62cK1" + } + } + } + }, + "Loyalty points": { + "value": { + "name": "Digital - Loyalty Points Reward", + "metadata": { + "Type": "Loyalty Points" }, - "object": "voucher" - }, - { - "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", - "code": "MmFAzfDe", - "campaign": "Loyalty Campaign", - "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "category": null, - "category_id": "cat_0b6152ce12414820de", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 13435, - "balance": 13135, - "next_expiration_date": "2022-11-30", - "next_expiration_points": 12 + "parameters": { + "campaign": { + "id": "camp_hC2GdqYtOmTT45zfhib62cK1", + "balance": 100 + } + } + } + }, + "Pay with Points": { + "value": { + "name": "Pay with Points Reward", + "metadata": { + "Type": "Coin" }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX184kVdWUO/msrLg1G0MRf/Cs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk/dXm/QEJ/sulXKDlUMWf+MN7TRG5LB+wuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX184kVdWUO%2FmsrLg1G0MRf%2FCs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk%2FdXm%2FQEJ%2FsulXKDlUMWf%2BMN7TRG5LB%2BwuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/RGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW/cXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FRGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW%2FcXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ%3D%3D" + "parameters": { + "coin": { + "exchange_ratio": 900, + "points_ratio": 8000 } + } + } + }, + "Material Reward": { + "value": { + "name": "Get a Comic Book", + "metadata": { + "Type": "Physical product" }, - "is_referral_code": false, - "created_at": "2022-02-18T14:03:59.954Z", - "updated_at": "2022-11-21T13:49:54.949Z", - "holder_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", - "redemption": { - "quantity": null, - "redeemed_quantity": 1, - "redeemed_points": 300, - "object": "list", - "url": "/v1/vouchers/MmFAzfDe/redemptions?page=1&limit=10" + "parameters": { + "product": { + "id": "prod_0b15f6b9f650c16990", + "sku_id": "sku_0b1621b319d248b79f" + } }, - "publish": { + "stock": 2, + "attributes": { + "image_url": "https://www.website.com/img_fPH9.png", + "description": "Comic book" + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns an updated reward object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_obj_reward_object" + }, + "examples": { + "Material": { + "value": { + "id": "rew_wg2pvCr5LDhCq4uVQZ9LhuZm", + "name": "Get a Comic Book", + "type": "MATERIAL", + "parameters": { + "product": { + "id": "prod_0b15f6b9f650c16990", + "sku_id": "sku_0b1621b319d248b79f" + } + }, + "stock": "2", + "redeemed": null, + "attributes": { + "image_url": "https://www.website.com/img_fPH9.png", + "description": "Comic book" + }, + "created_at": "2022-08-25T10:00:12.794Z", + "updated_at": "2022-08-25T10:06:30.655Z", + "metadata": { + "Type": "Physical product" + }, + "object": "reward" + } + } + } + } + } + }, + "400": { + "description": "Returns an error if the balance parameter is not defined correctly.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_400_invalid_balance" + }, + "examples": { + "Invalid Balance": { + "value": { + "code": 400, + "key": "invalid_balance", + "message": "Property 'parameters.campaign.balance' is invalid", + "details": "Property 'parameters.campaign.balance' must be greater than zero for campaign type: GIFT_VOUCHERS", + "request_id": "v-0b96d2b90dce48855f" + } + } + } + } + } + } + } + }, + "delete": { + "operationId": "delete-reward", + "tags": [ + "REWARDS API" + ], + "summary": "Delete Reward", + "description": "Delete a reward.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." + }, + "400": { + "description": "Bad Request. Returns an error indicating that the reward with given ID is assigned to a resource.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_400_resource_in_use" + }, + "examples": { + "Example": { + "value": { + "code": 400, + "key": "resource_in_use", + "message": "Resource in use", + "details": "Resource reward with id rew_fcYALROsORec6cP0VBItCVfq is in use by reward_assignments with ids [rewa_5WV7H3y2lT3GGl03Xjw29IEc]", + "request_id": "v-0b8c7b967950216291", + "related_object_ids": [ + "rewa_5WV7H3y2lT3GGl03Xjw29IEc" + ], + "related_object_type": "reward_assignment" + } + } + } + } + } + }, + "404": { + "description": "Returns an error indicating that the reward with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Reward Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find reward with id rew_2erjvECLs92GYzKbak3QkyT", + "request_id": "v-0ae29895e8c6b7781a", + "resource_id": "rew_2erjvECLs92GYzKbak3QkyT", + "resource_type": "reward" + } + } + } + } + } + } + } + } + }, + "/v1/rewards/{rewardId}/assignments": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "rewardId", + "in": "path", + "required": true, + "description": "A unique reward ID." + } + ], + "get": { + "operationId": "list-reward-assignments", + "tags": [ + "REWARDS API" + ], + "summary": "List Reward Assignments", + "description": "Retrieve reward assignments by the reward ID.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary of reward assignment objects. Each object contains information regarding the resource to which the reward was assigned and the cost in loyalty points for the reward.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_res_list_reward_assignments" + }, + "examples": { + "Example": { + "value": { "object": "list", - "count": 1, - "url": "/v1/vouchers/MmFAzfDe/publications?page=1&limit=10" - }, - "object": "voucher" + "data_ref": "data", + "data": [ + { + "id": "rewa_PbIRoMXpwe5QhobW4JKu0VjH", + "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", + "related_object_id": "camp_wciTvaOfYmAa3EmIIW3QpXXZ", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 15 + } + }, + "created_at": "2022-08-17T08:13:02.507Z", + "updated_at": null, + "object": "reward_assignment" + }, + { + "id": "rewa_pJYQBXSitK2OVPK3XMXZK76X", + "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", + "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 20 + } + }, + "created_at": "2022-08-24T11:40:22.418Z", + "updated_at": null, + "object": "reward_assignment" + } + ], + "total": 2 + } + } + } + } + } + }, + "404": { + "description": "Returns an error if the given reward is missing, does not exist or was deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find reward with id rew_C7wS9eHFDN4CIbXI5PpLSkGYi", + "request_id": "v-0b95a68c678ad5c765", + "resource_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGYi", + "resource_type": "reward" + } } - ], - "total": 2 + } } } } } - } - } - } - }, - "post": { - "operationId": "add-member", - "tags": [ - "LOYALTIES API" - ], - "summary": "Add Member", - "description": "This method assigns a loyalty card to a customer. It selects a [loyalty card](ref:get-voucher) suitable for publication, adds a publish entry, and returns the published voucher. \n\nA voucher is suitable for publication when it's active and hasn't been published yet. \n\n\n> 📘 Auto-update campaign\n>\n> In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use **auto-update** campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Provide details to whom the loyalty card should be assigned. \n\nYou can choose to either specify the exact loyalty card code that you want to publish from existin (non-assigned) codes, or choose not to specify a voucher code. If you choose not to specify a code in the request paylaod, then the system will choose the next available voucher code available to be assigned to a customer. \n\nYou can also include metadata in the request payload. This metadata will be assigned to the publication object, but will not be returned in the response to this endpoint. To see of publications (assignments of particular codes to customers) and publication metadata, use the [List Publications](ref:list-publications) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_add_member" - }, - "examples": { - "Using source ID": { - "value": { - "customer": "source_customer_1", - "metadata": { - "year": 2022 + }, + "post": { + "operationId": "create-reward-assignment", + "tags": [ + "REWARDS API" + ], + "summary": "Create Reward Assignment", + "description": "Assigns a reward to a specified loyalty campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Provide the campaign ID of the campaign to which the reward is to be assigned and define the cost of the reward in terms of loyalty points.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_req_create_reward_assignment" }, - "channel": "postman", - "voucher": "KpzbHUY5" + "examples": { + "Example": { + "value": { + "campaign": "camp_OTuGGP90PivbvROsRvfM65El", + "parameters": { + "loyalty": { + "points": 39 + } + } + } + } + } } - }, - "Using unique Voucherify assigned ID": { - "value": { - "customer": "cust_8KQmHxAERpgebYcFhSpZRr37", - "metadata": { - "year": 2022 - }, - "channel": "postman", - "voucher": "KpzbHUY5" + } + }, + "responses": { + "200": { + "description": "Returns a reward assignment object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_obj_reward_assignment_object" + }, + "examples": { + "Example": { + "value": { + "id": "rewa_cqD2XE5x8LcD2c1FLlvqikti", + "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", + "related_object_id": "camp_OTuGGP90PivbvROsRvfM65El", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 39 + } + }, + "created_at": "2022-08-24T13:44:42.610Z", + "updated_at": null, + "object": "reward_assignment" + } + } + } + } } }, - "Using source ID in object": { - "value": { - "customer": { - "source_id": "source_customer_1" - }, - "metadata": { - "year": 2022 - }, - "channel": "postman", - "voucher": "KpzbHUY5" + "400": { + "description": "Returns an error if request body parameters are missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_400_missing_param" + }, + "examples": { + "Missing Parameter": { + "value": { + "code": 400, + "key": "missing_param", + "message": "Missing required parameter", + "details": "Parameter 'parameters.loyalty' is required", + "request_id": "v-0b95c7f3684ad5f06d" + } + } + } + } } }, - "Using unique Voucherify assigned ID in object": { - "value": { - "customer": { - "id": "cust_8KQmHxAERpgebYcFhSpZRr37" - }, - "metadata": { - "year": 2022 - }, - "channel": "postman", - "voucher": "KpzbHUY5" + "404": { + "description": "Returns an error when creating a reward assignment for a reward that has been deleted or does not exist.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Reward Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find reward with id rew_C7wS9eHFDN4CIbXI5PpLSkGYi", + "request_id": "v-0b95c0bedf46fcbe83", + "resource_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGYi", + "resource_type": "reward" + } + }, + "Missing Campaign": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id null", + "request_id": "v-0b95c68b12cad5eebb", + "resource_id": null, + "resource_type": "campaign" + } + } + } + } } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns the voucher object that was published to the customer provided in the request payload.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_loyalty_card_object" - }, - "examples": { - "Loyalty Card": { - "value": { - "id": "v_0TxKw1bm0oZuS5lwA8526vze1OBMV1OH", - "code": "KpzbHUY5", - "campaign": "Loyalty Campaign", - "campaign_id": "camp_eTIsUtuzkRXQT6rsUQqrS5Gw", - "category": "New Customers", - "category_id": "cat_0b6152ce12414820dc", - "categories": [ - { - "id": "cat_0b6152ce12414820dc", - "name": "New Customers", - "hierarchy": 0, - "created_at": "2022-07-14T20:17:07.657Z", - "object": "category" + }, + "409": { + "description": "Returns an error if a conflict is found, i.e. an assignment for the reward has already been created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_409_duplicate_found" + }, + "examples": { + "Duplicate Found": { + "value": { + "code": 409, + "key": "duplicate_found", + "message": "Duplicated resource found", + "details": "Duplicated reward_assignment exists with id rewa_q1Ad955TUZS4nVIxplOw9pL3", + "request_id": "v-0b95c78daa06fcc6bb", + "resource_id": "rewa_q1Ad955TUZS4nVIxplOw9pL3", + "resource_type": "reward_assignment" + } } - ], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 0, - "balance": 0 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": { - "Season": "Fall" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+hdZfzUaz448vIsyf7WpvXiDyqFbyw0+P5wMu12w3B5DyYwA7LCSK+Nr7TA7PKGuHOTGxfBieqrhvJo81HiaIJimDOhk+ecEOisMRmHf6XsNckVlyBHmkpBiXWNm8UDwZnXOAG75Usdw==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BhdZfzUaz448vIsyf7WpvXiDyqFbyw0%2BP5wMu12w3B5DyYwA7LCSK%2BNr7TA7PKGuHOTGxfBieqrhvJo81HiaIJimDOhk%2BecEOisMRmHf6XsNckVlyBHmkpBiXWNm8UDwZnXOAG75Usdw%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX19VRXApVvZ9/ArwBd0wNg7s2KZBXrFvPXZdDQyzGj0HbbEIx5TAoXNR9zaE5kzIj9BElzgK82aOMMVnc1sqvr93xw+YeYMnqGqHRZfM78pYC8560Zc3U6IELtxzaJJ0x2uDUe6Dc9XYeg==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19VRXApVvZ9%2FArwBd0wNg7s2KZBXrFvPXZdDQyzGj0HbbEIx5TAoXNR9zaE5kzIj9BElzgK82aOMMVnc1sqvr93xw%2BYeYMnqGqHRZfM78pYC8560Zc3U6IELtxzaJJ0x2uDUe6Dc9XYeg%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-11-21T15:48:57.860Z", - "updated_at": "2022-11-21T15:49:36.671Z", - "holder_id": "cust_8KQmHxAERpgebYcFhSpZRr37", - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "redeemed_points": 0, - "object": "list", - "url": "/v1/vouchers/KpzbHUY5/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/KpzbHUY5/publications?page=1&limit=10" - }, - "object": "voucher" + } } } } } } }, - "400": { - "description": "Returns an error.", - "content": { - "application/json": { + "/v1/rewards/{rewardId}/assignments/{assignmentId}": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_error_no_translation" + "type": "string", + "example": "rew_2erjvECLs92GYzKbak3QkyTV" }, - "examples": { - "No Voucher Suitable for Publication": { - "value": { - "code": 400, - "key": "no_voucher_suitable_for_publication", - "message": "Couldn't find any voucher suitable for publication", - "details": "Couldn't create new vouchers for publication", - "request_id": "v-0c086598620e6704dd" - } - }, - "Voucher already published": { - "value": { - "code": 400, - "key": "voucher_already_published", - "message": "Voucher already published", - "details": "Voucher 'v_ZFjKHQD0d56eMkWkrotJaVbiMuXClRuM' has already been published", - "request_id": "v-0c086aaa7dc24ccfe0" + "name": "rewardId", + "in": "path", + "required": true, + "description": "A unique reward ID." + }, + { + "schema": { + "type": "string", + "example": "rewa_YkwQ5ezNYTQV2geodMVhTpy4" + }, + "name": "assignmentId", + "in": "path", + "required": true, + "description": "A unique reward assignment ID." + } + ], + "put": { + "operationId": "update-reward-assignment", + "tags": [ + "REWARDS API" + ], + "summary": "Update Reward Assignment", + "description": "Update the number of points needed to successfully redeem the reward.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Define the number of points required to exchange for the reward.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_req_update_reward_assignment" + }, + "examples": { + "Example": { + "value": { + "parameters": { + "loyalty": { + "points": 35 + } + } + } + } } } } - } - } - }, - "404": { - "description": "Returns an error if the voucher code that was specified in the request payload is not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + }, + "responses": { + "200": { + "description": "Returns the updated reward assignment object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_obj_reward_assignment_object" + }, + "examples": { + "Example": { + "value": { + "id": "rewa_pJYQBXSitK2OVPK3XMXZK76X", + "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", + "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 35 + } + }, + "created_at": "2022-08-24T11:40:22.418Z", + "updated_at": "2022-08-24T13:02:32.262Z", + "object": "reward_assignment" + } + } + } + } + } }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id Loyalty_Card", - "request_id": "v-0c086a26de424ccf2f", - "resource_id": "Loyalty_Card", - "resource_type": "voucher" + "404": { + "description": "Returns an error indicating that the reward assignment with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find reward_assignment with id rewa_pJYQBXSitK2OVPK3XMXZK76XI", + "request_id": "v-0b95b8760a4ad5dda1", + "resource_id": "rewa_pJYQBXSitK2OVPK3XMXZK76XI", + "resource_type": "reward_assignment" + } + } + } } } } } - } - } - } - } - }, - "/v1/loyalties/{campaignId}/members/{memberId}": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID." - }, - { - "schema": { - "type": "string" - }, - "name": "memberId", - "in": "path", - "required": true, - "description": "Unique code that identifies the loyalty card." - } - ], - "get": { - "operationId": "get-member-1", - "tags": [ - "LOYALTIES API" - ], - "summary": "Get Member", - "description": "Retrieves the loyalty card with the given member ID (i.e. voucher code).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns loyalty card details.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_loyalty_card_object_non_expanded_categories" - }, - "examples": { - "Loyalty Card": { - "value": { - "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", - "code": "MmFAzfDe", - "campaign": "Loyalty Program", - "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "category": null, - "category_id": "cat_0b6152ce12414820de", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 13435, - "balance": 13135, - "next_expiration_date": "2022-11-30", - "next_expiration_points": 12 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX184kVdWUO/msrLg1G0MRf/Cs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk/dXm/QEJ/sulXKDlUMWf+MN7TRG5LB+wuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX184kVdWUO%2FmsrLg1G0MRf%2FCs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk%2FdXm%2FQEJ%2FsulXKDlUMWf%2BMN7TRG5LB%2BwuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ%3D%3D" + }, + "delete": { + "operationId": "delete-reward-assignment", + "tags": [ + "REWARDS API" + ], + "summary": "Delete Reward Assignment", + "description": "This method deletes a reward assignment for a particular reward.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." + }, + "404": { + "description": "Returns an error indicating that the reward or reward assignment with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Reward Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find reward with id rew_2erjvECLs92GYzKbak3QkyT", + "request_id": "v-0ae29f325e1027cde8", + "resource_id": "rew_2erjvECLs92GYzKbak3QkyT", + "resource_type": "reward" + } }, - "barcode": { - "id": "U2FsdGVkX1/RGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW/cXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FRGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW%2FcXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ%3D%3D" + "Reward Assignment Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find reward_assignment with id rewa_YkwQ5ezNYTQV2geodMVhTpy", + "request_id": "v-0ae2a0588b9027cf95", + "resource_id": "rewa_YkwQ5ezNYTQV2geodMVhTpy", + "resource_type": "reward_assignment" + } } - }, - "is_referral_code": false, - "created_at": "2022-02-18T14:03:59.954Z", - "updated_at": "2022-11-21T13:49:54.949Z", - "holder_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", - "redemption": { - "quantity": null, - "redeemed_quantity": 1, - "redeemed_points": 300, - "object": "list", - "url": "/v1/vouchers/MmFAzfDe/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/MmFAzfDe/publications?page=1&limit=10" - }, - "object": "voucher" + } } } } } - } - } - } - } - }, - "/v1/loyalties/members/{memberId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "MmFAzfDe" - }, - "name": "memberId", - "in": "path", - "required": true, - "description": "Unique loyalty card code assigned to a particular customer." - } - ], - "get": { - "operationId": "get-member", - "tags": [ - "LOYALTIES API" - ], - "summary": "Get Member", - "description": "Retrieve loyalty card with the given member ID (i.e. voucher code). \n\n\n> 📘 Alternative endpoint\n> This endpoint is an alternative to this [endpoint](ref:get-member-1). The URL was re-designed to allow you to retrieve loyalty card details without having to provide the `campaignId` as a path parameter.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns loyalty card details.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_loyalty_card_object_non_expanded_categories" - }, - "examples": { - "Loyalty Card": { - "value": { - "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", - "code": "MmFAzfDe", - "campaign": "Loyalty Program", - "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "category": null, - "category_id": "cat_0b6152ce12414820de", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 13435, - "balance": 13135, - "next_expiration_date": "2022-11-30", - "next_expiration_points": 12 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX184kVdWUO/msrLg1G0MRf/Cs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk/dXm/QEJ/sulXKDlUMWf+MN7TRG5LB+wuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX184kVdWUO%2FmsrLg1G0MRf%2FCs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk%2FdXm%2FQEJ%2FsulXKDlUMWf%2BMN7TRG5LB%2BwuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/RGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW/cXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FRGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW%2FcXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ%3D%3D" + }, + "get": { + "operationId": "get-reward-assignment", + "tags": [ + "REWARDS API" + ], + "summary": "Get Reward Assignment", + "description": "Retrieve a reward assignment.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a reward assignment object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_obj_reward_assignment_object" + } + } + } + }, + "404": { + "description": "Returns an error indicating that the reward assignment with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Reward Assignment Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find reward_assignment with id rewa_pJYQBXSitK2OVPK3XMXZK76X", + "request_id": "v-0b95b596e98ad5da24", + "resource_id": "rewa_pJYQBXSitK2OVPK3XMXZK76X", + "resource_type": "reward_assignment" + } } - }, - "is_referral_code": false, - "created_at": "2022-02-18T14:03:59.954Z", - "updated_at": "2022-11-21T13:49:54.949Z", - "holder_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", - "redemption": { - "quantity": null, - "redeemed_quantity": 1, - "redeemed_points": 300, - "object": "list", - "url": "/v1/vouchers/MmFAzfDe/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/MmFAzfDe/publications?page=1&limit=10" - }, - "object": "voucher" + } } } } } } - } - } - } - }, - "/v1/loyalties/{campaignId}/members/{memberId}/activities": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID." - }, - { - "schema": { - "type": "string" - }, - "name": "memberId", - "in": "path", - "required": true, - "description": "A code that identifies the loyalty card." - } - ], - "get": { - "operationId": "get-member-activities-1", - "tags": [ - "LOYALTIES API" - ], - "summary": "Get Member Activities", - "description": "Retrieves the list of activities for the given member ID related to voucher and customer who is a holder of the voucher.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a list of event objects related to the loyalty card.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_get_member_activities" - } - } - } - } - } - } - }, - "/v1/loyalties/members/{memberId}/activities": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "MmFAzfDe" }, - "name": "memberId", - "in": "path", - "required": true, - "description": "Unique loyalty card assigned to a particular customer." - } - ], - "get": { - "operationId": "get-member-activities", - "tags": [ - "LOYALTIES API" - ], - "summary": "Get Member Activities", - "description": "Retrieves a list of activities for the given loyalty card related to the loyalty and customer who is the holder of the loyalty card.\n\n\n> 📘 Alternative endpoint\n> This endpoint is an alternative to this [endpoint](ref:get-member-activities-1). The URL was re-designed to allow you to get member activities without having to provide the `campaignId` as a path parameter.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a list of event objects related to the loyalty card.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_get_member_activities" + "/v1/publication-object": { + "get": { + "operationId": "publication-object", + "tags": [ + "PUBLICATIONS API" + ], + "summary": "Publication Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Publication Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/5_obj_publication_object" + } + } + } } } } - } - } - } - }, - "/v1/loyalties/{campaignId}/members/{memberId}/balance": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_7s3uXI44aKfIk5IhmeOPr6ic" }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID." - }, - { - "schema": { - "type": "string", - "example": "MmFAzfDe" - }, - "name": "memberId", - "in": "path", - "required": true, - "description": "A code that identifies the loyalty card." - } - ], - "post": { - "operationId": "add-remove-loyalty-card-balance-1", - "tags": [ - "LOYALTIES API" - ], - "summary": "Add or Remove Loyalty Card Balance", - "description": "This method adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the point adjustment along with the expiration mechanism.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_add_remove_points_balance" - }, - "examples": { - "Add points": { - "value": { - "points": 100, - "expiration_type": "CUSTOM_DATE", - "expiration_date": "2023-05-30" + "/v1/publications/create": { + "get": { + "operationId": "create-publication-1", + "tags": [ + "PUBLICATIONS API" + ], + "summary": "Create Publication", + "description": "This method selects vouchers that are suitable for publication, adds a publish entry and returns the publication.\n\nA voucher is suitable for publication when it's active and hasn't been published yet.\n> ❗️ Limited access\n>\n> Access to this endpoint is limited. This endpoint is designed for specific integrations and the API keys need to be configured to access this endpoint. Navigate to the **Dashboard** → **Project Settings** → **General** → **Integration Keys** to set up a pair of API keys and use them to send the request. \n\n\n> 🚧 Clearly define the source of the voucher\n>\n> You must clearly define which source you want to publish the voucher code from. It can either be a code from a campaign or a specific voucher identified by a code. \n\n> 🚧 Publish multiple vouchers\n> This endpoint does not support the publishing of multiple vouchers from a single campaign. In case you want to publish multiple vouchers within a single publication, you need to use a [dedicated endpoint](ref:create-publication). \n\n\n> 📘 Specifying the voucher to be published\n>\n> - In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use an **auto-update** campaign and in the query parameters specify the `campaign` without specifying the voucher.\n> - If you would like to publish a specific code from a specific campaign, then you need to provide the `campaign` and the `voucher` parameters.\n> - If you would like to publish a standalone voucher, then omit the campaign parameter and simply provide the `voucher` parameter. \n\n## Example Request \n```markdown Publication Query \n/publications/create?campaign=camp_T0bUgWGCAV6S0X3smH4MEboG&metadata[year]=2&metadata[Date]=2023-03-03&metadata[DateTime]=2023-03-03T14:06:08.311Z&metadata[Flag]=true&metadata[Number]=222&metadata[String]=stringy&metadata[ImageURL]=https://user-images.githubusercontent.com/95409292/222734777-a6d9e41a-de3a-42a8-8cc7-24f31e857edd.png&metadata[Object][payment][payment_tax]=9&metadata[Object][payment][payment_method]=Visa&metadata[Object][payment][payment_date]=2023-03-03&metadata[Object][payment][payment_datetime]=2023-03-03T14:06:08.311Z&metadata[Object][payment][payment_completed]=true&metadata[Object][payment][payment_url]=https://user-images.githubusercontent.com/95409292/222734777-a6d9e41a-de3a-42a8-8cc7-24f31e857edd.png&customer[source_id]=try-new-12&customer[name]=John%20Jimmy&customer[description]=This is testing the publication endpoint.&customer[email]=johnjimy2%40email.com&customer[phone]=%2B48%20123%20333%20333&customer[address][city]=Warsaw&customer[address][state]=Mazowieckie&customer[address][line_1]=4499%20Main%20St.&customer[address][line_2]=Blg%202%20APT%204&customer[address][country]=Poland&customer[address][postal_code]=122333&customer[birthday]=2222-01-22&customer[metadata][paid_bill]=true&customer[metadata][age]=22&customer[metadata][location]=Poland&customer[metadata][acquisition_date]=2022-09-09&customer[metadata][birth_date]=2023-03-20T18:44:19.215Z&customer[metadata][ImageURL]=https://user-images.githubusercontent.com/95409292/222734777-a6d9e41a-de3a-42a8-8cc7-24f31e857edd.png&customer[metadata][location-unknown][city]=Katowice&customer[metadata][location-unknown][state]=slask&customer[metadata][location-unknown][number]=2&customer[metadata][location-unknown][date]=2034-09-11&customer[metadata][location-unknown][dateTime]=2023-03-20T18:44:19.215Z&customer[metadata][Object][payment][payment_date]=2023-03-03&customer[metadata][Object][payment][payment_datetime]=2023-03-03T14:06:08.311Z&customer[metadata][Object][payment][payment_completed]=true&customer[metadata][Object][payment][payment_url]=https://user-images.githubusercontent.com/95409292/222734777-a6d9e41a-de3a-42a8-8cc7-24f31e857edd.png&customer[metadata][Object][payment][payment_tax]=9&customer[metadata][Object][payment][payment_method]=Visa```", + "parameters": [ + { + "schema": { + "type": "string", + "example": "custom_publication_source_id" + }, + "in": "query", + "name": "source_id", + "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service." + }, + { + "schema": { + "type": "string", + "example": "PROMO-1LwwzYI" + }, + "in": "query", + "name": "voucher", + "description": "Code of voucher being published. If there is a particular code that you would like to publish, then you can use this parameter to specify the code. You can omit this parameter if you would like to publish a random code from a campaign, where the campaign is in `AUTO_UPDATE` mode." + }, + { + "name": "metadata", + "in": "query", + "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format.", + "style": "deepObject", + "explode": true, + "schema": { + "type": "object" + } + }, + { + "name": "customer", + "in": "query", + "required": true, + "description": "Specify the customer who is to receive a code. You can either directly provide the respective ID's as strings or provide them in the form of an object.", + "style": "deepObject", + "explode": true, + "schema": { + "anyOf": [ + { + "$ref": "#/components/schemas/5_req_create_publication_customer" + }, + { + "$ref": "#/components/schemas/5_res_create_publication_customer_id" + }, + { + "$ref": "#/components/schemas/5_res_create_publication_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ] } }, - "Deduct points": { - "value": { - "points": -100 + { + "name": "campaign", + "in": "query", + "required": true, + "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`. You can use this parameter without having to specify a particular `voucher` code if the campaign is in `AUTO_UPDATE` mode. This parameter not required for a standalone code, however, if you intend to use a code from a campaign, then this parameter is required.", + "style": "deepObject", + "explode": true, + "schema": { + "anyOf": [ + { + "$ref": "#/components/schemas/5_req_create_publication_campaign" + }, + { + "$ref": "#/components/schemas/5_req_create_publication_campaign_id" + }, + { + "$ref": "#/components/schemas/5_req_create_publication_campaign_name" + } + ] } } - } - } - } - }, - "responses": { - "200": { - "description": "Returns a balance object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_add_remove_points_balance" + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a publication object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/5_res_create_publication" + }, + "examples": { + "Example": { + "value": { + "id": "pub_ocaXCa023ayJ3WL1ARxUeKgIvg3JcEGh", + "object": "publication", + "created_at": "2022-09-30T16:30:32.924Z", + "customer_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", + "tracking_id": "pub_source_customer_5", + "metadata": { + "year": 2022 + }, + "channel": "myown", + "source_id": "publication_source_ID_10", + "result": "SUCCESS", + "customer": { + "id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", + "name": "Bob Jones", + "email": "bob.smith@email.com", + "source_id": "pub_source_customer_5", + "metadata": { + "lang": "en", + "test": true + }, + "object": "customer" + }, + "voucher": { + "id": "v_6Hy5FdNlu3dP65fJu5BgXma31Sl3rgkf", + "code": "cEsMn0uA", + "campaign": "Test - Discount Effect - Amount - Items", + "campaign_id": "camp_dphuwqH7BOVkgh4JmpDtS32l", + "category": null, + "category_id": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 300, + "effect": "APPLY_TO_ITEMS" + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX188XVmOotyCyR2j3G8sJR8HzS3DQ+6J1OElPWSmjlEnthuJc7rkc7WIVxjT4pTl1JVVkHEuGXNXdzRik11H8S18HQeQFJFiuwLZ2mzEC2zZitEinyUxtZwhnEHoi0eGAgYCG7iVMNuOQA==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX188XVmOotyCyR2j3G8sJR8HzS3DQ%2B6J1OElPWSmjlEnthuJc7rkc7WIVxjT4pTl1JVVkHEuGXNXdzRik11H8S18HQeQFJFiuwLZ2mzEC2zZitEinyUxtZwhnEHoi0eGAgYCG7iVMNuOQA%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX18wDd9CcLM0Ef7aBfUSXZUoCQpuNpk4CHGOipbn+wFkfzcIZGBtUlxrI2KsXciCqF+c93AKzsymq5Yw8eEAFF/FK5f94z4/sgzaLDvyBmPCXHuS11Ew9S4ZEMjdTkUJftER2IlxWaCARA==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18wDd9CcLM0Ef7aBfUSXZUoCQpuNpk4CHGOipbn%2BwFkfzcIZGBtUlxrI2KsXciCqF%2Bc93AKzsymq5Yw8eEAFF%2FFK5f94z4%2FsgzaLDvyBmPCXHuS11Ew9S4ZEMjdTkUJftER2IlxWaCARA%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-30T16:30:32.956Z", + "updated_at": null, + "holder_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", + "redemption": { + "quantity": 1, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/cEsMn0uA/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/cEsMn0uA/publications?page=1&limit=10" + }, + "object": "voucher" + }, + "vouchers_id": [ + "v_6Hy5FdNlu3dP65fJu5BgXma31Sl3rgkf" + ] + } + } + } + } + } }, - "examples": { - "Add balance": { - "value": { - "points": -100, - "total": 13436, - "balance": 13136, - "type": "loyalty_card", - "object": "balance", - "related_object": { - "type": "voucher", - "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF" + "400": { + "description": "Returns an error if the query parameters are incomplete.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Missing customer": { + "value": { + "code": 400, + "key": "invalid_query_params", + "message": "Invalid query params", + "details": "Query should have required property 'customer'", + "request_id": "v-0c8b6423f3c80ed3e4" + } + }, + "Missing vouchers": { + "value": { + "code": 400, + "key": "missing_vouchers", + "message": "Missing vouchers", + "details": "Either Campaign or Voucher is required" + } + }, + "Voucher cannot be published": { + "value": { + "code": 400, + "key": "voucher_cannot_be_published", + "message": "Voucher cannot be published", + "details": "Voucher cannot be published. Customer already joined program.", + "request_id": "v-0c8b763544080efed2" + } + }, + "Voucher already published": { + "value": { + "code": 400, + "key": "voucher_already_published", + "message": "Voucher already published", + "details": "Voucher 'v_vM7vQZmgV86k0wuz05cFAOfarj4s8BQE' has already been published", + "request_id": "v-0c8baebc67c80e97a0" + } + }, + "Duplicate source ID": { + "value": { + "code": 400, + "key": "duplicate_source_id", + "message": "Duplicate source_id", + "details": "Publication with source_id: 'test_publication_source_id_test_voucher' already exists", + "request_id": "v-0c8b7e8f78c80e94a2" + } + }, + "Too many vouchers requested": { + "value": { + "code": 400, + "key": "too_many_vouchers_requested", + "message": "Too many vouchers requested", + "details": "Only up to 1 can be published", + "request_id": "v-0c8bac9a25c80e912d" + } + }, + "Metadata validation failed": { + "value": { + "code": 400, + "key": "metadata_validation_failed", + "message": "Metadata validation failed", + "details": "ImageURL: must be a URL pointing to JPG/JPEG or PNG resource (actual value is 'http.com')", + "request_id": "v-0c8bcbd742080ee807" + } + } } } - }, - "Deduct balance": { - "value": { - "points": -100, - "total": 13436, - "balance": 13136, - "type": "loyalty_card", - "object": "balance", - "related_object": { - "type": "voucher", - "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF" + } + }, + "403": { + "description": "Returns an error if you don't have a specific credentials set up. Navigate to the **Dashboard** → **Project Settings** → **General** → **Integration Keys** to set up a pair of API keys and use them to send the request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_integration_key" + }, + "examples": { + "Example": { + "value": { + "code": 403, + "message": "Forbidden", + "key": "integration_api_key_required" + } + } + } + } + } + }, + "404": { + "description": "Returns an error if a resource is not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Resource not found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find customer with id cust_xqA7DGj5eYPHg6PHVKwYRWiA", + "request_id": "v-0c8b6b35294af6f192", + "resource_id": "cust_xqA7DGj5eYPHg6PHVKwYRWiA", + "resource_type": "customer" + } + } } } } @@ -67831,100 +54731,523 @@ } } }, - "400": { - "description": "Returns an error if the expiration date was defined incorrectly in the request payload.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" + "/v1/publications": { + "get": { + "operationId": "list-publications", + "tags": [ + "PUBLICATIONS API" + ], + "summary": "List Publications", + "description": "Retrieve a list of publications. To return a **particular** publication, you can use the `source_id` query parameter and provide the `source_id` of the publication you are looking for specifically.\n\n## Pagination\n\n\n> 🚧 Important!\n>\n> If you want to scroll through a huge set of records, it is recommended to use the [Exports API](ref:create-export). This API will return an error `page_over_limit` if you reach a page above 1000.\n\n## Filter Query\n\nThe `filters` query parameter allows for joining multiple parameters with logical operators. The syntax looks as follows:\n\n\n```url\nfilters[][conditions][][]=\n```\n\n### Operators:\n\n\n```\n \"$in\"\n \"$not_in\"\n \"$is\"\n \"$is_not\"\n \"$has_value\"\n \"$is_unknown\"\n \"$contains\"\n \"$starts_with\"\n \"$ends_with\"\n \"$more_than\"\n \"$less_than\"\n \"$more_than_equal\"\n \"$less_than_equal\"\n```\n\n### Examples\n\n\n```url\nGET /v1/publications?filters[customer_id][conditions][$is][0]=cust_lUET6gRpO5Wxlg5p2j2gRCgL\n```\n\n```url\nGET /v1/publications?filters[customer_id][conditions][$in][0]=cust_lUET6gRpO5Wxlg5p2j2gRCgL&filters[customer_id][conditions][$in][1]=cust_aR7NfHusxT7PdTMAKMfWDXnc\n```\n\n```url\nGET /v1/publications?filters[customer_id][conditions][$is][0]=cust_lUET6gRpO5Wxlg5p2j2gRCgL&filters[customer_id][conditions][$is][1]=cust_aR7NfHusxT7PdTMAKMfWDXnc&filters[junction]=OR\n```", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "enum": [ + "id", + "-id", + "voucher_code", + "-voucher_code", + "tracking_id", + "-tracking_id", + "customer_id", + "-customer_id", + "created_at", + "-created_at", + "channel", + "-channel" + ] + }, + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "campaign", + "description": "Filters by a given campaign name." + }, + { + "schema": { + "type": "string", + "example": "cust_jl33V8ZDQJp4goU1z8DmFioo" + }, + "in": "query", + "name": "customer", + "description": "Filters by a unique customer ID." + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "voucher", + "description": "Filters by a given voucher code." + }, + { + "schema": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ] + }, + "in": "query", + "name": "result", + "description": "Filters by a publication result." + }, + { + "schema": { + "type": "string", + "enum": [ + "discount", + "loyalty", + "lucky_draw" + ] + }, + "in": "query", + "name": "voucher_type", + "description": "Filters by a voucher type." + }, + { + "schema": { + "type": "boolean" + }, + "in": "query", + "name": "is_referral_code", + "description": "This filter works only for the `true` option. If set to `true`, the query returns only publications of codes from referral campaigns. " + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "filters", + "description": "Allows for combining the filters mentioned in the endpoint description." + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "source_id", + "description": "Using this endpoint with a particular publication `source_id`, which was sent with the original request to create a publication, returns in the response, exactly the same code published initially because the code was assigned to the given publication. As a result, you can use this endpoint as a reference and return a code that was assigned in a publication by using a particular `source_id`." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of publications you’ve previously created with [create publication](ref:create-publication) or implicitly by the distribution manager. The publications are returned in sorted order, with the most recent ones appearing first.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/5_res_list_publications" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "publications", + "publications": [ + { + "id": "pub_QzQT50e5i2y3bRoEVvhFgrKbZ7t6BRwu", + "object": "publication", + "created_at": "2022-09-28T13:31:23.522Z", + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "tracking_id": "cindy.jones@email.com", + "metadata": { + "distribution_id": "distr_WXm0CBttar2ug2hBx3EdPtS8Ei", + "source_type": "distribution", + "source_id": "distr_WXm0CBttar2ug2hBx3EdPtS8Ei" + }, + "channel": "Automation", + "source_id": null, + "result": "SUCCESS", + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "name": "Cindy Jones", + "email": "cindy.jones@email.com", + "source_id": "cindy.jones@email.com", + "metadata": { + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "voucher": { + "code": "FNV5IrtY", + "object": "voucher", + "campaign": "Loyalty Campaign", + "loyalty_card": { + "points": 0, + "balance": 0 + }, + "is_referral_code": false + }, + "vouchers_id": [ + "v_i3HOzVClfJUDia0qCu7TSuGfDj7c0dgD" + ] + }, + { + "id": "pub_8KOKHObAjuemuI0b6225emIhmWDL1ZoX", + "object": "publication", + "created_at": "2022-09-28T13:31:02.766Z", + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "tracking_id": "sandy.jones@email.com", + "metadata": {}, + "channel": "voucherify-website", + "source_id": null, + "result": "SUCCESS", + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "name": "Sandy Jones", + "email": "sandy.jones@email.com", + "source_id": "sandy.jones@email.com", + "metadata": { + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "voucher": { + "code": "Voucher-1", + "object": "voucher", + "campaign": null, + "discount": { + "type": "AMOUNT", + "amount_off": 200, + "amount_off_formula": "IF(VOUCHER_PUBLISH_COUNT = 1;25;5)", + "effect": "APPLY_TO_ORDER" + }, + "is_referral_code": false + }, + "vouchers_id": [ + "v_1iEL92K634EIOqeYJw6AHrnjEhGPEdpu" + ] + }, + { + "id": "pub_DcQPfyVYzomtkQGXFW7dcdyNoJ6vQ4NV", + "object": "publication", + "created_at": "2022-09-13T06:15:08.249Z", + "customer_id": "cust_ur1hIPGflbaAe14mLlLdon3G", + "tracking_id": "1", + "metadata": {}, + "channel": "voucherify-website", + "source_id": null, + "result": "SUCCESS", + "customer": { + "id": "cust_ur1hIPGflbaAe14mLlLdon3G", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "1", + "metadata": { + "accepts_marketing": false + }, + "object": "customer" + }, + "voucher": { + "code": "GIFT-WOZaK5YF1Fs87tAX", + "object": "voucher", + "campaign": "Gift Cards", + "gift": { + "amount": 0, + "balance": 0 + }, + "is_referral_code": false + }, + "vouchers_id": [ + "v_yzOeb7vw63vbPfA30215dFm7aRXa8Xoc" + ] + } + ], + "total": 3 + } + } + } + } + } }, - "examples": { - "Invalid expiration date": { - "value": { - "code": 400, - "key": "invalid_expiration_date", - "message": "Invalid Expiration Date", - "details": "Expiration date cannot be set in the past", - "request_id": "v-0c118b1611424ca899" + "400": { + "description": "Returns an error if you request a page higher than 1000.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Example": { + "value": { + "code": 400, + "key": "page_over_limit", + "message": "Listing resource above 1000 page is not supported", + "details": "Property .page cannot be higher than 1000", + "request_id": "v-0bc2a39574c61362af" + } + } + } } } } } - } - } - } - } - }, - "/v1/loyalties/members/{memberId}/balance": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "MmFAzfDe" - }, - "name": "memberId", - "in": "path", - "required": true, - "description": "Unique loyalty card assigned to a particular customer." - } - ], - "post": { - "operationId": "add-remove-loyalty-card-balance", - "tags": [ - "LOYALTIES API" - ], - "summary": "Add or Remove Loyalty Card Balance", - "description": "This method gives adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. \n\n\n> 📘 Alternative endpoint\n> This endpoint is an alternative to this [endpoint](ref:add-remove-loyalty-card-balance-1). The URL was re-designed to allow you to add or remove loyalty card balance without having to provide the `campaignId` as a path parameter.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the point adjustment along with the expiration mechanism.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_add_remove_points_balance" + }, + "post": { + "operationId": "create-publication", + "tags": [ + "PUBLICATIONS API" + ], + "summary": "Create Publication", + "description": "This method selects vouchers that are suitable for publication, adds a publish entry and returns the publication.\n\nA voucher is suitable for publication when it's active and hasn't been published yet. \n\n\n> 🚧 Clearly define the source of the voucher\n>\n> You must clearly define which source you want to publish the voucher code from. It can either be a code from a campaign or a specific voucher identified by a code. \n\n> 🚧 Publish multiple vouchers\n> In case you want to publish multiple vouchers within a single publication, you need to specify the campaign name and number of vouchers you want to publish. \n\n\n> 📘 Auto-update campaign\n>\n> In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use an **auto-update** campaign.", + "parameters": [ + { + "schema": { + "type": "boolean" + }, + "in": "query", + "name": "join_once", + "description": "Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the publication parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/5_req_create_publication" + }, + "examples": { + "Example - Specific Voucher": { + "value": { + "campaign": { + "name": "campaign-name" + }, + "customer": { + "source_id": "source-id", + "Name": "Customer Name", + "email": "customer email" + }, + "voucher": "voucher-code", + "metadata": { + "key": "value" + } + } + }, + "Example - Random Voucher": { + "value": { + "campaign": { + "name": "campaign-name", + "count": 1 + }, + "customer": { + "source_id": "source-id", + "Name": "Customer Name", + "email": "customer email" + }, + "voucher": "voucher-code", + "metadata": { + "key": "value" + } + } + }, + "Example 3": { + "value": { + "source_id": "publication_source_ID_10", + "campaign": "Test - Discount Effect - Amount - Items", + "channel": "myown", + "customer": { + "source_id": "pub_source_customer_5", + "name": "Bob Jones", + "description": "A frequent customer", + "email": "bob.smith@email.com", + "phone": "+1 933 222 3333", + "address": { + "city": "New York", + "country": "United States", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 5", + "postal_code": "10001", + "state": "NY" + }, + "metadata": { + "lang": "en", + "test": true + }, + "birthday": "1901-12-01" + }, + "metadata": { + "year": 2022 + } + } + } + } + } + } }, - "examples": { - "Subtract points": { - "value": { - "points": -100 + "responses": { + "200": { + "description": "Returns a publication object if a valid identifier was provided.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/5_res_create_publication" + }, + "examples": { + "Example": { + "value": { + "id": "pub_ocaXCa023ayJ3WL1ARxUeKgIvg3JcEGh", + "object": "publication", + "created_at": "2022-09-30T16:30:32.924Z", + "customer_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", + "tracking_id": "pub_source_customer_5", + "metadata": { + "year": 2022 + }, + "channel": "myown", + "source_id": "publication_source_ID_10", + "result": "SUCCESS", + "customer": { + "id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", + "name": "Bob Jones", + "email": "bob.smith@email.com", + "source_id": "pub_source_customer_5", + "metadata": { + "lang": "en", + "test": true + }, + "object": "customer" + }, + "voucher": { + "id": "v_6Hy5FdNlu3dP65fJu5BgXma31Sl3rgkf", + "code": "cEsMn0uA", + "campaign": "Test - Discount Effect - Amount - Items", + "campaign_id": "camp_dphuwqH7BOVkgh4JmpDtS32l", + "category": null, + "category_id": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 300, + "effect": "APPLY_TO_ITEMS" + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX188XVmOotyCyR2j3G8sJR8HzS3DQ+6J1OElPWSmjlEnthuJc7rkc7WIVxjT4pTl1JVVkHEuGXNXdzRik11H8S18HQeQFJFiuwLZ2mzEC2zZitEinyUxtZwhnEHoi0eGAgYCG7iVMNuOQA==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX188XVmOotyCyR2j3G8sJR8HzS3DQ%2B6J1OElPWSmjlEnthuJc7rkc7WIVxjT4pTl1JVVkHEuGXNXdzRik11H8S18HQeQFJFiuwLZ2mzEC2zZitEinyUxtZwhnEHoi0eGAgYCG7iVMNuOQA%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX18wDd9CcLM0Ef7aBfUSXZUoCQpuNpk4CHGOipbn+wFkfzcIZGBtUlxrI2KsXciCqF+c93AKzsymq5Yw8eEAFF/FK5f94z4/sgzaLDvyBmPCXHuS11Ew9S4ZEMjdTkUJftER2IlxWaCARA==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18wDd9CcLM0Ef7aBfUSXZUoCQpuNpk4CHGOipbn%2BwFkfzcIZGBtUlxrI2KsXciCqF%2Bc93AKzsymq5Yw8eEAFF%2FFK5f94z4%2FsgzaLDvyBmPCXHuS11Ew9S4ZEMjdTkUJftER2IlxWaCARA%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-30T16:30:32.956Z", + "updated_at": null, + "holder_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", + "redemption": { + "quantity": 1, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/cEsMn0uA/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/cEsMn0uA/publications?page=1&limit=10" + }, + "object": "voucher" + }, + "vouchers_id": [ + "v_6Hy5FdNlu3dP65fJu5BgXma31Sl3rgkf" + ] + } + } + } + } } }, - "Add Points": { - "value": { - "points": 100, - "expiration_type": "CUSTOM_DATE", - "expiration_date": "2023-05-30" + "400": { + "description": "Returns an error if a publication with the same source ID already exists in the system or some request body parameter is missing.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Missing Parameters": { + "value": { + "code": 400, + "key": "missing_vouchers", + "message": "Missing vouchers", + "details": "Either Campaign or Voucher is required" + } + }, + "Already published": { + "value": { + "code": 400, + "key": "voucher_already_published", + "message": "Voucher already published", + "details": "Voucher 'v_Y5P4UZ1yilkiYOIJmAAgWazUi1wfkNwF' has already been published", + "request_id": "v-0bc40bb800d5651137" + } + }, + "Duplicate Source ID": { + "value": { + "code": 400, + "key": "duplicate_source_id", + "message": "Duplicate source_id", + "details": "Publication with source_id: 'publication_source_ID_1' already exists", + "request_id": "v-0bc40bf81555651191" + } + } + } + } } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns a balance object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_add_remove_points_balance" }, - "examples": { - "Subtract Points": { - "value": { - "points": 100, - "total": 13436, - "balance": 13136, - "type": "loyalty_card", - "object": "balance", - "related_object": { - "type": "voucher", - "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF" + "404": { + "description": "Returns an error if a resource is not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Campaign Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id 1", + "request_id": "v-0bc40546e5d56508e5", + "resource_id": "1", + "resource_type": "campaign" + } + } } } } @@ -67932,1367 +55255,2113 @@ } } }, - "400": { - "description": "Returns an error if the expiration date was specified incorrectly in the request payload.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Invalid payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Property .expiration_date cannot be recognized as a ISO-8601 compliant date", - "request_id": "v-0c118c6f7c0e6751ab" + "/v1/validation-object": { + "get": { + "operationId": "validation-object", + "tags": [ + "VALIDATIONS API" + ], + "summary": "Validation Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Validation Object", + "content": { + "application/json": { + "schema": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_voucher_false" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher" + } + ] + } } } } } } - } - } - } - }, - "/v1/loyalties/{campaignId}/members/{memberId}/transfers": { - "parameters": [ - { - "schema": { - "type": "string" }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination)." - }, - { - "schema": { - "type": "string" - }, - "name": "memberId", - "in": "path", - "required": true, - "description": "A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination)." - } - ], - "post": { - "operationId": "transfer-points", - "tags": [ - "LOYALTIES API" - ], - "summary": "Transfer Loyalty Points", - "description": "Transfer points between different loyalty cards. You need to provide the campaign ID and the loyalty card ID you want the points to be transferred to as path parameters in the URL. In the request body, you provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_transfer_loyalty_points" - }, - "examples": { - "Example": { - "value": [ - { - "code": "0PmQ7JQI", - "points": 1 - }, - { - "code": "kCeufB8i", - "points": 1 - } - ] - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns a loyalty card object for the loaded loyalty card, ie. the one that that points were transferred to from the other cards(s).", - "content": { - "application/json": { + "/v1/vouchers/{code}/validate": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/8_obj_loyalty_card_object_non_expanded_categories" - }, - "examples": { - "Example": { - "value": { - "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", - "code": "MmFAzfDe", - "campaign": "Proportional Earning Rules", - "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "category": null, - "category_id": "cat_0b6152ce12414820de", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 13441, - "balance": 13141, - "next_expiration_date": "2022-11-30", - "next_expiration_points": 0 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX184kVdWUO/msrLg1G0MRf/Cs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk/dXm/QEJ/sulXKDlUMWf+MN7TRG5LB+wuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX184kVdWUO%2FmsrLg1G0MRf%2FCs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk%2FdXm%2FQEJ%2FsulXKDlUMWf%2BMN7TRG5LB%2BwuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/RGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW/cXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FRGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW%2FcXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ%3D%3D" + "type": "string", + "example": "Testing7fjWdr" + }, + "name": "code", + "in": "path", + "required": true, + "description": "A code that identifies the voucher." + } + ], + "post": { + "operationId": "validate-voucher", + "deprecated": true, + "tags": [ + "VALIDATIONS API" + ], + "summary": "Validate Voucher [Deprecated]", + "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for voucher validation, and we do not recommend using it. The new [Stackable Discounts API](ref:validate-stacked-discounts) 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. \n\nTo verify a voucher code given by a customer, you can use this method. It is designed for a server side integration, which means that is accessible only through private keys. \n\n\n> ❗️ Important \n>\n> This endpoint supports the validation of a single promo code. If you need to validate more than one incentive, you can use the [Stackable discounts API](ref:stackable-discounts-api). The stacking discounts API lets you validate up to 5 incentives per call. Before integrating Voucherify, choose which validation endpoint you prefer to use.\n\n#### Gift Vouchers - validate Gift Card and control amount to redeem\nVoucherify also gives the possibility to create a gift card, which allows using credits to fulfill the order. A user can specify how many credits he wants to use from the gift card. The available balance of credits is counted based on policy rules attached to the Gift Voucher definition. \n\nThis operation returns information about the validity of the code. Moreover, it returns a hashed source identifier which can be used as a tracking ID in future calls.\n\nIf a validation session is established, then the session details will be returned as well. Read more about sessions [here](doc:locking-validation-session).\n\nVoucher validation might fail because of one of these reasons:\n* `voucher not found` - voucher doesn't exist or was [deleted](ref:delete-voucher)\n* `voucher expired` - voucher is out of start date - expiration date time frame\n* `voucher is disabled` - learn more about a [disabled voucher](ref:disable-voucher)\n* `customer does not match segment rules` - learn more [customer tracking](doc:customers#customer-tracking) \n* `order does not match validation rules` - learn more about [validation rules](doc:validation-rules)", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the voucher validation context using the request body parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/6_req_validate_voucher" + }, + "examples": { + "Free Shipping": { + "value": { + "customer": { + "id": "cust_4vMj8Twr5nBzvTrNCgipMb6M" + }, + "order": { + "items": [ + { + "product_id": "prod_0ba621bae5d39762ce", + "quantity": "1" + }, + { + "product_id": "prod_0b661d404787ec6d3b", + "quantity": "1", + "price": 3100 + } + ] + } } }, - "is_referral_code": false, - "created_at": "2022-02-18T14:03:59.954Z", - "updated_at": "2022-11-28T17:58:25.607Z", - "holder_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", - "redemption": { - "quantity": null, - "redeemed_quantity": 1, - "redeemed_points": 300, - "object": "list", - "url": "/v1/vouchers/MmFAzfDe/redemptions?page=1&limit=10" + "Multiple Product Variants": { + "value": { + "customer": { + "source_id": "08dd9b5a-26de-44aa-a1d4-d9adfa9e8ec2" + }, + "order": { + "id": "ord_FDdsDI3FppuiqHa4s7drZEMP" + } + } }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/MmFAzfDe/publications?page=1&limit=10" + "Unit - Add order items": { + "value": { + "customer": { + "source_id": "08dd9b5a-26de-44aa-a1d4-d9adfa9e8ec2" + }, + "order": { + "source_id": "47f491d1-a697-4f92-95ca-2ba1f463efa8" + }, + "session": { + "type": "LOCK", + "ttl_unit": "NANOSECONDS", + "ttl": 1 + } + } }, - "object": "voucher" - } - } - } - } - } - } - } - } - }, - "/v1/loyalties/{campaignId}/members/{memberId}/transactions": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return." - }, - { - "schema": { - "type": "string" - }, - "name": "memberId", - "in": "path", - "required": true, - "description": "A unique code identifying the loyalty card that you are looking to retrieve transaction data for." - } - ], - "get": { - "operationId": "list-loyalty-card-transactions-1", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Loyalty Card Transactions", - "description": "Retrieve transaction data related to point movements for a specific loyalty card.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary of loyalty card transaction objects.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_get_loyalty_card_transactions" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "vtx_0c9dd3c2e392f78613", - "source_id": "20230317_transfer_1", - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": "API", - "reason": "Transferring points to card", - "type": "POINTS_TRANSFER_OUT", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1396, - "object": "balance", - "points": -1, - "balance": 1396, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" + "Fixed": { + "value": { + "customer": { + "source_id": "08dd9b5a-26de-44aa-a1d4-d9adfa9e8ec2" + }, + "order": { + "items": [ + { + "source_id": "webinar_BF_sweater_pink_sweater", + "quantity": "1", + "price": 6500, + "related_object": "product" + }, + { + "source_id": "webinar_BF_pants_navy_sweat_pants", + "quantity": "1", + "price": 6000, + "related_object": "product" + }, + { + "source_id": "5h1pp1ng", + "quantity": "1", + "price": 2000, + "related_object": "product" + }, + { + "source_id": "webinar_BF_pants_gray_sweat_pants", + "quantity": "2", + "price": 5000, + "related_object": "product" + }, + { + "source_id": "webinar_BF_sweater_pearl", + "quantity": "2", + "price": 11000, + "related_object": "product" } + ] + }, + "session": { + "type": "LOCK" + } + } + }, + "Percentage": { + "value": { + "customer": { + "source_id": "your_customer_source_ID", + "name": "Bob Smith", + "description": "A frequent customer", + "email": "bob.smith@email.com", + "phone": "+1 933 222 3333", + "address": { + "city": "New York", + "country": "United States", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 5", + "postal_code": "10001", + "state": "NY" }, - "destination_voucher": { - "id": "v_Wak6xlf5WdR4rIcvJxC2olOopk0boK6t", - "code": "LOYALTY-CARD-A8XVurg", - "type": "LOYALTY_CARD", - "campaign": "Loyalty Campaign - Test Initial Points", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "loyalty_card": { - "points": 1102, - "balance": 1102, - "next_expiration_date": "2023-12-31", - "next_expiration_points": 102 + "metadata": { + "lang": "en", + "test": true + }, + "birthday": "1960-12-01" + }, + "order": { + "items": [ + { + "source_id": "webinar_BF_sweater_pink_sweater", + "quantity": "1", + "price": 6500, + "related_object": "product" }, - "is_referral_code": false - } + { + "source_id": "webinar_BF_pants_navy_sweat_pants", + "quantity": "1", + "price": 6000, + "related_object": "product" + }, + { + "source_id": "5h1pp1ng", + "quantity": "1", + "price": 2000, + "related_object": "product" + }, + { + "source_id": "webinar_BF_pants_gray_sweat_pants", + "quantity": "2", + "price": 5000, + "related_object": "product" + }, + { + "source_id": "webinar_BF_sweater_pearl", + "quantity": "2", + "price": 11000, + "related_object": "product" + } + ] }, - "related_transaction_id": "vtx_0c9dd3c2e392f78614", - "created_at": "2023-03-17T16:20:33.807Z" - }, - { - "id": "vtx_0c9dd2527696ba081b", - "source_id": "20230317_add_1", - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": null, - "reason": "Adding points to card", - "type": "POINTS_ADDITION", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1397, - "object": "balance", - "points": 100, - "balance": 1397, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" + "session": { + "type": "LOCK", + "key": "your_custom_key", + "ttl_unit": "NANOSECONDS", + "ttl": 1 + } + } + }, + "Amount": { + "value": { + "customer": { + "source_id": "your_customer_source_ID", + "name": "Bob Smith", + "description": "A frequent customer", + "email": "bob.smith@email.com", + "phone": "+1 933 222 3333", + "address": { + "city": "New York", + "country": "United States", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 5", + "postal_code": "10001", + "state": "NY" + }, + "metadata": { + "lang": "en", + "test": true + }, + "birthday": "1960-12-01" + }, + "order": { + "items": [ + { + "source_id": "webinar_BF_sweater_pink_sweater", + "quantity": "1", + "price": 6500, + "related_object": "product" + }, + { + "source_id": "webinar_BF_pants_navy_sweat_pants", + "quantity": "1", + "price": 6000, + "related_object": "product" + }, + { + "source_id": "5h1pp1ng", + "quantity": "1", + "price": 2000, + "related_object": "product" + }, + { + "source_id": "webinar_BF_pants_gray_sweat_pants", + "quantity": "2", + "price": 5000, + "related_object": "product" + }, + { + "source_id": "webinar_BF_sweater_pearl", + "quantity": "2", + "price": 11000, + "related_object": "product" } + ], + "metadata": { + "currency": "EUR" } }, - "related_transaction_id": null, - "created_at": "2023-03-17T16:14:16.524Z" - }, - { - "id": "vtx_0c9dd1ce1d403f4204", - "source_id": "20230317_subtract_1", - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": null, - "reason": "Subtracting points from card", - "type": "POINTS_REMOVAL", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1297, - "object": "balance", - "points": -1, - "balance": 1297, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" + "session": { + "type": "LOCK", + "key": "your_custom_key", + "ttl_unit": "NANOSECONDS", + "ttl": 1 + } + } + }, + "Loyalty Card": { + "value": { + "order": { + "items": [ + { + "product_id": "prod_0bd76fc58f8038b043", + "quantity": "1" + }, + { + "product_id": "prod_0bd76bd0e204542738", + "quantity": "1" } + ] + }, + "reward": { + "id": "rew_4ZF6Y69U2PXE3GLIZxfozgg1", + "points": 10 + } + } + }, + "Gift Card": { + "value": { + "customer": { + "source_id": "286401dc-6f4c-4ebb-8ca2-9f78b3e84c7d" + }, + "order": { + "amount": 1000, + "metadata": { + "currency": "USD" + } + }, + "gift": { + "credits": 2 + }, + "metadata": { + "location_id": [ + "L1" + ] + } + } + }, + "Referral Code": { + "value": { + "customer": { + "source_id": "earlybirdcust" + }, + "order": { + "amount": 20000, + "metadata": { + "currency": "USD" } }, - "related_transaction_id": null, - "created_at": "2023-03-17T16:12:00.981Z" + "metadata": { + "location_id": [ + "L1" + ] + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns information whether the voucher is valid in the context of the parameter values provided in the request body.", + "content": { + "application/json": { + "schema": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_voucher" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_false" + } + ] + }, + "examples": { + "False": { + "value": { + "valid": false, + "reason": "redemption does not match validation rules", + "error": { + "code": 400, + "key": "redemption_rules_violated", + "message": "redemption does not match validation rules", + "details": "Gift Card cannot be redeemed because of violated validation rules: val_wvipKm99CJuL", + "request_id": "v-0bccef7a9585cf63b6" + }, + "tracking_id": "track_ZGPtmYcM+Mw=", + "code": "vBQvYFEM", + "metadata": {} + } }, - { - "id": "vtx_0c9c21df658d03ce3f", - "source_id": null, - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": "Automation", - "reason": null, - "type": "POINTS_ACCRUAL", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1298, - "object": "balance", - "points": 200, - "balance": 1298, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } + "Free Shipping": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" }, - "order": { - "id": "ord_QZEKPzYATFjGoos4DonMg0fd", - "source_id": "s" + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" }, - "event": { - "id": "evcus_0c9c21def34e3c05bf", - "type": "customer.order.paid" + "tracking_id": "track_rynPcKGW2z7+kd2Vry4p12+Rx2NtyXZyiApdGWEXPrdX+44Fg6LRBQ==", + "order": { + "amount": 4300, + "total_amount": 4300, + "items": [ + { + "object": "order_item", + "product_id": "prod_0ba621bae5d39762ce", + "quantity": 1, + "amount": 1200, + "price": 1200, + "subtotal_amount": 1200, + "product": { + "id": "prod_0ba621bae5d39762ce", + "source_id": "arabica_plus", + "name": "Arabica Coffee 250g", + "price": 1200 + } + }, + { + "object": "order_item", + "product_id": "prod_0b661d404787ec6d3b", + "quantity": 1, + "amount": 3100, + "price": 3100, + "subtotal_amount": 3100, + "product": { + "id": "prod_0b661d404787ec6d3b", + "source_id": "7717f389-4621-4c7a-a6db-d4acfe051a97", + "name": "Kate Moss by Mario Testino" + } + }, + { + "object": "order_item", + "product_id": "prod_5h1pp1ng", + "quantity": 1, + "discount_quantity": 1, + "initial_quantity": 0, + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping" + } + } + ], + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" }, - "earning_rule": { - "id": "ern_2WsCIBEx6Lzf5IAV5IOR7a23", - "source": { - "banner": "Order paid" + "code": "Test - Discount - Free Shipping", + "discount": { + "type": "UNIT", + "effect": "ADD_MISSING_ITEMS", + "unit_off": 1, + "unit_type": "prod_5h1pp1ng", + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping" } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-16T08:44:52.333Z" + }, + "metadata": {} + } }, - { - "id": "vtx_0c9b09673f8a862a51", - "source_id": null, - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": null, - "reason": null, - "type": "POINTS_REFUND", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1098, - "object": "balance", - "points": 1000, - "balance": 1098, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } + "Multiple Product Varients": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" }, - "order": { - "id": "ord_DH2gGDlDWB1hRImf1VVB4EIH", - "source_id": null + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" }, - "redemption": { - "id": "r_0c9b08fe4b80897849" + "tracking_id": "track_rynPcKGW2z7+kd2Vry4p12+Rx2NtyXZyiApdGWEXPrdX+44Fg6LRBQ==", + "order": { + "id": "ord_FDdsDI3FppuiqHa4s7drZEMP", + "source_id": "47f491d1-a697-4f92-95ca-2ba1f463efa8", + "created_at": "2022-09-21T13:09:25.773Z", + "updated_at": "2022-09-21T13:09:27.139Z", + "status": "PAID", + "amount": 237300, + "initial_amount": 28000, + "discount_amount": 8400, + "items_discount_amount": 209300, + "total_discount_amount": 217700, + "total_amount": 19600, + "items_applied_discount_amount": 209300, + "total_applied_discount_amount": 209300, + "items": [ + { + "object": "order_item", + "source_id": "A0E20000000295J", + "related_object": "sku", + "product_id": "prod_0b661d31134b299cc2", + "quantity": 1, + "amount": 9500, + "price": 9500, + "subtotal_amount": 9500, + "product": { + "id": "prod_0b661d31134b299cc2", + "source_id": "2c446063-d582-4d7e-9651-23971b3e56f7", + "name": "Keychain D‘Amico" + }, + "sku": { + "id": "sku_0b661d6265cb29ae52", + "source_id": "A0E20000000295J", + "sku": "Keychain D‘Amico", + "metadata": {}, + "price": 9500 + } + }, + { + "object": "order_item", + "source_id": "M0E20000000EAT6", + "related_object": "sku", + "quantity": 1, + "amount": 18500, + "price": 18500, + "subtotal_amount": 18500, + "product": { + "name": "Jogging pants Paolo Pecora light grey" + }, + "sku": { + "sku": "Jogging pants Paolo Pecora light grey", + "metadata": {} + } + }, + { + "object": "order_item", + "product_id": "prod_5h1pp1ng", + "quantity": 1, + "discount_quantity": 1, + "initial_quantity": 0, + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping" + } + }, + { + "object": "order_item", + "product_id": "prod_0b661d4bd2c7ec7d1f", + "sku_id": "sku_0b661e41fc8d35a8f7", + "quantity": 3, + "discount_quantity": 3, + "initial_quantity": 0, + "amount": 89700, + "discount_amount": 89700, + "initial_amount": 0, + "applied_discount_amount": 89700, + "price": 29900, + "subtotal_amount": 0, + "product": { + "id": "prod_0b661d4bd2c7ec7d1f", + "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", + "name": "Casual jacket Michael Kors beige" + }, + "sku": { + "id": "sku_0b661e41fc8d35a8f7", + "source_id": "M0E20000000ELDG", + "sku": "Casual jacket Michael Kors beige", + "price": 29900 + } + }, + { + "object": "order_item", + "product_id": "prod_0b661d4bd2c7ec7d1f", + "sku_id": "sku_0b661e41fc8d35a8f6", + "quantity": 4, + "discount_quantity": 4, + "initial_quantity": 0, + "amount": 119600, + "discount_amount": 119600, + "initial_amount": 0, + "applied_discount_amount": 119600, + "price": 29900, + "subtotal_amount": 0, + "product": { + "id": "prod_0b661d4bd2c7ec7d1f", + "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", + "name": "Casual jacket Michael Kors beige" + }, + "sku": { + "id": "sku_0b661e41fc8d35a8f6", + "source_id": "M0E20000000ELDF", + "sku": "Casual jacket Michael Kors beige", + "price": 29900 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "object": "customer" + }, + "customer_id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0bb9c69ca9d5a364b2": { + "date": "2022-09-21T13:09:25.799Z", + "related_object_type": "redemption", + "related_object_id": "r_0bb9c69ca9d5a364b2", + "stacked": [ + "r_0bb9c69ca9d5a364b3", + "r_0bb9c69ca9d5a364b4" + ] + } + } }, - "rollback": { - "id": "rr_0c9b0967244a862a33" + "code": "Test - Discount - Unit - Multiple - Product Variants", + "discount": { + "type": "UNIT", + "effect": "ADD_MANY_ITEMS", + "units": [ + { + "effect": "ADD_MISSING_ITEMS", + "unit_off": 3, + "unit_type": "sku_0b661e41fc8d35a8f7", + "sku": { + "id": "sku_0b661e41fc8d35a8f7", + "source_id": "M0E20000000ELDG", + "sku": "Casual jacket Michael Kors beige" + }, + "product": { + "id": "prod_0b661d4bd2c7ec7d1f", + "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", + "name": "Casual jacket Michael Kors beige" + } + }, + { + "effect": "ADD_NEW_ITEMS", + "unit_off": 4, + "unit_type": "sku_0b661e41fc8d35a8f6", + "sku": { + "id": "sku_0b661e41fc8d35a8f6", + "source_id": "M0E20000000ELDF", + "sku": "Casual jacket Michael Kors beige" + }, + "product": { + "id": "prod_0b661d4bd2c7ec7d1f", + "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", + "name": "Casual jacket Michael Kors beige" + } + } + ] }, - "reward": { - "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "name": "100 = $20" - } - }, - "related_transaction_id": null, - "created_at": "2023-03-15T12:19:29.149Z" + "metadata": {} + } }, - { - "id": "vtx_0c9b08fe530089785c", - "source_id": null, - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": null, - "reason": null, - "type": "POINTS_REDEMPTION", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1098, - "object": "balance", - "points": -1000, - "balance": 98, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } + "Unit - Add order items": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" }, - "order": { - "id": "ord_DH2gGDlDWB1hRImf1VVB4EIH", - "source_id": null + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" }, - "redemption": { - "id": "r_0c9b08fe4b80897849" + "tracking_id": "track_rynPcKGW2z7+kd2Vry4p12+Rx2NtyXZyiApdGWEXPrdX+44Fg6LRBQ==", + "session": { + "key": "ssn_K7DV3RbAGNCRVrPNZxJfld3FdwAQwOGl", + "type": "LOCK", + "ttl": 1, + "ttl_unit": "NANOSECONDS" }, - "reward": { - "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "name": "100 = $20" - } - }, - "related_transaction_id": null, - "created_at": "2023-03-15T12:17:41.708Z" - }, - { - "id": "vtx_0c9b074afed3b30e4b", - "source_id": "20230309_add_points_1", - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": "voucherify-web-ui", - "reason": "Customer purchased points at kiosk.", - "type": "POINTS_ADDITION", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1098, - "object": "balance", - "points": 100, - "balance": 1098, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-15T12:10:15.917Z" - }, - { - "id": "vtx_0c9b073072408969d1", - "source_id": "20230309_subtract_points_1", - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": "voucherify-web-ui", - "reason": "Customer used points to obtain tickets.", - "type": "POINTS_REMOVAL", - "details": { - "balance": { - "type": "loyalty_card", - "total": 998, - "object": "balance", - "points": -1, - "balance": 998, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-15T12:09:48.735Z" - }, - { - "id": "vtx_0c9afe802593b34b80", - "source_id": null, - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": "API", - "reason": null, - "type": "POINTS_TRANSFER_OUT", - "details": { - "balance": { - "type": "loyalty_card", - "total": 999, - "object": "balance", - "points": -1, - "balance": 999, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" + "order": { + "id": "ord_FDdsDI3FppuiqHa4s7drZEMP", + "source_id": "47f491d1-a697-4f92-95ca-2ba1f463efa8", + "created_at": "2022-09-21T13:09:25.773Z", + "updated_at": "2022-09-21T13:09:27.139Z", + "status": "PAID", + "amount": 117700, + "initial_amount": 28000, + "discount_amount": 8400, + "items_discount_amount": 89700, + "total_discount_amount": 98100, + "total_amount": 19600, + "items_applied_discount_amount": 89700, + "total_applied_discount_amount": 89700, + "items": [ + { + "object": "order_item", + "source_id": "A0E20000000295J", + "related_object": "sku", + "product_id": "prod_0b661d31134b299cc2", + "quantity": 1, + "amount": 9500, + "price": 9500, + "subtotal_amount": 9500, + "product": { + "id": "prod_0b661d31134b299cc2", + "source_id": "2c446063-d582-4d7e-9651-23971b3e56f7", + "name": "Keychain D‘Amico" + }, + "sku": { + "id": "sku_0b661d6265cb29ae52", + "source_id": "A0E20000000295J", + "sku": "Keychain D‘Amico", + "metadata": {}, + "price": 9500 + } + }, + { + "object": "order_item", + "source_id": "M0E20000000EAT6", + "related_object": "sku", + "quantity": 1, + "amount": 18500, + "price": 18500, + "subtotal_amount": 18500, + "product": { + "name": "Jogging pants Paolo Pecora light grey" + }, + "sku": { + "sku": "Jogging pants Paolo Pecora light grey", + "metadata": {} + } + }, + { + "object": "order_item", + "product_id": "prod_5h1pp1ng", + "quantity": 1, + "discount_quantity": 1, + "initial_quantity": 0, + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping" + } + }, + { + "object": "order_item", + "product_id": "prod_0b661d4bd2c7ec7d1f", + "sku_id": "sku_0b661e41fc8d35a8f8", + "quantity": 3, + "discount_quantity": 3, + "initial_quantity": 0, + "amount": 89700, + "discount_amount": 89700, + "initial_amount": 0, + "applied_discount_amount": 89700, + "price": 29900, + "subtotal_amount": 0, + "product": { + "id": "prod_0b661d4bd2c7ec7d1f", + "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", + "name": "Casual jacket Michael Kors beige" + }, + "sku": { + "id": "sku_0b661e41fc8d35a8f8", + "source_id": "M0E20000000ELDH", + "sku": "Casual jacket Michael Kors beige", + "price": 29900 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "object": "customer" + }, + "customer_id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0bb9c69ca9d5a364b2": { + "date": "2022-09-21T13:09:25.799Z", + "related_object_type": "redemption", + "related_object_id": "r_0bb9c69ca9d5a364b2", + "stacked": [ + "r_0bb9c69ca9d5a364b3", + "r_0bb9c69ca9d5a364b4" + ] + } } }, - "destination_voucher": { - "id": "v_Wak6xlf5WdR4rIcvJxC2olOopk0boK6t", - "code": "LOYALTY-CARD-A8XVurg", - "type": "LOYALTY_CARD", - "campaign": "Loyalty Campaign - Test Initial Points", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "loyalty_card": { - "points": 1001, - "balance": 1001, - "next_expiration_date": "2023-12-31", - "next_expiration_points": 1 + "code": "Test - Discount - Unit - Add new order items", + "discount": { + "type": "UNIT", + "effect": "ADD_NEW_ITEMS", + "unit_off": 3, + "unit_type": "sku_0b661e41fc8d35a8f8", + "sku": { + "id": "sku_0b661e41fc8d35a8f8", + "source_id": "M0E20000000ELDH", + "sku": "Casual jacket Michael Kors beige" }, - "is_referral_code": false - } - }, - "related_transaction_id": "vtx_0c9afe802593b34b81", - "created_at": "2023-03-15T11:31:51.062Z" - } - ], - "has_more": false - } - } - } - } - } - } - } - } - }, - "/v1/loyalties/members/{memberId}/transactions": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "memberId", - "in": "path", - "required": true, - "description": "A unique code identifying the loyalty card that you are looking to retrieve transaction data for." - } - ], - "get": { - "operationId": "list-loyalty-card-transactions", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Loyalty Card Transactions", - "description": "Retrieve transaction data related to point movements for a specific loyalty card.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary of loyalty card transaction objects.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_get_loyalty_card_transactions" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "vtx_0c9dd3c2e392f78613", - "source_id": "20230317_transfer_1", - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": "API", - "reason": "Transferring points to card", - "type": "POINTS_TRANSFER_OUT", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1396, - "object": "balance", - "points": -1, - "balance": 1396, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" + "product": { + "id": "prod_0b661d4bd2c7ec7d1f", + "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", + "name": "Casual jacket Michael Kors beige" } }, - "destination_voucher": { - "id": "v_Wak6xlf5WdR4rIcvJxC2olOopk0boK6t", - "code": "LOYALTY-CARD-A8XVurg", - "type": "LOYALTY_CARD", - "campaign": "Loyalty Campaign - Test Initial Points", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "loyalty_card": { - "points": 1102, - "balance": 1102, - "next_expiration_date": "2023-12-31", - "next_expiration_points": 102 - }, - "is_referral_code": false - } - }, - "related_transaction_id": "vtx_0c9dd3c2e392f78614", - "created_at": "2023-03-17T16:20:33.807Z" + "metadata": {} + } }, - { - "id": "vtx_0c9dd2527696ba081b", - "source_id": "20230317_add_1", - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": null, - "reason": "Adding points to card", - "type": "POINTS_ADDITION", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1397, - "object": "balance", - "points": 100, - "balance": 1397, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-17T16:14:16.524Z" + "Fixed": { + "value": { + "valid": true, + "applicable_to": { + "data": [ + { + "object": "product", + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "strict": false, + "price": 2000, + "price_formula": "IF(ORDER_AMOUNT > 400;0;20)", + "effect": "APPLY_TO_EVERY" + }, + { + "object": "products_collection", + "id": "pc_2KWKXn09Dk8neCfymqd4xOq8", + "strict": false, + "price": 99900, + "price_formula": "IF(ORDER_AMOUNT > 300;ORDER_ITEM_PRICE * 0.8;ORDER_ITEM_PRICE)", + "effect": "APPLY_TO_EVERY" + }, + { + "object": "products_collection", + "id": "pc_x7HELQo52g2uI6nDuuOTRjAW", + "strict": false, + "price": 99900, + "price_formula": "IF(ORDER_AMOUNT > 200;ORDER_ITEM_PRICE * 0.9;ORDER_ITEM_PRICE)", + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0bd76ca337954ca116", + "source_id": "webinar_BF_sweater_pink_sweater", + "strict": true, + "price": 99900, + "price_formula": "IF(ORDER_AMOUNT > 300;ORDER_ITEM_PRICE * 0.8;ORDER_ITEM_PRICE)", + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0bd76bd0e204542738", + "source_id": "webinar_BF_pants_navy_sweat_pants", + "strict": true, + "price": 99900, + "price_formula": "IF(ORDER_AMOUNT > 200;ORDER_ITEM_PRICE * 0.9;ORDER_ITEM_PRICE)", + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0bd76b8656956a183f", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "strict": true, + "price": 99900, + "price_formula": "IF(ORDER_AMOUNT > 200;ORDER_ITEM_PRICE * 0.9;ORDER_ITEM_PRICE)", + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0bd76f59f98617518e", + "source_id": "webinar_BF_sweater_pearl", + "strict": true, + "price": 99900, + "price_formula": "IF(ORDER_AMOUNT > 300;ORDER_ITEM_PRICE * 0.8;ORDER_ITEM_PRICE)", + "effect": "APPLY_TO_EVERY" + } + ], + "total": 7, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_rynPcKGW2z7+kd2Vry4p12+Rx2NtyXZyiApdGWEXPrdX+44Fg6LRBQ==", + "session": { + "key": "ssn_u8rvi3Ac70S5ZRELWrxYsR2bnolpVWNg", + "type": "LOCK", + "ttl": 7, + "ttl_unit": "DAYS" + }, + "order": { + "amount": 46500, + "items_discount_amount": 9300, + "total_discount_amount": 9300, + "total_amount": 37200, + "items_applied_discount_amount": 9300, + "total_applied_discount_amount": 9300, + "items": [ + { + "object": "order_item", + "source_id": "webinar_BF_sweater_pink_sweater", + "related_object": "product", + "quantity": 1, + "amount": 6500, + "discount_amount": 1300, + "applied_discount_amount": 1300, + "price": 6500, + "subtotal_amount": 5200, + "product": { + "id": "prod_0bd76ca337954ca116", + "source_id": "webinar_BF_sweater_pink_sweater", + "name": "Pink Sweater", + "price": 6500 + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_pants_navy_sweat_pants", + "related_object": "product", + "quantity": 1, + "amount": 6000, + "discount_amount": 600, + "applied_discount_amount": 600, + "price": 6000, + "subtotal_amount": 5400, + "product": { + "id": "prod_0bd76bd0e204542738", + "source_id": "webinar_BF_pants_navy_sweat_pants", + "name": "Navy Sweat Pants", + "price": 6000 + } + }, + { + "object": "order_item", + "source_id": "5h1pp1ng", + "related_object": "product", + "quantity": 1, + "amount": 2000, + "discount_amount": 2000, + "applied_discount_amount": 2000, + "price": 2000, + "subtotal_amount": 0, + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping", + "price": 0 + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "related_object": "product", + "quantity": 2, + "amount": 10000, + "discount_amount": 1000, + "applied_discount_amount": 1000, + "price": 5000, + "subtotal_amount": 9000, + "product": { + "id": "prod_0bd76b8656956a183f", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "name": "Gray Sweat Pants", + "price": 5000 + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_sweater_pearl", + "related_object": "product", + "quantity": 2, + "amount": 22000, + "discount_amount": 4400, + "applied_discount_amount": 4400, + "price": 11000, + "subtotal_amount": 17600, + "product": { + "id": "prod_0bd76f59f98617518e", + "source_id": "webinar_BF_sweater_pearl", + "name": "Pearl Sweater", + "price": 11000 + } + } + ], + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "code": "SPENDMOREGETMORE-DaIXFJvn", + "discount": { + "type": "FIXED", + "effect": "APPLY_TO_ITEMS" + }, + "metadata": { + "shoutout": "Order more than 200€ to get 10% off pants, more than 300€ to get 20% off sweaters, and more than 400€ to get free shipping." + }, + "campaign": "SPENDMOREGETMORE", + "campaign_id": "camp_Nwb2mppeDTtk23s1FVo6riwp" + } }, - { - "id": "vtx_0c9dd1ce1d403f4204", - "source_id": "20230317_subtract_1", - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": null, - "reason": "Subtracting points from card", - "type": "POINTS_REMOVAL", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1297, - "object": "balance", - "points": -1, - "balance": 1297, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } + "Voucher expired": { + "value": { + "valid": false, + "reason": "voucher expired", + "error": { + "code": 400, + "key": "voucher_expired", + "message": "voucher expired", + "details": "EarlyBird-tB6zCApA", + "request_id": "v-0be43067028abb6ca8" + }, + "tracking_id": "track_4Wb/eeza4PDXKElxYR/QtlDQOVFpY9mP", + "code": "EarlyBird-tB6zCApA", + "metadata": { + "shoutout": "Get an early bird special. The earlier you order, the better discount you will get." } - }, - "related_transaction_id": null, - "created_at": "2023-03-17T16:12:00.981Z" + } }, - { - "id": "vtx_0c9c21df658d03ce3f", - "source_id": null, - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": "Automation", - "reason": null, - "type": "POINTS_ACCRUAL", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1298, - "object": "balance", - "points": 200, - "balance": 1298, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } + "Percentage": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_4Wb/eeza4PDXKElxYR/QtlDQOVFpY9mP", + "session": { + "key": "your_custom_key", + "type": "LOCK", + "ttl": 1, + "ttl_unit": "NANOSECONDS" }, "order": { - "id": "ord_QZEKPzYATFjGoos4DonMg0fd", - "source_id": "s" + "amount": 46500, + "discount_amount": 4650, + "total_discount_amount": 4650, + "total_amount": 41850, + "applied_discount_amount": 4650, + "total_applied_discount_amount": 4650, + "items": [ + { + "object": "order_item", + "source_id": "webinar_BF_sweater_pink_sweater", + "related_object": "product", + "quantity": 1, + "amount": 6500, + "price": 6500, + "subtotal_amount": 6500, + "product": { + "id": "prod_0bd76ca337954ca116", + "source_id": "webinar_BF_sweater_pink_sweater", + "name": "Pink Sweater", + "price": 6500 + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_pants_navy_sweat_pants", + "related_object": "product", + "quantity": 1, + "amount": 6000, + "price": 6000, + "subtotal_amount": 6000, + "product": { + "id": "prod_0bd76bd0e204542738", + "source_id": "webinar_BF_pants_navy_sweat_pants", + "name": "Navy Sweat Pants", + "price": 6000 + } + }, + { + "object": "order_item", + "source_id": "5h1pp1ng", + "related_object": "product", + "quantity": 1, + "amount": 2000, + "price": 2000, + "subtotal_amount": 2000, + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping", + "price": 0 + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "related_object": "product", + "quantity": 2, + "amount": 10000, + "price": 5000, + "subtotal_amount": 10000, + "product": { + "id": "prod_0bd76b8656956a183f", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "name": "Gray Sweat Pants", + "price": 5000 + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_sweater_pearl", + "related_object": "product", + "quantity": 2, + "amount": 22000, + "price": 11000, + "subtotal_amount": 22000, + "product": { + "id": "prod_0bd76f59f98617518e", + "source_id": "webinar_BF_sweater_pearl", + "name": "Pearl Sweater", + "price": 11000 + } + } + ], + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "code": "EarlyBird-tB6zCApA", + "discount": { + "type": "PERCENT", + "effect": "APPLY_TO_ORDER", + "percent_off": 10 }, - "event": { - "id": "evcus_0c9c21def34e3c05bf", - "type": "customer.order.paid" + "expiration_date": "2022-10-29T00:00:00.000Z", + "metadata": { + "shoutout": "Get an early bird special. The earlier you order, the better discount you will get." }, - "earning_rule": { - "id": "ern_2WsCIBEx6Lzf5IAV5IOR7a23", - "source": { - "banner": "Order paid" - } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-16T08:44:52.333Z" + "campaign": "Webinar - Early Bird Scenario", + "campaign_id": "camp_z1g3iFqQe5qiZ9TTYFVpMwC0" + } }, - { - "id": "vtx_0c9b09673f8a862a51", - "source_id": null, - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": null, - "reason": null, - "type": "POINTS_REFUND", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1098, - "object": "balance", - "points": 1000, - "balance": 1098, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } + "Amount": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_4Wb/eeza4PDXKElxYR/QtlDQOVFpY9mP", + "session": { + "key": "your_custom_key", + "type": "LOCK", + "ttl": 1, + "ttl_unit": "NANOSECONDS" }, "order": { - "id": "ord_DH2gGDlDWB1hRImf1VVB4EIH", - "source_id": null + "amount": 46500, + "discount_amount": 1000, + "total_discount_amount": 1000, + "total_amount": 45500, + "applied_discount_amount": 1000, + "total_applied_discount_amount": 1000, + "items": [ + { + "object": "order_item", + "source_id": "webinar_BF_sweater_pink_sweater", + "related_object": "product", + "quantity": 1, + "amount": 6500, + "price": 6500, + "subtotal_amount": 6500, + "product": { + "id": "prod_0bd76ca337954ca116", + "source_id": "webinar_BF_sweater_pink_sweater", + "name": "Pink Sweater", + "price": 6500 + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_pants_navy_sweat_pants", + "related_object": "product", + "quantity": 1, + "amount": 6000, + "price": 6000, + "subtotal_amount": 6000, + "product": { + "id": "prod_0bd76bd0e204542738", + "source_id": "webinar_BF_pants_navy_sweat_pants", + "name": "Navy Sweat Pants", + "price": 6000 + } + }, + { + "object": "order_item", + "source_id": "5h1pp1ng", + "related_object": "product", + "quantity": 1, + "amount": 2000, + "price": 2000, + "subtotal_amount": 2000, + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping", + "price": 0 + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "related_object": "product", + "quantity": 2, + "amount": 10000, + "price": 5000, + "subtotal_amount": 10000, + "product": { + "id": "prod_0bd76b8656956a183f", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "name": "Gray Sweat Pants", + "price": 5000 + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_sweater_pearl", + "related_object": "product", + "quantity": 2, + "amount": 22000, + "price": 11000, + "subtotal_amount": 22000, + "product": { + "id": "prod_0bd76f59f98617518e", + "source_id": "webinar_BF_sweater_pearl", + "name": "Pearl Sweater", + "price": 11000 + } + } + ], + "metadata": { + "currency": "EUR" + }, + "customer_id": null, + "referrer_id": null, + "object": "order" }, - "redemption": { - "id": "r_0c9b08fe4b80897849" + "code": "PAYINEUROS", + "discount": { + "type": "AMOUNT", + "effect": "APPLY_TO_ORDER", + "amount_off": 1000 + }, + "metadata": { + "shoutout": "Pay in euros to get 10 Euros off, any other currency to get 5 off in that currency." + } + } + }, + "Loyalty points exceeded": { + "value": { + "valid": false, + "reason": "loyalty card points exceeded", + "error": { + "code": 400, + "key": "loyalty_card_points_exceeded", + "message": "loyalty card points exceeded", + "details": "LOYALTY-CARD-ng3Kb9tM", + "request_id": "v-0be434ae35cabb018a" + }, + "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", + "code": "LOYALTY-CARD-ng3Kb9tM", + "metadata": {} + } + }, + "Loyalty Card": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", + "order": { + "amount": 14500, + "discount_amount": 50, + "total_discount_amount": 50, + "total_amount": 14450, + "applied_discount_amount": 50, + "total_applied_discount_amount": 50, + "items": [ + { + "object": "order_item", + "product_id": "prod_0bd76fc58f8038b043", + "quantity": 1, + "amount": 8500, + "price": 8500, + "subtotal_amount": 8500, + "product": { + "id": "prod_0bd76fc58f8038b043", + "source_id": "webinar_BF_sweater_yellow", + "name": "Yellow Sweater", + "price": 8500 + } + }, + { + "object": "order_item", + "product_id": "prod_0bd76bd0e204542738", + "quantity": 1, + "amount": 6000, + "price": 6000, + "subtotal_amount": 6000, + "product": { + "id": "prod_0bd76bd0e204542738", + "source_id": "webinar_BF_pants_navy_sweat_pants", + "name": "Navy Sweat Pants", + "price": 6000 + } + } + ], + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" }, - "rollback": { - "id": "rr_0c9b0967244a862a33" + "code": "LOYALTY-CARD-ng3Kb9tM", + "loyalty": { + "points_cost": 10 }, "reward": { - "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "name": "100 = $20" - } - }, - "related_transaction_id": null, - "created_at": "2023-03-15T12:19:29.149Z" + "id": "rew_4ZF6Y69U2PXE3GLIZxfozgg1", + "assignment_id": "rewa_WkeBlLhj0sRae70J5AAvLbmy", + "points": 10 + }, + "metadata": {}, + "campaign": "Loyalty Campaign", + "campaign_id": "camp_ZNb23Xtw1WuGCm7gdax84PUi" + } }, - { - "id": "vtx_0c9b08fe530089785c", - "source_id": null, - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": null, - "reason": null, - "type": "POINTS_REDEMPTION", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1098, - "object": "balance", - "points": -1000, - "balance": 98, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } + "Voucher disabled": { + "value": { + "valid": false, + "reason": "voucher is disabled", + "error": { + "code": 400, + "key": "voucher_disabled", + "message": "voucher is disabled", + "details": "GIFT-CARD-kW4aEsfB", + "request_id": "v-0be43817d7121a437d" + }, + "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", + "code": "GIFT-CARD-kW4aEsfB", + "metadata": {} + } + }, + "Gift Card": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" }, + "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", "order": { - "id": "ord_DH2gGDlDWB1hRImf1VVB4EIH", - "source_id": null + "amount": 1000, + "discount_amount": 2, + "total_discount_amount": 2, + "total_amount": 998, + "applied_discount_amount": 2, + "total_applied_discount_amount": 2, + "metadata": { + "currency": "USD" + }, + "customer_id": null, + "referrer_id": null, + "object": "order" }, - "redemption": { - "id": "r_0c9b08fe4b80897849" + "code": "GIFT-CARD-kW4aEsfB", + "gift": { + "amount": 32000, + "balance": 21500, + "effect": "APPLY_TO_ORDER" }, - "reward": { - "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "name": "100 = $20" - } - }, - "related_transaction_id": null, - "created_at": "2023-03-15T12:17:41.708Z" - }, - { - "id": "vtx_0c9b074afed3b30e4b", - "source_id": "20230309_add_points_1", - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": "voucherify-web-ui", - "reason": "Customer purchased points at kiosk.", - "type": "POINTS_ADDITION", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1098, - "object": "balance", - "points": 100, - "balance": 1098, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-15T12:10:15.917Z" + "metadata": {}, + "campaign": "Gift Card Campaign", + "campaign_id": "camp_ZjoZEdmnyUCPYwMPN0IVbvDK" + } }, - { - "id": "vtx_0c9b073072408969d1", - "source_id": "20230309_subtract_points_1", - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": "voucherify-web-ui", - "reason": "Customer used points to obtain tickets.", - "type": "POINTS_REMOVAL", - "details": { - "balance": { - "type": "loyalty_card", - "total": 998, - "object": "balance", - "points": -1, - "balance": 998, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-15T12:09:48.735Z" + "Cannot be redeemed by referrer": { + "value": { + "valid": false, + "reason": "voucher cannot be redeemed by referrer", + "error": { + "code": 400, + "key": "referrer_not_permitted_to_redeem", + "message": "voucher cannot be redeemed by referrer", + "details": "REFERRAL-CODE-OxBakPYf", + "request_id": "v-0be43a8a110abb1bd3" + }, + "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", + "code": "REFERRAL-CODE-OxBakPYf", + "metadata": {} + } }, - { - "id": "vtx_0c9afe802593b34b80", - "source_id": null, - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": "API", - "reason": null, - "type": "POINTS_TRANSFER_OUT", - "details": { - "balance": { - "type": "loyalty_card", - "total": 999, - "object": "balance", - "points": -1, - "balance": 999, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } + "Referral Code": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" }, - "destination_voucher": { - "id": "v_Wak6xlf5WdR4rIcvJxC2olOopk0boK6t", - "code": "LOYALTY-CARD-A8XVurg", - "type": "LOYALTY_CARD", - "campaign": "Loyalty Campaign - Test Initial Points", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "loyalty_card": { - "points": 1001, - "balance": 1001, - "next_expiration_date": "2023-12-31", - "next_expiration_points": 1 + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_p6hPsnZj2VSvyXDjH9o6aQ==", + "order": { + "amount": 20000, + "discount_amount": 6000, + "total_discount_amount": 6000, + "total_amount": 14000, + "applied_discount_amount": 6000, + "total_applied_discount_amount": 6000, + "metadata": { + "currency": "USD" }, - "is_referral_code": false - } - }, - "related_transaction_id": "vtx_0c9afe802593b34b81", - "created_at": "2023-03-15T11:31:51.062Z" + "referrer": { + "id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "object": "customer" + }, + "customer_id": null, + "referrer_id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "object": "order" + }, + "code": "REFERRAL-CODE-OxBakPYf", + "discount": { + "type": "PERCENT", + "effect": "APPLY_TO_ORDER", + "percent_off": 30 + }, + "metadata": {}, + "campaign": "Referral Campaign", + "campaign_id": "camp_TnOf5NB4Jtjxwoq38WckMJfy" + } } - ], - "has_more": false - } - } - } - } - } - } - } - } - }, - "/v1/loyalties/members/{memberId}/transactions/export": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "memberId", - "in": "path", - "required": true, - "description": "A unique code identifying the loyalty card that you are looking to export transaction data for." - } - ], - "post": { - "operationId": "export-loyalty-card-transactions", - "tags": [ - "LOYALTIES API" - ], - "summary": "Export Loyalty Card Transactions", - "description": "Export transactions that are associated with point movements on a loyalty card.\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID assigned by Voucherify. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `POINTS_EXPIRATION`
- `POINTS_ADDITION`
- `POINTS_REMOVAL`
- `POINTS_TRANSFER_OUT`
- `POINTS_ACCRUAL`
- `POINTS_REFUND`
- `POINTS_REDEMPTION` |\n| source_id | Custom source ID of the transaction if one was included originally. | source_id_custom |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The loyalty card balance after the transaction. | |\n| amount | The amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | - `API`
- `voucherify-web-ui`
- `Automation` |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n| related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the parameters and filters for the transaction export.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_create_loyalty_card_transactions_export" - }, - "examples": { - "Example": { - "value": { - "parameters": { - "order": "-created_at", - "fields": [ - "id", - "type", - "source_id", - "reason", - "balance", - "amount", - "created_at", - "voucher_id", - "campaign_id", - "details", - "related_transaction_id" - ] + } } } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns an export object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_export_transactions_object" - }, - "examples": { - "Example": { - "value": { - "id": "exp_8Fwd6Z8NS67ZH314KRtm5xXE", - "object": "export", - "created_at": "2023-03-21T13:50:43.286Z", - "status": "SCHEDULED", - "channel": "API", - "exported_object": "voucher_transactions", - "parameters": { - "order": "-created_at", - "fields": [ - "id", - "type", - "source_id", - "reason", - "balance", - "amount", - "created_at", - "voucher_id", - "campaign_id", - "details", - "related_transaction_id" - ], - "filters": { - "voucher_id": { - "conditions": { - "$in": [ - "LOYALTY-CARD-2IAoDNF" - ] + }, + "400": { + "description": "Returns an error if request body is missing parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error" + }, + "examples": { + "Missing reward": { + "value": { + "code": 400, + "key": "missing_reward", + "message": "Missing reward", + "details": "A reward is required when redeeming a LOYALTY_CARD", + "request_id": "v-0bcb925c6d90f7f8fc", + "error": { + "message": "Missing reward = please add one." } } - } - }, - "result": null, - "user_id": null - } - }, - "No request body": { - "value": { - "id": "exp_ExEE5A6OIK4tssuNswr5O6SU", - "object": "export", - "created_at": "2023-03-21T13:34:57.034Z", - "status": "SCHEDULED", - "channel": "API", - "exported_object": "voucher_transactions", - "parameters": { - "filters": { - "voucher_id": { - "conditions": { - "$in": [ - "HRwc0oHz" - ] + }, + "Missing Parameter": { + "value": { + "code": 400, + "key": "missing_order_items_amount", + "message": "Missing applicable order items", + "details": "At least one applicable order item with amount is required to redeem this GIFT_VOUCHER", + "request_id": "v-0bcccfd04085cf2540", + "error": { + "message": "Request should contain an amount for the item." } } + }, + "Metadata Validation Failed": { + "value": { + "code": 400, + "key": "metadata_validation_failed", + "message": "Metadata validation failed", + "details": "location_id: must be an array, and every element: must be a string, must be equal to one of L1,L2,L3 (actual value is 'L1')", + "request_id": "v-0bcced27715305d3fa" + } } - }, - "result": null, - "user_id": null + } } } } } } }, - "404": { - "description": "Returns an error if the voucher code does not exist or has been deleted.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + "/client/v1/validate": { + "get": { + "operationId": "validate-voucher-client-side", + "deprecated": true, + "tags": [ + "VALIDATIONS API" + ], + "summary": "Validate Voucher (client-side) [Deprecated]", + "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for voucher validation, and we do not recommend using it. The new [Stackable Discounts API](ref:validate-stacked-discounts-client-side) 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. \n\nTo verify a voucher code given by customer, you can use this method. It is designed for client side integration which means that is accessible only through public keys. This method is designed to be run directly either in web browsers or mobile apps.\n\n> ❗️ Specifying gift credits and loyalty points\n>\n> This endpoint does not support specifying the specific amount of gift credits to apply to an order nor the specific amount of loyalty points to an order. It calculates the amount that is available on the card and applies as much credits or points as possible to cover the total amount. \n\n### Set customer identity (optional)\n\nVoucherify can help you track anonymous customers. Once you integrate Voucherify into your web app and call the validate method, Voucherify will return a tracking ID and the script will store it in a cookie. Each subsequent validate call will use the same tracking ID.\n\nVoucherify tracks a user using a tracking ID to see if the user who is validating vouchers is the same as the one who consuming them. Voucherify does this by setting up an identity for the user. A `tracking_id` will be generated on the server side, unless you specify your own `tracking_id`. In both cases, you will receive the `tracking_id` in the validation response.\n\nThe returned `tracking_id` field should be used as the customer `source_id` in subsequent redemption requests. Moreover, the `tracking_id` returned from Validation API is encoded. Voucherify will recognize both values for identifying customer - the one before encryption sent as a query parameter to the **GET** `/validate` request, and the version encrypted and returned as part of the validation request.\n\n### Sample workflow\n\nCustomer tracking workflow in a nutshell:\n\n**Client-side:**\n * A customer visits your website.\n * A customer validates a voucher code. That triggers a validate request to be sent to Voucherify. In the request, you pass the tracking_id or customer.source_id. As a result, the API call to this endpoint returns an **encoded** `tracking_id`.\n\n**Backend:**\n * Once the customer finishes the checkout process, your website passes the `tracking_id` to your backend during a redemption call. The `tracking_id` is sent as a value assigned to the property *source_id* in a customer object.\n * A customer object is created and within the redemption response, you get a customer `id`.\n * You can use the customer `id` or the customer `source_id` to fetch or modify the customer details.\n \nA customer is created (upserted) automatically with a redemption call. Alternatively, you can create a new profile by creating a customer via a dedicated API method. Take a look at the customer object to understand the [entity's structure](ref:get-customer). \n\n\n\n> 📘 Customer identifier\n>\n> The source id of the customer may either be an already hashed version of the `tracking_id`, which you received in a response from a validation request or a custom ID you predefined (i.e. an email address). Nevertheless, we recommend using identifiers delivered by Voucherify API.\n\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -H \"origin: yourdomain.com\" \\\n 'https://api.voucherify.io/client/v1/validate?code=PAYINEUROS&session_type=LOCK&session_key=A&session_ttl=1&session_ttl_unit=NANOSECONDS&customer=cust_4vMj8Twr5nBzvTrNCgipMb6M&[order][metadata][currency]=EUR&[metadata][location_id][0]=L1&[item][0][source_id]=webinar_BF_sweater_pink_sweater&[item][0][quantity]=2&[item][0][related_object]=product'\n```\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -H \"origin: yourdomain.com\" \\\n 'https://api.voucherify.io/client/v1/validate?code=LOYALTY-CARD-ng3Kb9tM&session_type=LOCK&session_key=A&session_ttl=1&session_ttl_unit=NANOSECONDS&customer[source_id]=286401dc-6f4c-4ebb-8ca2-9f78b3e84c7d&[order][metadata][currency]=EUR&[customer][metadata][age]=24&[customer][metadata][acquisition_channel]=Facebook&[metadata][location_id][0]=L1&[item][0][source_id]=webinar_BF_sweater_pink_sweater&[item][0][quantity]=2&[item][0][related_object]=product&[item][1][source_id]=webinar_BF_pants_gray_sweat_pants&[item][1][quantity]=2&[item][1][related_object]=product&[item][2][product_id]=prod_0bd76bb4aa003890cb&[item][2][quantity]=2&[item][3][source_id]=M0E20000000ELDH&[item][3][quantity]=3&[item][3][related_object]=sku'\n```\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -H \"origin: yourdomain.com\" \\\n 'https://api.voucherify.io/client/v1/validate?code=GIFT-CARD-kW4aEsfB&session_type=LOCK&session_key=A&session_ttl=1&session_ttl_unit=NANOSECONDS&customer[source_id]=286401dc-6f4c-4ebb-8ca2-9f78b3e84c7d&[order][metadata][currency]=EUR&[customer][metadata][age]=24&[customer][metadata][acquisition_channel]=Facebook&[metadata][location_id][0]=L1&[item][0][source_id]=webinar_BF_sweater_pink_sweater&[item][0][quantity]=2&[item][0][related_object]=product&[item][1][source_id]=webinar_BF_pants_gray_sweat_pants&[item][1][quantity]=2&[item][1][related_object]=product&[item][2][product_id]=prod_0bd76bb4aa003890cb&[item][2][quantity]=2&[item][3][source_id]=M0E20000000ELDH&[item][3][quantity]=3&[item][3][related_object]=sku&[item][4][sku_id]=sku_0b661e41fc0d35a8f1&[item][4][quantity]=4'\n```\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -H \"origin: yourdomain.com\" \\\n 'https://api.voucherify.io/client/v1/validate?code=REFERRAL-CODE-OxBakPYf&amount=10000'\n```\n\n### [JSFiddle Example](https://jsfiddle.net/voucherify/gfu2bgn5/)\n\n```javascript\n\n\n\n```\n\n### Examples with Query Parameters\n\n| **Query Parameters** | **Example URL** |\n|:---|:---|\n| Shortcut - `customer` query param instead of `customer[source_id]` | `https://api.voucherify.io/client/v1/validate?code=sKKFCKLZ&amount=10100&customer=customer_id` |\n| Pass `customer`'s and `redemption`'s context `metadata` in query parameters | `https://api.voucherify.io/client/v1/validate?code=sKKFCKLZ&amount=10100&customer=sure_he_is_new&metadata[shop]=1&customer[metadata][propsy]=2&metadata[test]=true` |\n| Use `tracking_id` instead of `source_id` | `https://api.voucherify.io/client/v1/validate?code=IKU-mvS-JOG&amount=10100&tracking_id=sure_he_is_new_5&metadata[shop]=1&metadata[test]=true` |\n\n### Reasons why a validation might fail\n\nVoucher validation might fail because of one of these reasons:\n\n* `voucher not found` - voucher doesn't exist or was [deleted](ref:delete-voucher)\n* `voucher expired` - voucher is out of [start date - expiration date] timeframe\n* `voucher is disabled` - learn more about [disabled vouchers](ref:disable-voucher)\n* `customer does not match segment rules` - learn more customer tracking LINK\n* `order does not match validation rules` - learn more about validation rules LINK", + "parameters": [ + { + "$ref": "#/components/parameters/origin" }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id IrKORhS", - "request_id": "v-0a96cd820301c0483a", - "resource_id": "IrKORhS", - "resource_type": "voucher" - } - } - } - } - } - } - } - } - }, - "/v1/loyalties/{campaignId}/members/{memberId}/transactions/export": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export." - }, - { - "schema": { - "type": "string" - }, - "name": "memberId", - "in": "path", - "required": true, - "description": "A unique code identifying the loyalty card that you are looking to export transaction data for." - } - ], - "post": { - "operationId": "export-loyalty-card-transactions-1", - "tags": [ - "LOYALTIES API" - ], - "summary": "Export Loyalty Card Transactions", - "description": "Export transactions that are associated with point movements on a loyalty card.\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID assigned by Voucherify. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `POINTS_EXPIRATION`
- `POINTS_ADDITION`
- `POINTS_REMOVAL`
- `POINTS_TRANSFER_OUT`
- `POINTS_ACCRUAL`
- `POINTS_REFUND`
- `POINTS_REDEMPTION` |\n| source_id | Custom source ID of the transaction if one was included originally. | source_id_custom |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The loyalty card balance after the transaction. | |\n| amount | The amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | - `API`
- `voucherify-web-ui`
- `Automation` |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n| related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the parameters and filters for the transaction export.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_create_loyalty_card_transactions_export" - }, - "examples": { - "Example": { - "value": { - "parameters": { - "order": "-created_at", - "fields": [ - "id", - "type", - "source_id", - "reason", - "balance", - "amount", - "created_at", - "voucher_id", - "campaign_id", - "details", - "related_transaction_id" - ] - } - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns an export object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_export_transactions_object" - }, - "examples": { - "Example": { - "value": { - "id": "exp_8Fwd6Z8NS67ZH314KRtm5xXE", - "object": "export", - "created_at": "2023-03-21T13:50:43.286Z", - "status": "SCHEDULED", - "channel": "API", - "exported_object": "voucher_transactions", - "parameters": { - "order": "-created_at", - "fields": [ - "id", - "type", - "source_id", - "reason", - "balance", - "amount", - "created_at", - "voucher_id", - "campaign_id", - "details", - "related_transaction_id" - ], - "filters": { - "voucher_id": { - "conditions": { - "$in": [ - "LOYALTY-CARD-2IAoDNF" - ] - } - } - } - }, - "result": null, - "user_id": null - } + { + "schema": { + "type": "string", + "example": "7fjWdr" }, - "No request body": { - "value": { - "id": "exp_ExEE5A6OIK4tssuNswr5O6SU", - "object": "export", - "created_at": "2023-03-21T13:34:57.034Z", - "status": "SCHEDULED", - "channel": "API", - "exported_object": "voucher_transactions", - "parameters": { - "filters": { - "voucher_id": { - "conditions": { - "$in": [ - "HRwc0oHz" - ] - } + "in": "query", + "name": "code", + "description": "A code that identifies the voucher." + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "tracking_id", + "description": "A tracking identifier of a user that validated the voucher. This identifier is generated during voucher validation based on your internal ID (e.g., email, database ID) during the first request. This is a hashed customer source ID. If the request is performed for the first time, pass the internal ID to track the customer. **Although not all information is required, the extra information helps prevent fraud.**" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "amount", + "description": "A positive integer in the smallest currency unit (that is, 100 cents for $1.00) representing the total amount of the order. This amount is the sum of the order items' amounts." + }, + { + "schema": { + "type": "string", + "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" + }, + "in": "query", + "name": "session_key", + "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated." + }, + { + "schema": { + "type": "integer" + }, + "in": "query", + "name": "session_ttl", + "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session_ttl_unit` parameter." + }, + { + "schema": { + "type": "string", + "enum": [ + "HOURS", + "DAYS", + "MINUTES", + "SECONDS", + "MILLISECONDS", + "MICROSECONDS", + "NANOSECONDS" + ] + }, + "in": "query", + "name": "session_ttl_unit", + "description": "Defines the type of unit in which the session time is counted." + }, + { + "$ref": "#/components/parameters/metadata" + }, + { + "$ref": "#/components/parameters/item" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "session_type", + "description": "The session is required to establish a session between multiple parallel validation and redemption requests. This parameter is required to establish a new session. The session locks the **redemption quantity by 1** and additionally the redemption **gift credits** specified within the request for a gift card and the **loyalty points** for a loyalty card." + }, + { + "name": "customer", + "in": "query", + "required": false, + "schema": { + "anyOf": [ + { + "type": "object", + "title": "Customer details", + "description": "Customer source ID and/or customer metadata.", + "properties": { + "source_id": { + "type": "string", + "description": "Customer source ID.", + "example": "name.lastname@email.com" + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments.", + "style": "deepObject", + "explode": true } - } + }, + "style": "deepObject", + "explode": true }, - "result": null, - "user_id": null - } - } - } - } - } - }, - "404": { - "description": "Returns an error if the voucher code does not exist or has been deleted.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + { + "type": "string", + "title": "Customer ID", + "description": "Unique customer ID assigned by Voucherify, i.e. `cust_eWgXlBBiY6THFRJwX45Iakv4`.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + } + ] + }, + "description": "Customer details." }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id IrKORhS", - "request_id": "v-0a96cd820301c0483a", - "resource_id": "IrKORhS", - "resource_type": "voucher" - } - } + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "type": "object", + "title": "Order details", + "description": "Order details.", + "properties": { + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are attached to an order object. Stores additional information about the order in a structured format.", + "style": "deepObject", + "explode": true + } + }, + "style": "deepObject", + "explode": true + }, + "description": "Order details." } - } - } - } - } - } - }, - "/v1/loyalties/{campaignId}/members/{memberId}/points-expiration": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_7s3uXI44aKfIk5IhmeOPr6ic" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " - }, - { - "schema": { - "type": "string" - }, - "name": "memberId", - "in": "path", - "required": true, - "description": "Loyalty card code." - } - ], - "get": { - "operationId": "get-points-expiration", - "tags": [ - "LOYALTIES API" - ], - "summary": "Get Points Expiration", - "description": "Retrieve loyalty point expiration buckets for a given loyalty card. Expired point buckets are not returned in this endpoint. You can use the [Exports API](ref:create-export) to retrieve a list of both `ACTIVE` and `EXPIRED` point buckets.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a list of loyalty points expiration buckets along with an expiration date if the points are due to expire. No expiration date parameter is returned if the loyalty points bucket does not expire.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoyaltiesGetPointsExpirationResponseBody" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "lopb_ERSwDxeWTlvWwFrn3AtJxt3s", - "voucher_id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", - "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "bucket": { - "total_points": 2 + ], + "security": [ + { + "X-Client-Application-Id-1": [], + "X-Client-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns information whether the voucher is valid in the context of the parameter values provided in the query parameters. Moreover, it returns a hashed source identifier which can be used as tracking ID in future calls. If a validation session is established, then the session details will be returned as well. Read more on [validation sessions](doc:locking-validation-session).", + "content": { + "application/json": { + "schema": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_voucher" }, - "status": "ACTIVE", - "expires_at": "2022-11-25", - "created_at": "2022-11-25T09:10:20.994Z", - "object": "loyalty_points_bucket" + { + "$ref": "#/components/schemas/6_res_validate_voucher_false" + } + ] + }, + "examples": { + "Wrong customer": { + "value": { + "valid": false, + "reason": "customer does not match validation rules", + "error": { + "message": "Only the gift card owner can apply credits from the gift card to the order." + }, + "tracking_id": "track_0nmdnu/6xIb6NTN0Ea40oFmM4wD5QYlxAgKdSn6wh+o", + "code": "GIFT-CARD-kW4aEsfB", + "metadata": {} + } }, - { - "id": "lopb_zdeIBq3EsnPnRSDa7Tyyb6X2", - "voucher_id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", - "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "bucket": { - "total_points": 12 - }, - "status": "ACTIVE", - "expires_at": "2022-11-30", - "created_at": "2022-11-21T13:49:54.949Z", - "object": "loyalty_points_bucket" + "Validation Rule Not Satisfied": { + "value": { + "valid": false, + "reason": "redemption does not match validation rules", + "error": { + "code": 400, + "key": "redemption_rules_violated", + "message": "redemption does not match validation rules", + "details": "Discount Coupon cannot be redeemed because of violated validation rules: val_WuupvE7OVXyo", + "request_id": "v-0be54f4afa0357c12f" + }, + "tracking_id": "track_0nmdnu/6xIb6NTN0Ea40oFmM4wD5QYlxAgKdSn6wh+oychk", + "code": "PAYINEUROS", + "metadata": { + "shoutout": "Pay in euros to get 10 Euros off, any other currency to get 5 off in that currency." + } + } }, - { - "id": "lopb_Mg80vhZtqHFItWlJFYZ2rJAS", - "voucher_id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", - "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "bucket": { - "total_points": 0 - }, - "status": "ACTIVE", - "expires_at": "2023-05-30", - "created_at": "2022-06-09T11:07:07.344Z", - "updated_at": "2022-08-30T08:34:45.989Z", - "object": "loyalty_points_bucket" + "Validate Discount Coupon": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_rynPcKGW2z7+kd2Vry4p12+Rx2NtyXZyiApdGWEXPrdX+44Fg6LRBQ==", + "session": { + "key": "A", + "type": "LOCK", + "ttl": 1, + "ttl_unit": "NANOSECONDS" + }, + "order": { + "amount": 13000, + "discount_amount": 1000, + "total_discount_amount": 1000, + "total_amount": 12000, + "applied_discount_amount": 1000, + "total_applied_discount_amount": 1000, + "items": [ + { + "object": "order_item", + "source_id": "webinar_BF_sweater_pink_sweater", + "related_object": "product", + "quantity": 2, + "amount": 13000, + "price": 6500, + "subtotal_amount": 13000, + "product": { + "id": "prod_0bd76ca337954ca116", + "source_id": "webinar_BF_sweater_pink_sweater", + "name": "Pink Sweater", + "price": 6500 + } + } + ], + "metadata": { + "currency": "EUR" + }, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "code": "PAYINEUROS", + "discount": { + "type": "AMOUNT", + "effect": "APPLY_TO_ORDER", + "amount_off": 1000 + }, + "metadata": { + "shoutout": "Pay in euros to get 10 Euros off, any other currency to get 5 off in that currency." + } + } }, - { - "id": "lopb_dQE1TwyTkHAJDlVCPlqSC0nu", - "voucher_id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", - "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "bucket": { - "total_points": 13124 - }, - "status": "ACTIVE", - "created_at": "2022-02-28T12:13:57.749Z", - "updated_at": "2022-11-25T09:09:51.136Z", - "object": "loyalty_points_bucket" - } - ], - "total": 4 - } - } - } - } - } - } - } - } - }, - "/v1/loyalties/{campaignId}/points-expiration/export": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID or name." - } - ], - "post": { - "operationId": "create-points-expiration-export", - "tags": [ - "LOYALTIES API" - ], - "summary": "Create Points Expiration Export", - "description": "Schedule the generation of a points expiration CSV file for a particular campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the data filters, types of data to return and order in which the results should be returned.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_export_points_expirations" - }, - "examples": { - "Specific Vouchers": { - "value": { - "parameters": { - "fields": [ - "id", - "campaign_id", - "voucher_id", - "status", - "expires_at", - "points" - ], - "order": "-expires_at", - "filters": { - "junction": "and", - "voucher_id": { - "conditions": { - "$in": [ - "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", - "v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655" - ] + "Validate Loyalty Card": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", + "session": { + "key": "A", + "type": "LOCK", + "ttl": 1, + "ttl_unit": "NANOSECONDS" + }, + "order": { + "amount": 121700, + "discount_amount": 5000, + "total_discount_amount": 5000, + "total_amount": 116700, + "applied_discount_amount": 5000, + "total_applied_discount_amount": 5000, + "items": [ + { + "object": "order_item", + "source_id": "webinar_BF_sweater_pink_sweater", + "related_object": "product", + "quantity": 2, + "amount": 13000, + "price": 6500, + "subtotal_amount": 13000, + "product": { + "id": "prod_0bd76ca337954ca116", + "source_id": "webinar_BF_sweater_pink_sweater", + "name": "Pink Sweater", + "price": 6500 + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "related_object": "product", + "quantity": 2, + "amount": 10000, + "price": 5000, + "subtotal_amount": 10000, + "product": { + "id": "prod_0bd76b8656956a183f", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "name": "Gray Sweat Pants", + "price": 5000 + } + }, + { + "object": "order_item", + "product_id": "prod_0bd76bb4aa003890cb", + "quantity": 2, + "amount": 9000, + "price": 4500, + "subtotal_amount": 9000, + "product": { + "id": "prod_0bd76bb4aa003890cb", + "source_id": "webinar_BF_pants_black_sweat_pants", + "name": "Black Sweat Pants", + "price": 4500 + } + }, + { + "object": "order_item", + "source_id": "M0E20000000ELDH", + "related_object": "sku", + "product_id": "prod_0b661d4bd2c7ec7d1f", + "quantity": 3, + "amount": 89700, + "price": 29900, + "subtotal_amount": 89700, + "product": { + "id": "prod_0b661d4bd2c7ec7d1f", + "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", + "name": "Casual jacket Michael Kors beige" + }, + "sku": { + "id": "sku_0b661e41fc8d35a8f8", + "source_id": "M0E20000000ELDH", + "sku": "Casual jacket Michael Kors beige", + "price": 29900 + } + } + ], + "metadata": { + "currency": "EUR" + }, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "code": "LOYALTY-CARD-ng3Kb9tM", + "loyalty": { + "points_cost": 1000 + }, + "reward": { + "id": "rew_4ZF6Y69U2PXE3GLIZxfozgg1", + "assignment_id": "rewa_WkeBlLhj0sRae70J5AAvLbmy" + }, + "metadata": {}, + "campaign": "Loyalty Campaign", + "campaign_id": "camp_ZNb23Xtw1WuGCm7gdax84PUi" + } + }, + "Validate Gift Card": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", + "session": { + "key": "A", + "type": "LOCK", + "ttl": 1, + "ttl_unit": "NANOSECONDS" + }, + "order": { + "amount": 165700, + "discount_amount": 21500, + "total_discount_amount": 21500, + "total_amount": 144200, + "applied_discount_amount": 21500, + "total_applied_discount_amount": 21500, + "items": [ + { + "object": "order_item", + "source_id": "webinar_BF_sweater_pink_sweater", + "related_object": "product", + "quantity": 2, + "amount": 13000, + "price": 6500, + "subtotal_amount": 13000, + "product": { + "id": "prod_0bd76ca337954ca116", + "source_id": "webinar_BF_sweater_pink_sweater", + "name": "Pink Sweater", + "price": 6500 + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "related_object": "product", + "quantity": 2, + "amount": 10000, + "price": 5000, + "subtotal_amount": 10000, + "product": { + "id": "prod_0bd76b8656956a183f", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "name": "Gray Sweat Pants", + "price": 5000 + } + }, + { + "object": "order_item", + "product_id": "prod_0bd76bb4aa003890cb", + "quantity": 2, + "amount": 9000, + "price": 4500, + "subtotal_amount": 9000, + "product": { + "id": "prod_0bd76bb4aa003890cb", + "source_id": "webinar_BF_pants_black_sweat_pants", + "name": "Black Sweat Pants", + "price": 4500 + } + }, + { + "object": "order_item", + "source_id": "M0E20000000ELDH", + "related_object": "sku", + "product_id": "prod_0b661d4bd2c7ec7d1f", + "quantity": 3, + "amount": 89700, + "price": 29900, + "subtotal_amount": 89700, + "product": { + "id": "prod_0b661d4bd2c7ec7d1f", + "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", + "name": "Casual jacket Michael Kors beige" + }, + "sku": { + "id": "sku_0b661e41fc8d35a8f8", + "source_id": "M0E20000000ELDH", + "sku": "Casual jacket Michael Kors beige", + "price": 29900 + } + }, + { + "object": "order_item", + "product_id": "prod_0b661d4bd347ec7d26", + "sku_id": "sku_0b661e41fc0d35a8f1", + "quantity": 4, + "amount": 44000, + "price": 11000, + "subtotal_amount": 44000, + "product": { + "id": "prod_0b661d4bd347ec7d26", + "source_id": "975193eb-1911-444a-a0f0-f567efce1a8b", + "name": "Pumps ”Flex” Michael Kors black" + }, + "sku": { + "id": "sku_0b661e41fc0d35a8f1", + "source_id": "M0E20000000DMVX", + "sku": "Pumps ”Flex” Michael Kors black", + "price": 11000 + } + } + ], + "metadata": { + "currency": "EUR" + }, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "code": "GIFT-CARD-kW4aEsfB", + "gift": { + "amount": 32000, + "balance": 21500, + "effect": "APPLY_TO_ORDER" + }, + "metadata": {}, + "campaign": "Gift Card Campaign", + "campaign_id": "camp_ZjoZEdmnyUCPYwMPN0IVbvDK" + } + }, + "Validate Referral Code": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_p6hPsnZj2VSvyXDjH9o6aQ==", + "order": { + "amount": 10000, + "discount_amount": 3000, + "total_discount_amount": 3000, + "total_amount": 7000, + "applied_discount_amount": 3000, + "total_applied_discount_amount": 3000, + "items": [], + "metadata": {}, + "referrer": { + "id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "object": "customer" + }, + "customer_id": null, + "referrer_id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "object": "order" + }, + "code": "REFERRAL-CODE-OxBakPYf", + "discount": { + "type": "PERCENT", + "effect": "APPLY_TO_ORDER", + "percent_off": 30 + }, + "metadata": {}, + "campaign": "Referral Campaign", + "campaign_id": "camp_TnOf5NB4Jtjxwoq38WckMJfy" } } } } } }, - "Specific campaign": { - "value": { - "parameters": { - "fields": [ - "id", - "campaign_id", - "voucher_id", - "status", - "expires_at", - "points" - ], - "order": "-expires_at", - "filters": { - "junction": "and", - "campaign_id": { - "conditions": { - "$is": "camp_7s3uXI44aKfIk5IhmeOPr6ic" + "400": { + "description": "Returns an error if missing required parameters or tracking IDs come from the same origin.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Missing customer": { + "value": { + "code": 400, + "key": "missing_customer", + "message": "Missing customer", + "details": "Customer is required to validate rules", + "request_id": "v-0be548ae620abb0a73" + } + }, + "Ambiguous tracking ID": { + "value": { + "code": 400, + "key": "ambiguous_tracking_id", + "message": "Ambiguous trackingId ('track_0nmdnu/6xIb6NTN0Ea40oFmM4wD5QYlxAgKdSn6wh+oychkbEcMNB5RhcTj+zcKBEcGnUZkAXxg=' vs. 'track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==')", + "details": "The customer cannot be identified as two different identifiers have been used between requests from same origin.", + "request_id": "v-0be550a5a84abb30f8" } } } @@ -69301,5003 +57370,10411 @@ } } } - } - }, - "responses": { - "200": { - "description": "Returns an object with the export ID of the scheduled generation of CSV file with exported points expirations. You can use either the [Get Export](ref:get-export) endpoint to view the status and obtain the URL of the CSV file or [Download Export](ref:download-export) endpoint to download the CSV file.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_export_object_points_expiration" - }, - "examples": { - "Specific Vouchers": { - "value": { - "id": "exp_zC3eXAFss17XTMzMkkov4KGq", - "object": "export", - "created_at": "2022-11-28T13:00:23.621Z", - "status": "SCHEDULED", - "channel": "API", - "exported_object": "points_expiration", - "parameters": { - "order": "-expires_at", - "fields": [ - "id", - "campaign_id", - "voucher_id", - "status", - "expires_at", - "points" - ], - "filters": { - "junction": "and", - "voucher_id": { - "conditions": { - "$in": [ - "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", - "v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655" - ] - } - } - } - }, - "result": null, - "user_id": null - } + }, + "/v1/promotions/validation": { + "post": { + "operationId": "validate-promotions", + "deprecated": true, + "tags": [ + "VALIDATIONS API" + ], + "summary": "Validate Promotions [Deprecated]", + "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for qualification, and we do not recommend using it. The new [Qualifications API](ref:examine-qualification) introduces additional features and improvements while maintaining backward compatibility. 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. \n\nUse this method to get valid promotions for a given customer and order.\n\n### Advanced validation filters\n\nYou can narrow down a validation to a specific promotion ID or tier metadata. Here are the examples of filtering queries you can use:\n\n| **Filter** | **Example** |\n|:---|:---|\n| promotion_id | [filters][promotion_id][conditions][$is]={{campaign_id}} |\n| tier metadata | [filters][metadata.{{promotion tier metadata key}}][conditions][$is]={{promotion tier metadata value}} |\n\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"customer\": {\n \"id\": \"cust_gN9KgORZECfdhG9qT6n82Zr7\"\n },\n \"order\": {\n \"items\": [\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9aeddb019a42db\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": \"1\"\n },\n {\n \"sku_id\": \"sku_0b7d7dfb090be5c619\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b72b0bd64d198e3ae\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b7d7c4e814be5c502\",\n \"quantity\": 1\n }\n ],\n \"metadata\":{\n \"payment_mean\": [\"credit-card\"]\n }\n },\n \"options\": {\n \"expand\": [\n \"category\"\n ]\n }\n }'/\n 'https://api.voucherify.io/v1/promotions/validation?audienceRulesOnly=true'\n```\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -d `{\n \"customer\": {\n \"id\": \"cust_gN9KgORZECfdhG9qT6n82Zr7\"\n },\n \"order\": {\n \"items\": [\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9aeddb019a42db\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": \"1\"\n },\n {\n \"sku_id\": \"sku_0b7d7dfb090be5c619\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b72b0bd64d198e3ae\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b7d7c4e814be5c502\",\n \"quantity\": 1\n }\n ],\n \"metadata\":{\n \"payment_mean\": [\"credit-card\"]\n }\n },\n \"options\": {\n \"expand\": [\n \"category\"\n ]\n },\n \"metadata\": {\n \"store_names\": \"Store 1 - New York - Broadway\"\n }\n }`\\\n 'https://api.voucherify.io/v1/promotions/validation?[filters][promotion_id][conditions][$is]=camp_nYcAyjFXmEaBU0nB7EQ4hVTr'\n```\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -d `{\n \"customer\": {\n \"id\": \"cust_gN9KgORZECfdhG9qT6n82Zr7\"\n },\n \"order\": {\n \"items\": [\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9aeddb019a42db\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": \"1\"\n },\n {\n \"sku_id\": \"sku_0b7d7dfb090be5c619\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b72b0bd64d198e3ae\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b7d7c4e814be5c502\",\n \"quantity\": 1\n }\n ],\n \"metadata\":{\n \"payment_mean\": [\"credit-card\"]\n }\n },\n \"options\": {\n \"expand\": [\n \"category\"\n ]\n }\n }`\\\n 'https://api.voucherify.io/v1/promotions/validation?[filters][metadata.has_budget][conditions][$is]=true'\n```", + "parameters": [ + { + "schema": { + "type": "string" }, - "Specific Campaign": { - "value": { - "id": "exp_kfwVDMsavDHl2vOY6vH9q7P7", - "object": "export", - "created_at": "2022-11-28T16:46:34.148Z", - "status": "SCHEDULED", - "channel": "API", - "exported_object": "points_expiration", - "parameters": { - "order": "-expires_at", - "fields": [ - "id", - "campaign_id", - "voucher_id", - "status", - "expires_at", - "points" - ], - "filters": { - "junction": "and", - "campaign_id": { - "conditions": { - "$is": "camp_7s3uXI44aKfIk5IhmeOPr6ic" - } - } - } + "in": "query", + "name": "audienceRulesOnly", + "description": "If you add a query param AudienceRulesOnly=true, the request will be validated against customer-related rules only, the rest of attached limits and rules will be ignored." + }, + { + "name": "filters", + "in": "query", + "required": false, + "schema": { + "type": "object", + "title": "Promotion filters", + "description": "Promotion filter conditions.", + "properties": { + "metadata": { + "type": "object", + "description": "Allows you to create a filter based on the conditions set for promotion metadata values. The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that are attached to a promotion tier object. Stores additional information about the promotion tier in a structured format.", + "style": "deepObject", + "explode": true }, - "result": null, - "user_id": null - } - } + "promotion_id": { + "type": "object", + "description": "Allows you to create a filter based on the unique promotion ID.", + "style": "deepObject", + "explode": true + } + }, + "style": "deepObject", + "explode": true + }, + "description": "Filter conditions." } - } - } - } - } - } - }, - "/v1/loyalties/{campaignId}/earning-rules": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_0dJG7cCAjquzcxWmZ634bA0C" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " - } - ], - "get": { - "operationId": "list-earning-rules", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Earning Rules", - "description": "Returns a list of all earning rules within a given campaign.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ] - }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a list of earning rules.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_list_earning_rules" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "ern_HnRXyJHoj3E79r3KUWhgMgtD", - "created_at": "2022-11-10T12:25:12.927Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 100, - "type": "FIXED" - }, - "segment": { - "id": "seg_n3vVcU5t0m3rs4rEPr3C1oU5" - }, - "event": "customer.segment.entered", - "source": { - "banner": "New Customers", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_0gv3v7jQG5U6TtVC8bMEdIap", - "metadata": {} - }, - { - "id": "ern_raVUcdXruvXGuzm682ESrAzt", - "created_at": "2022-11-24T09:03:14.534Z", - "updated_at": "2022-11-25T07:31:42.778Z", - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "points": 20, - "type": "FIXED" - }, - "event": "order.paid", - "source": { - "banner": "Order has been paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-23T00:00:00.000Z", - "expiration_date": "2022-11-30T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_MbEIyLbn7pHyba5Qw5eeb35L", - "metadata": { - "Type": "Order has been paid - Fixed" - } - }, - { - "id": "ern_BmDiQs7T3UHfJQqtI2RfJHFR", - "created_at": "2022-11-24T14:48:36.567Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_AMOUNT", - "order": { - "amount": { - "every": 1000, - "points": 1 - } - } - }, - "event": "order.paid", - "source": { - "banner": "Order paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_IKanVw37J6oFuRrdnryXw8Lz", - "metadata": { - "Type": "Order has been paid - Proportional - 1" - } - }, - { - "id": "ern_jwtacKdEEHoc85QbouRw3CR8", - "created_at": "2022-11-24T15:17:11.539Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_TOTAL_AMOUNT", - "order": { - "total_amount": { - "every": 1100, - "points": 1 - } - } - }, - "event": "order.paid", - "source": { - "banner": "Order has been paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_Y6IWqhz0cHGkKcteU9PS5nmK", - "metadata": { - "Type": "Order has been paid - Proportional - 2" - } - }, - { - "id": "ern_fxVdmtJ4u4rlyoH2hIq7m1PQ", - "created_at": "2022-11-24T15:20:04.392Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_METADATA", - "order": { - "metadata": { - "every": 10, - "points": 2, - "property": "number_of_store_visits" - } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Provide the customer and order context.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/6_req_validate_promotion" + }, + "examples": { + "Example": { + "value": { + "customer": { + "source_id": "source-id", + "metadata": { + "key": "value" } }, - "event": "order.paid", - "source": { - "banner": "Order paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" + "options": { + "expand": [ + "category" + ] }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_HyowcdKQ0lsQ1rSxV5tyYr2z", - "metadata": { - "Type": "Order has been paid - Proportional - 3 - Metadata" - } - }, - { - "id": "ern_Aop1wTrmPv4yBntDcvXNTCWR", - "created_at": "2022-11-24T15:23:44.514Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_AMOUNT", - "order_items": { - "amount": { - "every": 1000, - "points": 3, - "object": "products_collection", - "id": "pc_75U0dHlr7u75BJodrW1AE3t6" + "order": { + "amount": 10000, + "items": [ + { + "product_id": "product-id", + "quantity": "1", + "price": 10000, + "related_object": "product", + "product": { + "metadata": { + "key": "value" + } + } } - } - }, - "event": "order.paid", - "source": { - "banner": "Order paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" + ] }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_EXRyQ0z0rgtF54PKDGGAF1qg", "metadata": { - "Type": "Order has been paid - Proportional - 4" + "key": "value" } - }, - { - "id": "ern_4qSQVjfGEH7OmXKMzotS0juY", - "created_at": "2022-11-24T15:44:45.301Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_SUBTOTAL_AMOUNT", - "order_items": { - "subtotal_amount": { - "every": 1000, - "points": 4, - "object": "sku", - "id": "sku_0b7d7dfb090be5c619" - } - } - }, - "event": "order.paid", - "source": { - "banner": "Order paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" + } + }, + "Customer Rules Only": { + "value": { + "customer": { + "id": "cust_gN9KgORZECfdhG9qT6n82Zr7" }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_ID3xLPXCdnOaveJYWiulcNFW", - "metadata": { - "Type": "Order has been paid - Proportional - 5 - Items" - } - }, - { - "id": "ern_aJyt4wIrXhmfMxvrLoZjBYrP", - "created_at": "2022-11-24T15:56:58.710Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_AMOUNT", - "order_items": { - "amount": { - "every": 10000, - "points": 1, - "object": "product", - "id": "prod_0bae32322150fd0546" + "order": { + "items": [ + { + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1 + }, + { + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 1 + }, + { + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": "1" + }, + { + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1 + }, + { + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 1 + }, + { + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1 } + ], + "metadata": { + "payment_mean": [ + "credit-card" + ] } }, - "event": "order.paid", - "source": { - "banner": "Order paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" + "options": { + "expand": [ + "category" + ] + } + } + }, + "Campaign Specific": { + "value": { + "customer": { + "source_id": "test-user@email.com" }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_EbBqD1SNW70vgDp5icGbWl3e", - "metadata": {} - }, - { - "id": "ern_v4Blmh9hA3gpnjo93cMAgvHr", - "created_at": "2022-11-24T16:19:20.571Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 1, - "points": 5, - "property": "customer_life_time_value" + "order": { + "items": [ + { + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1 + }, + { + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 1 + }, + { + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": "1" + }, + { + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1 + }, + { + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 1 + }, + { + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1 } + ], + "metadata": { + "payment_mean": [ + "credit-card" + ] } }, - "segment": { - "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" - }, - "event": "customer.segment.entered", - "source": { - "banner": "Entered Segment", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_wMMDJ86iHKkznz9x0506e30E", - "metadata": {} - }, - { - "id": "ern_L8dFanPxJzhw0f5voTwPurGP", - "created_at": "2022-11-24T16:27:13.917Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 3, - "type": "FIXED" - }, - "custom_event": { - "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" - }, - "event": "page_view", - "source": { - "banner": "Custom Event", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" + "options": { + "expand": [ + "category" + ] }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_9N69OJzGKGhp2mo7SNsnsF5b", "metadata": { - "Type": "Fixed" + "store_names": "Store 1 - New York - Broadway" } - }, - { - "id": "ern_ngdugZ2hzg35hGASFF8nDjUO", - "created_at": "2022-11-24T16:41:48.830Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOM_EVENT_METADATA", - "custom_event": { - "metadata": { - "every": 2, - "points": 2, - "property": "volume_number" + } + }, + "Promotion Tier Metadata": { + "value": { + "customer": { + "name": "Joe McDonald", + "email": "joey@email.com", + "source_id": "123_source_id" + }, + "order": { + "items": [ + { + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1 + }, + { + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 1 + }, + { + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": "1" + }, + { + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1 + }, + { + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 1 + }, + { + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1 } + ], + "metadata": { + "payment_mean": [ + "credit-card" + ] } }, - "custom_event": { - "schema_id": "ms_qpRZ3EmRQyszNH6Z52Gkq8au" - }, - "event": "user_subscribed", - "source": { - "banner": "Custom Event", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_v1eTxL7X63B5IkYgRWHK4leh", - "metadata": { - "Type": "Event" + "options": { + "expand": [ + "category" + ] } - }, - { - "id": "ern_afo3Ea760hAKv07JYpycnhiE", - "created_at": "2022-11-24T16:50:12.945Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 3, - "points": 3, - "property": "customer_life_time_value" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a list of valid promotions for a given context (customer and order). You can then choose which promotion to apply, i.e. the highest discount amount.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/6_res_validate_promotion" + }, + "examples": { + "Customer Rules Only": { + "value": { + "valid": true, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", + "promotions": [ + { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", + "order": { + "amount": 9351000, + "initial_amount": 72100, + "items_discount_amount": 9340400, + "total_discount_amount": 9340400, + "total_amount": 10600, + "items_applied_discount_amount": 9340400, + "total_applied_discount_amount": 9340400, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 1, + "amount": 3100, + "price": 3100, + "subtotal_amount": 3100, + "product": { + "id": "prod_0a9f9aeddb019a42db", + "name": "Blue T-Shirt", + "price": 3100 + } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 23, + "discount_quantity": 22, + "initial_quantity": 1, + "amount": 39100, + "discount_amount": 37400, + "initial_amount": 1700, + "applied_discount_amount": 37400, + "price": 1700, + "subtotal_amount": 1700, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100 + }, + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1700 + } + }, + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 222, + "discount_quantity": 222, + "initial_quantity": 1, + "amount": 333000, + "discount_amount": 333000, + "initial_amount": 1500, + "applied_discount_amount": 333000, + "price": 1500, + "subtotal_amount": 0, + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage", + "price": 1500 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 111, + "discount_quantity": 111, + "initial_quantity": 1, + "amount": 6660000, + "discount_amount": 6660000, + "initial_amount": 60000, + "applied_discount_amount": 6660000, + "price": 60000, + "subtotal_amount": 0, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "price": 60000 + } + }, + { + "object": "order_item", + "product_id": "prod_0bae2dc5a090fd0184", + "sku_id": "sku_0bae3b28f610fd0da1", + "quantity": 11, + "discount_quantity": 11, + "initial_quantity": 0, + "amount": 2310000, + "discount_amount": 2310000, + "initial_amount": 0, + "applied_discount_amount": 2310000, + "price": 210000, + "subtotal_amount": 0, + "product": { + "id": "prod_0bae2dc5a090fd0184", + "source_id": "first_product", + "name": "Samsung Phone 1", + "price": 220000 + }, + "sku": { + "id": "sku_0bae3b28f610fd0da1", + "source_id": "first_product_sku_1", + "sku": "Samsung phone 256GB", + "price": 210000 + } + } + ], + "metadata": { + "payment_mean": [ + "credit-card" + ] + }, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "id": "promo_ByIIAHC1Mz9ouJsitzAWsush", + "name": "Multiple", + "discount": { + "type": "UNIT", + "effect": "ADD_MANY_ITEMS", + "units": [ + { + "effect": "ADD_MISSING_ITEMS", + "unit_off": 11, + "unit_type": "sku_0bae3b28f610fd0da1", + "sku": { + "id": "sku_0bae3b28f610fd0da1", + "source_id": "first_product_sku_1", + "sku": "Samsung phone 256GB" + }, + "product": { + "id": "prod_0bae2dc5a090fd0184", + "source_id": "first_product", + "name": "Samsung Phone 1" + } + }, + { + "effect": "ADD_NEW_ITEMS", + "unit_off": 22, + "unit_type": "sku_0b7d7dfb090be5c619", + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1" + }, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1" + } + }, + { + "effect": "ADD_MISSING_ITEMS", + "unit_off": 111, + "unit_type": "prod_0b7d7c4e814be5c502", + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12" + } + }, + { + "effect": "ADD_MISSING_ITEMS", + "unit_off": 222, + "unit_type": "prod_0b72b0bd64d198e3ae", + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage" + } + } + ] + }, + "campaign": { + "id": "camp_JtoaZ8Qgpf6FkMAy2wWiOJWH", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "hierarchy": 1, + "discount_amount": 9340400, + "applied_discount_amount": 9340400, + "metadata": {}, + "object": "promotion_tier" + }, + { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", + "order": { + "amount": 9522100, + "initial_amount": 72100, + "items_discount_amount": 9450000, + "total_discount_amount": 9450000, + "total_amount": 72100, + "items_applied_discount_amount": 9450000, + "total_applied_discount_amount": 9450000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 1, + "amount": 3100, + "price": 3100, + "subtotal_amount": 3100, + "product": { + "id": "prod_0a9f9aeddb019a42db", + "name": "Blue T-Shirt", + "price": 3100 + } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1700, + "price": 1700, + "subtotal_amount": 1700, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100 + }, + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1700 + } + }, + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 1, + "amount": 1500, + "price": 1500, + "subtotal_amount": 1500, + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage", + "price": 1500 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 60000, + "price": 60000, + "subtotal_amount": 60000, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "price": 60000 + } + }, + { + "object": "order_item", + "product_id": "prod_0bae2dc5a090fd0184", + "sku_id": "sku_0bae3b28f610fd0da1", + "quantity": 45, + "discount_quantity": 45, + "initial_quantity": 0, + "amount": 9450000, + "discount_amount": 9450000, + "initial_amount": 0, + "applied_discount_amount": 9450000, + "price": 210000, + "subtotal_amount": 0, + "product": { + "id": "prod_0bae2dc5a090fd0184", + "source_id": "first_product", + "name": "Samsung Phone 1", + "price": 220000 + }, + "sku": { + "id": "sku_0bae3b28f610fd0da1", + "source_id": "first_product_sku_1", + "sku": "Samsung phone 256GB", + "price": 210000 + } + } + ], + "metadata": { + "payment_mean": [ + "credit-card" + ] + }, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "id": "promo_ZWkx6R0I1Ts3N9HL4kfTdxOm", + "name": "Add new SKU", + "discount": { + "type": "UNIT", + "effect": "ADD_NEW_ITEMS", + "unit_off": 45, + "unit_type": "sku_0bae3b28f610fd0da1", + "sku": { + "id": "sku_0bae3b28f610fd0da1", + "source_id": "first_product_sku_1", + "sku": "Samsung phone 256GB" + }, + "product": { + "id": "prod_0bae2dc5a090fd0184", + "source_id": "first_product", + "name": "Samsung Phone 1" + } + }, + "campaign": { + "id": "camp_40LC42P5NFbkkD4RWoJ4btks", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "hierarchy": 4, + "discount_amount": 9450000, + "applied_discount_amount": 9450000, + "metadata": {}, + "object": "promotion_tier" + }, + { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", + "order": { + "amount": 109500, + "initial_amount": 72100, + "items_discount_amount": 39100, + "total_discount_amount": 39100, + "total_amount": 70400, + "items_applied_discount_amount": 39100, + "total_applied_discount_amount": 39100, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 1, + "amount": 3100, + "price": 3100, + "subtotal_amount": 3100, + "product": { + "id": "prod_0a9f9aeddb019a42db", + "name": "Blue T-Shirt", + "price": 3100 + } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 23, + "discount_quantity": 23, + "initial_quantity": 1, + "amount": 39100, + "discount_amount": 39100, + "initial_amount": 1700, + "applied_discount_amount": 39100, + "price": 1700, + "subtotal_amount": 0, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100 + }, + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1700 + } + }, + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 1, + "amount": 1500, + "price": 1500, + "subtotal_amount": 1500, + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage", + "price": 1500 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 60000, + "price": 60000, + "subtotal_amount": 60000, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "price": 60000 + } + } + ], + "metadata": { + "payment_mean": [ + "credit-card" + ] + }, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "id": "promo_NcdD0zLo6FUhKWpNrNuP3Pte", + "name": "Add missing SKU", + "discount": { + "type": "UNIT", + "effect": "ADD_MISSING_ITEMS", + "unit_off": 23, + "unit_type": "sku_0b7d7dfb090be5c619", + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1" + }, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1" + } + }, + "campaign": { + "id": "camp_40LC42P5NFbkkD4RWoJ4btks", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "hierarchy": 3, + "discount_amount": 39100, + "applied_discount_amount": 39100, + "metadata": {}, + "object": "promotion_tier" + }, + { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", + "order": { + "amount": 76100, + "initial_amount": 72100, + "items_discount_amount": 4000, + "total_discount_amount": 4000, + "total_amount": 72100, + "items_applied_discount_amount": 4000, + "total_applied_discount_amount": 4000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 1, + "amount": 3100, + "price": 3100, + "subtotal_amount": 3100, + "product": { + "id": "prod_0a9f9aeddb019a42db", + "name": "Blue T-Shirt", + "price": 3100 + } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1700, + "price": 1700, + "subtotal_amount": 1700, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100 + }, + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1700 + } + }, + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 1, + "amount": 1500, + "price": 1500, + "subtotal_amount": 1500, + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage", + "price": 1500 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 60000, + "price": 60000, + "subtotal_amount": 60000, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "price": 60000 + } + }, + { + "object": "order_item", + "product_id": "prod_0b72b00ffed198e344", + "quantity": 8, + "discount_quantity": 8, + "initial_quantity": 0, + "amount": 4000, + "discount_amount": 4000, + "initial_amount": 0, + "applied_discount_amount": 4000, + "price": 500, + "subtotal_amount": 0, + "product": { + "id": "prod_0b72b00ffed198e344", + "source_id": "roses_1", + "name": "Bouquet - Romantic Roses", + "price": 500 + } + } + ], + "metadata": { + "payment_mean": [ + "credit-card" + ] + }, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "id": "promo_nGr1SWuy9vduABkbbJkl8cHb", + "name": "Add new order items", + "banner": "Add Romantic Roses", + "discount": { + "type": "UNIT", + "effect": "ADD_NEW_ITEMS", + "unit_off": 8, + "unit_type": "prod_0b72b00ffed198e344", + "product": { + "id": "prod_0b72b00ffed198e344", + "source_id": "roses_1", + "name": "Bouquet - Romantic Roses" + } + }, + "campaign": { + "id": "camp_40LC42P5NFbkkD4RWoJ4btks", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "hierarchy": 2, + "discount_amount": 4000, + "applied_discount_amount": 4000, + "metadata": {}, + "object": "promotion_tier" + }, + { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", + "order": { + "amount": 78100, + "initial_amount": 72100, + "items_discount_amount": 7500, + "total_discount_amount": 7500, + "total_amount": 70600, + "items_applied_discount_amount": 7500, + "total_applied_discount_amount": 7500, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 1, + "amount": 3100, + "price": 3100, + "subtotal_amount": 3100, + "product": { + "id": "prod_0a9f9aeddb019a42db", + "name": "Blue T-Shirt", + "price": 3100 + } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1700, + "price": 1700, + "subtotal_amount": 1700, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100 + }, + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1700 + } + }, + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 5, + "discount_quantity": 5, + "initial_quantity": 1, + "amount": 7500, + "discount_amount": 7500, + "initial_amount": 1500, + "applied_discount_amount": 7500, + "price": 1500, + "subtotal_amount": 0, + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage", + "price": 1500 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 60000, + "price": 60000, + "subtotal_amount": 60000, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "price": 60000 + } + } + ], + "metadata": { + "payment_mean": [ + "credit-card" + ] + }, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "id": "promo_R50x0A66V6jmPhM7YYOcFZfL", + "name": "Add missing order items", + "banner": "Add Boho Vintage", + "discount": { + "type": "UNIT", + "effect": "ADD_MISSING_ITEMS", + "unit_off": 5, + "unit_type": "prod_0b72b0bd64d198e3ae", + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage" + } + }, + "campaign": { + "id": "camp_40LC42P5NFbkkD4RWoJ4btks", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "hierarchy": 1, + "discount_amount": 7500, + "applied_discount_amount": 7500, + "metadata": {}, + "object": "promotion_tier" + }, + { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", + "order": { + "amount": 72100, + "total_amount": 72100, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 1, + "amount": 3100, + "price": 3100, + "subtotal_amount": 3100, + "product": { + "id": "prod_0a9f9aeddb019a42db", + "name": "Blue T-Shirt", + "price": 3100 + } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1700, + "price": 1700, + "subtotal_amount": 1700, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100 + }, + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1700 + } + }, + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 1, + "amount": 1500, + "price": 1500, + "subtotal_amount": 1500, + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage", + "price": 1500 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 60000, + "price": 60000, + "subtotal_amount": 60000, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "price": 60000 + } + }, + { + "object": "order_item", + "product_id": "prod_5h1pp1ng", + "quantity": 1, + "discount_quantity": 1, + "initial_quantity": 0, + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping" + } + } + ], + "metadata": { + "payment_mean": [ + "credit-card" + ] + }, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "id": "promo_jp2l6wRcTL4cARG5E8XRo42A", + "name": "Get", + "banner": "Free shipping", + "discount": { + "type": "UNIT", + "effect": "ADD_MISSING_ITEMS", + "unit_off": 1, + "unit_type": "prod_5h1pp1ng", + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping" + } + }, + "campaign": { + "id": "camp_wCEdu2igBcyv7CNna9ughGKc", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "hierarchy": 1, + "metadata": { + "has_budget": true, + "audience_restricted": false + }, + "object": "promotion_tier" + }, + { + "valid": true, + "applicable_to": { + "data": [ + { + "object": "products_collection", + "id": "pc_a11pr0dUc75", + "strict": false, + "price": 800, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0a9f9ab4ab019a42d5", + "source_id": "prod_0a9f9ab4ab019a42d5", + "strict": true, + "price": 800, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0a9f9aeddb019a42db", + "source_id": "prod_0a9f9aeddb019a42db", + "strict": true, + "price": 800, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "sku", + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "product_id": "prod_0b7d7dfb05cbe5c616", + "product_source_id": "Books", + "strict": true, + "price": 800, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "strict": true, + "price": 800, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "strict": true, + "price": 800, + "effect": "APPLY_TO_EVERY" + } + ], + "total": 6, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", + "order": { + "amount": 72100, + "items_discount_amount": 67300, + "total_discount_amount": 67300, + "total_amount": 4800, + "items_applied_discount_amount": 67300, + "total_applied_discount_amount": 67300, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "discount_amount": 2100, + "applied_discount_amount": 2100, + "price": 2900, + "subtotal_amount": 800, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 1, + "amount": 3100, + "discount_amount": 2300, + "applied_discount_amount": 2300, + "price": 3100, + "subtotal_amount": 800, + "product": { + "id": "prod_0a9f9aeddb019a42db", + "name": "Blue T-Shirt", + "price": 3100 + } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "discount_amount": 2100, + "applied_discount_amount": 2100, + "price": 2900, + "subtotal_amount": 800, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1700, + "discount_amount": 900, + "applied_discount_amount": 900, + "price": 1700, + "subtotal_amount": 800, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100 + }, + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1700 + } + }, + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 1, + "amount": 1500, + "discount_amount": 700, + "applied_discount_amount": 700, + "price": 1500, + "subtotal_amount": 800, + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage", + "price": 1500 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 60000, + "discount_amount": 59200, + "applied_discount_amount": 59200, + "price": 60000, + "subtotal_amount": 800, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "price": 60000 + } + } + ], + "metadata": { + "payment_mean": [ + "credit-card" + ] + }, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "id": "promo_WEloFBBJ8JJDCxrtR1FPy6t1", + "name": "Get Amount Off", + "banner": "Every product is worth 8", + "discount": { + "type": "FIXED", + "effect": "APPLY_TO_ITEMS" + }, + "campaign": { + "id": "camp_Ds2u0MSFGuKhDuR3jEa5dHBx", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "hierarchy": 2, + "discount_amount": 67300, + "applied_discount_amount": 67300, + "metadata": { + "has_budget": true, + "audience_restricted": false + }, + "object": "promotion_tier" } - } - }, - "custom_event": { - "schema_id": "ms_f0r4hcu5T0m3v3nT5ch3ma" - }, - "event": "cart_abandoned", - "source": { - "banner": "Custom Event", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_7ovoKiXx49fe3nnhEbDlp9FP", - "metadata": {} - }, - { - "id": "ern_chdlG14W8Sdcq3d6jJQQgRMT", - "created_at": "2022-11-24T16:51:31.595Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 1, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.joined", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Tier joined - Any", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_W9yMQTz5fgQTgmuu6pTVraBW", - "metadata": { - "Type": "Tier joined - any - fixed" + ] } }, - { - "id": "ern_gVo6CHBduFPoh1hctASfXHLT", - "created_at": "2022-11-24T17:01:42.809Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 4, - "points": 4, - "property": "customer_life_time_value" + "Campaign specific": { + "value": { + "valid": true, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", + "promotions": [ + { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", + "order": { + "amount": 72100, + "discount_amount": 100, + "total_discount_amount": 100, + "total_amount": 72000, + "applied_discount_amount": 100, + "total_applied_discount_amount": 100, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 1, + "amount": 3100, + "price": 3100, + "subtotal_amount": 3100, + "product": { + "id": "prod_0a9f9aeddb019a42db", + "name": "Blue T-Shirt", + "price": 3100 + } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1700, + "price": 1700, + "subtotal_amount": 1700, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100 + }, + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1700 + } + }, + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 1, + "amount": 1500, + "price": 1500, + "subtotal_amount": 1500, + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage", + "price": 1500 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 60000, + "price": 60000, + "subtotal_amount": 60000, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "price": 60000 + } + } + ], + "metadata": { + "payment_mean": [ + "credit-card" + ] + }, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "id": "promo_g83qUzYZpfX0OMAFOVoQuOYG", + "name": "1", + "discount": { + "type": "AMOUNT", + "effect": "APPLY_TO_ORDER", + "amount_off": 100 + }, + "campaign": { + "id": "camp_nYcAyjFXmEaBU0nB7EQ4hVTr", + "start_date": null, + "expiration_date": null, + "active": true, + "categories": [ + { + "id": "cat_0b5f66bc97ce5be3c6", + "name": "Sixth", + "hierarchy": 6, + "created_at": "2022-07-13T08:27:14.926Z", + "object": "category" + } + ], + "object": "campaign" + }, + "hierarchy": 1, + "discount_amount": 100, + "applied_discount_amount": 100, + "metadata": {}, + "object": "promotion_tier" } - } - }, - "event": "customer.loyalty.tier.joined", - "loyalty_tier": { - "id": "ltr_pudTGWasuIqxdiDM0go31OV1" - }, - "source": { - "banner": "Tier joined", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_wdlEo17wmoqYHGfilbayEUj7", - "metadata": { - "Type": "Tier joined - customer metadata - proportional" + ] } }, - { - "id": "ern_66OdCyLADv5IGFoQe18vGUwa", - "created_at": "2022-11-24T17:03:59.414Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 2, - "points": 2, - "property": "customer_life_time_value" + "Promotion Tier Metadata": { + "value": { + "valid": true, + "tracking_id": "track_oNgl7cQ8tVTg/fIVul/GKA==", + "promotions": [ + { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_oNgl7cQ8tVTg/fIVul/GKA==", + "order": { + "amount": 72100, + "total_amount": 72100, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 1, + "amount": 3100, + "price": 3100, + "subtotal_amount": 3100, + "product": { + "id": "prod_0a9f9aeddb019a42db", + "name": "Blue T-Shirt", + "price": 3100 + } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1700, + "price": 1700, + "subtotal_amount": 1700, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100 + }, + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1700 + } + }, + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 1, + "amount": 1500, + "price": 1500, + "subtotal_amount": 1500, + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage", + "price": 1500 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 60000, + "price": 60000, + "subtotal_amount": 60000, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "price": 60000 + } + }, + { + "object": "order_item", + "product_id": "prod_5h1pp1ng", + "quantity": 1, + "discount_quantity": 1, + "initial_quantity": 0, + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping" + } + } + ], + "metadata": { + "payment_mean": [ + "credit-card" + ] + }, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "id": "promo_jp2l6wRcTL4cARG5E8XRo42A", + "name": "Get", + "banner": "Free shipping", + "discount": { + "type": "UNIT", + "effect": "ADD_MISSING_ITEMS", + "unit_off": 1, + "unit_type": "prod_5h1pp1ng", + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping" + } + }, + "campaign": { + "id": "camp_wCEdu2igBcyv7CNna9ughGKc", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "hierarchy": 1, + "metadata": { + "has_budget": true, + "audience_restricted": false + }, + "object": "promotion_tier" + }, + { + "valid": true, + "applicable_to": { + "data": [ + { + "object": "products_collection", + "id": "pc_a11pr0dUc75", + "strict": false, + "price": 800, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0a9f9ab4ab019a42d5", + "source_id": "prod_0a9f9ab4ab019a42d5", + "strict": true, + "price": 800, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0a9f9aeddb019a42db", + "source_id": "prod_0a9f9aeddb019a42db", + "strict": true, + "price": 800, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "sku", + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "product_id": "prod_0b7d7dfb05cbe5c616", + "product_source_id": "Books", + "strict": true, + "price": 800, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "strict": true, + "price": 800, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "strict": true, + "price": 800, + "effect": "APPLY_TO_EVERY" + } + ], + "total": 6, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_oNgl7cQ8tVTg/fIVul/GKA==", + "order": { + "amount": 72100, + "items_discount_amount": 67300, + "total_discount_amount": 67300, + "total_amount": 4800, + "items_applied_discount_amount": 67300, + "total_applied_discount_amount": 67300, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "discount_amount": 2100, + "applied_discount_amount": 2100, + "price": 2900, + "subtotal_amount": 800, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 1, + "amount": 3100, + "discount_amount": 2300, + "applied_discount_amount": 2300, + "price": 3100, + "subtotal_amount": 800, + "product": { + "id": "prod_0a9f9aeddb019a42db", + "name": "Blue T-Shirt", + "price": 3100 + } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "discount_amount": 2100, + "applied_discount_amount": 2100, + "price": 2900, + "subtotal_amount": 800, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1700, + "discount_amount": 900, + "applied_discount_amount": 900, + "price": 1700, + "subtotal_amount": 800, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100 + }, + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1700 + } + }, + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 1, + "amount": 1500, + "discount_amount": 700, + "applied_discount_amount": 700, + "price": 1500, + "subtotal_amount": 800, + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage", + "price": 1500 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 60000, + "discount_amount": 59200, + "applied_discount_amount": 59200, + "price": 60000, + "subtotal_amount": 800, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "price": 60000 + } + } + ], + "metadata": { + "payment_mean": [ + "credit-card" + ] + }, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "id": "promo_WEloFBBJ8JJDCxrtR1FPy6t1", + "name": "Get Amount Off", + "banner": "Every product is worth 8", + "discount": { + "type": "FIXED", + "effect": "APPLY_TO_ITEMS" + }, + "campaign": { + "id": "camp_Ds2u0MSFGuKhDuR3jEa5dHBx", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "hierarchy": 2, + "discount_amount": 67300, + "applied_discount_amount": 67300, + "metadata": { + "has_budget": true, + "audience_restricted": false + }, + "object": "promotion_tier" } - } + ] + } + } + } + } + } + } + } + } + }, + "/v1/promotions/tiers/{tierId}/validation": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "tierId", + "in": "path", + "required": true, + "description": "Unique promotion tier ID." + } + ], + "post": { + "operationId": "validate-promotion-tier", + "deprecated": true, + "tags": [ + "VALIDATIONS API" + ], + "summary": "Validate Promotion Tier [Deprecated]", + "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for promotion tier redemption, and we do not recommend using it. The new [Stackable Discounts API](ref:redeem-stacked-discounts) 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. \n\nTo verify whether the promotion tier discount can be applied to an order. This method is designed for server side integration which means that it is accessible only through private keys.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Provide the customer and order context.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/6_req_validate_promotion_tier" + }, + "examples": { + "Using IDs": { + "value": { + "customer": { + "source_id": "test-user@email.io" }, - "event": "customer.loyalty.tier.left", - "loyalty_tier": { - "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2" + "order": { + "id": "ord_71uW6qnB5CFZlLHCeCNC4qtS" + } + } + }, + "Using Redemption Metadata": { + "value": { + "customer": { + "source_id": "test-user@email.com" }, - "source": { - "banner": "Tier left", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" + "order": { + "amount": 200000, + "items": [ + { + "product_id": "prod_anJ03RZZq74z4v", + "quantity": 2 + }, + { + "sku_id": "sku_0KtP4rvwEECQ2U", + "related_object": "sku", + "quantity": 1 + } + ] }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_czm5el1Uz1jeGaO97AYoDNAq", "metadata": { - "Type": "Tier left" + "store_names": "Store 1 - New York - Broadway" } - }, - { - "id": "ern_YR3fDfCjAmz9a5D68nk0i4dm", - "created_at": "2022-11-25T07:29:38.961Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 3, - "points": 4, - "property": "customer_life_time_value" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns validation result in `valid` key of the promotion tier object. Returns `true` if the promotion tier rules and validation rules are satisfied given the request body parameters. Returns `false` if the data provided in the payload does not meet validation rules or promotion tier requirements.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/6_res_validate_promotion_tier" + }, + "examples": { + "Promotion Valid": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_OWyBVb1mg1qnieLLNygh19A0Ia7FsJck", + "order": { + "id": "ord_71uW6qnB5CFZlLHCeCNC4qtS", + "source_id": null, + "created_at": "2022-11-17T12:17:55.096Z", + "updated_at": null, + "status": "CREATED", + "amount": 9918200, + "initial_amount": 468200, + "items_discount_amount": 9450000, + "total_discount_amount": 9450000, + "total_amount": 468200, + "items_applied_discount_amount": 9450000, + "total_applied_discount_amount": 9450000, + "items": [ + { + "object": "order_item", + "source_id": "webinar_BF_sweater_pink_sweater", + "related_object": "product", + "quantity": 1, + "amount": 6500, + "price": 6500, + "subtotal_amount": 6500 + }, + { + "object": "order_item", + "source_id": "webinar_BF_pants_navy_sweat_pants", + "related_object": "product", + "quantity": 1, + "amount": 6000, + "price": 6000, + "subtotal_amount": 6000 + }, + { + "object": "order_item", + "source_id": "5h1pp1ng", + "related_object": "product", + "quantity": 1, + "amount": 2000, + "price": 2000, + "subtotal_amount": 2000, + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping" + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "related_object": "product", + "quantity": 2, + "amount": 10000, + "price": 5000, + "subtotal_amount": 10000 + }, + { + "object": "order_item", + "source_id": "webinar_BF_sweater_pearl", + "related_object": "product", + "quantity": 2, + "amount": 22000, + "price": 11000, + "subtotal_amount": 22000 + }, + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1700, + "price": 1700, + "subtotal_amount": 1700, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100 + }, + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1700 + } + }, + { + "object": "order_item", + "product_id": "prod_0bae32322150fd0546", + "quantity": 2, + "amount": 420000, + "price": 210000, + "subtotal_amount": 420000, + "product": { + "id": "prod_0bae32322150fd0546", + "name": "Samsung Phone", + "price": 210000 + } + }, + { + "object": "order_item", + "product_id": "prod_0bae2dc5a090fd0184", + "sku_id": "sku_0bae3b28f610fd0da1", + "quantity": 45, + "discount_quantity": 45, + "initial_quantity": 0, + "amount": 9450000, + "discount_amount": 9450000, + "initial_amount": 0, + "applied_discount_amount": 9450000, + "price": 210000, + "subtotal_amount": 0, + "product": { + "id": "prod_0bae2dc5a090fd0184", + "source_id": "first_product", + "name": "Samsung Phone 1", + "price": 220000 + }, + "sku": { + "id": "sku_0bae3b28f610fd0da1", + "source_id": "first_product_sku_1", + "sku": "Samsung phone 256GB", + "price": 210000 + } + } + ], + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "id": "promo_ZWkx6R0I1Ts3N9HL4kfTdxOm", + "name": "Add new SKU", + "discount": { + "type": "UNIT", + "effect": "ADD_NEW_ITEMS", + "unit_off": 45, + "unit_type": "sku_0bae3b28f610fd0da1", + "sku": { + "id": "sku_0bae3b28f610fd0da1", + "source_id": "first_product_sku_1", + "sku": "Samsung phone 256GB" + }, + "product": { + "id": "prod_0bae2dc5a090fd0184", + "source_id": "first_product", + "name": "Samsung Phone 1" } - } - }, - "event": "customer.loyalty.tier.upgraded", - "loyalty_tier": { - "id": "ltr_30KHciA0UG8B71Fo51GZqwgN" - }, - "source": { - "banner": "Tier upgraded", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_M1OdRH8spk6Fs7yTuPLN2LAv", - "metadata": { - "Type": "Upgraded" + }, + "campaign": { + "id": "camp_40LC42P5NFbkkD4RWoJ4btks", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "hierarchy": 4, + "discount_amount": 9450000, + "applied_discount_amount": 9450000, + "metadata": {}, + "object": "promotion_tier" } }, - { - "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", - "created_at": "2022-11-25T07:31:05.866Z", - "updated_at": "2022-11-25T07:31:43.029Z", - "validation_rule_id": "val_kfmWpfXMI9P1", - "loyalty": { - "points": 1, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.downgraded", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Tier Downgraded", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", - "metadata": { - "Type": "Tier" + "Promotion Invalid with Error Message": { + "value": { + "valid": false, + "reason": "redemption does not match validation rules", + "error": { + "code": 400, + "key": "redemption_rules_violated", + "message": "redemption does not match validation rules", + "details": "Promotion Tier cannot be redeemed because of violated validation rules: val_eqSA1dXOv491", + "request_id": "v-0c034585fd16cf6958" + }, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", + "id": "promo_R50x0A66V6jmPhM7YYOcFZfL", + "name": "Add missing order items", + "banner": "Add Boho Vintage", + "discount": { + "type": "UNIT", + "effect": "ADD_MISSING_ITEMS", + "unit_off": 5, + "unit_type": "prod_0b72b0bd64d198e3ae" + }, + "campaign": { + "id": "camp_40LC42P5NFbkkD4RWoJ4btks", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "hierarchy": 1, + "metadata": { + "has_budget": true + }, + "object": "promotion_tier" } }, - { - "id": "ern_AdlWO2yt6b6llWsibIdiRXVE", - "created_at": "2022-11-25T07:31:42.767Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 5, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.prolonged", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Prolonged", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_4jH1yq9WJS0oJ8suagCrltyb", - "metadata": {} + "Promotion Invalid with Custom Message": { + "value": { + "valid": false, + "reason": "Inactive Promotion", + "error": { + "message": "Promotion is inactive this weekend." + }, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", + "id": "promo_R50x0A66V6jmPhM7YYOcFZfL", + "name": "Add missing order items", + "banner": "Add Boho Vintage", + "discount": { + "type": "UNIT", + "effect": "ADD_MISSING_ITEMS", + "unit_off": 5, + "unit_type": "prod_0b72b0bd64d198e3ae" + }, + "campaign": { + "id": "camp_40LC42P5NFbkkD4RWoJ4btks", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "hierarchy": 1, + "metadata": { + "has_budget": true + }, + "object": "promotion_tier" + } } - ], - "total": 18 + } } } } } } - } - } - }, - "post": { - "operationId": "create-earning-rule", - "tags": [ - "LOYALTIES API" - ], - "summary": "Create Earning Rule", - "description": "Create earning rules for a loyalty campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Customize the request body based on the type of earning rules you would like to create. The request body is an array of objects. The required minimum properties to include in the payload for each object are `event` and `loyalty`. Additionally, if you choose to add a `validity_timeframe`, you must include a `start_date`. Furthermore, an earning rule `event` type: \n\n- `customer.segment.entered` requires a `segment` object\n- a custom event requires a `custom_event` object\n- a `customer.loyalty.tier.joined`, `customer.loyalty.tier.left`, `customer.loyalty.tier.upgraded`, `customer.loyalty.tier.downgraded`, `customer.loyalty.tier.prolonged` requires a `loyalty_tier` object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_create_earning_rules" - }, - "examples": { - "Example": { - "value": [ - { - "event": "order.paid", - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "FIXED", - "points": "5" - }, - "source": { - "banner": "Order paid 5 points." - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Order paid - fixed amount of points" + }, + "/v1/redemption-object": { + "get": { + "operationId": "redemption-object", + "tags": [ + "REDEMPTIONS API" + ], + "summary": "Redemption Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Redemption Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_obj_redemption_object" } - }, - { - "event": "order.paid", - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_AMOUNT", - "order": { - "amount": { - "every": 1, - "points": 1 + } + } + } + } + } + }, + "/v1/rollback-redemption-object": { + "get": { + "operationId": "rollback-redemption-object", + "tags": [ + "REDEMPTIONS API" + ], + "summary": "Rollback Redemption Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Rollback Redemption Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_obj_rollback_redemption_object_extended" + } + } + } + } + } + } + }, + "/v1/stackable-redemptions-object": { + "get": { + "operationId": "stackable-redemptions-object", + "tags": [ + "STACKABLE DISCOUNTS API" + ], + "summary": "Stackable Redemptions Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Stackable Redemptions Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/19_res_redemptions_POST" + } + } + } + } + } + } + }, + "/v1/redemptions": { + "get": { + "operationId": "list-redemptions", + "tags": [ + "REDEMPTIONS API" + ], + "summary": "List Redemptions", + "description": "Returns a list of redemptions previously created. The redemptions are returned in a sorted order, with the most recent redemptions appearing first. The response returns a list of redemptions of all vouchers. \n\n## Filtering results\nThe result can be narrowed according to specified (or default) filters, for example, you can sort redemptions by date:\n`https://api.voucherify.io/v1/redemptions?limit=3&[created_at][before]=2017-09-08T13:52:18.227Z`. A filter based on the object `created_at` field narrows down the results and lists redemptions done before or after a particular date time. You can use the following options: `[created_at][after]`, `[created_at][before]`. A date value must be presented in ISO 8601 format (`2016-11-16T14:14:31Z` or `2016-11-16`). An example: `[created_at][before]=2017-09-08T13:52:18.227Z`.\n\n## Failed Redemptions\n\nA redemption may fail for various reasons. You can figure out an exact reason from the `failure_code`:\n- `resource_not_found` - voucher with given code does not exist\n- `voucher_not_active` - voucher is not active yet (before start date)\n- `voucher_expired` - voucher has already expired (after expiration date)\n- `voucher_disabled` - voucher has been disabled (`active: false`)\n- `quantity_exceeded` - voucher's redemptions limit has been exceeded\n- `gift_amount_exceeded` - gift amount has been exceeded\n- `customer_rules_violated` - customer did not match the segment\n- `order_rules_violated` - order did not match validation rules\n- `invalid_order` - order was specified incorrectly\n- `invalid_amount` - order amount was specified incorrectly\n- `missing_amount` - order amount was not specified\n- `missing_order_items` - order items were not specified\n- `missing_customer` - customer was not specified", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "result", + "description": "A filter on the list based on the redemption result. Available options are: `SUCCESS`, `FAILURE`. You can provide multiple values by repeating the param." + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "campaign", + "description": "A filter by the campaign **name** that the redemption resources originate from." + }, + { + "schema": { + "type": "string", + "example": "cust_IkrTR674vvQvr9a4rDMiqglY" + }, + "in": "query", + "name": "customer", + "description": "Return redemptions performed by the customer with given `id`." + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "id", + "-id", + "voucher_code", + "-voucher_code", + "tracking_id", + "-tracking_id", + "customer_id", + "-customer_id" + ] + }, + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." + }, + { + "$ref": "#/components/parameters/created_at" + }, + { + "name": "filters", + "in": "query", + "schema": { + "type": "object", + "properties": { + "voucher_code": { + "type": "object", + "description": "Unique voucher code.", + "style": "deepObject", + "explode": true, + "properties": { + "conditions": { + "$ref": "#/components/schemas/7_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" } } }, - "source": { - "banner": "Order paid - 1 point for 1 dollar spent excluding discounts." - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Order paid- points proportional to order amount" - } - }, - { - "event": "order.paid", - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_TOTAL_AMOUNT", - "order": { - "total_amount": { - "every": 1, - "points": 1 + "related_object_id": { + "type": "object", + "description": "Unique related object ID, i.e. v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk.", + "style": "deepObject", + "explode": true, + "properties": { + "conditions": { + "$ref": "#/components/schemas/7_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" } } }, - "source": { - "banner": "Order paid - 1 point for 1 dollar spent including discounts." - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Order paid- points proportional to order total amount" - } - }, - { - "event": "order.paid", - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_METADATA", - "order": { - "metadata": { - "every": 2, - "points": 1, - "property": "number_of_store_visits" + "related_object_parent_id": { + "type": "object", + "description": "Unique related object parent ID, i.e. camp_22noMlhTADb7Fq2UL3vWu3d1.", + "style": "deepObject", + "explode": true, + "properties": { + "conditions": { + "$ref": "#/components/schemas/7_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" } } }, - "source": { - "banner": "Order paid - 2 points for each store visit." - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Order paid- points proportional to numerical order metadata property " - } - }, - { - "event": "order.paid", - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_AMOUNT", - "order_items": { - "amount": { - "every": 2, - "points": 1, - "object": "product", - "id": "prod_0bae32322150fd0546" + "parent_redemption_id": { + "type": "object", + "description": "Unique parent redemption ID, i.e. r_0c5952900bcbfd54b6.", + "style": "deepObject", + "explode": true, + "properties": { + "conditions": { + "$ref": "#/components/schemas/7_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" } } }, - "source": { - "banner": "Order paid - 2 points for 1 dollar spent on items excluding discounts." - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Order paid- points proportional to order items amount" - } - }, - { - "event": "order.paid", - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_SUBTOTAL_AMOUNT", - "order_items": { - "subtotal_amount": { - "every": 2, - "points": 1, - "object": "products_collection", - "id": "pc_75U0dHlr7u75BJodrW1AE3t6" + "failure_code": { + "type": "object", + "description": "Failure code, i.e. quantity_exceeded.", + "style": "deepObject", + "explode": true, + "properties": { + "conditions": { + "$ref": "#/components/schemas/7_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" } } }, - "source": { - "banner": "Order paid - 2 points for every dollar spent on the product collection." - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Order paid- points proportional to order items subtotal amount" - } - }, - { - "event": "order.paid", - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_QUANTITY", - "order_items": { - "quantity": { - "every": 1, - "points": 1, - "object": "sku", - "id": "sku_0b7d7dfb090be5c619" + "result": { + "type": "object", + "description": "Result, i.e. `SUCCESS` or `FAILURE`.", + "style": "deepObject", + "explode": true, + "properties": { + "conditions": { + "$ref": "#/components/schemas/7_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" } } }, - "source": { - "banner": "Order paid - 1 point for every brand phone in your cart." - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Order paid - points proportional to quantity of items in a cart of a product varient." - } - }, - { - "event": "order.paid", - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 1, - "points": 1, - "property": "customer_life_time_value" + "object": { + "type": "object", + "description": "Specify which type of object to return, i.e. `redemption` or `redemption_rollback`.", + "style": "deepObject", + "explode": true, + "properties": { + "conditions": { + "$ref": "#/components/schemas/7_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" } } }, - "source": { - "banner": "Order paid 1 point for 1 month of being a customer with us." - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Order paid - points proportional to customer metadata property" - } - }, - { - "event": "customer.segment.entered", - "segment": { - "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" - }, - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 1, - "points": 1, - "property": "customer_life_time_value" + "customer_id": { + "type": "object", + "description": "Unique customer ID, i.e. cust_sehkNIi8Uq2qQuRqSr7xn4Zi.", + "style": "deepObject", + "explode": true, + "properties": { + "conditions": { + "$ref": "#/components/schemas/7_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" } } }, - "source": { - "banner": "Customer entered birthday segment - 1 point for each month of being a customer with us." - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Entered segment - points proportional to customer metadata property" - } - }, - { - "event": "customer.segment.entered", - "segment": { - "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" - }, - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "FIXED", - "points": "5" - }, - "source": { - "banner": "Customer entered birthday segment - 5 points" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Entered segment - fixed points" - } - }, - { - "event": "page_view", - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "points": 3, - "type": "FIXED" - }, - "custom_event": { - "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" - }, - "source": { - "banner": "See page - 3 points" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Custom Event - fixed points for viewing a page" - } - }, - { - "event": "page_view", - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOM_EVENT_METADATA", - "custom_event": { - "metadata": { - "every": 1, - "points": 2, - "property": "volume_number" + "campaign_name": { + "type": "object", + "description": "Campaign name.", + "style": "deepObject", + "explode": true, + "properties": { + "conditions": { + "$ref": "#/components/schemas/7_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" } } }, - "custom_event": { - "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" - }, - "source": { - "banner": "See page X - get 2 points multiplied by the page number" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Custom Event - proportional points for viewing a page based on custom event metadata" + "user_login": { + "type": "object", + "description": "User login used to login to Voucherify, i.e. name.lastname@email.com", + "style": "deepObject", + "explode": true, + "properties": { + "conditions": { + "$ref": "#/components/schemas/7_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } } - }, - { - "event": "page_view", - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 1, - "points": 2, - "property": "customer_life_time_value" + } + }, + "description": "Filters for listing responses.", + "style": "deepObject", + "explode": true + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of redemption objects. Each entry in the array is a separate redemption object. If no more redemptions are available, the resulting array will be empty. If you provide a non-existent customer ID, this call returns an empty object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_res_list_redemptions" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "redemptions", + "redemptions": [ + { + "id": "r_0c0469eaf705889d99", + "object": "redemption", + "date": "2022-11-18T12:30:32.622Z", + "customer_id": "cust_qBwHpagDOFu71Z3F22UzR80X", + "tracking_id": "track_5DQxXbK0C0pvAaHk7mnulhyMBo7VratI", + "metadata": { + "store_names": "Store 2 - Florida - Miami" + }, + "result": "SUCCESS", + "order": { + "id": "ord_ndw5rQJt12zvZ4upF72a3ljh", + "source_id": null, + "created_at": "2022-11-18T12:30:31.338Z", + "updated_at": null, + "status": "PAID", + "amount": 9680000, + "items_discount_amount": 9450000, + "total_discount_amount": 9450000, + "total_amount": 230000, + "items_applied_discount_amount": 9450000, + "total_applied_discount_amount": 9450000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0bae45ffc7003ffc52", + "quantity": 1, + "amount": 230000, + "price": 230000, + "subtotal_amount": 230000, + "product": { + "id": "prod_0bae45ffc7003ffc52", + "source_id": "second_product", + "name": "Samsung Phone 2", + "price": 230000 + } + }, + { + "object": "order_item", + "product_id": "prod_0bae2dc5a090fd0184", + "sku_id": "sku_0bae3b28f610fd0da1", + "quantity": 45, + "discount_quantity": 45, + "initial_quantity": 0, + "amount": 9450000, + "discount_amount": 9450000, + "initial_amount": 0, + "applied_discount_amount": 9450000, + "price": 210000, + "subtotal_amount": 0, + "product": { + "id": "prod_0bae2dc5a090fd0184", + "source_id": "first_product", + "name": "Samsung Phone 1", + "price": 220000 + }, + "sku": { + "id": "sku_0bae3b28f610fd0da1", + "source_id": "first_product_sku_1", + "sku": "Samsung phone 256GB", + "price": 210000 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_qBwHpagDOFu71Z3F22UzR80X", + "object": "customer" + }, + "customer_id": "cust_qBwHpagDOFu71Z3F22UzR80X", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c0469eaf705889d99": { + "date": "2022-11-18T12:30:31.388Z", + "related_object_type": "promotion_tier", + "related_object_id": "promo_ZWkx6R0I1Ts3N9HL4kfTdxOm", + "related_object_parent_id": "camp_40LC42P5NFbkkD4RWoJ4btks" + } + } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_qBwHpagDOFu71Z3F22UzR80X", + "name": "Bob Jones", + "email": "bob.smith@email.com", + "source_id": "pub_source_customer_5_a", + "metadata": { + "lang": "en", + "test": true + }, + "object": "customer" + }, + "related_object_type": "promotion_tier", + "related_object_id": "promo_ZWkx6R0I1Ts3N9HL4kfTdxOm", + "voucher": null, + "promotion_tier": { + "id": "promo_ZWkx6R0I1Ts3N9HL4kfTdxOm", + "campaign": { + "id": "camp_40LC42P5NFbkkD4RWoJ4btks" + } + } + }, + { + "id": "r_0bf9cf0a8b12dc5ba6", + "object": "redemption", + "date": "2022-11-10T06:49:03.835Z", + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "tracking_id": "track_fxEMFisanb4sbl4Z4yCnJyDW013IrRbJmqKByTNHbXE=", + "metadata": {}, + "amount": 200, + "result": "SUCCESS", + "order": { + "id": "ord_jAifScsbOqxgb12hLu7hXrLU", + "source_id": null, + "created_at": "2022-11-10T06:49:02.703Z", + "updated_at": null, + "status": "PAID", + "amount": 4500, + "discount_amount": 4000, + "total_discount_amount": 4000, + "total_amount": 500, + "applied_discount_amount": 4000, + "total_applied_discount_amount": 4000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 3, + "amount": 4500, + "price": 1500, + "subtotal_amount": 4500, + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage", + "price": 1500 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "object": "customer" + }, + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0bf9cf0a8b12dc5ba6": { + "date": "2022-11-10T06:49:02.764Z", + "related_object_type": "voucher", + "related_object_id": "v_Xak3ViMbxCH8Lb4ZG0lWwC0goMRBXWB4", + "related_object_parent_id": "camp_fkZ28pe7DUAEmmabofkxHI8N" + } + } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "name": "Bobby McDonald", + "email": "bobby.mcdonald@email.com", + "source_id": "bobby.mcdonald@email.com", + "metadata": { + "acquisition_channel": "Facebook", + "customer_life_time_value": 100 + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_Xak3ViMbxCH8Lb4ZG0lWwC0goMRBXWB4", + "voucher": { + "id": "v_Xak3ViMbxCH8Lb4ZG0lWwC0goMRBXWB4", + "code": "LT1-wMPnRhxb", + "campaign": "Loyalty Campaign - Tiers - 1", + "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N" + }, + "reward": { + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "name": "Bobby McDonald", + "email": "bobby.mcdonald@email.com", + "source_id": "bobby.mcdonald@email.com", + "metadata": { + "acquisition_channel": "Facebook", + "customer_life_time_value": 100 + }, + "object": "customer" + }, + "assignment_id": "rewa_nMXB59qGTNYawMT8eP8M4oUp", + "id": "rew_MVXA2kV7lZ1zC057WUaTrvNz", + "object": "reward", + "name": "100 Points = $20", + "created_at": "2022-09-09T06:41:54.496Z", + "updated_at": null, + "parameters": { + "coin": { + "exchange_ratio": 20, + "points_ratio": 100 + } + }, + "type": "COIN" + }, + "loyalty_card": { + "points": 200 + } + }, + { + "id": "rf_0bf9caf744d2dc593a", + "object": "redemption", + "date": "2022-11-10T06:31:15.477Z", + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "tracking_id": "track_fxEMFisanb4sbl4Z4yCnJyDW013IrRbJmqKByTNHbXE=", + "metadata": {}, + "result": "FAILURE", + "failure_code": "loyalty_card_points_exceeded", + "failure_message": "loyalty card points exceeded", + "order": null, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "name": "Bobby McDonald", + "email": "bobby.mcdonald@email.com", + "source_id": "bobby.mcdonald@email.com", + "metadata": { + "acquisition_channel": "Facebook", + "customer_life_time_value": 100 + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_Xak3ViMbxCH8Lb4ZG0lWwC0goMRBXWB4", + "voucher": { + "id": "v_Xak3ViMbxCH8Lb4ZG0lWwC0goMRBXWB4", + "code": "LT1-wMPnRhxb", + "campaign": "Loyalty Campaign - Tiers - 1", + "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N" + } + }, + { + "id": "rf_0bf8c023eb4d4aa4ad", + "object": "redemption", + "date": "2022-11-09T11:05:28.074Z", + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "tracking_id": "track_fxEMFisanb4sbl4Z4yCnJyDW013IrRbJmqKByTNHbXE=", + "metadata": {}, + "result": "FAILURE", + "failure_code": "customer_rules_violated", + "failure_message": "customer does not match validation rules", + "order": null, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "name": "Bob Smith", + "email": "bob.smith@email.com", + "source_id": "bob.smith@email.com", + "metadata": { + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_FGQjOjqasEbbdpnySdCpUoalJio3OHWK", + "voucher": { + "id": "v_FGQjOjqasEbbdpnySdCpUoalJio3OHWK", + "code": "3rqWOTAh", + "campaign_id": null + } + }, + { + "id": "r_0ba9fa02fcd28ed8f1", + "object": "redemption", + "date": "2022-09-09T06:38:20.085Z", + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "tracking_id": "track_fxEMFisanb4sbl4Z4yCnJyDW013IrRbJmqKByTNHbXE=", + "metadata": {}, + "amount": 300, + "result": "SUCCESS", + "order": { + "id": "ord_G9LBb5SOPa36pHdwxUvzkw4P", + "source_id": null, + "created_at": "2022-09-09T06:38:17.984Z", + "updated_at": null, + "status": "PAID", + "amount": 4600, + "items_discount_amount": 300, + "total_discount_amount": 300, + "total_amount": 4300, + "items_applied_discount_amount": 300, + "total_applied_discount_amount": 300, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1600, + "price": 1600, + "subtotal_amount": 1600, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 1600 + }, + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1600 + } + }, + { + "object": "order_item", + "product_id": "prod_0a65b3ff8592d7a5b5", + "quantity": 1, + "amount": 3000, + "discount_amount": 300, + "applied_discount_amount": 300, + "price": 3000, + "subtotal_amount": 2700, + "product": { + "id": "prod_0a65b3ff8592d7a5b5", + "name": "Koffee Cup", + "price": 3000 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "object": "customer" + }, + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0ba9fa02fcd28ed8f1": { + "date": "2022-09-09T06:38:18.099Z", + "related_object_type": "voucher", + "related_object_id": "v_KqP2NOSb4dJb1D6UBhcq7ScPZXun0y40", + "related_object_parent_id": "camp_hC2GdqYtOmTT45zfhib62cK1" + } + } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "name": "Bob Smith", + "email": "bob.smith@email.com", + "source_id": "bob.smith@email.com", + "metadata": {}, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_KqP2NOSb4dJb1D6UBhcq7ScPZXun0y40", + "voucher": { + "id": "v_KqP2NOSb4dJb1D6UBhcq7ScPZXun0y40", + "code": "vTcguVLE", + "campaign": "SL-Gift", + "campaign_id": "camp_hC2GdqYtOmTT45zfhib62cK1" + }, + "gift": { + "amount": 300 + } + }, + { + "id": "rf_0bf8bfe0808d4aa473", + "object": "redemption", + "date": "2022-11-09T11:04:19.062Z", + "customer_id": null, + "tracking_id": null, + "metadata": {}, + "result": "FAILURE", + "failure_code": "missing_customer", + "failure_message": "Missing customer", + "order": null, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": null, + "related_object_type": "voucher", + "related_object_id": "v_FGQjOjqasEbbdpnySdCpUoalJio3OHWK", + "voucher": { + "id": "v_FGQjOjqasEbbdpnySdCpUoalJio3OHWK", + "code": "3rqWOTAh", + "campaign_id": null + } + } + ], + "total": 6 } } - }, - "custom_event": { - "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" - }, - "source": { - "banner": "Get 2 points for every month you're a customer for viewing a page" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Custom Event - proportional points for viewing a page based on customer metadata" } + } + } + } + } + }, + "post": { + "operationId": "redeem-stacked-discounts", + "tags": [ + "STACKABLE DISCOUNTS API" + ], + "summary": "Redeem Stackable Discounts", + "description": "Use this method to redeem up to 5 redeemables in a single API request.\n\n## How API returns calculated discounts and order amounts in the response\n\nIn the table below, you can see the logic the API follows to calculate discounts and amounts:\n\n| **Field** | **Calculation** | **Description** |\n|:---|:---|:---|\n| amount | N/A | This field shows the order amount before applying any discount |\n| total_amount | `total_amount` = `amount` - `total_discount_amount` | This field shows the order amount after applying all the discounts |\n| 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. |\n| items_discount_amount | sum(items, i => i.discount_amount) | This field sums up all product-specific discounts |\n| total_discount_amount | `total_discount_amount` = `discount_amount` + `items_discount_amount` | This field sums up all order-level and all product-specific discounts |\n| applied_discount_amount | N/A | This field shows the order-level discount applied in a particular request |\n| items_applied_discount_amount | sum(items, i => i.applied_discount_amount) | This field sums up all product-specific discounts applied in a particular request |\n| 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 |\n\n\n> 📘 Rollbacks\n>\n> 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](ref:rollback-stacked-redemptions). \n\n\n> 📘 Also available on client-side\n>\n> This method is also accessible through public keys which you can use in client-side​ apps: mobile and web browser apps. Go to the dedicated [endpoint](ref:redeem-stacked-discounts-client-side) to learn more.\n> - Use `X-Client-Application-Id` as the application ID header.\n> - Use `X-Client-Token` as the appliction secret key header.\n> - Use client-side base URL.\n> - Use an `origin` header for your custom domain.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "## Expanded Response\n\nResponses will vary depending on the strings passed in the `options.expand` string array.\n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redemption object.
- Metadata not included for each discount type. |\n| [\"order\", \"redemption\"] | - Returns redemption object `metadata`.
- Order data with calculated discounts are listed in each child redemption object. |\n| [\"redeemable\", \"redemption\"] | - Returns each discount type's `metadata` in each child redemption object.
- Returns redemption object `metadata`. |\n| [\"redemption\"] | - Returns redemption object `metadata`. |\n| [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object
- Returns redemption object `metadata`.
- Returns an expanded `categories` object, showing details about the category. |", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/19_req_redemptions" }, - { - "event": "customer.loyalty.tier.prolonged", - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 1, - "points": 2, - "property": "customer_life_time_value" + "examples": { + "Example": { + "value": { + "customer": { + "source_id": "sample_customer", + "metadata": { + "key": "value" + } + }, + "options": { + "expand": [ + "order", + "redeemable", + "category" + ] + }, + "redeemables": [ + { + "object": "voucher", + "id": "voucher-code" + } + ], + "session": { + "type": "LOCK", + "key": "session_key" + }, + "order": { + "amount": 55000, + "status": "PAID", + "items": [ + { + "quantity": 2, + "price": 20000, + "source_id": "sample product1", + "related_object": "product", + "product": { + "metadata": { + "key": "value" + } + } + }, + { + "quantity": 1, + "price": 15000, + "source_id": "sample product2", + "related_object": "product", + "product": { + "metadata": { + "key": "value" + } + } + } + ], + "metadata": { + "key": "value" + } } } - }, - "loyalty_tier": { - "id": "ltr_pudTGWasuIqxdiDM0go31OV1" - }, - "source": { - "banner": "Get 2 points for every month you're a customer when your loyalty tier is prolonged." - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Custom Event - proportional points for extending a loyalty tier based on customer metadata." } } - ] + } + } + }, + "responses": { + "200": { + "description": "All promo codes and tiers provided in redeemables are redeemed during the request and returned in the API response. As a result, there are child `redemptions` related to redemptions of each redeemable and a `parent_redemption` that presents the final effect of redeeming all redeemables and stores the list of child redemptions. \n\n| Response Parameter | Description |\n|:---|:---|\n| redemptions
`array of objects` | This array lists all child redemptions that were executed during the request. Each child redemption returns a redemption object with detailed information on how each discount/code was applied to the order. You can see the effect of each consecutive redemption within the order object of each redemption, specifically the `total_discount_amount` parameter. This is why the sequence in which the discounts were provided in the request body matters. Each subsequent redemption object contains the order object which combines the effect of the previously applied discounts. |\n| parent_redemption
`object` | Represents the final effect of all child redemptions executed during the request. |\n| order
`object` | Represents order details after all discounts are applied. |", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/19_res_redemptions_POST" + } + } + } } } } - } - }, - "responses": { - "200": { - "description": "Returns an array of earning rule objects.", - "content": { - "application/json": { + }, + "/v1/redemptions/{redemptionId}": { + "parameters": [ + { "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/8_obj_earning_rule_object" - } + "type": "string" }, - "examples": { - "Example": { - "value": [ - { - "id": "ern_63g6NQgtepfXn2z0QbT2ksLf", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "points": 5, - "type": "FIXED" + "name": "redemptionId", + "in": "path", + "required": true, + "description": "ID of previously created redemption." + } + ], + "get": { + "operationId": "get-redemption", + "tags": [ + "REDEMPTIONS API" + ], + "summary": "Get Redemption", + "description": "Return a redemption or redemption rollback object. This object can either be a successfull or failed redemption or redemption rollback.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a redemption object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_res_get_redemption" + }, + "examples": { + "Discount Voucher": { + "value": { + "id": "r_0bade27c428db5873e", + "object": "redemption", + "date": "2022-09-12T07:29:28.211Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": {}, + "result": "SUCCESS", + "order": { + "id": "ord_ebmAU9uv3dTE2Khqyh7i5ka7", + "source_id": null, + "created_at": "2022-09-12T07:29:26.245Z", + "updated_at": null, + "status": "PAID", + "amount": 22500, + "discount_amount": 300, + "total_discount_amount": 300, + "total_amount": 22200, + "applied_discount_amount": 300, + "total_applied_discount_amount": 300, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b2c36568000039138", + "quantity": 1, + "amount": 22500, + "price": 22500, + "subtotal_amount": 22500, + "product": { + "id": "prod_0b2c36568000039138", + "source_id": "86", + "name": "[Sample] Able Brewing System", + "price": 22500 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0bade27c428db5873e": { + "date": "2022-09-12T07:29:26.282Z", + "related_object_type": "voucher", + "related_object_id": "v_c1yOEjZXOyVIe89VAYiRvL3QimZjXo8h" + } + } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "accepts_marketing": false + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_c1yOEjZXOyVIe89VAYiRvL3QimZjXo8h", + "voucher": { + "id": "v_c1yOEjZXOyVIe89VAYiRvL3QimZjXo8h", + "code": "FB-metadata-string", + "campaign": null, + "campaign_id": null, + "category": null, + "categories": [], + "discount": null, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "additional_info": null, + "assets": { + "qr": {}, + "barcode": {} + }, + "updated_at": null, + "object": "voucher" + } + } }, - "event": "order.paid", - "source": { - "banner": "Order paid 5 points.", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" + "Loyalty Card - Material Reward Product Type": { + "value": { + "id": "r_0c5bf0e6d601c7d7de", + "object": "redemption", + "date": "2023-01-25T12:08:09.503Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": {}, + "amount": 4, + "result": "SUCCESS", + "order": { + "id": "ord_dSOsWkNCRT24lHPkMu8o5QbX", + "source_id": null, + "created_at": "2023-01-25T12:08:07.750Z", + "updated_at": null, + "status": "PAID", + "items": [], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5bf0e6d601c7d7de": { + "date": "2023-01-25T12:08:07.768Z", + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + } + } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "categories": [], + "discount": null, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "additional_info": null, + "assets": { + "qr": {}, + "barcode": {} + }, + "updated_at": null, + "object": "voucher" + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_LRx3Y1iHFWTt217NVrknkpi5", + "product": { + "id": "prod_0b2c2ddf35150b83bb", + "source_id": "97", + "name": "[Sample] Tiered Wire Basket", + "price": 11995, + "attributes": [], + "metadata": { + "source": "bigcommerce", + "bigcommerce_product_categories": [ + 21, + 23 + ] + }, + "image_url": null, + "created_at": "2022-06-03T13:36:16.084Z", + "updated_at": "2022-06-07T09:10:44.644Z", + "object": "product" + }, + "id": "rew_EPx1hCTpqzF0HW1z9NKckZH4", + "object": "reward", + "name": "Present", + "created_at": "2022-06-13T06:59:01.694Z", + "updated_at": null, + "parameters": { + "product": { + "id": "prod_0b2c2ddf35150b83bb", + "sku_id": null + } + }, + "type": "MATERIAL" + }, + "loyalty_card": { + "points": 4 + } + } + }, + "Loyalty Card - Material Reward SKU Type": { + "value": { + "id": "r_0c5bf18dad48a34392", + "object": "redemption", + "date": "2023-01-25T12:11:00.543Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": {}, + "amount": 6, + "result": "SUCCESS", + "order": { + "id": "ord_dwb6bpqjIlMuXFS71NuHed9S", + "source_id": null, + "created_at": "2023-01-25T12:10:58.598Z", + "updated_at": null, + "status": "PAID", + "items": [], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5bf18dad48a34392": { + "date": "2023-01-25T12:10:58.613Z", + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + } + } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "categories": [], + "discount": null, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "additional_info": null, + "assets": { + "qr": {}, + "barcode": {} + }, + "updated_at": null, + "object": "voucher" + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_gfpRNkOT0pwzF7P5tXWXOs4H", + "product": { + "id": "prod_5h0wc453_2", + "source_id": "jonah-nystrom-bourbon", + "name": "Johan & Nyström - Bourbon", + "price": null, + "attributes": [ + "categories", + "description", + "weight" + ], + "metadata": { + "company": "Johan & Nyström", + "showcase": true + }, + "image_url": null, + "created_at": "2021-12-01T08:00:49.418Z", + "updated_at": null, + "object": "product" + }, + "sku": { + "id": "sku_0a3efc9044dd121803", + "source_id": "jonah-nystrom-bourbon-250g", + "product_id": "prod_5h0wc453_2", + "sku": "250g", + "price": 1750, + "currency": null, + "attributes": { + "categories": "Coffee, Whole Bean", + "description": "Background for this blend comes from the longing for a real dark roasting of high-quality coffee beans. Although the beans are dark roasted, they keep their clear and intense aroma. This coffee has a smoky flavour with a slight hint of sweetness and loads of fruit notes. Thanks to the experience in the dark roasting of coffee, the beans still retain most of their aromas. Its aftertaste is clear and remains for a long time. This coffee is perfect for a Dripper, French Press, Moka coffee maker and the traditional espresso brewing method.", + "weight": 250 + }, + "image_url": null, + "metadata": {}, + "created_at": "2021-12-01T08:00:49.427Z", + "updated_at": null, + "object": "sku" + }, + "id": "rew_SfQCsap5R8UBTVbdMTRx10x8", + "object": "reward", + "name": "Present - SKU", + "created_at": "2023-01-25T12:10:16.060Z", + "updated_at": null, + "parameters": { + "product": { + "id": "prod_5h0wc453_2", + "sku_id": "sku_0a3efc9044dd121803" + } + }, + "type": "MATERIAL" + }, + "loyalty_card": { + "points": 6 + } + } }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" + "Loyalty Card - Pay with Points": { + "value": { + "id": "r_0b5e402ad54a3afe9c", + "object": "redemption", + "date": "2022-07-12T11:00:26.247Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 5, + "redemption": "r_0b5e402ad50a3afe98", + "result": "SUCCESS", + "order": { + "id": "ord_9akjPYZNskEhKZ4zCZt6TKwq", + "source_id": null, + "created_at": "2022-07-12T11:00:26.224Z", + "amount": 20000, + "discount_amount": 5100, + "total_discount_amount": 5100, + "total_amount": 14900, + "applied_discount_amount": 500, + "total_applied_discount_amount": 500, + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "channel": { + "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", + "channel_type": "API" + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "accepts_marketing": false + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_pQZDYaH8LzoOvgh3234DqZQjGJgbPov6", + "voucher": { + "id": "v_pQZDYaH8LzoOvgh3234DqZQjGJgbPov6", + "code": "LOYALTY-CARD-zOR2sV9Q", + "campaign": "Loyalty Program", + "campaign_id": "camp_Hpt5hPTA8kSKRWGxBGw8Y0So", + "category": null, + "categories": [], + "discount": null, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "additional_info": null, + "assets": { + "qr": {}, + "barcode": {} + }, + "updated_at": null, + "object": "voucher" + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "accepts_marketing": false + }, + "object": "customer" + }, + "assignment_id": "rewa_X3jnD5XFxP6GXCzPZUNknDck", + "id": "rew_6rhNwuuWFQJLvTPO34ilg6jq", + "object": "reward", + "name": "Pay with Points", + "created_at": "2022-07-11T08:18:18.205Z", + "updated_at": null, + "parameters": { + "coin": { + "exchange_ratio": 1, + "points_ratio": 1 + } + }, + "type": "COIN" + }, + "loyalty_card": { + "points": 5 + } + } }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_knM56LS3oygL0Ue0oeSNt4WA", - "metadata": { - "Type": "Order paid - fixed amount of points" - } - }, - { - "id": "ern_Ov5RWerVFubVSjIHOMco34dv", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_AMOUNT", - "order": { - "amount": { - "every": 1, - "points": 1 + "Loyalty Card - Digital Reward - Discount Voucher": { + "value": { + "id": "r_0c5bf3323008a35032", + "object": "redemption", + "date": "2023-01-25T12:18:10.707Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": { + "redemption_location": { + "city": "Warsaw", + "state": "Polyork" + } + }, + "amount": 2, + "result": "SUCCESS", + "order": { + "id": "ord_dqxr4uzaYWkTZnrSEMoQtCF8", + "source_id": null, + "created_at": "2023-01-25T12:18:09.203Z", + "updated_at": null, + "status": "PAID", + "amount": 2100, + "total_amount": 2100, + "items": [ + { + "object": "order_item", + "product_id": "prod_0bc3bd8a4e072c5275", + "quantity": 3, + "amount": 2100, + "price": 700, + "subtotal_amount": 2100, + "product": { + "id": "prod_0bc3bd8a4e072c5275", + "name": "Bouquet - Romantic Roses", + "price": 700 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5bf3323008a35032": { + "date": "2023-01-25T12:18:09.216Z", + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + } + } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "categories": [], + "discount": null, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "additional_info": null, + "assets": { + "qr": {}, + "barcode": {} + }, + "updated_at": null, + "object": "voucher" + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_0ZwLAHgeU9IrI2V1ofYRmW7g", + "voucher": { + "id": "v_4GaEX7clyqMaveT7vHhoyRpsIgxv95Q6", + "code": "HAPPY-ORDER5My", + "campaign": "$20 off the entire order", + "campaign_id": "camp_5h0wc453_4", + "category": null, + "category_id": "cat_0b688929a2476386a6", + "categories": [], + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 2000, + "effect": "APPLY_TO_ORDER" + }, + "gift": null, + "loyalty_card": null, + "start_date": "2022-09-20T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "21ceb848-4869-4dac-ba41-f854bda3a101", + "url": "https://dl.voucherify.io/api/v1/assets/qr/21ceb848-4869-4dac-ba41-f854bda3a101" + }, + "barcode": { + "id": "1dba9cb2-fb28-4c8d-8548-5edb2eb01f5a", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/1dba9cb2-fb28-4c8d-8548-5edb2eb01f5a" + } + }, + "is_referral_code": false, + "created_at": "2023-01-25T12:18:09.256Z", + "updated_at": null, + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/HAPPY-ORDER5My/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/HAPPY-ORDER5My/publications?page=1&limit=10" + }, + "object": "voucher" + }, + "id": "rew_MF4hKh1IKYgJkPjbcFbH94Ho", + "object": "reward", + "name": "Digital Present", + "created_at": "2023-01-25T12:16:44.557Z", + "updated_at": null, + "parameters": { + "campaign": { + "id": "camp_5h0wc453_4", + "type": "DISCOUNT_COUPONS" + } + }, + "type": "CAMPAIGN" + }, + "loyalty_card": { + "points": 2 } } }, - "event": "order.paid", - "source": { - "banner": "Order paid - 1 point for 1 dollar spent excluding discounts.", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_2R4x6pMFVEIPz1Lhz5ZVo33Y", - "metadata": { - "Type": "Order paid- points proportional to order amount" - } - }, - { - "id": "ern_5rWPz4arGlTv4FVc1vETeFfe", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_TOTAL_AMOUNT", - "order": { - "total_amount": { - "every": 1, + "Loyalty Card - Digital Reward - Credits on Gift Card": { + "value": { + "id": "r_0c5c1435d053202118", + "object": "redemption", + "date": "2023-01-25T14:42:25.206Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": {}, + "amount": 1, + "result": "SUCCESS", + "order": { + "id": "ord_v0r7JfUQgWRpw28UJm9Z5AaH", + "source_id": null, + "created_at": "2023-01-25T14:42:23.637Z", + "updated_at": null, + "status": "PAID", + "amount": 22500, + "total_amount": 22500, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b2c36568000039138", + "quantity": 1, + "amount": 22500, + "price": 22500, + "subtotal_amount": 22500, + "product": { + "id": "prod_0b2c36568000039138", + "source_id": "86", + "name": "[Sample] Able Brewing System", + "price": 22500 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5c1435d053202118": { + "date": "2023-01-25T14:42:23.681Z", + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + } + } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "categories": [], + "discount": null, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "additional_info": null, + "assets": { + "qr": {}, + "barcode": {} + }, + "updated_at": null, + "object": "voucher" + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_U554pL2BhDIDZOvZ8y9YQ9hA", + "voucher": { + "id": "v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk", + "code": "GIFT-CARD-xwc6X7Tk", + "campaign": "Gift Cards", + "campaign_id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "GIFT_VOUCHER", + "discount": null, + "gift": { + "amount": 55080, + "balance": 44780 + }, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM/aTyHCYfr7kRWb2vv08WIgY/Tv53SJGW+k2keqfsTq/Ohb5shkCN3FTFsaI8gulTp616sEGn/JJoIInIoNkO9Vd1+AfrKiAjmirCmekE6cz2SVCyNAXs=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM%2FaTyHCYfr7kRWb2vv08WIgY%2FTv53SJGW%2Bk2keqfsTq%2FOhb5shkCN3FTFsaI8gulTp616sEGn%2FJJoIInIoNkO9Vd1%2BAfrKiAjmirCmekE6cz2SVCyNAXs%3D" + }, + "barcode": { + "id": "U2FsdGVkX18vWc/qplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO/199U+zicnFNWqg/jF5ZCQW+6jO1q8=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18vWc%2FqplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO%2F199U%2BzicnFNWqg%2FjF5ZCQW%2B6jO1q8%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-07-08T09:44:33.179Z", + "updated_at": "2023-01-11T15:23:02.789Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "redemption": { + "quantity": null, + "redeemed_quantity": 7, + "redeemed_amount": 10300, + "object": "list", + "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/publications?page=1&limit=10" + }, + "object": "voucher" + }, + "id": "rew_6bvM4vnaVdbPVQxYpuN37rhH", + "object": "reward", + "name": "Present Credits on Gift Card", + "created_at": "2023-01-25T14:41:31.858Z", + "updated_at": null, + "parameters": { + "campaign": { + "id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", + "balance": 4000, + "type": "GIFT_VOUCHERS" + } + }, + "type": "CAMPAIGN" + }, + "loyalty_card": { "points": 1 } } }, - "event": "order.paid", - "source": { - "banner": "Order paid - 1 point for 1 dollar spent including discounts.", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_fXasfs6Eh7P2haZkI33PEumI", - "metadata": { - "Type": "Order paid- points proportional to order total amount" - } - }, - { - "id": "ern_Xs3o43dHr1O3RM5ojoeu1l6b", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_METADATA", - "order": { - "metadata": { - "every": 2, - "points": 1, - "property": "number_of_store_visits" + "Loyalty Card - Digital Reward - Points on Loyalty Card": { + "value": { + "id": "r_0c5c226f498f1a93f0", + "object": "redemption", + "date": "2023-01-25T15:44:34.317Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": {}, + "amount": 1, + "result": "SUCCESS", + "order": { + "id": "ord_1fv4ITwpUQra6iDTHFPVfnRR", + "source_id": null, + "created_at": "2023-01-25T15:44:32.494Z", + "updated_at": null, + "status": "PAID", + "amount": 700, + "total_amount": 700, + "items": [ + { + "object": "order_item", + "product_id": "prod_0bc3bd8a4e072c5275", + "quantity": 1, + "amount": 700, + "price": 700, + "subtotal_amount": 700, + "product": { + "id": "prod_0bc3bd8a4e072c5275", + "name": "Bouquet - Romantic Roses", + "price": 700 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5c226f498f1a93f0": { + "date": "2023-01-25T15:44:32.550Z", + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + } + } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "categories": [], + "discount": null, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "additional_info": null, + "assets": { + "qr": {}, + "barcode": {} + }, + "updated_at": null, + "object": "voucher" + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_BpytIepuSekuXXwb9qkLJfCU", + "voucher": { + "id": "v_pQZDYaH8LzoOvgh3234DqZQjGJgbPov6", + "code": "LOYALTY-CARD-zOR2sV9Q", + "campaign": "Loyalty Program", + "campaign_id": "camp_Hpt5hPTA8kSKRWGxBGw8Y0So", + "category": null, + "category_id": null, + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 1000, + "balance": 870 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/THRRj1QegAan0r5U+wRoHuFEA6FR7TrvZm8N+8cK7niF/8uAqFdVYTU1JD0/CdoSXlYqiGgz3PAFOGWFSJt8vkM50fcMtMNLsaudU+YrPDeT2HCB7o0Ts7h1FnbD85+0F7lwrbKmkGW6kub0mjCaRdJYS/axIAq4=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FTHRRj1QegAan0r5U%2BwRoHuFEA6FR7TrvZm8N%2B8cK7niF%2F8uAqFdVYTU1JD0%2FCdoSXlYqiGgz3PAFOGWFSJt8vkM50fcMtMNLsaudU%2BYrPDeT2HCB7o0Ts7h1FnbD85%2B0F7lwrbKmkGW6kub0mjCaRdJYS%2FaxIAq4%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+yREd0zRAfZY9uwtMZsl4eDd8+LeiKGVI5OzOQRpjhtV91IuEe7/SXEW8m4F2Llg2//yieX2zsP3UtWasWxw8ZkHMRSIdxfxzSdSj8ap0dI5xwKW4OE1Q6Sgsb+kZVfCKUHbwXCcd8y5a6xTpVIg97y74Ng1Vg2PY=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2ByREd0zRAfZY9uwtMZsl4eDd8%2BLeiKGVI5OzOQRpjhtV91IuEe7%2FSXEW8m4F2Llg2%2F%2FyieX2zsP3UtWasWxw8ZkHMRSIdxfxzSdSj8ap0dI5xwKW4OE1Q6Sgsb%2BkZVfCKUHbwXCcd8y5a6xTpVIg97y74Ng1Vg2PY%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-07-11T08:19:28.780Z", + "updated_at": "2022-10-01T00:02:05.604Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "redemption": { + "quantity": null, + "redeemed_quantity": 26, + "redeemed_points": 130, + "object": "list", + "url": "/v1/vouchers/LOYALTY-CARD-zOR2sV9Q/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/LOYALTY-CARD-zOR2sV9Q/publications?page=1&limit=10" + }, + "object": "voucher" + }, + "id": "rew_7ZM476Q77dH5KvHk4KzoRNvF", + "object": "reward", + "name": "Present on Loyalty Card", + "created_at": "2023-01-25T15:43:40.716Z", + "updated_at": null, + "parameters": { + "campaign": { + "id": "camp_Hpt5hPTA8kSKRWGxBGw8Y0So", + "balance": 20, + "type": "LOYALTY_PROGRAM" + } + }, + "type": "CAMPAIGN" + }, + "loyalty_card": { + "points": 1 } } }, - "event": "order.paid", - "source": { - "banner": "Order paid - 2 points for each store visit.", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_jucMzF25jisrqiG3k6JyyviT", - "metadata": { - "Type": "Order paid- points proportional to numerical order metadata property " - } - }, - { - "id": "ern_9CjMBP2V8zgpsHLga4YOQo0A", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_AMOUNT", - "order_items": { - "amount": { - "every": 2, - "points": 1, - "object": "product", - "id": "prod_0bae32322150fd0546" + "Gift Card": { + "value": { + "id": "r_0b5e7d29ba4fb72ee4", + "object": "redemption", + "date": "2022-07-12T15:26:52.777Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 5000, + "redemption": "r_0b5e7d29ba0fb72ee2", + "result": "SUCCESS", + "order": { + "id": "ord_5iOTjTG4I3Yo2G2bH1qHk66a", + "source_id": null, + "created_at": "2022-07-12T15:26:52.773Z", + "amount": 30200, + "discount_amount": 9530, + "total_discount_amount": 9530, + "total_amount": 20670, + "applied_discount_amount": 5000, + "total_applied_discount_amount": 5000, + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "channel": { + "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", + "channel_type": "API" + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "accepts_marketing": false + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk", + "voucher": { + "id": "v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk", + "code": "GIFT-CARD-xwc6X7Tk", + "campaign": "Gift Cards", + "campaign_id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", + "category": null, + "categories": [], + "discount": null, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "additional_info": null, + "assets": { + "qr": {}, + "barcode": {} + }, + "updated_at": null, + "object": "voucher" + }, + "gift": { + "amount": 5000 } } }, - "event": "order.paid", - "source": { - "banner": "Order paid - 2 points for 1 dollar spent on items excluding discounts.", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_y60lx7XsW1YdOOOFuDaYjvG4", - "metadata": { - "Type": "Order paid- points proportional to order items amount" - } - }, - { - "id": "ern_uI7hRj8PNodK8xWRsn3gpDdG", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_SUBTOTAL_AMOUNT", - "order_items": { - "subtotal_amount": { - "every": 2, - "points": 1, - "object": "products_collection", - "id": "pc_75U0dHlr7u75BJodrW1AE3t6" + "Promotion Tier": { + "value": { + "id": "r_0c5d6689b35320059a", + "object": "redemption", + "date": "2023-01-26T15:20:35.916Z", + "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==", + "metadata": null, + "result": "SUCCESS", + "order": { + "id": "ord_4kVJ1PiXP3TNfik3pM79KZsn", + "source_id": null, + "created_at": "2023-01-26T15:20:34.216Z", + "updated_at": null, + "status": "PAID", + "amount": 200000, + "discount_amount": 80000, + "total_discount_amount": 80000, + "total_amount": 120000, + "applied_discount_amount": 80000, + "total_applied_discount_amount": 80000, + "items": [ + { + "object": "order_item", + "source_id": "apple534", + "related_object": "product", + "product_id": "prod_anJ03RZZq74z4v", + "quantity": 2, + "amount": 100000, + "price": 50000, + "subtotal_amount": 100000, + "product": { + "name": "Apple iPhone 8", + "metadata": { + "shop": "citycenter", + "category": "electronics" + } + }, + "metadata": { + "series": "2022-783CV" + } + }, + { + "object": "order_item", + "source_id": "apple534-ihd5", + "related_object": "sku", + "sku_id": "sku_0KtP4rvwEECQ2U", + "quantity": 1, + "amount": 100000, + "price": 100000, + "subtotal_amount": 100000, + "sku": { + "sku": "Apple iPad 10 Silver 64GB", + "metadata": { + "category": "electronics" + } + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "object": "customer" + }, + "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5d6689b35320059a": { + "date": "2023-01-26T15:20:34.253Z", + "related_object_type": "promotion_tier", + "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "related_object_parent_id": "camp_w7BUstntAm8jbIDjfM49volj" + } + } + }, + "channel": { + "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", + "channel_type": "API" + }, + "customer": { + "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "name": "Annie Lemon", + "email": "annie@lemon.com", + "source_id": "annie@lemon.com", + "object": "customer" + }, + "related_object_type": "promotion_tier", + "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "voucher": null, + "promotion_tier": { + "id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "action": null, + "campaign": { + "id": "camp_w7BUstntAm8jbIDjfM49volj", + "start_date": null, + "expiration_date": null, + "object": "campaign" + }, + "campaign_id": null, + "summary": { + "redemptions": { + "total_redeemed": 0 + }, + "orders": { + "total_amount": 0, + "total_discount_amount": 0 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": null } } }, - "event": "order.paid", - "source": { - "banner": "Order paid - 2 points for every dollar spent on the product collection.", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_Lk1WROGexXA72FabUWhR1p7X", - "metadata": { - "Type": "Order paid- points proportional to order items subtotal amount" - } - }, - { - "id": "ern_dL13AmZEO0ToImOY44YUP1ru", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_QUANTITY", - "order_items": { - "quantity": { - "every": 1, - "points": 1, - "object": "sku", - "id": "sku_0b7d7dfb090be5c619" - } + "Stacked Redemption": { + "value": { + "id": "r_0b5e3e2b7f851d0192", + "object": "redemption", + "date": "2022-07-12T10:51:33.098Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "result": "SUCCESS", + "order": { + "id": "ord_qjnno0eUQ1fs0RMjejfbZp7q", + "source_id": null, + "created_at": "2022-07-12T10:51:31.687Z", + "updated_at": null, + "status": "PAID", + "amount": 20000, + "discount_amount": 6100, + "total_discount_amount": 6100, + "total_amount": 13900, + "applied_discount_amount": 6100, + "total_applied_discount_amount": 6100, + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0b5e3e2b7f851d0192": { + "date": "2022-07-12T10:51:31.711Z", + "related_object_type": "redemption", + "related_object_id": "r_0b5e3e2b7f851d0192", + "stacked": [ + "r_0b5e3e2b7f851d0193", + "r_0b5e3e2b7fc51d0194", + "r_0b5e3e2b7fc51d0195", + "r_0b5e3e2b7fc51d0196", + "r_0b5e3e2b7fc51d0197" + ] + } + } + }, + "channel": { + "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", + "channel_type": "API" + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "accepts_marketing": false + }, + "object": "customer" + }, + "related_object_type": "redemption", + "related_object_id": "r_0b5e3e2b7f851d0192", + "voucher": null } }, - "event": "order.paid", - "source": { - "banner": "Order paid - 1 point for every brand phone in your cart.", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_4F9iJG0hmKTiqSsmkfbB8vUF", - "metadata": { - "Type": "Order paid - points proportional to quantity of items in a cart of a product varient." - } - }, - { - "id": "ern_ublD9yGhxPrd9ayPAMTc4aOZ", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { + "Failed Voucher": { + "value": { + "id": "rf_0c5bd3c15701c78243", + "object": "redemption", + "date": "2023-01-25T10:00:47.812Z", + "customer_id": "cust_w1aRTTkpzeTGtOauISc8CKUN", + "tracking_id": "track_hr0jh/qNQqZWu7gkCEcVwEg27bNVrn2+", "metadata": { - "every": 1, - "points": 1, - "property": "customer_life_time_value" + "location_id": [], + "redemption_location": { + "city": "Albany", + "state": "New York" + } + }, + "result": "FAILURE", + "failure_code": "voucher_disabled", + "failure_message": "voucher is disabled", + "order": null, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_w1aRTTkpzeTGtOauISc8CKUN", + "name": "Bobby's Friend", + "email": null, + "source_id": "create_order_referrer_1", + "metadata": {}, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_zr4XJD6b6JtldZq9EorHf4jxRbahjkfi", + "voucher": { + "id": "v_zr4XJD6b6JtldZq9EorHf4jxRbahjkfi", + "code": "PROMO-CODE2", + "campaign": null, + "campaign_id": null, + "category": null, + "categories": [], + "discount": null, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "additional_info": null, + "assets": { + "qr": {}, + "barcode": {} + }, + "updated_at": null, + "object": "voucher" } } }, - "event": "order.paid", - "source": { - "banner": "Order paid 1 point for 1 month of being a customer with us.", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_raft7C1hVw427OnEobmzhXjD", - "metadata": { - "Type": "Order paid - points proportional to customer metadata property" - } - }, - { - "id": "ern_6tBwufmR7UNJInhZq8zNRrj5", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 1, - "points": 1, - "property": "customer_life_time_value" + "Failed Promotion Tier": { + "value": { + "id": "rf_0c5d6e47050156bfc2", + "object": "redemption", + "date": "2023-01-26T15:54:23.508Z", + "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==", + "metadata": null, + "result": "FAILURE", + "failure_code": "promotion_inactive", + "failure_message": "Inactive Promotion", + "order": null, + "channel": { + "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", + "channel_type": "API" + }, + "customer": { + "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "name": "Annie Lemon", + "email": "annie@lemon.com", + "source_id": "annie@lemon.com", + "metadata": { + "age": 2 + }, + "object": "customer" + }, + "related_object_type": "promotion_tier", + "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "voucher": null, + "promotion_tier": { + "id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "action": null, + "campaign": { + "id": "camp_w7BUstntAm8jbIDjfM49volj", + "start_date": null, + "expiration_date": null, + "object": "campaign" + }, + "campaign_id": null, + "summary": { + "redemptions": { + "total_redeemed": 0 + }, + "orders": { + "total_amount": 0, + "total_discount_amount": 0 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": null } } }, - "segment": { - "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" - }, - "event": "customer.segment.entered", - "source": { - "banner": "Customer entered birthday segment - 1 point for each month of being a customer with us.", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_mQ8SCABGLnrGMBbh8QS6DUpX", - "metadata": { - "Type": "Entered segment - points proportional to customer metadata property" + "Failed Redemption": { + "value": { + "id": "rf_0c5bde8dfc0156f0e3", + "object": "redemption", + "date": "2023-01-25T10:47:58.578Z", + "customer_id": null, + "tracking_id": null, + "metadata": null, + "result": "FAILURE", + "failure_code": "not_found", + "failure_message": "Resource not found", + "order": null, + "channel": { + "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", + "channel_type": "API" + }, + "customer": null, + "related_object_type": "redemption", + "related_object_id": "rf_0c5bde8dfc0156f0e3", + "voucher": null + } } - }, - { - "id": "ern_yBR0JtdcDyJXgZf30C8KQLPw", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "points": 5, - "type": "FIXED" - }, - "segment": { - "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" - }, - "event": "customer.segment.entered", - "source": { - "banner": "Customer entered birthday segment - 5 points", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_Co7zjgYPIKZ45vcK0jn7qrY8", - "metadata": { - "Type": "Entered segment - fixed points" + } + } + } + } + } + } + }, + "/v1/vouchers/{code}/redemption": { + "parameters": [ + { + "$ref": "#/components/parameters/code" + } + ], + "get": { + "operationId": "get-voucher-redemptions", + "tags": [ + "REDEMPTIONS API" + ], + "summary": "Get Voucher's Redemptions", + "description": "Retrieve the number of times a voucher was redeemed and each of the redemption details.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "A dictionary with a `redemption_entries` property that contains an array of voucher's redemptions.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_res_get_vouchers_redemptions" + }, + "examples": { + "Example": { + "value": { + "quantity": null, + "redeemed_quantity": 6, + "object": "list", + "url": "/v1/vouchers/Test - FB - Vouchers - 9/redemptions?page=1&limit=10", + "data_ref": "redemption_entries", + "total": 6, + "redemption_entries": [ + { + "id": "r_0bc92f81a6801f9bca", + "object": "redemption", + "date": "2022-10-03T12:24:58.008Z", + "customer_id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "tracking_id": "track_fxEMFisanb6bqeHALcTMxy9fmc+1Azdq951CZwGFCweQF8eGLowFHg==", + "metadata": {}, + "result": "SUCCESS", + "order": { + "id": "ord_bhp1EH2SDz7UwkkurPFPLPhi", + "source_id": null, + "created_at": "2022-10-03T12:24:56.179Z", + "updated_at": null, + "status": "PAID", + "amount": 230000, + "discount_amount": 100, + "total_discount_amount": 100, + "total_amount": 229900, + "applied_discount_amount": 100, + "total_applied_discount_amount": 100, + "items": [ + { + "object": "order_item", + "product_id": "prod_0bae45ffc7003ffc52", + "quantity": 1, + "amount": 230000, + "price": 230000, + "subtotal_amount": 230000, + "product": { + "id": "prod_0bae45ffc7003ffc52", + "source_id": "second_product", + "name": "Samsung Phone 2", + "price": 230000 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "object": "customer" + }, + "customer_id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0bc92f81a6801f9bca": { + "date": "2022-10-03T12:24:56.219Z", + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + } + } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "name": null, + "email": null, + "source_id": "johnnyy@email.com", + "metadata": {}, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "voucher": { + "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "code": "Test - FB - Vouchers - 9", + "campaign_id": null + } + }, + { + "id": "r_0bc92e6a68050e118c", + "object": "redemption", + "date": "2022-10-03T12:20:11.873Z", + "customer_id": "cust_TzWOhveicr7BI1Qg4bCFrrQQ", + "tracking_id": "track_5DQxXbK0C0pvAaHk7mnulmKhuFqhawWj", + "metadata": {}, + "result": "SUCCESS", + "order": { + "id": "ord_rBsuJYqf4eFZgqj6IxeJgEcN", + "source_id": null, + "created_at": "2022-10-03T12:20:10.222Z", + "updated_at": null, + "status": "PAID", + "amount": 230000, + "discount_amount": 100, + "total_discount_amount": 100, + "total_amount": 229900, + "applied_discount_amount": 100, + "total_applied_discount_amount": 100, + "items": [ + { + "object": "order_item", + "product_id": "prod_0bae45ffc7003ffc52", + "quantity": 1, + "amount": 230000, + "price": 230000, + "subtotal_amount": 230000, + "product": { + "id": "prod_0bae45ffc7003ffc52", + "source_id": "second_product", + "name": "Samsung Phone 2", + "price": 230000 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_TzWOhveicr7BI1Qg4bCFrrQQ", + "object": "customer" + }, + "customer_id": "cust_TzWOhveicr7BI1Qg4bCFrrQQ", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0bc92e6a68050e118c": { + "date": "2022-10-03T12:20:10.272Z", + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + } + } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_TzWOhveicr7BI1Qg4bCFrrQQ", + "name": "Bob Jones", + "email": "bob.smith@email.com", + "source_id": "pub_source_customer_4", + "metadata": { + "lang": "en", + "test": true + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "voucher": { + "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "code": "Test - FB - Vouchers - 9", + "campaign_id": null + } + }, + { + "id": "r_0bc92db6e6001f9aa8", + "object": "redemption", + "date": "2022-10-03T12:17:07.780Z", + "customer_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", + "tracking_id": "track_5DQxXbK0C0pvAaHk7mnulmYlx396Pk4X", + "metadata": {}, + "result": "SUCCESS", + "order": { + "id": "ord_JvZbg1LFcXdQ67no5SENGldH", + "source_id": null, + "created_at": "2022-10-03T12:17:06.404Z", + "updated_at": null, + "status": "PAID", + "amount": 230000, + "discount_amount": 1200, + "total_discount_amount": 1200, + "total_amount": 228800, + "applied_discount_amount": 1200, + "total_applied_discount_amount": 1200, + "items": [ + { + "object": "order_item", + "product_id": "prod_0bae45ffc7003ffc52", + "quantity": 1, + "amount": 230000, + "price": 230000, + "subtotal_amount": 230000, + "product": { + "id": "prod_0bae45ffc7003ffc52", + "source_id": "second_product", + "name": "Samsung Phone 2", + "price": 230000 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", + "object": "customer" + }, + "customer_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0bc92db6e6001f9aa8": { + "date": "2022-10-03T12:17:06.456Z", + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + } + } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", + "name": "Bob Jones", + "email": "bob.smith@email.com", + "source_id": "pub_source_customer_5", + "metadata": { + "lang": "en", + "test": true + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "voucher": { + "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "code": "Test - FB - Vouchers - 9", + "campaign_id": null + } + }, + { + "id": "r_0bc2dc6404426c0ab3", + "object": "redemption", + "date": "2022-09-28T14:30:56.199Z", + "customer_id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "tracking_id": "track_fxEMFisanb6bqeHALcTMxy9fmc+1Azdq951CZwGFCweQF8eGLowFHg==", + "metadata": {}, + "result": "SUCCESS", + "order": { + "id": "ord_6uuhGraDuXMOpVRTJT251kKW", + "source_id": null, + "created_at": "2022-09-28T14:30:54.681Z", + "updated_at": null, + "status": "PAID", + "amount": 230000, + "discount_amount": 800, + "total_discount_amount": 800, + "total_amount": 229200, + "applied_discount_amount": 800, + "total_applied_discount_amount": 800, + "items": [ + { + "object": "order_item", + "product_id": "prod_0bae45ffc7003ffc52", + "quantity": 1, + "amount": 230000, + "price": 230000, + "subtotal_amount": 230000, + "product": { + "id": "prod_0bae45ffc7003ffc52", + "source_id": "second_product", + "name": "Samsung Phone 2", + "price": 230000 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "object": "customer" + }, + "customer_id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0bc2dc6404426c0ab3": { + "date": "2022-09-28T14:30:54.737Z", + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + } + } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "name": null, + "email": null, + "source_id": "jonny@email.com", + "metadata": {}, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "voucher": { + "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "code": "Test - FB - Vouchers - 9", + "campaign_id": null + } + }, + { + "id": "r_0bc2d6f0ebc95f1783", + "object": "redemption", + "date": "2022-09-28T14:07:07.516Z", + "customer_id": "cust_H0nXrItO1DNV3UiPIl54HA5o", + "tracking_id": "track_ThofCMTQe4EVIo0zvvOlTor1twaQNd7E", + "metadata": {}, + "result": "SUCCESS", + "order": { + "id": "ord_ZQevc2J2sBegsnp5DwanXHsa", + "source_id": null, + "created_at": "2022-09-28T14:07:06.073Z", + "updated_at": null, + "status": "PAID", + "amount": 230000, + "discount_amount": 0, + "total_discount_amount": 0, + "total_amount": 230000, + "applied_discount_amount": 0, + "total_applied_discount_amount": 0, + "items": [ + { + "object": "order_item", + "product_id": "prod_0bae45ffc7003ffc52", + "quantity": 1, + "amount": 230000, + "price": 230000, + "subtotal_amount": 230000, + "product": { + "id": "prod_0bae45ffc7003ffc52", + "source_id": "second_product", + "name": "Samsung Phone 2", + "price": 230000 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_H0nXrItO1DNV3UiPIl54HA5o", + "object": "customer" + }, + "customer_id": "cust_H0nXrItO1DNV3UiPIl54HA5o", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0bc2d6f0ebc95f1783": { + "date": "2022-09-28T14:07:06.159Z", + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + } + } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_H0nXrItO1DNV3UiPIl54HA5o", + "name": "Bob Smith", + "email": "bob.smith.1@email.com", + "source_id": "bob.smith.1@email.com", + "metadata": { + "lang": "en", + "test": false + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "voucher": { + "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "code": "Test - FB - Vouchers - 9", + "campaign_id": null + } + }, + { + "id": "r_0bc2d3c4f7495f159a", + "object": "redemption", + "date": "2022-09-28T13:53:16.057Z", + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "tracking_id": "track_fxEMFisanb4sbl4Z4yCnJyDW013IrRbJmqKByTNHbXE=", + "metadata": {}, + "result": "SUCCESS", + "order": { + "id": "ord_ff6rwr58kmdyuLsi5orplnVW", + "source_id": null, + "created_at": "2022-09-28T13:53:14.604Z", + "updated_at": null, + "status": "PAID", + "amount": 230000, + "discount_amount": 800, + "total_discount_amount": 800, + "total_amount": 229200, + "applied_discount_amount": 800, + "total_applied_discount_amount": 800, + "items": [ + { + "object": "order_item", + "product_id": "prod_0bae45ffc7003ffc52", + "quantity": 1, + "amount": 230000, + "price": 230000, + "subtotal_amount": 230000, + "product": { + "id": "prod_0bae45ffc7003ffc52", + "source_id": "second_product", + "name": "Samsung Phone 2", + "price": 230000 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "object": "customer" + }, + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0bc2d3c4f7495f159a": { + "date": "2022-09-28T13:53:14.717Z", + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + } + } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "name": "John Smith", + "email": "john.smith@email.com", + "source_id": "john.smith@email.com", + "metadata": { + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "voucher": { + "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "code": "Test - FB - Vouchers - 9", + "campaign_id": null + } + } + ] + } } + } + } + } + } + } + }, + "post": { + "operationId": "redeem-voucher", + "deprecated": true, + "tags": [ + "REDEMPTIONS API" + ], + "summary": "Redeem Voucher [Deprecated]", + "description": "\n> ❗️ Deprecated \n>\n> 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](ref:redeem-stacked-discounts) 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. \n\nTo redeem a voucher, you create a redemption object. It increments the redemption counter and updates the history of the voucher. \n\n## How discounts and order amounts are calculated in the API response?\n\nIn the table below, you can see the logic the API follows to calculate discounts and amounts:\n\n| **Field** | **Calculation** | **Description** |\n|:---|:---|:---|\n| amount | N/A | This field shows the order amount before applying any discount |\n| total_amount | total_amount = amount - total_discount_amount | This field shows the order amount after applying all the discounts |\n| discount_amount | discount_amount = previous_discount_amount + applied_discount_amount | This field sums up all order-level discounts applied to a patricular order |\n| items_discount_amount | sum(items, i => i.discount_amount) | This field sums up all product-specific discounts applied to this order |\n| total_discount_amount | total_discount_amount = discount_amount + items_discount_amount | This field sums up all order-level and all product-specific discounts applied to this order |\n| applied_discount_amount | N/A | This field shows order-level discount applied in a particular request |\n| items_applied_discount_amount | sum(items, i => i.applied_discount_amount) | This field sums up all product-specific discounts applied in a particular request |\n| 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 |\n\n## SDKs \n\nYou can invoke the redemption endpoint with one of the official libraries: \n\n\n[block:html]\n{\n \"html\": \"
\\n\\n
\\n \\n
\\n\\n
\\n\\n
\\n\\n\\n
\\n\\n\\n\\n\\n\\n
\\n\\n
\\n
\\n\\n\"\n}\n[/block]\n\n## Customer tracking\n\nThe redeem operation is a key part of [Customer tracking] (doc:customer-tracking) workflow. There're 3 ways you can identify your end customer in Voucherify within this request. You can either provide a tracking ID (e.g. your customer's login or a generated id), a customer ID (if the customer is already stored in Voucherify) or a full `customer` object in the payload. Note that you can pass and thus store any customer-related metadata. See examples on the right.\n\n\n```json\n\"customer\": {\n \"source_id\": \"alice.morgan\",\n \"name\": \"Alice Morgan\",\n \"email\": \"alice@morgan.com\",\n \"description\": \"\",\n \"metadata\": {\n \"locale\": \"en-GB\",\n \"shoeSize\": 5,\n \"favourite_brands\": [\"Armani\", \"L’Autre Chose\", \"Vicini\"]\n }\n}\n```\n\nIf you already created a customer profile in Voucherify's database, whether it was implicitly by providing it to the redeem function or explicitly by invoking the [Create Customer](ref:create-customer) method, you can identify your customer in redemptions by a generated ID (starting with `cust_`). \n\n\n```json title=Example Customer Identifier [object]\n\"customer\": {\n \"id\": \"cust_C9qJ3xKgZFqkpMw7b21MF2ow\"\n}\n```\n\n```json title=Example Customer Identifier\n{\n \"customer\": \"cust_C9qJ3xKgZFqkpMw7b21MF2ow\"\n}\n```\n\n```json title=Example Customer Identifier by Source ID\n{\n \"customer\": \"alice.morgan\"\n}\n```\n\n\n> 📘 Redemption rollback\n>\n> Do you need to undo a redemption? You can do it with [redemption rollback](ref:rollback-redemption).\n\n## Redemption failures\n\nThere are several reasons why a redemption may fail. You will get the reason in the error key:\n - `resource_not_found` - voucher with given code does not exist\n- `voucher_not_active` - voucher is not active yet (before start date)\n- `voucher_expired` - voucher has already expired (after expiration date)\n- `voucher_disabled` - voucher has been disabled (`active: false`)\n- `quantity_exceeded` - voucher's redemptions limit has been exceeded\n- `gift_amount_exceeded` - gift amount has been exceeded\n- `customer_rules_violated` - customer did not match the segment\n- `order_rules_violated` - order did not match validation rules\n- `invalid_order` - order was specified incorrectly\n- `invalid_amount` - order amount was specified incorrectly\n- `missing_amount` - order amount was not specified\n- `missing_order_items` - order items were not specified\n- `missing_customer` - customer was not specified\n\n## Order object\n\nThe purchase of previously defined products (products are stored in Voucherify) by end customers is handled through the order object. You are obligated to pass the order object in case you use validation rules. You can learn more about the [validation rules structure] (doc:validation-rules). \n\n| **Attributes** | **Description** |\n|:---|:---|\n| amount
`integer` | A positive integer representing the total amount for the order. |\n| items
`list` | List of items constituting the order. Order items can be defined either by `product_id` or `sku_id`. Along with every item you must define the `quantity`.

Child attributes:

- `product_id` (*string*) - The ID of the associated product object for this line item.

- `sku_id` (*string*) - The ID of the associated variant (sku) object for this line item.

- `quantity` (*integer*) - A positive integer representing the number of instances of the item that are included in this order line.

- `price` (*integer*) - A positive integer representing the cost of an item.

- `amount` (*integer*) - `quantity` * `price` (you should provide it to retrieve `discount_amount` for a particular order item if the discount is applied only to this item learn more |\n\n\n\n\n> 🚧 Order ID\n>\n> If you use the same order id in more than one redemption request, all valid discounts provided in the redemption payload will be applied to the given order. [Read more in this guide] (https://docs.voucherify.io/docs/manage-stackable-discounts).\n\n\n```json title=Example Order\n\"order\": {\n \"amount\": 10000,\n \"items\": [\n {\n \"product_id\": \"prod_Bi7sRr3kwvxH2I\",\n \"quantity\": 1\n }\n ]\n}\n```\n## Gift Vouchers - redeem Gift Card and control redeemed amount\n\nIn Voucherify,you can also create a gift card for customers. Customers then can use gift card credits to fulfill the order. A user can specify how many credits he wants to use from the gift card. The available balance of credits is counted based on policy rules attached to the Gift Voucher definition.\n\nWhen the user wants to define how many gift credits are to be used from the gift card to complete the order, the `credits` property can be assigned the equivalent value in the lowest currency in the request body. The value of credits being applied to the order cannot be higher than the current balance on the gift card.\n\n\n```cURL title=Example Request - control redeemed amount\ncurl -i -X POST \\\n -H \"Content-Type:application/json\" \\\n -H \"X-App-Id:c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token:3266b9f8-e246-4f79-bdf0-833929b1380c\" \\\n -d '{\n \"order\": {\n \"amount\": 2500\n },\n \"gift\": {\n \"credits\": 1500\n }\n }' \\ \n 'https://api.voucherify.io/v1/vouchers/aDm4CRR3/redemption'\n```\n## Loyalty Coins - redeem loyalty card and pay with points\n\nVoucherify offers the possibility to set up a reward type in the Loyalty Program, which allows using loyalty points as gift credits. The available balance of credits is counted based on policy rules attached to the reward definition.\n\nIf a user configures just one reward type of paying in points, in the redemption request, there is no additional information required. Voucherify will automatically select as a proper reward definition and will calculate the discount based on the attached policy. \n\n\n```json title=Example Request\n{\n \"order\": {\n \"amount\": 25000,\n \"items\": [\n {\n \"product_id\": \"test_source_1\",\n \"quantity\": \"1\",\n \"price\": 15000\n },\n {\n \"product_id\": \"test_source_2\",\n \"quantity\": \"1\",\n \"price\": 10000\n }\n ]\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n }\n}\n```\n\n```json title=Example Response\n{\n \"id\": \"r_zv5Qn7cF68RbVX4foKxgwUi1\",\n \"object\": \"redemption\",\n \"date\": \"2020-05-24T13:44:20Z\",\n \"customer_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"amount\": 250,\n \"order\": {\n \"status\": \"PROCESSING\",\n \"items\": [\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_1\",\n \"quantity\": 1,\n \"amount\": 15000,\n \"price\": 15000\n },\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_2\",\n \"quantity\": 1,\n \"amount\": 10000,\n \"price\": 10000\n }\n ],\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"object\": \"customer\",\n \"referrals\": {\n \"campaigns\": [],\n \"total\": 0\n }\n },\n \"amount\": 25000,\n \"object\": \"order\",\n \"id\": \"ord_Tgi2ApelDyl86sm5AYDKCBMZ\",\n \"created_at\": \"2020-05-24T13:44:20Z\",\n \"discount_amount\": 25000\n },\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"reward\": {\n \"assignment_id\": \"rewa_pHilLjHWOD7oNjJZnog3VoEi\",\n \"loyalty_tier_id\": \"ltr_3q5dW6GaRC4QkA1oYmfGy1k1\",\n \"id\": \"rew_3qmzGPWJ7LfLXnPAjmbPacIl\",\n \"name\": \"1 point - 25 cents\",\n \"created_at\": \"2020-05-22T18:39:52Z\",\n \"updated_at\": \"2020-05-23T08:18:55Z\",\n \"parameters\": {\n \"automation_id\": null,\n \"coin\": {\n \"exchange_ratio\": 0.25\n }\n },\n \"type\": \"COIN\",\n \"object\": \"reward\"\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n },\n \"result\": \"SUCCESS\",\n \"tracking_id\": \"track_IWQYtuUE7phYpPzTHD5uwbyvlrO4nqyzipbQQtsHrRw=\",\n \"voucher\": {\n \"id\": \"v_wjgLC2lrQy1urPOdd35JX0RtkcOcQOmb\",\n \"code\": \"Dm1x8MuX\",\n \"campaign\": \"TestLoyalty-GivePoints\",\n \"campaign_id\": \"camp_qVVaC4vpVlof03eBi8qb5gE7\",\n \"category\": null,\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 489,\n \"balance\": 23\n },\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/Dm1x8MuX/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_quantity\": 8,\n \"url\": \"/v1/vouchers/Dm1x8MuX/redemptions?page=1&limit=10\",\n \"redeemed_points\": 466\n },\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX1+9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19NfR0ANlhLM7Df9Ec+xqTh6aTbHakk/Gzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF/BSQTyJx0YSK+HIUG9RGD+9rVhiC7+4WkSKrgAZ+NeqQBIqcespt8WWygXjfkvbyXBSF7Lg==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19NfR0ANlhLM7Df9Ec%2BxqTh6aTbHakk%2FGzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF%2FBSQTyJx0YSK%2BHIUG9RGD%2B9rVhiC7%2B4WkSKrgAZ%2BNeqQBIqcespt8WWygXjfkvbyXBSF7Lg%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"holder_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"updated_at\": \"2020-05-24T13:44:20Z\",\n \"holder\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"object\": \"voucher\",\n \"validation_rules_assignments\": {\n \"data\": [],\n \"object\": \"list\",\n \"total\": 0,\n \"data_ref\": \"data\"\n }\n }\n}\n```\n\nIn case the user wants to define how much he spends in points, it is configurable by property `points` in a request body.\n\n\n```json title=Example Request\n{\n \"reward\": {\n \"points\": 10\n },\n \"order\": {\n \"amount\": 25000,\n \"items\": [\n {\n \"product_id\": \"test_source_1\",\n \"quantity\": \"1\",\n \"price\": 15000\n },\n {\n \"product_id\": \"test_source_2\",\n \"quantity\": \"1\",\n \"price\": 10000\n }\n ]\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n }\n}\n```\n\n```json title=Example Response\n{\n \"id\": \"r_NJIfNYD8uc2lNm3YBAqXr3FF\",\n \"object\": \"redemption\",\n \"date\": \"2020-05-24T16:28:29Z\",\n \"customer_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"amount\": 10,\n \"order\": {\n \"status\": \"PROCESSING\",\n \"items\": [\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_1\",\n \"quantity\": 1,\n \"amount\": 15000,\n \"price\": 15000\n },\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_2\",\n \"quantity\": 1,\n \"amount\": 10000,\n \"price\": 10000\n }\n ],\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"object\": \"customer\",\n \"referrals\": {\n \"campaigns\": [],\n \"total\": 0\n }\n },\n \"amount\": 25000,\n \"object\": \"order\",\n \"id\": \"ord_70kKdXIKCSx5cfglKSpz9aHy\",\n \"created_at\": \"2020-05-24T16:28:29Z\",\n \"discount_amount\": 250\n },\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"reward\": {\n \"assignment_id\": \"rewa_pHilLjHWOD7oNjJZnog3VoEi\",\n \"loyalty_tier_id\": null,\n \"id\": \"rew_3qmzGPWJ7LfLXnPAjmbPacIl\",\n \"name\": \"1 point - 25 cents\",\n \"created_at\": \"2020-05-22T18:39:52Z\",\n \"updated_at\": \"2020-05-24T13:44:26Z\",\n \"parameters\": {\n \"automation_id\": null,\n \"coin\": {\n \"exchange_ratio\": 0.25\n }\n },\n \"type\": \"COIN\",\n \"object\": \"reward\"\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n },\n \"result\": \"SUCCESS\",\n \"tracking_id\": \"track_IWQYtuUE7phYpPzTHD5uwbyvlrO4nqyzipbQQtsHrRw=\",\n \"voucher\": {\n \"id\": \"v_wjgLC2lrQy1urPOdd35JX0RtkcOcQOmb\",\n \"code\": \"Dm1x8MuX\",\n \"campaign\": \"TestLoyalty-GivePoints\",\n \"campaign_id\": \"camp_qVVaC4vpVlof03eBi8qb5gE7\",\n \"category\": null,\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 539,\n \"balance\": 63\n },\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/Dm1x8MuX/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_quantity\": 9,\n \"url\": \"/v1/vouchers/Dm1x8MuX/redemptions?page=1&limit=10\",\n \"redeemed_points\": 476\n },\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX1+9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19NfR0ANlhLM7Df9Ec+xqTh6aTbHakk/Gzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF/BSQTyJx0YSK+HIUG9RGD+9rVhiC7+4WkSKrgAZ+NeqQBIqcespt8WWygXjfkvbyXBSF7Lg==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19NfR0ANlhLM7Df9Ec%2BxqTh6aTbHakk%2FGzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF%2FBSQTyJx0YSK%2BHIUG9RGD%2B9rVhiC7%2B4WkSKrgAZ%2BNeqQBIqcespt8WWygXjfkvbyXBSF7Lg%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"holder_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"updated_at\": \"2020-05-24T16:28:29Z\",\n \"holder\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"object\": \"voucher\",\n \"validation_rules_assignments\": {\n \"data\": [],\n \"object\": \"list\",\n \"total\": 0,\n \"data_ref\": \"data\"\n }\n }\n}\n```\n\nMoreover, it is possible to define many levels of reward in which collected points can be used as gift credits. Per each tier, we can implement different conversion factors. Having many options in the rewards catalog, we will need to select a coins calculation policy (reward ID) that we want to use for calculating a final discount in the redemption request.\n\n\n\n```json title=Example Request\n{\n \"reward\": {\n \"points\": 30,\n \"id\": \"rew_noP2S5H8PEBFT97mennSA531\"\n },\n \"order\": {\n \"amount\": 25000,\n \"items\": [\n {\n \"product_id\": \"test_source_1\",\n \"quantity\": \"1\",\n \"price\": 15000\n },\n {\n \"product_id\": \"test_source_2\",\n \"quantity\": \"1\",\n \"price\": 10000\n }\n ]\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n }\n}\n```\n\n```json title=Example Response\n{\n \"id\": \"r_se17sLon6YX5wMhYVzfQa2dc\",\n \"object\": \"redemption\",\n \"date\": \"2020-05-24T13:41:16Z\",\n \"customer_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"amount\": 10,\n \"order\": {\n \"status\": \"PROCESSING\",\n \"items\": [\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_1\",\n \"quantity\": 1,\n \"amount\": 15000,\n \"price\": 15000\n },\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_2\",\n \"quantity\": 1,\n \"amount\": 10000,\n \"price\": 10000\n }\n ],\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"object\": \"customer\",\n \"referrals\": {\n \"campaigns\": [],\n \"total\": 0\n }\n },\n \"amount\": 25000,\n \"object\": \"order\",\n \"id\": \"ord_EfMmve84JzQIg2MCM3cAvLgF\",\n \"created_at\": \"2020-05-24T13:41:16Z\",\n \"discount_amount\": 25000\n },\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"reward\": {\n \"assignment_id\": \"rewa_g3QQwQfhJrjBYzEa1NJkub7N\",\n \"loyalty_tier_id\": null,\n \"id\": \"rew_noP2S5H8PEBFT97mennSA531\",\n \"name\": \"1 point 25$\",\n \"created_at\": \"2020-05-24T12:57:19Z\",\n \"parameters\": {\n \"automation_id\": null,\n \"coin\": {\n \"exchange_ratio\": 25.0\n }\n },\n \"type\": \"COIN\",\n \"object\": \"reward\"\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n },\n \"result\": \"SUCCESS\",\n \"tracking_id\": \"track_IWQYtuUE7phYpPzTHD5uwbyvlrO4nqyzipbQQtsHrRw=\",\n \"voucher\": {\n \"id\": \"v_wjgLC2lrQy1urPOdd35JX0RtkcOcQOmb\",\n \"code\": \"Dm1x8MuX\",\n \"campaign\": \"TestLoyalty-GivePoints\",\n \"campaign_id\": \"camp_qVVaC4vpVlof03eBi8qb5gE7\",\n \"category\": null,\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 439,\n \"balance\": 223\n },\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/Dm1x8MuX/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_quantity\": 7,\n \"url\": \"/v1/vouchers/Dm1x8MuX/redemptions?page=1&limit=10\",\n \"redeemed_points\": 216\n },\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX1+9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19NfR0ANlhLM7Df9Ec+xqTh6aTbHakk/Gzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF/BSQTyJx0YSK+HIUG9RGD+9rVhiC7+4WkSKrgAZ+NeqQBIqcespt8WWygXjfkvbyXBSF7Lg==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19NfR0ANlhLM7Df9Ec%2BxqTh6aTbHakk%2FGzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF%2FBSQTyJx0YSK%2BHIUG9RGD%2B9rVhiC7%2B4WkSKrgAZ%2BNeqQBIqcespt8WWygXjfkvbyXBSF7Lg%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"holder_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"updated_at\": \"2020-05-24T13:41:16Z\",\n \"holder\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"object\": \"voucher\",\n \"validation_rules_assignments\": {\n \"data\": [],\n \"object\": \"list\",\n \"total\": 0,\n \"data_ref\": \"data\"\n }\n }\n}\n```", + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "tracking_id", + "description": "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 returnee by [voucher validation](ref:validate-voucher), or a string identifying customer, with the options described below. **Although not all information is required, the extra info helps prevent fraud.**" + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Provide the redemption context in the request body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_req_redeem_voucher" + } + } + } + }, + "responses": { + "200": { + "description": "Returns a redemption object if the redeem operation succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_res_redeem_voucher" }, - { - "id": "ern_Ic2AUznt4cJInIl1wt6n0Fbv", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "points": 3, - "type": "FIXED" - }, - "custom_event": { - "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" - }, - "event": "page_view", - "source": { - "banner": "See page - 3 points", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" + "examples": { + "Gift Voucher": { + "value": { + "id": "r_0c5e8a38730ccec0d5", + "object": "redemption", + "date": "2023-01-27T12:34:57.100Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 2000, + "result": "SUCCESS", + "order": { + "id": "ord_S4BvUj64TlGqVZDOeud7z3rU", + "source_id": null, + "created_at": "2023-01-27T12:34:57.086Z", + "updated_at": null, + "status": "PAID", + "amount": 6000, + "discount_amount": 2000, + "total_discount_amount": 2000, + "total_amount": 4000, + "applied_discount_amount": 2000, + "total_applied_discount_amount": 2000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 3300, + "price": 3000, + "subtotal_amount": 3300 + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 2, + "amount": 3400, + "price": 3000, + "subtotal_amount": 3400 + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5e8a38730ccec0d5": { + "date": "2023-01-27T12:34:57.100Z", + "related_object_type": "voucher", + "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", + "related_object_parent_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6" + } + } + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", + "voucher": { + "id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", + "code": "CODE14", + "campaign": "Gift Card Campaign", + "campaign_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6", + "category": "Second", + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [], + "type": "GIFT_VOUCHER", + "discount": null, + "gift": { + "amount": 2000, + "balance": 0, + "effect": null + }, + "loyalty_card": null, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": "secret-code1", + "metadata": { + "region": "APAC", + "season": "Fall" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX1+VibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BVibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/GVIi0p5fL5hxAY/ZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd//S4R9AB+60T/x4kSKu3lgfa9KgJmbyrzXm7Ggly06/qph4/asJaZVZIXEba4WJCeHqXCEgg==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FGVIi0p5fL5hxAY%2FZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd%2F%2FS4R9AB%2B60T%2Fx4kSKu3lgfa9KgJmbyrzXm7Ggly06%2Fqph4%2FasJaZVZIXEba4WJCeHqXCEgg%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-23T11:05:42.164Z", + "updated_at": "2023-01-27T12:34:57.102Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": 18, + "redeemed_quantity": 1, + "redeemed_amount": 2000, + "object": "list", + "url": "/v1/vouchers/CODE14/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/CODE14/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + } + }, + "gift": { + "amount": 2000 + } + } }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" + "Discount Coupon": { + "value": { + "id": "r_0c5e8ef10842da0aad", + "object": "redemption", + "date": "2023-01-27T12:55:34.689Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "result": "SUCCESS", + "order": { + "id": "ord_J5ogV1Gkk2yfxmBEhYIg4O65", + "source_id": null, + "created_at": "2023-01-27T12:55:34.673Z", + "updated_at": null, + "status": "PAID", + "amount": 6000, + "items_discount_amount": 300, + "total_discount_amount": 300, + "total_amount": 5700, + "items_applied_discount_amount": 300, + "total_applied_discount_amount": 300, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 3300, + "discount_amount": 148, + "applied_discount_amount": 148, + "price": 3000, + "subtotal_amount": 3152 + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 2, + "amount": 3400, + "discount_amount": 152, + "applied_discount_amount": 152, + "price": 3000, + "subtotal_amount": 3248 + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5e8ef10842da0aad": { + "date": "2023-01-27T12:55:34.689Z", + "related_object_type": "voucher", + "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u" + } + } + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "voucher": { + "id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "code": "2CpRCE2c", + "campaign": null, + "campaign_id": null, + "category": null, + "category_id": null, + "categories": [], + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 300, + "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1+ro/6HLsfI9E/rz0QEoYv+rcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz+WQtg4nKpjUS0wcA7AuIbz2zb870YfJO/r5UBS5gCqQ==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bro%2F6HLsfI9E%2Frz0QEoYv%2BrcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz%2BWQtg4nKpjUS0wcA7AuIbz2zb870YfJO%2Fr5UBS5gCqQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3/4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ+aTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3%2F4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ%2BaTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-19T10:06:07.932Z", + "updated_at": "2023-01-27T12:55:34.690Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_HesdqEzt5e9c0T56", + "rule_id": "val_gZft0NKZSUWK", + "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "related_object_type": "voucher", + "object": "validation_rules_assignment" + } + ], + "total": 1 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 2, + "object": "list", + "url": "/v1/vouchers/2CpRCE2c/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/2CpRCE2c/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [ + { + "object": "product", + "id": "prod_0a9f9ab4ab019a42d5", + "source_id": "prod_0a9f9ab4ab019a42d5", + "strict": true, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0a9f9aeddb019a42db", + "source_id": "prod_0a9f9aeddb019a42db", + "strict": true, + "effect": "APPLY_TO_EVERY" + } + ], + "total": 2, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + } + } + } }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_KWvcBS3bdmJnWD4BTw29eRNT", - "metadata": { - "Type": "Custom Event - fixed points for viewing a page" - } - }, - { - "id": "ern_4SRj1TY1j8Q617R2Y4qiN1sy", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOM_EVENT_METADATA", - "custom_event": { - "metadata": { - "every": 1, - "points": 2, - "property": "volume_number" + "Loyalty Card": { + "value": { + "id": "r_0c5e8f2cd78497a372", + "object": "redemption", + "date": "2023-01-27T12:56:35.934Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 300, + "result": "SUCCESS", + "order": { + "id": "ord_MGTimoN4VtSj7iT75bP01FsH", + "source_id": null, + "created_at": "2023-01-27T12:56:35.923Z", + "updated_at": null, + "status": "PAID", + "amount": 6000, + "discount_amount": 6000, + "total_discount_amount": 6000, + "total_amount": 0, + "applied_discount_amount": 6000, + "total_applied_discount_amount": 6000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 3300, + "price": 3000, + "subtotal_amount": 3300 + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 2, + "amount": 3400, + "price": 3000, + "subtotal_amount": 3400 + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5e8f2cd78497a372": { + "date": "2023-01-27T12:56:35.934Z", + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + } + } + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 6500, + "balance": 5086 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-11-10T06:28:59.970Z", + "updated_at": "2023-01-27T12:56:35.935Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "holder": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 10, + "redeemed_points": 1414, + "object": "list", + "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + } + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", + "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "object": "reward", + "name": "100 = $20", + "created_at": "2022-11-10T06:28:39.582Z", + "updated_at": null, + "parameters": { + "coin": { + "exchange_ratio": 20, + "points_ratio": 100 + } + }, + "type": "COIN" + }, + "loyalty_card": { + "points": 300 } } - }, - "custom_event": { - "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" - }, - "event": "page_view", - "source": { - "banner": "See page X - get 2 points multiplied by the page number", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_WWESERcKoTRSbCDal7Hr7H0A", - "metadata": { - "Type": "Custom Event - proportional points for viewing a page based on custom event metadata" } - }, - { - "id": "ern_WXBa4b5a6N5XZt9A9Nf9dagA", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 1, - "points": 2, - "property": "customer_life_time_value" + } + } + } + }, + "400": { + "description": "Returns an error if something goes wrong. A common source of error is an invalid or expired voucher, or a valid gift voucher with insufficient available balance.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_expanded" + }, + "examples": { + "Voucher disabled": { + "value": { + "code": 400, + "key": "voucher_disabled", + "message": "voucher is disabled", + "details": "AnsvocvP", + "request_id": "v-0c5d710a63c4110ae9", + "resource_id": "rf_0c5d710a87c8a31f86", + "resource_type": "redemption", + "error": { + "message": "The voucher has been disabled and cannot be used." } } }, - "custom_event": { - "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" - }, - "event": "page_view", - "source": { - "banner": "Get 2 points for every month you're a customer for viewing a page", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_zv3mCOeZOaHCsFMG0yIKu0ax", - "metadata": { - "Type": "Custom Event - proportional points for viewing a page based on customer metadata" - } - }, - { - "id": "ern_DvdegDzcaMUXzf2fayzCqMEV", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 1, - "points": 2, - "property": "customer_life_time_value" + "Invalid Customer": { + "value": { + "code": 400, + "key": "invalid_customer", + "message": "Customer must be a holder of a loyalty card.", + "details": "AnsvocvP", + "request_id": "v-0c5e628bd14411244b", + "resource_id": "rf_0c5e628bf841c7f248", + "resource_type": "redemption", + "error": { + "message": "The customer is invalid." } } }, - "event": "customer.loyalty.tier.prolonged", - "loyalty_tier": { - "id": "ltr_pudTGWasuIqxdiDM0go31OV1" - }, - "source": { - "banner": "Get 2 points for every month you're a customer when your loyalty tier is prolonged.", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_fpfYyNcpVskgwcrs21kQ91Wx", - "metadata": { - "Type": "Custom Event - proportional points for extending a loyalty tier based on customer metadata." + "Voucher Inactive": { + "value": { + "code": 400, + "key": "voucher_not_active_now", + "message": "voucher not active now", + "details": "CODE14", + "request_id": "v-0c5e89b9300d820994", + "resource_id": "rf_0c5e89b945d33b9c02", + "resource_type": "redemption", + "error": { + "message": "The voucher is not active in the given timeframe." + } + } } } - ] + } } } } } }, - "400": { - "description": "Returns an error if a parameters is defined incorrectly.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_400_missing_param" + "/client/v1/redeem": { + "post": { + "operationId": "redeem-voucher-client-side", + "deprecated": true, + "tags": [ + "REDEMPTIONS API" + ], + "summary": "Redeem Voucher (client-side) [Deprecated]", + "description": "\n> ❗️ Deprecated \n>\n> 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](ref:redeem-stacked-discounts-client-side) 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. \n\nTo 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). \n\nThe client-side redemption works similar to the server-side [voucher redemption](ref:redeem-voucher) endpoint. The difference lies in the authorization. For the client-side, you can use client-side keys.\n\n\n> 📘 Opt-in \n>\n> By default this feature is disabled. If you want to use it, you will need to enable the function explicitly in **Project Settings**.\n\n\n> ❗️ Security Threat \n>\n> 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.\n\n### Expand Response\nYou may expand the response by adding the following object to your request body. The expanded response will include the category details of the voucher.\n\n```json\n{\n \"options\": {\n \"expand\": [\n \"category\"\n ]\n }\n}\n```", + "parameters": [ + { + "$ref": "#/components/parameters/origin" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "code", + "description": "Voucher code being redeemed.", + "required": true }, - "examples": { - "Example": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Loyalty order rules must contain one of the following properties - 'total_amount'", - "request_id": "v-0c127fa5d4424c8411" + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "tracking_id", + "description": "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](ref:validate-voucher), or a string identifying customer, with the options described below. Although not all information is required, the extra info helps prevent fraud." + } + ], + "security": [ + { + "X-Client-Application-Id-1": [], + "X-Client-Token-1": [] + } + ], + "requestBody": { + "description": "Provide the redemption context in the request body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_req_redeem_voucher" } } } - } - } - }, - "404": { - "description": "Returns an error if a parameter's value is not found in the respository.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + }, + "responses": { + "200": { + "description": "Returns a redemption object if the redeem operation succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_res_redeem_voucher" + }, + "examples": { + "Gift Voucher": { + "value": { + "id": "r_0c5e8a38730ccec0d5", + "object": "redemption", + "date": "2023-01-27T12:34:57.100Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 2000, + "result": "SUCCESS", + "order": { + "id": "ord_S4BvUj64TlGqVZDOeud7z3rU", + "source_id": null, + "created_at": "2023-01-27T12:34:57.086Z", + "updated_at": null, + "status": "PAID", + "amount": 6000, + "discount_amount": 2000, + "total_discount_amount": 2000, + "total_amount": 4000, + "applied_discount_amount": 2000, + "total_applied_discount_amount": 2000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 3300, + "price": 3000, + "subtotal_amount": 3300 + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 2, + "amount": 3400, + "price": 3000, + "subtotal_amount": 3400 + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5e8a38730ccec0d5": { + "date": "2023-01-27T12:34:57.100Z", + "related_object_type": "voucher", + "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", + "related_object_parent_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6" + } + } + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", + "voucher": { + "id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", + "code": "CODE14", + "campaign": "Gift Card Campaign", + "campaign_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6", + "category": "Second", + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [], + "type": "GIFT_VOUCHER", + "discount": null, + "gift": { + "amount": 2000, + "balance": 0, + "effect": null + }, + "loyalty_card": null, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": "secret-code1", + "metadata": { + "region": "APAC", + "season": "Fall" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX1+VibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BVibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/GVIi0p5fL5hxAY/ZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd//S4R9AB+60T/x4kSKu3lgfa9KgJmbyrzXm7Ggly06/qph4/asJaZVZIXEba4WJCeHqXCEgg==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FGVIi0p5fL5hxAY%2FZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd%2F%2FS4R9AB%2B60T%2Fx4kSKu3lgfa9KgJmbyrzXm7Ggly06%2Fqph4%2FasJaZVZIXEba4WJCeHqXCEgg%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-23T11:05:42.164Z", + "updated_at": "2023-01-27T12:34:57.102Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": 18, + "redeemed_quantity": 1, + "redeemed_amount": 2000, + "object": "list", + "url": "/v1/vouchers/CODE14/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/CODE14/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + } + }, + "gift": { + "amount": 2000 + } + } + }, + "Discount Coupon": { + "value": { + "id": "r_0c5e8ef10842da0aad", + "object": "redemption", + "date": "2023-01-27T12:55:34.689Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "result": "SUCCESS", + "order": { + "id": "ord_J5ogV1Gkk2yfxmBEhYIg4O65", + "source_id": null, + "created_at": "2023-01-27T12:55:34.673Z", + "updated_at": null, + "status": "PAID", + "amount": 6000, + "items_discount_amount": 300, + "total_discount_amount": 300, + "total_amount": 5700, + "items_applied_discount_amount": 300, + "total_applied_discount_amount": 300, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 3300, + "discount_amount": 148, + "applied_discount_amount": 148, + "price": 3000, + "subtotal_amount": 3152 + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 2, + "amount": 3400, + "discount_amount": 152, + "applied_discount_amount": 152, + "price": 3000, + "subtotal_amount": 3248 + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5e8ef10842da0aad": { + "date": "2023-01-27T12:55:34.689Z", + "related_object_type": "voucher", + "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u" + } + } + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "voucher": { + "id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "code": "2CpRCE2c", + "campaign": null, + "campaign_id": null, + "category": null, + "category_id": null, + "categories": [], + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 300, + "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1+ro/6HLsfI9E/rz0QEoYv+rcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz+WQtg4nKpjUS0wcA7AuIbz2zb870YfJO/r5UBS5gCqQ==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bro%2F6HLsfI9E%2Frz0QEoYv%2BrcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz%2BWQtg4nKpjUS0wcA7AuIbz2zb870YfJO%2Fr5UBS5gCqQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3/4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ+aTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3%2F4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ%2BaTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-19T10:06:07.932Z", + "updated_at": "2023-01-27T12:55:34.690Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_HesdqEzt5e9c0T56", + "rule_id": "val_gZft0NKZSUWK", + "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "related_object_type": "voucher", + "object": "validation_rules_assignment" + } + ], + "total": 1 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 2, + "object": "list", + "url": "/v1/vouchers/2CpRCE2c/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/2CpRCE2c/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [ + { + "object": "product", + "id": "prod_0a9f9ab4ab019a42d5", + "source_id": "prod_0a9f9ab4ab019a42d5", + "strict": true, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0a9f9aeddb019a42db", + "source_id": "prod_0a9f9aeddb019a42db", + "strict": true, + "effect": "APPLY_TO_EVERY" + } + ], + "total": 2, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + } + } + } + }, + "Loyalty Card": { + "value": { + "id": "r_0c5e8f2cd78497a372", + "object": "redemption", + "date": "2023-01-27T12:56:35.934Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 300, + "result": "SUCCESS", + "order": { + "id": "ord_MGTimoN4VtSj7iT75bP01FsH", + "source_id": null, + "created_at": "2023-01-27T12:56:35.923Z", + "updated_at": null, + "status": "PAID", + "amount": 6000, + "discount_amount": 6000, + "total_discount_amount": 6000, + "total_amount": 0, + "applied_discount_amount": 6000, + "total_applied_discount_amount": 6000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 3300, + "price": 3000, + "subtotal_amount": 3300 + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 2, + "amount": 3400, + "price": 3000, + "subtotal_amount": 3400 + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5e8f2cd78497a372": { + "date": "2023-01-27T12:56:35.934Z", + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + } + } + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 6500, + "balance": 5086 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-11-10T06:28:59.970Z", + "updated_at": "2023-01-27T12:56:35.935Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "holder": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 10, + "redeemed_points": 1414, + "object": "list", + "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + } + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", + "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "object": "reward", + "name": "100 = $20", + "created_at": "2022-11-10T06:28:39.582Z", + "updated_at": null, + "parameters": { + "coin": { + "exchange_ratio": 20, + "points_ratio": 100 + } + }, + "type": "COIN" + }, + "loyalty_card": { + "points": 300 + } + } + } + } + } + } }, - "examples": { - "Example": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find loyalty_tier with id ltr_pudTGWasuIqxdiDM0go31OV1", - "request_id": "v-0c12808f33ce673c42", - "resource_id": "ltr_pudTGWasuIqxdiDM0go31OV1", - "resource_type": "loyalty_tier" + "400": { + "description": "Returns an error if something goes wrong. A common source of error is an invalid or expired voucher, or a valid gift voucher with insufficient available balance.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_expanded" + }, + "examples": { + "Voucher disabled": { + "value": { + "code": 400, + "key": "voucher_disabled", + "message": "voucher is disabled", + "details": "AnsvocvP", + "request_id": "v-0c5d710a63c4110ae9", + "resource_id": "rf_0c5d710a87c8a31f86", + "resource_type": "redemption", + "error": { + "message": "The voucher has been disabled and cannot be used." + } + } + }, + "Invalid Customer": { + "value": { + "code": 400, + "key": "invalid_customer", + "message": "Customer must be a holder of a loyalty card.", + "details": "AnsvocvP", + "request_id": "v-0c5e628bd14411244b", + "resource_id": "rf_0c5e628bf841c7f248", + "resource_type": "redemption", + "error": { + "message": "The customer is invalid." + } + } + }, + "Voucher Inactive": { + "value": { + "code": 400, + "key": "voucher_not_active_now", + "message": "voucher not active now", + "details": "CODE14", + "request_id": "v-0c5e89b9300d820994", + "resource_id": "rf_0c5e89b945d33b9c02", + "resource_type": "redemption", + "error": { + "message": "The voucher is not active in the given timeframe." + } + } + } + } } } } } } - } - } - } - }, - "/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_0dJG7cCAjquzcxWmZ634bA0C" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " - }, - { - "schema": { - "type": "string", - "example": "ern_CFuv1O0IDl8Jgph0ojhMu8bH" }, - "name": "earningRuleId", - "in": "path", - "required": true, - "description": "A unique earning rule ID." - } - ], - "get": { - "operationId": "get-earning-rule", - "tags": [ - "LOYALTIES API" - ], - "summary": "Get Earning Rule", - "description": "Retrieves an earning rule assigned to a campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns an earning rule object with the earning rule details.", - "content": { - "application/json": { + "/v1/redemptions/{redemptionId}/rollback": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/LoyaltiesGetEarningRuleResponseBody" + "type": "string" }, - "examples": { - "Custom Event": { - "value": { - "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", - "created_at": "2022-02-07T08:19:41.810Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 2, - "type": "FIXED" - }, - "custom_event": { - "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" - }, - "event": "saw_on_facebook", - "source": { - "banner": "Saw on Facebook Timeframe", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-07T08:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "object": "earning_rule", - "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" - } - }, - "Order Paid": { - "value": { - "id": "ern_taClaOIiaGNdmdby8xS0lCcy", - "created_at": "2022-02-04T13:27:50.665Z", - "updated_at": "2022-02-07T08:19:44.198Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "event": "order.paid", - "source": { - "banner": "Order paid 1000 points", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 4 - ], - "object": "earning_rule", - "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" - } - }, - "Segment Entered": { - "value": { - "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", - "created_at": "2022-02-04T13:02:52.937Z", - "updated_at": "2022-02-07T08:19:43.291Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "segment": { - "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" - }, - "event": "customer.segment.entered", - "source": { - "banner": "Entered segment 100 points.", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" - } + "name": "redemptionId", + "in": "path", + "required": true, + "description": "The original redemption ID to be rolled back (undone)." + } + ], + "post": { + "operationId": "rollback-redemption", + "tags": [ + "REDEMPTIONS API" + ], + "summary": "Rollback Redemption", + "description": "Your business logic may include a case when you need to undo a redemption. You can revert a redemption by calling this API endpoint. \n\n ## Effect \nThe operation \n- creates a rollback entry in voucher's redemption history (`redemption.redemption_entries`) and \n- gives 1 redemption back to the pool (decreases `redeemed_quantity` by 1). \n## Returned funds \nIn case of *gift card vouchers*, this method returns funds back according to the source redemption. In case of *loyalty card vouchers*, this method returns points back according to the source redemption.", + "parameters": [ + { + "schema": { + "type": "string" }, - "Loyalty Tier Joined": { - "value": { - "id": "ern_gVo6CHBduFPoh1hctASfXHLT", - "created_at": "2022-11-24T17:01:42.809Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { + "in": "query", + "name": "reason", + "description": "Reason for the rollback." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_req_rollback_redemption" + }, + "examples": { + "Promotion": { + "value": { + "customer": { + "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "name": "Annie Lemons", + "email": "annie@lemon.com", + "phone": "+1 933 222 3334", + "birthday": "1900-12-02", + "birthdate": "1900-12-01", + "address": { + "city": "New York", + "state": "NY", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 5", + "country": "United States", + "postal_code": "100012" + }, + "metadata": { + "age": 23 + } + }, + "order": { + "source_id": "test_rollback_8" + }, "metadata": { - "every": 4, - "points": 4, - "property": "customer_life_time_value" + "location_id": [ + "L2" + ] } } - }, - "event": "customer.loyalty.tier.joined", - "loyalty_tier": { - "id": "ltr_pudTGWasuIqxdiDM0go31OV1" - }, - "source": { - "banner": "Tier joined", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_wdlEo17wmoqYHGfilbayEUj7", - "metadata": { - "Type": "Tier joined - customer metadata - proportional" } } - }, - "Loyalty Tier Left": { - "value": { - "id": "ern_66OdCyLADv5IGFoQe18vGUwa", - "created_at": "2022-11-24T17:03:59.414Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 2, - "points": 2, - "property": "customer_life_time_value" - } - } - }, - "event": "customer.loyalty.tier.left", - "loyalty_tier": { - "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2" - }, - "source": { - "banner": "Tier left", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" + } + } + }, + "responses": { + "200": { + "description": "Returns a redemption rollback object indicating the result of the rollback.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_res_rollback_redemption" }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_czm5el1Uz1jeGaO97AYoDNAq", - "metadata": { - "Type": "Tier left" - } - } - }, - "Loyalty Tier Upgraded": { - "value": { - "id": "ern_YR3fDfCjAmz9a5D68nk0i4dm", - "created_at": "2022-11-25T07:29:38.961Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 3, - "points": 4, - "property": "customer_life_time_value" + "examples": { + "Loyalty Card": { + "value": { + "id": "rr_0c5eba630bc4979e70", + "object": "redemption_rollback", + "date": "2023-01-27T16:05:23.631Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": -2, + "redemption": "r_0c5bf3323008a35032", + "reason": "A UI rollback to check for result in API response to listing.", + "result": "SUCCESS", + "order": { + "id": "ord_dqxr4uzaYWkTZnrSEMoQtCF8", + "source_id": null, + "created_at": "2023-01-25T12:18:09.203Z", + "updated_at": "2023-01-27T16:05:23.687Z", + "status": "CANCELED", + "amount": 2100, + "total_amount": 2100, + "items": [ + { + "object": "order_item", + "product_id": "prod_0bc3bd8a4e072c5275", + "quantity": 3, + "amount": 2100, + "price": 700, + "subtotal_amount": 2100, + "product": { + "name": "Bouquet - Romantic Roses", + "price": 700 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5bf3323008a35032": { + "date": "2023-01-25T12:18:09.216Z", + "rollback_id": "rr_0c5eba630bc4979e70", + "rollback_date": "2023-01-27T16:05:23.631Z", + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + } + } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "categories": [], + "discount": null, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "additional_info": null, + "assets": { + "qr": {}, + "barcode": {} + }, + "updated_at": null, + "object": "voucher" + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_0ZwLAHgeU9IrI2V1ofYRmW7g", + "voucher": { + "id": "v_4GaEX7clyqMaveT7vHhoyRpsIgxv95Q6", + "code": "HAPPY-ORDER5My", + "campaign": "$20 off the entire order", + "campaign_id": "camp_5h0wc453_4", + "category": null, + "category_id": "cat_0b688929a2476386a6", + "categories": [], + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 2000, + "effect": "APPLY_TO_ORDER" + }, + "gift": null, + "loyalty_card": null, + "start_date": "2022-09-20T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "21ceb848-4869-4dac-ba41-f854bda3a101", + "url": "https://dl.voucherify.io/api/v1/assets/qr/21ceb848-4869-4dac-ba41-f854bda3a101" + }, + "barcode": { + "id": "1dba9cb2-fb28-4c8d-8548-5edb2eb01f5a", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/1dba9cb2-fb28-4c8d-8548-5edb2eb01f5a" + } + }, + "is_referral_code": false, + "created_at": "2023-01-25T12:18:09.256Z", + "updated_at": null, + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/HAPPY-ORDER5My/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/HAPPY-ORDER5My/publications?page=1&limit=10" + }, + "object": "voucher" + }, + "id": "rew_MF4hKh1IKYgJkPjbcFbH94Ho", + "object": "reward", + "name": "Digital Present", + "created_at": "2023-01-25T12:16:44.557Z", + "updated_at": null, + "parameters": { + "campaign": { + "id": "camp_5h0wc453_4", + "type": "DISCOUNT_COUPONS" + } + }, + "type": "CAMPAIGN" + }, + "loyalty_card": { + "points": -2 + } + } + }, + "Discount Coupon": { + "value": { + "id": "rr_0c5eb002b40cce9d62", + "object": "redemption_rollback", + "date": "2023-01-27T15:20:03.536Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "redemption": "r_0c5e8ef10842da0aad", + "result": "SUCCESS", + "order": { + "id": "ord_J5ogV1Gkk2yfxmBEhYIg4O65", + "source_id": null, + "created_at": "2023-01-27T12:55:34.673Z", + "updated_at": "2023-01-27T15:20:03.743Z", + "status": "CANCELED", + "amount": 6000, + "total_amount": 6000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 3300, + "price": 3000, + "subtotal_amount": 3300 + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 2, + "amount": 3400, + "price": 3000, + "subtotal_amount": 3400 + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5e8ef10842da0aad": { + "date": "2023-01-27T12:55:34.689Z", + "rollback_id": "rr_0c5eb002b40cce9d62", + "rollback_date": "2023-01-27T15:20:03.536Z", + "related_object_type": "voucher", + "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u" + } + } + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "voucher": { + "id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "code": "2CpRCE2c", + "campaign": null, + "campaign_id": null, + "category": null, + "category_id": null, + "categories": [], + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 300, + "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1+ro/6HLsfI9E/rz0QEoYv+rcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz+WQtg4nKpjUS0wcA7AuIbz2zb870YfJO/r5UBS5gCqQ==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bro%2F6HLsfI9E%2Frz0QEoYv%2BrcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz%2BWQtg4nKpjUS0wcA7AuIbz2zb870YfJO%2Fr5UBS5gCqQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3/4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ+aTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3%2F4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ%2BaTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-19T10:06:07.932Z", + "updated_at": "2023-01-27T15:20:03.707Z", + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "object": "list", + "url": "/v1/vouchers/2CpRCE2c/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/2CpRCE2c/publications?page=1&limit=10" + }, + "object": "voucher" + } + } + }, + "Gift Card": { + "value": { + "id": "rr_0c5eb099214ccea115", + "object": "redemption_rollback", + "date": "2023-01-27T15:22:37.573Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": -2000, + "redemption": "r_0c5e8a38730ccec0d5", + "result": "SUCCESS", + "order": { + "id": "ord_S4BvUj64TlGqVZDOeud7z3rU", + "source_id": null, + "created_at": "2023-01-27T12:34:57.086Z", + "updated_at": "2023-01-27T15:22:37.628Z", + "status": "CANCELED", + "amount": 6000, + "total_amount": 6000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 3300, + "price": 3000, + "subtotal_amount": 3300 + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 2, + "amount": 3400, + "price": 3000, + "subtotal_amount": 3400 + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5e8a38730ccec0d5": { + "date": "2023-01-27T12:34:57.100Z", + "rollback_id": "rr_0c5eb099214ccea115", + "rollback_date": "2023-01-27T15:22:37.573Z", + "related_object_type": "voucher", + "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", + "related_object_parent_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6" + } + } + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", + "voucher": { + "id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", + "code": "CODE14", + "campaign": "Gift Card Campaign", + "campaign_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6", + "category": "Second", + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [], + "type": "GIFT_VOUCHER", + "discount": null, + "gift": { + "amount": 2000, + "balance": 2000, + "effect": null + }, + "loyalty_card": null, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": "secret-code1", + "metadata": { + "region": "APAC", + "season": "Fall" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX1+VibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BVibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/GVIi0p5fL5hxAY/ZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd//S4R9AB+60T/x4kSKu3lgfa9KgJmbyrzXm7Ggly06/qph4/asJaZVZIXEba4WJCeHqXCEgg==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FGVIi0p5fL5hxAY%2FZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd%2F%2FS4R9AB%2B60T%2Fx4kSKu3lgfa9KgJmbyrzXm7Ggly06%2Fqph4%2FasJaZVZIXEba4WJCeHqXCEgg%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-23T11:05:42.164Z", + "updated_at": "2023-01-27T15:22:37.595Z", + "redemption": { + "quantity": 18, + "redeemed_quantity": 0, + "redeemed_amount": 0, + "object": "list", + "url": "/v1/vouchers/CODE14/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/CODE14/publications?page=1&limit=10" + }, + "object": "voucher" + }, + "gift": { + "amount": -2000 + } + } + }, + "Promotion Tier": { + "value": { + "id": "rr_0ca286e96cc03f3e76", + "object": "redemption_rollback", + "date": "2023-03-21T07:57:12.526Z", + "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==", + "metadata": { + "location_id": [ + "L2" + ] + }, + "redemption": "r_0ca286d222d2f7dc1f", + "reason": "To undo a redemption.", + "result": "SUCCESS", + "order": { + "id": "ord_0FR01SqYIxV4ITzgs1yZjkK6", + "source_id": "test_rollback_8", + "created_at": "2023-03-21T07:56:48.634Z", + "updated_at": "2023-03-21T07:57:12.546Z", + "status": "CANCELED", + "amount": 200000, + "total_amount": 200000, + "items": [ + { + "object": "order_item", + "source_id": "apple534", + "related_object": "product", + "product_id": "prod_anJ03RZZq74z4v", + "quantity": 2, + "amount": 100000, + "price": 50000, + "subtotal_amount": 100000, + "product": { + "id": "prod_0c5d6689b39320059b", + "source_id": "prod_anJ03RZZq74z4v", + "name": "Apple iPhone 8", + "metadata": { + "shop": "citycenter", + "category": "electronics" + } + }, + "metadata": { + "series": "2022-783CV" + } + }, + { + "object": "order_item", + "source_id": "apple534-ihd5", + "related_object": "sku", + "sku_id": "sku_0KtP4rvwEECQ2U", + "quantity": 1, + "amount": 100000, + "price": 100000, + "subtotal_amount": 100000, + "sku": { + "sku": "Apple iPad 10 Silver 64GB", + "metadata": { + "category": "electronics" + } + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "object": "customer" + }, + "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0ca286d222d2f7dc1f": { + "date": "2023-03-21T07:56:48.651Z", + "rollback_id": "rr_0ca286e96cc03f3e76", + "rollback_date": "2023-03-21T07:57:12.526Z", + "related_object_type": "promotion_tier", + "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "related_object_parent_id": "camp_w7BUstntAm8jbIDjfM49volj" + } + } + }, + "channel": { + "channel_id": "e55f3aaa-b303-421a-b562-ca8529ed341d", + "channel_type": "API" + }, + "customer": { + "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "name": "Annie Lemons", + "email": "annie@lemon.com", + "source_id": "annie@lemon.com", + "metadata": { + "age": 23 + }, + "object": "customer" + }, + "related_object_type": "promotion_tier", + "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "voucher": null, + "promotion_tier": { + "id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "created_at": "2022-09-23T08:31:23.022Z", + "updated_at": "2023-02-01T07:47:57.324Z", + "name": "Percent Discount", + "banner": "Get 40% off", + "action": { + "discount": { + "type": "PERCENT", + "percent_off": 40, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": {}, + "hierarchy": 2, + "campaign": { + "id": "camp_w7BUstntAm8jbIDjfM49volj", + "start_date": "2019-08-16T00:00:00.000Z", + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "campaign_id": "camp_w7BUstntAm8jbIDjfM49volj", + "active": true, + "start_date": "2022-09-21T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "summary": { + "redemptions": { + "total_redeemed": 5 + }, + "orders": { + "total_amount": 616000, + "total_discount_amount": 246400 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": null, + "category_id": null, + "categories": [] + } } } - }, - "event": "customer.loyalty.tier.upgraded", - "loyalty_tier": { - "id": "ltr_30KHciA0UG8B71Fo51GZqwgN" - }, - "source": { - "banner": "Tier upgraded", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_M1OdRH8spk6Fs7yTuPLN2LAv", - "metadata": { - "Type": "Upgraded" - } - } - }, - "Loyalty Tier Downgraded": { - "value": { - "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", - "created_at": "2022-11-25T07:31:05.866Z", - "updated_at": "2022-11-25T07:31:43.029Z", - "validation_rule_id": "val_kfmWpfXMI9P1", - "loyalty": { - "points": 1, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.downgraded", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Tier Downgraded", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", - "metadata": { - "Type": "Tier" } } - }, - "Loyalty Tier Prolonged": { - "value": { - "id": "ern_AdlWO2yt6b6llWsibIdiRXVE", - "created_at": "2022-11-25T07:31:42.767Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 5, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.prolonged", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Prolonged", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_4jH1yq9WJS0oJ8suagCrltyb", - "metadata": {} - } } - } - } - } - } - } - }, - "put": { - "operationId": "update-earning-rule", - "tags": [ - "LOYALTIES API" - ], - "summary": "Update Earning Rule", - "description": "Update an earning rule definition.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the parameters that you would like to update for the given earning rule.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_update_earning_rule" - }, - "examples": { - "Example": { - "value": { - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "FIXED", - "points": "5" - }, - "source": { - "banner": "Order paid 5 points." - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Order paid - fixed amount of points" + }, + "400": { + "description": "Returns an error if the rollback redemption process failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Already rolledback": { + "value": { + "code": 400, + "key": "already_rolled_back", + "message": "Already rolled back", + "details": "Redemption has been already rolled back.", + "request_id": "v-0c5eb3bd81cd7e3a39", + "resource_id": "rrf_0c5eb3bd884497ed05", + "resource_type": "redemption_rollback" + } + }, + "Invalid Redemption Parent": { + "value": { + "code": 400, + "key": "invalid_redemption_parent", + "message": "Invalid redemption parent", + "details": "You can rollback only a redemption that does not have parent redemption.", + "request_id": "v-0c6382005e03b3bd2f" + } + }, + "Invalid Redemption": { + "value": { + "code": 400, + "key": "invalid_redemption", + "message": "Invalid redemption", + "details": "You can rollback only a single redemption. Use different endpoint for stacked redemption.", + "request_id": "v-0c675e5e2e04e31bb3" + } + }, + "Invalid Order": { + "value": { + "code": 400, + "key": "invalid_order", + "message": "Invalid order", + "details": "Order is not related with redemption.", + "request_id": "v-0ca2770e3fc4047e25" + } + }, + "Invalidate Customer": { + "value": { + "code": 400, + "key": "invalid_customer", + "message": "Invalid customer", + "details": "Customer is not related with redemption.", + "request_id": "v-0ca284851b0404513f" + } + } + } } } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns the updated earning rule object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_earning_rule_object" }, - "examples": { - "Example": { - "value": { - "id": "ern_63g6NQgtepfXn2z0QbT2ksLf", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": "2022-11-29T11:30:57.652Z", - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "points": 5, - "type": "FIXED" - }, - "event": "order.paid", - "source": { - "banner": "Order paid 5 points.", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_knM56LS3oygL0Ue0oeSNt4WA", - "metadata": { - "Type": "Order paid - fixed amount of points" + "404": { + "description": "Returns an error if the rollback redemption process failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Cannot find customer": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find customer with id cust_eWgXlBBiY6THFRJwX45Iakv4s", + "request_id": "v-0c5ebc5de80a2cf1a5", + "resource_id": "cust_eWgXlBBiY6THFRJwX45Iakv4s", + "resource_type": "customer" + } + } } } } } } } - } - } - }, - "delete": { - "operationId": "delete-earning-rule", - "tags": [ - "LOYALTIES API" - ], - "summary": "Delete Earning Rule", - "description": "This method deletes an earning rule for a specific loyalty campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." }, - "404": { - "description": "Returns an error indicating that the loyalty campaign or earning rule with given ID was not found.", - "content": { - "application/json": { + "/v1/promotions/tiers/{promotionTierId}/redemption": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Earning Rule Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find earning_rule with id ern_10S9ijStRZsf65xd12aydn4f", - "request_id": "v-0ae2bdc5f11027e81a", - "resource_id": "ern_10S9ijStRZsf65xd12aydn4f", - "resource_type": "earning_rule" - } - }, - "Loyalty Campaign Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id Summer Loyalty Campaign", - "request_id": "v-0ae2be04d146b71e50", - "resource_id": "Summer Loyalty Campaign", - "resource_type": "campaign" + "type": "string" + }, + "name": "promotionTierId", + "in": "path", + "required": true, + "description": "ID of the promotion tier to be redeemed." + } + ], + "post": { + "operationId": "redeem-promotion", + "deprecated": true, + "tags": [ + "REDEMPTIONS API" + ], + "summary": "Redeem Promotion [Deprecated]", + "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for promotion tier redemption, and we do not recommend using it. The new [Stackable Discounts API](ref:redeem-stacked-discounts) 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. \n\nTo redeem a promotion, you create a redemption object passing a context.\n\nYou can retrieve a list of active promotions through the [Validate Promotions](ref:validate-promotions) endpoint. That validation method will return a list of active​ promotion tiers identified by thier IDs. \n\n> 📘 Redemption rollback\n>\n> Do you need to undo a redemption? You can do it with [redemption rollback](ref:rollback-redemption).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Provide the redemption context in the request body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_req_redeem_promotion_tier" + }, + "examples": { + "One product one sku": { + "value": { + "customer": { + "source_id": "annie@lemon.com", + "name": "Annie Lemon", + "email": "annie@lemon.com" + }, + "order": { + "amount": 200000, + "items": [ + { + "source_id": "apple534", + "product_id": "prod_anJ03RZZq74z4v", + "related_object": "product", + "quantity": 2, + "price": 50000, + "product": { + "override": true, + "name": "Apple iPhone 8", + "metadata": { + "shop": "citycenter", + "category": "electronics" + } + }, + "metadata": { + "series": "2022-783CV" + } + }, + { + "sku_id": "sku_0KtP4rvwEECQ2U", + "source_id": "apple534-ihd5", + "related_object": "sku", + "quantity": 1, + "price": 100000, + "sku": { + "override": true, + "sku": "Apple iPad 10 Silver 64GB", + "metadata": { + "category": "electronics" + } + } + } + ] + } + } + } } } } - } - } - } - } - } - }, - "/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/enable": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_fkZ28pe7DUAEmmabofkxHI8N" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID or name." - }, - { - "schema": { - "type": "string", - "example": "ern_A2RArBE30Tkt56utVLrRv7rZ" - }, - "name": "earningRuleId", - "in": "path", - "required": true, - "description": "Unique earning rule ID." - } - ], - "post": { - "operationId": "enable-earning-rule", - "tags": [ - "LOYALTIES API" - ], - "summary": "Enable Earning Rule", - "description": "Enable an earning rule.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns an earning rule object with the `active` parameter set to `true`.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoyaltiesEnableEarningRulesResponseBody" - }, - "examples": { - "Example": { - "value": { - "id": "ern_raVUcdXruvXGuzm682ESrAzt", - "created_at": "2022-11-24T09:03:14.534Z", - "updated_at": "2022-11-25T14:07:39.460Z", - "loyalty": { - "points": 20, - "type": "FIXED" + }, + "responses": { + "200": { + "description": "Returns a redemption object if the redeem operation succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_obj_redemption_object_promotion_tier_extended" }, - "event": "order.paid", - "source": { - "banner": "Order has been paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-23T00:00:00.000Z", - "expiration_date": "2022-11-30T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_MbEIyLbn7pHyba5Qw5eeb35L", - "metadata": { - "Type": "Order has been paid - Fixed" + "examples": { + "One product one sku": { + "value": { + "id": "r_0ca2699201c03f121b", + "object": "redemption", + "date": "2023-03-21T05:49:00.807Z", + "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==", + "metadata": null, + "result": "SUCCESS", + "order": { + "id": "ord_IVEF85NZCXmP4S1fGmImSTwH", + "source_id": null, + "created_at": "2023-03-21T05:49:00.772Z", + "updated_at": null, + "status": "PAID", + "amount": 200000, + "discount_amount": 80000, + "total_discount_amount": 80000, + "total_amount": 120000, + "applied_discount_amount": 80000, + "total_applied_discount_amount": 80000, + "items": [ + { + "object": "order_item", + "source_id": "apple534", + "related_object": "product", + "product_id": "prod_anJ03RZZq74z4v", + "quantity": 2, + "amount": 100000, + "price": 50000, + "subtotal_amount": 100000, + "product": { + "id": "prod_0c5d6689b39320059b", + "source_id": "prod_anJ03RZZq74z4v", + "name": "Apple iPhone 8", + "metadata": { + "shop": "citycenter", + "category": "electronics" + } + }, + "metadata": { + "series": "2022-783CV" + } + }, + { + "object": "order_item", + "source_id": "apple534-ihd5", + "related_object": "sku", + "sku_id": "sku_0KtP4rvwEECQ2U", + "quantity": 1, + "amount": 100000, + "price": 100000, + "subtotal_amount": 100000, + "sku": { + "sku": "Apple iPad 10 Silver 64GB", + "metadata": { + "category": "electronics" + } + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "object": "customer" + }, + "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0ca2699201c03f121b": { + "date": "2023-03-21T05:49:00.807Z", + "related_object_type": "promotion_tier", + "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "related_object_parent_id": "camp_w7BUstntAm8jbIDjfM49volj" + } + } + }, + "channel": { + "channel_id": "e55f3aaa-b303-421a-b562-ca8529ed341d", + "channel_type": "API" + }, + "customer": { + "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "name": "Annie Lemon", + "email": "annie@lemon.com", + "source_id": "annie@lemon.com", + "metadata": { + "age": 2 + }, + "object": "customer" + }, + "related_object_type": "promotion_tier", + "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "voucher": null, + "promotion_tier": { + "id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "created_at": "2022-09-23T08:31:23.022Z", + "updated_at": "2023-02-01T07:47:57.324Z", + "name": "Percent Discount", + "banner": "Get 40% off", + "action": { + "discount": { + "type": "PERCENT", + "percent_off": 40, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": {}, + "hierarchy": 2, + "campaign": { + "id": "camp_w7BUstntAm8jbIDjfM49volj", + "start_date": "2019-08-16T00:00:00.000Z", + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "campaign_id": "camp_w7BUstntAm8jbIDjfM49volj", + "active": true, + "start_date": "2022-09-21T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "summary": { + "redemptions": { + "total_redeemed": 5 + }, + "orders": { + "total_amount": 616000, + "total_discount_amount": 246400 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_z6MvMg2Zf2UABNWN", + "rule_id": "val_q8qUBMOh5qIQ", + "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "related_object_type": "promotion_tier", + "object": "validation_rules_assignment" + } + ], + "total": 1 + }, + "category_id": null, + "categories": [] + } + } + }, + "Example": { + "value": { + "id": "r_0c64c10b8ece60bd91", + "object": "redemption", + "date": "2023-02-01T08:25:22.235Z", + "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==", + "metadata": null, + "result": "SUCCESS", + "order": { + "id": "ord_7n58dbLV2jMG4C14XjEYEbjh", + "source_id": null, + "created_at": "2023-02-01T08:25:22.192Z", + "updated_at": null, + "status": "PAID", + "amount": 200000, + "discount_amount": 80000, + "total_discount_amount": 80000, + "total_amount": 120000, + "applied_discount_amount": 80000, + "total_applied_discount_amount": 80000, + "items": [ + { + "object": "order_item", + "source_id": "apple534", + "related_object": "product", + "product_id": "prod_anJ03RZZq74z4v", + "quantity": 2, + "amount": 100000, + "price": 50000, + "subtotal_amount": 100000, + "product": { + "id": "prod_0c5d6689b39320059b", + "source_id": "prod_anJ03RZZq74z4v", + "name": "Apple iPhone 8", + "metadata": { + "shop": "citycenter", + "category": "electronics" + } + }, + "metadata": { + "series": "2022-783CV" + } + }, + { + "object": "order_item", + "source_id": "apple534-ihd5", + "related_object": "sku", + "sku_id": "sku_0KtP4rvwEECQ2U", + "quantity": 1, + "amount": 100000, + "price": 100000, + "subtotal_amount": 100000, + "sku": { + "sku": "Apple iPad 10 Silver 64GB", + "metadata": { + "category": "electronics" + } + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "object": "customer" + }, + "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c64c10b8ece60bd91": { + "date": "2023-02-01T08:25:22.235Z", + "related_object_type": "promotion_tier", + "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "related_object_parent_id": "camp_w7BUstntAm8jbIDjfM49volj" + } + } + }, + "customer": { + "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "name": "Annie Lemon", + "email": "annie@lemon.com", + "source_id": "annie@lemon.com", + "metadata": { + "age": 2 + }, + "object": "customer" + }, + "related_object_type": "promotion_tier", + "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "voucher": null, + "promotion_tier": { + "id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "created_at": "2022-09-23T08:31:23.022Z", + "updated_at": "2023-02-01T07:47:57.324Z", + "name": "Percent Discount", + "banner": "Get 40% off", + "action": { + "discount": { + "type": "PERCENT", + "percent_off": 40, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": {}, + "hierarchy": 2, + "campaign": { + "id": "camp_w7BUstntAm8jbIDjfM49volj", + "start_date": "2019-08-16T00:00:00.000Z", + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "campaign_id": null, + "active": true, + "start_date": "2022-09-21T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "summary": { + "redemptions": { + "total_redeemed": 3 + }, + "orders": { + "total_amount": 408000, + "total_discount_amount": 163200 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_z6MvMg2Zf2UABNWN", + "rule_id": "val_q8qUBMOh5qIQ", + "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "related_object_type": "promotion_tier", + "object": "validation_rules_assignment" + } + ], + "total": 1 + } + } + } + } } } } - } - } - } - }, - "404": { - "description": "Returns an error if the resource cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" }, - "examples": { - "Example": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find earning_rule with id ern_raVUcdXruvXGuzm682ESrAz", - "request_id": "v-0c0d849dde0e6737d9", - "resource_id": "ern_raVUcdXruvXGuzm682ESrAz", - "resource_type": "earning_rule" + "400": { + "description": "Returns an error if the promotion tier is inactive.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_expanded" + }, + "examples": { + "Inactive Promotion": { + "value": { + "code": 400, + "key": "promotion_inactive", + "message": "Inactive Promotion", + "details": "Promotion Tier with id: promo_DE1N30D731Tg2F6NoMwNas2W is disabled.", + "request_id": "v-0c64b722160294496b", + "resource_id": "rf_0c64b7223cce60eec6", + "resource_type": "redemption", + "error": { + "message": "The promotion is inactive." + } + } + } + } } } } } } - } - } - } - }, - "/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_fkZ28pe7DUAEmmabofkxHI8N" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID or name." - }, - { - "schema": { - "type": "string", - "example": "ern_A2RArBE30Tkt56utVLrRv7rZ" }, - "name": "earningRuleId", - "in": "path", - "required": true, - "description": "Unique earning rule ID." - } - ], - "post": { - "operationId": "disable-earning-rule", - "tags": [ - "LOYALTIES API" - ], - "summary": "Disable Earning Rule", - "description": "Disable an earning rule.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns an earning rule object with the `active` parameter set to `false`.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoyaltiesDisableEarningRulesResponseBody" - }, - "examples": { - "Example": { - "value": { - "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", - "created_at": "2022-11-25T07:31:05.866Z", - "updated_at": "2022-11-25T14:12:57.167Z", - "loyalty": { - "points": 1, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.downgraded", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Tier Downgraded", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": false, - "object": "earning_rule", - "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", - "metadata": { - "Type": "Tier" + "/client/v1/redemptions": { + "post": { + "operationId": "redeem-stacked-discounts-client-side", + "tags": [ + "STACKABLE DISCOUNTS API" + ], + "summary": "Redeem Stackable Discounts (client-side)", + "description": "Use this method to redeem up to 5 redeemables in a single API request. This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications.\n\n## How API returns calculated discounts and order amounts in the response\n\nIn the table below, you can see the logic the API follows to calculate discounts and amounts:\n\n| **Field** | **Calculation** | **Description** |\n|:---|:---|:---|\n| amount | N/A | This field shows the order amount before applying any discount |\n| total_amount | `total_amount` = `amount` - `total_discount_amount` | This field shows the order amount after applying all the discounts |\n| 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. |\n| items_discount_amount | sum(items, i => i.discount_amount) | This field sums up all product-specific discounts |\n| total_discount_amount | `total_discount_amount` = `discount_amount` + `items_discount_amount` | This field sums up all order-level and all product-specific discounts |\n| applied_discount_amount | N/A | This field shows the order-level discount applied in a particular request |\n| items_applied_discount_amount | sum(items, i => i.applied_discount_amount) | This field sums up all product-specific discounts applied in a particular request |\n| 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 |\n\n\n> 📘 Rollbacks\n>\n> 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](ref:rollback-stacked-redemptions).", + "parameters": [ + { + "$ref": "#/components/parameters/origin" + } + ], + "security": [ + { + "X-Client-Application-Id-1": [], + "X-Client-Token-1": [] + } + ], + "requestBody": { + "description": "## Expanded Response\n\nResponses will vary depending on the strings passed in the `options.expand` string array.\n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redemption object.
- Metadata not included for each discount type. |\n| [\"order\", \"redemption\"] | - Returns redemption object `metadata`.
- Order data with calculated discounts are listed in each child redemption object. |\n| [\"redeemable\", \"redemption\"] | - Returns each discount type's `metadata` in each child redemption object.
- Returns redemption object `metadata`. |\n| [\"redemption\"] | - Returns redemption object `metadata`. |\n| [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object
- Returns redemption object `metadata`.
- Returns an expanded `categories` object, showing details about the category. |", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/19_req_redemptions" + }, + "examples": { + "Example": { + "value": { + "customer": { + "source_id": "sample_customer", + "metadata": { + "key": "value" + } + }, + "options": { + "expand": [ + "order", + "redeemable", + "category" + ] + }, + "redeemables": [ + { + "object": "voucher", + "id": "voucher-code" + } + ], + "session": { + "type": "LOCK", + "key": "session_key" + }, + "order": { + "amount": 55000, + "status": "PAID", + "items": [ + { + "quantity": 2, + "price": 20000, + "source_id": "sample product1", + "related_object": "product", + "product": { + "metadata": { + "key": "value" + } + } + }, + { + "quantity": 1, + "price": 15000, + "source_id": "sample product2", + "related_object": "product", + "product": { + "metadata": { + "key": "value" + } + } + } + ], + "metadata": { + "key": "value" + } + } + } } } } } - } - } - }, - "404": { - "description": "Returns an error if the resource cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find earning_rule with id ern_A2RArBE30Tkt56utVLrRv7r", - "request_id": "v-0c0d842ed5ce67373f", - "resource_id": "ern_A2RArBE30Tkt56utVLrRv7r", - "resource_type": "earning_rule" + }, + "responses": { + "200": { + "description": "All promo codes and tiers provided in redeemables are redeemed during the request and returned in the API response. As a result, there are child `redemptions` related to redemptions of each redeemable and a `parent_redemption` that presents the final effect of redeeming all redeemables and stores the list of child redemptions. \n\n| Response Parameter | Description |\n|:---|:---|\n| redemptions
`array of objects` | This array lists all child redemptions that were executed during the request. Each child redemption returns a redemption object with detailed information on how each discount/code was applied to the order. You can see the effect of each consecutive redemption within the order object of each redemption, specifically the `total_discount_amount` parameter. This is why the sequence in which the discounts were provided in the request body matters. Each subsequent redemption object contains the order object which combines the effect of the previously applied discounts. |\n| parent_redemption
`object` | Represents the final effect of all child redemptions executed during the request. |\n| order
`object` | Represents order details after all discounts are applied. |", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/19_res_redemptions_POST" + } } } } } } - } - } - } - }, - "/v1/loyalties/members/{memberId}/rewards": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "MmFAzfDe" }, - "name": "memberId", - "in": "path", - "required": true, - "description": "Unique loyalty card assigned to a particular customer." - } - ], - "get": { - "operationId": "list-member-rewards", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Member Rewards", - "description": "Retrieves the list of rewards that the given customer (identified by `member_id`, which is a loyalty card assigned to a particular customer) **can get in exchange for loyalty points**. \n\nYou can use the `affordable_only` parameter to limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). \n\nPlease note that rewards that are disabled (i.e. set to `Not Available` in the Dashboard) for a given loyalty tier reward mapping will not be returned in this endpoint.", - "parameters": [ - { - "in": "query", - "name": "affordable_only", - "description": "Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to `true` to return rewards which the customer can actually afford.", - "schema": { - "type": "boolean" - } - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a list of rewards for the given `member_id`. Returns a filtered list if the query parameter `affordable_only` is set to `true`.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_list_member_rewards" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "reward": { - "id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", - "name": "Material Reward", - "type": "MATERIAL", - "parameters": { - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619" - } - }, - "stock": 4, - "redeemed": 1, - "attributes": { - "description": "Get a Comic Book in Archie's series." - }, - "created_at": "2022-08-17T07:46:18.619169+00:00", - "updated_at": "2022-08-17T08:13:48.30747+00:00", - "metadata": {}, - "object": "reward" + "/v1/validations": { + "post": { + "operationId": "validate-stacked-discounts", + "tags": [ + "STACKABLE DISCOUNTS API" + ], + "summary": "Validate Stackable Discounts", + "description": "Verify redeemables provided in the request. This method is designed for server side integration which means that it is accessible only through private keys.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "## Expanded Response \n\nResponses will vary depending on the strings passed in the `options.expand` string array. You can customize the response by using one of the following combinations of strings.\n \n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redeemable object.
- Metadata _not_ included for each discount type. |\n| [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. |\n| [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
- Includes `metadata` for each discount type. |\n| [\"category\"] | - Returns an expanded `categories` object, showing details about the category. |", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/19_req_validations" + }, + "examples": { + "1 Redeemable": { + "value": { + "customer": { + "source_id": "sample_customer", + "metadata": { + "key": "value" + } }, - "assignment": { - "id": "rewa_pJYQBXSitK2OVPK3XMXZK76X", - "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", - "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 39 - } - }, - "created_at": "2022-08-24T11:40:22.418972+00:00", - "updated_at": "2022-08-24T13:23:50.409121+00:00", - "object": "reward_assignment" + "options": { + "expand": [ + "order", + "redeemable", + "category" + ] }, - "object": "loyalty_reward" - }, - { - "reward": { - "id": "rew_31M6Za6zkMRfhxYJz4aDo11h", - "name": "Pay with Points", - "type": "COIN", - "parameters": { - "coin": { - "exchange_ratio": 1, - "points_ratio": 1 + "redeemables": [ + { + "object": "voucher", + "id": "voucher-code" + } + ], + "session": { + "type": "LOCK" + }, + "order": { + "amount": 55000, + "status": "PAID", + "items": [ + { + "quantity": 2, + "price": 20000, + "source_id": "sample product1", + "related_object": "product", + "product": { + "metadata": { + "key": "value" + } + } + }, + { + "quantity": 1, + "price": 15000, + "source_id": "sample product2", + "related_object": "product", + "product": { + "metadata": { + "key": "value" + } + } } - }, - "stock": null, - "redeemed": null, - "attributes": {}, - "created_at": "2022-06-23T11:06:06.222736+00:00", - "updated_at": null, - "metadata": null, - "object": "reward" + ], + "metadata": { + "key": "value" + } + } + } + }, + "5 Redeemables": { + "value": { + "customer": { + "source_id": "36_bob" }, - "assignment": { - "id": "rewa_wrVYAfXWolq52gnl15dumPCq", - "reward_id": "rew_31M6Za6zkMRfhxYJz4aDo11h", - "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", - "related_object_type": "campaign", - "created_at": "2022-08-11T14:13:34.581194+00:00", - "updated_at": null, - "object": "reward_assignment" + "options": { + "expand": [ + "order", + "redeemable", + "category" + ] }, - "object": "loyalty_reward" - }, - { - "reward": { - "id": "rew_Jhq0ecLGSx8eF4pFdlhFr9P6", - "name": "20% discount", - "type": "CAMPAIGN", - "parameters": { - "campaign": { - "id": "camp_4B1jDE63pCeSij3HU7gx3gPT", - "type": "DISCOUNT_COUPONS" + "redeemables": [ + { + "object": "voucher", + "id": "GNcuPKGe" + }, + { + "object": "voucher", + "id": "AnsvocvP", + "reward": { + "id": "rew_EPx1hCTpqzF0HW1z9NKckZH4" } }, - "stock": null, - "redeemed": null, - "attributes": {}, - "created_at": "2022-08-11T09:52:39.032699+00:00", - "updated_at": null, - "metadata": {}, - "object": "reward" - }, - "assignment": { - "id": "rewa_nFREw86qh1LiqGPRygahNh8Z", - "reward_id": "rew_Jhq0ecLGSx8eF4pFdlhFr9P6", - "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 100 + { + "object": "voucher", + "id": "M3X8IwW8", + "gift": { + "credits": 100 } }, - "created_at": "2022-08-11T14:13:34.581194+00:00", - "updated_at": null, - "object": "reward_assignment" + { + "object": "promotion_tier", + "id": "promo_DE1N30D731Tg2F6NoMwNas2W" + }, + { + "object": "promotion_tier", + "id": "promo_NDHgTg4VnOLYNjk9r7WOmQxf" + } + ], + "session": { + "type": "LOCK" }, - "object": "loyalty_reward" + "order": { + "items": [ + { + "sku_id": "sku_0a3efc90375d1217e2", + "quantity": 1 + }, + { + "product_id": "prod_0bc3bd8a4e072c5275", + "quantity": 1 + } + ] + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "All codes and tiers provided in redeemables are validated during the request and the result of their validation is returned in the API response. \n\n| **Response** | **Description** |\n|:---|:---|\n| valid
`boolean` | If **all** redeemables can be applied in the given context, the API returns `true`. Otherwise, if at least one redeemable can't be applied, the API returns `false`. |\n| redeemables
`array of objects` | The `redeemables` array lists the validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"` |\n| order
`object` | The `order` object presents details of the order provided in the request after all discounts are applied. |\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/19_res_validations" + }, + "examples": { + "False": { + "value": { + "valid": false, + "redeemables": [ + { + "status": "INAPPLICABLE", + "id": "eee33463", + "object": "voucher", + "result": { + "error": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id eee33463", + "request_id": "v-0c6c6e20dc42940f0b", + "resource_id": "eee33463", + "resource_type": "voucher" + } + } + }, + { + "status": "SKIPPED", + "id": "promo_Mwy9XpA0TLctSGriM5kum0qp", + "object": "promotion_tier", + "result": {} + } + ], + "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==" + } }, - { - "reward": { - "id": "rew_Dev2yQLodRV33UKPKHTUQWk1", - "name": "Get a product", - "type": "MATERIAL", - "parameters": { - "product": { - "id": "prod_0b2ac1dab28985cb1e", - "sku_id": null + "True - 5 Redeemables": { + "value": { + "valid": true, + "redeemables": [ + { + "status": "APPLICABLE", + "id": "GNcuPKGe", + "object": "voucher", + "order": { + "amount": 2700, + "items_discount_amount": 1700, + "total_discount_amount": 1700, + "total_amount": 1000, + "items_applied_discount_amount": 1700, + "total_applied_discount_amount": 1700, + "items": [ + { + "object": "order_item", + "product_id": "prod_s3C0nDpr0DuC7", + "sku_id": "sku_0a3efc90375d1217e2", + "quantity": 1, + "amount": 2000, + "discount_amount": 1000, + "applied_discount_amount": 1000, + "price": 2000, + "subtotal_amount": 1000, + "product": { + "id": "prod_s3C0nDpr0DuC7", + "source_id": "test_prod_id_2", + "name": "Watchflix" + }, + "sku": { + "id": "sku_0a3efc90375d1217e2", + "source_id": "test_standard_ultra_hd", + "sku": "Premium", + "price": 2000 + } + }, + { + "object": "order_item", + "product_id": "prod_0bc3bd8a4e072c5275", + "quantity": 1, + "amount": 700, + "discount_amount": 700, + "applied_discount_amount": 700, + "price": 700, + "subtotal_amount": 0, + "product": { + "id": "prod_0bc3bd8a4e072c5275", + "name": "Bouquet - Romantic Roses", + "price": 700 + } + } + ], + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "applicable_to": { + "data": [ + { + "object": "products_collection", + "id": "pc_a11pr0dUc75", + "strict": false, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "sku", + "id": "sku_0a3efc90375d1217e2", + "source_id": "test_standard_ultra_hd", + "product_id": "prod_s3C0nDpr0DuC7", + "product_source_id": "test_prod_id_2", + "strict": true, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0bc3bd8a4e072c5275", + "source_id": "prod_0bc3bd8a4e072c5275", + "strict": true, + "effect": "APPLY_TO_EVERY" + } + ], + "total": 3, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "result": { + "discount": { + "type": "AMOUNT", + "effect": "APPLY_TO_ITEMS", + "amount_off": 1000, + "is_dynamic": false + } + }, + "metadata": {}, + "categories": [] + }, + { + "status": "APPLICABLE", + "id": "AnsvocvP", + "object": "voucher", + "order": { + "amount": 2700, + "items_discount_amount": 1700, + "total_discount_amount": 1700, + "total_amount": 1000, + "items": [ + { + "object": "order_item", + "product_id": "prod_s3C0nDpr0DuC7", + "sku_id": "sku_0a3efc90375d1217e2", + "quantity": 1, + "amount": 2000, + "discount_amount": 1000, + "price": 2000, + "subtotal_amount": 1000, + "product": { + "id": "prod_s3C0nDpr0DuC7", + "source_id": "test_prod_id_2", + "name": "Watchflix" + }, + "sku": { + "id": "sku_0a3efc90375d1217e2", + "source_id": "test_standard_ultra_hd", + "sku": "Premium", + "price": 2000 + } + }, + { + "object": "order_item", + "product_id": "prod_0bc3bd8a4e072c5275", + "quantity": 1, + "amount": 700, + "discount_amount": 700, + "price": 700, + "subtotal_amount": 0, + "product": { + "id": "prod_0bc3bd8a4e072c5275", + "name": "Bouquet - Romantic Roses", + "price": 700 + } + } + ], + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "result": { + "loyalty_card": { + "points": 4 + } + }, + "metadata": {}, + "categories": [ + { + "id": "cat_0bb81a481615a37b5e", + "name": "Second", + "hierarchy": 2, + "created_at": "2022-09-20T05:58:01.561Z", + "object": "category" + } + ] + }, + { + "status": "APPLICABLE", + "id": "M3X8IwW8", + "object": "voucher", + "order": { + "amount": 2700, + "discount_amount": 100, + "items_discount_amount": 1700, + "total_discount_amount": 1800, + "total_amount": 900, + "applied_discount_amount": 100, + "total_applied_discount_amount": 100, + "items": [ + { + "object": "order_item", + "product_id": "prod_s3C0nDpr0DuC7", + "sku_id": "sku_0a3efc90375d1217e2", + "quantity": 1, + "amount": 2000, + "discount_amount": 1000, + "price": 2000, + "subtotal_amount": 1000, + "product": { + "id": "prod_s3C0nDpr0DuC7", + "source_id": "test_prod_id_2", + "name": "Watchflix" + }, + "sku": { + "id": "sku_0a3efc90375d1217e2", + "source_id": "test_standard_ultra_hd", + "sku": "Premium", + "price": 2000 + } + }, + { + "object": "order_item", + "product_id": "prod_0bc3bd8a4e072c5275", + "quantity": 1, + "amount": 700, + "discount_amount": 700, + "price": 700, + "subtotal_amount": 0, + "product": { + "id": "prod_0bc3bd8a4e072c5275", + "name": "Bouquet - Romantic Roses", + "price": 700 + } + } + ], + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "result": { + "gift": { + "credits": 100 + } + }, + "metadata": {}, + "categories": [] + }, + { + "status": "APPLICABLE", + "id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "object": "promotion_tier", + "order": { + "amount": 2700, + "discount_amount": 460, + "items_discount_amount": 1700, + "total_discount_amount": 2160, + "total_amount": 540, + "applied_discount_amount": 360, + "total_applied_discount_amount": 360, + "items": [ + { + "object": "order_item", + "product_id": "prod_s3C0nDpr0DuC7", + "sku_id": "sku_0a3efc90375d1217e2", + "quantity": 1, + "amount": 2000, + "discount_amount": 1000, + "price": 2000, + "subtotal_amount": 1000, + "product": { + "id": "prod_s3C0nDpr0DuC7", + "source_id": "test_prod_id_2", + "name": "Watchflix" + }, + "sku": { + "id": "sku_0a3efc90375d1217e2", + "source_id": "test_standard_ultra_hd", + "sku": "Premium", + "price": 2000 + } + }, + { + "object": "order_item", + "product_id": "prod_0bc3bd8a4e072c5275", + "quantity": 1, + "amount": 700, + "discount_amount": 700, + "price": 700, + "subtotal_amount": 0, + "product": { + "id": "prod_0bc3bd8a4e072c5275", + "name": "Bouquet - Romantic Roses", + "price": 700 + } + } + ], + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "applicable_to": { + "data": [ + { + "object": "sku", + "id": "sku_0a3efc90375d1217e2", + "source_id": "test_standard_ultra_hd", + "product_id": "prod_s3C0nDpr0DuC7", + "product_source_id": "test_prod_id_2", + "strict": true, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0bc3bd8a4e072c5275", + "source_id": "prod_0bc3bd8a4e072c5275", + "strict": true, + "effect": "APPLY_TO_EVERY" + } + ], + "total": 2, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [ + { + "object": "product", + "id": "prod_0b2c2ddf35150b83bb", + "source_id": "97", + "strict": false, + "effect": "APPLY_TO_EVERY" + } + ], + "total": 1, + "data_ref": "data", + "object": "list" + }, + "result": { + "discount": { + "type": "PERCENT", + "effect": "APPLY_TO_ORDER", + "percent_off": 40, + "is_dynamic": false + } + }, + "metadata": {} + }, + { + "status": "APPLICABLE", + "id": "promo_NDHgTg4VnOLYNjk9r7WOmQxf", + "object": "promotion_tier", + "order": { + "amount": 2700, + "discount_amount": 490, + "items_discount_amount": 1700, + "total_discount_amount": 2190, + "total_amount": 510, + "applied_discount_amount": 30, + "total_applied_discount_amount": 30, + "items": [ + { + "object": "order_item", + "product_id": "prod_s3C0nDpr0DuC7", + "sku_id": "sku_0a3efc90375d1217e2", + "quantity": 1, + "amount": 2000, + "discount_amount": 1000, + "price": 2000, + "subtotal_amount": 1000, + "product": { + "id": "prod_s3C0nDpr0DuC7", + "source_id": "test_prod_id_2", + "name": "Watchflix" + }, + "sku": { + "id": "sku_0a3efc90375d1217e2", + "source_id": "test_standard_ultra_hd", + "sku": "Premium", + "price": 2000 + } + }, + { + "object": "order_item", + "product_id": "prod_0bc3bd8a4e072c5275", + "quantity": 1, + "amount": 700, + "discount_amount": 700, + "price": 700, + "subtotal_amount": 0, + "product": { + "id": "prod_0bc3bd8a4e072c5275", + "name": "Bouquet - Romantic Roses", + "price": 700 + } + } + ], + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "applicable_to": { + "data": [ + { + "object": "sku", + "id": "sku_0a3efc90375d1217e2", + "source_id": "test_standard_ultra_hd", + "product_id": "prod_s3C0nDpr0DuC7", + "product_source_id": "test_prod_id_2", + "strict": true, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0bc3bd8a4e072c5275", + "source_id": "prod_0bc3bd8a4e072c5275", + "strict": true, + "effect": "APPLY_TO_EVERY" + } + ], + "total": 2, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [ + { + "object": "product", + "id": "prod_0b2c2ddf35150b83bb", + "source_id": "97", + "strict": false, + "effect": "APPLY_TO_EVERY" + } + ], + "total": 1, + "data_ref": "data", + "object": "list" + }, + "result": { + "discount": { + "type": "AMOUNT", + "effect": "APPLY_TO_ORDER", + "amount_off": 30, + "is_dynamic": false + } + }, + "metadata": {} } + ], + "order": { + "amount": 2700, + "discount_amount": 490, + "items_discount_amount": 1700, + "total_discount_amount": 2190, + "total_amount": 510, + "applied_discount_amount": 490, + "items_applied_discount_amount": 1700, + "total_applied_discount_amount": 2190, + "items": [ + { + "object": "order_item", + "product_id": "prod_s3C0nDpr0DuC7", + "sku_id": "sku_0a3efc90375d1217e2", + "quantity": 1, + "amount": 2000, + "discount_amount": 1000, + "applied_discount_amount": 1000, + "price": 2000, + "subtotal_amount": 1000, + "product": { + "id": "prod_s3C0nDpr0DuC7", + "source_id": "test_prod_id_2", + "name": "Watchflix" + }, + "sku": { + "id": "sku_0a3efc90375d1217e2", + "source_id": "test_standard_ultra_hd", + "sku": "Premium", + "price": 2000 + } + }, + { + "object": "order_item", + "product_id": "prod_0bc3bd8a4e072c5275", + "quantity": 1, + "amount": 700, + "discount_amount": 700, + "applied_discount_amount": 700, + "price": 700, + "subtotal_amount": 0, + "product": { + "id": "prod_0bc3bd8a4e072c5275", + "name": "Bouquet - Romantic Roses", + "price": 700 + } + } + ], + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" }, - "stock": 1, - "redeemed": 1, - "attributes": { - "description": "Product" - }, - "created_at": "2022-06-13T10:43:15.929621+00:00", - "updated_at": "2022-08-11T15:59:30.820937+00:00", - "metadata": null, - "object": "reward" + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "session": { + "key": "ssn_pkJfPcWAgp9WyHpA62Eky8X8SzxpKub2", + "type": "LOCK", + "ttl": 7, + "ttl_unit": "DAYS" + } + } + } + } + } + } + }, + "400": { + "description": "Returns an error if the payload is missing an `\"object\"` or `\"id\"` property in the redeemables array, if you add more than one promotion stack or attempt to join stacks with vouchers/promotion tiers.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_400_invalid_payload" + }, + "examples": { + "Invalid payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Property .redeemables[1] should have required property 'id'", + "request_id": "v-0b4ff38ab8c8164573" + } + }, + "Duplicated Redeemables": { + "value": { + "code": 400, + "key": "duplicated_redeemables", + "message": "Duplicated redeemables detected", + "details": "Duplicated redeemables detected in one redemption", + "request_id": "v-0b4ffecfb408165300" + } + }, + "Invalid Redeemables": { + "value": { + "code": 400, + "key": "invalid_redeemables", + "message": "Invalid redeemables", + "details": "Promotion Stack cannot be use with other redeemables", + "request_id": "v-0b5007812f48165d6b" + } + } + } + } + } + } + } + } + }, + "/client/v1/validations": { + "post": { + "operationId": "validate-stacked-discounts-client-side", + "tags": [ + "STACKABLE DISCOUNTS API" + ], + "summary": "Validate Stackable Discounts (client-side)", + "description": "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.", + "parameters": [ + { + "$ref": "#/components/parameters/origin" + } + ], + "security": [ + { + "X-Client-Application-Id-1": [], + "X-Client-Token-1": [] + } + ], + "requestBody": { + "description": "## Expanded Response \n\nResponses will vary depending on the strings passed in the `options.expand` string array. You can customize the response by using one of the following combinations of strings. \n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
- Order data with calculated discounts are listed in each child redeemable object.
- Metadata _not_ included for each discount type. |\n| [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. |\n| [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
- Includes `metadata` for each discount type. |\n| [\"category\"] | - Returns an expanded `categories` object, showing details about the category. |", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/19_req_validations" + }, + "examples": { + "1 Redeemable": { + "value": { + "customer": { + "source_id": "sample_customer", + "metadata": { + "key": "value" + } + }, + "options": { + "expand": [ + "order", + "redeemable", + "category" + ] + }, + "redeemables": [ + { + "object": "voucher", + "id": "voucher-code" + } + ], + "session": { + "type": "LOCK" + }, + "order": { + "amount": 55000, + "status": "PAID", + "items": [ + { + "quantity": 2, + "price": 20000, + "source_id": "sample product1", + "related_object": "product", + "product": { + "metadata": { + "key": "value" + } + } + }, + { + "quantity": 1, + "price": 15000, + "source_id": "sample product2", + "related_object": "product", + "product": { + "metadata": { + "key": "value" + } + } + } + ], + "metadata": { + "key": "value" + } + } + } + }, + "5 Redeemables": { + "value": { + "customer": { + "source_id": "36_bob" }, - "assignment": { - "id": "rewa_SV4gMgPXTXDrsoTyqhY1B2ut", - "reward_id": "rew_Dev2yQLodRV33UKPKHTUQWk1", - "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 4000 - } - }, - "created_at": "2022-08-11T14:13:34.581194+00:00", - "updated_at": null, - "object": "reward_assignment" + "options": { + "expand": [ + "order", + "redeemable", + "category" + ] }, - "object": "loyalty_reward" - }, - { - "reward": { - "id": "rew_oQEYtUNYcVe2IdBEUBdLfkCD", - "name": "Get a comic book", - "type": "MATERIAL", - "parameters": { - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "sku_id": null + "redeemables": [ + { + "object": "voucher", + "id": "GNcuPKGe" + }, + { + "object": "voucher", + "id": "AnsvocvP", + "reward": { + "id": "rew_EPx1hCTpqzF0HW1z9NKckZH4" } }, - "stock": 1, - "redeemed": 2, - "attributes": { - "image_url": "https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_fPH9ohe0pZf4EiIt295sk9Ob.png", - "description": "Archie's Series" + { + "object": "voucher", + "id": "M3X8IwW8", + "gift": { + "credits": 100 + } }, - "created_at": "2022-08-11T14:35:44.694611+00:00", - "updated_at": "2022-08-17T07:52:56.965366+00:00", - "metadata": { - "Type": "GR-2" + { + "object": "promotion_tier", + "id": "promo_DE1N30D731Tg2F6NoMwNas2W" }, - "object": "reward" + { + "object": "promotion_tier", + "id": "promo_NDHgTg4VnOLYNjk9r7WOmQxf" + } + ], + "session": { + "type": "LOCK" }, - "assignment": { - "id": "rewa_7HHH6TjN7Q9WDr5ZePeZUg5p", - "reward_id": "rew_oQEYtUNYcVe2IdBEUBdLfkCD", - "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 10 + "order": { + "items": [ + { + "sku_id": "sku_0a3efc90375d1217e2", + "quantity": 1 + }, + { + "product_id": "prod_0bc3bd8a4e072c5275", + "quantity": 1 } - }, - "created_at": "2022-08-11T15:44:12.789086+00:00", - "updated_at": null, - "object": "reward_assignment" - }, - "object": "loyalty_reward" + ] + } } - ], - "total": 5 + } + } + } + } + }, + "responses": { + "200": { + "description": "All codes and tiers provided in redeemables are validated during the request and the result of their validation is returned in the API response. \n\n| **Response** | **Description** |\n|:---|:---|\n| valid
`boolean` | If **all** redeemables can be applied in the given context, the API returns `true`. Otherwise, if at least one redeemable can't be applied, the API returns `false`. |\n| redeemables
`array of objects` | The `redeemables` array lists the validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"` |\n| order
`object` | The `order` object presents details of the order provided in the request after all discounts are applied. |\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/19_res_validations" + } + } + } + }, + "400": { + "description": "Returns an error if the payload is missing an `\"object\"` or `\"id\"` property in the redeemables array, if you add more than one promotion stack or attempt to join stacks with vouchers/promotion tiers.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_400_invalid_payload" + }, + "examples": { + "Invalid payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Property .redeemables[1] should have required property 'id'", + "request_id": "v-0b4ff38ab8c8164573" + } + }, + "Duplicated Redeemables": { + "value": { + "code": 400, + "key": "duplicated_redeemables", + "message": "Duplicated redeemables detected", + "details": "Duplicated redeemables detected in one redemption", + "request_id": "v-0b4ffecfb408165300" + } + }, + "Invalid Redeemables": { + "value": { + "code": 400, + "key": "invalid_redeemables", + "message": "Invalid redeemables", + "details": "Promotion Stack cannot be use with other redeemables", + "request_id": "v-0b5007812f48165d6b" + } + } + } } } } } } - } - } - } - }, - "/v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " - }, - { - "schema": { - "type": "string", - "example": "rewa_hzc19a5NLyIr2bVL3UB1w0B3" }, - "name": "assignmentId", - "in": "path", - "required": true, - "description": "Unique reward assignment ID." - } - ], - "get": { - "operationId": "get-reward-details", - "tags": [ - "LOYALTIES API" - ], - "summary": "Get Reward Details", - "description": "Get reward details in the context of a loyalty campaign and reward assignment ID.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns reward details in the context of a loyalty *campaign* and reward assignment ID.", - "content": { - "application/json": { + "/v1/redemptions/{parentRedemptionId}/rollbacks": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/LoyaltiesGetRewardDetailsResponseBody" - }, - "examples": { - "Material": { - "value": { - "id": "rew_Dev2yQLodRV33UKPKHTUQWk1", - "name": "Get a product", - "type": "MATERIAL", - "parameters": { - "product": { - "id": "prod_0b2ac1dab28985cb1e", - "sku_id": null - } - }, - "stock": "1", - "redeemed": "1", - "attributes": { - "description": "Product" - }, - "created_at": "2022-06-13T10:43:15.929Z", - "updated_at": "2022-08-11T15:59:30.820Z", - "metadata": null, - "object": "reward" - } - }, - "Pay with Points": { - "value": { - "id": "rew_31M6Za6zkMRfhxYJz4aDo11h", - "name": "Pay with Points", - "type": "COIN", - "parameters": { - "coin": { - "exchange_ratio": 1, - "points_ratio": 1 - } - }, - "stock": null, - "redeemed": null, - "attributes": {}, - "created_at": "2022-06-23T11:06:06.222Z", - "updated_at": null, - "metadata": null, - "object": "reward" + "type": "string" + }, + "name": "parentRedemptionId", + "in": "path", + "required": true, + "description": "Unique identifier of a parent redemption, e.g. `r_JQfm73zWSJFQxs3bGxweYjgm`." + } + ], + "post": { + "operationId": "rollback-stacked-redemptions", + "tags": [ + "STACKABLE DISCOUNTS API" + ], + "summary": "Rollback Stackable Redemptions", + "description": "Rollback a stackable redemption. When you rollback a stacked redemption, all child redemptions will be rolled back. Provide the parent redemption ID as the path parameter.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns an array with the individual redemption rollback results along with the parent rollback result and related order.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/19_res_redemptions_parentRedemptionId_rollbacks" + } } - }, - "Discount Coupon": { - "value": { - "id": "rew_Jhq0ecLGSx8eF4pFdlhFr9P6", - "name": "20% discount", - "type": "CAMPAIGN", - "parameters": { - "campaign": { - "id": "camp_4B1jDE63pCeSij3HU7gx3gPT", - "type": "DISCOUNT_COUPONS" - } + } + }, + "400": { + "description": "Returns an error indicating that the parent redemption ID is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" }, - "stock": null, - "redeemed": null, - "attributes": {}, - "created_at": "2022-08-11T09:52:39.032Z", - "updated_at": null, - "metadata": {}, - "object": "reward" + "examples": { + "Invalid Redemption Parent": { + "value": { + "code": 400, + "key": "invalid_redemption_parent", + "message": "Invalid redemption parent", + "details": "You can rollback only a redemption that does not have parent redemption.", + "request_id": "v-0b56a1cf1e4d69b375" + } + }, + "Already rolled back": { + "value": { + "code": 400, + "key": "already_rolled_back", + "message": "Already rolled back", + "details": "Redemption has been already rolled back.", + "request_id": "v-0c67af9544c4e3388f", + "resource_id": "rrf_0c67af954e039be56b", + "resource_type": "redemption_rollback" + } + } + } } } } } } - } - } - } - }, - "/v1/loyalties/{campaignId}/reward-assignments": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " - } - ], - "get": { - "operationId": "list-reward-assignments-1", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Reward Assignments", - "description": "Returns reward assignments from a given loyalty campaign.\n\n> 📘 Alternative endpoint\n>\n> This endpoint is an alternative to this [endpoint](ref:list-reward-assignments-2). The URL was re-designed to be more ontextual to the type of data returned in the response.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" }, - { - "$ref": "#/components/parameters/page" + "/v1/loyalty-campaign-object": { + "get": { + "operationId": "loyalty-campaign-object", + "tags": [ + "LOYALTIES API" + ], + "summary": "Loyalty Campaign Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Loyalty Campaign Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_loyalty_campaign_object" + } + } + } + } + } + } }, - { - "schema": { - "type": "string", - "example": "rewa_m9hEAu10KsPcLhGXiHG85aY0" - }, - "in": "query", - "name": "assignmentId", - "description": "A unique reward assignment ID." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary with reward assignment objects.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_list_reward_assignments" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "rewa_2EPffrq151ArmjR7j3CumxGE", - "reward_id": "rew_6uCtsIjgcuzi4NW43mKZQWd5", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 18 - } - }, - "created_at": "2022-06-22T11:02:19.564Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_75e6oBjYfIKUDbM4Dsgg6xAU", - "reward_id": "rew_gI4GYbXMeHAJUAIiZCad5LaS", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 25 - } - }, - "created_at": "2022-06-22T11:00:49.034Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_dJ5nFBpmL8DVhmY1j4zYYOqF", - "reward_id": "rew_VSi5rNvb67bn2tqkNwVBBP7u", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 100 - } - }, - "created_at": "2022-06-22T10:57:24.051Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_874iVl5bHrZFr2FSsG9ilKzF", - "reward_id": "rew_QQ73sIywuMoEj6L8K6ft2Mn7", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", - "related_object_type": "campaign", - "created_at": "2022-06-22T10:47:55.934Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_GgSlEk4bnR09lMMts6CgR6aV", - "reward_id": "rew_URQeO2fgbjxHnulgYVguuidX", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 9 - } - }, - "created_at": "2022-06-22T10:21:53.109Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_i6VcsXr3ovJ2JCpZk9k1JOj1", - "reward_id": "rew_YNr7tRr9TPAiFEJBZBAsuKCq", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", - "related_object_type": "campaign", - "created_at": "2022-06-22T10:18:27.684Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_YjTw2InYSVx1nA88brDASS9e", - "reward_id": "rew_BUfchmIo7pOR8GrZMw0vVL08", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 30 - } - }, - "created_at": "2022-06-22T09:58:12.133Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_1gJ6VyYQI0IcnEvhArbr9XFH", - "reward_id": "rew_injbwG52POgfpSogTlQl4hA6", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 10 - } - }, - "created_at": "2022-06-13T11:56:49.185Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_gb6U5byuRh12EvdiL46P4Cxy", - "reward_id": "rew_NQB7WbdQLBrFQW1DZmBNcLvH", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 100 - } - }, - "created_at": "2022-06-13T11:50:23.429Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_hfyF9IGez9i3z5a3Uwlkcg7S", - "reward_id": "rew_87ItIc9P5Bky10eS7vEm7Dc7", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 20 - } - }, - "created_at": "2022-06-13T11:20:43.961Z", - "updated_at": null, - "object": "reward_assignment" - } - ], - "total": 12 + "/v1/loyalty-card-object": { + "get": { + "operationId": "loyalty-card-object", + "tags": [ + "LOYALTIES API" + ], + "summary": "Loyalty Card Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Loyalty Card Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_loyalty_card_object_non_expanded_categories" + } } } } } } - } - } - } - }, - "/v1/loyalties/{campaignId}/rewards": { - "parameters": [ - { - "schema": { - "type": "string" }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " - } - ], - "get": { - "operationId": "list-reward-assignments-2", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Reward Assignments", - "description": "Returns active rewards from a given loyalty campaign.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" + "/v1/loyalty-tier-object": { + "get": { + "operationId": "loyalty-tier-object", + "tags": [ + "LOYALTIES API" + ], + "summary": "Loyalty Tier Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Loyalty Tier Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_loyalty_tier_object" + } + } + } + } + } + } }, - { - "$ref": "#/components/parameters/page" + "/v1/earning-object": { + "get": { + "operationId": "earning-rule-object", + "tags": [ + "LOYALTIES API" + ], + "summary": "Earning Rule Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Earning Rule Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_earning_rule_object" + } + } + } + } + } + } }, - { - "schema": { - "type": "string", - "example": "rewa_m9hEAu10KsPcLhGXiHG85aY0" + "/v1/loyalties": { + "get": { + "operationId": "list-loyalty-programs", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Loyalty Campaigns", + "description": "Returns a list of your loyalty campaigns.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + }, + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with loyalty program objects. The loyalty campaigns are returned sorted by creation date, with the most recent campaigns appearing first.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_list_loyalty_campaigns" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "campaigns", + "campaigns": [ + { + "id": "camp_eTIsUtuzkRXQT6rsUQqrS5Gw", + "name": "Loyalty Campaign 1", + "campaign_type": "LOYALTY_PROGRAM", + "type": "AUTO_UPDATE", + "voucher": { + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 0 + }, + "redemption": { + "quantity": null + }, + "code_config": { + "length": 8, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "########" + }, + "is_referral_code": false + }, + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": true, + "description": "This is a campaign description.", + "vouchers_count": 6, + "active": true, + "metadata": { + "Season": "Fall" + }, + "created_at": "2022-11-21T13:57:03.712Z", + "updated_at": "2022-11-23T09:59:49.581Z", + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "category_id": "cat_0b6152ce12414820dc", + "categories": [], + "object": "campaign" + }, + { + "id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "name": "Loyalty Campaign - Tiers", + "campaign_type": "LOYALTY_PROGRAM", + "type": "AUTO_UPDATE", + "voucher": { + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 0 + }, + "redemption": { + "quantity": null + }, + "code_config": { + "length": 8, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "########", + "prefix": "LT1-", + "initial_count": 1 + }, + "is_referral_code": false, + "start_date": "2022-11-01T00:00:00.000Z" + }, + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": true, + "start_date": "2022-11-01T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "vouchers_count": 3, + "active": true, + "metadata": {}, + "created_at": "2022-11-09T06:26:52.985Z", + "updated_at": "2022-11-10T08:54:46.136Z", + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "category_id": "cat_0b8b5a427a0283c854", + "categories": [], + "loyalty_tiers_expiration": { + "qualification_type": "BALANCE", + "start_date": { + "type": "IMMEDIATE" + }, + "expiration_date": { + "type": "CUSTOM", + "extend": "P3M", + "rounding": { + "type": "MONTH", + "strategy": "END" + } + } + }, + "object": "campaign" + }, + { + "id": "camp_NwO6D0Z0mpZ1CDc380DnPgrW", + "name": "Loyalty Campaign Example", + "campaign_type": "LOYALTY_PROGRAM", + "type": "STATIC", + "voucher": { + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 0 + }, + "redemption": { + "quantity": null + }, + "code_config": { + "length": 8, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "########", + "initial_count": 1 + }, + "is_referral_code": false, + "start_date": "2021-12-15T00:00:00.000Z", + "expiration_date": "2021-12-31T00:00:00.000Z", + "validity_timeframe": { + "interval": "P1D", + "duration": "PT1H" + } + }, + "auto_join": true, + "join_once": true, + "use_voucher_metadata_schema": true, + "start_date": "2021-12-15T00:00:00.000Z", + "expiration_date": "2021-12-31T00:00:00.000Z", + "validity_timeframe": { + "interval": "P1D", + "duration": "PT1H" + }, + "validity_day_of_week": [ + 3, + 4, + 5, + 6 + ], + "activity_duration_after_publishing": "P24D", + "vouchers_count": 0, + "active": false, + "metadata": {}, + "created_at": "2021-12-15T08:02:52.298Z", + "updated_at": "2021-12-15T08:11:43.808Z", + "creation_status": "DRAFT", + "vouchers_generation_status": "DRAFT", + "protected": false, + "category_id": null, + "categories": [], + "object": "campaign" + } + ], + "total": 3 + } + } + } + } + } + } + } }, - "in": "query", - "name": "assignment_id", - "description": "A unique reward assignment ID." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary with reward assignment objects.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_list_reward_assignments" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "rewa_6VSWcXjfm5PuZlfeuZxl5JZT", - "reward_id": "rew_pjJKIZgjIopIPZyibEAt7oPk", - "related_object_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "related_object_type": "campaign", - "created_at": "2022-08-30T08:24:32.171Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_7gFZsNg8oiry63FtzML0N52R", - "reward_id": "rew_BUfchmIo7pOR8GrZMw0vVL08", - "related_object_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 3000000 - } + "post": { + "operationId": "create-loyalty-program", + "tags": [ + "LOYALTIES API" + ], + "summary": "Create Loyalty Campaign", + "description": "Creates a batch of [loyalty cards](ref:get-member) aggregated in a single loyalty campaign. It also allows you to define a custom codes pattern. \n\n\n> 📘 Global uniqueness\n> All codes are unique across the whole project. Voucherify won't allow to generate the same codes in any of your campaigns.\n\n\n> 🚧 Asyncronous action!\n>\n> This is an asynchronous action, you can't read or modify a newly created campaign until the code generation is completed. See `creation_status` field in the [loyalty campaign object](ref:get-loyalty-program) description.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the loyalty campaign details.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_create_loyalty_cards" + }, + "examples": { + "Example": { + "value": { + "name": "Loyalty Program 4", + "description": "This is a campaign description.", + "auto_join": true, + "join_once": true, + "use_voucher_metadata_schema": true, + "start_date": "2016-10-26T00:00:00Z", + "expiration_date": "2024-10-26T00:00:00Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" }, - "created_at": "2022-05-13T11:14:58.146Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_eAGhQSY4FS4T3q4zMkiarHoN", - "reward_id": "rew_nIy4gHpQHle2c3pNMwuj7G6j", - "related_object_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 100 + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "activity_duration_after_publishing": "P24D", + "category_id": "cat_0b6152ce12414820dc", + "vouchers_count": 2, + "voucher": { + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 0, + "expiration_rules": { + "period_type": "MONTH", + "period_value": 3, + "rounding_type": "END_OF_QUARTER" + } + }, + "redemption": { + "quantity": 2 + }, + "code_config": { + "pattern": "L-CARD-#######" } }, - "created_at": "2022-02-28T11:56:55.241Z", - "updated_at": null, - "object": "reward_assignment" + "metadata": { + "test": true + }, + "type": "STATIC", + "loyalty_tiers_expiration": { + "qualification_type": "BALANCE", + "start_date": { + "type": "IMMEDIATE" + }, + "expiration_date": { + "type": "CUSTOM", + "extend": "P3M", + "rounding": { + "type": "MONTH", + "strategy": "END" + } + } + } } - ], - "total": 3 + } } } } - } - } - } - } - }, - "post": { - "operationId": "create-reward-assignment-1", - "tags": [ - "LOYALTIES API" - ], - "summary": "Create Reward Assignment", - "description": "Add rewards to a loyalty campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a list of reward assignment objects.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_create_reward_assignment" - }, - "examples": { - "Example": { - "value": [ - { - "id": "rewa_Iw9VopmlLm0topBG17ZH1gp5", - "reward_id": "rew_wg2pvCr5LDhCq4uVQZ9LhuZm", - "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 2 - } - }, - "created_at": "2022-11-28T18:54:19.747Z", - "updated_at": null, - "object": "reward_assignment" + }, + "responses": { + "200": { + "description": "Returns a campaign object with its settings but without the loyalty card codes.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_loyalty_campaign_object" }, - { - "id": "rewa_tAFZ7cHiTwZyOg1QaWHt6yYv", - "reward_id": "rew_z35ffKoH0tCcck8EL56p6SIs", - "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 2 + "examples": { + "Example": { + "value": { + "id": "camp_wGlqXtnHddb39DvHuuhvvbxi", + "name": "Loyalty Program 4", + "campaign_type": "LOYALTY_PROGRAM", + "type": "STATIC", + "voucher": { + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 0, + "expiration_rules": { + "period_type": "MONTH", + "period_value": 3, + "rounding_type": "END_OF_QUARTER" + } + }, + "redemption": { + "quantity": 2 + }, + "code_config": { + "length": 7, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "L-CARD-#######" + }, + "is_referral_code": false, + "start_date": "2016-10-26T00:00:00.000Z", + "expiration_date": "2024-10-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P1D", + "duration": "PT1H" + } + }, + "auto_join": true, + "join_once": true, + "use_voucher_metadata_schema": true, + "description": "This is a campaign description.", + "start_date": "2016-10-26T00:00:00.000Z", + "expiration_date": "2024-10-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P1D", + "duration": "PT1H" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "activity_duration_after_publishing": "P24D", + "vouchers_count": 0, + "active": true, + "metadata": { + "test": true + }, + "created_at": "2022-11-29T13:10:30.848Z", + "category": "New Customers", + "creation_status": "IN_PROGRESS", + "vouchers_generation_status": "IN_PROGRESS", + "protected": false, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "category_id": "cat_0b6152ce12414820dc", + "categories": [ + { + "id": "cat_0b6152ce12414820dc", + "name": "New Customers", + "hierarchy": 0, + "created_at": "2022-07-14T20:17:07.657Z", + "object": "category" + } + ], + "loyalty_tiers_expiration": { + "qualification_type": "BALANCE", + "start_date": { + "type": "IMMEDIATE" + }, + "expiration_date": { + "type": "CUSTOM", + "extend": "P3M", + "rounding": { + "type": "MONTH", + "strategy": "END" + } + } + }, + "object": "campaign" } - }, - "created_at": "2022-11-28T18:54:19.747Z", - "updated_at": null, - "object": "reward_assignment" + } } - ] + } + } + }, + "409": { + "description": "Returns an error if a loyalty campaign with the same name already exists.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": {} + }, + "examples": { + "Example": { + "value": { + "code": 409, + "key": "duplicate_found", + "message": "Duplicated resource found", + "details": "Duplicated campaign exists with name Loyalty Program 2", + "request_id": "v-0c12951ec58e67577e", + "resource_id": "Loyalty Program 2", + "resource_type": "campaign" + } + } + } + } } } } } }, - "409": { - "description": "Returns an error if there's a reward assignment created for the given reward.", - "content": { - "application/json": { + "/v1/loyalties/{campaignId}": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" + "type": "string", + "example": "camp_0dJG7cCAjquzcxWmZ634bA0C" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " + } + ], + "get": { + "operationId": "get-loyalty-program", + "tags": [ + "LOYALTIES API" + ], + "summary": "Get Loyalty Campaign", + "description": "Retrieve a specific loyalty campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a loyalty campaign object for a given loyalty campaign ID. ", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_loyalty_campaign_object" + }, + "examples": { + "Example": { + "value": { + "id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "name": "Loyalty Campaign - Tiers - 1", + "campaign_type": "LOYALTY_PROGRAM", + "type": "AUTO_UPDATE", + "voucher": { + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 0 + }, + "redemption": { + "quantity": null + }, + "code_config": { + "length": 8, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "########", + "prefix": "LT1-", + "initial_count": 1 + }, + "is_referral_code": false, + "start_date": "2022-11-01T00:00:00.000Z" + }, + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": true, + "start_date": "2022-11-01T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "vouchers_count": 3, + "active": true, + "metadata": {}, + "created_at": "2022-11-09T06:26:52.985Z", + "updated_at": "2022-11-10T08:54:46.136Z", + "category": "Eighth", + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "category_id": "cat_0b8b5a427a0283c854", + "categories": [ + { + "id": "cat_0b8b5a427a0283c854", + "name": "Eighth", + "hierarchy": 8, + "created_at": "2022-08-16T11:45:54.171Z", + "object": "category" + } + ], + "loyalty_tiers_expiration": { + "qualification_type": "BALANCE", + "start_date": { + "type": "IMMEDIATE" + }, + "expiration_date": { + "type": "CUSTOM", + "extend": "P3M", + "rounding": { + "type": "MONTH", + "strategy": "END" + } + } + }, + "object": "campaign" + } + } + } + } + } }, - "examples": { - "Example": { - "value": { - "code": 409, - "key": "duplicate_found", - "message": "Duplicated resource found", - "details": "Duplicated reward_assignment exists with id rewa_50O40FgyojhUiZAs3vDQbKiC", - "request_id": "v-0c11a10ed2ce676da9", - "resource_id": "rewa_50O40FgyojhUiZAs3vDQbKiC", - "resource_type": "reward_assignment" + "404": { + "description": "Returns an error if the campaign does not exist or has been deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + } } } } } - } - } - }, - "requestBody": { - "description": "Define the cost of the rewards in loyalty points.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_create_reward_assignment" - }, - "examples": { - "Example": { - "value": [ - { - "reward": "rew_wg2pvCr5LDhCq4uVQZ9LhuZm", - "parameters": { - "loyalty": { - "points": 2 + }, + "put": { + "operationId": "update-loyalty-program", + "tags": [ + "LOYALTIES API" + ], + "summary": "Update Loyalty Campaign", + "description": "Updates a loyalty program. \n\nFields other than those specified in the allowed request body payload won't be modified (even if provided they are silently skipped). Any parameters not provided will be left unchanged. \n\nThis method will update the [loyalty cards](ref:get-member) which have not been published or redeemed yet.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the new values for the parameters that you would like to update for the given loyalty campaign.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_update_loyalty_campaign" + }, + "examples": { + "Example": { + "value": { + "description": "This is a campaign description. Updated", + "auto_join": false, + "join_once": false, + "start_date": "2013-10-26T00:00:00Z", + "expiration_date": "2025-10-26T00:00:00Z", + "validity_timeframe": { + "duration": "PT2H", + "interval": "P2D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6 + ], + "activity_duration_after_publishing": "P25D", + "category_id": "cat_0b6152ce12414820dd", + "loyalty_card": { + "points": 1, + "expiration_rules": { + "period_type": "MONTH", + "period_value": 4, + "rounding_type": "END_OF_YEAR" + } + }, + "metadata": { + "test": false + }, + "type": "AUTO_UPDATE", + "loyalty_tiers_expiration": { + "qualification_type": "BALANCE", + "start_date": { + "type": "IMMEDIATE" + }, + "expiration_date": { + "type": "CUSTOM", + "extend": "P4M", + "rounding": { + "type": "CUSTOM", + "unit": "MONTH", + "value": 1 + } + } + } } } - }, - { - "reward": "rew_z35ffKoH0tCcck8EL56p6SIs", - "parameters": { - "loyalty": { - "points": 2 + } + } + } + }, + "responses": { + "200": { + "description": "Returns the loyalty campaign object if the update succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_loyalty_campaign_object" + }, + "examples": { + "Example": { + "value": { + "id": "camp_wGlqXtnHddb39DvHuuhvvbxi", + "name": "Loyalty Program 4", + "campaign_type": "LOYALTY_PROGRAM", + "type": "AUTO_UPDATE", + "voucher": { + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 1, + "expiration_rules": { + "period_type": "MONTH", + "period_value": 4, + "rounding_type": "END_OF_YEAR" + } + }, + "redemption": { + "quantity": 2 + }, + "code_config": { + "length": 7, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "L-CARD-#######" + }, + "is_referral_code": false, + "start_date": "2013-10-26T00:00:00.000Z", + "expiration_date": "2025-10-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "PT2H" + } + }, + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": true, + "description": "This is a campaign description. Updated", + "start_date": "2013-10-26T00:00:00.000Z", + "expiration_date": "2025-10-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "PT2H" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6 + ], + "activity_duration_after_publishing": "P25D", + "vouchers_count": 2, + "active": true, + "metadata": { + "test": false + }, + "created_at": "2022-11-29T13:10:30.848Z", + "updated_at": "2022-11-29T14:08:30.655Z", + "category": "Lorem_Ipsum", + "creation_status": "MODIFYING", + "vouchers_generation_status": "MODIFYING", + "protected": false, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "category_id": "cat_0b6152ce12414820dd", + "categories": [ + { + "id": "cat_0b6152ce12414820dd", + "name": "Lorem_Ipsum", + "hierarchy": 0, + "created_at": "2022-07-14T20:17:07.657Z", + "object": "category" + } + ], + "loyalty_tiers_expiration": { + "qualification_type": "BALANCE", + "start_date": { + "type": "IMMEDIATE" + }, + "expiration_date": { + "type": "CUSTOM", + "extend": "P4M", + "rounding": { + "type": "CUSTOM", + "strategy": "END", + "unit": "MONTH", + "value": 1 + } + } + }, + "object": "campaign" + } } } } - ] + } } } - } - } - } - } - }, - "/v1/loyalties/{campaignId}/reward-assignments/{assignmentId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " - }, - { - "schema": { - "type": "string", - "example": "rewa_hzc19a5NLyIr2bVL3UB1w0B3" - }, - "name": "assignmentId", - "in": "path", - "required": true, - "description": "Unique reward assignment ID." - } - ], - "get": { - "operationId": "get-reward-assignment-1", - "tags": [ - "LOYALTIES API" - ], - "summary": "Get Reward Assignment", - "description": "Retrieve specific reward assignment.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns specific reward assignment.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoyaltiesGetRewardAssignmentResponseBody" - }, - "examples": { - "Example": { - "value": { - "id": "rewa_1gJ6VyYQI0IcnEvhArbr9XFH", - "reward_id": "rew_injbwG52POgfpSogTlQl4hA6", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 10 + }, + "delete": { + "operationId": "delete-loyalty-program", + "tags": [ + "LOYALTIES API" + ], + "summary": "Delete Loyalty Campaign", + "description": "This method permanently deletes a loyalty campaign and all related loyalty cards. This action cannot be undone. Also, it immediately removes any redemptions on loyalty cards.", + "parameters": [ + { + "schema": { + "type": "boolean" + }, + "in": "query", + "name": "force", + "description": "If this flag is set to `true`, the campaign and related vouchers will be removed permanently. Going forward, the user will be able to create the next campaign with the same name." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns the id of the scheduled asynchronous action, informing you that your request has been accepted and the loyalty campaign will be deleted from the repository asynchronously. To check the deletion status and result, copy the `async_action_id` from the response and pass it using [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" + }, + "examples": { + "Example": { + "value": { + "async_action_id": "aa_0a875d56c805df6601" + } } - }, - "created_at": "2022-06-13T11:56:49.185Z", - "updated_at": null, - "object": "reward_assignment" + } } } - } - } - } - } - } - } - }, - "/v1/loyalties/{campaignId}/rewards/{assignmentId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_0dJG7cCAjquzcxWmZ634bA0C" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " - }, - { - "schema": { - "type": "string", - "example": "rewa_1gJ6VyYQI0IcnEvhArbr9XFH" - }, - "name": "assignmentId", - "in": "path", - "required": true, - "description": "A unique reward assignment ID." - } - ], - "get": { - "operationId": "get-reward-assignment-2", - "tags": [ - "LOYALTIES API" - ], - "summary": "Get Reward Assignment", - "description": "Retrieve specific reward assignment.\n\n> 📘 Alternative endpoint\n>\n> This endpoint is an alternative to this [endpoint](ref:get-reward-assignment-2). ", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns specific reward assignment.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" }, - "examples": { - "Example": { - "value": { - "id": "rewa_1gJ6VyYQI0IcnEvhArbr9XFH", - "reward_id": "rew_injbwG52POgfpSogTlQl4hA6", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 10 + "404": { + "description": "Returns an error indicating that the loyalty campaign with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Loyalty Campaign Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id Summer Loyalty Perks", + "request_id": "v-0ae2b0092f50c130c7", + "resource_id": "Summer Loyalty Perks", + "resource_type": "campaign" + } } - }, - "created_at": "2022-06-13T11:56:49.185Z", - "updated_at": null, - "object": "reward_assignment" + } } } } } } }, - "404": { - "description": "Returns an error if the reward assignment cannot be found.", - "content": { - "application/json": { + "/v1/loyalties/{campaignId}/members": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_404_not_found" + "type": "string" }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find reward_assignment with id rewa_1gJ6VyYQI0IcnEvhArbr9XFH", - "request_id": "v-0c0be6ee648e67609b", - "resource_id": "rewa_1gJ6VyYQI0IcnEvhArbr9XFH", - "resource_type": "reward_assignment" - } - } - } + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID of the loyalty program." } - } - } - } - }, - "put": { - "operationId": "update-reward-assignment-1", - "tags": [ - "LOYALTIES API" - ], - "summary": "Update Reward Assignment", - "description": "Updates rewards parameters, i.e. the points cost for the specific reward.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a reward assignment with an updated points value.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" + ], + "get": { + "operationId": "list-members", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Members", + "description": "Returns a list of your loyalty cards. The loyalty cards are sorted by creation date, with the most recent loyalty cards appearing first.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" }, - "examples": { - "Example": { - "value": { - "id": "rewa_Iw9VopmlLm0topBG17ZH1gp5", - "reward_id": "rew_wg2pvCr5LDhCq4uVQZ9LhuZm", - "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 3 - } - }, - "created_at": "2022-11-28T18:54:19.747Z", - "updated_at": "2022-11-28T19:27:40.604Z", - "object": "reward_assignment" - } - } + { + "$ref": "#/components/parameters/page" + }, + { + "$ref": "#/components/parameters/created_at" + }, + { + "$ref": "#/components/parameters/updated_at" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + }, + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." } - } - } - } - }, - "requestBody": { - "description": "Update the points cost for the reward assignment.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_update_reward_assignment" - }, - "examples": { - "Example": { - "value": { - "parameters": { - "loyalty": { - "points": 3 + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of loyalty cards within a campaign.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_list_members" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "vouchers", + "vouchers": [ + { + "id": "v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655", + "code": "0PmQ7JQI", + "campaign": "Loyalty Campaign", + "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "category": null, + "category_id": null, + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 0, + "balance": 0 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX19RtPewWeUYb2hiCR6xEhVE3SLdMfCXj3BA/s6uqSwFl2oAKAt9K5dolsdcZcj5Jgaa/YCnKkm63TRuX6OgGJoEggbKMg+wLfCMwBSi4J2v8KXuyqM25wP4r9WAL58Z+z3B1jkALIbjtw==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19RtPewWeUYb2hiCR6xEhVE3SLdMfCXj3BA%2Fs6uqSwFl2oAKAt9K5dolsdcZcj5Jgaa%2FYCnKkm63TRuX6OgGJoEggbKMg%2BwLfCMwBSi4J2v8KXuyqM25wP4r9WAL58Z%2Bz3B1jkALIbjtw%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+hrRfaPMHRRX5aGVz2RpurRBjC2brcHcptPs4Od93qZM51vUXZe4DDzfRbnVrP+BfBtF+pyyQpxCeqbQuB/OuSnP/nzec6n0n/gTb9+XcIYLvvxcbnDbYoVdRFQEbcCxKKo4QzDlqIjQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BhrRfaPMHRRX5aGVz2RpurRBjC2brcHcptPs4Od93qZM51vUXZe4DDzfRbnVrP%2BBfBtF%2BpyyQpxCeqbQuB%2FOuSnP%2Fnzec6n0n%2FgTb9%2BXcIYLvvxcbnDbYoVdRFQEbcCxKKo4QzDlqIjQ%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-04-15T05:48:45.509Z", + "updated_at": "2022-07-01T00:01:57.860Z", + "holder_id": "cust_nk0N1uNQ1YnupAoJGOgvsODC", + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "redeemed_points": 0, + "object": "list", + "url": "/v1/vouchers/0PmQ7JQI/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/0PmQ7JQI/publications?page=1&limit=10" + }, + "object": "voucher" + }, + { + "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", + "code": "MmFAzfDe", + "campaign": "Loyalty Campaign", + "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "category": null, + "category_id": "cat_0b6152ce12414820de", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 13435, + "balance": 13135, + "next_expiration_date": "2022-11-30", + "next_expiration_points": 12 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX184kVdWUO/msrLg1G0MRf/Cs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk/dXm/QEJ/sulXKDlUMWf+MN7TRG5LB+wuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX184kVdWUO%2FmsrLg1G0MRf%2FCs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk%2FdXm%2FQEJ%2FsulXKDlUMWf%2BMN7TRG5LB%2BwuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/RGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW/cXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FRGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW%2FcXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-18T14:03:59.954Z", + "updated_at": "2022-11-21T13:49:54.949Z", + "holder_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "redeemed_points": 300, + "object": "list", + "url": "/v1/vouchers/MmFAzfDe/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/MmFAzfDe/publications?page=1&limit=10" + }, + "object": "voucher" + } + ], + "total": 2 + } + } } } } } } - } - } - } - }, - "delete": { - "operationId": "delete-reward-assignment-1", - "tags": [ - "LOYALTIES API" - ], - "summary": "Delete Reward Assignment", - "description": "This method deletes a reward assignment for a particular loyalty campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." - }, - "404": { - "description": "Returns an error indicating that the loyalty campaign or reward assignment with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Reward Assignment Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find reward_assignment with id rewa_0b4hqJpVFssxXXrq56Ddtyo", - "request_id": "v-0ae2b69e0cd0c1364f", - "resource_id": "rewa_0b4hqJpVFssxXXrq56Ddtyo", - "resource_type": "reward_assignment" - } - }, - "Loyalty Campaign Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id Loyalty Summer Campaign", - "request_id": "v-0ae2b71e57d027e263", - "resource_id": "Loyalty Summer Campaign", - "resource_type": "campaign" - } - } + }, + "post": { + "operationId": "add-member", + "tags": [ + "LOYALTIES API" + ], + "summary": "Add Member", + "description": "This method assigns a loyalty card to a customer. It selects a [loyalty card](ref:get-voucher) suitable for publication, adds a publish entry, and returns the published voucher. \n\nA voucher is suitable for publication when it's active and hasn't been published yet. \n\n\n> 📘 Auto-update campaign\n>\n> In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use **auto-update** campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] } - } - } - } - } - } - }, - "/v1/loyalties/{campaignId}/members/{memberId}/redemption": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID." - }, - { - "schema": { - "type": "string" - }, - "name": "memberId", - "in": "path", - "required": true, - "description": "A code that identifies the loyalty card." - } - ], - "post": { - "operationId": "redeem-reward-1", - "tags": [ - "LOYALTIES API" - ], - "summary": "Redeem Reward", - "description": "Exchange points from a loyalty card for a specified reward. This API method returns an assigned award in the response. It means that if a requesting customer gets a coupon code with a discount for the next order, that discount code will be visible in response as part of the reward object definition.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a redemption object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_redeem_reward" - }, - "examples": { - "Redeem Reward that adds points to a loyalty card": { - "value": { - "id": "r_0c6b3abbfe8e60a9dd", - "object": "redemption", - "date": "2023-02-06T09:07:55.514Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 1, - "result": "SUCCESS", - "order": null, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 8000, - "balance": 6887 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-11-10T06:28:59.970Z", - "updated_at": "2023-02-06T09:07:55.515Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "holder": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", + ], + "requestBody": { + "description": "Provide details to whom the loyalty card should be assigned. \n\nYou can choose to either specify the exact loyalty card code that you want to publish from existin (non-assigned) codes, or choose not to specify a voucher code. If you choose not to specify a code in the request paylaod, then the system will choose the next available voucher code available to be assigned to a customer. \n\nYou can also include metadata in the request payload. This metadata will be assigned to the publication object, but will not be returned in the response to this endpoint. To see of publications (assignments of particular codes to customers) and publication metadata, use the [List Publications](ref:list-publications) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_add_member" + }, + "examples": { + "Using source ID": { + "value": { + "customer": "source_customer_1", "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" + "year": 2022 }, - "object": "customer" - }, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 9, - "redeemed_points": 1113, - "object": "list", - "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" + "channel": "postman", + "voucher": "KpzbHUY5" } }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", + "Using unique Voucherify assigned ID": { + "value": { + "customer": "cust_8KQmHxAERpgebYcFhSpZRr37", "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_BpytIepuSekuXXwb9qkLJfCU", - "voucher": { - "id": "v_pQZDYaH8LzoOvgh3234DqZQjGJgbPov6", - "code": "LOYALTY-CARD-zOR2sV9Q", - "campaign": "Loyalty Program", - "campaign_id": "camp_Hpt5hPTA8kSKRWGxBGw8Y0So", - "category": null, - "category_id": null, - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 1020, - "balance": 890 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/THRRj1QegAan0r5U+wRoHuFEA6FR7TrvZm8N+8cK7niF/8uAqFdVYTU1JD0/CdoSXlYqiGgz3PAFOGWFSJt8vkM50fcMtMNLsaudU+YrPDeT2HCB7o0Ts7h1FnbD85+0F7lwrbKmkGW6kub0mjCaRdJYS/axIAq4=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FTHRRj1QegAan0r5U%2BwRoHuFEA6FR7TrvZm8N%2B8cK7niF%2F8uAqFdVYTU1JD0%2FCdoSXlYqiGgz3PAFOGWFSJt8vkM50fcMtMNLsaudU%2BYrPDeT2HCB7o0Ts7h1FnbD85%2B0F7lwrbKmkGW6kub0mjCaRdJYS%2FaxIAq4%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+yREd0zRAfZY9uwtMZsl4eDd8+LeiKGVI5OzOQRpjhtV91IuEe7/SXEW8m4F2Llg2//yieX2zsP3UtWasWxw8ZkHMRSIdxfxzSdSj8ap0dI5xwKW4OE1Q6Sgsb+kZVfCKUHbwXCcd8y5a6xTpVIg97y74Ng1Vg2PY=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2ByREd0zRAfZY9uwtMZsl4eDd8%2BLeiKGVI5OzOQRpjhtV91IuEe7%2FSXEW8m4F2Llg2%2F%2FyieX2zsP3UtWasWxw8ZkHMRSIdxfxzSdSj8ap0dI5xwKW4OE1Q6Sgsb%2BkZVfCKUHbwXCcd8y5a6xTpVIg97y74Ng1Vg2PY%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-07-11T08:19:28.780Z", - "updated_at": "2023-01-25T15:44:33.500Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "redemption": { - "quantity": null, - "redeemed_quantity": 26, - "redeemed_points": 130, - "object": "list", - "url": "/v1/vouchers/LOYALTY-CARD-zOR2sV9Q/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/LOYALTY-CARD-zOR2sV9Q/publications?page=1&limit=10" + "year": 2022 }, - "object": "voucher" - }, - "id": "rew_7ZM476Q77dH5KvHk4KzoRNvF", - "object": "reward", - "name": "Present on Loyalty Card", - "created_at": "2023-01-25T15:43:40.716Z", - "updated_at": null, - "parameters": { - "campaign": { - "id": "camp_Hpt5hPTA8kSKRWGxBGw8Y0So", - "balance": 20, - "type": "LOYALTY_PROGRAM" - } - }, - "type": "CAMPAIGN" + "channel": "postman", + "voucher": "KpzbHUY5" + } }, - "loyalty_card": { - "points": 1 - } - } - }, - "Redeem Reward that adds credits to a gift card": { - "value": { - "id": "r_0c6b3bedf3478a0167", - "object": "redemption", - "date": "2023-02-06T09:13:08.813Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 1, - "result": "SUCCESS", - "order": null, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 8000, - "balance": 6886 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" + "Using source ID in object": { + "value": { + "customer": { + "source_id": "source_customer_1" }, - "barcode": { - "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-11-10T06:28:59.970Z", - "updated_at": "2023-02-06T09:13:08.814Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "holder": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" + "year": 2022 }, - "object": "customer" - }, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 10, - "redeemed_points": 1114, - "object": "list", - "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" + "channel": "postman", + "voucher": "KpzbHUY5" } }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_U554pL2BhDIDZOvZ8y9YQ9hA", - "voucher": { - "id": "v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk", - "code": "GIFT-CARD-xwc6X7Tk", - "campaign": "Gift Cards", - "campaign_id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "GIFT_VOUCHER", - "discount": null, - "gift": { - "amount": 59080, - "balance": 48780 - }, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM/aTyHCYfr7kRWb2vv08WIgY/Tv53SJGW+k2keqfsTq/Ohb5shkCN3FTFsaI8gulTp616sEGn/JJoIInIoNkO9Vd1+AfrKiAjmirCmekE6cz2SVCyNAXs=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM%2FaTyHCYfr7kRWb2vv08WIgY%2FTv53SJGW%2Bk2keqfsTq%2FOhb5shkCN3FTFsaI8gulTp616sEGn%2FJJoIInIoNkO9Vd1%2BAfrKiAjmirCmekE6cz2SVCyNAXs%3D" - }, - "barcode": { - "id": "U2FsdGVkX18vWc/qplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO/199U+zicnFNWqg/jF5ZCQW+6jO1q8=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18vWc%2FqplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO%2F199U%2BzicnFNWqg%2FjF5ZCQW%2B6jO1q8%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-07-08T09:44:33.179Z", - "updated_at": "2023-01-25T14:42:25.214Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "redemption": { - "quantity": null, - "redeemed_quantity": 7, - "redeemed_amount": 10300, - "object": "list", - "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/publications?page=1&limit=10" - }, - "object": "voucher" - }, - "id": "rew_6bvM4vnaVdbPVQxYpuN37rhH", - "object": "reward", - "name": "Present Credits on Gift Card", - "created_at": "2023-01-25T14:41:31.858Z", - "updated_at": null, - "parameters": { - "campaign": { - "id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", - "balance": 4000, - "type": "GIFT_VOUCHERS" - } - }, - "type": "CAMPAIGN" - }, - "loyalty_card": { - "points": 1 - } - } - }, - "Redeem Reward that gives a discount coupon": { - "value": { - "id": "r_0c6b3ca77e0e60b534", - "object": "redemption", - "date": "2023-02-06T09:16:18.808Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 2, - "result": "SUCCESS", - "order": null, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 8000, - "balance": 6884 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" + "Using unique Voucherify assigned ID in object": { + "value": { + "customer": { + "id": "cust_8KQmHxAERpgebYcFhSpZRr37" }, - "barcode": { - "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-11-10T06:28:59.970Z", - "updated_at": "2023-02-06T09:16:18.809Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "holder": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" + "year": 2022 }, - "object": "customer" - }, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 11, - "redeemed_points": 1116, - "object": "list", - "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" + "channel": "postman", + "voucher": "KpzbHUY5" } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns the voucher object that was published to the customer provided in the request payload.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_loyalty_card_object" }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" + "examples": { + "Loyalty Card": { + "value": { + "id": "v_0TxKw1bm0oZuS5lwA8526vze1OBMV1OH", + "code": "KpzbHUY5", + "campaign": "Loyalty Campaign", + "campaign_id": "camp_eTIsUtuzkRXQT6rsUQqrS5Gw", + "category": "New Customers", + "category_id": "cat_0b6152ce12414820dc", + "categories": [ + { + "id": "cat_0b6152ce12414820dc", + "name": "New Customers", + "hierarchy": 0, + "created_at": "2022-07-14T20:17:07.657Z", + "object": "category" + } ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_0ZwLAHgeU9IrI2V1ofYRmW7g", - "voucher": { - "id": "v_a3Ba1neDwPa3rBE0HkDd0C7CbiehBulo", - "code": "HAPPY-ORDERctb", - "campaign": "$20 off the entire order", - "campaign_id": "camp_5h0wc453_4", - "category": null, - "category_id": "cat_0b688929a2476386a6", - "categories": [], - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 2000, - "effect": "APPLY_TO_ORDER" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2022-09-20T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "7d646e7d-9b5a-40b6-a44e-6bae848e108e", - "url": "https://dl.voucherify.io/api/v1/assets/qr/7d646e7d-9b5a-40b6-a44e-6bae848e108e" - }, - "barcode": { - "id": "dfb3e48d-ce4f-4187-a114-483feb4ca88d", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/dfb3e48d-ce4f-4187-a114-483feb4ca88d" - } - }, - "is_referral_code": false, - "created_at": "2023-02-06T09:16:18.845Z", - "updated_at": null, - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/HAPPY-ORDERctb/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/HAPPY-ORDERctb/publications?page=1&limit=10" - }, - "object": "voucher" - }, - "id": "rew_MF4hKh1IKYgJkPjbcFbH94Ho", - "object": "reward", - "name": "Digital Present", - "created_at": "2023-01-25T12:16:44.557Z", - "updated_at": null, - "parameters": { - "campaign": { - "id": "camp_5h0wc453_4", - "type": "DISCOUNT_COUPONS" + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 0, + "balance": 0 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": { + "Season": "Fall" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX1+hdZfzUaz448vIsyf7WpvXiDyqFbyw0+P5wMu12w3B5DyYwA7LCSK+Nr7TA7PKGuHOTGxfBieqrhvJo81HiaIJimDOhk+ecEOisMRmHf6XsNckVlyBHmkpBiXWNm8UDwZnXOAG75Usdw==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BhdZfzUaz448vIsyf7WpvXiDyqFbyw0%2BP5wMu12w3B5DyYwA7LCSK%2BNr7TA7PKGuHOTGxfBieqrhvJo81HiaIJimDOhk%2BecEOisMRmHf6XsNckVlyBHmkpBiXWNm8UDwZnXOAG75Usdw%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX19VRXApVvZ9/ArwBd0wNg7s2KZBXrFvPXZdDQyzGj0HbbEIx5TAoXNR9zaE5kzIj9BElzgK82aOMMVnc1sqvr93xw+YeYMnqGqHRZfM78pYC8560Zc3U6IELtxzaJJ0x2uDUe6Dc9XYeg==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19VRXApVvZ9%2FArwBd0wNg7s2KZBXrFvPXZdDQyzGj0HbbEIx5TAoXNR9zaE5kzIj9BElzgK82aOMMVnc1sqvr93xw%2BYeYMnqGqHRZfM78pYC8560Zc3U6IELtxzaJJ0x2uDUe6Dc9XYeg%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-11-21T15:48:57.860Z", + "updated_at": "2022-11-21T15:49:36.671Z", + "holder_id": "cust_8KQmHxAERpgebYcFhSpZRr37", + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "redeemed_points": 0, + "object": "list", + "url": "/v1/vouchers/KpzbHUY5/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/KpzbHUY5/publications?page=1&limit=10" + }, + "object": "voucher" } - }, - "type": "CAMPAIGN" - }, - "loyalty_card": { - "points": 2 + } } } - }, - "Redeem a Material reward of a SKU type": { - "value": { - "id": "r_0c6b3d1357878a0813", - "object": "redemption", - "date": "2023-02-06T09:18:09.246Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 6, - "result": "SUCCESS", - "order": null, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 8000, - "balance": 6878 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" + } + }, + "400": { + "description": "Returns an error.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "No Voucher Suitable for Publication": { + "value": { + "code": 400, + "key": "no_voucher_suitable_for_publication", + "message": "Couldn't find any voucher suitable for publication", + "details": "Couldn't create new vouchers for publication", + "request_id": "v-0c086598620e6704dd" } }, - "is_referral_code": false, - "created_at": "2022-11-10T06:28:59.970Z", - "updated_at": "2023-02-06T09:18:09.247Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "holder": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 12, - "redeemed_points": 1122, - "object": "list", - "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" + "Voucher already published": { + "value": { + "code": 400, + "key": "voucher_already_published", + "message": "Voucher already published", + "details": "Voucher 'v_ZFjKHQD0d56eMkWkrotJaVbiMuXClRuM' has already been published", + "request_id": "v-0c086aaa7dc24ccfe0" + } } - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_gfpRNkOT0pwzF7P5tXWXOs4H", - "product": { - "id": "prod_5h0wc453_2", - "source_id": "jonah-nystrom-bourbon", - "name": "Johan & Nyström - Bourbon", - "price": null, - "attributes": [ - "categories", - "description", - "weight" - ], - "metadata": { - "company": "Johan & Nyström", - "showcase": true - }, - "image_url": null, - "created_at": "2021-12-01T08:00:49.418Z", - "updated_at": null, - "object": "product" - }, - "sku": { - "id": "sku_0a3efc9044dd121803", - "source_id": "jonah-nystrom-bourbon-250g", - "product_id": "prod_5h0wc453_2", - "sku": "250g", - "price": 1750, - "currency": null, - "attributes": { - "categories": "Coffee, Whole Bean", - "description": "Background for this blend comes from the longing for a real dark roasting of high-quality coffee beans. Although the beans are dark roasted, they keep their clear and intense aroma. This coffee has a smoky flavour with a slight hint of sweetness and loads of fruit notes. Thanks to the experience in the dark roasting of coffee, the beans still retain most of their aromas. Its aftertaste is clear and remains for a long time. This coffee is perfect for a Dripper, French Press, Moka coffee maker and the traditional espresso brewing method.", - "weight": 250 - }, - "image_url": null, - "metadata": {}, - "created_at": "2021-12-01T08:00:49.427Z", - "updated_at": null, - "object": "sku" - }, - "id": "rew_SfQCsap5R8UBTVbdMTRx10x8", - "object": "reward", - "name": "Present - SKU", - "created_at": "2023-01-25T12:10:16.060Z", - "updated_at": "2023-01-25T12:10:59.662Z", - "parameters": { - "product": { - "id": "prod_5h0wc453_2", - "sku_id": "sku_0a3efc9044dd121803" + } + } + } + }, + "404": { + "description": "Returns an error if the voucher code that was specified in the request payload is not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id Loyalty_Card", + "request_id": "v-0c086a26de424ccf2f", + "resource_id": "Loyalty_Card", + "resource_type": "voucher" } - }, - "type": "MATERIAL" - }, - "loyalty_card": { - "points": 6 + } } } - }, - "Redeem a Material Reward of a Product Type": { - "value": { - "id": "r_0c6b3d8c35546f8673", - "object": "redemption", - "date": "2023-02-06T09:20:13.013Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 4, - "result": "SUCCESS", - "order": null, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@voucherify.io", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 8000, - "balance": 6874 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" + } + } + } + } + }, + "/v1/loyalties/{campaignId}/members/{memberId}": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID." + }, + { + "schema": { + "type": "string" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "Unique code that identifies the loyalty card." + } + ], + "get": { + "operationId": "get-member-1", + "tags": [ + "LOYALTIES API" + ], + "summary": "Get Member", + "description": "Retrieves the loyalty card with the given member ID (i.e. voucher code).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns loyalty card details.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_loyalty_card_object_non_expanded_categories" + }, + "examples": { + "Loyalty Card": { + "value": { + "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", + "code": "MmFAzfDe", + "campaign": "Loyalty Program", + "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "category": null, + "category_id": "cat_0b6152ce12414820de", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 13435, + "balance": 13135, + "next_expiration_date": "2022-11-30", + "next_expiration_points": 12 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX184kVdWUO/msrLg1G0MRf/Cs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk/dXm/QEJ/sulXKDlUMWf+MN7TRG5LB+wuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX184kVdWUO%2FmsrLg1G0MRf%2FCs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk%2FdXm%2FQEJ%2FsulXKDlUMWf%2BMN7TRG5LB%2BwuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/RGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW/cXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FRGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW%2FcXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-18T14:03:59.954Z", + "updated_at": "2022-11-21T13:49:54.949Z", + "holder_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "redeemed_points": 300, + "object": "list", + "url": "/v1/vouchers/MmFAzfDe/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/MmFAzfDe/publications?page=1&limit=10" + }, + "object": "voucher" } - }, - "is_referral_code": false, - "created_at": "2022-11-10T06:28:59.970Z", - "updated_at": "2023-02-06T09:20:13.014Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "holder": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 13, - "redeemed_points": 1126, - "object": "list", - "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" } - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@voucherify.io", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_LRx3Y1iHFWTt217NVrknkpi5", - "product": { - "id": "prod_0b2c2ddf35150b83bb", - "source_id": "97", - "name": "[Sample] Tiered Wire Basket", - "price": 11995, - "attributes": [], - "metadata": { - "source": "bigcommerce", - "bigcommerce_product_categories": [ - 21, - 23 - ] - }, - "image_url": null, - "created_at": "2022-06-03T13:36:16.084Z", - "updated_at": "2022-06-07T09:10:44.644Z", - "object": "product" - }, - "id": "rew_EPx1hCTpqzF0HW1z9NKckZH4", - "object": "reward", - "name": "Present", - "created_at": "2022-06-13T06:59:01.694Z", - "updated_at": "2023-02-03T15:04:14.102Z", - "parameters": { - "product": { - "id": "prod_0b2c2ddf35150b83bb", - "sku_id": null + } + } + } + } + } + } + }, + "/v1/loyalties/members/{memberId}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "MmFAzfDe" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "Unique loyalty card code assigned to a particular customer." + } + ], + "get": { + "operationId": "get-member", + "tags": [ + "LOYALTIES API" + ], + "summary": "Get Member", + "description": "Retrieve loyalty card with the given member ID (i.e. voucher code). \n\n\n> 📘 Alternative endpoint\n> This endpoint is an alternative to this [endpoint](ref:get-member-1). The URL was re-designed to allow you to retrieve loyalty card details without having to provide the `campaignId` as a path parameter.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns loyalty card details.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_loyalty_card_object_non_expanded_categories" + }, + "examples": { + "Loyalty Card": { + "value": { + "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", + "code": "MmFAzfDe", + "campaign": "Loyalty Program", + "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "category": null, + "category_id": "cat_0b6152ce12414820de", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 13435, + "balance": 13135, + "next_expiration_date": "2022-11-30", + "next_expiration_points": 12 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX184kVdWUO/msrLg1G0MRf/Cs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk/dXm/QEJ/sulXKDlUMWf+MN7TRG5LB+wuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX184kVdWUO%2FmsrLg1G0MRf%2FCs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk%2FdXm%2FQEJ%2FsulXKDlUMWf%2BMN7TRG5LB%2BwuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/RGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW/cXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FRGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW%2FcXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-18T14:03:59.954Z", + "updated_at": "2022-11-21T13:49:54.949Z", + "holder_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "redeemed_points": 300, + "object": "list", + "url": "/v1/vouchers/MmFAzfDe/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/MmFAzfDe/publications?page=1&limit=10" + }, + "object": "voucher" } - }, - "type": "MATERIAL" - }, - "loyalty_card": { - "points": 4 + } + } + } + } + } + } + } + }, + "/v1/loyalties/{campaignId}/members/{memberId}/activities": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID." + }, + { + "schema": { + "type": "string" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "A code that identifies the loyalty card." + } + ], + "get": { + "operationId": "get-member-activities-1", + "tags": [ + "LOYALTIES API" + ], + "summary": "Get Member Activities", + "description": "Retrieves the list of activities for the given member ID related to voucher and customer who is a holder of the voucher.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of event objects related to the loyalty card.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_get_member_activities" + } + } + } + } + } + } + }, + "/v1/loyalties/members/{memberId}/activities": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "MmFAzfDe" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "Unique loyalty card assigned to a particular customer." + } + ], + "get": { + "operationId": "get-member-activities", + "tags": [ + "LOYALTIES API" + ], + "summary": "Get Member Activities", + "description": "Retrieves a list of activities for the given loyalty card related to the loyalty and customer who is the holder of the loyalty card.\n\n\n> 📘 Alternative endpoint\n> This endpoint is an alternative to this [endpoint](ref:get-member-activities-1). The URL was re-designed to allow you to get member activities without having to provide the `campaignId` as a path parameter.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of event objects related to the loyalty card.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_get_member_activities" } } - }, - "Redeem Pay with Points Reward": { - "value": { - "id": "r_0c6b4142ecc78a21d0", - "object": "redemption", - "date": "2023-02-06T09:36:26.547Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 2300, - "result": "SUCCESS", - "order": { - "id": "ord_QBnrJlVWA2EEiZoKOptFROnp", - "source_id": null, - "created_at": "2023-02-06T09:36:26.503Z", - "updated_at": null, - "status": "PAID", - "amount": 45000, - "discount_amount": 45000, - "total_discount_amount": 45000, - "total_amount": 0, - "applied_discount_amount": 45000, - "total_applied_discount_amount": 45000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0c5d6689b39320059b", - "quantity": 1, - "product": { - "id": "prod_0c5d6689b39320059b", - "source_id": "prod_anJ03RZZq74z4v", - "name": "Apple iPhone 8" - } - }, - { - "object": "order_item", - "product_id": "prod_0b2c36568000039138", - "quantity": 2, - "amount": 45000, - "price": 22500, - "subtotal_amount": 45000, - "product": { - "id": "prod_0b2c36568000039138", - "source_id": "86", - "name": "[Sample] Able Brewing System", - "price": 22500 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c6b4142ecc78a21d0": { - "date": "2023-02-06T09:36:26.547Z", - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" - } + } + } + } + } + }, + "/v1/loyalties/{campaignId}/members/{memberId}/balance": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_7s3uXI44aKfIk5IhmeOPr6ic" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID." + }, + { + "schema": { + "type": "string", + "example": "MmFAzfDe" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "A code that identifies the loyalty card." + } + ], + "post": { + "operationId": "add-remove-loyalty-card-balance-1", + "tags": [ + "LOYALTIES API" + ], + "summary": "Add or Remove Loyalty Card Balance", + "description": "This method adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the point adjustment along with the expiration mechanism.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_add_remove_points_balance" + }, + "examples": { + "Add points": { + "value": { + "points": 100, + "expiration_type": "CUSTOM_DATE", + "expiration_date": "2023-05-30" } }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 8000, - "balance": 4574 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-11-10T06:28:59.970Z", - "updated_at": "2023-02-06T09:36:26.548Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "holder": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 14, - "redeemed_points": 3426, - "object": "list", - "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" + "Deduct points": { + "value": { + "points": -100 } - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", - "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "object": "reward", - "name": "100 = $20", - "created_at": "2022-11-10T06:28:39.582Z", - "updated_at": null, - "parameters": { - "coin": { - "exchange_ratio": 20, - "points_ratio": 100 - } - }, - "type": "COIN" - }, - "loyalty_card": { - "points": 2300 } } - }, - "Redeem Pay with Points Reward with a specific amount of points": { - "value": { - "id": "r_0c6b423368146fa4bb", - "object": "redemption", - "date": "2023-02-06T09:40:32.800Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 100, - "result": "SUCCESS", - "order": { - "id": "ord_1L67XS8EYDDp5A4B3k62G2tr", - "source_id": null, - "created_at": "2023-02-06T09:40:32.784Z", - "updated_at": null, - "status": "PAID", - "amount": 45000, - "discount_amount": 2000, - "total_discount_amount": 2000, - "total_amount": 43000, - "applied_discount_amount": 2000, - "total_applied_discount_amount": 2000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0c5d6689b39320059b", - "quantity": 1, - "product": { - "id": "prod_0c5d6689b39320059b", - "source_id": "prod_anJ03RZZq74z4v", - "name": "Apple iPhone 8" - } - }, - { - "object": "order_item", - "product_id": "prod_0b2c36568000039138", - "quantity": 2, - "amount": 45000, - "price": 22500, - "subtotal_amount": 45000, - "product": { - "id": "prod_0b2c36568000039138", - "source_id": "86", - "name": "[Sample] Able Brewing System", - "price": 22500 + } + } + }, + "responses": { + "200": { + "description": "Returns a balance object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_add_remove_points_balance" + }, + "examples": { + "Add balance": { + "value": { + "points": -100, + "total": 13436, + "balance": 13136, + "type": "loyalty_card", + "object": "balance", + "related_object": { + "type": "voucher", + "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF" } } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c6b423368146fa4bb": { - "date": "2023-02-06T09:40:32.800Z", - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + "Deduct balance": { + "value": { + "points": -100, + "total": 13436, + "balance": 13136, + "type": "loyalty_card", + "object": "balance", + "related_object": { + "type": "voucher", + "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF" + } } } + } + } + } + }, + "400": { + "description": "Returns an error if the expiration date was defined incorrectly in the request payload.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 8500, - "balance": 4974 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" + "examples": { + "Invalid expiration date": { + "value": { + "code": 400, + "key": "invalid_expiration_date", + "message": "Invalid Expiration Date", + "details": "Expiration date cannot be set in the past", + "request_id": "v-0c118b1611424ca899" } - }, - "is_referral_code": false, - "created_at": "2022-11-10T06:28:59.970Z", - "updated_at": "2023-02-06T09:40:32.801Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "holder": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 15, - "redeemed_points": 3526, - "object": "list", - "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" } - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", - "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "object": "reward", - "name": "100 = $20", - "created_at": "2022-11-10T06:28:39.582Z", - "updated_at": null, - "parameters": { - "coin": { - "exchange_ratio": 20, - "points_ratio": 100 - } - }, - "type": "COIN" - }, - "loyalty_card": { - "points": 100 } } } @@ -74305,301 +67782,229 @@ } } }, - "404": { - "description": "Returns an error if the campaign was not found.", - "content": { - "application/json": { + "/v1/loyalties/members/{memberId}/balance": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_404_not_found" + "type": "string", + "example": "MmFAzfDe" }, - "examples": { - "Campaign Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id :campaignId", - "request_id": "v-0c6b39288084e3435a", - "resource_id": ":campaignId", - "resource_type": "campaign" + "name": "memberId", + "in": "path", + "required": true, + "description": "Unique loyalty card assigned to a particular customer." + } + ], + "post": { + "operationId": "add-remove-loyalty-card-balance", + "tags": [ + "LOYALTIES API" + ], + "summary": "Add or Remove Loyalty Card Balance", + "description": "This method gives adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. \n\n\n> 📘 Alternative endpoint\n> This endpoint is an alternative to this [endpoint](ref:add-remove-loyalty-card-balance-1). The URL was re-designed to allow you to add or remove loyalty card balance without having to provide the `campaignId` as a path parameter.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the point adjustment along with the expiration mechanism.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_add_remove_points_balance" + }, + "examples": { + "Subtract points": { + "value": { + "points": -100 + } + }, + "Add Points": { + "value": { + "points": 100, + "expiration_type": "CUSTOM_DATE", + "expiration_date": "2023-05-30" + } + } } } } - } - } - } - }, - "requestBody": { - "description": "Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_redeem_reward" }, - "examples": { - "Pay with Points": { - "value": { - "reward": { - "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "points": 100 - }, - "order": { - "items": [ - { - "product_id": "prod_0c5d6689b39320059b", - "quantity": "1" - }, - { - "product_id": "prod_0b2c36568000039138", - "quantity": "2" + "responses": { + "200": { + "description": "Returns a balance object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_add_remove_points_balance" + }, + "examples": { + "Subtract Points": { + "value": { + "points": 100, + "total": 13436, + "balance": 13136, + "type": "loyalty_card", + "object": "balance", + "related_object": { + "type": "voucher", + "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF" + } + } } - ] + } + } + } + }, + "400": { + "description": "Returns an error if the expiration date was specified incorrectly in the request payload.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Invalid payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Property .expiration_date cannot be recognized as a ISO-8601 compliant date", + "request_id": "v-0c118c6f7c0e6751ab" + } + } + } } } } } } - } - } - } - }, - "/v1/loyalties/members/{memberId}/redemption": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "MmFAzfDe" }, - "name": "memberId", - "in": "path", - "required": true, - "description": "Unique loyalty card assigned to a particular customer." - } - ], - "post": { - "operationId": "redeem-reward", - "tags": [ - "LOYALTIES API" - ], - "summary": "Redeem Reward", - "description": "\n> 📘 Alternative endpoint\n>\n> This endpoint is an alternative to this [endpoint](ref:redeem-reward-1). The URL was re-designed to allow you to redeem a reward without having to provide the `campaignId` as a path parameter.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a redemption object.", - "content": { - "application/json": { + "/v1/loyalties/{campaignId}/members/{memberId}/transfers": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/8_res_redeem_reward" - }, - "examples": { - "Redeem Pay with Points Reward with a specific number of Points": { - "value": { - "id": "r_0c6b4bf721439bf02b", - "object": "redemption", - "date": "2023-02-06T10:23:12.517Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 100, - "result": "SUCCESS", - "order": { - "id": "ord_71Ayjxq2gFV80v3OP3qrxh37", - "source_id": null, - "created_at": "2023-02-06T10:23:12.485Z", - "updated_at": null, - "status": "PAID", - "amount": 45000, - "discount_amount": 2000, - "total_discount_amount": 2000, - "total_amount": 43000, - "applied_discount_amount": 2000, - "total_applied_discount_amount": 2000, - "items": [ + "type": "string" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination)." + }, + { + "schema": { + "type": "string" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination)." + } + ], + "post": { + "operationId": "transfer-points", + "tags": [ + "LOYALTIES API" + ], + "summary": "Transfer Loyalty Points", + "description": "Transfer points between different loyalty cards. You need to provide the campaign ID and the loyalty card ID you want the points to be transferred to as path parameters in the URL. In the request body, you provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_transfer_loyalty_points" + }, + "examples": { + "Example": { + "value": [ { - "object": "order_item", - "product_id": "prod_0c5d6689b39320059b", - "quantity": 1, - "product": { - "id": "prod_0c5d6689b39320059b", - "source_id": "prod_anJ03RZZq74z4v", - "name": "Apple iPhone 8" - } + "code": "0PmQ7JQI", + "points": 1 }, { - "object": "order_item", - "product_id": "prod_0b2c36568000039138", - "quantity": 2, - "amount": 45000, - "price": 22500, - "subtotal_amount": 45000, - "product": { - "id": "prod_0b2c36568000039138", - "source_id": "86", - "name": "[Sample] Able Brewing System", - "price": 22500 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c6b4bf721439bf02b": { - "date": "2023-02-06T10:23:12.517Z", - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + "code": "kCeufB8i", + "points": 1 } - } + ] + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a loyalty card object for the loaded loyalty card, ie. the one that that points were transferred to from the other cards(s).", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_loyalty_card_object_non_expanded_categories" }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 9000, - "balance": 5374 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" + "examples": { + "Example": { + "value": { + "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", + "code": "MmFAzfDe", + "campaign": "Proportional Earning Rules", + "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "category": null, + "category_id": "cat_0b6152ce12414820de", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 13441, + "balance": 13141, + "next_expiration_date": "2022-11-30", + "next_expiration_points": 0 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX184kVdWUO/msrLg1G0MRf/Cs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk/dXm/QEJ/sulXKDlUMWf+MN7TRG5LB+wuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX184kVdWUO%2FmsrLg1G0MRf%2FCs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk%2FdXm%2FQEJ%2FsulXKDlUMWf%2BMN7TRG5LB%2BwuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/RGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW/cXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FRGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW%2FcXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-18T14:03:59.954Z", + "updated_at": "2022-11-28T17:58:25.607Z", + "holder_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "redeemed_points": 300, + "object": "list", + "url": "/v1/vouchers/MmFAzfDe/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/MmFAzfDe/publications?page=1&limit=10" + }, + "object": "voucher" } - }, - "is_referral_code": false, - "created_at": "2022-11-10T06:28:59.970Z", - "updated_at": "2023-02-06T10:23:12.517Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "holder": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 16, - "redeemed_points": 3626, - "object": "list", - "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" } - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", - "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "object": "reward", - "name": "100 = $20", - "created_at": "2022-11-10T06:28:39.582Z", - "updated_at": null, - "parameters": { - "coin": { - "exchange_ratio": 20, - "points_ratio": 100 - } - }, - "type": "COIN" - }, - "loyalty_card": { - "points": 100 } } } @@ -74607,4303 +68012,8366 @@ } } }, - "400": { - "description": "Returns an error indicating that a reward is missing.", - "content": { - "application/json": { + "/v1/loyalties/{campaignId}/members/{memberId}/transactions": { + "parameters": [ + { "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/e_400_missing_reward" - }, - { - "$ref": "#/components/schemas/e_400_missing_order" - }, - { - "$ref": "#/components/schemas/e_400_loyalty_card_points_exceeded" + "type": "string" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return." + }, + { + "schema": { + "type": "string" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "A unique code identifying the loyalty card that you are looking to retrieve transaction data for." + } + ], + "get": { + "operationId": "list-loyalty-card-transactions-1", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Loyalty Card Transactions", + "description": "Retrieve transaction data related to point movements for a specific loyalty card.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary of loyalty card transaction objects.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_get_loyalty_card_transactions" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "vtx_0c9dd3c2e392f78613", + "source_id": "20230317_transfer_1", + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": "API", + "reason": "Transferring points to card", + "type": "POINTS_TRANSFER_OUT", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1396, + "object": "balance", + "points": -1, + "balance": 1396, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + }, + "destination_voucher": { + "id": "v_Wak6xlf5WdR4rIcvJxC2olOopk0boK6t", + "code": "LOYALTY-CARD-A8XVurg", + "type": "LOYALTY_CARD", + "campaign": "Loyalty Campaign - Test Initial Points", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "loyalty_card": { + "points": 1102, + "balance": 1102, + "next_expiration_date": "2023-12-31", + "next_expiration_points": 102 + }, + "is_referral_code": false + } + }, + "related_transaction_id": "vtx_0c9dd3c2e392f78614", + "created_at": "2023-03-17T16:20:33.807Z" + }, + { + "id": "vtx_0c9dd2527696ba081b", + "source_id": "20230317_add_1", + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": null, + "reason": "Adding points to card", + "type": "POINTS_ADDITION", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1397, + "object": "balance", + "points": 100, + "balance": 1397, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-17T16:14:16.524Z" + }, + { + "id": "vtx_0c9dd1ce1d403f4204", + "source_id": "20230317_subtract_1", + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": null, + "reason": "Subtracting points from card", + "type": "POINTS_REMOVAL", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1297, + "object": "balance", + "points": -1, + "balance": 1297, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-17T16:12:00.981Z" + }, + { + "id": "vtx_0c9c21df658d03ce3f", + "source_id": null, + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": "Automation", + "reason": null, + "type": "POINTS_ACCRUAL", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1298, + "object": "balance", + "points": 200, + "balance": 1298, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + }, + "order": { + "id": "ord_QZEKPzYATFjGoos4DonMg0fd", + "source_id": "s" + }, + "event": { + "id": "evcus_0c9c21def34e3c05bf", + "type": "customer.order.paid" + }, + "earning_rule": { + "id": "ern_2WsCIBEx6Lzf5IAV5IOR7a23", + "source": { + "banner": "Order paid" + } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-16T08:44:52.333Z" + }, + { + "id": "vtx_0c9b09673f8a862a51", + "source_id": null, + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": null, + "reason": null, + "type": "POINTS_REFUND", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1098, + "object": "balance", + "points": 1000, + "balance": 1098, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + }, + "order": { + "id": "ord_DH2gGDlDWB1hRImf1VVB4EIH", + "source_id": null + }, + "redemption": { + "id": "r_0c9b08fe4b80897849" + }, + "rollback": { + "id": "rr_0c9b0967244a862a33" + }, + "reward": { + "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "name": "100 = $20" + } + }, + "related_transaction_id": null, + "created_at": "2023-03-15T12:19:29.149Z" + }, + { + "id": "vtx_0c9b08fe530089785c", + "source_id": null, + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": null, + "reason": null, + "type": "POINTS_REDEMPTION", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1098, + "object": "balance", + "points": -1000, + "balance": 98, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + }, + "order": { + "id": "ord_DH2gGDlDWB1hRImf1VVB4EIH", + "source_id": null + }, + "redemption": { + "id": "r_0c9b08fe4b80897849" + }, + "reward": { + "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "name": "100 = $20" + } + }, + "related_transaction_id": null, + "created_at": "2023-03-15T12:17:41.708Z" + }, + { + "id": "vtx_0c9b074afed3b30e4b", + "source_id": "20230309_add_points_1", + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": "voucherify-web-ui", + "reason": "Customer purchased points at kiosk.", + "type": "POINTS_ADDITION", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1098, + "object": "balance", + "points": 100, + "balance": 1098, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-15T12:10:15.917Z" + }, + { + "id": "vtx_0c9b073072408969d1", + "source_id": "20230309_subtract_points_1", + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": "voucherify-web-ui", + "reason": "Customer used points to obtain tickets.", + "type": "POINTS_REMOVAL", + "details": { + "balance": { + "type": "loyalty_card", + "total": 998, + "object": "balance", + "points": -1, + "balance": 998, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-15T12:09:48.735Z" + }, + { + "id": "vtx_0c9afe802593b34b80", + "source_id": null, + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": "API", + "reason": null, + "type": "POINTS_TRANSFER_OUT", + "details": { + "balance": { + "type": "loyalty_card", + "total": 999, + "object": "balance", + "points": -1, + "balance": 999, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + }, + "destination_voucher": { + "id": "v_Wak6xlf5WdR4rIcvJxC2olOopk0boK6t", + "code": "LOYALTY-CARD-A8XVurg", + "type": "LOYALTY_CARD", + "campaign": "Loyalty Campaign - Test Initial Points", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "loyalty_card": { + "points": 1001, + "balance": 1001, + "next_expiration_date": "2023-12-31", + "next_expiration_points": 1 + }, + "is_referral_code": false + } + }, + "related_transaction_id": "vtx_0c9afe802593b34b81", + "created_at": "2023-03-15T11:31:51.062Z" + } + ], + "has_more": false + } + } + } } - ] + } } } } }, - "404": { - "description": "Returns an error indicating a resource was not found.", - "content": { - "application/json": { + "/v1/loyalties/members/{memberId}/transactions": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_404_not_found" + "type": "string" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "A unique code identifying the loyalty card that you are looking to retrieve transaction data for." + } + ], + "get": { + "operationId": "list-loyalty-card-transactions", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Loyalty Card Transactions", + "description": "Retrieve transaction data related to point movements for a specific loyalty card.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" }, - "examples": { - "Member Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id :memberId", - "request_id": "v-0c6b4b525d8e40cf3e", - "resource_id": ":memberId", - "resource_type": "voucher" + { + "$ref": "#/components/parameters/page" + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary of loyalty card transaction objects.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_get_loyalty_card_transactions" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "vtx_0c9dd3c2e392f78613", + "source_id": "20230317_transfer_1", + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": "API", + "reason": "Transferring points to card", + "type": "POINTS_TRANSFER_OUT", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1396, + "object": "balance", + "points": -1, + "balance": 1396, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + }, + "destination_voucher": { + "id": "v_Wak6xlf5WdR4rIcvJxC2olOopk0boK6t", + "code": "LOYALTY-CARD-A8XVurg", + "type": "LOYALTY_CARD", + "campaign": "Loyalty Campaign - Test Initial Points", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "loyalty_card": { + "points": 1102, + "balance": 1102, + "next_expiration_date": "2023-12-31", + "next_expiration_points": 102 + }, + "is_referral_code": false + } + }, + "related_transaction_id": "vtx_0c9dd3c2e392f78614", + "created_at": "2023-03-17T16:20:33.807Z" + }, + { + "id": "vtx_0c9dd2527696ba081b", + "source_id": "20230317_add_1", + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": null, + "reason": "Adding points to card", + "type": "POINTS_ADDITION", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1397, + "object": "balance", + "points": 100, + "balance": 1397, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-17T16:14:16.524Z" + }, + { + "id": "vtx_0c9dd1ce1d403f4204", + "source_id": "20230317_subtract_1", + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": null, + "reason": "Subtracting points from card", + "type": "POINTS_REMOVAL", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1297, + "object": "balance", + "points": -1, + "balance": 1297, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-17T16:12:00.981Z" + }, + { + "id": "vtx_0c9c21df658d03ce3f", + "source_id": null, + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": "Automation", + "reason": null, + "type": "POINTS_ACCRUAL", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1298, + "object": "balance", + "points": 200, + "balance": 1298, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + }, + "order": { + "id": "ord_QZEKPzYATFjGoos4DonMg0fd", + "source_id": "s" + }, + "event": { + "id": "evcus_0c9c21def34e3c05bf", + "type": "customer.order.paid" + }, + "earning_rule": { + "id": "ern_2WsCIBEx6Lzf5IAV5IOR7a23", + "source": { + "banner": "Order paid" + } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-16T08:44:52.333Z" + }, + { + "id": "vtx_0c9b09673f8a862a51", + "source_id": null, + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": null, + "reason": null, + "type": "POINTS_REFUND", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1098, + "object": "balance", + "points": 1000, + "balance": 1098, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + }, + "order": { + "id": "ord_DH2gGDlDWB1hRImf1VVB4EIH", + "source_id": null + }, + "redemption": { + "id": "r_0c9b08fe4b80897849" + }, + "rollback": { + "id": "rr_0c9b0967244a862a33" + }, + "reward": { + "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "name": "100 = $20" + } + }, + "related_transaction_id": null, + "created_at": "2023-03-15T12:19:29.149Z" + }, + { + "id": "vtx_0c9b08fe530089785c", + "source_id": null, + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": null, + "reason": null, + "type": "POINTS_REDEMPTION", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1098, + "object": "balance", + "points": -1000, + "balance": 98, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + }, + "order": { + "id": "ord_DH2gGDlDWB1hRImf1VVB4EIH", + "source_id": null + }, + "redemption": { + "id": "r_0c9b08fe4b80897849" + }, + "reward": { + "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "name": "100 = $20" + } + }, + "related_transaction_id": null, + "created_at": "2023-03-15T12:17:41.708Z" + }, + { + "id": "vtx_0c9b074afed3b30e4b", + "source_id": "20230309_add_points_1", + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": "voucherify-web-ui", + "reason": "Customer purchased points at kiosk.", + "type": "POINTS_ADDITION", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1098, + "object": "balance", + "points": 100, + "balance": 1098, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-15T12:10:15.917Z" + }, + { + "id": "vtx_0c9b073072408969d1", + "source_id": "20230309_subtract_points_1", + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": "voucherify-web-ui", + "reason": "Customer used points to obtain tickets.", + "type": "POINTS_REMOVAL", + "details": { + "balance": { + "type": "loyalty_card", + "total": 998, + "object": "balance", + "points": -1, + "balance": 998, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-15T12:09:48.735Z" + }, + { + "id": "vtx_0c9afe802593b34b80", + "source_id": null, + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": "API", + "reason": null, + "type": "POINTS_TRANSFER_OUT", + "details": { + "balance": { + "type": "loyalty_card", + "total": 999, + "object": "balance", + "points": -1, + "balance": 999, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + }, + "destination_voucher": { + "id": "v_Wak6xlf5WdR4rIcvJxC2olOopk0boK6t", + "code": "LOYALTY-CARD-A8XVurg", + "type": "LOYALTY_CARD", + "campaign": "Loyalty Campaign - Test Initial Points", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "loyalty_card": { + "points": 1001, + "balance": 1001, + "next_expiration_date": "2023-12-31", + "next_expiration_points": 1 + }, + "is_referral_code": false + } + }, + "related_transaction_id": "vtx_0c9afe802593b34b81", + "created_at": "2023-03-15T11:31:51.062Z" + } + ], + "has_more": false + } + } + } } } } } } - } - }, - "requestBody": { - "description": "Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_redeem_reward" - }, - "examples": { - "Pay with Points": { - "value": { - "reward": { - "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "points": 100 + }, + "/v1/loyalties/members/{memberId}/transactions/export": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "A unique code identifying the loyalty card that you are looking to export transaction data for." + } + ], + "post": { + "operationId": "export-loyalty-card-transactions", + "tags": [ + "LOYALTIES API" + ], + "summary": "Export Loyalty Card Transactions", + "description": "Export transactions that are associated with point movements on a loyalty card.\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID assigned by Voucherify. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `POINTS_EXPIRATION`
- `POINTS_ADDITION`
- `POINTS_REMOVAL`
- `POINTS_TRANSFER_OUT`
- `POINTS_ACCRUAL`
- `POINTS_REFUND`
- `POINTS_REDEMPTION` |\n| source_id | Custom source ID of the transaction if one was included originally. | source_id_custom |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The loyalty card balance after the transaction. | |\n| amount | The amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | - `API`
- `voucherify-web-ui`
- `Automation` |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n| related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the parameters and filters for the transaction export.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_create_loyalty_card_transactions_export" }, - "order": { - "items": [ - { - "product_id": "prod_0c5d6689b39320059b", - "quantity": "1" + "examples": { + "Example": { + "value": { + "parameters": { + "order": "-created_at", + "fields": [ + "id", + "type", + "source_id", + "reason", + "balance", + "amount", + "created_at", + "voucher_id", + "campaign_id", + "details", + "related_transaction_id" + ] + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns an export object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_export_transactions_object" + }, + "examples": { + "Example": { + "value": { + "id": "exp_8Fwd6Z8NS67ZH314KRtm5xXE", + "object": "export", + "created_at": "2023-03-21T13:50:43.286Z", + "status": "SCHEDULED", + "channel": "API", + "exported_object": "voucher_transactions", + "parameters": { + "order": "-created_at", + "fields": [ + "id", + "type", + "source_id", + "reason", + "balance", + "amount", + "created_at", + "voucher_id", + "campaign_id", + "details", + "related_transaction_id" + ], + "filters": { + "voucher_id": { + "conditions": { + "$in": [ + "LOYALTY-CARD-2IAoDNF" + ] + } + } + } + }, + "result": null, + "user_id": null + } }, - { - "product_id": "prod_0b2c36568000039138", - "quantity": "2" + "No request body": { + "value": { + "id": "exp_ExEE5A6OIK4tssuNswr5O6SU", + "object": "export", + "created_at": "2023-03-21T13:34:57.034Z", + "status": "SCHEDULED", + "channel": "API", + "exported_object": "voucher_transactions", + "parameters": { + "filters": { + "voucher_id": { + "conditions": { + "$in": [ + "HRwc0oHz" + ] + } + } + } + }, + "result": null, + "user_id": null + } } - ] + } + } + } + }, + "404": { + "description": "Returns an error if the voucher code does not exist or has been deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id IrKORhS", + "request_id": "v-0a96cd820301c0483a", + "resource_id": "IrKORhS", + "resource_type": "voucher" + } + } + } } } } } } - } - } - } - }, - "/v1/loyalties/{campaignId}/tiers": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique loyalty campaign ID or name." - } - ], - "get": { - "operationId": "list-loyalty-tiers", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Loyalty Tiers", - "description": "Retrieve a list of loyalty tiers which were added to the loyalty program.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" }, - { - "$ref": "#/components/parameters/page" - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ] - }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a list of loyalty tier objects.", - "content": { - "application/json": { + "/v1/loyalties/{campaignId}/members/{memberId}/transactions/export": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/LoyaltiesListTiersResponseBody" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "ltr_30KHciA0UG8B71Fo51GZqwgN", - "name": "Bottom", - "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "metadata": {}, - "created_at": "2022-11-10T12:20:52.755Z", - "updated_at": "2022-11-25T11:27:58.616Z", - "earning_rules": { - "ern_95aq3JaE5A8xzHjoJPYNRqXZ": { - "type": "MULTIPLY", - "multiplier": 1 - }, - "ern_raVUcdXruvXGuzm682ESrAzt": { - "type": "CUSTOM", - "points": 5 - } - }, - "rewards": { - "rewa_t88DnSdNnE0IzQX6gqH3jHGQ": { - "type": "MULTIPLY", - "multiplier": 4 - } - }, - "config": { - "points": { - "from": 1, - "to": 249 - } - }, - "points": { - "from": 1, - "to": 249 - }, - "object": "loyalty_tier" - }, - { - "id": "ltr_pudTGWasuIqxdiDM0go31OV1", - "name": "Middle", - "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "metadata": {}, - "created_at": "2022-11-10T12:20:52.755Z", - "updated_at": "2022-11-25T11:27:58.579Z", - "earning_rules": { - "ern_95aq3JaE5A8xzHjoJPYNRqXZ": { - "type": "MULTIPLY", - "multiplier": 2 - } - }, - "rewards": {}, - "config": { - "points": { - "from": 250, - "to": 499 - } - }, - "points": { - "from": 250, - "to": 499 - }, - "object": "loyalty_tier" + "type": "string" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export." + }, + { + "schema": { + "type": "string" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "A unique code identifying the loyalty card that you are looking to export transaction data for." + } + ], + "post": { + "operationId": "export-loyalty-card-transactions-1", + "tags": [ + "LOYALTIES API" + ], + "summary": "Export Loyalty Card Transactions", + "description": "Export transactions that are associated with point movements on a loyalty card.\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID assigned by Voucherify. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `POINTS_EXPIRATION`
- `POINTS_ADDITION`
- `POINTS_REMOVAL`
- `POINTS_TRANSFER_OUT`
- `POINTS_ACCRUAL`
- `POINTS_REFUND`
- `POINTS_REDEMPTION` |\n| source_id | Custom source ID of the transaction if one was included originally. | source_id_custom |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The loyalty card balance after the transaction. | |\n| amount | The amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | - `API`
- `voucherify-web-ui`
- `Automation` |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n| related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the parameters and filters for the transaction export.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_create_loyalty_card_transactions_export" + }, + "examples": { + "Example": { + "value": { + "parameters": { + "order": "-created_at", + "fields": [ + "id", + "type", + "source_id", + "reason", + "balance", + "amount", + "created_at", + "voucher_id", + "campaign_id", + "details", + "related_transaction_id" + ] + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns an export object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_export_transactions_object" + }, + "examples": { + "Example": { + "value": { + "id": "exp_8Fwd6Z8NS67ZH314KRtm5xXE", + "object": "export", + "created_at": "2023-03-21T13:50:43.286Z", + "status": "SCHEDULED", + "channel": "API", + "exported_object": "voucher_transactions", + "parameters": { + "order": "-created_at", + "fields": [ + "id", + "type", + "source_id", + "reason", + "balance", + "amount", + "created_at", + "voucher_id", + "campaign_id", + "details", + "related_transaction_id" + ], + "filters": { + "voucher_id": { + "conditions": { + "$in": [ + "LOYALTY-CARD-2IAoDNF" + ] + } + } + } + }, + "result": null, + "user_id": null + } }, - { - "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2", - "name": "Tier 1 - Top", - "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "metadata": { - "has_funds": true - }, - "created_at": "2022-11-09T06:26:54.797Z", - "updated_at": "2022-11-25T11:27:58.578Z", - "earning_rules": { - "ern_95aq3JaE5A8xzHjoJPYNRqXZ": { - "type": "MULTIPLY", - "multiplier": 3 - }, - "ern_AdlWO2yt6b6llWsibIdiRXVE": { - "type": "MULTIPLY", - "multiplier": 5 - }, - "ern_HnRXyJHoj3E79r3KUWhgMgtD": { - "type": "MULTIPLY", - "multiplier": 3 - }, - "ern_raVUcdXruvXGuzm682ESrAzt": { - "type": "CUSTOM", - "points": 200 - } - }, - "rewards": { - "rewa_Or6gWZ5ASuGkBLjOf0IyiD4k": { - "type": "CUSTOM", - "points": 300 - } - }, - "config": { - "points": { - "from": 500, - "to": 1000 - } - }, - "points": { - "from": 500, - "to": 1000 - }, - "object": "loyalty_tier" + "No request body": { + "value": { + "id": "exp_ExEE5A6OIK4tssuNswr5O6SU", + "object": "export", + "created_at": "2023-03-21T13:34:57.034Z", + "status": "SCHEDULED", + "channel": "API", + "exported_object": "voucher_transactions", + "parameters": { + "filters": { + "voucher_id": { + "conditions": { + "$in": [ + "HRwc0oHz" + ] + } + } + } + }, + "result": null, + "user_id": null + } + } + } + } + } + }, + "404": { + "description": "Returns an error if the voucher code does not exist or has been deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id IrKORhS", + "request_id": "v-0a96cd820301c0483a", + "resource_id": "IrKORhS", + "resource_type": "voucher" + } } - ], - "total": 3 + } } } } } } - } - } - }, - "post": { - "operationId": "create-loyalty-tiers", - "tags": [ - "LOYALTIES API" - ], - "summary": "Create loyalty tiers", - "description": "Creates loyalty tiers for desired campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns created loyalty tiers.", - "content": { - "application/json": { + }, + "/v1/loyalties/{campaignId}/members/{memberId}/points-expiration": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/LoyaltiesCreateTiersResponseBody" - } + "type": "string", + "example": "camp_7s3uXI44aKfIk5IhmeOPr6ic" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " + }, + { + "schema": { + "type": "string" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "Loyalty card code." } - } - } - }, - "requestBody": { - "description": "Provide tier definitions you want to add to existing loyalty campaign.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoyaltiesCreateTiersRequestBody" + ], + "get": { + "operationId": "get-points-expiration", + "tags": [ + "LOYALTIES API" + ], + "summary": "Get Points Expiration", + "description": "Retrieve loyalty point expiration buckets for a given loyalty card. Expired point buckets are not returned in this endpoint. You can use the [Exports API](ref:create-export) to retrieve a list of both `ACTIVE` and `EXPIRED` point buckets.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of loyalty points expiration buckets along with an expiration date if the points are due to expire. No expiration date parameter is returned if the loyalty points bucket does not expire.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltiesGetPointsExpirationResponseBody" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "lopb_ERSwDxeWTlvWwFrn3AtJxt3s", + "voucher_id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", + "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "bucket": { + "total_points": 2 + }, + "status": "ACTIVE", + "expires_at": "2022-11-25", + "created_at": "2022-11-25T09:10:20.994Z", + "object": "loyalty_points_bucket" + }, + { + "id": "lopb_zdeIBq3EsnPnRSDa7Tyyb6X2", + "voucher_id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", + "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "bucket": { + "total_points": 12 + }, + "status": "ACTIVE", + "expires_at": "2022-11-30", + "created_at": "2022-11-21T13:49:54.949Z", + "object": "loyalty_points_bucket" + }, + { + "id": "lopb_Mg80vhZtqHFItWlJFYZ2rJAS", + "voucher_id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", + "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "bucket": { + "total_points": 0 + }, + "status": "ACTIVE", + "expires_at": "2023-05-30", + "created_at": "2022-06-09T11:07:07.344Z", + "updated_at": "2022-08-30T08:34:45.989Z", + "object": "loyalty_points_bucket" + }, + { + "id": "lopb_dQE1TwyTkHAJDlVCPlqSC0nu", + "voucher_id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", + "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "bucket": { + "total_points": 13124 + }, + "status": "ACTIVE", + "created_at": "2022-02-28T12:13:57.749Z", + "updated_at": "2022-11-25T09:09:51.136Z", + "object": "loyalty_points_bucket" + } + ], + "total": 4 + } + } + } + } + } + } } } - } - } - } - }, - "/v1/loyalties/{campaignId}/tiers/{tierId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_fkZ28pe7DUAEmmabofkxHI8N" }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique loyalty campaign ID or name." - }, - { - "schema": { - "type": "string", - "example": "ltr_30KHciA0UG8B71Fo51GZqwgN" - }, - "name": "tierId", - "in": "path", - "required": true, - "description": "Unique loyalty tier ID." - } - ], - "get": { - "operationId": "get-loyalty-tier", - "tags": [ - "LOYALTIES API" - ], - "summary": "Get Loyalty Tier", - "description": "Retrieve a loyalty tier from a loyalty campaign by the loyalty tier ID.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a loyalty tier object.", - "content": { - "application/json": { + "/v1/loyalties/{campaignId}/points-expiration/export": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/LoyaltyTier" - }, - "examples": { - "Example": { - "value": { - "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2", - "name": "Tier 1 - Top", - "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "metadata": { - "has_funds": true - }, - "created_at": "2022-11-09T06:26:54.797Z", - "updated_at": "2022-11-25T11:27:58.578Z", - "earning_rules": { - "ern_95aq3JaE5A8xzHjoJPYNRqXZ": { - "type": "MULTIPLY", - "multiplier": 3 - }, - "ern_AdlWO2yt6b6llWsibIdiRXVE": { - "type": "MULTIPLY", - "multiplier": 5 - }, - "ern_HnRXyJHoj3E79r3KUWhgMgtD": { - "type": "MULTIPLY", - "multiplier": 3 - }, - "ern_raVUcdXruvXGuzm682ESrAzt": { - "type": "CUSTOM", - "points": 200 + "type": "string" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID or name." + } + ], + "post": { + "operationId": "create-points-expiration-export", + "tags": [ + "LOYALTIES API" + ], + "summary": "Create Points Expiration Export", + "description": "Schedule the generation of a points expiration CSV file for a particular campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the data filters, types of data to return and order in which the results should be returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_export_points_expirations" + }, + "examples": { + "Specific Vouchers": { + "value": { + "parameters": { + "fields": [ + "id", + "campaign_id", + "voucher_id", + "status", + "expires_at", + "points" + ], + "order": "-expires_at", + "filters": { + "junction": "and", + "voucher_id": { + "conditions": { + "$in": [ + "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", + "v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655" + ] + } + } + } + } } }, - "rewards": { - "rewa_Or6gWZ5ASuGkBLjOf0IyiD4k": { - "type": "CUSTOM", - "points": 300 + "Specific campaign": { + "value": { + "parameters": { + "fields": [ + "id", + "campaign_id", + "voucher_id", + "status", + "expires_at", + "points" + ], + "order": "-expires_at", + "filters": { + "junction": "and", + "campaign_id": { + "conditions": { + "$is": "camp_7s3uXI44aKfIk5IhmeOPr6ic" + } + } + } + } } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns an object with the export ID of the scheduled generation of CSV file with exported points expirations. You can use either the [Get Export](ref:get-export) endpoint to view the status and obtain the URL of the CSV file or [Download Export](ref:download-export) endpoint to download the CSV file.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_export_object_points_expiration" }, - "config": { - "points": { - "from": 500, - "to": 1000 + "examples": { + "Specific Vouchers": { + "value": { + "id": "exp_zC3eXAFss17XTMzMkkov4KGq", + "object": "export", + "created_at": "2022-11-28T13:00:23.621Z", + "status": "SCHEDULED", + "channel": "API", + "exported_object": "points_expiration", + "parameters": { + "order": "-expires_at", + "fields": [ + "id", + "campaign_id", + "voucher_id", + "status", + "expires_at", + "points" + ], + "filters": { + "junction": "and", + "voucher_id": { + "conditions": { + "$in": [ + "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", + "v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655" + ] + } + } + } + }, + "result": null, + "user_id": null + } + }, + "Specific Campaign": { + "value": { + "id": "exp_kfwVDMsavDHl2vOY6vH9q7P7", + "object": "export", + "created_at": "2022-11-28T16:46:34.148Z", + "status": "SCHEDULED", + "channel": "API", + "exported_object": "points_expiration", + "parameters": { + "order": "-expires_at", + "fields": [ + "id", + "campaign_id", + "voucher_id", + "status", + "expires_at", + "points" + ], + "filters": { + "junction": "and", + "campaign_id": { + "conditions": { + "$is": "camp_7s3uXI44aKfIk5IhmeOPr6ic" + } + } + } + }, + "result": null, + "user_id": null + } } - }, - "points": { - "from": 500, - "to": 1000 - }, - "object": "loyalty_tier" + } } } } } } - } - } - } - }, - "/v1/loyalties/members/{memberId}/tiers": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "MmFAzfDe" }, - "name": "memberId", - "in": "path", - "required": true, - "description": "Unique loyalty card assigned to a particular customer." - } - ], - "get": { - "operationId": "get-member-loyalty-tier", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Member's Loyalty Tiers", - "description": "Retrieve member tiers using the loyalty card ID.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a data array containing the member's loyalty tiers.", - "content": { - "application/json": { + "/v1/loyalties/{campaignId}/earning-rules": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/LoyaltiesListMemberLoyaltyTiersResponseBody" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2", - "name": "Tier 1 - Top", - "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "metadata": { - "has_funds": true - }, - "created_at": "2022-11-09T06:26:54.797Z", - "updated_at": "2022-11-25T11:27:58.578Z", - "earning_rules": { - "ern_95aq3JaE5A8xzHjoJPYNRqXZ": { - "type": "MULTIPLY", - "multiplier": 3 - }, - "ern_AdlWO2yt6b6llWsibIdiRXVE": { - "type": "MULTIPLY", - "multiplier": 5 - }, - "ern_HnRXyJHoj3E79r3KUWhgMgtD": { - "type": "MULTIPLY", - "multiplier": 3 - }, - "ern_raVUcdXruvXGuzm682ESrAzt": { - "type": "CUSTOM", - "points": 200 - } - }, - "rewards": { - "rewa_Or6gWZ5ASuGkBLjOf0IyiD4k": { - "type": "CUSTOM", - "points": 300 - } - }, - "config": { - "points": { - "from": 500, - "to": 1000 - } - }, - "points": { - "from": 500, - "to": 1000 - }, - "expiration": { - "customer_id": "cust_qBwHpagDOFu71Z3F22UzR80X", - "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "tier_id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2", - "start_date": "2022-11-10", - "expiration_date": "2023-02-28", - "created_at": "2022-11-09T11:26:26.719Z", - "updated_at": "2022-11-10T08:54:47.200Z" - }, - "object": "loyalty_tier" + "type": "string", + "example": "camp_0dJG7cCAjquzcxWmZ634bA0C" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " + } + ], + "get": { + "operationId": "list-earning-rules", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Earning Rules", + "description": "Returns a list of all earning rules within a given campaign.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + }, + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of earning rules.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_list_earning_rules" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "ern_HnRXyJHoj3E79r3KUWhgMgtD", + "created_at": "2022-11-10T12:25:12.927Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 100, + "type": "FIXED" + }, + "segment": { + "id": "seg_n3vVcU5t0m3rs4rEPr3C1oU5" + }, + "event": "customer.segment.entered", + "source": { + "banner": "New Customers", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_0gv3v7jQG5U6TtVC8bMEdIap", + "metadata": {} + }, + { + "id": "ern_raVUcdXruvXGuzm682ESrAzt", + "created_at": "2022-11-24T09:03:14.534Z", + "updated_at": "2022-11-25T07:31:42.778Z", + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "points": 20, + "type": "FIXED" + }, + "event": "order.paid", + "source": { + "banner": "Order has been paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-23T00:00:00.000Z", + "expiration_date": "2022-11-30T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_MbEIyLbn7pHyba5Qw5eeb35L", + "metadata": { + "Type": "Order has been paid - Fixed" + } + }, + { + "id": "ern_BmDiQs7T3UHfJQqtI2RfJHFR", + "created_at": "2022-11-24T14:48:36.567Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_AMOUNT", + "order": { + "amount": { + "every": 1000, + "points": 1 + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_IKanVw37J6oFuRrdnryXw8Lz", + "metadata": { + "Type": "Order has been paid - Proportional - 1" + } + }, + { + "id": "ern_jwtacKdEEHoc85QbouRw3CR8", + "created_at": "2022-11-24T15:17:11.539Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_TOTAL_AMOUNT", + "order": { + "total_amount": { + "every": 1100, + "points": 1 + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order has been paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_Y6IWqhz0cHGkKcteU9PS5nmK", + "metadata": { + "Type": "Order has been paid - Proportional - 2" + } + }, + { + "id": "ern_fxVdmtJ4u4rlyoH2hIq7m1PQ", + "created_at": "2022-11-24T15:20:04.392Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_METADATA", + "order": { + "metadata": { + "every": 10, + "points": 2, + "property": "number_of_store_visits" + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_HyowcdKQ0lsQ1rSxV5tyYr2z", + "metadata": { + "Type": "Order has been paid - Proportional - 3 - Metadata" + } + }, + { + "id": "ern_Aop1wTrmPv4yBntDcvXNTCWR", + "created_at": "2022-11-24T15:23:44.514Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_AMOUNT", + "order_items": { + "amount": { + "every": 1000, + "points": 3, + "object": "products_collection", + "id": "pc_75U0dHlr7u75BJodrW1AE3t6" + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_EXRyQ0z0rgtF54PKDGGAF1qg", + "metadata": { + "Type": "Order has been paid - Proportional - 4" + } + }, + { + "id": "ern_4qSQVjfGEH7OmXKMzotS0juY", + "created_at": "2022-11-24T15:44:45.301Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_SUBTOTAL_AMOUNT", + "order_items": { + "subtotal_amount": { + "every": 1000, + "points": 4, + "object": "sku", + "id": "sku_0b7d7dfb090be5c619" + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_ID3xLPXCdnOaveJYWiulcNFW", + "metadata": { + "Type": "Order has been paid - Proportional - 5 - Items" + } + }, + { + "id": "ern_aJyt4wIrXhmfMxvrLoZjBYrP", + "created_at": "2022-11-24T15:56:58.710Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_AMOUNT", + "order_items": { + "amount": { + "every": 10000, + "points": 1, + "object": "product", + "id": "prod_0bae32322150fd0546" + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_EbBqD1SNW70vgDp5icGbWl3e", + "metadata": {} + }, + { + "id": "ern_v4Blmh9hA3gpnjo93cMAgvHr", + "created_at": "2022-11-24T16:19:20.571Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 1, + "points": 5, + "property": "customer_life_time_value" + } + } + }, + "segment": { + "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" + }, + "event": "customer.segment.entered", + "source": { + "banner": "Entered Segment", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_wMMDJ86iHKkznz9x0506e30E", + "metadata": {} + }, + { + "id": "ern_L8dFanPxJzhw0f5voTwPurGP", + "created_at": "2022-11-24T16:27:13.917Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 3, + "type": "FIXED" + }, + "custom_event": { + "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" + }, + "event": "page_view", + "source": { + "banner": "Custom Event", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_9N69OJzGKGhp2mo7SNsnsF5b", + "metadata": { + "Type": "Fixed" + } + }, + { + "id": "ern_ngdugZ2hzg35hGASFF8nDjUO", + "created_at": "2022-11-24T16:41:48.830Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOM_EVENT_METADATA", + "custom_event": { + "metadata": { + "every": 2, + "points": 2, + "property": "volume_number" + } + } + }, + "custom_event": { + "schema_id": "ms_qpRZ3EmRQyszNH6Z52Gkq8au" + }, + "event": "user_subscribed", + "source": { + "banner": "Custom Event", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_v1eTxL7X63B5IkYgRWHK4leh", + "metadata": { + "Type": "Event" + } + }, + { + "id": "ern_afo3Ea760hAKv07JYpycnhiE", + "created_at": "2022-11-24T16:50:12.945Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 3, + "points": 3, + "property": "customer_life_time_value" + } + } + }, + "custom_event": { + "schema_id": "ms_f0r4hcu5T0m3v3nT5ch3ma" + }, + "event": "cart_abandoned", + "source": { + "banner": "Custom Event", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_7ovoKiXx49fe3nnhEbDlp9FP", + "metadata": {} + }, + { + "id": "ern_chdlG14W8Sdcq3d6jJQQgRMT", + "created_at": "2022-11-24T16:51:31.595Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 1, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.joined", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Tier joined - Any", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_W9yMQTz5fgQTgmuu6pTVraBW", + "metadata": { + "Type": "Tier joined - any - fixed" + } + }, + { + "id": "ern_gVo6CHBduFPoh1hctASfXHLT", + "created_at": "2022-11-24T17:01:42.809Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 4, + "points": 4, + "property": "customer_life_time_value" + } + } + }, + "event": "customer.loyalty.tier.joined", + "loyalty_tier": { + "id": "ltr_pudTGWasuIqxdiDM0go31OV1" + }, + "source": { + "banner": "Tier joined", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_wdlEo17wmoqYHGfilbayEUj7", + "metadata": { + "Type": "Tier joined - customer metadata - proportional" + } + }, + { + "id": "ern_66OdCyLADv5IGFoQe18vGUwa", + "created_at": "2022-11-24T17:03:59.414Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 2, + "points": 2, + "property": "customer_life_time_value" + } + } + }, + "event": "customer.loyalty.tier.left", + "loyalty_tier": { + "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2" + }, + "source": { + "banner": "Tier left", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_czm5el1Uz1jeGaO97AYoDNAq", + "metadata": { + "Type": "Tier left" + } + }, + { + "id": "ern_YR3fDfCjAmz9a5D68nk0i4dm", + "created_at": "2022-11-25T07:29:38.961Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 3, + "points": 4, + "property": "customer_life_time_value" + } + } + }, + "event": "customer.loyalty.tier.upgraded", + "loyalty_tier": { + "id": "ltr_30KHciA0UG8B71Fo51GZqwgN" + }, + "source": { + "banner": "Tier upgraded", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_M1OdRH8spk6Fs7yTuPLN2LAv", + "metadata": { + "Type": "Upgraded" + } + }, + { + "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", + "created_at": "2022-11-25T07:31:05.866Z", + "updated_at": "2022-11-25T07:31:43.029Z", + "validation_rule_id": "val_kfmWpfXMI9P1", + "loyalty": { + "points": 1, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.downgraded", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Tier Downgraded", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", + "metadata": { + "Type": "Tier" + } + }, + { + "id": "ern_AdlWO2yt6b6llWsibIdiRXVE", + "created_at": "2022-11-25T07:31:42.767Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 5, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.prolonged", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Prolonged", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_4jH1yq9WJS0oJ8suagCrltyb", + "metadata": {} + } + ], + "total": 18 + } } - ], - "total": 1 + } } } } } - } - } - } - } - }, - "/v1/loyalties/{campaignId}/tiers/{tierId}/earning-rules": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID or name." - }, - { - "schema": { - "type": "string", - "example": "ltr_mtWowJBBhVYnY8oXaLJ2tUnk" - }, - "name": "tierId", - "in": "path", - "required": true, - "description": "Unique tier ID." - } - ], - "get": { - "operationId": "list-loyalty-tier-earning-rules", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Loyalty Tier Earning Rules", - "description": "Retrieve available earning rules for a given tier and the calculation method for earning points.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a list of earning rules for a given tier. The object for each earning rule also contains information about how the points are calculated; this includes mapping. If a specific multiplier was used to calculate points for a given tier, then the `loyalty.points` parameter will account for this calculation.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoyaltiesListLoyaltyTierEarningRulesResponseBody" - }, - "examples": { - "example-1": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "ern_95aq3JaE5A8xzHjoJPYNRqXZ", - "created_at": "2022-11-09T06:26:54.332Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 1, - "points": 300, - "property": "customer_life_time_value" - } + }, + "post": { + "operationId": "create-earning-rule", + "tags": [ + "LOYALTIES API" + ], + "summary": "Create Earning Rule", + "description": "Create earning rules for a loyalty campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Customize the request body based on the type of earning rules you would like to create. The request body is an array of objects. The required minimum properties to include in the payload for each object are `event` and `loyalty`. Additionally, if you choose to add a `validity_timeframe`, you must include a `start_date`. Furthermore, an earning rule `event` type: \n\n- `customer.segment.entered` requires a `segment` object\n- a custom event requires a `custom_event` object\n- a `customer.loyalty.tier.joined`, `customer.loyalty.tier.left`, `customer.loyalty.tier.upgraded`, `customer.loyalty.tier.downgraded`, `customer.loyalty.tier.prolonged` requires a `loyalty_tier` object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_create_earning_rules" + }, + "examples": { + "Example": { + "value": [ + { + "event": "order.paid", + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "FIXED", + "points": "5" + }, + "source": { + "banner": "Order paid 5 points." + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Order paid - fixed amount of points" } }, - "event": "customer.loyalty.tier.joined", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Tier Joined", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" + { + "event": "order.paid", + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_AMOUNT", + "order": { + "amount": { + "every": 1, + "points": 1 + } + } + }, + "source": { + "banner": "Order paid - 1 point for 1 dollar spent excluding discounts." + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Order paid- points proportional to order amount" + } }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_bfi69WIbztany4iX6prkKbGN", - "metadata": { - "Type": "Joined Any" - } - }, - { - "id": "ern_HnRXyJHoj3E79r3KUWhgMgtD", - "created_at": "2022-11-10T12:25:12.927Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 300, - "type": "FIXED" + { + "event": "order.paid", + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_TOTAL_AMOUNT", + "order": { + "total_amount": { + "every": 1, + "points": 1 + } + } + }, + "source": { + "banner": "Order paid - 1 point for 1 dollar spent including discounts." + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Order paid- points proportional to order total amount" + } }, - "segment": { - "id": "seg_n3vVcU5t0m3rs4rEPr3C1oU5" + { + "event": "order.paid", + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_METADATA", + "order": { + "metadata": { + "every": 2, + "points": 1, + "property": "number_of_store_visits" + } + } + }, + "source": { + "banner": "Order paid - 2 points for each store visit." + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Order paid- points proportional to numerical order metadata property " + } }, - "event": "customer.segment.entered", - "source": { - "banner": "New Customers", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" + { + "event": "order.paid", + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_AMOUNT", + "order_items": { + "amount": { + "every": 2, + "points": 1, + "object": "product", + "id": "prod_0bae32322150fd0546" + } + } + }, + "source": { + "banner": "Order paid - 2 points for 1 dollar spent on items excluding discounts." + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Order paid- points proportional to order items amount" + } }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_0gv3v7jQG5U6TtVC8bMEdIap", - "metadata": {} - }, - { - "id": "ern_raVUcdXruvXGuzm682ESrAzt", - "created_at": "2022-11-24T09:03:14.534Z", - "updated_at": "2022-11-25T09:48:26.284Z", - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "points": 20, - "type": "FIXED" + { + "event": "order.paid", + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_SUBTOTAL_AMOUNT", + "order_items": { + "subtotal_amount": { + "every": 2, + "points": 1, + "object": "products_collection", + "id": "pc_75U0dHlr7u75BJodrW1AE3t6" + } + } + }, + "source": { + "banner": "Order paid - 2 points for every dollar spent on the product collection." + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Order paid- points proportional to order items subtotal amount" + } }, - "event": "order.paid", - "source": { - "banner": "Order has been paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" + { + "event": "order.paid", + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_QUANTITY", + "order_items": { + "quantity": { + "every": 1, + "points": 1, + "object": "sku", + "id": "sku_0b7d7dfb090be5c619" + } + } + }, + "source": { + "banner": "Order paid - 1 point for every brand phone in your cart." + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Order paid - points proportional to quantity of items in a cart of a product varient." + } }, - "active": true, - "start_date": "2022-11-23T00:00:00.000Z", - "expiration_date": "2022-11-30T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_MbEIyLbn7pHyba5Qw5eeb35L", - "metadata": { - "Type": "Order has been paid - Fixed" - } - }, - { - "id": "ern_BmDiQs7T3UHfJQqtI2RfJHFR", - "created_at": "2022-11-24T14:48:36.567Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_AMOUNT", - "order": { - "amount": { - "every": 1000, - "points": 1 + { + "event": "order.paid", + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 1, + "points": 1, + "property": "customer_life_time_value" + } } + }, + "source": { + "banner": "Order paid 1 point for 1 month of being a customer with us." + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Order paid - points proportional to customer metadata property" } }, - "event": "order.paid", - "source": { - "banner": "Order paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_IKanVw37J6oFuRrdnryXw8Lz", - "metadata": { - "Type": "Order has been paid - Proportional - 1" - } - }, - { - "id": "ern_jwtacKdEEHoc85QbouRw3CR8", - "created_at": "2022-11-24T15:17:11.539Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_TOTAL_AMOUNT", - "order": { - "total_amount": { - "every": 1100, - "points": 1 + { + "event": "customer.segment.entered", + "segment": { + "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" + }, + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 1, + "points": 1, + "property": "customer_life_time_value" + } } + }, + "source": { + "banner": "Customer entered birthday segment - 1 point for each month of being a customer with us." + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Entered segment - points proportional to customer metadata property" } }, - "event": "order.paid", - "source": { - "banner": "Order has been paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_Y6IWqhz0cHGkKcteU9PS5nmK", - "metadata": { - "Type": "Order has been paid - Proportional - 2" - } - }, - { - "id": "ern_fxVdmtJ4u4rlyoH2hIq7m1PQ", - "created_at": "2022-11-24T15:20:04.392Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_METADATA", - "order": { - "metadata": { - "every": 10, - "points": 2, - "property": "number_of_store_visits" - } + { + "event": "customer.segment.entered", + "segment": { + "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" + }, + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "FIXED", + "points": "5" + }, + "source": { + "banner": "Customer entered birthday segment - 5 points" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Entered segment - fixed points" } }, - "event": "order.paid", - "source": { - "banner": "Order paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_HyowcdKQ0lsQ1rSxV5tyYr2z", - "metadata": { - "Type": "Order has been paid - Proportional - 3 - Metadata" - } - }, - { - "id": "ern_Aop1wTrmPv4yBntDcvXNTCWR", - "created_at": "2022-11-24T15:23:44.514Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_AMOUNT", - "order_items": { - "amount": { - "every": 1000, - "points": 3, - "object": "products_collection", - "id": "pc_75U0dHlr7u75BJodrW1AE3t6" - } + { + "event": "page_view", + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "points": 3, + "type": "FIXED" + }, + "custom_event": { + "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" + }, + "source": { + "banner": "See page - 3 points" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Custom Event - fixed points for viewing a page" } }, - "event": "order.paid", - "source": { - "banner": "Order paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_EXRyQ0z0rgtF54PKDGGAF1qg", - "metadata": { - "Type": "Order has been paid - Proportional - 4" - } - }, - { - "id": "ern_4qSQVjfGEH7OmXKMzotS0juY", - "created_at": "2022-11-24T15:44:45.301Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_SUBTOTAL_AMOUNT", - "order_items": { - "subtotal_amount": { - "every": 1000, - "points": 4, - "object": "sku", - "id": "sku_0b7d7dfb090be5c619" + { + "event": "page_view", + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOM_EVENT_METADATA", + "custom_event": { + "metadata": { + "every": 1, + "points": 2, + "property": "volume_number" + } } + }, + "custom_event": { + "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" + }, + "source": { + "banner": "See page X - get 2 points multiplied by the page number" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Custom Event - proportional points for viewing a page based on custom event metadata" } }, - "event": "order.paid", - "source": { - "banner": "Order paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_ID3xLPXCdnOaveJYWiulcNFW", - "metadata": { - "Type": "Order has been paid - Proportional - 5 - Items" - } - }, - { - "id": "ern_aJyt4wIrXhmfMxvrLoZjBYrP", - "created_at": "2022-11-24T15:56:58.710Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_AMOUNT", - "order_items": { - "amount": { - "every": 10000, - "points": 1, - "object": "product", - "id": "prod_0bae32322150fd0546" + { + "event": "page_view", + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 1, + "points": 2, + "property": "customer_life_time_value" + } } + }, + "custom_event": { + "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" + }, + "source": { + "banner": "Get 2 points for every month you're a customer for viewing a page" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Custom Event - proportional points for viewing a page based on customer metadata" } }, - "event": "order.paid", - "source": { - "banner": "Order paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_EbBqD1SNW70vgDp5icGbWl3e", - "metadata": {} - }, - { - "id": "ern_v4Blmh9hA3gpnjo93cMAgvHr", - "created_at": "2022-11-24T16:19:20.571Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 1, - "points": 5, - "property": "customer_life_time_value" + { + "event": "customer.loyalty.tier.prolonged", + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 1, + "points": 2, + "property": "customer_life_time_value" + } } + }, + "loyalty_tier": { + "id": "ltr_pudTGWasuIqxdiDM0go31OV1" + }, + "source": { + "banner": "Get 2 points for every month you're a customer when your loyalty tier is prolonged." + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Custom Event - proportional points for extending a loyalty tier based on customer metadata." } - }, - "segment": { - "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" - }, - "event": "customer.segment.entered", - "source": { - "banner": "Entered Segment", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_wMMDJ86iHKkznz9x0506e30E", - "metadata": {} - }, - { - "id": "ern_L8dFanPxJzhw0f5voTwPurGP", - "created_at": "2022-11-24T16:27:13.917Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 3, - "type": "FIXED" - }, - "custom_event": { - "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" - }, - "event": "page_view", - "source": { - "banner": "Custom Event", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_9N69OJzGKGhp2mo7SNsnsF5b", - "metadata": { - "Type": "Fixed" } - }, - { - "id": "ern_ngdugZ2hzg35hGASFF8nDjUO", - "created_at": "2022-11-24T16:41:48.830Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOM_EVENT_METADATA", - "custom_event": { + ] + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns an array of earning rule objects.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/8_obj_earning_rule_object" + } + }, + "examples": { + "Example": { + "value": [ + { + "id": "ern_63g6NQgtepfXn2z0QbT2ksLf", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "points": 5, + "type": "FIXED" + }, + "event": "order.paid", + "source": { + "banner": "Order paid 5 points.", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_knM56LS3oygL0Ue0oeSNt4WA", "metadata": { - "every": 2, - "points": 2, - "property": "volume_number" + "Type": "Order paid - fixed amount of points" } - } - }, - "custom_event": { - "schema_id": "ms_qpRZ3EmRQyszNH6Z52Gkq8au" - }, - "event": "user_subscribed", - "source": { - "banner": "Custom Event", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_v1eTxL7X63B5IkYgRWHK4leh", - "metadata": { - "Type": "Event" - } - }, - { - "id": "ern_afo3Ea760hAKv07JYpycnhiE", - "created_at": "2022-11-24T16:50:12.945Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { + }, + { + "id": "ern_Ov5RWerVFubVSjIHOMco34dv", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_AMOUNT", + "order": { + "amount": { + "every": 1, + "points": 1 + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid - 1 point for 1 dollar spent excluding discounts.", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_2R4x6pMFVEIPz1Lhz5ZVo33Y", "metadata": { - "every": 3, - "points": 3, - "property": "customer_life_time_value" + "Type": "Order paid- points proportional to order amount" } - } - }, - "custom_event": { - "schema_id": "ms_f0r4hcu5T0m3v3nT5ch3ma" - }, - "event": "cart_abandoned", - "source": { - "banner": "Custom Event", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_7ovoKiXx49fe3nnhEbDlp9FP", - "metadata": {} - }, - { - "id": "ern_chdlG14W8Sdcq3d6jJQQgRMT", - "created_at": "2022-11-24T16:51:31.595Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 1, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.joined", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Tier joined - Any", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_W9yMQTz5fgQTgmuu6pTVraBW", - "metadata": { - "Type": "Tier joined - any - fixed" - } - }, - { - "id": "ern_gVo6CHBduFPoh1hctASfXHLT", - "created_at": "2022-11-24T17:01:42.809Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { + }, + { + "id": "ern_5rWPz4arGlTv4FVc1vETeFfe", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_TOTAL_AMOUNT", + "order": { + "total_amount": { + "every": 1, + "points": 1 + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid - 1 point for 1 dollar spent including discounts.", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_fXasfs6Eh7P2haZkI33PEumI", "metadata": { - "every": 4, - "points": 4, - "property": "customer_life_time_value" + "Type": "Order paid- points proportional to order total amount" } - } - }, - "event": "customer.loyalty.tier.joined", - "loyalty_tier": { - "id": "ltr_pudTGWasuIqxdiDM0go31OV1" - }, - "source": { - "banner": "Tier joined", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_wdlEo17wmoqYHGfilbayEUj7", - "metadata": { - "Type": "Tier joined - customer metadata - proportional" - } - }, - { - "id": "ern_66OdCyLADv5IGFoQe18vGUwa", - "created_at": "2022-11-24T17:03:59.414Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { + }, + { + "id": "ern_Xs3o43dHr1O3RM5ojoeu1l6b", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_METADATA", + "order": { + "metadata": { + "every": 2, + "points": 1, + "property": "number_of_store_visits" + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid - 2 points for each store visit.", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_jucMzF25jisrqiG3k6JyyviT", "metadata": { - "every": 2, - "points": 2, - "property": "customer_life_time_value" + "Type": "Order paid- points proportional to numerical order metadata property " } - } - }, - "event": "customer.loyalty.tier.left", - "loyalty_tier": { - "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2" - }, - "source": { - "banner": "Tier left", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_czm5el1Uz1jeGaO97AYoDNAq", - "metadata": { - "Type": "Tier left" - } - }, - { - "id": "ern_YR3fDfCjAmz9a5D68nk0i4dm", - "created_at": "2022-11-25T07:29:38.961Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { + }, + { + "id": "ern_9CjMBP2V8zgpsHLga4YOQo0A", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_AMOUNT", + "order_items": { + "amount": { + "every": 2, + "points": 1, + "object": "product", + "id": "prod_0bae32322150fd0546" + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid - 2 points for 1 dollar spent on items excluding discounts.", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_y60lx7XsW1YdOOOFuDaYjvG4", "metadata": { - "every": 3, - "points": 4, - "property": "customer_life_time_value" + "Type": "Order paid- points proportional to order items amount" } - } - }, - "event": "customer.loyalty.tier.upgraded", - "loyalty_tier": { - "id": "ltr_30KHciA0UG8B71Fo51GZqwgN" - }, - "source": { - "banner": "Tier upgraded", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_M1OdRH8spk6Fs7yTuPLN2LAv", - "metadata": { - "Type": "Upgraded" + }, + { + "id": "ern_uI7hRj8PNodK8xWRsn3gpDdG", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_SUBTOTAL_AMOUNT", + "order_items": { + "subtotal_amount": { + "every": 2, + "points": 1, + "object": "products_collection", + "id": "pc_75U0dHlr7u75BJodrW1AE3t6" + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid - 2 points for every dollar spent on the product collection.", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_Lk1WROGexXA72FabUWhR1p7X", + "metadata": { + "Type": "Order paid- points proportional to order items subtotal amount" + } + }, + { + "id": "ern_dL13AmZEO0ToImOY44YUP1ru", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_QUANTITY", + "order_items": { + "quantity": { + "every": 1, + "points": 1, + "object": "sku", + "id": "sku_0b7d7dfb090be5c619" + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid - 1 point for every brand phone in your cart.", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_4F9iJG0hmKTiqSsmkfbB8vUF", + "metadata": { + "Type": "Order paid - points proportional to quantity of items in a cart of a product varient." + } + }, + { + "id": "ern_ublD9yGhxPrd9ayPAMTc4aOZ", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 1, + "points": 1, + "property": "customer_life_time_value" + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid 1 point for 1 month of being a customer with us.", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_raft7C1hVw427OnEobmzhXjD", + "metadata": { + "Type": "Order paid - points proportional to customer metadata property" + } + }, + { + "id": "ern_6tBwufmR7UNJInhZq8zNRrj5", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 1, + "points": 1, + "property": "customer_life_time_value" + } + } + }, + "segment": { + "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" + }, + "event": "customer.segment.entered", + "source": { + "banner": "Customer entered birthday segment - 1 point for each month of being a customer with us.", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_mQ8SCABGLnrGMBbh8QS6DUpX", + "metadata": { + "Type": "Entered segment - points proportional to customer metadata property" + } + }, + { + "id": "ern_yBR0JtdcDyJXgZf30C8KQLPw", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "points": 5, + "type": "FIXED" + }, + "segment": { + "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" + }, + "event": "customer.segment.entered", + "source": { + "banner": "Customer entered birthday segment - 5 points", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_Co7zjgYPIKZ45vcK0jn7qrY8", + "metadata": { + "Type": "Entered segment - fixed points" + } + }, + { + "id": "ern_Ic2AUznt4cJInIl1wt6n0Fbv", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "points": 3, + "type": "FIXED" + }, + "custom_event": { + "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" + }, + "event": "page_view", + "source": { + "banner": "See page - 3 points", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_KWvcBS3bdmJnWD4BTw29eRNT", + "metadata": { + "Type": "Custom Event - fixed points for viewing a page" + } + }, + { + "id": "ern_4SRj1TY1j8Q617R2Y4qiN1sy", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOM_EVENT_METADATA", + "custom_event": { + "metadata": { + "every": 1, + "points": 2, + "property": "volume_number" + } + } + }, + "custom_event": { + "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" + }, + "event": "page_view", + "source": { + "banner": "See page X - get 2 points multiplied by the page number", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_WWESERcKoTRSbCDal7Hr7H0A", + "metadata": { + "Type": "Custom Event - proportional points for viewing a page based on custom event metadata" + } + }, + { + "id": "ern_WXBa4b5a6N5XZt9A9Nf9dagA", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 1, + "points": 2, + "property": "customer_life_time_value" + } + } + }, + "custom_event": { + "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" + }, + "event": "page_view", + "source": { + "banner": "Get 2 points for every month you're a customer for viewing a page", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_zv3mCOeZOaHCsFMG0yIKu0ax", + "metadata": { + "Type": "Custom Event - proportional points for viewing a page based on customer metadata" + } + }, + { + "id": "ern_DvdegDzcaMUXzf2fayzCqMEV", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 1, + "points": 2, + "property": "customer_life_time_value" + } + } + }, + "event": "customer.loyalty.tier.prolonged", + "loyalty_tier": { + "id": "ltr_pudTGWasuIqxdiDM0go31OV1" + }, + "source": { + "banner": "Get 2 points for every month you're a customer when your loyalty tier is prolonged.", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_fpfYyNcpVskgwcrs21kQ91Wx", + "metadata": { + "Type": "Custom Event - proportional points for extending a loyalty tier based on customer metadata." + } + } + ] + } + } + } + } + }, + "400": { + "description": "Returns an error if a parameters is defined incorrectly.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_400_missing_param" + }, + "examples": { + "Example": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Loyalty order rules must contain one of the following properties - 'total_amount'", + "request_id": "v-0c127fa5d4424c8411" } - }, - { - "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", - "created_at": "2022-11-25T07:31:05.866Z", - "updated_at": "2022-11-25T09:48:26.506Z", - "validation_rule_id": "val_kfmWpfXMI9P1", - "loyalty": { - "points": 1, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.downgraded", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Tier Downgraded", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", - "metadata": { - "Type": "Tier" + } + } + } + } + }, + "404": { + "description": "Returns an error if a parameter's value is not found in the respository.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Example": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find loyalty_tier with id ltr_pudTGWasuIqxdiDM0go31OV1", + "request_id": "v-0c12808f33ce673c42", + "resource_id": "ltr_pudTGWasuIqxdiDM0go31OV1", + "resource_type": "loyalty_tier" } - }, - { - "id": "ern_AdlWO2yt6b6llWsibIdiRXVE", - "created_at": "2022-11-25T07:31:42.767Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 25, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.prolonged", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Prolonged", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_4jH1yq9WJS0oJ8suagCrltyb", - "metadata": {} } - ], - "total": 19 + } } } } } } - } - } - } - }, - "/v1/loyalties/{campaignId}/tiers/{tierId}/rewards": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID or name." - }, - { - "schema": { - "type": "string", - "example": "ltr_mtWowJBBhVYnY8oXaLJ2tUnk" }, - "name": "tierId", - "in": "path", - "required": true, - "description": "Unique tier ID." - } - ], - "get": { - "operationId": "list-loyalty-tier-rewards", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Loyalty Tier Rewards", - "description": "Get available rewards for a given tier.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary of loyalty tier reward objects.", - "content": { - "application/json": { + "/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/8_res_list_loyalty_tier_rewards" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "reward": { - "id": "rew_QuWYsBNB2G3fikffjnl0G3gH", - "name": "API - Testing", - "type": "CAMPAIGN", - "parameters": { - "campaign": { - "id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", - "balance": 500, - "type": "LOYALTY_PROGRAM" - } + "type": "string", + "example": "camp_0dJG7cCAjquzcxWmZ634bA0C" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " + }, + { + "schema": { + "type": "string", + "example": "ern_CFuv1O0IDl8Jgph0ojhMu8bH" + }, + "name": "earningRuleId", + "in": "path", + "required": true, + "description": "A unique earning rule ID." + } + ], + "get": { + "operationId": "get-earning-rule", + "tags": [ + "LOYALTIES API" + ], + "summary": "Get Earning Rule", + "description": "Retrieves an earning rule assigned to a campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns an earning rule object with the earning rule details.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltiesGetEarningRuleResponseBody" + }, + "examples": { + "Custom Event": { + "value": { + "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", + "created_at": "2022-02-07T08:19:41.810Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 2, + "type": "FIXED" }, - "stock": null, - "redeemed": null, - "created_at": "2022-08-25T09:32:04.579424+00:00", - "updated_at": "2022-08-25T09:33:46.680639+00:00", - "metadata": { - "Type": "Second campaign" + "custom_event": { + "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" }, - "object": "reward" - }, - "assignment": { - "id": "rewa_3Z2sP0bmqcL0ggU28GvFeHU3", - "reward_id": "rew_QuWYsBNB2G3fikffjnl0G3gH", - "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 40 - } + "event": "saw_on_facebook", + "source": { + "banner": "Saw on Facebook Timeframe", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" }, - "created_at": "2022-11-23T22:11:58.759092+00:00", - "updated_at": null, - "object": "reward_assignment" - }, - "object": "loyalty_tier_reward" + "active": true, + "start_date": "2022-02-07T08:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "object": "earning_rule", + "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" + } }, - { - "reward": { - "id": "rew_XoDgmQ2HZX7qPM6aIEuslObo", - "name": "Material", - "type": "MATERIAL", - "parameters": { - "product": { - "id": "prod_0b15f6b9f650c16990", - "sku_id": "sku_0b1621b319d248b79f" - } + "Order Paid": { + "value": { + "id": "ern_taClaOIiaGNdmdby8xS0lCcy", + "created_at": "2022-02-04T13:27:50.665Z", + "updated_at": "2022-02-07T08:19:44.198Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" }, - "stock": 2, - "redeemed": 1, - "attributes": { - "image_url": "https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_fPH9ohe0pZf4EiIt295sk9Ob.png", - "description": "Archie's Series" + "event": "order.paid", + "source": { + "banner": "Order paid 1000 points", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" }, - "created_at": "2022-08-29T06:02:36.753873+00:00", - "updated_at": "2022-11-08T08:01:26.883166+00:00", - "metadata": { - "Type": "Material" + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" }, - "object": "reward" - }, - "assignment": { - "id": "rewa_Or6gWZ5ASuGkBLjOf0IyiD4k", - "reward_id": "rew_XoDgmQ2HZX7qPM6aIEuslObo", - "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 30 - } + "validity_day_of_week": [ + 4 + ], + "object": "earning_rule", + "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" + } + }, + "Segment Entered": { + "value": { + "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", + "created_at": "2022-02-04T13:02:52.937Z", + "updated_at": "2022-02-07T08:19:43.291Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" + }, + "segment": { + "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" + }, + "event": "customer.segment.entered", + "source": { + "banner": "Entered segment 100 points.", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" }, - "created_at": "2022-11-23T22:11:58.759092+00:00", + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" + } + }, + "Loyalty Tier Joined": { + "value": { + "id": "ern_gVo6CHBduFPoh1hctASfXHLT", + "created_at": "2022-11-24T17:01:42.809Z", "updated_at": null, - "object": "reward_assignment" - }, - "object": "loyalty_tier_reward" + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 4, + "points": 4, + "property": "customer_life_time_value" + } + } + }, + "event": "customer.loyalty.tier.joined", + "loyalty_tier": { + "id": "ltr_pudTGWasuIqxdiDM0go31OV1" + }, + "source": { + "banner": "Tier joined", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_wdlEo17wmoqYHGfilbayEUj7", + "metadata": { + "Type": "Tier joined - customer metadata - proportional" + } + } }, - { - "reward": { - "id": "rew_MVXA2kV7lZ1zC057WUaTrvNz", - "name": "100 Points = $20", - "type": "COIN", - "parameters": { - "coin": { - "exchange_ratio": 20, - "points_ratio": 100 + "Loyalty Tier Left": { + "value": { + "id": "ern_66OdCyLADv5IGFoQe18vGUwa", + "created_at": "2022-11-24T17:03:59.414Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 2, + "points": 2, + "property": "customer_life_time_value" + } } }, - "stock": null, - "redeemed": null, - "attributes": {}, - "created_at": "2022-09-09T06:41:54.496035+00:00", + "event": "customer.loyalty.tier.left", + "loyalty_tier": { + "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2" + }, + "source": { + "banner": "Tier left", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_czm5el1Uz1jeGaO97AYoDNAq", + "metadata": { + "Type": "Tier left" + } + } + }, + "Loyalty Tier Upgraded": { + "value": { + "id": "ern_YR3fDfCjAmz9a5D68nk0i4dm", + "created_at": "2022-11-25T07:29:38.961Z", "updated_at": null, - "metadata": {}, - "object": "reward" - }, - "assignment": { - "id": "rewa_nMXB59qGTNYawMT8eP8M4oUp", - "reward_id": "rew_MVXA2kV7lZ1zC057WUaTrvNz", - "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "related_object_type": "campaign", - "created_at": "2022-11-09T11:01:21.065681+00:00", + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 3, + "points": 4, + "property": "customer_life_time_value" + } + } + }, + "event": "customer.loyalty.tier.upgraded", + "loyalty_tier": { + "id": "ltr_30KHciA0UG8B71Fo51GZqwgN" + }, + "source": { + "banner": "Tier upgraded", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_M1OdRH8spk6Fs7yTuPLN2LAv", + "metadata": { + "Type": "Upgraded" + } + } + }, + "Loyalty Tier Downgraded": { + "value": { + "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", + "created_at": "2022-11-25T07:31:05.866Z", + "updated_at": "2022-11-25T07:31:43.029Z", + "validation_rule_id": "val_kfmWpfXMI9P1", + "loyalty": { + "points": 1, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.downgraded", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Tier Downgraded", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", + "metadata": { + "Type": "Tier" + } + } + }, + "Loyalty Tier Prolonged": { + "value": { + "id": "ern_AdlWO2yt6b6llWsibIdiRXVE", + "created_at": "2022-11-25T07:31:42.767Z", "updated_at": null, - "object": "reward_assignment" - }, - "object": "loyalty_tier_reward" + "validation_rule_id": null, + "loyalty": { + "points": 5, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.prolonged", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Prolonged", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_4jH1yq9WJS0oJ8suagCrltyb", + "metadata": {} + } } - ], - "total": 3 + } } } } } - } - } - } - } - }, - "/v1/customer-object": { - "get": { - "operationId": "customer-object", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Customer Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Customer Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/9_obj_customer_object" - } - } - } - } - } - } - }, - "/v1/customer-activity-object": { - "get": { - "operationId": "customer-activity-object", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Customer Activity Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Customer Activity Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/9_obj_customer_activity_object" - } - } - } - } - } - } - }, - "/v1/customers": { - "get": { - "operationId": "list-customers", - "tags": [ - "CUSTOMERS API" - ], - "summary": "List Customers", - "description": "Returns a list of customers.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "email", - "description": "Limit the customers to the ones that have this specific email address." - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "description": "Limit the customers to the ones that are located in the specified city.", - "name": "city" - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "description": "Filter customers by the name property.", - "name": "name" - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at", - "source_id", - "-source_id" - ] }, - "in": "query", - "name": "order", - "description": "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." - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "starting_after", - "description": "A cursor for use in pagination. This is a date-time value that defines your place in the list based on `created_at` property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at `2020-05-24T13:43:09.024Z`, your subsequent call can include `starting_after=2020-05-24T13:43:09.024Z` in order to fetch the next page of the list. \n\n| **Option** | **Format** | **Sorting** |\n|:---|:---|:---|\n| Return customers **before** a specific creation date | - set `starting_after` parameter to the breakpoint date | Sorting order is **descending**; the most recent dates first and least recent dates last. |\n| Return customers **after** a specific create or update date | - include the `order` parameter set to `created_at` or `updated_at`
- set `starting_after` to the breakpoint date | Sorting order is **ascending**; the least recent dates first and the most recent dates last. |\n" - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary with customer objects. The customers are returned sorted by creation date, with the most recent customers appearing first.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/9_res_list_customers" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "customers", - "customers": [ - { - "id": "cust_CSnYd37MXmrbS19XCrghjBsv", - "source_id": "source_123", - "name": "Bob Smith", - "description": "A frequent customer", - "email": "bob.smith@email.com", - "phone": "+1 933 222 3333", - "birthdate": "2022-01-01", - "address": { - "city": "New York", - "state": "NY", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 5", - "country": "United States", - "postal_code": "10001" - }, - "summary": { - "redemptions": { - "total_redeemed": 1, - "total_failed": 0, - "total_succeeded": 1, - "total_rolled_back": 0, - "total_rollback_failed": 0, - "total_rollback_succeeded": 0, - "gift": { - "redeemed_amount": 0, - "amount_to_go": 0 - }, - "loyalty_card": { - "redeemed_points": 0, - "points_to_go": 4200 - } - }, - "orders": { - "total_amount": 1600, - "total_count": 1, - "average_amount": 1600, - "last_order_amount": 1600, - "last_order_date": "2022-08-30T10:17:39.220Z" - } - }, + "put": { + "operationId": "update-earning-rule", + "tags": [ + "LOYALTIES API" + ], + "summary": "Update Earning Rule", + "description": "Update an earning rule definition.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the parameters that you would like to update for the given earning rule.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_update_earning_rule" + }, + "examples": { + "Example": { + "value": { + "validation_rule_id": "val_7SxpdhPeBngA", "loyalty": { - "points": 2200, - "referred_customers": 0, - "campaigns": { - "Christmas Campaign": { - "points": 1000, - "referred_customers": 0 - }, - "Fall Campaign": { - "points": 75, - "referred_customers": 0 - }, - "Winter Campaign": { - "points": 75, - "referred_customers": 0 - }, - "Summer Campaign": { - "points": 50, - "referred_customers": 0 - }, - "Spring Campaign": { - "points": 1000, - "referred_customers": 0 - } - } - }, - "referrals": { - "total": 1, - "campaigns": [ - { - "campaign_id": "camp_rRsfatlwN7unSeUIJDCYedal", - "referrer_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", - "related_object_id": "r_0b9d4c5121d64dd01d", - "related_object_type": "redemption", - "date": "2022-08-30T10:17:41.089Z" - } - ] - }, - "metadata": { - "lang": "en", - "test": true - }, - "system_metadata": {}, - "created_at": "2022-08-30T06:32:07.380Z", - "updated_at": "2022-08-30T10:17:58.049Z", - "object": "customer" - }, - { - "id": "cust_X0hU04x7FeisPnD5lctZcQkI", - "source_id": "jane.smith@email.com", - "name": "Jane Smith", - "description": "A nice customer", - "email": "jane.smith@email.com", - "phone": "+1 933 222 3333", - "birthdate": "2022-01-02", - "address": { - "city": "New Yorke", - "state": "NY", - "line_1": "123 Main Ste.", - "line_2": "APT 3 BLG 4e", - "country": "United Statese", - "postal_code": "10001e" - }, - "summary": { - "redemptions": { - "total_redeemed": 4, - "total_failed": 0, - "total_succeeded": 4, - "total_rolled_back": 1, - "total_rollback_failed": 0, - "total_rollback_succeeded": 1, - "gift": { - "redeemed_amount": 0, - "amount_to_go": 0 - }, - "loyalty_card": { - "redeemed_points": 0, - "points_to_go": 15549 - } - }, - "orders": { - "total_amount": 210000, - "total_count": 3, - "average_amount": 70000, - "last_order_amount": 70000, - "last_order_date": "2022-08-30T11:51:08.029Z" - } + "type": "FIXED", + "points": "5" }, - "loyalty": { - "points": 15399, - "referred_customers": 0, - "campaigns": { - "Christmas Campaign": { - "points": 7000, - "referred_customers": 0 - }, - "Fall Campaign": { - "points": 2299, - "referred_customers": 0 - }, - "Winter Campaign": { - "points": 25, - "referred_customers": 0 - }, - "Summer Campaign": { - "points": 75, - "referred_customers": 0 - }, - "Spring Campaign": { - "points": 6000, - "referred_customers": 0 - } - } + "source": { + "banner": "Order paid 5 points." }, - "referrals": { - "total": 2, - "campaigns": [ - { - "campaign_id": "camp_rRsfatlwN7unSeUIJDCYedal", - "referrer_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", - "related_object_id": "r_0b9d4cc4aa164dd073", - "related_object_type": "redemption", - "date": "2022-08-30T10:19:39.196Z" - }, - { - "campaign_id": "camp_YDsFdX8TgFtT0RUuKEFyhqs3", - "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", - "related_object_id": "r_0b9d61b6484ead0324", - "related_object_type": "redemption", - "date": "2022-08-30T11:51:10.445Z" - } - ] + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], "metadata": { - "lang": "en", - "test": false - }, - "system_metadata": {}, - "created_at": "2022-08-09T09:50:53.620Z", - "updated_at": "2022-08-30T11:51:24.327Z", - "object": "customer" + "Type": "Order paid - fixed amount of points" + } } - ], - "total": 2 + } } } } - } - } - } - } - }, - "post": { - "operationId": "create-customer", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Create Customer", - "description": "Creates a customer object.\n\n\n\n> 📘 Upsert Mode\n>\n> If you pass a `source_id` that already exists in the customer database, Voucherify will return a related customer object with updated fields.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Create a customer with specified parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/9_req_create_customer" }, - "examples": { - "Example": { - "value": { - "source_id": "source_123", - "name": "Bob Smith", - "description": "A frequent customer", - "email": "bob.smith@email.com", - "phone": "+1 933 222 3333", - "address": { - "city": "New York", - "country": "United States", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 4", - "postal_code": "10001", - "state": "NY" - }, - "metadata": { - "lang": "en", - "test": true - }, - "birthdate": "2022-01-01" + "responses": { + "200": { + "description": "Returns the updated earning rule object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_earning_rule_object" + }, + "examples": { + "Example": { + "value": { + "id": "ern_63g6NQgtepfXn2z0QbT2ksLf", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": "2022-11-29T11:30:57.652Z", + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "points": 5, + "type": "FIXED" + }, + "event": "order.paid", + "source": { + "banner": "Order paid 5 points.", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_knM56LS3oygL0Ue0oeSNt4WA", + "metadata": { + "Type": "Order paid - fixed amount of points" + } + } + } + } + } } } } - } - } - }, - "responses": { - "200": { - "description": "Returns a customer object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/9_obj_customer_object" - }, - "examples": { - "Example": { - "value": { - "id": "cust_CSnYd37MXmrbS19XCrghjBsv", - "source_id": "source_123", - "name": "Bob Smith", - "description": "A frequent customer", - "email": "bob.smith@email.com", - "phone": "+1 933 222 3333", - "birthdate": "2022-01-01", - "address": { - "city": "New York", - "state": "NY", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 4", - "country": "United States", - "postal_code": "10001" - }, - "summary": { - "redemptions": { - "total_redeemed": 0, - "total_failed": 0, - "total_succeeded": 0, - "total_rolled_back": 0, - "total_rollback_failed": 0, - "total_rollback_succeeded": 0, - "gift": { - "redeemed_amount": 0, - "amount_to_go": 0 - }, - "loyalty_card": { - "redeemed_points": 0, - "points_to_go": 0 + }, + "delete": { + "operationId": "delete-earning-rule", + "tags": [ + "LOYALTIES API" + ], + "summary": "Delete Earning Rule", + "description": "This method deletes an earning rule for a specific loyalty campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." + }, + "404": { + "description": "Returns an error indicating that the loyalty campaign or earning rule with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Earning Rule Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find earning_rule with id ern_10S9ijStRZsf65xd12aydn4f", + "request_id": "v-0ae2bdc5f11027e81a", + "resource_id": "ern_10S9ijStRZsf65xd12aydn4f", + "resource_type": "earning_rule" } }, - "orders": { - "total_amount": 0, - "total_count": 0, - "average_amount": 0, - "last_order_amount": 0 + "Loyalty Campaign Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id Summer Loyalty Campaign", + "request_id": "v-0ae2be04d146b71e50", + "resource_id": "Summer Loyalty Campaign", + "resource_type": "campaign" + } } - }, - "loyalty": { - "points": 0, - "referred_customers": 0, - "campaigns": {} - }, - "referrals": { - "total": 0, - "campaigns": [] - }, - "metadata": { - "lang": "en", - "test": true - }, - "system_metadata": {}, - "created_at": "2022-08-30T06:32:07.380Z", - "object": "customer" + } } } } } } - } - } - } - }, - "/v1/customers/{customerId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "cust_J1CDUdbqn5Exva8ASWk1Fq0j" }, - "name": "customerId", - "in": "path", - "required": true, - "description": "A Voucherify customer ID or `source_id`." - } - ], - "get": { - "operationId": "get-customer", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Get Customer", - "description": "Retrieve customer details.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a customer object if a valid identifier was provided.", - "content": { - "application/json": { + "/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/enable": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/9_obj_customer_object" + "type": "string", + "example": "camp_fkZ28pe7DUAEmmabofkxHI8N" }, - "examples": { - "Example": { - "value": { - "id": "cust_T849EgzNVVmn5icJ2FAkT2rO", - "source_id": "alice.morgan@email.com", - "name": "Alice Morgan", - "email": "alice.morgan@email.com", - "address": null, - "summary": { - "redemptions": { - "total_redeemed": 2, - "total_failed": 0, - "total_succeeded": 2, - "total_rolled_back": 0, - "total_rollback_failed": 0, - "total_rollback_succeeded": 0, - "gift": { - "redeemed_amount": 0, - "amount_to_go": 0 - }, - "loyalty_card": { - "redeemed_points": 0, - "points_to_go": 3303 - } - }, - "orders": { - "total_amount": 203900, - "total_count": 2, - "average_amount": 101950, - "last_order_amount": 3900, - "last_order_date": "2022-07-26T14:59:52.814Z" - } - }, - "loyalty": { - "points": 3303, - "referred_customers": 0, - "campaigns": { - "Summer Campaign": { - "points": 3303, - "referred_customers": 0 + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID or name." + }, + { + "schema": { + "type": "string", + "example": "ern_A2RArBE30Tkt56utVLrRv7rZ" + }, + "name": "earningRuleId", + "in": "path", + "required": true, + "description": "Unique earning rule ID." + } + ], + "post": { + "operationId": "enable-earning-rule", + "tags": [ + "LOYALTIES API" + ], + "summary": "Enable Earning Rule", + "description": "Enable an earning rule.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns an earning rule object with the `active` parameter set to `true`.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltiesEnableEarningRulesResponseBody" + }, + "examples": { + "Example": { + "value": { + "id": "ern_raVUcdXruvXGuzm682ESrAzt", + "created_at": "2022-11-24T09:03:14.534Z", + "updated_at": "2022-11-25T14:07:39.460Z", + "loyalty": { + "points": 20, + "type": "FIXED" + }, + "event": "order.paid", + "source": { + "banner": "Order has been paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-23T00:00:00.000Z", + "expiration_date": "2022-11-30T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_MbEIyLbn7pHyba5Qw5eeb35L", + "metadata": { + "Type": "Order has been paid - Fixed" + } } } - }, - "referrals": { - "total": 0, - "campaigns": [] - }, - "system_metadata": {}, - "created_at": "2022-02-07T08:28:23.644Z", - "updated_at": "2022-07-26T14:59:59.806Z", - "assets": { - "cockpit_url": "https://www.url.com" - }, - "object": "customer" + } } } - } - } - } - }, - "404": { - "description": "Not Found. When requesting the ID of a customer that has been deleted or does not exist in the system, the resource will not be returned.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" }, - "examples": { - "Not found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find customer with id cust_sehkNIi8Uq2qQuRqSr7xn4Z", - "request_id": "v-0b4c590350857970df", - "resource_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Z", - "resource_type": "customer" + "404": { + "description": "Returns an error if the resource cannot be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Example": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find earning_rule with id ern_raVUcdXruvXGuzm682ESrAz", + "request_id": "v-0c0d849dde0e6737d9", + "resource_id": "ern_raVUcdXruvXGuzm682ESrAz", + "resource_type": "earning_rule" + } + } + } } } } } } - } - } - }, - "delete": { - "operationId": "delete-customer", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Delete Customer", - "description": "This method deletes a customer.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." }, - "404": { - "description": "Returns an error indicating that the customer with given ID was not found.", - "content": { - "application/json": { + "/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_404_not_found" + "type": "string", + "example": "camp_fkZ28pe7DUAEmmabofkxHI8N" }, - "examples": { - "Customer Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find customer with id cust_7pm0hh0yemiydeFsdYXZlr1", - "request_id": "v-0ae398fd9ac683dc84", - "resource_id": "cust_7pm0hh0yemiydeFsdYXZlr1", - "resource_type": "customer" - } - } - } - } - } - } - } - }, - "put": { - "operationId": "update-customer", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Update Customer", - "description": "Updates the specified customer by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the parameters to be updated.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/9_req_update_customer" + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID or name." }, - "examples": { - "Example": { - "value": { - "name": "Alice McDonald", - "email": "alice.mdconald@email.com", - "description": "Updating customer data", - "phone": "+1 (132) 222-2222", - "address": { - "city": "New York", - "country": "United States", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 4", - "postal_code": "10001", - "state": "NY" - }, - "metadata": { - "lang": "en", - "test": true - }, - "birthdate": "2022-01-01", - "birthday": "2022-01-02" - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns a customer object if updates were successful.", - "content": { - "application/json": { + { "schema": { - "$ref": "#/components/schemas/9_obj_customer_object" + "type": "string", + "example": "ern_A2RArBE30Tkt56utVLrRv7rZ" }, - "examples": { - "Example": { - "value": { - "id": "cust_T849EgzNVVmn5icJ2FAkT2rO", - "source_id": "alice@morgan.com", - "name": "Alice McDonald", - "description": "Updating customer data", - "email": "alice.mdconald@email.com", - "phone": "+1 (132) 222-2222", - "birthday": "2022-01-02", - "birthdate": "2022-01-01", - "address": { - "city": "New York", - "state": "NY", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 4", - "country": "United States", - "postal_code": "10001" - }, - "summary": { - "redemptions": { - "total_redeemed": 2, - "total_failed": 0, - "total_succeeded": 2, - "total_rolled_back": 0, - "total_rollback_failed": 0, - "total_rollback_succeeded": 0, - "gift": { - "redeemed_amount": 0, - "amount_to_go": 0 - }, - "loyalty_card": { - "redeemed_points": 0, - "points_to_go": 4428 + "name": "earningRuleId", + "in": "path", + "required": true, + "description": "Unique earning rule ID." + } + ], + "post": { + "operationId": "disable-earning-rule", + "tags": [ + "LOYALTIES API" + ], + "summary": "Disable Earning Rule", + "description": "Disable an earning rule.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns an earning rule object with the `active` parameter set to `false`.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltiesDisableEarningRulesResponseBody" + }, + "examples": { + "Example": { + "value": { + "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", + "created_at": "2022-11-25T07:31:05.866Z", + "updated_at": "2022-11-25T14:12:57.167Z", + "loyalty": { + "points": 1, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.downgraded", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Tier Downgraded", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": false, + "object": "earning_rule", + "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", + "metadata": { + "Type": "Tier" + } } - }, - "orders": { - "total_amount": 203900, - "total_count": 2, - "average_amount": 101950, - "last_order_amount": 3900, - "last_order_date": "2022-07-26T14:59:52.814Z" } - }, - "loyalty": { - "points": 3403, - "referred_customers": 0, - "campaigns": { - "Summer Campaign": { - "points": 0, - "referred_customers": 0 - }, - "Spring Campaign": { - "points": 50, - "referred_customers": 0 - }, - "Fall Campaign": { - "points": 50, - "referred_customers": 0 - }, - "Winter Campaign": { - "points": 3303, - "referred_customers": 0 + } + } + } + }, + "404": { + "description": "Returns an error if the resource cannot be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find earning_rule with id ern_A2RArBE30Tkt56utVLrRv7r", + "request_id": "v-0c0d842ed5ce67373f", + "resource_id": "ern_A2RArBE30Tkt56utVLrRv7r", + "resource_type": "earning_rule" } } - }, - "referrals": { - "total": 0, - "campaigns": [] - }, - "metadata": { - "lang": "en", - "test": true - }, - "system_metadata": {}, - "created_at": "2022-02-07T08:28:23.644Z", - "updated_at": "2022-08-31T09:58:30.475Z", - "object": "customer" + } } } } } } }, - "404": { - "description": "Returns an error indicating that a customer with given ID was not found.", - "content": { - "application/json": { + "/v1/loyalties/members/{memberId}/rewards": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_404_not_found" + "type": "string", + "example": "MmFAzfDe" }, - "examples": { - "Example": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find customer with id alice2@morgan.com", - "request_id": "v-0b9e924dd243bf26e2", - "resource_id": "alice2@morgan.com", - "resource_type": "customer" - } + "name": "memberId", + "in": "path", + "required": true, + "description": "Unique loyalty card assigned to a particular customer." + } + ], + "get": { + "operationId": "list-member-rewards", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Member Rewards", + "description": "Retrieves the list of rewards that the given customer (identified by `member_id`, which is a loyalty card assigned to a particular customer) **can get in exchange for loyalty points**. \n\nYou can use the `affordable_only` parameter to limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). \n\nPlease note that rewards that are disabled (i.e. set to `Not Available` in the Dashboard) for a given loyalty tier reward mapping will not be returned in this endpoint.", + "parameters": [ + { + "in": "query", + "name": "affordable_only", + "description": "Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to `true` to return rewards which the customer can actually afford.", + "schema": { + "type": "boolean" } } - } - } - } - } - } - }, - "/v1/customers/{customerId}/permanent-deletion": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "customerId", - "in": "path", - "required": true, - "description": "A Voucherify customer ID or `source_id`." - } - ], - "post": { - "operationId": "delete-customer-permanently", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Delete Customer Permanently", - "description": "The organization user can remove consumer data permanently from the Voucherify system by using this API method. It d​eletes all customer data and connected resources. It makes the customer profile forgotten by Voucherify.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a permanent deletion object and status of the deletion.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/customers_permanent_deletion_response_body" - }, - "examples": { - "Example": { - "value": { - "id": "del_7k3buMvBsJuXiLRmdh1WZvZs", - "created_at": "2022-09-02T17:50:29.302Z", - "related_object_id": "cust_XI8sPLvznzVpNI1BMIWGcUJa", - "related_object": "customer", - "status": "DONE", - "data_json": { - "events": 16, - "customer_events": 28, - "daily_events": 0, - "segments": 0, - "orders": 9, - "order_events": 5, - "customer": 1 - }, - "object": "pernament_deletion" + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of rewards for the given `member_id`. Returns a filtered list if the query parameter `affordable_only` is set to `true`.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_list_member_rewards" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "reward": { + "id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", + "name": "Material Reward", + "type": "MATERIAL", + "parameters": { + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619" + } + }, + "stock": 4, + "redeemed": 1, + "attributes": { + "description": "Get a Comic Book in Archie's series." + }, + "created_at": "2022-08-17T07:46:18.619169+00:00", + "updated_at": "2022-08-17T08:13:48.30747+00:00", + "metadata": {}, + "object": "reward" + }, + "assignment": { + "id": "rewa_pJYQBXSitK2OVPK3XMXZK76X", + "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", + "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 39 + } + }, + "created_at": "2022-08-24T11:40:22.418972+00:00", + "updated_at": "2022-08-24T13:23:50.409121+00:00", + "object": "reward_assignment" + }, + "object": "loyalty_reward" + }, + { + "reward": { + "id": "rew_31M6Za6zkMRfhxYJz4aDo11h", + "name": "Pay with Points", + "type": "COIN", + "parameters": { + "coin": { + "exchange_ratio": 1, + "points_ratio": 1 + } + }, + "stock": null, + "redeemed": null, + "attributes": {}, + "created_at": "2022-06-23T11:06:06.222736+00:00", + "updated_at": null, + "metadata": null, + "object": "reward" + }, + "assignment": { + "id": "rewa_wrVYAfXWolq52gnl15dumPCq", + "reward_id": "rew_31M6Za6zkMRfhxYJz4aDo11h", + "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", + "related_object_type": "campaign", + "created_at": "2022-08-11T14:13:34.581194+00:00", + "updated_at": null, + "object": "reward_assignment" + }, + "object": "loyalty_reward" + }, + { + "reward": { + "id": "rew_Jhq0ecLGSx8eF4pFdlhFr9P6", + "name": "20% discount", + "type": "CAMPAIGN", + "parameters": { + "campaign": { + "id": "camp_4B1jDE63pCeSij3HU7gx3gPT", + "type": "DISCOUNT_COUPONS" + } + }, + "stock": null, + "redeemed": null, + "attributes": {}, + "created_at": "2022-08-11T09:52:39.032699+00:00", + "updated_at": null, + "metadata": {}, + "object": "reward" + }, + "assignment": { + "id": "rewa_nFREw86qh1LiqGPRygahNh8Z", + "reward_id": "rew_Jhq0ecLGSx8eF4pFdlhFr9P6", + "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 100 + } + }, + "created_at": "2022-08-11T14:13:34.581194+00:00", + "updated_at": null, + "object": "reward_assignment" + }, + "object": "loyalty_reward" + }, + { + "reward": { + "id": "rew_Dev2yQLodRV33UKPKHTUQWk1", + "name": "Get a product", + "type": "MATERIAL", + "parameters": { + "product": { + "id": "prod_0b2ac1dab28985cb1e", + "sku_id": null + } + }, + "stock": 1, + "redeemed": 1, + "attributes": { + "description": "Product" + }, + "created_at": "2022-06-13T10:43:15.929621+00:00", + "updated_at": "2022-08-11T15:59:30.820937+00:00", + "metadata": null, + "object": "reward" + }, + "assignment": { + "id": "rewa_SV4gMgPXTXDrsoTyqhY1B2ut", + "reward_id": "rew_Dev2yQLodRV33UKPKHTUQWk1", + "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 4000 + } + }, + "created_at": "2022-08-11T14:13:34.581194+00:00", + "updated_at": null, + "object": "reward_assignment" + }, + "object": "loyalty_reward" + }, + { + "reward": { + "id": "rew_oQEYtUNYcVe2IdBEUBdLfkCD", + "name": "Get a comic book", + "type": "MATERIAL", + "parameters": { + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "sku_id": null + } + }, + "stock": 1, + "redeemed": 2, + "attributes": { + "image_url": "https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_fPH9ohe0pZf4EiIt295sk9Ob.png", + "description": "Archie's Series" + }, + "created_at": "2022-08-11T14:35:44.694611+00:00", + "updated_at": "2022-08-17T07:52:56.965366+00:00", + "metadata": { + "Type": "GR-2" + }, + "object": "reward" + }, + "assignment": { + "id": "rewa_7HHH6TjN7Q9WDr5ZePeZUg5p", + "reward_id": "rew_oQEYtUNYcVe2IdBEUBdLfkCD", + "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 10 + } + }, + "created_at": "2022-08-11T15:44:12.789086+00:00", + "updated_at": null, + "object": "reward_assignment" + }, + "object": "loyalty_reward" + } + ], + "total": 5 + } + } + } } } } } } }, - "404": { - "description": "Returns an error indicating that a customer with given ID was not found.", - "content": { - "application/json": { + "/v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_404_not_found" + "type": "string", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find customer with id cust_W8n9I8pJDXlM69j49iKJeYp", - "request_id": "v-0b4c62635a154e96f1", - "resource_id": "cust_W8n9I8pJDXlM69j49iKJeYp", - "resource_type": "customer" - } - } - } - } - } - } - } - } - }, - "/v1/customers/importCSV": { - "post": { - "operationId": "import-customers-using-csv", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Import and Update Customers using CSV", - "description": "This API method lets you import or update customer data. To get a proper and valid response, please send a CSV file with data separated by commas. \n\n## Request Example\n\n```cURL\ncurl -X POST \\\n https://api.voucherify.io/v1/customers/importCSV \\\n -F file=@/path/to/customers.csv \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\"\n```\n## CSV File Format\n\nThe CSV file has to include headers in the first line. All properties which cannot be mapped to standard customer fields will be added to the metadata object.\n\n\n> 📘 Standard customer fields mapping\n>\n> **No spaces allowed in field names** \n> Name, Email, Phone, Birthdate, Source_id, Address_line_1, Address_line_2, Address_Postal_Code, Address_City, Address_State, Address_Country, Description, Metadata_name_1, Metadata_name_2\n\n## Update Customers using CSV\n\nIf you would like to update customer's data, you can do it using the CSV file with new data. However, remember to include a `source_id` in your CSV file to manage the update successfully.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "The file path is stored in the form `file` header.", - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/a_req_importCSV" + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " }, - "examples": {} - } - } - }, - "responses": { - "202": { - "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and customers will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { + { "schema": { - "$ref": "#/components/schemas/a_res_async_actions" + "type": "string", + "example": "rewa_hzc19a5NLyIr2bVL3UB1w0B3" }, - "examples": { - "Example": { - "value": { - "async_action_id": "aa_0a875d56c805df6601" - } - } - } + "name": "assignmentId", + "in": "path", + "required": true, + "description": "Unique reward assignment ID." } - } - } - } - } - }, - "/v1/customers/bulk/async": { - "post": { - "operationId": "update-customers-in-bulk", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Update Customers in bulk", - "description": "Update several customers in one asynchronous operation. \n\nIn one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. \n\nIf a requested customer object is not found, then an **upsert** occurs. This is reflected in the [Get Async Action](ref:get-async-action) endpoint as follows: \n\n\n```json\n{\n \"found\": false,\n \"updated\": true\n}\n```\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the customer fields that you would like to update in each customer object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/customers_update_in_bulk_request_body" - }, - "examples": { - "Example": { - "value": [ - { - "source_id": "John.Smith@email.com", - "name": "John Smith", - "email": "john.smith@email.com", - "description": "Updating customer data", - "phone": "+1 (132) 222-2222", - "address": { - "city": "New York", - "country": "United States", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 4", - "postal_code": "10001", - "state": "NY" - }, - "metadata": { - "lang": "en", - "test": true - }, - "birthday": "2022-04-04" - }, - { - "source_id": "Jane.Smith@email.com", - "name": "Jane Smith", - "email": "Jane.Smith@email.com", - "description": "Updating customer data", - "phone": "+1 (132) 222-2222", - "address": { - "city": "New York", - "country": "United States", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 4", - "postal_code": "10001", - "state": "NY" - }, - "metadata": { - "lang": "en", - "test": true - }, - "birthday": "2022-03-03" - }, - { - "source_id": "Sally.Smith@email.com", - "name": "Sally Smith", - "email": "Sally.Smith@email.com", - "description": "Updating customer data", - "phone": "+1 (132) 222-2222", - "address": { - "city": "New York", - "country": "United States", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 4", - "postal_code": "10001", - "state": "NY" - }, - "metadata": { - "lang": "en", - "test": true - }, - "birthdate": "2022-02-02" - } - ] + ], + "get": { + "operationId": "get-reward-details", + "tags": [ + "LOYALTIES API" + ], + "summary": "Get Reward Details", + "description": "Get reward details in the context of a loyalty campaign and reward assignment ID.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] } - } - } - } - }, - "responses": { - "202": { - "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and customers will be updated in the repository asynchronously. To check the update status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" + ], + "responses": { + "200": { + "description": "Returns reward details in the context of a loyalty *campaign* and reward assignment ID.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltiesGetRewardDetailsResponseBody" + }, + "examples": { + "Material": { + "value": { + "id": "rew_Dev2yQLodRV33UKPKHTUQWk1", + "name": "Get a product", + "type": "MATERIAL", + "parameters": { + "product": { + "id": "prod_0b2ac1dab28985cb1e", + "sku_id": null + } + }, + "stock": "1", + "redeemed": "1", + "attributes": { + "description": "Product" + }, + "created_at": "2022-06-13T10:43:15.929Z", + "updated_at": "2022-08-11T15:59:30.820Z", + "metadata": null, + "object": "reward" + } + }, + "Pay with Points": { + "value": { + "id": "rew_31M6Za6zkMRfhxYJz4aDo11h", + "name": "Pay with Points", + "type": "COIN", + "parameters": { + "coin": { + "exchange_ratio": 1, + "points_ratio": 1 + } + }, + "stock": null, + "redeemed": null, + "attributes": {}, + "created_at": "2022-06-23T11:06:06.222Z", + "updated_at": null, + "metadata": null, + "object": "reward" + } + }, + "Discount Coupon": { + "value": { + "id": "rew_Jhq0ecLGSx8eF4pFdlhFr9P6", + "name": "20% discount", + "type": "CAMPAIGN", + "parameters": { + "campaign": { + "id": "camp_4B1jDE63pCeSij3HU7gx3gPT", + "type": "DISCOUNT_COUPONS" + } + }, + "stock": null, + "redeemed": null, + "attributes": {}, + "created_at": "2022-08-11T09:52:39.032Z", + "updated_at": null, + "metadata": {}, + "object": "reward" + } + } + } + } + } } } } }, - "400": { - "description": "Returns an error if metadata fields are incorrect data type or a customer's source ID is missing in the request body.", - "content": { - "application/json": { + "/v1/loyalties/{campaignId}/reward-assignments": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_error_no_translation" + "type": "string", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" }, - "examples": { - "Metadata validation failed": { - "value": { - "code": 400, - "key": "metadata_validation_failed", - "message": "Metadata validation failed", - "details": "acquisition_channel: must be a string, property is required, must be equal to one of Facebook,Twitter,Website (actual value is 'true')", - "request_id": "v-0afb29d91094432cea" - } + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " + } + ], + "get": { + "operationId": "list-reward-assignments-1", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Reward Assignments", + "description": "Returns reward assignments from a given loyalty campaign.\n\n> 📘 Alternative endpoint\n>\n> This endpoint is an alternative to this [endpoint](ref:list-reward-assignments-2). The URL was re-designed to be more ontextual to the type of data returned in the response.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "example": "rewa_m9hEAu10KsPcLhGXiHG85aY0" }, - "Invalid payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Payload should have required property 'source_id'", - "request_id": "v-0ba51a2f5ec3bf76de" + "in": "query", + "name": "assignmentId", + "description": "A unique reward assignment ID." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with reward assignment objects.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_list_reward_assignments" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "rewa_2EPffrq151ArmjR7j3CumxGE", + "reward_id": "rew_6uCtsIjgcuzi4NW43mKZQWd5", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 18 + } + }, + "created_at": "2022-06-22T11:02:19.564Z", + "updated_at": null, + "object": "reward_assignment" + }, + { + "id": "rewa_75e6oBjYfIKUDbM4Dsgg6xAU", + "reward_id": "rew_gI4GYbXMeHAJUAIiZCad5LaS", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 25 + } + }, + "created_at": "2022-06-22T11:00:49.034Z", + "updated_at": null, + "object": "reward_assignment" + }, + { + "id": "rewa_dJ5nFBpmL8DVhmY1j4zYYOqF", + "reward_id": "rew_VSi5rNvb67bn2tqkNwVBBP7u", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 100 + } + }, + "created_at": "2022-06-22T10:57:24.051Z", + "updated_at": null, + "object": "reward_assignment" + }, + { + "id": "rewa_874iVl5bHrZFr2FSsG9ilKzF", + "reward_id": "rew_QQ73sIywuMoEj6L8K6ft2Mn7", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "created_at": "2022-06-22T10:47:55.934Z", + "updated_at": null, + "object": "reward_assignment" + }, + { + "id": "rewa_GgSlEk4bnR09lMMts6CgR6aV", + "reward_id": "rew_URQeO2fgbjxHnulgYVguuidX", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 9 + } + }, + "created_at": "2022-06-22T10:21:53.109Z", + "updated_at": null, + "object": "reward_assignment" + }, + { + "id": "rewa_i6VcsXr3ovJ2JCpZk9k1JOj1", + "reward_id": "rew_YNr7tRr9TPAiFEJBZBAsuKCq", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "created_at": "2022-06-22T10:18:27.684Z", + "updated_at": null, + "object": "reward_assignment" + }, + { + "id": "rewa_YjTw2InYSVx1nA88brDASS9e", + "reward_id": "rew_BUfchmIo7pOR8GrZMw0vVL08", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 30 + } + }, + "created_at": "2022-06-22T09:58:12.133Z", + "updated_at": null, + "object": "reward_assignment" + }, + { + "id": "rewa_1gJ6VyYQI0IcnEvhArbr9XFH", + "reward_id": "rew_injbwG52POgfpSogTlQl4hA6", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 10 + } + }, + "created_at": "2022-06-13T11:56:49.185Z", + "updated_at": null, + "object": "reward_assignment" + }, + { + "id": "rewa_gb6U5byuRh12EvdiL46P4Cxy", + "reward_id": "rew_NQB7WbdQLBrFQW1DZmBNcLvH", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 100 + } + }, + "created_at": "2022-06-13T11:50:23.429Z", + "updated_at": null, + "object": "reward_assignment" + }, + { + "id": "rewa_hfyF9IGez9i3z5a3Uwlkcg7S", + "reward_id": "rew_87ItIc9P5Bky10eS7vEm7Dc7", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 20 + } + }, + "created_at": "2022-06-13T11:20:43.961Z", + "updated_at": null, + "object": "reward_assignment" + } + ], + "total": 12 + } + } + } } } } } } }, - "429": { - "description": "Too Many Requests", - "content": { - "application/json": { + "/v1/loyalties/{campaignId}/rewards": { + "parameters": [ + { "schema": { - "type": "object", - "properties": { - "code": { - "type": "string", - "default": 429 - }, - "message": { - "type": "string", - "default": "Too many requests hit the API too quickly." - } - } - } + "type": "string" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " } - } - } - } - } - }, - "/v1/customers/metadata/async": { - "post": { - "operationId": "update-customers-metadata-in-bulk", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Update Customers' Metadata in bulk", - "description": "Update several customers metadata properties in one asynchronous operation. \n\nIn one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. \n\nIf a requested customer object is not found, then an **upsert** occurs. This is reflected in the [Get Async Action](ref:get-async-action) endpoint as follows: \n\n\n```json\n{\n \"found\": false,\n \"updated\": true\n}\n```\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "List the `source_ids` of the customer's you would like to update along with the metadata key value pairs.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/customers_update_metadata_in_bulk_request_body" - }, - "examples": { - "Example": { - "value": { - "source_ids": [ - "source_123", - "source_456" - ], - "metadata": { - "lang": "en", - "test": false + ], + "get": { + "operationId": "list-reward-assignments-2", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Reward Assignments", + "description": "Returns active rewards from a given loyalty campaign.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "example": "rewa_m9hEAu10KsPcLhGXiHG85aY0" + }, + "in": "query", + "name": "assignment_id", + "description": "A unique reward assignment ID." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with reward assignment objects.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_list_reward_assignments" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "rewa_6VSWcXjfm5PuZlfeuZxl5JZT", + "reward_id": "rew_pjJKIZgjIopIPZyibEAt7oPk", + "related_object_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "related_object_type": "campaign", + "created_at": "2022-08-30T08:24:32.171Z", + "updated_at": null, + "object": "reward_assignment" + }, + { + "id": "rewa_7gFZsNg8oiry63FtzML0N52R", + "reward_id": "rew_BUfchmIo7pOR8GrZMw0vVL08", + "related_object_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 3000000 + } + }, + "created_at": "2022-05-13T11:14:58.146Z", + "updated_at": null, + "object": "reward_assignment" + }, + { + "id": "rewa_eAGhQSY4FS4T3q4zMkiarHoN", + "reward_id": "rew_nIy4gHpQHle2c3pNMwuj7G6j", + "related_object_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 100 + } + }, + "created_at": "2022-02-28T11:56:55.241Z", + "updated_at": null, + "object": "reward_assignment" + } + ], + "total": 3 + } + } + } } } } } - } - } - }, - "responses": { - "202": { - "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and customers will be updated in the repository asynchronously. To check the update status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" - }, - "examples": { - "Example": { - "value": { - "async_action_id": "aa_0a875d56c805df6601" + }, + "post": { + "operationId": "create-reward-assignment-1", + "tags": [ + "LOYALTIES API" + ], + "summary": "Create Reward Assignment", + "description": "Add rewards to a loyalty campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of reward assignment objects.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_create_reward_assignment" + }, + "examples": { + "Example": { + "value": [ + { + "id": "rewa_Iw9VopmlLm0topBG17ZH1gp5", + "reward_id": "rew_wg2pvCr5LDhCq4uVQZ9LhuZm", + "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 2 + } + }, + "created_at": "2022-11-28T18:54:19.747Z", + "updated_at": null, + "object": "reward_assignment" + }, + { + "id": "rewa_tAFZ7cHiTwZyOg1QaWHt6yYv", + "reward_id": "rew_z35ffKoH0tCcck8EL56p6SIs", + "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 2 + } + }, + "created_at": "2022-11-28T18:54:19.747Z", + "updated_at": null, + "object": "reward_assignment" + } + ] + } + } } } - } - } - } - }, - "400": { - "description": "An error will be returned when submitting a request with no source IDs or missing metadata.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" }, - "examples": { - "Not enough source IDs": { - "value": { - "code": 400, - "key": "not_enough_source_ids", - "message": "Not enough source_ids", - "details": "Specify at least 1 source_id", - "request_id": "v-0ba50abf2843bf6585" - } - }, - "Invalid Payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Payload should have required property 'metadata'", - "request_id": "v-0ba50c720789984b5c" + "409": { + "description": "Returns an error if there's a reward assignment created for the given reward.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_409_duplicate_found" + }, + "examples": { + "Example": { + "value": { + "code": 409, + "key": "duplicate_found", + "message": "Duplicated resource found", + "details": "Duplicated reward_assignment exists with id rewa_50O40FgyojhUiZAs3vDQbKiC", + "request_id": "v-0c11a10ed2ce676da9", + "resource_id": "rewa_50O40FgyojhUiZAs3vDQbKiC", + "resource_type": "reward_assignment" + } + } + } } } } - } - } - } - } - } - }, - "/v1/customers/{customerId}/consents": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "customerId", - "in": "path", - "required": true, - "description": "A Voucherify unique customer identifier or source ID." - } - ], - "put": { - "operationId": "update-customers-consents", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Update Customer's consents", - "description": "Update marketing permissions for the specified customer.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "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. \n\n#### Examples\n\n\n```json\n{\n \"cnst_aIdUulAh0SCsOCaS3005y7yS\": true,\n \"cnst_aIdUulAhwewqaS31213fdsfds\": false\n}\n```\n\nOpt-out from all communication:\n\n\n```json\n{\n \"unsubscribed\": true\n}\n```", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/9_req_update_customers_consents" }, - "examples": { - "Example": { - "value": { - "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I": true, - "cnst_VCmucIvAsmDYw2PPAok6bcYy": false - } - }, - "Opt-out of all": { - "value": { - "unsubscribed": true + "requestBody": { + "description": "Define the cost of the rewards in loyalty points.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_create_reward_assignment" + }, + "examples": { + "Example": { + "value": [ + { + "reward": "rew_wg2pvCr5LDhCq4uVQZ9LhuZm", + "parameters": { + "loyalty": { + "points": 2 + } + } + }, + { + "reward": "rew_z35ffKoH0tCcck8EL56p6SIs", + "parameters": { + "loyalty": { + "points": 2 + } + } + } + ] + } + } } } } } - } - }, - "responses": { - "204": { - "description": "Returns no content if the consents were updated successfully." }, - "400": { - "description": "Returns an error if the payload is empty.", - "content": { - "application/json": { + "/v1/loyalties/{campaignId}/reward-assignments/{assignmentId}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " + }, + { "schema": { - "$ref": "#/components/schemas/e_error_no_translation" + "type": "string", + "example": "rewa_hzc19a5NLyIr2bVL3UB1w0B3" }, - "examples": { - "Example": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "The payload cannot be empty", - "request_id": "v-0ba675252cc3bf6b03" + "name": "assignmentId", + "in": "path", + "required": true, + "description": "Unique reward assignment ID." + } + ], + "get": { + "operationId": "get-reward-assignment-1", + "tags": [ + "LOYALTIES API" + ], + "summary": "Get Reward Assignment", + "description": "Retrieve specific reward assignment.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns specific reward assignment.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltiesGetRewardAssignmentResponseBody" + }, + "examples": { + "Example": { + "value": { + "id": "rewa_1gJ6VyYQI0IcnEvhArbr9XFH", + "reward_id": "rew_injbwG52POgfpSogTlQl4hA6", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 10 + } + }, + "created_at": "2022-06-13T11:56:49.185Z", + "updated_at": null, + "object": "reward_assignment" + } + } + } } } } } } - } - } - } - }, - "/client/v1/customers/{customerId}/consents#": { - "parameters": [ - { - "schema": { - "type": "string" }, - "name": "customerId", - "in": "path", - "required": true, - "description": "A Voucherify customer identifier or `source_id`" - } - ], - "put": { - "operationId": "update-customers-consents-client-side", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Update Customer's consents (client-side)", - "description": "Update marketing permissions for the specified customer.", - "parameters": [], - "security": [ - { - "X-Client-Application-Id-1": [], - "X-Client-Token-1": [] - } - ], - "requestBody": { - "description": "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. \n\n#### Examples\n\n\n```json\n{\n \"cnst_aIdUulAh0SCsOCaS3005y7yS\": true,\n \"cnst_aIdUulAhwewqaS31213fdsfds\": false\n}\n```\n\nOpt-out from all communication:\n\n\n```json\n{\n \"unsubscribed\": true\n}\n```", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/9_req_update_customers_consents" + "/v1/loyalties/{campaignId}/rewards/{assignmentId}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_0dJG7cCAjquzcxWmZ634bA0C" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " }, - "examples": { - "Example": { - "value": { - "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I": true, - "cnst_VCmucIvAsmDYw2PPAok6bcYy": false - } + { + "schema": { + "type": "string", + "example": "rewa_1gJ6VyYQI0IcnEvhArbr9XFH" }, - "Opt-out of all": { - "value": { - "unsubscribed": true - } - } + "name": "assignmentId", + "in": "path", + "required": true, + "description": "A unique reward assignment ID." } - } - } - }, - "responses": { - "204": { - "description": "Returns no content if the consents were updated successfully." - }, - "400": { - "description": "Returns an error if the payload is empty.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" + ], + "get": { + "operationId": "get-reward-assignment-2", + "tags": [ + "LOYALTIES API" + ], + "summary": "Get Reward Assignment", + "description": "Retrieve specific reward assignment.\n\n> 📘 Alternative endpoint\n>\n> This endpoint is an alternative to this [endpoint](ref:get-reward-assignment-2). ", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns specific reward assignment.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_obj_reward_assignment_object" + }, + "examples": { + "Example": { + "value": { + "id": "rewa_1gJ6VyYQI0IcnEvhArbr9XFH", + "reward_id": "rew_injbwG52POgfpSogTlQl4hA6", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 10 + } + }, + "created_at": "2022-06-13T11:56:49.185Z", + "updated_at": null, + "object": "reward_assignment" + } + } + } + } + } }, - "examples": { - "Example": { - "value": {} + "404": { + "description": "Returns an error if the reward assignment cannot be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find reward_assignment with id rewa_1gJ6VyYQI0IcnEvhArbr9XFH", + "request_id": "v-0c0be6ee648e67609b", + "resource_id": "rewa_1gJ6VyYQI0IcnEvhArbr9XFH", + "resource_type": "reward_assignment" + } + } + } + } } } } - } - } - } - } - }, - "/v1/customers/{customerId}/activities": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "customerId", - "in": "path", - "required": true, - "description": "A Voucherify customer ID or source ID of the customer who performed the activities." - } - ], - "get": { - "operationId": "list-customer-activities", - "tags": [ - "CUSTOMERS API" - ], - "summary": "List Customer Activities", - "description": "Retrieve customer activities.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/order" - }, - { - "schema": { - "type": "string" }, - "in": "query", - "name": "starting_after", - "description": "A cursor for use in pagination. `starting_after` is a date-time value that defines your place in the list based on `created_at` property from the activity object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after=2020-05-24T13:43:09.024Z in order to fetch the next page of the list." - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "starting_after_id", - "description": "By applying this filter value, you will get events starting after an event with the given ID." - }, - { - "schema": { - "enum": [ - "DISCOUNT_COUPONS", - "REFERRAL_PROGRAM", - "GIFT_VOUCHERS", - "PROMOTION", - "LOYALTY_PROGRAM" + "put": { + "operationId": "update-reward-assignment-1", + "tags": [ + "LOYALTIES API" ], - "type": "string" - }, - "in": "query", - "name": "campaign_type", - "description": "Through this parameter you can control a type of campaign by which Voucherify will filter related customer's activity. API will return only records related to that given type. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM" - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "campaign_id", - "description": "By applying this parameter you request only events related to specific campaign identified by its ID." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary with customer activities.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/9_res_list_customer_activities" + "summary": "Update Reward Assignment", + "description": "Updates rewards parameters, i.e. the points cost for the specific reward.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] } - } - } - } - } - } - }, - "/v1/customers/{customerId}/segments": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "cust_aSeH6JH52DPjYLC1G475Ii0N" - }, - "name": "customerId", - "in": "path", - "required": true, - "description": "Unique identifier of a customer represented by an internal customer ID or customer source ID." - } - ], - "get": { - "operationId": "list-customer-segments", - "tags": [ - "CUSTOMERS API" - ], - "summary": "List Customer's Segments", - "description": "Returns the list of segments IDs to which the customer belongs to. \n\nIf you pass a `customerId` which is not stored and recognized by Voucherify as an existing customer in the system, the response will generate a list of segments that the customer would potentialy qualify for if they were to become a customer tracked in the system.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "The method returns segment(s) to which the given customer belongs to.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/14_res_customers_customerId_segments" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "seg_DNAOhUtJffvX0f57ajLMFBYR", - "name": "area code not 123", - "object": "segment" - }, - { - "id": "seg_IPIYx96l92Op0Sy5MOaImhgw", - "name": "not bob.smith@email.com", - "object": "segment" - }, - { - "id": "seg_1wc52c5z6r1kQ81brO8j9Hk2", - "name": "Birthday After Dec 31", - "object": "segment" - }, - { - "id": "seg_ZEbbT4mq1ePpM9PzR02lcww2", - "name": "Start with S", - "object": "segment" - }, - { - "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt", - "name": "Loyalty Card", - "object": "segment" + ], + "responses": { + "200": { + "description": "Returns a reward assignment with an updated points value.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_obj_reward_assignment_object" + }, + "examples": { + "Example": { + "value": { + "id": "rewa_Iw9VopmlLm0topBG17ZH1gp5", + "reward_id": "rew_wg2pvCr5LDhCq4uVQZ9LhuZm", + "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 3 + } + }, + "created_at": "2022-11-28T18:54:19.747Z", + "updated_at": "2022-11-28T19:27:40.604Z", + "object": "reward_assignment" + } } - ], - "total": 5 + } + } + } + } + }, + "requestBody": { + "description": "Update the points cost for the reward assignment.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_update_reward_assignment" + }, + "examples": { + "Example": { + "value": { + "parameters": { + "loyalty": { + "points": 3 + } + } + } + } } } } } - } - } - } - } - }, - "/v1/order-object": { - "get": { - "operationId": "order-object", - "tags": [ - "ORDERS API" - ], - "summary": "Order Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Order Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/10_obj_order_object" + }, + "delete": { + "operationId": "delete-reward-assignment-1", + "tags": [ + "LOYALTIES API" + ], + "summary": "Delete Reward Assignment", + "description": "This method deletes a reward assignment for a particular loyalty campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." + }, + "404": { + "description": "Returns an error indicating that the loyalty campaign or reward assignment with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Reward Assignment Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find reward_assignment with id rewa_0b4hqJpVFssxXXrq56Ddtyo", + "request_id": "v-0ae2b69e0cd0c1364f", + "resource_id": "rewa_0b4hqJpVFssxXXrq56Ddtyo", + "resource_type": "reward_assignment" + } + }, + "Loyalty Campaign Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id Loyalty Summer Campaign", + "request_id": "v-0ae2b71e57d027e263", + "resource_id": "Loyalty Summer Campaign", + "resource_type": "campaign" + } + } + } + } + } } } } - } - } - } - }, - "/v1/orders": { - "get": { - "operationId": "list-orders", - "tags": [ - "ORDERS API" - ], - "summary": "List Orders", - "description": "Returns a list of orders.\n\n", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ] - }, - "in": "query", - "name": "order", - "description": "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." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "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.", - "content": { - "application/json": { + "/v1/loyalties/{campaignId}/members/{memberId}/redemption": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/10_res_list_orders" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "orders", - "orders": [ - { - "id": "ord_v5vupdacgud1CwUSyKqSlHuk", - "source_id": null, - "created_at": "2022-09-09T07:44:41.594Z", - "updated_at": "2022-09-09T07:44:42.331Z", - "status": "PAID", - "amount": 2700, - "discount_amount": 1243, - "items_discount_amount": 270, - "total_discount_amount": 1513, - "total_amount": 1187, - "items": [ - { - "object": "order_item", - "source_id": "prod_5h1pp1ng", - "related_object": "product", - "quantity": 1, - "amount": 700, - "discount_amount": 70, - "price": 700, - "subtotal_amount": 630, - "product": { - "name": "Shipping" - } + "type": "string" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID." + }, + { + "schema": { + "type": "string" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "A code that identifies the loyalty card." + } + ], + "post": { + "operationId": "redeem-reward-1", + "tags": [ + "LOYALTIES API" + ], + "summary": "Redeem Reward", + "description": "Exchange points from a loyalty card for a specified reward. This API method returns an assigned award in the response. It means that if a requesting customer gets a coupon code with a discount for the next order, that discount code will be visible in response as part of the reward object definition.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a redemption object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_redeem_reward" + }, + "examples": { + "Redeem Reward that adds points to a loyalty card": { + "value": { + "id": "r_0c6b3abbfe8e60a9dd", + "object": "redemption", + "date": "2023-02-06T09:07:55.514Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 1, + "result": "SUCCESS", + "order": null, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" }, - { - "object": "order_item", - "source_id": "roses_1", - "related_object": "product", - "quantity": 1, - "amount": 500, - "discount_amount": 50, - "price": 500, - "subtotal_amount": 450, - "product": { - "name": "Bouquet - Romantic Roses", - "price": 500 + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 8000, + "balance": 6887 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-11-10T06:28:59.970Z", + "updated_at": "2023-02-06T09:07:55.515Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "holder": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 9, + "redeemed_points": 1113, + "object": "list", + "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" } }, - { - "object": "order_item", - "source_id": "vase_1", - "related_object": "product", - "quantity": 1, - "amount": 1500, - "discount_amount": 150, - "price": 1500, - "subtotal_amount": 1350, - "product": { - "name": "Vase - Boho Vintage", - "price": 1500 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "object": "customer" - }, - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0baa093537528ef645": { - "date": "2022-09-09T07:44:41.695Z", - "related_object_type": "redemption", - "related_object_id": "r_0baa093537528ef645", - "stacked": [ - "r_0baa093537528ef646", - "r_0baa093537528ef647", - "r_0baa093537528ef648" - ] + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_BpytIepuSekuXXwb9qkLJfCU", + "voucher": { + "id": "v_pQZDYaH8LzoOvgh3234DqZQjGJgbPov6", + "code": "LOYALTY-CARD-zOR2sV9Q", + "campaign": "Loyalty Program", + "campaign_id": "camp_Hpt5hPTA8kSKRWGxBGw8Y0So", + "category": null, + "category_id": null, + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 1020, + "balance": 890 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/THRRj1QegAan0r5U+wRoHuFEA6FR7TrvZm8N+8cK7niF/8uAqFdVYTU1JD0/CdoSXlYqiGgz3PAFOGWFSJt8vkM50fcMtMNLsaudU+YrPDeT2HCB7o0Ts7h1FnbD85+0F7lwrbKmkGW6kub0mjCaRdJYS/axIAq4=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FTHRRj1QegAan0r5U%2BwRoHuFEA6FR7TrvZm8N%2B8cK7niF%2F8uAqFdVYTU1JD0%2FCdoSXlYqiGgz3PAFOGWFSJt8vkM50fcMtMNLsaudU%2BYrPDeT2HCB7o0Ts7h1FnbD85%2B0F7lwrbKmkGW6kub0mjCaRdJYS%2FaxIAq4%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+yREd0zRAfZY9uwtMZsl4eDd8+LeiKGVI5OzOQRpjhtV91IuEe7/SXEW8m4F2Llg2//yieX2zsP3UtWasWxw8ZkHMRSIdxfxzSdSj8ap0dI5xwKW4OE1Q6Sgsb+kZVfCKUHbwXCcd8y5a6xTpVIg97y74Ng1Vg2PY=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2ByREd0zRAfZY9uwtMZsl4eDd8%2BLeiKGVI5OzOQRpjhtV91IuEe7%2FSXEW8m4F2Llg2%2F%2FyieX2zsP3UtWasWxw8ZkHMRSIdxfxzSdSj8ap0dI5xwKW4OE1Q6Sgsb%2BkZVfCKUHbwXCcd8y5a6xTpVIg97y74Ng1Vg2PY%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-07-11T08:19:28.780Z", + "updated_at": "2023-01-25T15:44:33.500Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "redemption": { + "quantity": null, + "redeemed_quantity": 26, + "redeemed_points": 130, + "object": "list", + "url": "/v1/vouchers/LOYALTY-CARD-zOR2sV9Q/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/LOYALTY-CARD-zOR2sV9Q/publications?page=1&limit=10" + }, + "object": "voucher" + }, + "id": "rew_7ZM476Q77dH5KvHk4KzoRNvF", + "object": "reward", + "name": "Present on Loyalty Card", + "created_at": "2023-01-25T15:43:40.716Z", + "updated_at": null, + "parameters": { + "campaign": { + "id": "camp_Hpt5hPTA8kSKRWGxBGw8Y0So", + "balance": 20, + "type": "LOYALTY_PROGRAM" + } + }, + "type": "CAMPAIGN" + }, + "loyalty_card": { + "points": 1 } } }, - { - "id": "ord_3JkWC6jG0JgyRf5lO3r4IyU1", - "source_id": null, - "created_at": "2022-09-09T07:04:22.597Z", - "updated_at": "2022-09-09T07:04:23.743Z", - "status": "PAID", - "amount": 73100, - "items_discount_amount": 7310, - "total_discount_amount": 7310, - "total_amount": 65790, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 70000, - "discount_amount": 7000, - "price": 70000, - "subtotal_amount": 63000, - "product": { - "name": "Apple iPhone 12", - "price": 70000 - } + "Redeem Reward that adds credits to a gift card": { + "value": { + "id": "r_0c6b3bedf3478a0167", + "object": "redemption", + "date": "2023-02-06T09:13:08.813Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 1, + "result": "SUCCESS", + "order": null, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1600, - "discount_amount": 160, - "price": 1600, - "subtotal_amount": 1440, - "product": { - "name": "Comic Books1", - "price": 1600 + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 8000, + "balance": 6886 }, - "sku": { - "sku": "Comics1", - "price": 1600 + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-11-10T06:28:59.970Z", + "updated_at": "2023-02-06T09:13:08.814Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "holder": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 10, + "redeemed_points": 1114, + "object": "list", + "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" } }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1, - "amount": 1500, - "discount_amount": 150, - "price": 1500, - "subtotal_amount": 1350, - "product": { - "name": "Vase - Boho Vintage", - "price": 1500 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "object": "customer" - }, - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0ba9fffae90e1b2495": { - "date": "2022-09-09T07:04:22.692Z", - "related_object_type": "voucher", - "related_object_id": "v_24rljiUfdLNC9poBf0BPNmoh2txzFkLs" - } - } - }, - { - "id": "ord_HwdbziIPvUZJkIC7z74FKmPv", - "source_id": null, - "created_at": "2022-09-09T06:47:14.195Z", - "updated_at": "2022-09-09T06:47:15.369Z", - "status": "PAID", - "amount": 71600, - "discount_amount": 7160, - "total_discount_amount": 7160, - "total_amount": 64440, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1600, - "price": 1600, - "subtotal_amount": 1600, - "product": { - "name": "Comic Books1", - "price": 1600 + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" }, - "sku": { - "sku": "Comics1", - "price": 1600 - } + "assignment_id": "rewa_U554pL2BhDIDZOvZ8y9YQ9hA", + "voucher": { + "id": "v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk", + "code": "GIFT-CARD-xwc6X7Tk", + "campaign": "Gift Cards", + "campaign_id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "GIFT_VOUCHER", + "discount": null, + "gift": { + "amount": 59080, + "balance": 48780 + }, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM/aTyHCYfr7kRWb2vv08WIgY/Tv53SJGW+k2keqfsTq/Ohb5shkCN3FTFsaI8gulTp616sEGn/JJoIInIoNkO9Vd1+AfrKiAjmirCmekE6cz2SVCyNAXs=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM%2FaTyHCYfr7kRWb2vv08WIgY%2FTv53SJGW%2Bk2keqfsTq%2FOhb5shkCN3FTFsaI8gulTp616sEGn%2FJJoIInIoNkO9Vd1%2BAfrKiAjmirCmekE6cz2SVCyNAXs%3D" + }, + "barcode": { + "id": "U2FsdGVkX18vWc/qplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO/199U+zicnFNWqg/jF5ZCQW+6jO1q8=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18vWc%2FqplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO%2F199U%2BzicnFNWqg%2FjF5ZCQW%2B6jO1q8%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-07-08T09:44:33.179Z", + "updated_at": "2023-01-25T14:42:25.214Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "redemption": { + "quantity": null, + "redeemed_quantity": 7, + "redeemed_amount": 10300, + "object": "list", + "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/publications?page=1&limit=10" + }, + "object": "voucher" + }, + "id": "rew_6bvM4vnaVdbPVQxYpuN37rhH", + "object": "reward", + "name": "Present Credits on Gift Card", + "created_at": "2023-01-25T14:41:31.858Z", + "updated_at": null, + "parameters": { + "campaign": { + "id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", + "balance": 4000, + "type": "GIFT_VOUCHERS" + } + }, + "type": "CAMPAIGN" }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 70000, - "price": 70000, - "subtotal_amount": 70000, - "product": { - "name": "Apple iPhone 12", - "price": 70000 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "object": "customer" - }, - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0ba9fc0eb00e1b2230": { - "date": "2022-09-09T06:47:14.369Z", - "related_object_type": "voucher", - "related_object_id": "v_3vEprqa6tbzfhFtpjr4mDlkNchXepW7s" + "loyalty_card": { + "points": 1 } } }, - { - "id": "ord_HRluwFS2seoILUkXxWML0D7Z", - "source_id": null, - "created_at": "2022-09-09T06:44:27.383Z", - "updated_at": "2022-09-09T06:44:28.252Z", - "status": "PAID", - "amount": 71600, - "discount_amount": 100, - "total_discount_amount": 100, - "total_amount": 71500, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1600, - "price": 1600, - "subtotal_amount": 1600, - "product": { - "name": "Comic Books1", - "price": 1600 + "Redeem Reward that gives a discount coupon": { + "value": { + "id": "r_0c6b3ca77e0e60b534", + "object": "redemption", + "date": "2023-02-06T09:16:18.808Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 2, + "result": "SUCCESS", + "order": null, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" }, - "sku": { - "sku": "Comics1", - "price": 1600 - } + "object": "customer" }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 70000, - "price": 70000, - "subtotal_amount": 70000, - "product": { - "name": "Apple iPhone 12", - "price": 70000 + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 8000, + "balance": 6884 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-11-10T06:28:59.970Z", + "updated_at": "2023-02-06T09:16:18.809Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "holder": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 11, + "redeemed_points": 1116, + "object": "list", + "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" } - } - ], - "metadata": {}, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "object": "customer" - }, - "referrer": { - "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", - "object": "customer" - }, - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", - "object": "order", - "redemptions": { - "r_0ba9fb6bb7928ed9ec": { - "date": "2022-09-09T06:44:27.486Z", - "related_object_type": "voucher", - "related_object_id": "v_vhHuiEmZSchWHtE0xKm0HM7PFCR9cNkA", - "related_object_parent_id": "camp_rRsfatlwN7unSeUIJDCYedal" + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_0ZwLAHgeU9IrI2V1ofYRmW7g", + "voucher": { + "id": "v_a3Ba1neDwPa3rBE0HkDd0C7CbiehBulo", + "code": "HAPPY-ORDERctb", + "campaign": "$20 off the entire order", + "campaign_id": "camp_5h0wc453_4", + "category": null, + "category_id": "cat_0b688929a2476386a6", + "categories": [], + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 2000, + "effect": "APPLY_TO_ORDER" + }, + "gift": null, + "loyalty_card": null, + "start_date": "2022-09-20T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "7d646e7d-9b5a-40b6-a44e-6bae848e108e", + "url": "https://dl.voucherify.io/api/v1/assets/qr/7d646e7d-9b5a-40b6-a44e-6bae848e108e" + }, + "barcode": { + "id": "dfb3e48d-ce4f-4187-a114-483feb4ca88d", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/dfb3e48d-ce4f-4187-a114-483feb4ca88d" + } + }, + "is_referral_code": false, + "created_at": "2023-02-06T09:16:18.845Z", + "updated_at": null, + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/HAPPY-ORDERctb/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/HAPPY-ORDERctb/publications?page=1&limit=10" + }, + "object": "voucher" + }, + "id": "rew_MF4hKh1IKYgJkPjbcFbH94Ho", + "object": "reward", + "name": "Digital Present", + "created_at": "2023-01-25T12:16:44.557Z", + "updated_at": null, + "parameters": { + "campaign": { + "id": "camp_5h0wc453_4", + "type": "DISCOUNT_COUPONS" + } + }, + "type": "CAMPAIGN" + }, + "loyalty_card": { + "points": 2 } } }, - { - "id": "ord_Qg5utCohAZ3tafYvc1O4C80r", - "source_id": null, - "created_at": "2022-09-09T06:42:34.083Z", - "updated_at": "2022-09-09T06:42:35.169Z", - "status": "PAID", - "amount": 70000, - "discount_amount": 4000, - "total_discount_amount": 4000, - "total_amount": 66000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 70000, - "price": 70000, - "subtotal_amount": 70000, - "product": { - "name": "Apple iPhone 12", - "price": 70000 + "Redeem a Material reward of a SKU type": { + "value": { + "id": "r_0c6b3d1357878a0813", + "object": "redemption", + "date": "2023-02-06T09:18:09.246Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 6, + "result": "SUCCESS", + "order": null, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 8000, + "balance": 6878 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-11-10T06:28:59.970Z", + "updated_at": "2023-02-06T09:18:09.247Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "holder": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 12, + "redeemed_points": 1122, + "object": "list", + "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" } - } - ], - "metadata": {}, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "object": "customer" - }, - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0ba9fafd11d28ed999": { - "date": "2022-09-09T06:42:34.183Z", - "related_object_type": "voucher", - "related_object_id": "v_RaMaTT7F0Q47BetdGcFxsyqwo1aZGzJs", - "related_object_parent_id": "camp_hg7ajfHh6DcE1xa18mw3SdF6" - } - } - }, - { - "id": "ord_G9LBb5SOPa36pHdwxUvzkw4P", - "source_id": null, - "created_at": "2022-09-09T06:38:17.984Z", - "updated_at": "2022-09-09T06:38:19.064Z", - "status": "PAID", - "amount": 4600, - "items_discount_amount": 300, - "total_discount_amount": 300, - "total_amount": 4300, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1600, - "price": 1600, - "subtotal_amount": 1600, + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_gfpRNkOT0pwzF7P5tXWXOs4H", "product": { - "name": "Comic Books1", - "price": 1600 + "id": "prod_5h0wc453_2", + "source_id": "jonah-nystrom-bourbon", + "name": "Johan & Nyström - Bourbon", + "price": null, + "attributes": [ + "categories", + "description", + "weight" + ], + "metadata": { + "company": "Johan & Nyström", + "showcase": true + }, + "image_url": null, + "created_at": "2021-12-01T08:00:49.418Z", + "updated_at": null, + "object": "product" }, "sku": { - "sku": "Comics1", - "price": 1600 - } + "id": "sku_0a3efc9044dd121803", + "source_id": "jonah-nystrom-bourbon-250g", + "product_id": "prod_5h0wc453_2", + "sku": "250g", + "price": 1750, + "currency": null, + "attributes": { + "categories": "Coffee, Whole Bean", + "description": "Background for this blend comes from the longing for a real dark roasting of high-quality coffee beans. Although the beans are dark roasted, they keep their clear and intense aroma. This coffee has a smoky flavour with a slight hint of sweetness and loads of fruit notes. Thanks to the experience in the dark roasting of coffee, the beans still retain most of their aromas. Its aftertaste is clear and remains for a long time. This coffee is perfect for a Dripper, French Press, Moka coffee maker and the traditional espresso brewing method.", + "weight": 250 + }, + "image_url": null, + "metadata": {}, + "created_at": "2021-12-01T08:00:49.427Z", + "updated_at": null, + "object": "sku" + }, + "id": "rew_SfQCsap5R8UBTVbdMTRx10x8", + "object": "reward", + "name": "Present - SKU", + "created_at": "2023-01-25T12:10:16.060Z", + "updated_at": "2023-01-25T12:10:59.662Z", + "parameters": { + "product": { + "id": "prod_5h0wc453_2", + "sku_id": "sku_0a3efc9044dd121803" + } + }, + "type": "MATERIAL" }, - { - "object": "order_item", - "product_id": "prod_0a65b3ff8592d7a5b5", - "quantity": 1, - "amount": 3000, - "discount_amount": 300, - "price": 3000, - "subtotal_amount": 2700, - "product": { - "name": "Koffee Cup", - "price": 3000 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "object": "customer" - }, - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0ba9fa02fcd28ed8f1": { - "date": "2022-09-09T06:38:18.099Z", - "related_object_type": "voucher", - "related_object_id": "v_KqP2NOSb4dJb1D6UBhcq7ScPZXun0y40", - "related_object_parent_id": "camp_hC2GdqYtOmTT45zfhib62cK1" + "loyalty_card": { + "points": 6 } } }, - { - "id": "ord_N3YBowDTZs0UH2hHoMZLbUDN", - "source_id": null, - "created_at": "2022-09-09T06:18:31.459Z", - "updated_at": "2022-09-09T06:18:31.624Z", - "status": "PAID", - "amount": 71600, - "discount_amount": 7160, - "total_discount_amount": 7160, - "total_amount": 64440, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 70000, - "price": 70000, - "subtotal_amount": 70000, - "product": { - "name": "Apple iPhone 12", - "price": 70000 + "Redeem a Material Reward of a Product Type": { + "value": { + "id": "r_0c6b3d8c35546f8673", + "object": "redemption", + "date": "2023-02-06T09:20:13.013Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 4, + "result": "SUCCESS", + "order": null, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@voucherify.io", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 8000, + "balance": 6874 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-11-10T06:28:59.970Z", + "updated_at": "2023-02-06T09:20:13.014Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "holder": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 13, + "redeemed_points": 1126, + "object": "list", + "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" } }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1600, - "price": 1600, - "subtotal_amount": 1600, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@voucherify.io", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_LRx3Y1iHFWTt217NVrknkpi5", "product": { - "name": "Comic Books1", - "price": 1600 + "id": "prod_0b2c2ddf35150b83bb", + "source_id": "97", + "name": "[Sample] Tiered Wire Basket", + "price": 11995, + "attributes": [], + "metadata": { + "source": "bigcommerce", + "bigcommerce_product_categories": [ + 21, + 23 + ] + }, + "image_url": null, + "created_at": "2022-06-03T13:36:16.084Z", + "updated_at": "2022-06-07T09:10:44.644Z", + "object": "product" }, - "sku": { - "sku": "Comics1", - "price": 1600 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", - "object": "customer" - }, - "customer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0ba9f57c37128ed639": { - "date": "2022-09-09T06:18:31.516Z", - "related_object_type": "promotion_tier", - "related_object_id": "promo_CQonGnrsFAdEJfJQ3oKB3a8G", - "related_object_parent_id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0" + "id": "rew_EPx1hCTpqzF0HW1z9NKckZH4", + "object": "reward", + "name": "Present", + "created_at": "2022-06-13T06:59:01.694Z", + "updated_at": "2023-02-03T15:04:14.102Z", + "parameters": { + "product": { + "id": "prod_0b2c2ddf35150b83bb", + "sku_id": null + } + }, + "type": "MATERIAL" + }, + "loyalty_card": { + "points": 4 } } }, - { - "id": "ord_3R6vsxRZRkND8rpe0rAn9Agc", - "source_id": null, - "created_at": "2022-09-05T08:13:13.720Z", - "updated_at": "2022-09-05T08:13:14.498Z", - "status": "PAID", - "amount": 74000, - "items_discount_amount": 1500, - "total_discount_amount": 1500, - "total_amount": 72500, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 70000, - "price": 70000, - "subtotal_amount": 70000, - "product": { - "name": "Apple iPhone 12", - "price": 70000 + "Redeem Pay with Points Reward": { + "value": { + "id": "r_0c6b4142ecc78a21d0", + "object": "redemption", + "date": "2023-02-06T09:36:26.547Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 2300, + "result": "SUCCESS", + "order": { + "id": "ord_QBnrJlVWA2EEiZoKOptFROnp", + "source_id": null, + "created_at": "2023-02-06T09:36:26.503Z", + "updated_at": null, + "status": "PAID", + "amount": 45000, + "discount_amount": 45000, + "total_discount_amount": 45000, + "total_amount": 0, + "applied_discount_amount": 45000, + "total_applied_discount_amount": 45000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0c5d6689b39320059b", + "quantity": 1, + "product": { + "id": "prod_0c5d6689b39320059b", + "source_id": "prod_anJ03RZZq74z4v", + "name": "Apple iPhone 8" + } + }, + { + "object": "order_item", + "product_id": "prod_0b2c36568000039138", + "quantity": 2, + "amount": 45000, + "price": 22500, + "subtotal_amount": 45000, + "product": { + "id": "prod_0b2c36568000039138", + "source_id": "86", + "name": "[Sample] Able Brewing System", + "price": 22500 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c6b4142ecc78a21d0": { + "date": "2023-02-06T09:36:26.547Z", + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + } } }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 2, - "amount": 3000, - "discount_amount": 500, - "price": 1500, - "subtotal_amount": 2500, - "product": { - "name": "Vase - Boho Vintage", - "price": 1500 - } + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" }, - { - "object": "order_item", - "product_id": "prod_0b72b00ffed198e344", - "quantity": 2, - "amount": 1000, - "discount_amount": 1000, - "price": 500, - "subtotal_amount": 0, - "product": { - "name": "Bouquet - Romantic Roses", - "price": 500 + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 8000, + "balance": 4574 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-11-10T06:28:59.970Z", + "updated_at": "2023-02-06T09:36:26.548Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "holder": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 14, + "redeemed_points": 3426, + "object": "list", + "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" } - } - ], - "metadata": {}, - "customer": { - "id": "cust_CSnYd37MXmrbS19XCrghjBsv", - "object": "customer" - }, - "customer_id": "cust_CSnYd37MXmrbS19XCrghjBsv", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0ba4e961444579711a": { - "date": "2022-09-05T08:13:13.873Z", - "related_object_type": "voucher", - "related_object_id": "v_hwySVBBk6YmMD4GzZHJzke1Fxo3QO7kP", - "related_object_parent_id": "camp_Uji5a53s5wRSUHqznncTkhHh" + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", + "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "object": "reward", + "name": "100 = $20", + "created_at": "2022-11-10T06:28:39.582Z", + "updated_at": null, + "parameters": { + "coin": { + "exchange_ratio": 20, + "points_ratio": 100 + } + }, + "type": "COIN" + }, + "loyalty_card": { + "points": 2300 } } }, - { - "id": "ord_7bqlkoHyEJCQuxVZpKfZYNeA", - "source_id": null, - "created_at": "2022-09-02T17:12:13.213Z", - "updated_at": "2022-09-02T17:12:13.969Z", - "status": "PAID", - "amount": 292400, - "items_discount_amount": 900, - "total_discount_amount": 900, - "total_amount": 291500, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 4, - "amount": 6400, - "price": 1600, - "subtotal_amount": 6400, - "product": { - "name": "Comic Books1", - "price": 1600 + "Redeem Pay with Points Reward with a specific amount of points": { + "value": { + "id": "r_0c6b423368146fa4bb", + "object": "redemption", + "date": "2023-02-06T09:40:32.800Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 100, + "result": "SUCCESS", + "order": { + "id": "ord_1L67XS8EYDDp5A4B3k62G2tr", + "source_id": null, + "created_at": "2023-02-06T09:40:32.784Z", + "updated_at": null, + "status": "PAID", + "amount": 45000, + "discount_amount": 2000, + "total_discount_amount": 2000, + "total_amount": 43000, + "applied_discount_amount": 2000, + "total_applied_discount_amount": 2000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0c5d6689b39320059b", + "quantity": 1, + "product": { + "id": "prod_0c5d6689b39320059b", + "source_id": "prod_anJ03RZZq74z4v", + "name": "Apple iPhone 8" + } + }, + { + "object": "order_item", + "product_id": "prod_0b2c36568000039138", + "quantity": 2, + "amount": 45000, + "price": 22500, + "subtotal_amount": 45000, + "product": { + "id": "prod_0b2c36568000039138", + "source_id": "86", + "name": "[Sample] Able Brewing System", + "price": 22500 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c6b423368146fa4bb": { + "date": "2023-02-06T09:40:32.800Z", + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + } + } + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 8500, + "balance": 4974 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" + } }, - "sku": { - "sku": "Comics1", - "price": 1600 + "is_referral_code": false, + "created_at": "2022-11-10T06:28:59.970Z", + "updated_at": "2023-02-06T09:40:32.801Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "holder": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 15, + "redeemed_points": 3526, + "object": "list", + "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" } }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 4, - "amount": 6000, - "price": 1500, - "subtotal_amount": 6000, - "product": { - "name": "Vase - Boho Vintage", - "price": 1500 - } + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", + "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "object": "reward", + "name": "100 = $20", + "created_at": "2022-11-10T06:28:39.582Z", + "updated_at": null, + "parameters": { + "coin": { + "exchange_ratio": 20, + "points_ratio": 100 + } + }, + "type": "COIN" }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 4, - "amount": 280000, - "discount_amount": 900, - "price": 70000, - "subtotal_amount": 279100, - "product": { - "name": "Apple iPhone 12", - "price": 70000 - } + "loyalty_card": { + "points": 100 } - ], - "metadata": {}, - "customer": { - "id": "cust_CSnYd37MXmrbS19XCrghjBsv", - "object": "customer" + } + } + } + } + } + }, + "404": { + "description": "Returns an error if the campaign was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Campaign Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id :campaignId", + "request_id": "v-0c6b39288084e3435a", + "resource_id": ":campaignId", + "resource_type": "campaign" + } + } + } + } + } + } + }, + "requestBody": { + "description": "Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_redeem_reward" + }, + "examples": { + "Pay with Points": { + "value": { + "reward": { + "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "points": 100 }, - "customer_id": "cust_CSnYd37MXmrbS19XCrghjBsv", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0ba187f9bb45792c13": { - "date": "2022-09-02T17:12:13.293Z", - "related_object_type": "voucher", - "related_object_id": "v_pg6DhwhmeZASoSoJ15PdzMT9MhsPjYuc", - "related_object_parent_id": "camp_W8DJVd8J0btqXT6FBwn7BSkC" - } + "order": { + "items": [ + { + "product_id": "prod_0c5d6689b39320059b", + "quantity": "1" + }, + { + "product_id": "prod_0b2c36568000039138", + "quantity": "2" + } + ] } - }, - { - "id": "ord_7HwbJiHmS07O7FsVAtjJcuRS", - "source_id": null, - "created_at": "2022-09-02T17:08:37.794Z", - "updated_at": "2022-09-02T17:08:38.879Z", - "status": "PAID", - "amount": 223900, - "items_discount_amount": 900, - "total_discount_amount": 900, - "total_amount": 223000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 4, - "amount": 6400, - "discount_amount": 300, - "price": 1600, - "subtotal_amount": 6100, - "product": { - "name": "Comic Books1", - "price": 1600 + } + } + } + } + } + } + } + }, + "/v1/loyalties/members/{memberId}/redemption": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "MmFAzfDe" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "Unique loyalty card assigned to a particular customer." + } + ], + "post": { + "operationId": "redeem-reward", + "tags": [ + "LOYALTIES API" + ], + "summary": "Redeem Reward", + "description": "\n> 📘 Alternative endpoint\n>\n> This endpoint is an alternative to this [endpoint](ref:redeem-reward-1). The URL was re-designed to allow you to redeem a reward without having to provide the `campaignId` as a path parameter.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a redemption object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_redeem_reward" + }, + "examples": { + "Redeem Pay with Points Reward with a specific number of Points": { + "value": { + "id": "r_0c6b4bf721439bf02b", + "object": "redemption", + "date": "2023-02-06T10:23:12.517Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 100, + "result": "SUCCESS", + "order": { + "id": "ord_71Ayjxq2gFV80v3OP3qrxh37", + "source_id": null, + "created_at": "2023-02-06T10:23:12.485Z", + "updated_at": null, + "status": "PAID", + "amount": 45000, + "discount_amount": 2000, + "total_discount_amount": 2000, + "total_amount": 43000, + "applied_discount_amount": 2000, + "total_applied_discount_amount": 2000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0c5d6689b39320059b", + "quantity": 1, + "product": { + "id": "prod_0c5d6689b39320059b", + "source_id": "prod_anJ03RZZq74z4v", + "name": "Apple iPhone 8" + } + }, + { + "object": "order_item", + "product_id": "prod_0b2c36568000039138", + "quantity": 2, + "amount": 45000, + "price": 22500, + "subtotal_amount": 45000, + "product": { + "id": "prod_0b2c36568000039138", + "source_id": "86", + "name": "[Sample] Able Brewing System", + "price": 22500 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" }, - "sku": { - "sku": "Comics1", - "price": 1600 + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c6b4bf721439bf02b": { + "date": "2023-02-06T10:23:12.517Z", + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + } } }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 3, - "amount": 210000, - "discount_amount": 300, - "price": 70000, - "subtotal_amount": 209700, - "product": { - "name": "Apple iPhone 12", - "price": 70000 - } + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 5, - "amount": 7500, - "discount_amount": 300, - "price": 1500, - "subtotal_amount": 7200, - "product": { - "name": "Vase - Boho Vintage", - "price": 1500 + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 9000, + "balance": 5374 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-11-10T06:28:59.970Z", + "updated_at": "2023-02-06T10:23:12.517Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "holder": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 16, + "redeemed_points": 3626, + "object": "list", + "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" } + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", + "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "object": "reward", + "name": "100 = $20", + "created_at": "2022-11-10T06:28:39.582Z", + "updated_at": null, + "parameters": { + "coin": { + "exchange_ratio": 20, + "points_ratio": 100 + } + }, + "type": "COIN" + }, + "loyalty_card": { + "points": 100 } - ], - "metadata": {}, - "customer": { - "id": "cust_CSnYd37MXmrbS19XCrghjBsv", - "object": "customer" + } + } + } + } + } + }, + "400": { + "description": "Returns an error indicating that a reward is missing.", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/e_400_missing_reward" }, - "customer_id": "cust_CSnYd37MXmrbS19XCrghjBsv", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0ba1872762c5792b73": { - "date": "2022-09-02T17:08:37.899Z", - "related_object_type": "voucher", - "related_object_id": "v_yQydppWWJpSUuGNEWJ4I2upFGY2Ma4IY", - "related_object_parent_id": "camp_A5L21BD4cJii28882owYBqTV" - } + { + "$ref": "#/components/schemas/e_400_missing_order" + }, + { + "$ref": "#/components/schemas/e_400_loyalty_card_points_exceeded" + } + ] + } + } + } + }, + "404": { + "description": "Returns an error indicating a resource was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Member Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id :memberId", + "request_id": "v-0c6b4b525d8e40cf3e", + "resource_id": ":memberId", + "resource_type": "voucher" } } - ], - "total": 441 + } } } } - } - } - } - } - }, - "post": { - "operationId": "create-order", - "tags": [ - "ORDERS API" - ], - "summary": "Create Order", - "description": "Creates an order object and triggers an order creation event. ", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the order parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/10_req_create_order" }, - "examples": { - "Example": { - "value": { - "amount": 20000, - "customer": { - "source_id": "sample_customer" + "requestBody": { + "description": "Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_redeem_reward" }, - "status": "PAID", - "items": [ - { - "quantity": 1, - "price": 20000, - "source_id": "sample product1", - "related_object": "product", - "product": { - "metadata": { - "key": "value" + "examples": { + "Pay with Points": { + "value": { + "reward": { + "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "points": 100 + }, + "order": { + "items": [ + { + "product_id": "prod_0c5d6689b39320059b", + "quantity": "1" + }, + { + "product_id": "prod_0b2c36568000039138", + "quantity": "2" + } + ] } } } - ] + } } + } + } + } + }, + "/v1/loyalties/{campaignId}/tiers": { + "parameters": [ + { + "schema": { + "type": "string" }, - "Example 2": { - "value": { - "source_id": "new", - "status": "FULFILLED", - "metadata": { - "location_id": [ - "L1", - "L2" - ], - "payment_mean": [ - "paypal", - "credit-card" - ] - }, - "customer": { - "source_id": "bob.smith.1@email.com", - "name": "Bob Smith", - "description": "A nice customer", - "email": "bob.smith.1@email.com", - "phone": "+1 933 222 3333", - "address": { - "city": "New York", - "country": "United Statese", - "line_1": "123 Main St", - "line_2": "APT 3 BLG 4", - "postal_code": "10001", - "state": "NY" - }, - "metadata": { - "lang": "en", - "test": false - }, - "birthdate": "2022-01-02" - }, - "referrer": { - "source_id": "jane.smith@email.com", - "name": "Jane Smith", - "description": "A really nice customer", - "email": "jane.smith@email.com", - "phone": "+1 933 222 3334", - "address": { - "city": "New York", - "country": "United States", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 4", - "postal_code": "10001", - "state": "NY" - }, - "metadata": { - "lang": "en", - "test": false - }, - "birthday": "2022-03-03" - }, - "items": [ - { - "source_id": "prod_1", - "related_object": "product", - "quantity": 2, - "product": { - "name": "Apple iPhone 12", - "price": 60000, - "metadata": { - "color": [ - "purple" - ], - "vendor": "mall" - }, - "override": true - } - }, - { - "source_id": "ComicBook_1", - "related_object": "sku", - "quantity": 1, - "product": { - "source_id": "Books", - "name": "Comic Books1", - "price": 2100, - "metadata": { - "color": [ - "silver" - ], - "vendor": "Bookstore1" - }, - "override": true - }, - "sku": { - "sku": "Comics1", - "source_id": "ComicBook_1", - "price": 1700, - "metadata": { - "color": [ - "golden" + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique loyalty campaign ID or name." + } + ], + "get": { + "operationId": "list-loyalty-tiers", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Loyalty Tiers", + "description": "Retrieve a list of loyalty tiers which were added to the loyalty program.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + }, + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of loyalty tier objects.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltiesListTiersResponseBody" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "ltr_30KHciA0UG8B71Fo51GZqwgN", + "name": "Bottom", + "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "metadata": {}, + "created_at": "2022-11-10T12:20:52.755Z", + "updated_at": "2022-11-25T11:27:58.616Z", + "earning_rules": { + "ern_95aq3JaE5A8xzHjoJPYNRqXZ": { + "type": "MULTIPLY", + "multiplier": 1 + }, + "ern_raVUcdXruvXGuzm682ESrAzt": { + "type": "CUSTOM", + "points": 5 + } + }, + "rewards": { + "rewa_t88DnSdNnE0IzQX6gqH3jHGQ": { + "type": "MULTIPLY", + "multiplier": 4 + } + }, + "config": { + "points": { + "from": 1, + "to": 249 + } + }, + "points": { + "from": 1, + "to": 249 + }, + "object": "loyalty_tier" + }, + { + "id": "ltr_pudTGWasuIqxdiDM0go31OV1", + "name": "Middle", + "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "metadata": {}, + "created_at": "2022-11-10T12:20:52.755Z", + "updated_at": "2022-11-25T11:27:58.579Z", + "earning_rules": { + "ern_95aq3JaE5A8xzHjoJPYNRqXZ": { + "type": "MULTIPLY", + "multiplier": 2 + } + }, + "rewards": {}, + "config": { + "points": { + "from": 250, + "to": 499 + } + }, + "points": { + "from": 250, + "to": 499 + }, + "object": "loyalty_tier" + }, + { + "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2", + "name": "Tier 1 - Top", + "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "metadata": { + "has_funds": true + }, + "created_at": "2022-11-09T06:26:54.797Z", + "updated_at": "2022-11-25T11:27:58.578Z", + "earning_rules": { + "ern_95aq3JaE5A8xzHjoJPYNRqXZ": { + "type": "MULTIPLY", + "multiplier": 3 + }, + "ern_AdlWO2yt6b6llWsibIdiRXVE": { + "type": "MULTIPLY", + "multiplier": 5 + }, + "ern_HnRXyJHoj3E79r3KUWhgMgtD": { + "type": "MULTIPLY", + "multiplier": 3 + }, + "ern_raVUcdXruvXGuzm682ESrAzt": { + "type": "CUSTOM", + "points": 200 + } + }, + "rewards": { + "rewa_Or6gWZ5ASuGkBLjOf0IyiD4k": { + "type": "CUSTOM", + "points": 300 + } + }, + "config": { + "points": { + "from": 500, + "to": 1000 + } + }, + "points": { + "from": 500, + "to": 1000 + }, + "object": "loyalty_tier" + } ], - "vendor": "islands" - }, - "override": true + "total": 3 + } } } - ] + } + } + } + } + }, + "post": { + "operationId": "create-loyalty-tiers", + "tags": [ + "LOYALTIES API" + ], + "summary": "Create loyalty tiers", + "description": "Creates loyalty tiers for desired campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns created loyalty tiers.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltiesCreateTiersResponseBody" + } + } + } + } + }, + "requestBody": { + "description": "Provide tier definitions you want to add to existing loyalty campaign.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltiesCreateTiersRequestBody" + } } } } } - } - }, - "responses": { - "200": { - "description": "Returns an order object if the operation succeeded.", - "content": { - "application/json": { + }, + "/v1/loyalties/{campaignId}/tiers/{tierId}": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/10_obj_order_object_no_discount_calculations" - }, - "examples": { - "Example": { - "value": { - "id": "ord_cRKOEXiBOj0EZKF7g9n6l0eH", - "source_id": "new", - "created_at": "2022-09-09T09:20:01.660Z", - "updated_at": "2022-09-09T09:24:43.604Z", - "status": "FULFILLED", - "amount": 121700, - "total_amount": 121700, - "items": [ - { - "object": "order_item", - "source_id": "prod_1", - "related_object": "product", - "quantity": 2, - "amount": 120000, - "price": 60000, - "subtotal_amount": 120000, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", + "type": "string", + "example": "camp_fkZ28pe7DUAEmmabofkxHI8N" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique loyalty campaign ID or name." + }, + { + "schema": { + "type": "string", + "example": "ltr_30KHciA0UG8B71Fo51GZqwgN" + }, + "name": "tierId", + "in": "path", + "required": true, + "description": "Unique loyalty tier ID." + } + ], + "get": { + "operationId": "get-loyalty-tier", + "tags": [ + "LOYALTIES API" + ], + "summary": "Get Loyalty Tier", + "description": "Retrieve a loyalty tier from a loyalty campaign by the loyalty tier ID.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a loyalty tier object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltyTier" + }, + "examples": { + "Example": { + "value": { + "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2", + "name": "Tier 1 - Top", + "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", "metadata": { - "color": [ - "purple" - ], - "vendor": "mall" + "has_funds": true }, - "price": 60000 - } - }, - { - "object": "order_item", - "source_id": "ComicBook_1", - "related_object": "sku", - "product_id": "prod_0b7d7dfb05cbe5c616", - "quantity": 1, - "amount": 1700, - "price": 1700, - "subtotal_amount": 1700, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "metadata": { - "color": [ - "silver" - ], - "vendor": "Bookstore1" + "created_at": "2022-11-09T06:26:54.797Z", + "updated_at": "2022-11-25T11:27:58.578Z", + "earning_rules": { + "ern_95aq3JaE5A8xzHjoJPYNRqXZ": { + "type": "MULTIPLY", + "multiplier": 3 + }, + "ern_AdlWO2yt6b6llWsibIdiRXVE": { + "type": "MULTIPLY", + "multiplier": 5 + }, + "ern_HnRXyJHoj3E79r3KUWhgMgtD": { + "type": "MULTIPLY", + "multiplier": 3 + }, + "ern_raVUcdXruvXGuzm682ESrAzt": { + "type": "CUSTOM", + "points": 200 + } }, - "price": 2100 - }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "metadata": { - "color": [ - "golden" - ], - "vendor": "islands" + "rewards": { + "rewa_Or6gWZ5ASuGkBLjOf0IyiD4k": { + "type": "CUSTOM", + "points": 300 + } + }, + "config": { + "points": { + "from": 500, + "to": 1000 + } + }, + "points": { + "from": 500, + "to": 1000 }, - "price": 1700 + "object": "loyalty_tier" + } + } + } + } + } + } + } + } + }, + "/v1/loyalties/members/{memberId}/tiers": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "MmFAzfDe" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "Unique loyalty card assigned to a particular customer." + } + ], + "get": { + "operationId": "get-member-loyalty-tier", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Member's Loyalty Tiers", + "description": "Retrieve member tiers using the loyalty card ID.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a data array containing the member's loyalty tiers.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltiesListMemberLoyaltyTiersResponseBody" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2", + "name": "Tier 1 - Top", + "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "metadata": { + "has_funds": true + }, + "created_at": "2022-11-09T06:26:54.797Z", + "updated_at": "2022-11-25T11:27:58.578Z", + "earning_rules": { + "ern_95aq3JaE5A8xzHjoJPYNRqXZ": { + "type": "MULTIPLY", + "multiplier": 3 + }, + "ern_AdlWO2yt6b6llWsibIdiRXVE": { + "type": "MULTIPLY", + "multiplier": 5 + }, + "ern_HnRXyJHoj3E79r3KUWhgMgtD": { + "type": "MULTIPLY", + "multiplier": 3 + }, + "ern_raVUcdXruvXGuzm682ESrAzt": { + "type": "CUSTOM", + "points": 200 + } + }, + "rewards": { + "rewa_Or6gWZ5ASuGkBLjOf0IyiD4k": { + "type": "CUSTOM", + "points": 300 + } + }, + "config": { + "points": { + "from": 500, + "to": 1000 + } + }, + "points": { + "from": 500, + "to": 1000 + }, + "expiration": { + "customer_id": "cust_qBwHpagDOFu71Z3F22UzR80X", + "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "tier_id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2", + "start_date": "2022-11-10", + "expiration_date": "2023-02-28", + "created_at": "2022-11-09T11:26:26.719Z", + "updated_at": "2022-11-10T08:54:47.200Z" + }, + "object": "loyalty_tier" + } + ], + "total": 1 + } + } + } + } + } + } + } + } + }, + "/v1/loyalties/{campaignId}/tiers/{tierId}/earning-rules": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID or name." + }, + { + "schema": { + "type": "string", + "example": "ltr_mtWowJBBhVYnY8oXaLJ2tUnk" + }, + "name": "tierId", + "in": "path", + "required": true, + "description": "Unique tier ID." + } + ], + "get": { + "operationId": "list-loyalty-tier-earning-rules", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Loyalty Tier Earning Rules", + "description": "Retrieve available earning rules for a given tier and the calculation method for earning points.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of earning rules for a given tier. The object for each earning rule also contains information about how the points are calculated; this includes mapping. If a specific multiplier was used to calculate points for a given tier, then the `loyalty.points` parameter will account for this calculation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltiesListLoyaltyTierEarningRulesResponseBody" + }, + "examples": { + "example-1": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "ern_95aq3JaE5A8xzHjoJPYNRqXZ", + "created_at": "2022-11-09T06:26:54.332Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 1, + "points": 300, + "property": "customer_life_time_value" + } + } + }, + "event": "customer.loyalty.tier.joined", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Tier Joined", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_bfi69WIbztany4iX6prkKbGN", + "metadata": { + "Type": "Joined Any" + } + }, + { + "id": "ern_HnRXyJHoj3E79r3KUWhgMgtD", + "created_at": "2022-11-10T12:25:12.927Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 300, + "type": "FIXED" + }, + "segment": { + "id": "seg_n3vVcU5t0m3rs4rEPr3C1oU5" + }, + "event": "customer.segment.entered", + "source": { + "banner": "New Customers", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_0gv3v7jQG5U6TtVC8bMEdIap", + "metadata": {} + }, + { + "id": "ern_raVUcdXruvXGuzm682ESrAzt", + "created_at": "2022-11-24T09:03:14.534Z", + "updated_at": "2022-11-25T09:48:26.284Z", + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "points": 20, + "type": "FIXED" + }, + "event": "order.paid", + "source": { + "banner": "Order has been paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-23T00:00:00.000Z", + "expiration_date": "2022-11-30T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_MbEIyLbn7pHyba5Qw5eeb35L", + "metadata": { + "Type": "Order has been paid - Fixed" + } + }, + { + "id": "ern_BmDiQs7T3UHfJQqtI2RfJHFR", + "created_at": "2022-11-24T14:48:36.567Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_AMOUNT", + "order": { + "amount": { + "every": 1000, + "points": 1 + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_IKanVw37J6oFuRrdnryXw8Lz", + "metadata": { + "Type": "Order has been paid - Proportional - 1" + } + }, + { + "id": "ern_jwtacKdEEHoc85QbouRw3CR8", + "created_at": "2022-11-24T15:17:11.539Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_TOTAL_AMOUNT", + "order": { + "total_amount": { + "every": 1100, + "points": 1 + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order has been paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_Y6IWqhz0cHGkKcteU9PS5nmK", + "metadata": { + "Type": "Order has been paid - Proportional - 2" + } + }, + { + "id": "ern_fxVdmtJ4u4rlyoH2hIq7m1PQ", + "created_at": "2022-11-24T15:20:04.392Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_METADATA", + "order": { + "metadata": { + "every": 10, + "points": 2, + "property": "number_of_store_visits" + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_HyowcdKQ0lsQ1rSxV5tyYr2z", + "metadata": { + "Type": "Order has been paid - Proportional - 3 - Metadata" + } + }, + { + "id": "ern_Aop1wTrmPv4yBntDcvXNTCWR", + "created_at": "2022-11-24T15:23:44.514Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_AMOUNT", + "order_items": { + "amount": { + "every": 1000, + "points": 3, + "object": "products_collection", + "id": "pc_75U0dHlr7u75BJodrW1AE3t6" + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_EXRyQ0z0rgtF54PKDGGAF1qg", + "metadata": { + "Type": "Order has been paid - Proportional - 4" + } + }, + { + "id": "ern_4qSQVjfGEH7OmXKMzotS0juY", + "created_at": "2022-11-24T15:44:45.301Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_SUBTOTAL_AMOUNT", + "order_items": { + "subtotal_amount": { + "every": 1000, + "points": 4, + "object": "sku", + "id": "sku_0b7d7dfb090be5c619" + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_ID3xLPXCdnOaveJYWiulcNFW", + "metadata": { + "Type": "Order has been paid - Proportional - 5 - Items" + } + }, + { + "id": "ern_aJyt4wIrXhmfMxvrLoZjBYrP", + "created_at": "2022-11-24T15:56:58.710Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_AMOUNT", + "order_items": { + "amount": { + "every": 10000, + "points": 1, + "object": "product", + "id": "prod_0bae32322150fd0546" + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_EbBqD1SNW70vgDp5icGbWl3e", + "metadata": {} + }, + { + "id": "ern_v4Blmh9hA3gpnjo93cMAgvHr", + "created_at": "2022-11-24T16:19:20.571Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 1, + "points": 5, + "property": "customer_life_time_value" + } + } + }, + "segment": { + "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" + }, + "event": "customer.segment.entered", + "source": { + "banner": "Entered Segment", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_wMMDJ86iHKkznz9x0506e30E", + "metadata": {} + }, + { + "id": "ern_L8dFanPxJzhw0f5voTwPurGP", + "created_at": "2022-11-24T16:27:13.917Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 3, + "type": "FIXED" + }, + "custom_event": { + "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" + }, + "event": "page_view", + "source": { + "banner": "Custom Event", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_9N69OJzGKGhp2mo7SNsnsF5b", + "metadata": { + "Type": "Fixed" + } + }, + { + "id": "ern_ngdugZ2hzg35hGASFF8nDjUO", + "created_at": "2022-11-24T16:41:48.830Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOM_EVENT_METADATA", + "custom_event": { + "metadata": { + "every": 2, + "points": 2, + "property": "volume_number" + } + } + }, + "custom_event": { + "schema_id": "ms_qpRZ3EmRQyszNH6Z52Gkq8au" + }, + "event": "user_subscribed", + "source": { + "banner": "Custom Event", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_v1eTxL7X63B5IkYgRWHK4leh", + "metadata": { + "Type": "Event" + } + }, + { + "id": "ern_afo3Ea760hAKv07JYpycnhiE", + "created_at": "2022-11-24T16:50:12.945Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 3, + "points": 3, + "property": "customer_life_time_value" + } + } + }, + "custom_event": { + "schema_id": "ms_f0r4hcu5T0m3v3nT5ch3ma" + }, + "event": "cart_abandoned", + "source": { + "banner": "Custom Event", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_7ovoKiXx49fe3nnhEbDlp9FP", + "metadata": {} + }, + { + "id": "ern_chdlG14W8Sdcq3d6jJQQgRMT", + "created_at": "2022-11-24T16:51:31.595Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 1, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.joined", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Tier joined - Any", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_W9yMQTz5fgQTgmuu6pTVraBW", + "metadata": { + "Type": "Tier joined - any - fixed" + } + }, + { + "id": "ern_gVo6CHBduFPoh1hctASfXHLT", + "created_at": "2022-11-24T17:01:42.809Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 4, + "points": 4, + "property": "customer_life_time_value" + } + } + }, + "event": "customer.loyalty.tier.joined", + "loyalty_tier": { + "id": "ltr_pudTGWasuIqxdiDM0go31OV1" + }, + "source": { + "banner": "Tier joined", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_wdlEo17wmoqYHGfilbayEUj7", + "metadata": { + "Type": "Tier joined - customer metadata - proportional" + } + }, + { + "id": "ern_66OdCyLADv5IGFoQe18vGUwa", + "created_at": "2022-11-24T17:03:59.414Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 2, + "points": 2, + "property": "customer_life_time_value" + } + } + }, + "event": "customer.loyalty.tier.left", + "loyalty_tier": { + "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2" + }, + "source": { + "banner": "Tier left", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_czm5el1Uz1jeGaO97AYoDNAq", + "metadata": { + "Type": "Tier left" + } + }, + { + "id": "ern_YR3fDfCjAmz9a5D68nk0i4dm", + "created_at": "2022-11-25T07:29:38.961Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 3, + "points": 4, + "property": "customer_life_time_value" + } + } + }, + "event": "customer.loyalty.tier.upgraded", + "loyalty_tier": { + "id": "ltr_30KHciA0UG8B71Fo51GZqwgN" + }, + "source": { + "banner": "Tier upgraded", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_M1OdRH8spk6Fs7yTuPLN2LAv", + "metadata": { + "Type": "Upgraded" + } + }, + { + "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", + "created_at": "2022-11-25T07:31:05.866Z", + "updated_at": "2022-11-25T09:48:26.506Z", + "validation_rule_id": "val_kfmWpfXMI9P1", + "loyalty": { + "points": 1, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.downgraded", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Tier Downgraded", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", + "metadata": { + "Type": "Tier" + } + }, + { + "id": "ern_AdlWO2yt6b6llWsibIdiRXVE", + "created_at": "2022-11-25T07:31:42.767Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 25, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.prolonged", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Prolonged", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_4jH1yq9WJS0oJ8suagCrltyb", + "metadata": {} + } + ], + "total": 19 } } - ], - "metadata": { - "location_id": [ - "L1", - "L2" - ], - "payment_mean": [ - "paypal", - "credit-card" - ] - }, - "customer": { - "id": "cust_H0nXrItO1DNV3UiPIl54HA5o", - "object": "customer" - }, - "referrer": { - "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", - "object": "customer" - }, - "customer_id": "cust_H0nXrItO1DNV3UiPIl54HA5o", - "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", - "object": "order" + } } } } } } - } - } - } - }, - "/v1/orders/{orderId}": { - "parameters": [ - { - "schema": { - "type": "string" }, - "name": "orderId", - "in": "path", - "required": true, - "description": "Unique Voucherify order ID or order source ID." - } - ], - "get": { - "operationId": "get-order", - "tags": [ - "ORDERS API" - ], - "summary": "Get Order", - "description": "Retrieve an order.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns an order object if a valid identifier was provided. ", - "content": { - "application/json": { + "/v1/loyalties/{campaignId}/tiers/{tierId}/rewards": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID or name." + }, + { "schema": { - "$ref": "#/components/schemas/10_obj_order_object" + "type": "string", + "example": "ltr_mtWowJBBhVYnY8oXaLJ2tUnk" + }, + "name": "tierId", + "in": "path", + "required": true, + "description": "Unique tier ID." + } + ], + "get": { + "operationId": "list-loyalty-tier-rewards", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Loyalty Tier Rewards", + "description": "Get available rewards for a given tier.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary of loyalty tier reward objects.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_list_loyalty_tier_rewards" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "reward": { + "id": "rew_QuWYsBNB2G3fikffjnl0G3gH", + "name": "API - Testing", + "type": "CAMPAIGN", + "parameters": { + "campaign": { + "id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", + "balance": 500, + "type": "LOYALTY_PROGRAM" + } + }, + "stock": null, + "redeemed": null, + "created_at": "2022-08-25T09:32:04.579424+00:00", + "updated_at": "2022-08-25T09:33:46.680639+00:00", + "metadata": { + "Type": "Second campaign" + }, + "object": "reward" + }, + "assignment": { + "id": "rewa_3Z2sP0bmqcL0ggU28GvFeHU3", + "reward_id": "rew_QuWYsBNB2G3fikffjnl0G3gH", + "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 40 + } + }, + "created_at": "2022-11-23T22:11:58.759092+00:00", + "updated_at": null, + "object": "reward_assignment" + }, + "object": "loyalty_tier_reward" + }, + { + "reward": { + "id": "rew_XoDgmQ2HZX7qPM6aIEuslObo", + "name": "Material", + "type": "MATERIAL", + "parameters": { + "product": { + "id": "prod_0b15f6b9f650c16990", + "sku_id": "sku_0b1621b319d248b79f" + } + }, + "stock": 2, + "redeemed": 1, + "attributes": { + "image_url": "https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_fPH9ohe0pZf4EiIt295sk9Ob.png", + "description": "Archie's Series" + }, + "created_at": "2022-08-29T06:02:36.753873+00:00", + "updated_at": "2022-11-08T08:01:26.883166+00:00", + "metadata": { + "Type": "Material" + }, + "object": "reward" + }, + "assignment": { + "id": "rewa_Or6gWZ5ASuGkBLjOf0IyiD4k", + "reward_id": "rew_XoDgmQ2HZX7qPM6aIEuslObo", + "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 30 + } + }, + "created_at": "2022-11-23T22:11:58.759092+00:00", + "updated_at": null, + "object": "reward_assignment" + }, + "object": "loyalty_tier_reward" + }, + { + "reward": { + "id": "rew_MVXA2kV7lZ1zC057WUaTrvNz", + "name": "100 Points = $20", + "type": "COIN", + "parameters": { + "coin": { + "exchange_ratio": 20, + "points_ratio": 100 + } + }, + "stock": null, + "redeemed": null, + "attributes": {}, + "created_at": "2022-09-09T06:41:54.496035+00:00", + "updated_at": null, + "metadata": {}, + "object": "reward" + }, + "assignment": { + "id": "rewa_nMXB59qGTNYawMT8eP8M4oUp", + "reward_id": "rew_MVXA2kV7lZ1zC057WUaTrvNz", + "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "related_object_type": "campaign", + "created_at": "2022-11-09T11:01:21.065681+00:00", + "updated_at": null, + "object": "reward_assignment" + }, + "object": "loyalty_tier_reward" + } + ], + "total": 3 + } + } + } + } + } } } } }, - "404": { - "description": "Returns an error when requesting an order that has been deleted or cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find order with id ord_nIcO2s8iD4Xh5E9IGDQ57Ax", - "request_id": "v-0baa1ad023d0656a84", - "resource_id": "ord_nIcO2s8iD4Xh5E9IGDQ57Ax", - "resource_type": "order" + "/v1/customer-object": { + "get": { + "operationId": "customer-object", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Customer Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Customer Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/9_obj_customer_object" + } } } } } } - } - } - }, - "put": { - "operationId": "update-order", - "tags": [ - "ORDERS API" - ], - "summary": "Update Order", - "description": "Updates the specified order by setting the values of the parameters passed in the request body. Any parameters not provided will be left unchanged.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the parameters of the order that are to be updated.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/10_req_update_order" - }, - "examples": { - "Example": { - "value": { - "status": "CANCELED" + }, + "/v1/customer-activity-object": { + "get": { + "operationId": "customer-activity-object", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Customer Activity Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Customer Activity Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/9_obj_customer_activity_object" + } + } } } } } - } - }, - "responses": { - "200": { - "description": "Returns the order object if the update succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/10_obj_order_object" - }, - "examples": { - "Example": { - "value": { - "id": "ord_cRKOEXiBOj0EZKF7g9n6l0eH", - "source_id": "new", - "created_at": "2022-09-09T09:20:01.660Z", - "updated_at": "2022-09-09T09:41:00.881Z", - "status": "CANCELED", - "amount": 121700, - "total_amount": 121700, - "items": [ - { - "object": "order_item", - "source_id": "prod_1", - "related_object": "product", - "quantity": 2, - "amount": 120000, - "price": 60000, - "subtotal_amount": 120000, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "metadata": { - "color": [ - "purple" - ], - "vendor": "mall" - }, - "price": 60000 - } - }, - { - "object": "order_item", - "source_id": "ComicBook_1", - "related_object": "sku", - "product_id": "prod_0b7d7dfb05cbe5c616", - "quantity": 1, - "amount": 1700, - "price": 1700, - "subtotal_amount": 1700, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "metadata": { - "color": [ - "silver" - ], - "vendor": "Bookstore1" - }, - "price": 2100 - }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "metadata": { - "color": [ - "golden" - ], - "vendor": "islands" - }, - "price": 1700 + }, + "/v1/customers": { + "get": { + "operationId": "list-customers", + "tags": [ + "CUSTOMERS API" + ], + "summary": "List Customers", + "description": "Returns a list of customers.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "email", + "description": "Limit the customers to the ones that have this specific email address." + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "description": "Limit the customers to the ones that are located in the specified city.", + "name": "city" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "description": "Filter customers by the name property.", + "name": "name" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at", + "source_id", + "-source_id" + ] + }, + "in": "query", + "name": "order", + "description": "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." + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "starting_after", + "description": "A cursor for use in pagination. This is a date-time value that defines your place in the list based on `created_at` property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at `2020-05-24T13:43:09.024Z`, your subsequent call can include `starting_after=2020-05-24T13:43:09.024Z` in order to fetch the next page of the list. \n\n| **Option** | **Format** | **Sorting** |\n|:---|:---|:---|\n| Return customers **before** a specific creation date | - set `starting_after` parameter to the breakpoint date | Sorting order is **descending**; the most recent dates first and least recent dates last. |\n| Return customers **after** a specific create or update date | - include the `order` parameter set to `created_at` or `updated_at`
- set `starting_after` to the breakpoint date | Sorting order is **ascending**; the least recent dates first and the most recent dates last. |\n" + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with customer objects. The customers are returned sorted by creation date, with the most recent customers appearing first.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/9_res_list_customers" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "customers", + "customers": [ + { + "id": "cust_CSnYd37MXmrbS19XCrghjBsv", + "source_id": "source_123", + "name": "Bob Smith", + "description": "A frequent customer", + "email": "bob.smith@email.com", + "phone": "+1 933 222 3333", + "birthdate": "2022-01-01", + "address": { + "city": "New York", + "state": "NY", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 5", + "country": "United States", + "postal_code": "10001" + }, + "summary": { + "redemptions": { + "total_redeemed": 1, + "total_failed": 0, + "total_succeeded": 1, + "total_rolled_back": 0, + "total_rollback_failed": 0, + "total_rollback_succeeded": 0, + "gift": { + "redeemed_amount": 0, + "amount_to_go": 0 + }, + "loyalty_card": { + "redeemed_points": 0, + "points_to_go": 4200 + } + }, + "orders": { + "total_amount": 1600, + "total_count": 1, + "average_amount": 1600, + "last_order_amount": 1600, + "last_order_date": "2022-08-30T10:17:39.220Z" + } + }, + "loyalty": { + "points": 2200, + "referred_customers": 0, + "campaigns": { + "Christmas Campaign": { + "points": 1000, + "referred_customers": 0 + }, + "Fall Campaign": { + "points": 75, + "referred_customers": 0 + }, + "Winter Campaign": { + "points": 75, + "referred_customers": 0 + }, + "Summer Campaign": { + "points": 50, + "referred_customers": 0 + }, + "Spring Campaign": { + "points": 1000, + "referred_customers": 0 + } + } + }, + "referrals": { + "total": 1, + "campaigns": [ + { + "campaign_id": "camp_rRsfatlwN7unSeUIJDCYedal", + "referrer_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", + "related_object_id": "r_0b9d4c5121d64dd01d", + "related_object_type": "redemption", + "date": "2022-08-30T10:17:41.089Z" + } + ] + }, + "metadata": { + "lang": "en", + "test": true + }, + "system_metadata": {}, + "created_at": "2022-08-30T06:32:07.380Z", + "updated_at": "2022-08-30T10:17:58.049Z", + "object": "customer" + }, + { + "id": "cust_X0hU04x7FeisPnD5lctZcQkI", + "source_id": "jane.smith@email.com", + "name": "Jane Smith", + "description": "A nice customer", + "email": "jane.smith@email.com", + "phone": "+1 933 222 3333", + "birthdate": "2022-01-02", + "address": { + "city": "New Yorke", + "state": "NY", + "line_1": "123 Main Ste.", + "line_2": "APT 3 BLG 4e", + "country": "United Statese", + "postal_code": "10001e" + }, + "summary": { + "redemptions": { + "total_redeemed": 4, + "total_failed": 0, + "total_succeeded": 4, + "total_rolled_back": 1, + "total_rollback_failed": 0, + "total_rollback_succeeded": 1, + "gift": { + "redeemed_amount": 0, + "amount_to_go": 0 + }, + "loyalty_card": { + "redeemed_points": 0, + "points_to_go": 15549 + } + }, + "orders": { + "total_amount": 210000, + "total_count": 3, + "average_amount": 70000, + "last_order_amount": 70000, + "last_order_date": "2022-08-30T11:51:08.029Z" + } + }, + "loyalty": { + "points": 15399, + "referred_customers": 0, + "campaigns": { + "Christmas Campaign": { + "points": 7000, + "referred_customers": 0 + }, + "Fall Campaign": { + "points": 2299, + "referred_customers": 0 + }, + "Winter Campaign": { + "points": 25, + "referred_customers": 0 + }, + "Summer Campaign": { + "points": 75, + "referred_customers": 0 + }, + "Spring Campaign": { + "points": 6000, + "referred_customers": 0 + } + } + }, + "referrals": { + "total": 2, + "campaigns": [ + { + "campaign_id": "camp_rRsfatlwN7unSeUIJDCYedal", + "referrer_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", + "related_object_id": "r_0b9d4cc4aa164dd073", + "related_object_type": "redemption", + "date": "2022-08-30T10:19:39.196Z" + }, + { + "campaign_id": "camp_YDsFdX8TgFtT0RUuKEFyhqs3", + "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", + "related_object_id": "r_0b9d61b6484ead0324", + "related_object_type": "redemption", + "date": "2022-08-30T11:51:10.445Z" + } + ] + }, + "metadata": { + "lang": "en", + "test": false + }, + "system_metadata": {}, + "created_at": "2022-08-09T09:50:53.620Z", + "updated_at": "2022-08-30T11:51:24.327Z", + "object": "customer" + } + ], + "total": 2 } } - ], - "metadata": { - "location_id": [ - "L1", - "L2" - ], - "payment_mean": [ - "paypal", - "credit-card" - ] - }, - "customer": { - "id": "cust_H0nXrItO1DNV3UiPIl54HA5o", - "object": "customer" - }, - "referrer": { - "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", - "object": "customer" - }, - "customer_id": "cust_H0nXrItO1DNV3UiPIl54HA5o", - "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", - "object": "order" + } } } } } - } - } - } - } - }, - "/v1/orders/import": { - "post": { - "operationId": "import-orders", - "tags": [ - "ORDERS API" - ], - "summary": "Import Orders", - "description": "\n\n> 🚧 Historical orders\n>\n> This endpoint should only be used to import historical orders into Voucherify. For on-going synchronization, the [create order](ref:create-order) and [update order](ref:update-order) endpoints should be used. This is critical because this endpoint does not store events or launch distributions.\n\n## Limitations\n\n### Import volume\n\nThere 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. \n\n### Maximum count of orders in single import\n\nThere is a `2000` limit but we might decide to change it to a lower / higher value at any given time depending if we find this value is too high or too low with time.\n\n## Notifications\n\nThere are no notifications on the Dashboard because this import is launched via the API.\n\n## Triggered actions\n \nIf you import orders with customers, then a logic will be scheduled responsible for placing these customers into segments and refreshing the segment's summary. Consequently, this update will trigger \n- **customers entering into segments** \n- **distributions** based on any rules tied to customer entering segment(s)\n- **earning rules** based on the customer entering segment(s)\n\n## What is not triggered\n\n1. No webhooks are triggered during the import of orders - for both orders and upserted products / skus. \n\n2. 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. \n\n3. No events are created during the import of orders - for both orders and upserted products / skus. In other words you won't 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 won't see the Product created events listed, etc. \n\n4. Earning rules based on Order Paid won't be triggered.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "The request body is sent in the form of an array of order objects.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/10_req_orders_import" + }, + "post": { + "operationId": "create-customer", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Create Customer", + "description": "Creates a customer object.\n\n\n\n> 📘 Upsert Mode\n>\n> If you pass a `source_id` that already exists in the customer database, Voucherify will return a related customer object with updated fields.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Create a customer with specified parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/9_req_create_customer" + }, + "examples": { + "Example": { + "value": { + "source_id": "source_123", + "name": "Bob Smith", + "description": "A frequent customer", + "email": "bob.smith@email.com", + "phone": "+1 933 222 3333", + "address": { + "city": "New York", + "country": "United States", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 4", + "postal_code": "10001", + "state": "NY" + }, + "metadata": { + "lang": "en", + "test": true + }, + "birthdate": "2022-01-01" + } + } + } + } + } }, - "examples": { - "Example": { - "value": [ - { - "source_id": "orderImport14", - "status": "PAID", - "metadata": { - "location_id": [ - "L1", - "L2" - ], - "payment_mean": [ - "paypal", - "credit-card" - ] - }, - "customer": { - "source_id": "bob2.smith@email.com", - "name": "Bob Smith", - "description": "A nice customer", - "email": "bob.smith@email.com", - "phone": "+1 933 222 3333", - "address": { - "city": "New York", - "country": "United States", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 4", - "postal_code": "10001", - "state": "NY" - }, - "metadata": { - "lang": "en", - "test": true - }, - "birthdate": "2022-01-01" - }, - "referrer": { - "source_id": "jane.smith@email.com", - "name": "Jane Smith", - "description": "A really nice customer", - "email": "jane.smith@email.com", - "phone": "+1 933 222 3334", - "address": { - "city": "New York", - "country": "United States", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 4", - "postal_code": "10001", - "state": "NY" - }, - "metadata": { - "lang": "en", - "test": false - }, - "birthday": "2022-03-03" + "responses": { + "200": { + "description": "Returns a customer object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/9_obj_customer_object" }, - "items": [ - { - "source_id": "prod_1", - "related_object": "product", - "quantity": 2, - "product": { - "name": "Apple iPhone 12", - "price": 70000, - "metadata": { - "color": [ - "silver" - ], - "vendor": "mall" + "examples": { + "Example": { + "value": { + "id": "cust_CSnYd37MXmrbS19XCrghjBsv", + "source_id": "source_123", + "name": "Bob Smith", + "description": "A frequent customer", + "email": "bob.smith@email.com", + "phone": "+1 933 222 3333", + "birthdate": "2022-01-01", + "address": { + "city": "New York", + "state": "NY", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 4", + "country": "United States", + "postal_code": "10001" }, - "override": true - } - }, - { - "source_id": "ComicBook_1", - "related_object": "sku", - "quantity": 1, - "product": { - "source_id": "Books", - "name": "Comic Books1", - "price": 1600, - "metadata": { - "color": [ - "silver" - ], - "vendor": "Bookstore1" + "summary": { + "redemptions": { + "total_redeemed": 0, + "total_failed": 0, + "total_succeeded": 0, + "total_rolled_back": 0, + "total_rollback_failed": 0, + "total_rollback_succeeded": 0, + "gift": { + "redeemed_amount": 0, + "amount_to_go": 0 + }, + "loyalty_card": { + "redeemed_points": 0, + "points_to_go": 0 + } + }, + "orders": { + "total_amount": 0, + "total_count": 0, + "average_amount": 0, + "last_order_amount": 0 + } + }, + "loyalty": { + "points": 0, + "referred_customers": 0, + "campaigns": {} + }, + "referrals": { + "total": 0, + "campaigns": [] }, - "override": true - }, - "sku": { - "sku": "Comics1", - "source_id": "ComicBook_1", - "price": 1600, "metadata": { - "color": [ - "golden" - ], - "vendor": "islands" + "lang": "en", + "test": true }, - "override": true - } - } - ] - }, - { - "source_id": "orderImport15", - "status": "PAID", - "metadata": { - "location_id": [ - "L3" - ], - "payment_mean": [ - "wire-transfer" - ] - }, - "customer": { - "source_id": "bob2.smith@email.com" - }, - "referrer": { - "source_id": "jane.smith@email.com" - }, - "items": [ - { - "source_id": "ComicBook_1", - "quantity": 4, - "related_object": "sku", - "sku": { - "source_id": "ComicBook_1" - } - }, - { - "source_id": "vase_1", - "quantity": 1, - "related_object": "product", - "product": { - "source_id": "vase_1" + "system_metadata": {}, + "created_at": "2022-08-30T06:32:07.380Z", + "object": "customer" } } - ] - }, - { - "source_id": "orderImport16", - "status": "FULFILLED", - "metadata": { - "location_id": [ - "L3" - ], - "payment_mean": [ - "wire-transfer" - ] - }, - "customer": { - "id": "cust_LMY4ZylSdUYB1J4tzqNcl5VV" - }, - "referrer": { - "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" - }, - "items": [ - { - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 2 - }, - { - "sku_id": "sku_0b1621b319d248b79f", - "quantity": 2 - } - ] - }, - { - "source_id": "orderImport17", - "status": "CANCELED", - "amount": 7000, - "metadata": { - "location_id": [ - "L3" - ], - "payment_mean": [ - "wire-transfer" - ] } - }, - { - "source_id": "orderImport18", - "status": "CREATED", - "metadata": { - "location_id": [ - "L3" - ], - "payment_mean": [ - "wire-transfer" - ] - }, - "items": [ - { - "source_id": "ComicBook_1", - "amount": 900, - "related_object": "sku" - }, - { - "source_id": "vase_1", - "amount": 2000, - "related_object": "product" - } - ] - }, - { - "source_id": "orderImport19", - "status": "CREATED", - "metadata": { - "location_id": [ - "L3" - ], - "payment_mean": [ - "wire-transfer" - ] - }, - "items": [ - { - "amount": 900 - }, - { - "amount": 2000 - } - ] - }, - { - "source_id": "orderImport20", - "status": "CREATED", - "metadata": { - "location_id": [ - "L3" - ], - "payment_mean": [ - "wire-transfer" - ] - }, - "items": [ - { - "price": 900, - "quantity": 2 - }, - { - "price": 2000, - "quantity": 3 - } - ] - } - ] - } - } - } - } - }, - "responses": { - "200": { - "description": "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](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" - }, - "examples": { - "Example": { - "value": { - "async_action_id": "aa_0a875d56c805df6601" } } } } } }, - "400": { - "description": "Returns an error if the payload is invalid.", - "content": { - "application/json": { + "/v1/customers/{customerId}": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_error_no_translation" + "type": "string", + "example": "cust_J1CDUdbqn5Exva8ASWk1Fq0j" }, - "examples": { - "Invalid Payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Property .items[0].initial_quantity cannot be lower than 1", - "request_id": "v-0c5561d945cb0f0fb5" - } - } - } + "name": "customerId", + "in": "path", + "required": true, + "description": "A Voucherify customer ID or `source_id`." } - } - } - } - } - }, - "/v1/orders/export": { - "post": { - "operationId": "create-order-export", - "tags": [ - "ORDERS API" - ], - "summary": "Create Orders Export", - "description": "Creates a downloadable CSV file containing a list of orders.\n\nThe 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.\n\nThe available filters are all [order object](ref:get-order) attributes. Additionally, any metadata defined in the metadata schema can be exported.\n\nPassing an empty JSON will generate a file containing three default fields: `id`, `source_id`, and `status`.\n\nThe 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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique order ID. | ord_A69RIxEdRsPuC6i8gFGVHUft |\n| source_id | Unique order source ID. | 8638 |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the order was created. | 2022-03-09T09:16:32.521Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the order was last updated. | 2022-03-09T09:16:33.331Z |\n| status | Order status. | `PAID`, `CREATED`, `FULFILLED`, `CANCELED` |\n| amount | Total amount of order items. | 7700 |\n| discount_amount | Represents total amount of the discount applied to whole cart. | 500 |\n| items_discount_amount | Represents total amount of the discount applied to order line items. | 100 |\n| total_discount_amount | All discounts applied to the order including discounts applied to particular order line items and discounts applied to the whole cart. | 600 |\n| total_amount | Total order amount after applying all discounts. | 7100 |\n| customer_id | Customer unique ID. | cust_2G4fUQdCXUqp35nXNleav7bO |\n| referrer_id | Referrer unique ID. | cust_IkrTR674vvQvr9a4rDMiqglY |\n| metadata | Returns all order metadata. | Response will include all order metadata. |\n| metadata.X | Where X is the name of a particular order metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Order. |", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify which order parameters you would like to export.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/10_req_create_order_export" - }, - "examples": { - "Using fields": { - "value": { - "parameters": { - "fields": [ - "id", - "source_id", - "status", - "created_at", - "updated_at", - "amount", - "discount_amount", - "items_discount_amount", - "total_discount_amount", - "total_amount", - "customer_id", - "referrer_id", - "metadata.payment_mean" - ] + ], + "get": { + "operationId": "get-customer", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Get Customer", + "description": "Retrieve customer details.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a customer object if a valid identifier was provided.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/9_obj_customer_object" + }, + "examples": { + "Example": { + "value": { + "id": "cust_T849EgzNVVmn5icJ2FAkT2rO", + "source_id": "alice.morgan@email.com", + "name": "Alice Morgan", + "email": "alice.morgan@email.com", + "address": null, + "summary": { + "redemptions": { + "total_redeemed": 2, + "total_failed": 0, + "total_succeeded": 2, + "total_rolled_back": 0, + "total_rollback_failed": 0, + "total_rollback_succeeded": 0, + "gift": { + "redeemed_amount": 0, + "amount_to_go": 0 + }, + "loyalty_card": { + "redeemed_points": 0, + "points_to_go": 3303 + } + }, + "orders": { + "total_amount": 203900, + "total_count": 2, + "average_amount": 101950, + "last_order_amount": 3900, + "last_order_date": "2022-07-26T14:59:52.814Z" + } + }, + "loyalty": { + "points": 3303, + "referred_customers": 0, + "campaigns": { + "Summer Campaign": { + "points": 3303, + "referred_customers": 0 + } + } + }, + "referrals": { + "total": 0, + "campaigns": [] + }, + "system_metadata": {}, + "created_at": "2022-02-07T08:28:23.644Z", + "updated_at": "2022-07-26T14:59:59.806Z", + "assets": { + "cockpit_url": "https://www.url.com" + }, + "object": "customer" + } + } + } } } }, - "Using fields and filters": { - "value": { - "parameters": { - "fields": [ - "id", - "source_id", - "status", - "created_at", - "updated_at", - "amount", - "discount_amount", - "items_discount_amount", - "total_discount_amount", - "total_amount", - "customer_id", - "referrer_id", - "metadata.payment_mean" - ], - "order": "-updated_at", - "filters": { - "discount_amount": { - "conditions": { - "$more_than": 100000 + "404": { + "description": "Not Found. When requesting the ID of a customer that has been deleted or does not exist in the system, the resource will not be returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find customer with id cust_sehkNIi8Uq2qQuRqSr7xn4Z", + "request_id": "v-0b4c590350857970df", + "resource_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Z", + "resource_type": "customer" } } } @@ -78911,1911 +76379,2781 @@ } } } - } - } - }, - "responses": { - "200": { - "description": "Returns the `id` of the export object and `status` of the file generation process. The `id` is used in the [Get Export](ref:get-export) method to generate the url for the downloadable CSV file or in the [Download Export](ref:download-export) method to return the contents of the CSV file. The status indicates whether the file has been scheduled for creation.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/16_obj_export_object" - }, - "examples": { - "Example": { - "value": { - "id": "exp_pT2Y1mgYsAgRAqsWTGf7PQX7", - "object": "export", - "created_at": "2022-09-09T10:45:52.362Z", - "status": "SCHEDULED", - "channel": "API", - "exported_object": "order", - "parameters": { - "fields": [ - "id", - "source_id", - "status", - "created_at", - "updated_at", - "amount", - "discount_amount", - "items_discount_amount", - "total_discount_amount", - "total_amount", - "customer_id", - "referrer_id", - "metadata.payment_mean" - ] - }, - "result": null, - "user_id": null - } - } + }, + "delete": { + "operationId": "delete-customer", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Delete Customer", + "description": "This method deletes a customer.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] } - } - } - }, - "400": { - "description": "Returns an error if the request payload is specified incorrectly.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Invalid payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Property .parameters.filters should match either `filters[${field}][conditions][${condition}][${index}]` or `filters[${field}][conditions][${condition}]` format and condition must be one of: $in, $not_in, $in_location, $not_in_location, $is, $is_days_ago, $is_days_in_future, $is_not, $has_value, $is_unknown, $contains, $not_contain, $starts_with, $ends_with, $more_than, $less_than, $more_than_ago, $less_than_ago, $more_than_future, $less_than_future, $more_than_equal, $less_than_equal, $after, $before, $count, $count_less, $count_more, $today, $tomorrow, $yesterday, $this_week, $last_week, $next_week, $this_month, $last_month, $next_month, $this_year, $next_year, $last_year, $is_day_of_month, $is_day, $is_month, $is_year, $today_md, $tomorrow_md, $yesterday_md, $this_week_md, $last_week_md, $next_week_md, $this_month_md, $last_month_md, $next_month_md, $is_days_ago_md, $is_more_days_ago_md, $is_less_days_ago_md, $is_days_in_future_md, $is_more_days_in_future_md, $is_less_days_in_future_md, $is_years_ago, $active, $failed, $in_progress, $expired, $before_start, $enabled, $disabled, $redeemed, $redeemable", - "request_id": "v-0c52e783650ae585b2" + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." + }, + "404": { + "description": "Returns an error indicating that the customer with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Customer Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find customer with id cust_7pm0hh0yemiydeFsdYXZlr1", + "request_id": "v-0ae398fd9ac683dc84", + "resource_id": "cust_7pm0hh0yemiydeFsdYXZlr1", + "resource_type": "customer" + } + } + } } } } } - } - } - } - } - }, - "/v1/product-object": { - "get": { - "operationId": "product-object", - "tags": [ - "PRODUCTS API" - ], - "summary": "Product Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Product Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_obj_product_object" - } - } - } - } - } - } - }, - "/v1/sku-object": { - "get": { - "operationId": "sku-object", - "tags": [ - "PRODUCTS API" - ], - "summary": "SKU Object", - "description": "Data model description", - "responses": { - "200": { - "description": "SKU Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_obj_sku_object" - } - } - } - } - } - } - }, - "/v1/products": { - "get": { - "operationId": "list-products", - "tags": [ - "PRODUCTS API" - ], - "summary": "List Products", - "description": "Retrieve a list of products.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ] }, - "in": "query", - "name": "order", - "description": "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." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary with product objects. The products are returned sorted by creation date by default, with the most recent products appearing last, unless you specify another sequence using the `order` query parameter.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_res_list_products" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "products", - "products": [ - { - "id": "prod_f1r5Tpr0DuC7", - "source_id": "test_prod_id_1", - "name": "Apple iPhone 8", - "price": null, - "attributes": [ - "color", - "memory" - ], + "put": { + "operationId": "update-customer", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Update Customer", + "description": "Updates the specified customer by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the parameters to be updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/9_req_update_customer" + }, + "examples": { + "Example": { + "value": { + "name": "Alice McDonald", + "email": "alice.mdconald@email.com", + "description": "Updating customer data", + "phone": "+1 (132) 222-2222", + "address": { + "city": "New York", + "country": "United States", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 4", + "postal_code": "10001", + "state": "NY" + }, "metadata": { - "test": true, - "vendor": "Cortland" + "lang": "en", + "test": true }, - "image_url": null, - "created_at": "2021-12-03T06:33:46.101Z", - "updated_at": null, - "object": "product", - "skus": { - "data": [ - { - "id": "sku_0a417bd1d9952f9d6f", - "source_id": "test_iphone_8_silver_256gb", - "product_id": "prod_f1r5Tpr0DuC7", - "sku": "iPhone 8 Silver 256GB", - "price": null, - "currency": null, - "attributes": { - "color": "silver", - "memory": "256" + "birthdate": "2022-01-01", + "birthday": "2022-01-02" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a customer object if updates were successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/9_obj_customer_object" + }, + "examples": { + "Example": { + "value": { + "id": "cust_T849EgzNVVmn5icJ2FAkT2rO", + "source_id": "alice@morgan.com", + "name": "Alice McDonald", + "description": "Updating customer data", + "email": "alice.mdconald@email.com", + "phone": "+1 (132) 222-2222", + "birthday": "2022-01-02", + "birthdate": "2022-01-01", + "address": { + "city": "New York", + "state": "NY", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 4", + "country": "United States", + "postal_code": "10001" + }, + "summary": { + "redemptions": { + "total_redeemed": 2, + "total_failed": 0, + "total_succeeded": 2, + "total_rolled_back": 0, + "total_rollback_failed": 0, + "total_rollback_succeeded": 0, + "gift": { + "redeemed_amount": 0, + "amount_to_go": 0 }, - "image_url": null, - "metadata": {}, - "created_at": "2021-12-03T06:33:46.599097+00:00", - "updated_at": null, - "object": "sku" + "loyalty_card": { + "redeemed_points": 0, + "points_to_go": 4428 + } }, - { - "id": "sku_0a417bd1d9952f9d6e", - "source_id": "test_iphone_8_silver_64gb", - "product_id": "prod_f1r5Tpr0DuC7", - "sku": "iPhone 8 Silver 64GB", - "price": null, - "currency": null, - "attributes": { - "color": "silver", - "memory": "64" - }, - "image_url": null, - "metadata": {}, - "created_at": "2021-12-03T06:33:46.598595+00:00", - "updated_at": null, - "object": "sku" + "orders": { + "total_amount": 203900, + "total_count": 2, + "average_amount": 101950, + "last_order_amount": 3900, + "last_order_date": "2022-07-26T14:59:52.814Z" } - ], - "total": 2 - } - }, - { - "id": "prod_0ac67e1bb8072eec48", - "source_id": "test_volleyball", - "name": "VolleyBall", - "price": 1100, - "attributes": [], - "metadata": { - "color": [ - "white" - ], - "label": true, - "origin": "PL" - }, - "image_url": null, - "created_at": "2022-03-16T14:01:45.459Z", - "updated_at": "2022-04-26T12:51:35.500Z", - "object": "product", - "skus": { - "data": [ - { - "id": "sku_0ac768973f5c4ea0d0", - "source_id": "test_volleyball_pl", - "product_id": "prod_0ac67e1bb8072eec48", - "sku": "PL", - "price": 500, - "currency": "USD", - "attributes": {}, - "image_url": null, - "metadata": { - "color": [ - "red" - ] + }, + "loyalty": { + "points": 3403, + "referred_customers": 0, + "campaigns": { + "Summer Campaign": { + "points": 0, + "referred_customers": 0 }, - "created_at": "2022-03-17T07:06:13.629918+00:00", - "updated_at": null, - "object": "sku" - }, - { - "id": "sku_0ac7689713072e1df6", - "source_id": "test_volleyball_us", - "product_id": "prod_0ac67e1bb8072eec48", - "sku": "US", - "price": 1500, - "currency": "USD", - "attributes": {}, - "image_url": null, - "metadata": { - "color": [ - "yellow" - ] + "Spring Campaign": { + "points": 50, + "referred_customers": 0 }, - "created_at": "2022-03-17T07:06:13.452532+00:00", - "updated_at": null, - "object": "sku" + "Fall Campaign": { + "points": 50, + "referred_customers": 0 + }, + "Winter Campaign": { + "points": 3303, + "referred_customers": 0 + } } - ], - "total": 2 + }, + "referrals": { + "total": 0, + "campaigns": [] + }, + "metadata": { + "lang": "en", + "test": true + }, + "system_metadata": {}, + "created_at": "2022-02-07T08:28:23.644Z", + "updated_at": "2022-08-31T09:58:30.475Z", + "object": "customer" } } - ], - "total": 2 + } + } + } + }, + "404": { + "description": "Returns an error indicating that a customer with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Example": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find customer with id alice2@morgan.com", + "request_id": "v-0b9e924dd243bf26e2", + "resource_id": "alice2@morgan.com", + "resource_type": "customer" + } + } + } } } } } } - } - } - }, - "post": { - "operationId": "create-product", - "tags": [ - "PRODUCTS API" - ], - "summary": "Create Product", - "description": "Creates a product object.\n\n\n\n> 🚧 Upsert Mode\n>\n> If you pass a `source_id` that already exists in the product database, Voucherify will return a related product object with updated fields.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the product parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_req_create_product" - }, - "examples": { - "Example": { - "value": { - "source_id": "first_product", - "name": "Samsung Phone", - "price": 200000, - "attributes": [ - "color", - "memory", - "processor" - ], - "metadata": { - "test": true, - "vendor": "Online Store" - }, - "image_url": "https://www.website.com/image.png" + }, + "/v1/customers/{customerId}/permanent-deletion": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "customerId", + "in": "path", + "required": true, + "description": "A Voucherify customer ID or `source_id`." + } + ], + "post": { + "operationId": "delete-customer-permanently", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Delete Customer Permanently", + "description": "The organization user can remove consumer data permanently from the Voucherify system by using this API method. It d​eletes all customer data and connected resources. It makes the customer profile forgotten by Voucherify.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a permanent deletion object and status of the deletion.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/customers_permanent_deletion_response_body" + }, + "examples": { + "Example": { + "value": { + "id": "del_7k3buMvBsJuXiLRmdh1WZvZs", + "created_at": "2022-09-02T17:50:29.302Z", + "related_object_id": "cust_XI8sPLvznzVpNI1BMIWGcUJa", + "related_object": "customer", + "status": "DONE", + "data_json": { + "events": 16, + "customer_events": 28, + "daily_events": 0, + "segments": 0, + "orders": 9, + "order_events": 5, + "customer": 1 + }, + "object": "pernament_deletion" + } + } + } + } + } + }, + "404": { + "description": "Returns an error indicating that a customer with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find customer with id cust_W8n9I8pJDXlM69j49iKJeYp", + "request_id": "v-0b4c62635a154e96f1", + "resource_id": "cust_W8n9I8pJDXlM69j49iKJeYp", + "resource_type": "customer" + } + } + } + } } } } } - } - }, - "responses": { - "200": { - "description": "Returns a product object if the operation succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_obj_product_object" - }, - "examples": { - "Example": { - "value": { - "id": "prod_0bae2dc5a090fd0184", - "source_id": "first_product", - "name": "Samsung Phone", - "price": 200000, - "attributes": [ - "color", - "memory", - "processor" - ], - "metadata": { - "test": true, - "vendor": "Online Store" + }, + "/v1/customers/importCSV": { + "post": { + "operationId": "import-customers-using-csv", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Import and Update Customers using CSV", + "description": "This API method lets you import or update customer data. To get a proper and valid response, please send a CSV file with data separated by commas. \n\n## Request Example\n\n```cURL\ncurl -X POST \\\n https://api.voucherify.io/v1/customers/importCSV \\\n -F file=@/path/to/customers.csv \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\"\n```\n## CSV File Format\n\nThe CSV file has to include headers in the first line. All properties which cannot be mapped to standard customer fields will be added to the metadata object.\n\n\n> 📘 Standard customer fields mapping\n>\n> **No spaces allowed in field names** \n> Name, Email, Phone, Birthdate, Source_id, Address_line_1, Address_line_2, Address_Postal_Code, Address_City, Address_State, Address_Country, Description, Metadata_name_1, Metadata_name_2\n\n## Update Customers using CSV\n\nIf you would like to update customer's data, you can do it using the CSV file with new data. However, remember to include a `source_id` in your CSV file to manage the update successfully.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "The file path is stored in the form `file` header.", + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/a_req_importCSV" + }, + "examples": {} + } + } + }, + "responses": { + "202": { + "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and customers will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" }, - "image_url": "https://www.website.com/image.png", - "created_at": "2022-09-12T12:58:22.232Z", - "updated_at": "2022-09-12T12:59:55.890Z", - "object": "product" + "examples": { + "Example": { + "value": { + "async_action_id": "aa_0a875d56c805df6601" + } + } + } } } } } } - } - } - } - }, - "/v1/products/{productId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "prod_f1r5Tpr0DuC7" }, - "name": "productId", - "in": "path", - "required": true, - "description": "A Voucherify product ID or source ID." - } - ], - "get": { - "operationId": "get-product", - "tags": [ - "PRODUCTS API" - ], - "summary": "Get Product", - "description": "Retrieve product details.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a product object if a valid identifier was provided.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_obj_product_object" - }, - "examples": { - "Example": { - "value": { - "id": "prod_f1r5Tpr0DuC7", - "source_id": "test_prod_id_1", - "name": "Apple iPhone 8", - "price": null, - "attributes": [ - "color", - "memory" - ], - "metadata": { - "test": true, - "vendor": "Cortland" - }, - "image_url": null, - "created_at": "2021-12-03T06:33:46.101Z", - "updated_at": null, - "object": "product", - "skus": { - "object": "list", - "data_ref": "data", - "data": [ + "/v1/customers/bulk/async": { + "post": { + "operationId": "update-customers-in-bulk", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Update Customers in bulk", + "description": "Update several customers in one asynchronous operation. \n\nIn one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. \n\nIf a requested customer object is not found, then an **upsert** occurs. This is reflected in the [Get Async Action](ref:get-async-action) endpoint as follows: \n\n\n```json\n{\n \"found\": false,\n \"updated\": true\n}\n```\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the customer fields that you would like to update in each customer object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/customers_update_in_bulk_request_body" + }, + "examples": { + "Example": { + "value": [ { - "id": "sku_0a417bd1d9952f9d6f", - "source_id": "test_iphone_8_silver_256gb", - "product_id": "prod_f1r5Tpr0DuC7", - "sku": "iPhone 8 Silver 256GB", - "price": null, - "currency": null, - "attributes": { - "color": "silver", - "memory": "256" + "source_id": "John.Smith@email.com", + "name": "John Smith", + "email": "john.smith@email.com", + "description": "Updating customer data", + "phone": "+1 (132) 222-2222", + "address": { + "city": "New York", + "country": "United States", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 4", + "postal_code": "10001", + "state": "NY" }, - "image_url": null, - "metadata": {}, - "created_at": "2021-12-03T06:33:46.599097+00:00", - "updated_at": null, - "object": "sku" + "metadata": { + "lang": "en", + "test": true + }, + "birthday": "2022-04-04" }, { - "id": "sku_0a417bd1d9952f9d6e", - "source_id": "test_iphone_8_silver_64gb", - "product_id": "prod_f1r5Tpr0DuC7", - "sku": "iPhone 8 Silver 64GB", - "price": null, - "currency": null, - "attributes": { - "color": "silver", - "memory": "64" + "source_id": "Jane.Smith@email.com", + "name": "Jane Smith", + "email": "Jane.Smith@email.com", + "description": "Updating customer data", + "phone": "+1 (132) 222-2222", + "address": { + "city": "New York", + "country": "United States", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 4", + "postal_code": "10001", + "state": "NY" }, - "image_url": null, - "metadata": {}, - "created_at": "2021-12-03T06:33:46.598595+00:00", - "updated_at": null, - "object": "sku" + "metadata": { + "lang": "en", + "test": true + }, + "birthday": "2022-03-03" + }, + { + "source_id": "Sally.Smith@email.com", + "name": "Sally Smith", + "email": "Sally.Smith@email.com", + "description": "Updating customer data", + "phone": "+1 (132) 222-2222", + "address": { + "city": "New York", + "country": "United States", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 4", + "postal_code": "10001", + "state": "NY" + }, + "metadata": { + "lang": "en", + "test": true + }, + "birthdate": "2022-02-02" } - ], - "total": 2 + ] } } } } - } - } - }, - "404": { - "description": "Returns an error when requesting a product that has been deleted or cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + }, + "responses": { + "202": { + "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and customers will be updated in the repository asynchronously. To check the update status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" + } + } + } + }, + "400": { + "description": "Returns an error if metadata fields are incorrect data type or a customer's source ID is missing in the request body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Metadata validation failed": { + "value": { + "code": 400, + "key": "metadata_validation_failed", + "message": "Metadata validation failed", + "details": "acquisition_channel: must be a string, property is required, must be equal to one of Facebook,Twitter,Website (actual value is 'true')", + "request_id": "v-0afb29d91094432cea" + } + }, + "Invalid payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Payload should have required property 'source_id'", + "request_id": "v-0ba51a2f5ec3bf76de" + } + } + } + } + } }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find product with id test_prod_id_", - "request_id": "v-0bae1d3caf478da111", - "resource_id": "test_prod_id_", - "resource_type": "product" + "429": { + "description": "Too Many Requests", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "default": 429 + }, + "message": { + "type": "string", + "default": "Too many requests hit the API too quickly." + } + } + } } } } } } - } - } - }, - "put": { - "operationId": "update-product", - "tags": [ - "PRODUCTS API" - ], - "summary": "Update Product", - "description": "Updates the specified product by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the parameters of the product that are to be updated.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_req_update_product" - }, - "examples": { - "Example": { - "value": { - "price": 210000 + }, + "/v1/customers/metadata/async": { + "post": { + "operationId": "update-customers-metadata-in-bulk", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Update Customers' Metadata in bulk", + "description": "Update several customers metadata properties in one asynchronous operation. \n\nIn one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. \n\nIf a requested customer object is not found, then an **upsert** occurs. This is reflected in the [Get Async Action](ref:get-async-action) endpoint as follows: \n\n\n```json\n{\n \"found\": false,\n \"updated\": true\n}\n```\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "List the `source_ids` of the customer's you would like to update along with the metadata key value pairs.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/customers_update_metadata_in_bulk_request_body" + }, + "examples": { + "Example": { + "value": { + "source_ids": [ + "source_123", + "source_456" + ], + "metadata": { + "lang": "en", + "test": false + } + } + } + } } } - } - } - } - }, - "responses": { - "200": { - "description": "Returns an updated product object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_obj_product_object_truncated" + }, + "responses": { + "202": { + "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and customers will be updated in the repository asynchronously. To check the update status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" + }, + "examples": { + "Example": { + "value": { + "async_action_id": "aa_0a875d56c805df6601" + } + } + } + } + } }, - "examples": { - "Example": { - "value": { - "id": "prod_0bae2dc5a090fd0184", - "source_id": "first_product", - "name": "Samsung Phone", - "price": 210000, - "attributes": [ - "color", - "memory", - "processor" - ], - "metadata": { - "test": false, - "vendor": "Online Stores" + "400": { + "description": "An error will be returned when submitting a request with no source IDs or missing metadata.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" }, - "image_url": "https://www.website.com/image.png", - "created_at": "2022-09-12T12:58:22.232Z", - "updated_at": "2022-09-12T13:33:48.904Z", - "object": "product" + "examples": { + "Not enough source IDs": { + "value": { + "code": 400, + "key": "not_enough_source_ids", + "message": "Not enough source_ids", + "details": "Specify at least 1 source_id", + "request_id": "v-0ba50abf2843bf6585" + } + }, + "Invalid Payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Payload should have required property 'metadata'", + "request_id": "v-0ba50c720789984b5c" + } + } + } } } } } } - } - } - }, - "delete": { - "operationId": "delete-product", - "tags": [ - "PRODUCTS API" - ], - "summary": "Delete Product", - "description": "This method deletes a product.", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "force", - "description": "If this flag is set to `true`, the product will be removed permanently. Going forward, the user will be able to create another product with exactly the same `source_id`." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." }, - "404": { - "description": "Returns an error indicating that the product with given ID was not found.", - "content": { - "application/json": { + "/v1/customers/{customerId}/consents": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_404_not_found" + "type": "string" }, - "examples": { - "Product Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find product with id prod_0a4934c50ddc5dbae", - "request_id": "v-0ae39cd7de8683dfd8", - "resource_id": "prod_0a4934c50ddc5dbae", - "resource_type": "product" - } - } - } + "name": "customerId", + "in": "path", + "required": true, + "description": "A Voucherify unique customer identifier or source ID." } - } - } - } - } - }, - "/v1/products/bulk/async": { - "post": { - "operationId": "update-products-in-bulk", - "tags": [ - "PRODUCTS API" - ], - "summary": "Update Products in bulk", - "description": "Update several products in one asynchronous operation. \n\nIn one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. If a requested product object is not found, then an **upsert** occurs. This is reflected in the [Get Async Action](ref:get-async-action) endpoint as follows: \n\n\n```json\n{\n \"found\": false,\n \"updated\": true\n}\n```\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Create an array of product objects, each with the parameters which you want to update.", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/11_req_update_product_bulk" + ], + "put": { + "operationId": "update-customers-consents", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Update Customer's consents", + "description": "Update marketing permissions for the specified customer.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] } - }, - "examples": { - "Example": { - "value": [ - { - "source_id": "first_product", - "name": "Samsung Phone 1", - "price": 220000, - "attributes": [ - "color", - "memory", - "processor" - ], - "metadata": { - "test": true, - "vendor": "Online Store - 3" - }, - "image_url": "https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_Z2qvs2KFnQyo2Ohz4uhsjGtf.png" + ], + "requestBody": { + "description": "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. \n\n#### Examples\n\n\n```json\n{\n \"cnst_aIdUulAh0SCsOCaS3005y7yS\": true,\n \"cnst_aIdUulAhwewqaS31213fdsfds\": false\n}\n```\n\nOpt-out from all communication:\n\n\n```json\n{\n \"unsubscribed\": true\n}\n```", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/9_req_update_customers_consents" }, - { - "source_id": "second_product", - "name": "Samsung Phone 2", - "price": 230000, - "attributes": [ - "color", - "memory", - "processor" - ], - "metadata": { - "test": true, - "vendor": "Online Store - 4" + "examples": { + "Example": { + "value": { + "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I": true, + "cnst_VCmucIvAsmDYw2PPAok6bcYy": false + } }, - "image_url": "https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_Z2qvs2KFnQyo2Ohz4uhsjGtf.png" + "Opt-out of all": { + "value": { + "unsubscribed": true + } + } } - ] + } } - } - } - } - }, - "responses": { - "202": { - "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and updates will be added to the repository asynchronously. To check the update status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" + }, + "responses": { + "204": { + "description": "Returns no content if the consents were updated successfully." }, - "examples": { - "Example": { - "value": { - "async_action_id": "aa_0a875d56c805df6601" + "400": { + "description": "Returns an error if the payload is empty.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Example": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "The payload cannot be empty", + "request_id": "v-0ba675252cc3bf6b03" + } + } + } } } } } } }, - "400": { - "description": "Returns an error if the required parameters are not included in the request body.", - "content": { - "application/json": { + "/client/v1/customers/{customerId}/consents#": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_error_no_translation" + "type": "string" }, - "examples": { - "Example": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Payload should have required property 'source_id'", - "request_id": "v-0bae44e063cca61aff" + "name": "customerId", + "in": "path", + "required": true, + "description": "A Voucherify customer identifier or `source_id`" + } + ], + "put": { + "operationId": "update-customers-consents-client-side", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Update Customer's consents (client-side)", + "description": "Update marketing permissions for the specified customer.", + "parameters": [], + "security": [ + { + "X-Client-Application-Id-1": [], + "X-Client-Token-1": [] + } + ], + "requestBody": { + "description": "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. \n\n#### Examples\n\n\n```json\n{\n \"cnst_aIdUulAh0SCsOCaS3005y7yS\": true,\n \"cnst_aIdUulAhwewqaS31213fdsfds\": false\n}\n```\n\nOpt-out from all communication:\n\n\n```json\n{\n \"unsubscribed\": true\n}\n```", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/9_req_update_customers_consents" + }, + "examples": { + "Example": { + "value": { + "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I": true, + "cnst_VCmucIvAsmDYw2PPAok6bcYy": false + } + }, + "Opt-out of all": { + "value": { + "unsubscribed": true + } + } } } } - } - } - } - } - } - }, - "/v1/products/metadata/async": { - "post": { - "operationId": "update-products-metadata-in-bulk", - "tags": [ - "PRODUCTS API" - ], - "summary": "Update Products' Metadata in bulk", - "description": "Update several product metadata properties in one asynchronous operation. \n\nIn one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. If a requested product object is not found, then an **upsert** occurs. This is reflected in the [Get Async Action](ref:get-async-action) endpoint as follows: \n\n\n```json\n{\n \"found\": false,\n \"updated\": true\n}\n```\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the list of product source IDs and the metadata key value pairs to be udpated for these products.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_req_update_products_metadata_in_bulk" }, - "examples": { - "Example": { - "value": { - "source_ids": [ - "123-567-3433", - "test_volleyball" - ], - "metadata": { - "label": true, - "origin": "PL" + "responses": { + "204": { + "description": "Returns no content if the consents were updated successfully." + }, + "400": { + "description": "Returns an error if the payload is empty.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Example": { + "value": {} + } + } } } } } } - } - }, - "responses": { - "202": { - "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and updates will be added to the repository asynchronously. To check the update status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { + }, + "/v1/customers/{customerId}/activities": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/a_res_async_actions" + "type": "string" + }, + "name": "customerId", + "in": "path", + "required": true, + "description": "A Voucherify customer ID or source ID of the customer who performed the activities." + } + ], + "get": { + "operationId": "list-customer-activities", + "tags": [ + "CUSTOMERS API" + ], + "summary": "List Customer Activities", + "description": "Retrieve customer activities.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/order" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "starting_after", + "description": "A cursor for use in pagination. `starting_after` is a date-time value that defines your place in the list based on `created_at` property from the activity object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after=2020-05-24T13:43:09.024Z in order to fetch the next page of the list." + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "starting_after_id", + "description": "By applying this filter value, you will get events starting after an event with the given ID." + }, + { + "schema": { + "enum": [ + "DISCOUNT_COUPONS", + "REFERRAL_PROGRAM", + "GIFT_VOUCHERS", + "PROMOTION", + "LOYALTY_PROGRAM" + ], + "type": "string" + }, + "in": "query", + "name": "campaign_type", + "description": "Through this parameter you can control a type of campaign by which Voucherify will filter related customer's activity. API will return only records related to that given type. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM" }, - "examples": { - "Example": { - "value": { - "async_action_id": "aa_0a875d56c805df6601" + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "campaign_id", + "description": "By applying this parameter you request only events related to specific campaign identified by its ID." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with customer activities.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/9_res_list_customer_activities" + } } } } } } }, - "400": { - "description": "Returns an error if the request parameters are not provided.", - "content": { - "application/json": { + "/v1/customers/{customerId}/segments": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_error_no_translation" + "type": "string", + "example": "cust_aSeH6JH52DPjYLC1G475Ii0N" }, - "examples": { - "Not enough source IDs": { - "value": { - "code": 400, - "key": "not_enough_source_ids", - "message": "Not enough source_ids", - "details": "Specify at least 1 ID in source_ids.", - "request_id": "v-0bae421d05078dcdb4" - } - }, - "Invalid Payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Payload should have required property 'metadata'", - "request_id": "v-0bae428dab8ca61825" + "name": "customerId", + "in": "path", + "required": true, + "description": "Unique identifier of a customer represented by an internal customer ID or customer source ID." + } + ], + "get": { + "operationId": "list-customer-segments", + "tags": [ + "CUSTOMERS API" + ], + "summary": "List Customer's Segments", + "description": "Returns the list of segments IDs to which the customer belongs to. \n\nIf you pass a `customerId` which is not stored and recognized by Voucherify as an existing customer in the system, the response will generate a list of segments that the customer would potentialy qualify for if they were to become a customer tracked in the system.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "The method returns segment(s) to which the given customer belongs to.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/14_res_customers_customerId_segments" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "seg_DNAOhUtJffvX0f57ajLMFBYR", + "name": "area code not 123", + "object": "segment" + }, + { + "id": "seg_IPIYx96l92Op0Sy5MOaImhgw", + "name": "not bob.smith@email.com", + "object": "segment" + }, + { + "id": "seg_1wc52c5z6r1kQ81brO8j9Hk2", + "name": "Birthday After Dec 31", + "object": "segment" + }, + { + "id": "seg_ZEbbT4mq1ePpM9PzR02lcww2", + "name": "Start with S", + "object": "segment" + }, + { + "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt", + "name": "Loyalty Card", + "object": "segment" + } + ], + "total": 5 + } + } + } } } } } } - } - } - } - }, - "/v1/skus/{skuId}": { - "parameters": [ - { - "schema": { - "type": "string" }, - "name": "skuId", - "in": "path", - "required": true, - "description": "A Voucherify SKU identifier or SKU source ID." - } - ], - "get": { - "operationId": "get-sku", - "tags": [ - "PRODUCTS API" - ], - "summary": "Get SKU", - "description": "Retrieve details of a SKU.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns requested SKU object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_obj_sku_object" - }, - "examples": { - "Example": { - "value": { - "id": "sku_0b1621b2f25248b79c", - "source_id": "sku_source_id_1", - "product_id": "prod_0b15f6b9f650c16990", - "sku": "Extra Small Blue Shirt", - "price": 1300, - "currency": "USD", - "attributes": { - "size": "XS", - "color": "blue", - "ranking": 1 - }, - "image_url": "", - "metadata": {}, - "created_at": "2022-05-17T10:36:30.057Z", - "updated_at": "2022-07-01T05:34:16.822Z", - "object": "sku" + "/v1/order-object": { + "get": { + "operationId": "order-object", + "tags": [ + "ORDERS API" + ], + "summary": "Order Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Order Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/10_obj_order_object" + } } } } } } }, - "404": { - "description": "Returns an error indicating that the sku with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + "/v1/orders": { + "get": { + "operationId": "list-orders", + "tags": [ + "ORDERS API" + ], + "summary": "List Orders", + "description": "Returns a list of orders.\n\n", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find sku with id sku_0b1621b319d248b79", - "request_id": "v-0b4fe3ddc55646d01d", - "resource_id": "sku_0b1621b319d248b79", - "resource_type": "sku" + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + }, + "in": "query", + "name": "order", + "description": "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." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "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.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/10_res_list_orders" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "orders", + "orders": [ + { + "id": "ord_v5vupdacgud1CwUSyKqSlHuk", + "source_id": null, + "created_at": "2022-09-09T07:44:41.594Z", + "updated_at": "2022-09-09T07:44:42.331Z", + "status": "PAID", + "amount": 2700, + "discount_amount": 1243, + "items_discount_amount": 270, + "total_discount_amount": 1513, + "total_amount": 1187, + "items": [ + { + "object": "order_item", + "source_id": "prod_5h1pp1ng", + "related_object": "product", + "quantity": 1, + "amount": 700, + "discount_amount": 70, + "price": 700, + "subtotal_amount": 630, + "product": { + "name": "Shipping" + } + }, + { + "object": "order_item", + "source_id": "roses_1", + "related_object": "product", + "quantity": 1, + "amount": 500, + "discount_amount": 50, + "price": 500, + "subtotal_amount": 450, + "product": { + "name": "Bouquet - Romantic Roses", + "price": 500 + } + }, + { + "object": "order_item", + "source_id": "vase_1", + "related_object": "product", + "quantity": 1, + "amount": 1500, + "discount_amount": 150, + "price": 1500, + "subtotal_amount": 1350, + "product": { + "name": "Vase - Boho Vintage", + "price": 1500 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "object": "customer" + }, + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0baa093537528ef645": { + "date": "2022-09-09T07:44:41.695Z", + "related_object_type": "redemption", + "related_object_id": "r_0baa093537528ef645", + "stacked": [ + "r_0baa093537528ef646", + "r_0baa093537528ef647", + "r_0baa093537528ef648" + ] + } + } + }, + { + "id": "ord_3JkWC6jG0JgyRf5lO3r4IyU1", + "source_id": null, + "created_at": "2022-09-09T07:04:22.597Z", + "updated_at": "2022-09-09T07:04:23.743Z", + "status": "PAID", + "amount": 73100, + "items_discount_amount": 7310, + "total_discount_amount": 7310, + "total_amount": 65790, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 70000, + "discount_amount": 7000, + "price": 70000, + "subtotal_amount": 63000, + "product": { + "name": "Apple iPhone 12", + "price": 70000 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1600, + "discount_amount": 160, + "price": 1600, + "subtotal_amount": 1440, + "product": { + "name": "Comic Books1", + "price": 1600 + }, + "sku": { + "sku": "Comics1", + "price": 1600 + } + }, + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 1, + "amount": 1500, + "discount_amount": 150, + "price": 1500, + "subtotal_amount": 1350, + "product": { + "name": "Vase - Boho Vintage", + "price": 1500 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "object": "customer" + }, + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0ba9fffae90e1b2495": { + "date": "2022-09-09T07:04:22.692Z", + "related_object_type": "voucher", + "related_object_id": "v_24rljiUfdLNC9poBf0BPNmoh2txzFkLs" + } + } + }, + { + "id": "ord_HwdbziIPvUZJkIC7z74FKmPv", + "source_id": null, + "created_at": "2022-09-09T06:47:14.195Z", + "updated_at": "2022-09-09T06:47:15.369Z", + "status": "PAID", + "amount": 71600, + "discount_amount": 7160, + "total_discount_amount": 7160, + "total_amount": 64440, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1600, + "price": 1600, + "subtotal_amount": 1600, + "product": { + "name": "Comic Books1", + "price": 1600 + }, + "sku": { + "sku": "Comics1", + "price": 1600 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 70000, + "price": 70000, + "subtotal_amount": 70000, + "product": { + "name": "Apple iPhone 12", + "price": 70000 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "object": "customer" + }, + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0ba9fc0eb00e1b2230": { + "date": "2022-09-09T06:47:14.369Z", + "related_object_type": "voucher", + "related_object_id": "v_3vEprqa6tbzfhFtpjr4mDlkNchXepW7s" + } + } + }, + { + "id": "ord_HRluwFS2seoILUkXxWML0D7Z", + "source_id": null, + "created_at": "2022-09-09T06:44:27.383Z", + "updated_at": "2022-09-09T06:44:28.252Z", + "status": "PAID", + "amount": 71600, + "discount_amount": 100, + "total_discount_amount": 100, + "total_amount": 71500, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1600, + "price": 1600, + "subtotal_amount": 1600, + "product": { + "name": "Comic Books1", + "price": 1600 + }, + "sku": { + "sku": "Comics1", + "price": 1600 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 70000, + "price": 70000, + "subtotal_amount": 70000, + "product": { + "name": "Apple iPhone 12", + "price": 70000 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "object": "customer" + }, + "referrer": { + "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", + "object": "customer" + }, + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", + "object": "order", + "redemptions": { + "r_0ba9fb6bb7928ed9ec": { + "date": "2022-09-09T06:44:27.486Z", + "related_object_type": "voucher", + "related_object_id": "v_vhHuiEmZSchWHtE0xKm0HM7PFCR9cNkA", + "related_object_parent_id": "camp_rRsfatlwN7unSeUIJDCYedal" + } + } + }, + { + "id": "ord_Qg5utCohAZ3tafYvc1O4C80r", + "source_id": null, + "created_at": "2022-09-09T06:42:34.083Z", + "updated_at": "2022-09-09T06:42:35.169Z", + "status": "PAID", + "amount": 70000, + "discount_amount": 4000, + "total_discount_amount": 4000, + "total_amount": 66000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 70000, + "price": 70000, + "subtotal_amount": 70000, + "product": { + "name": "Apple iPhone 12", + "price": 70000 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "object": "customer" + }, + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0ba9fafd11d28ed999": { + "date": "2022-09-09T06:42:34.183Z", + "related_object_type": "voucher", + "related_object_id": "v_RaMaTT7F0Q47BetdGcFxsyqwo1aZGzJs", + "related_object_parent_id": "camp_hg7ajfHh6DcE1xa18mw3SdF6" + } + } + }, + { + "id": "ord_G9LBb5SOPa36pHdwxUvzkw4P", + "source_id": null, + "created_at": "2022-09-09T06:38:17.984Z", + "updated_at": "2022-09-09T06:38:19.064Z", + "status": "PAID", + "amount": 4600, + "items_discount_amount": 300, + "total_discount_amount": 300, + "total_amount": 4300, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1600, + "price": 1600, + "subtotal_amount": 1600, + "product": { + "name": "Comic Books1", + "price": 1600 + }, + "sku": { + "sku": "Comics1", + "price": 1600 + } + }, + { + "object": "order_item", + "product_id": "prod_0a65b3ff8592d7a5b5", + "quantity": 1, + "amount": 3000, + "discount_amount": 300, + "price": 3000, + "subtotal_amount": 2700, + "product": { + "name": "Koffee Cup", + "price": 3000 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "object": "customer" + }, + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0ba9fa02fcd28ed8f1": { + "date": "2022-09-09T06:38:18.099Z", + "related_object_type": "voucher", + "related_object_id": "v_KqP2NOSb4dJb1D6UBhcq7ScPZXun0y40", + "related_object_parent_id": "camp_hC2GdqYtOmTT45zfhib62cK1" + } + } + }, + { + "id": "ord_N3YBowDTZs0UH2hHoMZLbUDN", + "source_id": null, + "created_at": "2022-09-09T06:18:31.459Z", + "updated_at": "2022-09-09T06:18:31.624Z", + "status": "PAID", + "amount": 71600, + "discount_amount": 7160, + "total_discount_amount": 7160, + "total_amount": 64440, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 70000, + "price": 70000, + "subtotal_amount": 70000, + "product": { + "name": "Apple iPhone 12", + "price": 70000 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1600, + "price": 1600, + "subtotal_amount": 1600, + "product": { + "name": "Comic Books1", + "price": 1600 + }, + "sku": { + "sku": "Comics1", + "price": 1600 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", + "object": "customer" + }, + "customer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0ba9f57c37128ed639": { + "date": "2022-09-09T06:18:31.516Z", + "related_object_type": "promotion_tier", + "related_object_id": "promo_CQonGnrsFAdEJfJQ3oKB3a8G", + "related_object_parent_id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0" + } + } + }, + { + "id": "ord_3R6vsxRZRkND8rpe0rAn9Agc", + "source_id": null, + "created_at": "2022-09-05T08:13:13.720Z", + "updated_at": "2022-09-05T08:13:14.498Z", + "status": "PAID", + "amount": 74000, + "items_discount_amount": 1500, + "total_discount_amount": 1500, + "total_amount": 72500, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 70000, + "price": 70000, + "subtotal_amount": 70000, + "product": { + "name": "Apple iPhone 12", + "price": 70000 + } + }, + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 2, + "amount": 3000, + "discount_amount": 500, + "price": 1500, + "subtotal_amount": 2500, + "product": { + "name": "Vase - Boho Vintage", + "price": 1500 + } + }, + { + "object": "order_item", + "product_id": "prod_0b72b00ffed198e344", + "quantity": 2, + "amount": 1000, + "discount_amount": 1000, + "price": 500, + "subtotal_amount": 0, + "product": { + "name": "Bouquet - Romantic Roses", + "price": 500 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_CSnYd37MXmrbS19XCrghjBsv", + "object": "customer" + }, + "customer_id": "cust_CSnYd37MXmrbS19XCrghjBsv", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0ba4e961444579711a": { + "date": "2022-09-05T08:13:13.873Z", + "related_object_type": "voucher", + "related_object_id": "v_hwySVBBk6YmMD4GzZHJzke1Fxo3QO7kP", + "related_object_parent_id": "camp_Uji5a53s5wRSUHqznncTkhHh" + } + } + }, + { + "id": "ord_7bqlkoHyEJCQuxVZpKfZYNeA", + "source_id": null, + "created_at": "2022-09-02T17:12:13.213Z", + "updated_at": "2022-09-02T17:12:13.969Z", + "status": "PAID", + "amount": 292400, + "items_discount_amount": 900, + "total_discount_amount": 900, + "total_amount": 291500, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 4, + "amount": 6400, + "price": 1600, + "subtotal_amount": 6400, + "product": { + "name": "Comic Books1", + "price": 1600 + }, + "sku": { + "sku": "Comics1", + "price": 1600 + } + }, + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 4, + "amount": 6000, + "price": 1500, + "subtotal_amount": 6000, + "product": { + "name": "Vase - Boho Vintage", + "price": 1500 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 4, + "amount": 280000, + "discount_amount": 900, + "price": 70000, + "subtotal_amount": 279100, + "product": { + "name": "Apple iPhone 12", + "price": 70000 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_CSnYd37MXmrbS19XCrghjBsv", + "object": "customer" + }, + "customer_id": "cust_CSnYd37MXmrbS19XCrghjBsv", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0ba187f9bb45792c13": { + "date": "2022-09-02T17:12:13.293Z", + "related_object_type": "voucher", + "related_object_id": "v_pg6DhwhmeZASoSoJ15PdzMT9MhsPjYuc", + "related_object_parent_id": "camp_W8DJVd8J0btqXT6FBwn7BSkC" + } + } + }, + { + "id": "ord_7HwbJiHmS07O7FsVAtjJcuRS", + "source_id": null, + "created_at": "2022-09-02T17:08:37.794Z", + "updated_at": "2022-09-02T17:08:38.879Z", + "status": "PAID", + "amount": 223900, + "items_discount_amount": 900, + "total_discount_amount": 900, + "total_amount": 223000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 4, + "amount": 6400, + "discount_amount": 300, + "price": 1600, + "subtotal_amount": 6100, + "product": { + "name": "Comic Books1", + "price": 1600 + }, + "sku": { + "sku": "Comics1", + "price": 1600 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 3, + "amount": 210000, + "discount_amount": 300, + "price": 70000, + "subtotal_amount": 209700, + "product": { + "name": "Apple iPhone 12", + "price": 70000 + } + }, + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 5, + "amount": 7500, + "discount_amount": 300, + "price": 1500, + "subtotal_amount": 7200, + "product": { + "name": "Vase - Boho Vintage", + "price": 1500 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_CSnYd37MXmrbS19XCrghjBsv", + "object": "customer" + }, + "customer_id": "cust_CSnYd37MXmrbS19XCrghjBsv", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0ba1872762c5792b73": { + "date": "2022-09-02T17:08:37.899Z", + "related_object_type": "voucher", + "related_object_id": "v_yQydppWWJpSUuGNEWJ4I2upFGY2Ma4IY", + "related_object_parent_id": "camp_A5L21BD4cJii28882owYBqTV" + } + } + } + ], + "total": 441 + } + } + } } } } } - } - } - } - } - }, - "/v1/products/{productId}/skus": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "productId", - "in": "path", - "description": "A Voucherify [product](ref:get-product) ID or product source ID.", - "required": true - } - ], - "get": { - "operationId": "list-skus-in-product", - "tags": [ - "PRODUCTS API" - ], - "summary": "List SKUs in Product", - "description": "Retrieve all SKUs for a given product.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ] }, - "in": "query", - "name": "order", - "description": "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." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary of SKUs.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_res_products_productId_skus" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "skus", - "skus": [ - { - "id": "sku_0b1621b2f25248b79c", - "source_id": "sku_source_id_1", - "product_id": "prod_0b15f6b9f650c16990", - "sku": "Extra Small Blue Shirt", - "price": 1300, - "currency": "USD", - "attributes": { - "size": "XS", - "color": "blue", - "ranking": 1 + "post": { + "operationId": "create-order", + "tags": [ + "ORDERS API" + ], + "summary": "Create Order", + "description": "Creates an order object and triggers an order creation event. ", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the order parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/10_req_create_order" + }, + "examples": { + "Example": { + "value": { + "amount": 20000, + "customer": { + "source_id": "sample_customer" }, - "image_url": "", - "metadata": {}, - "created_at": "2022-05-17T10:36:30.057Z", - "updated_at": "2022-07-01T05:34:16.822Z", - "object": "sku" - }, - { - "id": "sku_0b1621b3181248b79d", - "source_id": "sku_source_id_3", - "product_id": "prod_0b15f6b9f650c16990", - "sku": "Medium Yellow Shirt", - "price": 1450, - "currency": "USD", - "attributes": { - "size": "M", - "color": "yellow", - "ranking": 3 + "status": "PAID", + "items": [ + { + "quantity": 1, + "price": 20000, + "source_id": "sample product1", + "related_object": "product", + "product": { + "metadata": { + "key": "value" + } + } + } + ] + } + }, + "Example 2": { + "value": { + "source_id": "new", + "status": "FULFILLED", + "metadata": { + "location_id": [ + "L1", + "L2" + ], + "payment_mean": [ + "paypal", + "credit-card" + ] }, - "image_url": "", - "metadata": {}, - "created_at": "2022-05-17T10:36:30.180Z", - "updated_at": "2022-07-01T05:34:16.842Z", - "object": "sku" - }, - { - "id": "sku_0b1621b3199248b79e", - "source_id": "sku_source_id_2", - "product_id": "prod_0b15f6b9f650c16990", - "sku": "Small Red Shirt", - "price": 1400, - "currency": "USD", - "attributes": { - "size": "S", - "color": "red", - "ranking": 2 + "customer": { + "source_id": "bob.smith.1@email.com", + "name": "Bob Smith", + "description": "A nice customer", + "email": "bob.smith.1@email.com", + "phone": "+1 933 222 3333", + "address": { + "city": "New York", + "country": "United Statese", + "line_1": "123 Main St", + "line_2": "APT 3 BLG 4", + "postal_code": "10001", + "state": "NY" + }, + "metadata": { + "lang": "en", + "test": false + }, + "birthdate": "2022-01-02" }, - "image_url": "", - "metadata": {}, - "created_at": "2022-05-17T10:36:30.183Z", - "updated_at": "2022-07-01T05:34:16.927Z", - "object": "sku" - }, - { - "id": "sku_0b1621b319d248b79f", - "source_id": "sku_source_id_4", - "product_id": "prod_0b15f6b9f650c16990", - "sku": "Large Pink Shirt -", - "price": 1700, - "currency": "USD", - "attributes": { - "size": "L", - "color": "pink", - "ranking": 4 + "referrer": { + "source_id": "jane.smith@email.com", + "name": "Jane Smith", + "description": "A really nice customer", + "email": "jane.smith@email.com", + "phone": "+1 933 222 3334", + "address": { + "city": "New York", + "country": "United States", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 4", + "postal_code": "10001", + "state": "NY" + }, + "metadata": { + "lang": "en", + "test": false + }, + "birthday": "2022-03-03" }, - "image_url": "", - "metadata": {}, - "created_at": "2022-05-17T10:36:30.187Z", - "updated_at": "2022-07-05T08:47:50.680Z", - "object": "sku" + "items": [ + { + "source_id": "prod_1", + "related_object": "product", + "quantity": 2, + "product": { + "name": "Apple iPhone 12", + "price": 60000, + "metadata": { + "color": [ + "purple" + ], + "vendor": "mall" + }, + "override": true + } + }, + { + "source_id": "ComicBook_1", + "related_object": "sku", + "quantity": 1, + "product": { + "source_id": "Books", + "name": "Comic Books1", + "price": 2100, + "metadata": { + "color": [ + "silver" + ], + "vendor": "Bookstore1" + }, + "override": true + }, + "sku": { + "sku": "Comics1", + "source_id": "ComicBook_1", + "price": 1700, + "metadata": { + "color": [ + "golden" + ], + "vendor": "islands" + }, + "override": true + } + } + ] } - ], - "total": 4 - } - } - } - } - } - }, - "404": { - "description": "Returns an error when requesting a product that has been deleted or cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Example": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find product with id prod_0b15f6b9f650c6990", - "request_id": "v-0bae223075878da708", - "resource_id": "prod_0b15f6b9f650c6990", - "resource_type": "product" + } } } } - } - } - } - } - }, - "post": { - "operationId": "create-sku", - "tags": [ - "PRODUCTS API" - ], - "summary": "Create SKU", - "description": "This method adds product varients to a [created product](ref:create-product).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the SKU parameters to be created.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_req_create_sku" }, - "examples": { - "Example": { - "value": { - "source_id": "first_product_sku_1", - "sku": "Samsung phone 256GB", - "price": 1300, - "currency": "USD", - "attributes": { - "color": "vintage-black", - "memory": "256", - "processor": "Intel" - }, - "image_url": "https://www.website.com/image.png", - "metadata": { - "imported": true - } - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns the created SKU object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_obj_sku_object" - }, - "examples": { - "Example": { - "value": { - "id": "sku_0bae3b28f610fd0da1", - "source_id": "first_product_sku_1", - "product_id": "prod_0bae2dc5a090fd0184", - "sku": "Samsung phone 256GB", - "price": 1300, - "currency": "USD", - "attributes": { - "color": "vintage-black", - "memory": "256", - "processor": "Intel" - }, - "image_url": "https://www.website.com/image.png", - "metadata": { - "imported": true + "responses": { + "200": { + "description": "Returns an order object if the operation succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/10_obj_order_object_no_discount_calculations" }, - "created_at": "2022-09-12T13:56:51.828Z", - "updated_at": null, - "object": "sku" + "examples": { + "Example": { + "value": { + "id": "ord_cRKOEXiBOj0EZKF7g9n6l0eH", + "source_id": "new", + "created_at": "2022-09-09T09:20:01.660Z", + "updated_at": "2022-09-09T09:24:43.604Z", + "status": "FULFILLED", + "amount": 121700, + "total_amount": 121700, + "items": [ + { + "object": "order_item", + "source_id": "prod_1", + "related_object": "product", + "quantity": 2, + "amount": 120000, + "price": 60000, + "subtotal_amount": 120000, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "metadata": { + "color": [ + "purple" + ], + "vendor": "mall" + }, + "price": 60000 + } + }, + { + "object": "order_item", + "source_id": "ComicBook_1", + "related_object": "sku", + "product_id": "prod_0b7d7dfb05cbe5c616", + "quantity": 1, + "amount": 1700, + "price": 1700, + "subtotal_amount": 1700, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "metadata": { + "color": [ + "silver" + ], + "vendor": "Bookstore1" + }, + "price": 2100 + }, + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "metadata": { + "color": [ + "golden" + ], + "vendor": "islands" + }, + "price": 1700 + } + } + ], + "metadata": { + "location_id": [ + "L1", + "L2" + ], + "payment_mean": [ + "paypal", + "credit-card" + ] + }, + "customer": { + "id": "cust_H0nXrItO1DNV3UiPIl54HA5o", + "object": "customer" + }, + "referrer": { + "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", + "object": "customer" + }, + "customer_id": "cust_H0nXrItO1DNV3UiPIl54HA5o", + "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", + "object": "order" + } + } + } } } } } } - } - } - } - }, - "/v1/products/{productId}/skus/{skuId}": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "productId", - "in": "path", - "required": true, - "description": "A unique Voucherify [product](ref:get-product) ID or product source ID." - }, - { - "schema": { - "type": "string" }, - "name": "skuId", - "in": "path", - "required": true, - "description": "A Voucherify [SKU ID](ref:get-sku) or SKU source ID." - } - ], - "put": { - "operationId": "update-sku", - "tags": [ - "PRODUCTS API" - ], - "summary": "Update SKU", - "description": "Updates the specified SKU by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged.\n\nFields other than the ones listed in the request body schema won't be modified. Even if provided, they will be silently skipped.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the parameters to be updated.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_req_update_sku" - }, - "examples": { - "Example": { - "value": { - "price": 210000, - "currency": "PLN" - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns the SKU object with the updated parameters.", - "content": { - "application/json": { + "/v1/orders/{orderId}": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/11_obj_sku_object" + "type": "string" }, - "examples": { - "Example": { - "value": { - "id": "sku_0bae3b28f610fd0da1", - "source_id": "first_product_sku_1", - "product_id": "prod_0bae2dc5a090fd0184", - "sku": "Samsung phone 256GB", - "price": 210000, - "currency": "PLN", - "attributes": { - "color": "vintage-black", - "memory": "256", - "processor": "Intel" - }, - "image_url": "https://www.website.com/image.png", - "metadata": { - "imported": true - }, - "created_at": "2022-09-12T13:56:51.828Z", - "updated_at": "2022-09-12T14:09:40.859Z", - "object": "sku" - } - } - } + "name": "orderId", + "in": "path", + "required": true, + "description": "Unique Voucherify order ID or order source ID." } - } - } - } - }, - "delete": { - "operationId": "delete-sku", - "tags": [ - "PRODUCTS API" - ], - "summary": "Delete SKU", - "description": "This method deletes a product SKU.", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "force", - "description": "If this flag is set to `true`, the SKU will be removed permanently. Going forward, the user will be able to create another SKU with exactly the same `source_id`." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." - }, - "404": { - "description": "Returns an error indicating that the product or sku with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Product Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find product with id 123-567-343", - "request_id": "v-0ae3a0d26fd40ecd11", - "resource_id": "123-567-343", - "resource_type": "product" - } - }, - "SKU Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find sku with id sku_0ae3a06b20019ba8f", - "request_id": "v-0ae3a1534d940ecd81", - "resource_id": "sku_0ae3a06b20019ba8f", - "resource_type": "sku" + ], + "get": { + "operationId": "get-order", + "tags": [ + "ORDERS API" + ], + "summary": "Get Order", + "description": "Retrieve an order.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns an order object if a valid identifier was provided. ", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/10_obj_order_object" + } } } - } - } - } - } - } - } - }, - "/v1/products/importCSV": { - "post": { - "operationId": "import-products-using-csv", - "tags": [ - "PRODUCTS API" - ], - "summary": "Import Products using CSV", - "description": "Import products into the repository using a CSV file. \n\nCurl Example\n\n```cURL\ncurl -X POST \\\n https://api.voucherify.io/v1/products/importCSV \\\n -F file=@/path/to/products.csv \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\"\n```\n\nThe CSV file has to include headers in the first line.\n\n\n\n> 📘 Standard product fields mapping\n>\n> - Create a **comma separated value (CSV) file** or download our CSV import template. You can find an example template [here](https://s3.amazonaws.com/helpscout.net/docs/assets/5902f1c12c7d3a057f88a36d/attachments/627b82ed68d51e779443f550/Import_products_template.csv).\n> - Supported CSV file headers: `name,source_id,price,attributes,image_url,Metadata_property_name`\n> - **Name** is a **required** field. The remaining fields in the CSV template are optional.\n> - Override/Update products' **names** in Voucherify using this method. Data will be updated for each product included in the CSV file whose **source_id** matches a source ID in Voucherify. No other data can be updated other than the product name.\n> - Note that dates and date-time attributes need to be provided in compliance with the **ISO 8601 norms**. For example, 2022-03-11T09:00:00.000Z or 2022-03-11\n> - `YYYY-MM-DD`\n> - `YYYY-MM-DDTHH`\n> - `YYYY-MM-DDTHH:mm`\n> - `YYYY-MM-DDTHH:mm:ss`\n> - `YYYY-MM-DDTHH:mm:ssZ`\n> - `YYYY-MM-DDTHH:mm:ssZ`\n> - `YYYY-MM-DDTHH:mm:ss.SSSZ`\n> - Columns that can't be mapped to standard fields, will be mapped to **Custom attributes** and added as **products' metadata**. There is no limit on the number of custom attributes that you can import as metadata. \n> - To provide the proper data type, you need to add all custom attributes to the metadata schema **before importing the file**. Read more [here](https://support.voucherify.io/article/99-schema-validation-metadata#add-metadata).\n> - **Product attributes** (not custom attributes) need to be separated by a comma and enclosed in double quotes, i.e \"attribute1,attribute2\".\n> - Headers with metadata names **can't contain white-space characters**.\n> - If you import metadata defined in the schema as **arrays (multiple)**, you need to separate each value using a comma, for example: \n> - array of strings: \"subscribed,premium\" \n> - array of numbers: \"123,234\". \n> - array of dates: \"2000-01-01,2000-01-02\"\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "The file path is stored in the form `file` header.", - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/a_req_importCSV" - } - } - } - }, - "responses": { - "200": { - "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and products will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" }, - "examples": { - "Async Action": { - "value": { - "async_action_id": "aa_0a875d56c805df6601" + "404": { + "description": "Returns an error when requesting an order that has been deleted or cannot be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find order with id ord_nIcO2s8iD4Xh5E9IGDQ57Ax", + "request_id": "v-0baa1ad023d0656a84", + "resource_id": "ord_nIcO2s8iD4Xh5E9IGDQ57Ax", + "resource_type": "order" + } + } + } } } } } - } - }, - "400": { - "description": "Returns an invalid payload error. You may receive this error if you have incorrectly or have not specified the content type as `multipart/form-data` in the headers.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Invalid payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Payload should have required property 'file'", - "request_id": "v-0c4c46bbad0136789f" + }, + "put": { + "operationId": "update-order", + "tags": [ + "ORDERS API" + ], + "summary": "Update Order", + "description": "Updates the specified order by setting the values of the parameters passed in the request body. Any parameters not provided will be left unchanged.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the parameters of the order that are to be updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/10_req_update_order" + }, + "examples": { + "Example": { + "value": { + "status": "CANCELED" + } + } } } } - } - } - } - } - } - }, - "/v1/skus/importCSV": { - "post": { - "operationId": "import-skus-using-csv", - "tags": [ - "PRODUCTS API" - ], - "summary": "Import SKUs using CSV", - "description": "Import SKUs into the repository using a CSV file.\n\nThe CSV file has to include headers in the first line. All properties which cannot be mapped to standard SKU fields will be added to the metadata object. You can find an example template [here](https://s3.amazonaws.com/helpscout.net/docs/assets/5902f1c12c7d3a057f88a36d/attachments/627b98d08c9b585083488a4c/Import_SKUS_template.csv). \n\nCurl Example\n\n```cURL\ncurl -X POST \\\n https://api.voucherify.io/v1/skus/importCSV \\\n -F file=@/path/to/skus.csv \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\"\n```\n> 🚧 Import sequence\n>\n> First import products using the [dedicated endpoint](ref:import-products-using-csv), then import SKUs using this endpoint to properly match SKUs to products.\n\n\n\n> 📘 Standard SKU fields mapping\n>\n> - **Required** fields are source_id and product_id.\n> - Supported CSV file headers: `product_id,sku,source_id,price,image_url,attributes`\n> - SKU **source_id**'s must be unique in the entire product catalog, no duplicates allowed.\n> - SKU attributes need to be in the form of a stringy-fied json, i.e.`\"{'color':'blue'}\"`. These attributes must be defined in the **product** beforehand in order for you to be able to import them to the SKU.\n> - You can use this method to update the following parameters in bulk: **sku** and the sku **price**.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "The file path is stored in the form `file` header.", - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/a_req_importCSV" - } - } - } - }, - "responses": { - "200": { - "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and SKUs will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" - }, - "examples": { - "Async Action": { - "value": { - "async_action_id": "aa_0a875d56c805df6601" + }, + "responses": { + "200": { + "description": "Returns the order object if the update succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/10_obj_order_object" + }, + "examples": { + "Example": { + "value": { + "id": "ord_cRKOEXiBOj0EZKF7g9n6l0eH", + "source_id": "new", + "created_at": "2022-09-09T09:20:01.660Z", + "updated_at": "2022-09-09T09:41:00.881Z", + "status": "CANCELED", + "amount": 121700, + "total_amount": 121700, + "items": [ + { + "object": "order_item", + "source_id": "prod_1", + "related_object": "product", + "quantity": 2, + "amount": 120000, + "price": 60000, + "subtotal_amount": 120000, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "metadata": { + "color": [ + "purple" + ], + "vendor": "mall" + }, + "price": 60000 + } + }, + { + "object": "order_item", + "source_id": "ComicBook_1", + "related_object": "sku", + "product_id": "prod_0b7d7dfb05cbe5c616", + "quantity": 1, + "amount": 1700, + "price": 1700, + "subtotal_amount": 1700, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "metadata": { + "color": [ + "silver" + ], + "vendor": "Bookstore1" + }, + "price": 2100 + }, + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "metadata": { + "color": [ + "golden" + ], + "vendor": "islands" + }, + "price": 1700 + } + } + ], + "metadata": { + "location_id": [ + "L1", + "L2" + ], + "payment_mean": [ + "paypal", + "credit-card" + ] + }, + "customer": { + "id": "cust_H0nXrItO1DNV3UiPIl54HA5o", + "object": "customer" + }, + "referrer": { + "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", + "object": "customer" + }, + "customer_id": "cust_H0nXrItO1DNV3UiPIl54HA5o", + "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", + "object": "order" + } + } + } } } } } } - } - } - } - }, - "/v1/product-collection-object": { - "get": { - "operationId": "product-collection-object", - "tags": [ - "PRODUCT COLLECTIONS API" - ], - "summary": "Product Collection Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Product Collection Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/product_collections_collection_item" - } - } - } - } - } - } - }, - "/v1/product-collections": { - "get": { - "operationId": "list-product-collections", - "tags": [ - "PRODUCT COLLECTIONS API" - ], - "summary": "List Product Collections", - "description": "This method returns a list of product collections.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" }, - { - "$ref": "#/components/parameters/page" - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at" - ] - }, - "in": "query", - "name": "order", - "description": "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." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary containing a list of product collections and details about each product collection.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/product_collections_list_response_body" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "pc_Dj1qSH7bho4SVh7aSDKjU174", - "name": "Products in Poland", - "type": "AUTO_UPDATE", - "filter": { - "junction": "and", - "metadata.product_location": { - "conditions": { - "$in_location": [ - "loc_RcYz537sV07e1t5aG5tIH9FD" - ] - } - } - }, - "created_at": "2022-07-14T16:12:26.377Z", - "object": "products_collection" - }, - { - "id": "pc_FJdBpaQyvK6Gcdul4D2HRChI", - "name": "Price less than 10", - "type": "AUTO_UPDATE", - "filter": { - "junction": "and", - "price": { - "conditions": { - "$less_than": [ - 1000 - ] - } - } - }, - "created_at": "2022-03-17T07:11:25.406Z", - "object": "products_collection" - }, - { - "id": "pc_4ndRXAsTOzwSdHcQcxf489uU", - "name": "Color is brown", - "type": "AUTO_UPDATE", - "filter": { - "junction": "and", - "metadata.color": { - "conditions": { - "$is": [ - "brown" - ] + "/v1/orders/import": { + "post": { + "operationId": "import-orders", + "tags": [ + "ORDERS API" + ], + "summary": "Import Orders", + "description": "\n\n> 🚧 Historical orders\n>\n> This endpoint should only be used to import historical orders into Voucherify. For on-going synchronization, the [create order](ref:create-order) and [update order](ref:update-order) endpoints should be used. This is critical because this endpoint does not store events or launch distributions.\n\n## Limitations\n\n### Import volume\n\nThere 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. \n\n### Maximum count of orders in single import\n\nThere is a `2000` limit but we might decide to change it to a lower / higher value at any given time depending if we find this value is too high or too low with time.\n\n## Notifications\n\nThere are no notifications on the Dashboard because this import is launched via the API.\n\n## Triggered actions\n \nIf you import orders with customers, then a logic will be scheduled responsible for placing these customers into segments and refreshing the segment's summary. Consequently, this update will trigger \n- **customers entering into segments** \n- **distributions** based on any rules tied to customer entering segment(s)\n- **earning rules** based on the customer entering segment(s)\n\n## What is not triggered\n\n1. No webhooks are triggered during the import of orders - for both orders and upserted products / skus. \n\n2. 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. \n\n3. No events are created during the import of orders - for both orders and upserted products / skus. In other words you won't 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 won't see the Product created events listed, etc. \n\n4. Earning rules based on Order Paid won't be triggered.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "The request body is sent in the form of an array of order objects.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/10_req_orders_import" + }, + "examples": { + "Example": { + "value": [ + { + "source_id": "orderImport14", + "status": "PAID", + "metadata": { + "location_id": [ + "L1", + "L2" + ], + "payment_mean": [ + "paypal", + "credit-card" + ] + }, + "customer": { + "source_id": "bob2.smith@email.com", + "name": "Bob Smith", + "description": "A nice customer", + "email": "bob.smith@email.com", + "phone": "+1 933 222 3333", + "address": { + "city": "New York", + "country": "United States", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 4", + "postal_code": "10001", + "state": "NY" + }, + "metadata": { + "lang": "en", + "test": true + }, + "birthdate": "2022-01-01" + }, + "referrer": { + "source_id": "jane.smith@email.com", + "name": "Jane Smith", + "description": "A really nice customer", + "email": "jane.smith@email.com", + "phone": "+1 933 222 3334", + "address": { + "city": "New York", + "country": "United States", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 4", + "postal_code": "10001", + "state": "NY" + }, + "metadata": { + "lang": "en", + "test": false + }, + "birthday": "2022-03-03" + }, + "items": [ + { + "source_id": "prod_1", + "related_object": "product", + "quantity": 2, + "product": { + "name": "Apple iPhone 12", + "price": 70000, + "metadata": { + "color": [ + "silver" + ], + "vendor": "mall" + }, + "override": true + } + }, + { + "source_id": "ComicBook_1", + "related_object": "sku", + "quantity": 1, + "product": { + "source_id": "Books", + "name": "Comic Books1", + "price": 1600, + "metadata": { + "color": [ + "silver" + ], + "vendor": "Bookstore1" + }, + "override": true + }, + "sku": { + "sku": "Comics1", + "source_id": "ComicBook_1", + "price": 1600, + "metadata": { + "color": [ + "golden" + ], + "vendor": "islands" + }, + "override": true + } } - } + ] }, - "created_at": "2022-03-16T14:27:49.612Z", - "object": "products_collection" - }, - { - "id": "pc_BxofAP7pyM9FO7M6iaIzIouy", - "name": "Color not brown", - "type": "AUTO_UPDATE", - "filter": { - "junction": "and", - "metadata.color": { - "conditions": { - "$is_not": [ - "brown" - ] + { + "source_id": "orderImport15", + "status": "PAID", + "metadata": { + "location_id": [ + "L3" + ], + "payment_mean": [ + "wire-transfer" + ] + }, + "customer": { + "source_id": "bob2.smith@email.com" + }, + "referrer": { + "source_id": "jane.smith@email.com" + }, + "items": [ + { + "source_id": "ComicBook_1", + "quantity": 4, + "related_object": "sku", + "sku": { + "source_id": "ComicBook_1" + } + }, + { + "source_id": "vase_1", + "quantity": 1, + "related_object": "product", + "product": { + "source_id": "vase_1" + } } - } + ] }, - "created_at": "2022-03-16T13:49:05.697Z", - "object": "products_collection" - }, - { - "id": "pc_uHpM9ipEQH2yEpm3D8aohkBM", - "name": "Price less than 20", - "type": "AUTO_UPDATE", - "filter": { - "junction": "and", - "price": { - "conditions": { - "$less_than": [ - 2000 - ] + { + "source_id": "orderImport16", + "status": "FULFILLED", + "metadata": { + "location_id": [ + "L3" + ], + "payment_mean": [ + "wire-transfer" + ] + }, + "customer": { + "id": "cust_LMY4ZylSdUYB1J4tzqNcl5VV" + }, + "referrer": { + "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" + }, + "items": [ + { + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 2 + }, + { + "sku_id": "sku_0b1621b319d248b79f", + "quantity": 2 } - } + ] }, - "created_at": "2022-03-16T13:46:01.102Z", - "object": "products_collection" - }, - { - "id": "pc_ZgM25PcZAMp6qItKJRtR2mEi", - "name": "Name starts with S", - "type": "AUTO_UPDATE", - "filter": { - "junction": "and", - "name": { - "conditions": { - "$starts_with": [ - "S" - ] - } + { + "source_id": "orderImport17", + "status": "CANCELED", + "amount": 7000, + "metadata": { + "location_id": [ + "L3" + ], + "payment_mean": [ + "wire-transfer" + ] } }, - "created_at": "2022-03-16T13:42:35.917Z", - "object": "products_collection" - }, - { - "id": "pc_41V4DiQQO8YGqj0J2oZD57j4", - "name": "Ends with baby", - "type": "AUTO_UPDATE", - "filter": { - "junction": "and", - "source_id": { - "conditions": { - "$ends_with": [ - "baby" - ] + { + "source_id": "orderImport18", + "status": "CREATED", + "metadata": { + "location_id": [ + "L3" + ], + "payment_mean": [ + "wire-transfer" + ] + }, + "items": [ + { + "source_id": "ComicBook_1", + "amount": 900, + "related_object": "sku" + }, + { + "source_id": "vase_1", + "amount": 2000, + "related_object": "product" } - } + ] }, - "created_at": "2022-03-14T12:50:19.885Z", - "object": "products_collection" - }, - { - "id": "pc_0cRX5wAFt1R1R5Ir6WdTowui", - "name": "C start", - "type": "AUTO_UPDATE", - "filter": { - "junction": "and", - "name": { - "conditions": { - "$starts_with": [ - "C" - ] + { + "source_id": "orderImport19", + "status": "CREATED", + "metadata": { + "location_id": [ + "L3" + ], + "payment_mean": [ + "wire-transfer" + ] + }, + "items": [ + { + "amount": 900 + }, + { + "amount": 2000 } - } + ] }, - "created_at": "2022-03-14T12:18:15.588Z", - "object": "products_collection" - }, - { - "id": "pc_bQ2p9TycbEhd3YzwFCR3JQYA", - "name": "Shirts", - "type": "STATIC", - "products": [ - { - "id": "prod_0a9f9aeddb019a42db", - "object": "product" + { + "source_id": "orderImport20", + "status": "CREATED", + "metadata": { + "location_id": [ + "L3" + ], + "payment_mean": [ + "wire-transfer" + ] }, - { - "id": "prod_0a9f9ab4ab019a42d5", - "object": "product" - } - ], - "created_at": "2022-02-28T11:42:12.484Z", - "object": "products_collection" + "items": [ + { + "price": 900, + "quantity": 2 + }, + { + "price": 2000, + "quantity": 3 + } + ] + } + ] + } + } + } + } + }, + "responses": { + "200": { + "description": "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](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" + }, + "examples": { + "Example": { + "value": { + "async_action_id": "aa_0a875d56c805df6601" + } + } + } + } + } + }, + "400": { + "description": "Returns an error if the payload is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Invalid Payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Property .items[0].initial_quantity cannot be lower than 1", + "request_id": "v-0c5561d945cb0f0fb5" + } } - ], - "total": 9 + } } } } } } - } - } - }, - "post": { - "operationId": "create-product-collection", - "tags": [ - "PRODUCT COLLECTIONS API" - ], - "summary": "Create Product Collection", - "description": "This method creates a new product collection.", - "responses": { - "200": { - "description": "Returns information about the newly created collection, as well as an array containing the products.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/product_collections_collection_item" - } - } - } - } - }, - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "parameters": [], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/product_collections_create_request_body" - } - } - } - } - } - }, - "/v1/product-collections/{productCollectionId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "pc_41V4DiQQO8YGqj0J2oZD57j4" }, - "name": "productCollectionId", - "in": "path", - "required": true, - "description": "A unique product collection ID." - } - ], - "get": { - "operationId": "get-product-collection", - "tags": [ - "PRODUCT COLLECTIONS API" - ], - "summary": "Get Product Collection", - "description": "Retrieves the product collection.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a products collection object if a valid identifier was provided in the path.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/product_collections_get_response_body", - "description": "Returns a products collection object if a valid identifier was provided in the path." - }, - "examples": { - "Dynamic": { - "value": { - "id": "pc_Dj1qSH7bho4SVh7aSDKjU174", - "name": "Products in Poland", - "type": "AUTO_UPDATE", - "filter": { - "junction": "and", - "metadata.product_location": { - "conditions": { - "$in_location": [ - "loc_RcYz537sV07e1t5aG5tIH9FD" + "/v1/orders/export": { + "post": { + "operationId": "create-order-export", + "tags": [ + "ORDERS API" + ], + "summary": "Create Orders Export", + "description": "Creates a downloadable CSV file containing a list of orders.\n\nThe 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.\n\nThe available filters are all [order object](ref:get-order) attributes. Additionally, any metadata defined in the metadata schema can be exported.\n\nPassing an empty JSON will generate a file containing three default fields: `id`, `source_id`, and `status`.\n\nThe 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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique order ID. | ord_A69RIxEdRsPuC6i8gFGVHUft |\n| source_id | Unique order source ID. | 8638 |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the order was created. | 2022-03-09T09:16:32.521Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the order was last updated. | 2022-03-09T09:16:33.331Z |\n| status | Order status. | `PAID`, `CREATED`, `FULFILLED`, `CANCELED` |\n| amount | Total amount of order items. | 7700 |\n| discount_amount | Represents total amount of the discount applied to whole cart. | 500 |\n| items_discount_amount | Represents total amount of the discount applied to order line items. | 100 |\n| total_discount_amount | All discounts applied to the order including discounts applied to particular order line items and discounts applied to the whole cart. | 600 |\n| total_amount | Total order amount after applying all discounts. | 7100 |\n| customer_id | Customer unique ID. | cust_2G4fUQdCXUqp35nXNleav7bO |\n| referrer_id | Referrer unique ID. | cust_IkrTR674vvQvr9a4rDMiqglY |\n| metadata | Returns all order metadata. | Response will include all order metadata. |\n| metadata.X | Where X is the name of a particular order metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Order. |", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify which order parameters you would like to export.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/10_req_create_order_export" + }, + "examples": { + "Using fields": { + "value": { + "parameters": { + "fields": [ + "id", + "source_id", + "status", + "created_at", + "updated_at", + "amount", + "discount_amount", + "items_discount_amount", + "total_discount_amount", + "total_amount", + "customer_id", + "referrer_id", + "metadata.payment_mean" ] } } }, - "created_at": "2022-07-14T16:12:26.377Z", - "object": "products_collection" + "Using fields and filters": { + "value": { + "parameters": { + "fields": [ + "id", + "source_id", + "status", + "created_at", + "updated_at", + "amount", + "discount_amount", + "items_discount_amount", + "total_discount_amount", + "total_amount", + "customer_id", + "referrer_id", + "metadata.payment_mean" + ], + "order": "-updated_at", + "filters": { + "discount_amount": { + "conditions": { + "$more_than": 100000 + } + } + } + } + } + } } - }, - "Static": { - "value": { - "id": "pc_bQ2p9TycbEhd3YzwFCR3JQYA", - "name": "Shirts", - "type": "STATIC", - "products": [ - { - "id": "prod_0a9f9aeddb019a42db", - "object": "product" - }, - { - "id": "prod_0a9f9ab4ab019a42d5", - "object": "product" + } + } + }, + "responses": { + "200": { + "description": "Returns the `id` of the export object and `status` of the file generation process. The `id` is used in the [Get Export](ref:get-export) method to generate the url for the downloadable CSV file or in the [Download Export](ref:download-export) method to return the contents of the CSV file. The status indicates whether the file has been scheduled for creation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/16_obj_export_object" + }, + "examples": { + "Example": { + "value": { + "id": "exp_pT2Y1mgYsAgRAqsWTGf7PQX7", + "object": "export", + "created_at": "2022-09-09T10:45:52.362Z", + "status": "SCHEDULED", + "channel": "API", + "exported_object": "order", + "parameters": { + "fields": [ + "id", + "source_id", + "status", + "created_at", + "updated_at", + "amount", + "discount_amount", + "items_discount_amount", + "total_discount_amount", + "total_amount", + "customer_id", + "referrer_id", + "metadata.payment_mean" + ] + }, + "result": null, + "user_id": null + } } - ], - "created_at": "2022-02-28T11:42:12.484Z", - "object": "products_collection" + } + } + } + }, + "400": { + "description": "Returns an error if the request payload is specified incorrectly.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Invalid payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Property .parameters.filters should match either `filters[${field}][conditions][${condition}][${index}]` or `filters[${field}][conditions][${condition}]` format and condition must be one of: $in, $not_in, $in_location, $not_in_location, $is, $is_days_ago, $is_days_in_future, $is_not, $has_value, $is_unknown, $contains, $not_contain, $starts_with, $ends_with, $more_than, $less_than, $more_than_ago, $less_than_ago, $more_than_future, $less_than_future, $more_than_equal, $less_than_equal, $after, $before, $count, $count_less, $count_more, $today, $tomorrow, $yesterday, $this_week, $last_week, $next_week, $this_month, $last_month, $next_month, $this_year, $next_year, $last_year, $is_day_of_month, $is_day, $is_month, $is_year, $today_md, $tomorrow_md, $yesterday_md, $this_week_md, $last_week_md, $next_week_md, $this_month_md, $last_month_md, $next_month_md, $is_days_ago_md, $is_more_days_ago_md, $is_less_days_ago_md, $is_days_in_future_md, $is_more_days_in_future_md, $is_less_days_in_future_md, $is_years_ago, $active, $failed, $in_progress, $expired, $before_start, $enabled, $disabled, $redeemed, $redeemable", + "request_id": "v-0c52e783650ae585b2" + } + } + } } } } } } }, - "404": { - "description": "Returns an error when requesting a product collection that has been deleted or does not exist.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find products_collection with id pc_41V4DiQQO8YGqj0J2oZD57j", - "request_id": "v-0b4ec2530e9646cb15", - "resource_id": "pc_41V4DiQQO8YGqj0J2oZD57j", - "resource_type": "products_collection" + "/v1/product-object": { + "get": { + "operationId": "product-object", + "tags": [ + "PRODUCTS API" + ], + "summary": "Product Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Product Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_obj_product_object" + } } } } } } - } - } - }, - "delete": { - "operationId": "delete-product-collection", - "tags": [ - "PRODUCT COLLECTIONS API" - ], - "summary": "Delete Product Collection", - "description": "This method deletes a product collection.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." }, - "400": { - "description": "Returns an error indicating that the product collection with given ID is in use by other resources.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_400_resource_in_use" - }, - "examples": { - "Product Colllection In Use": { - "value": { - "code": 400, - "key": "resource_in_use", - "message": "Resource in use", - "details": "Resource products_collection with id pc_41V4DiQQO8YGqj0J2oZD57j4 is in use by validation_ruless with ids [val_9TB89AjZeVEJ]", - "request_id": "v-0ae3a63aff940ed1b2", - "related_object_ids": [ - "val_9TB89AjZeVEJ" - ], - "related_object_type": "validation_rules" + "/v1/sku-object": { + "get": { + "operationId": "sku-object", + "tags": [ + "PRODUCTS API" + ], + "summary": "SKU Object", + "description": "Data model description", + "responses": { + "200": { + "description": "SKU Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_obj_sku_object" + } } } } } } }, - "404": { - "description": "Returns an error indicating that the product collection with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" + "/v1/products": { + "get": { + "operationId": "list-products", + "tags": [ + "PRODUCTS API" + ], + "summary": "List Products", + "description": "Retrieve a list of products.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" }, - "examples": { - "Product Collection Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find products_collection with id pc_41V4DiQQO8YGqj0J2oZD57j", - "request_id": "v-0ae3a49261d027b870", - "resource_id": "pc_41V4DiQQO8YGqj0J2oZD57j", - "resource_type": "products_collection" + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + }, + "in": "query", + "name": "order", + "description": "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." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with product objects. The products are returned sorted by creation date by default, with the most recent products appearing last, unless you specify another sequence using the `order` query parameter.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_res_list_products" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "products", + "products": [ + { + "id": "prod_f1r5Tpr0DuC7", + "source_id": "test_prod_id_1", + "name": "Apple iPhone 8", + "price": null, + "attributes": [ + "color", + "memory" + ], + "metadata": { + "test": true, + "vendor": "Cortland" + }, + "image_url": null, + "created_at": "2021-12-03T06:33:46.101Z", + "updated_at": null, + "object": "product", + "skus": { + "data": [ + { + "id": "sku_0a417bd1d9952f9d6f", + "source_id": "test_iphone_8_silver_256gb", + "product_id": "prod_f1r5Tpr0DuC7", + "sku": "iPhone 8 Silver 256GB", + "price": null, + "currency": null, + "attributes": { + "color": "silver", + "memory": "256" + }, + "image_url": null, + "metadata": {}, + "created_at": "2021-12-03T06:33:46.599097+00:00", + "updated_at": null, + "object": "sku" + }, + { + "id": "sku_0a417bd1d9952f9d6e", + "source_id": "test_iphone_8_silver_64gb", + "product_id": "prod_f1r5Tpr0DuC7", + "sku": "iPhone 8 Silver 64GB", + "price": null, + "currency": null, + "attributes": { + "color": "silver", + "memory": "64" + }, + "image_url": null, + "metadata": {}, + "created_at": "2021-12-03T06:33:46.598595+00:00", + "updated_at": null, + "object": "sku" + } + ], + "total": 2 + } + }, + { + "id": "prod_0ac67e1bb8072eec48", + "source_id": "test_volleyball", + "name": "VolleyBall", + "price": 1100, + "attributes": [], + "metadata": { + "color": [ + "white" + ], + "label": true, + "origin": "PL" + }, + "image_url": null, + "created_at": "2022-03-16T14:01:45.459Z", + "updated_at": "2022-04-26T12:51:35.500Z", + "object": "product", + "skus": { + "data": [ + { + "id": "sku_0ac768973f5c4ea0d0", + "source_id": "test_volleyball_pl", + "product_id": "prod_0ac67e1bb8072eec48", + "sku": "PL", + "price": 500, + "currency": "USD", + "attributes": {}, + "image_url": null, + "metadata": { + "color": [ + "red" + ] + }, + "created_at": "2022-03-17T07:06:13.629918+00:00", + "updated_at": null, + "object": "sku" + }, + { + "id": "sku_0ac7689713072e1df6", + "source_id": "test_volleyball_us", + "product_id": "prod_0ac67e1bb8072eec48", + "sku": "US", + "price": 1500, + "currency": "USD", + "attributes": {}, + "image_url": null, + "metadata": { + "color": [ + "yellow" + ] + }, + "created_at": "2022-03-17T07:06:13.452532+00:00", + "updated_at": null, + "object": "sku" + } + ], + "total": 2 + } + } + ], + "total": 2 + } + } + } } } } } - } - } - } - } - }, - "/v1/product-collections/{productCollectionId}/products": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "productCollectionId", - "in": "path", - "required": true, - "description": "Unique product collection ID." - } - ], - "get": { - "operationId": "list-products-in-collection", - "tags": [ - "PRODUCT COLLECTIONS API" - ], - "summary": "List Products in Collection", - "description": "Retrieves list of products from a products collection; works for both dynamic and static product collections.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary of products and/or SKUs grouped in the collection with each product's/SKU's details.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/product_collections_list_products_response_body" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "prod_0bae45ffc7003ffc52", - "source_id": "second_product", - "name": "Samsung Phone 2", - "price": 230000, + }, + "post": { + "operationId": "create-product", + "tags": [ + "PRODUCTS API" + ], + "summary": "Create Product", + "description": "Creates a product object.\n\n\n\n> 🚧 Upsert Mode\n>\n> If you pass a `source_id` that already exists in the product database, Voucherify will return a related product object with updated fields.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the product parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_req_create_product" + }, + "examples": { + "Example": { + "value": { + "source_id": "first_product", + "name": "Samsung Phone", + "price": 200000, "attributes": [ "color", "memory", @@ -80823,1557 +79161,1085 @@ ], "metadata": { "test": true, - "vendor": "Online Store - 4" - }, - "image_url": "https://www.images.com/image4.png", - "created_at": "2022-09-12T14:44:13.212Z", - "updated_at": null, - "object": "product" - }, - { - "id": "sku_0bae3b28f610fd0da1", - "source_id": "first_product_sku_1", - "product_id": "prod_0bae2dc5a090fd0184", - "sku": "Samsung phone 256GB", - "price": 210000, - "attributes": { - "color": "vintage-black", - "memory": "256", - "processor": "Intel" - }, - "image_url": "https://www.website.com/image.png", - "metadata": { - "test": false, - "vendor": "Online Stores", - "imported": true + "vendor": "Online Store" }, - "created_at": "2022-09-12T13:56:51.828Z", - "updated_at": "2022-09-12T14:09:40.859Z", - "object": "sku", - "product": { + "image_url": "https://www.website.com/image.png" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a product object if the operation succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_obj_product_object" + }, + "examples": { + "Example": { + "value": { "id": "prod_0bae2dc5a090fd0184", "source_id": "first_product", "name": "Samsung Phone", - "price": null, - "attributes": [], - "metadata": {}, - "object": "product" - } - }, - { - "id": "prod_0bae2dc5a090fd0184", - "source_id": "first_product", - "name": "Samsung Phone 1", - "price": 220000, - "attributes": [ - "color", - "memory", - "processor" - ], - "metadata": { - "test": true, - "vendor": "Online Store - 3" - }, - "image_url": "https://www.images.com/image2.png", - "created_at": "2022-09-12T12:58:22.232Z", - "updated_at": "2022-09-12T14:44:13.208Z", - "object": "product" - }, - { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku": "Comics1", - "price": 1700, - "attributes": {}, - "image_url": null, - "metadata": { - "color": [ - "golden" + "price": 200000, + "attributes": [ + "color", + "memory", + "processor" ], - "vendor": "islands" - }, - "created_at": "2022-08-05T17:23:14.084Z", - "updated_at": "2022-09-09T09:24:43.806Z", - "object": "sku", - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": null, - "attributes": [], - "metadata": {}, + "metadata": { + "test": true, + "vendor": "Online Store" + }, + "image_url": "https://www.website.com/image.png", + "created_at": "2022-09-12T12:58:22.232Z", + "updated_at": "2022-09-12T12:59:55.890Z", "object": "product" } - }, - { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100, - "attributes": [], - "metadata": { - "color": [ - "silver" - ], - "vendor": "Bookstore1" - }, - "image_url": "https://www.images.com/image1.png", - "created_at": "2022-08-05T17:23:14.071Z", - "updated_at": "2022-09-09T09:24:43.728Z", - "object": "product" - }, - { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "price": 60000, - "attributes": [], - "metadata": { - "color": [ - "purple" - ], - "vendor": "mall" - }, - "image_url": null, - "created_at": "2022-08-05T17:15:55.270Z", - "updated_at": "2022-09-09T09:24:43.704Z", - "object": "product" } - ], - "total": 6 + } } } } } } }, - "404": { - "description": "Returns an error when requesting a product collection that has been deleted or does not exist.", - "content": { - "application/json": { + "/v1/products/{productId}": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_404_not_found" + "type": "string", + "example": "prod_f1r5Tpr0DuC7" }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find products_collection with id pc_M5XgaWPx3Sl4v26atA15zFj", - "request_id": "v-0b4ec6429e5646d089", - "resource_id": "pc_M5XgaWPx3Sl4v26atA15zFj", - "resource_type": "products_collection" - } - } - } + "name": "productId", + "in": "path", + "required": true, + "description": "A Voucherify product ID or source ID." } - } - } - } - } - }, - "/v1/validation-rule-object": { - "get": { - "operationId": "validation-rule-object", - "tags": [ - "VALIDATION RULES API" - ], - "summary": "Validation Rule Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Validation Rule Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/13_obj_validation_rule_object" - } - } - } - } - } - } - }, - "/v1/validation-rule-assignment-object": { - "get": { - "operationId": "validation-rule-assignment-object", - "tags": [ - "VALIDATION RULES API" - ], - "summary": "Validation Rule Assignment Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Validation Rule Assignment Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/13_obj_validation_rule_assignment_object" + ], + "get": { + "operationId": "get-product", + "tags": [ + "PRODUCTS API" + ], + "summary": "Get Product", + "description": "Retrieve product details.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] } - } - } - } - } - } - }, - "/v1/validation-rules": { - "get": { - "operationId": "list-validation-rules", - "tags": [ - "VALIDATION RULES API" - ], - "summary": "List Validation Rules", - "description": "Retrieve validation rules.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at", - "name", - "-name" - ] - }, - "in": "query", - "name": "order", - "description": "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." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary of validation rules.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/13_res_list_validation_rules" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "val_auLlxlfTR9Ps", - "name": "Customer in Segment", - "rules": { - "1": { - "name": "customer.segment", - "rules": {}, - "property": null, - "conditions": { - "$is": [ - "seg_18tD3HR0h8ymPC07rBMLryk3" - ] - } - }, - "logic": "1" - }, - "applicable_to": { - "excluded": [], - "included": [], - "included_all": false - }, - "created_at": "2021-12-10T11:08:16.499Z", - "updated_at": "2021-12-10T12:01:41.665Z", - "type": "advanced", - "context_type": "earning_rule.order.paid", - "assignments_count": 1, - "object": "validation_rules" - }, - { - "id": "val_AvIe1WWuBXre", - "name": "Order Volume - Price of Any Item - = 1500 USD", - "rules": { - "1": { - "name": "order.items.price_any", - "rules": {}, - "property": null, - "conditions": { - "$is": [ - 150000 - ] - } - }, - "logic": "1" - }, - "applicable_to": { - "excluded": [], - "included": [], - "included_all": false - }, - "created_at": "2021-12-13T06:54:06.864Z", - "type": "advanced", - "context_type": "reward_assignment.pay_with_points", - "object": "validation_rules" - }, - { - "id": "val_aZhPe4tQYMgr", - "name": "Business Validation Rule - excluded", - "rules": { - "logic": "" - }, - "applicable_to": { - "excluded": [ - { - "object": "products_collection", - "id": "pc_7fVU2RxybhR66YxC7r7BKKRh", - "source_id": null - }, - { - "object": "sku", - "id": "sku_0bae3b28f610fd0da1", - "source_id": "first_product_sku_1" - } - ], - "included": [], - "included_all": true - }, - "created_at": "2022-09-13T14:38:33.710Z", - "type": "basic", - "context_type": "campaign.discount_coupons.discount.apply_to_items_by_quantity", - "assignments_count": 1, - "object": "validation_rules" - }, - { - "id": "val_bbJCAXAWtYX0", - "name": "Business Validation Rule - Test - Discount Effect - Amount - Items - each unit of matched product", - "rules": { - "logic": "" - }, - "applicable_to": { - "excluded": [], - "included": [ - { - "object": "products_collection", - "id": "pc_a11pr0dUc75", - "source_id": null, - "effect": "APPLY_TO_EVERY", - "quantity_limit": 1 - } + ], + "responses": { + "200": { + "description": "Returns a product object if a valid identifier was provided.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_obj_product_object" + }, + "examples": { + "Example": { + "value": { + "id": "prod_f1r5Tpr0DuC7", + "source_id": "test_prod_id_1", + "name": "Apple iPhone 8", + "price": null, + "attributes": [ + "color", + "memory" ], - "included_all": false - }, - "created_at": "2022-09-02T17:04:23.814Z", - "type": "basic", - "context_type": "campaign.discount_coupons.discount.apply_to_items_by_quantity", - "assignments_count": 1, - "object": "validation_rules" - }, - { - "id": "val_BkV21MUJGaiT", - "name": "Order Volume - Total Amount More than 100", - "rules": { - "1": { - "name": "order.amount", - "rules": {}, - "property": null, - "conditions": { - "$more_than": [ - 10000 - ] - } + "metadata": { + "test": true, + "vendor": "Cortland" }, - "logic": "1" - }, - "applicable_to": { - "excluded": [], - "included": [], - "included_all": false - }, - "created_at": "2021-12-10T14:01:10.750Z", - "type": "advanced", - "context_type": "reward_assignment.pay_with_points", - "object": "validation_rules" - }, - { - "id": "val_BTQg027UGl0v", - "name": "Business Validation Rule - Get some $ off", - "rules": { - "logic": "" - }, - "applicable_to": { - "excluded": [], - "included": [ - { - "object": "product", - "id": "prod_0a41dd45dc85fcab40", - "source_id": "10474", - "strict": false - } - ], - "included_all": false - }, - "created_at": "2021-12-07T06:58:23.759Z", - "updated_at": "2021-12-22T08:11:18.773Z", - "type": "advanced", - "context_type": "campaign.discount_coupons.discount.apply_to_items", - "assignments_count": 1, - "object": "validation_rules" + "image_url": null, + "created_at": "2021-12-03T06:33:46.101Z", + "updated_at": null, + "object": "product", + "skus": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "sku_0a417bd1d9952f9d6f", + "source_id": "test_iphone_8_silver_256gb", + "product_id": "prod_f1r5Tpr0DuC7", + "sku": "iPhone 8 Silver 256GB", + "price": null, + "currency": null, + "attributes": { + "color": "silver", + "memory": "256" + }, + "image_url": null, + "metadata": {}, + "created_at": "2021-12-03T06:33:46.599097+00:00", + "updated_at": null, + "object": "sku" + }, + { + "id": "sku_0a417bd1d9952f9d6e", + "source_id": "test_iphone_8_silver_64gb", + "product_id": "prod_f1r5Tpr0DuC7", + "sku": "iPhone 8 Silver 64GB", + "price": null, + "currency": null, + "attributes": { + "color": "silver", + "memory": "64" + }, + "image_url": null, + "metadata": {}, + "created_at": "2021-12-03T06:33:46.598595+00:00", + "updated_at": null, + "object": "sku" + } + ], + "total": 2 + } + } } - ], - "total": 6 + } + } + } + }, + "404": { + "description": "Returns an error when requesting a product that has been deleted or cannot be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find product with id test_prod_id_", + "request_id": "v-0bae1d3caf478da111", + "resource_id": "test_prod_id_", + "resource_type": "product" + } + } + } } } } } - } - } - } - }, - "post": { - "operationId": "create-validation-rules", - "tags": [ - "VALIDATION RULES API" - ], - "summary": "Create Validation Rules", - "description": "Create validation rules.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/13_req_create_validation_rule" - }, - "examples": { - "Example": { - "value": { - "name": "Set of Validation Rules", - "error": { - "message": "Your order does not meet at least one of the required criteria." - }, - "applicable_to": { - "included_all": false, - "excluded": [ - { - "object": "product", - "id": "prod_0bae45ffc7003ffc52", - "source_id": "second_product", - "strict": false, - "effect": "APPLY_TO_EVERY" - } - ], - "included": [ - { - "object": "product", - "id": "prod_0b72b00ffed198e344", - "source_id": null, - "effect": "APPLY_TO_MOST_EXPENSIVE", - "quantity_limit": 1 - }, - { - "object": "products_collection", - "id": "pc_4ndRXAsTOzwSdHcQcxf489uU", - "source_id": null, - "effect": "APPLY_TO_EVERY", - "quantity_limit": 5 - } - ] + }, + "put": { + "operationId": "update-product", + "tags": [ + "PRODUCTS API" + ], + "summary": "Update Product", + "description": "Updates the specified product by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the parameters of the product that are to be updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_req_update_product" }, - "rules": { - "1": { - "name": "order.metadata", - "property": "location", - "rules": {}, - "conditions": { - "$is": [ - "Santorini" - ] - }, - "error": { - "message": "Your order must be placed at one of our Santorini shops." - } - }, - "2": { - "name": "custom_event.metadata", - "property": "test", - "rules": {}, - "conditions": { - "$greater_than_or_equal": [ - 1 - ] - } - }, - "3": { - "name": "order.items.every", - "rules": { - "1": { - "name": "order.items.metadata", - "property": "test", - "rules": {}, - "conditions": { - "$greater_than_or_equal": [ - 1 - ] - } - } - }, - "conditions": { - "$is": [ - { - "id": "", - "effect": "APPLY_TO_EVERY", - "object": "product", - "source_id": "" - } - ] + "examples": { + "Example": { + "value": { + "price": 210000 } - }, - "logic": "1 or 2" + } } } } - } - } - }, - "description": "Specify the validation rules parameters." - }, - "responses": { - "200": { - "description": "Returns a validation rule object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/13_obj_validation_rule_object" - }, - "examples": { - "Example": { - "value": { - "id": "val_eR1c41hu0vUU", - "name": "Business Validation Rule", - "rules": { - "1": { - "name": "string", - "property": "string", - "conditions": { - "$one_of_voucherify_conditions": [ - "string" - ] - }, - "rules": { - "1": { - "name": "string", - "property": "string", - "conditions": {}, - "rules": {} - }, - "logic": "string" - }, - "error": { - "message": "string" - } - }, - "logic": "(1 and 2) and (3)" - }, - "error": { - "message": "string" + }, + "responses": { + "200": { + "description": "Returns an updated product object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_obj_product_object_truncated" }, - "applicable_to": { - "excluded": [ - { - "object": "product", - "id": "string", - "source_id": "string", - "strict": true, - "effect": "APPLY_TO_EVERY" - } - ], - "included": [ - { - "object": "product", - "id": "string", - "source_id": "string", - "strict": true, - "effect": "APPLY_TO_EVERY", - "quantity_limit": 0 + "examples": { + "Example": { + "value": { + "id": "prod_0bae2dc5a090fd0184", + "source_id": "first_product", + "name": "Samsung Phone", + "price": 210000, + "attributes": [ + "color", + "memory", + "processor" + ], + "metadata": { + "test": false, + "vendor": "Online Stores" + }, + "image_url": "https://www.website.com/image.png", + "created_at": "2022-09-12T12:58:22.232Z", + "updated_at": "2022-09-12T13:33:48.904Z", + "object": "product" } - ], - "included_all": true - }, - "created_at": "2022-03-23T07:44:00.444Z", - "updated_at": "2022-04-26T08:35:54.960Z", - "type": "basic", - "context_type": "earning_rule.order.paid", - "object": "validation_rules" + } + } } } } } - } - }, - "400": { - "description": "Returns an error if the request parameters were not specified correctly.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_400_invalid_validation_rules" - }, - "examples": { - "Invalid Validation Rules": { - "value": { - "code": 400, - "key": "invalid_validation_rules", - "message": "Invalid Validation Rule Definition", - "details": "Rule 'custom_event.metadata' must have a 'property'" + }, + "delete": { + "operationId": "delete-product", + "tags": [ + "PRODUCTS API" + ], + "summary": "Delete Product", + "description": "This method deletes a product.", + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "force", + "description": "If this flag is set to `true`, the product will be removed permanently. Going forward, the user will be able to create another product with exactly the same `source_id`." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." + }, + "404": { + "description": "Returns an error indicating that the product with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Product Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find product with id prod_0a4934c50ddc5dbae", + "request_id": "v-0ae39cd7de8683dfd8", + "resource_id": "prod_0a4934c50ddc5dbae", + "resource_type": "product" + } + } + } } } } } } - } - } - } - }, - "/v1/validation-rules/{validationRuleId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "val_TU4de3EP4dlL" }, - "name": "validationRuleId", - "in": "path", - "required": true, - "description": "A unique validation rule ID." - } - ], - "get": { - "operationId": "get-validation-rule", - "tags": [ - "VALIDATION RULES API" - ], - "summary": "Get Validation Rule", - "description": "Retrieve the details of a validation rule.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns the validation rule object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/13_obj_validation_rule_object" - }, - "examples": { - "Example": { - "value": { - "id": "val_TU4de3EP4dlL", - "name": "Order is less than $40", - "rules": { - "1": { - "name": "order.amount", - "property": null, - "conditions": { - "$less_than": [ - 4000 - ] + "/v1/products/bulk/async": { + "post": { + "operationId": "update-products-in-bulk", + "tags": [ + "PRODUCTS API" + ], + "summary": "Update Products in bulk", + "description": "Update several products in one asynchronous operation. \n\nIn one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. If a requested product object is not found, then an **upsert** occurs. This is reflected in the [Get Async Action](ref:get-async-action) endpoint as follows: \n\n\n```json\n{\n \"found\": false,\n \"updated\": true\n}\n```\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Create an array of product objects, each with the parameters which you want to update.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/11_req_update_product_bulk" + } + }, + "examples": { + "Example": { + "value": [ + { + "source_id": "first_product", + "name": "Samsung Phone 1", + "price": 220000, + "attributes": [ + "color", + "memory", + "processor" + ], + "metadata": { + "test": true, + "vendor": "Online Store - 3" + }, + "image_url": "https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_Z2qvs2KFnQyo2Ohz4uhsjGtf.png" }, - "rules": {} - }, - "logic": "1" - }, - "applicable_to": { - "excluded": [], - "included": [], - "included_all": false - }, - "created_at": "2022-08-11T16:42:13.630Z", - "type": "advanced", - "context_type": "reward_assignment.pay_with_points", - "object": "validation_rules" + { + "source_id": "second_product", + "name": "Samsung Phone 2", + "price": 230000, + "attributes": [ + "color", + "memory", + "processor" + ], + "metadata": { + "test": true, + "vendor": "Online Store - 4" + }, + "image_url": "https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_Z2qvs2KFnQyo2Ohz4uhsjGtf.png" + } + ] + } } } } - } - } - } - } - }, - "put": { - "operationId": "update-validation-rule", - "tags": [ - "VALIDATION RULES API" - ], - "summary": "Update Validation Rule", - "description": "Update validation rule parameters.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the parameters to be updated.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/13_req_create_validation_rule" }, - "examples": { - "Example": { - "value": { - "name": "Set of Validation Rules Updated", - "error": { - "message": "Your orders do not meet at least one of the required criteria." - }, - "applicable_to": { - "included_all": false, - "excluded": [ - { - "object": "product", - "id": "prod_0bae45ffc7003ffccc", - "source_id": "second_product", - "strict": false, - "effect": "APPLY_TO_EVERY" - } - ], - "included": [ - { - "object": "product", - "id": "prod_0b72b00ffed198e333", - "source_id": null, - "effect": "APPLY_TO_CHEAPEST", - "quantity_limit": 1 - }, - { - "object": "products_collection", - "id": "pc_4ndRXAsTOzwSdHcQcxf489uU", - "source_id": null, - "effect": "APPLY_TO_EVERY", - "quantity_limit": 5 - } - ] - }, - "rules": { - "1": { - "name": "order.metadata", - "property": "place", - "rules": {}, - "conditions": { - "$is": [ - "Santorini" - ] - }, - "error": { - "message": "Your order must be placed at one of our Santorini shops on the beach." - } + "responses": { + "202": { + "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and updates will be added to the repository asynchronously. To check the update status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" }, - "2": { - "name": "custom_event.metadata", - "property": "lining", - "rules": {}, - "conditions": { - "$greater_than_or_equal": [ - 1 - ] + "examples": { + "Example": { + "value": { + "async_action_id": "aa_0a875d56c805df6601" + } } + } + } + } + }, + "400": { + "description": "Returns an error if the required parameters are not included in the request body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" }, - "3": { - "name": "order.items.every", - "rules": { - "1": { - "name": "order.items.metadata", - "property": "test", - "rules": {}, - "conditions": { - "$greater_than_or_equal": [ - 1 - ] - } + "examples": { + "Example": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Payload should have required property 'source_id'", + "request_id": "v-0bae44e063cca61aff" } - }, - "conditions": { - "$is": [ - { - "id": "", - "effect": "APPLY_TO_EVERY", - "object": "product", - "source_id": "" - } - ] } - }, - "logic": "1 and 2" + } } } } } } - } - }, - "responses": { - "200": { - "description": "Returns the validation rule object with the updated parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/13_obj_validation_rule_object" - }, - "examples": { - "Example": { - "value": { - "id": "val_VZ91fqqtoVmw", - "name": "Set of Validation Rules Updated", - "rules": { - "1": { - "name": "order.metadata", - "property": "place", - "conditions": { - "$is": [ - "Santorini" - ] - }, - "rules": {}, - "error": { - "message": "Your order must be placed at one of our Santorini shops on the beach." - } - }, - "2": { - "name": "custom_event.metadata", - "property": "lining", - "conditions": { - "$greater_than_or_equal": [ - 1 - ] - }, - "rules": {} - }, - "3": { - "name": "order.items.every", - "conditions": { - "$is": [ - { - "id": "", - "effect": "APPLY_TO_EVERY", - "object": "product", - "source_id": "" - } - ] - }, - "rules": { - "1": { - "name": "order.items.metadata", - "property": "test", - "conditions": { - "$greater_than_or_equal": [ - 1 - ] - }, - "rules": {} - } + }, + "/v1/products/metadata/async": { + "post": { + "operationId": "update-products-metadata-in-bulk", + "tags": [ + "PRODUCTS API" + ], + "summary": "Update Products' Metadata in bulk", + "description": "Update several product metadata properties in one asynchronous operation. \n\nIn one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. If a requested product object is not found, then an **upsert** occurs. This is reflected in the [Get Async Action](ref:get-async-action) endpoint as follows: \n\n\n```json\n{\n \"found\": false,\n \"updated\": true\n}\n```\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the list of product source IDs and the metadata key value pairs to be udpated for these products.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_req_update_products_metadata_in_bulk" + }, + "examples": { + "Example": { + "value": { + "source_ids": [ + "123-567-3433", + "test_volleyball" + ], + "metadata": { + "label": true, + "origin": "PL" } - }, - "logic": "1 and 2" + } + } + } + } + } + }, + "responses": { + "202": { + "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and updates will be added to the repository asynchronously. To check the update status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" }, - "error": { - "message": "Your orders do not meet at least one of the required criteria." + "examples": { + "Example": { + "value": { + "async_action_id": "aa_0a875d56c805df6601" + } + } + } + } + } + }, + "400": { + "description": "Returns an error if the request parameters are not provided.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" }, - "applicable_to": { - "excluded": [ - { - "object": "product", - "id": "prod_0bae45ffc7003ffccc", - "source_id": "second_product", - "strict": false, - "effect": "APPLY_TO_EVERY" + "examples": { + "Not enough source IDs": { + "value": { + "code": 400, + "key": "not_enough_source_ids", + "message": "Not enough source_ids", + "details": "Specify at least 1 ID in source_ids.", + "request_id": "v-0bae421d05078dcdb4" } - ], - "included": [ - { - "object": "product", - "id": "prod_0b72b00ffed198e333", - "source_id": null, - "strict": false, - "effect": "APPLY_TO_CHEAPEST", - "quantity_limit": 1 - }, - { - "object": "products_collection", - "id": "pc_4ndRXAsTOzwSdHcQcxf489uU", - "source_id": null, - "strict": false, - "effect": "APPLY_TO_EVERY", - "quantity_limit": 5 + }, + "Invalid Payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Payload should have required property 'metadata'", + "request_id": "v-0bae428dab8ca61825" } - ], - "included_all": false - }, - "created_at": "2022-09-14T05:54:51.099Z", - "updated_at": "2022-09-14T06:06:32.855Z", - "type": "complex", - "context_type": "global", - "object": "validation_rules" + } + } } } } } } - } - } - }, - "delete": { - "operationId": "delete-validation-rules", - "tags": [ - "VALIDATION RULES API" - ], - "summary": "Delete Validation Rule", - "description": "This method deletes a validation rule.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." }, - "404": { - "description": "Returns an error indicating that the validation rule with the given ID was not found.", - "content": { - "application/json": { + "/v1/skus/{skuId}": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_404_not_found" + "type": "string" + }, + "name": "skuId", + "in": "path", + "required": true, + "description": "A Voucherify SKU identifier or SKU source ID." + } + ], + "get": { + "operationId": "get-sku", + "tags": [ + "PRODUCTS API" + ], + "summary": "Get SKU", + "description": "Retrieve details of a SKU.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns requested SKU object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_obj_sku_object" + }, + "examples": { + "Example": { + "value": { + "id": "sku_0b1621b2f25248b79c", + "source_id": "sku_source_id_1", + "product_id": "prod_0b15f6b9f650c16990", + "sku": "Extra Small Blue Shirt", + "price": 1300, + "currency": "USD", + "attributes": { + "size": "XS", + "color": "blue", + "ranking": 1 + }, + "image_url": "", + "metadata": {}, + "created_at": "2022-05-17T10:36:30.057Z", + "updated_at": "2022-07-01T05:34:16.822Z", + "object": "sku" + } + } + } + } + } }, - "examples": { - "Validation Rule Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find validation_rules with id val_TGN3rqZ8vEm", - "request_id": "v-0ae3b3436346b778be", - "resource_id": "val_TGN3rqZ8vEm", - "resource_type": "validation_rules" + "404": { + "description": "Returns an error indicating that the sku with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find sku with id sku_0b1621b319d248b79", + "request_id": "v-0b4fe3ddc55646d01d", + "resource_id": "sku_0b1621b319d248b79", + "resource_type": "sku" + } + } + } } } } } } - } - } - } - }, - "/v1/validation-rules-assignments": { - "get": { - "operationId": "list-validation-rules-assignments", - "tags": [ - "VALIDATION RULES API" - ], - "summary": "List Validation Rules' Assignment(s)", - "description": "List all validation rules' assignments or filter the results using the related object ID or the validation rule ID query parameters. \n\n## How to retrieve specific validaiton rule assignments(s)\n\n### Related object ID\n\nTo find an assignment for a particular resource, you can use the ID of the object to which the validation rule was assigned. This could be, for example, an ID of a: voucher, campaign, distribution, reward assignment, earning rule, promotion tier. \n\n\n\n```curl\ncurl -X GET \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\" \\\n -H \"Content-Type: application/json\" \\\n https://api.voucherify.io/v1/validation-rules-assignments?related_object_id=promo_kJliy076IuJYtuYWSHE9fSuT\n```\n\n```json\n{\n \"object\": \"list\",\n \"data_ref\": \"data\",\n \"data\": [\n {\n \"id\": \"asgm_tZaqxeO8gP4q91jG\",\n \"rule_id\": \"val_WB6ETAiFztw5\",\n \"related_object_id\": \"promo_kJliy076IuJYtuYWSHE9fSuT\",\n \"related_object_type\": \"promotion_tier\",\n \"created_at\": \"2022-08-10T10:30:39.986Z\",\n \"object\": \"validation_rules_assignment\"\n }\n ],\n \"total\": 1\n}\n```\n\n### Validation rule ID\n\nYou can use the validation rule ID to find assignment(s) for a specific validation rule.\n\n\n\n```curl\ncurl -X GET \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\" \\\n -H \"Content-Type: application/json\" \\\n https://api.voucherify.io/v1/validation-rules-assignments?rule=val_ZEZmA9oit8aU\n```\n\n```json\n{\n \"object\": \"list\",\n \"data_ref\": \"data\",\n \"data\": [\n {\n \"id\": \"asgm_vef0G6d9Al0rABxq\",\n \"rule_id\": \"val_ZEZmA9oit8aU\",\n \"related_object_id\": \"camp_rRsfatlwN7unSeUIJDCYedal\",\n \"related_object_type\": \"campaign\",\n \"created_at\": \"2022-06-29T11:43:52.953Z\",\n \"object\": \"validation_rules_assignment\"\n },\n {\n \"id\": \"asgm_sFV4wEFvldwIvgfb\",\n \"rule_id\": \"val_ZEZmA9oit8aU\",\n \"related_object_id\": \"distr_9QKI02wqgjWyvZXeQkFEPmkkYe\",\n \"related_object_type\": \"distribution\",\n \"created_at\": \"2022-06-29T11:41:07.680Z\",\n \"object\": \"validation_rules_assignment\"\n },\n {\n \"id\": \"asgm_69Qifyv6UZynFIIQ\",\n \"rule_id\": \"val_ZEZmA9oit8aU\",\n \"related_object_id\": \"promo_g83qUzYZpfX0OMAFOVoQuOYG\",\n \"related_object_type\": \"promotion_tier\",\n \"created_at\": \"2022-06-29T11:29:41.906Z\",\n \"object\": \"validation_rules_assignment\"\n }\n ],\n \"total\": 3\n}\n```\n", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "related_object_id", - "description": "The resource ID to which the validation rule was assigned; this could be, for example, a resource ID of a voucher, campaign, earning rule, reward assignment, promotion tier, or distribution." - }, - { - "schema": { - "type": "string", - "example": "val_30Qo2rclFi4T" - }, - "in": "query", - "name": "rule", - "description": "Validation rule ID." - }, - { - "$ref": "#/components/parameters/page" - }, - { - "$ref": "#/components/parameters/limit" }, - { - "schema": { - "type": "string" - }, - "in": "query", - "description": "Sorts the results using one of the filtering options: `-created_at`, `created_at`, where the dash `-` preceding a sorting option means sorting in a descending order.", - "name": "order" - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary with a data property that contains an array of validation rule assignments. Each entry in the array is a separate object. If no more validation rule assignments are available, the resulting array will be empty. The result can be narrowed down according to default filters.", - "content": { - "application/json": { + "/v1/products/{productId}/skus": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/13_res_validation-rules_validationRuleId_assignments" + "type": "string" }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_2S7Xm4dab4UvYAgm", - "rule_id": "val_5ix74ru7e", - "related_object_id": "camp_YDsFdX8TgFtT0RUuKEFyhqs3", - "related_object_type": "campaign", - "created_at": "2022-02-08T10:49:30.534Z", - "object": "validation_rules_assignment" - }, - { - "id": "asgm_sFV4wEFvldwIvgfb", - "rule_id": "val_ZEZmA9oit8aU", - "related_object_id": "distr_9QKI02wqgjWyvZXeQkFEPmkkYe", - "related_object_type": "distribution", - "created_at": "2022-06-29T11:41:07.680Z", - "object": "validation_rules_assignment" - }, - { - "id": "asgm_8xelF5R4zB8ue168", - "rule_id": "val_ggDODO6fakMs", - "related_object_id": "ern_xrRuGEV7EW0X8wtMaze3HOfw", - "related_object_type": "earning_rule", - "created_at": "2022-02-28T12:25:56.783Z", - "object": "validation_rules_assignment" - }, - { - "id": "asgm_tZaqxeO8gP4q91jG", - "rule_id": "val_WB6ETAiFztw5", - "related_object_id": "promo_kJliy076IuJYtuYWSHE9fSuT", - "related_object_type": "promotion_tier", - "created_at": "2022-08-10T10:30:39.986Z", - "object": "validation_rules_assignment" - }, - { - "id": "asgm_xTMHiyPGSz3rp5m2", - "rule_id": "val_2AxnWmW2ra6X", - "related_object_id": "rewa_m9hEAu10KsPcLhGXiHG85aY0", - "related_object_type": "reward_assignment", - "created_at": "2021-12-10T11:38:35.922Z", - "object": "validation_rules_assignment" - }, - { - "id": "asgm_DhlDn54JwqVFJzR6", - "rule_id": "val_eR1c41hu0vUU", - "related_object_id": "v_XuF7icVlUcVpHsSY9nG7n7yJa5wx27Va", - "related_object_type": "voucher", - "created_at": "2022-03-23T07:50:31.068Z", - "object": "validation_rules_assignment" + "name": "productId", + "in": "path", + "description": "A Voucherify [product](ref:get-product) ID or product source ID.", + "required": true + } + ], + "get": { + "operationId": "list-skus-in-product", + "tags": [ + "PRODUCTS API" + ], + "summary": "List SKUs in Product", + "description": "Retrieve all SKUs for a given product.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + }, + "in": "query", + "name": "order", + "description": "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." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary of SKUs.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_res_products_productId_skus" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "skus", + "skus": [ + { + "id": "sku_0b1621b2f25248b79c", + "source_id": "sku_source_id_1", + "product_id": "prod_0b15f6b9f650c16990", + "sku": "Extra Small Blue Shirt", + "price": 1300, + "currency": "USD", + "attributes": { + "size": "XS", + "color": "blue", + "ranking": 1 + }, + "image_url": "", + "metadata": {}, + "created_at": "2022-05-17T10:36:30.057Z", + "updated_at": "2022-07-01T05:34:16.822Z", + "object": "sku" + }, + { + "id": "sku_0b1621b3181248b79d", + "source_id": "sku_source_id_3", + "product_id": "prod_0b15f6b9f650c16990", + "sku": "Medium Yellow Shirt", + "price": 1450, + "currency": "USD", + "attributes": { + "size": "M", + "color": "yellow", + "ranking": 3 + }, + "image_url": "", + "metadata": {}, + "created_at": "2022-05-17T10:36:30.180Z", + "updated_at": "2022-07-01T05:34:16.842Z", + "object": "sku" + }, + { + "id": "sku_0b1621b3199248b79e", + "source_id": "sku_source_id_2", + "product_id": "prod_0b15f6b9f650c16990", + "sku": "Small Red Shirt", + "price": 1400, + "currency": "USD", + "attributes": { + "size": "S", + "color": "red", + "ranking": 2 + }, + "image_url": "", + "metadata": {}, + "created_at": "2022-05-17T10:36:30.183Z", + "updated_at": "2022-07-01T05:34:16.927Z", + "object": "sku" + }, + { + "id": "sku_0b1621b319d248b79f", + "source_id": "sku_source_id_4", + "product_id": "prod_0b15f6b9f650c16990", + "sku": "Large Pink Shirt -", + "price": 1700, + "currency": "USD", + "attributes": { + "size": "L", + "color": "pink", + "ranking": 4 + }, + "image_url": "", + "metadata": {}, + "created_at": "2022-05-17T10:36:30.187Z", + "updated_at": "2022-07-05T08:47:50.680Z", + "object": "sku" + } + ], + "total": 4 + } } - ], - "total": 6 + } } - }, - "No Assignments": { - "value": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 + } + }, + "404": { + "description": "Returns an error when requesting a product that has been deleted or cannot be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Example": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find product with id prod_0b15f6b9f650c6990", + "request_id": "v-0bae223075878da708", + "resource_id": "prod_0b15f6b9f650c6990", + "resource_type": "product" + } + } + } } } } } - } - } - } - } - }, - "/v1/validation-rules/{validationRuleId}/assignments": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "validationRuleId", - "in": "path", - "required": true, - "description": "Unique validation rule ID." - } - ], - "get": { - "operationId": "list-validation-rule-assignments", - "tags": [ - "VALIDATION RULES API" - ], - "summary": "List Validation Rule Assignments", - "description": "Retrieve validation rule assignments for a specific validation rule.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at" - ] }, - "in": "query", - "name": "order", - "description": "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." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary of validation rule assignments. If the validation rule ID provided in the path parameter cannot be found, the endpoint will return an empty `data` array and a total of `0`.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/13_res_validation-rules_validationRuleId_assignments" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_74F7QZoYbUoljwQO", - "rule_id": "val_4j7DCRm2IS59", - "related_object_id": "v_MBOEmHelKwvykVZ8JcT4TE5Kla5IMJyc", - "related_object_type": "voucher", - "created_at": "2022-02-17T09:05:34.642Z", - "object": "validation_rules_assignment" - }, - { - "id": "asgm_zzLBm8mIzGQStXl9", - "rule_id": "val_4j7DCRm2IS59", - "related_object_id": "v_JtWunK6jUo7X2qOFj0SyRHq4p9tgENlT", - "related_object_type": "voucher", - "created_at": "2022-02-17T08:18:15.085Z", - "object": "validation_rules_assignment" - }, - { - "id": "asgm_JztMAws0e0Qx2Xy6", - "rule_id": "val_4j7DCRm2IS59", - "related_object_id": "camp_kjja4moiVB7hQKPGOT61026Z", - "related_object_type": "campaign", - "created_at": "2022-02-15T13:26:34.807Z", - "object": "validation_rules_assignment" + "post": { + "operationId": "create-sku", + "tags": [ + "PRODUCTS API" + ], + "summary": "Create SKU", + "description": "This method adds product varients to a [created product](ref:create-product).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the SKU parameters to be created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_req_create_sku" + }, + "examples": { + "Example": { + "value": { + "source_id": "first_product_sku_1", + "sku": "Samsung phone 256GB", + "price": 1300, + "currency": "USD", + "attributes": { + "color": "vintage-black", + "memory": "256", + "processor": "Intel" + }, + "image_url": "https://www.website.com/image.png", + "metadata": { + "imported": true + } } - ], - "total": 3 - } - }, - "No Assignments": { - "value": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 + } } } } - } - } - } - } - }, - "post": { - "operationId": "create-validation-rule-assignment", - "tags": [ - "VALIDATION RULES API" - ], - "summary": "Create Validation Rules Assignments", - "description": "Assign validation rule to either one of the following objects: voucher, campaign, promotion tier, earning rule, reward, distribution.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the resource that you would like to assign the validation rule to.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/13_req_create_validation_rule_assignments" }, - "examples": { - "Voucher": { - "value": { - "voucher": "v_ssR6vhswwh5odSloN2Vc3O60w7aea018" - } - }, - "Campaign": { - "value": { - "campaign": "camp_Rv9EuIrkT08YEORb2pUMGSUo" - } - }, - "Distribution": { - "value": { - "distribution": "distr_2nUIekYnS9L1Vm1I55vmC7kSvd" + "responses": { + "200": { + "description": "Returns the created SKU object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_obj_sku_object" + }, + "examples": { + "Example": { + "value": { + "id": "sku_0bae3b28f610fd0da1", + "source_id": "first_product_sku_1", + "product_id": "prod_0bae2dc5a090fd0184", + "sku": "Samsung phone 256GB", + "price": 1300, + "currency": "USD", + "attributes": { + "color": "vintage-black", + "memory": "256", + "processor": "Intel" + }, + "image_url": "https://www.website.com/image.png", + "metadata": { + "imported": true + }, + "created_at": "2022-09-12T13:56:51.828Z", + "updated_at": null, + "object": "sku" + } + } + } + } } } } } - } - }, - "responses": { - "200": { - "description": "Returns a validation rules assignment object.", - "content": { - "application/json": { + }, + "/v1/products/{productId}/skus/{skuId}": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "productId", + "in": "path", + "required": true, + "description": "A unique Voucherify [product](ref:get-product) ID or product source ID." + }, + { "schema": { - "$ref": "#/components/schemas/13_obj_validation_rule_assignment_object" + "type": "string" }, - "examples": { - "Example": { - "value": { - "id": "asgm_kPPiNW3smQLRMWiF", - "rule_id": "val_ZEZmA9oit8aU", - "related_object_id": "camp_Rv9EuIrkT08YEORb2pUMGSUo", - "related_object_type": "campaign", - "created_at": "2022-09-14T07:06:49.557Z", - "object": "validation_rules_assignment" + "name": "skuId", + "in": "path", + "required": true, + "description": "A Voucherify [SKU ID](ref:get-sku) or SKU source ID." + } + ], + "put": { + "operationId": "update-sku", + "tags": [ + "PRODUCTS API" + ], + "summary": "Update SKU", + "description": "Updates the specified SKU by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged.\n\nFields other than the ones listed in the request body schema won't be modified. Even if provided, they will be silently skipped.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the parameters to be updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_req_update_sku" + }, + "examples": { + "Example": { + "value": { + "price": 210000, + "currency": "PLN" + } + } } } } - } - } - }, - "409": { - "description": "Returns an error if an duplicate assignment is found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" - }, - "examples": { - "Duplicate": { - "value": { - "code": 409, - "key": "duplicate_found", - "message": "Duplicated resource found", - "details": "Duplicated validation_rules_assignment exists with id asgm_ixJEwQbUv8hfPlhO", - "request_id": "v-0bb06fd1c3478dcb47", - "resource_id": "asgm_ixJEwQbUv8hfPlhO", - "resource_type": "validation_rules_assignment" + }, + "responses": { + "200": { + "description": "Returns the SKU object with the updated parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_obj_sku_object" + }, + "examples": { + "Example": { + "value": { + "id": "sku_0bae3b28f610fd0da1", + "source_id": "first_product_sku_1", + "product_id": "prod_0bae2dc5a090fd0184", + "sku": "Samsung phone 256GB", + "price": 210000, + "currency": "PLN", + "attributes": { + "color": "vintage-black", + "memory": "256", + "processor": "Intel" + }, + "image_url": "https://www.website.com/image.png", + "metadata": { + "imported": true + }, + "created_at": "2022-09-12T13:56:51.828Z", + "updated_at": "2022-09-12T14:09:40.859Z", + "object": "sku" + } + } + } } } } } - } - } - } - } - }, - "/v1/validation-rules/{validationRuleId}/assignments/{assignmentId}": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "validationRuleId", - "in": "path", - "required": true, - "description": "A unique validation rule ID." - }, - { - "schema": { - "type": "string" - }, - "name": "assignmentId", - "in": "path", - "required": true, - "description": "A unique validation rule assignment ID." - } - ], - "delete": { - "operationId": "delete-validation-rule-assignment", - "tags": [ - "VALIDATION RULES API" - ], - "summary": "Delete Validation Rule Assignment", - "description": "This method deletes a validation rule assignment.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." - }, - "404": { - "description": "Returns an error indicating that the validation rule or validation rule assignment with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Validation Rule Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find validation_rules with id val_4j7DCRm2IS5", - "request_id": "v-0ae3b84bac0683f697", - "resource_id": "val_4j7DCRm2IS5", - "resource_type": "validation_rules" - } + }, + "delete": { + "operationId": "delete-sku", + "tags": [ + "PRODUCTS API" + ], + "summary": "Delete SKU", + "description": "This method deletes a product SKU.", + "parameters": [ + { + "schema": { + "type": "string" }, - "Validation Rule Assignment Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find validation_rules_assignment with id asgm_tDN7MJNayjrf1wy", - "request_id": "v-0ae3b87eeb9027c916", - "resource_id": "asgm_tDN7MJNayjrf1wy", - "resource_type": "validation_rules_assignment" + "in": "query", + "name": "force", + "description": "If this flag is set to `true`, the SKU will be removed permanently. Going forward, the user will be able to create another SKU with exactly the same `source_id`." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." + }, + "404": { + "description": "Returns an error indicating that the product or sku with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Product Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find product with id 123-567-343", + "request_id": "v-0ae3a0d26fd40ecd11", + "resource_id": "123-567-343", + "resource_type": "product" + } + }, + "SKU Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find sku with id sku_0ae3a06b20019ba8f", + "request_id": "v-0ae3a1534d940ecd81", + "resource_id": "sku_0ae3a06b20019ba8f", + "resource_type": "sku" + } + } + } } } } } } - } - } - } - }, - "/v1/segments/{segmentId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "seg_DNAOhUtJffvX0f57ajLMFBYR" }, - "name": "segmentId", - "in": "path", - "required": true, - "description": "A unique customer segment ID." - } - ], - "get": { - "operationId": "get-segment", - "tags": [ - "SEGMENTS API" - ], - "summary": "Get Segment", - "description": "Retrieves the segment with given segment ID.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns segment object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/14_obj_segment_object" - }, - "examples": { - "Tier Segment": { - "value": { - "id": "seg_Mv5w1b2FIEbiCCO5ioT8TfI2", - "name": "Tiers 2 - Senior", - "created_at": "2022-06-09T13:21:26.656Z", - "type": "auto-update", - "filter": { - "junction": "and", - "loyalty_points.campaigns.Tiers 2.points": { - "conditions": { - "$more_than_equal": [ - 41 - ] + "/v1/products/importCSV": { + "post": { + "operationId": "import-products-using-csv", + "tags": [ + "PRODUCTS API" + ], + "summary": "Import Products using CSV", + "description": "Import products into the repository using a CSV file. \n\nCurl Example\n\n```cURL\ncurl -X POST \\\n https://api.voucherify.io/v1/products/importCSV \\\n -F file=@/path/to/products.csv \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\"\n```\n\nThe CSV file has to include headers in the first line.\n\n\n\n> 📘 Standard product fields mapping\n>\n> - Create a **comma separated value (CSV) file** or download our CSV import template. You can find an example template [here](https://s3.amazonaws.com/helpscout.net/docs/assets/5902f1c12c7d3a057f88a36d/attachments/627b82ed68d51e779443f550/Import_products_template.csv).\n> - Supported CSV file headers: `name,source_id,price,attributes,image_url,Metadata_property_name`\n> - **Name** is a **required** field. The remaining fields in the CSV template are optional.\n> - Override/Update products' **names** in Voucherify using this method. Data will be updated for each product included in the CSV file whose **source_id** matches a source ID in Voucherify. No other data can be updated other than the product name.\n> - Note that dates and date-time attributes need to be provided in compliance with the **ISO 8601 norms**. For example, 2022-03-11T09:00:00.000Z or 2022-03-11\n> - `YYYY-MM-DD`\n> - `YYYY-MM-DDTHH`\n> - `YYYY-MM-DDTHH:mm`\n> - `YYYY-MM-DDTHH:mm:ss`\n> - `YYYY-MM-DDTHH:mm:ssZ`\n> - `YYYY-MM-DDTHH:mm:ssZ`\n> - `YYYY-MM-DDTHH:mm:ss.SSSZ`\n> - Columns that can't be mapped to standard fields, will be mapped to **Custom attributes** and added as **products' metadata**. There is no limit on the number of custom attributes that you can import as metadata. \n> - To provide the proper data type, you need to add all custom attributes to the metadata schema **before importing the file**. Read more [here](https://support.voucherify.io/article/99-schema-validation-metadata#add-metadata).\n> - **Product attributes** (not custom attributes) need to be separated by a comma and enclosed in double quotes, i.e \"attribute1,attribute2\".\n> - Headers with metadata names **can't contain white-space characters**.\n> - If you import metadata defined in the schema as **arrays (multiple)**, you need to separate each value using a comma, for example: \n> - array of strings: \"subscribed,premium\" \n> - array of numbers: \"123,234\". \n> - array of dates: \"2000-01-01,2000-01-02\"\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "The file path is stored in the form `file` header.", + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/a_req_importCSV" + } + } + } + }, + "responses": { + "200": { + "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and products will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" + }, + "examples": { + "Async Action": { + "value": { + "async_action_id": "aa_0a875d56c805df6601" } } - }, - "initial_sync_status": "DONE", - "object": "segment" + } } } - } - } - } - }, - "404": { - "description": "Returns an error when requesting a segment that has been deleted or does not exist.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find segment with id seg_Mv5w1b2FIEbiCCO5ioT8TfI", - "request_id": "v-0b4d7a37a105797650", - "resource_id": "seg_Mv5w1b2FIEbiCCO5ioT8TfI", - "resource_type": "segment" + "400": { + "description": "Returns an invalid payload error. You may receive this error if you have incorrectly or have not specified the content type as `multipart/form-data` in the headers.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Invalid payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Payload should have required property 'file'", + "request_id": "v-0c4c46bbad0136789f" + } + } + } } } } } } - } - } - }, - "delete": { - "operationId": "delete-segment", - "tags": [ - "SEGMENTS API" - ], - "summary": "Delete Segment", - "description": "This method deletes a customer segment.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." }, - "404": { - "description": "Returns an error indicating that the customer segment with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Customer Segment Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find segment with id seg_DNAOhUtJffvX0f57ajLMFBY", - "request_id": "v-0ae3bb40409027cb63", - "resource_id": "seg_DNAOhUtJffvX0f57ajLMFBY", - "resource_type": "segment" + "/v1/skus/importCSV": { + "post": { + "operationId": "import-skus-using-csv", + "tags": [ + "PRODUCTS API" + ], + "summary": "Import SKUs using CSV", + "description": "Import SKUs into the repository using a CSV file.\n\nThe CSV file has to include headers in the first line. All properties which cannot be mapped to standard SKU fields will be added to the metadata object. You can find an example template [here](https://s3.amazonaws.com/helpscout.net/docs/assets/5902f1c12c7d3a057f88a36d/attachments/627b98d08c9b585083488a4c/Import_SKUS_template.csv). \n\nCurl Example\n\n```cURL\ncurl -X POST \\\n https://api.voucherify.io/v1/skus/importCSV \\\n -F file=@/path/to/skus.csv \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\"\n```\n> 🚧 Import sequence\n>\n> First import products using the [dedicated endpoint](ref:import-products-using-csv), then import SKUs using this endpoint to properly match SKUs to products.\n\n\n\n> 📘 Standard SKU fields mapping\n>\n> - **Required** fields are source_id and product_id.\n> - Supported CSV file headers: `product_id,sku,source_id,price,image_url,attributes`\n> - SKU **source_id**'s must be unique in the entire product catalog, no duplicates allowed.\n> - SKU attributes need to be in the form of a stringy-fied json, i.e.`\"{'color':'blue'}\"`. These attributes must be defined in the **product** beforehand in order for you to be able to import them to the SKU.\n> - You can use this method to update the following parameters in bulk: **sku** and the sku **price**.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "The file path is stored in the form `file` header.", + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/a_req_importCSV" } } } - } - } - } - } - } - }, - "/v1/customer-segment-object": { - "get": { - "operationId": "customer-segment-object", - "tags": [ - "SEGMENTS API" - ], - "summary": "Customer Segment Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Customer Segment Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/14_obj_segment_object" - } - } - } - } - } - } - }, - "/v1/segments": { - "post": { - "operationId": "create-segment", - "tags": [ - "SEGMENTS API" - ], - "summary": "Create Segment", - "description": "Create a customer segment.\n\n> 🚧 Limit on Static Segments\n>\n> There is a cap on the number of customers that you can assign to a static segment: **20,000**. If you would like to create a bigger segment, then you can use the unlimited auto-update segment instead and use some customer metadata to build this segment.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the boundary conditions for the customer segment.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/14_req_create_segment" }, - "examples": { - "Static Segment": { - "value": { - "name": "Customers in a new Segment", - "type": "static", - "customers": [ - "cust_iajsExT2QB4sGWzABY85WRqV", - "cust_sehkNIi8Uq2qQuRqSr7xn4Zi" - ] - } - }, - "Dynamic": { - "value": { - "name": "Customers in a new Dynamic Segment", - "type": "auto-update", - "filter": { - "junction": "and", - "created_at": { - "conditions": { - "$after": [ - "2021-12-01T00:00:00.000Z" - ] + "responses": { + "200": { + "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and SKUs will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" + }, + "examples": { + "Async Action": { + "value": { + "async_action_id": "aa_0a875d56c805df6601" + } } } } @@ -82381,3508 +80247,5572 @@ } } } - } - }, - "responses": { - "200": { - "description": "Returns a customer segment object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/14_obj_segment_object" - }, - "examples": { - "Static": { - "value": { - "id": "seg_vC8iOSCqUG02EsPzsHynLv8i", - "name": "Customers in a new Segment", - "created_at": "2022-09-13T08:57:15.801Z", - "type": "static", - "filter": null, - "initial_sync_status": "DONE", - "object": "segment" + }, + "/v1/product-collection-object": { + "get": { + "operationId": "product-collection-object", + "tags": [ + "PRODUCT COLLECTIONS API" + ], + "summary": "Product Collection Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Product Collection Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/product_collections_collection_item" + } } + } + } + } + } + }, + "/v1/product-collections": { + "get": { + "operationId": "list-product-collections", + "tags": [ + "PRODUCT COLLECTIONS API" + ], + "summary": "List Product Collections", + "description": "This method returns a list of product collections.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at" + ] }, - "Dynamic": { - "value": { - "id": "seg_nZULMFHhVWIFm9vQ0dytg83Q", - "name": "Customers in a new Dynamic Segment", - "created_at": "2022-09-13T09:03:32.764Z", - "type": "auto-update", - "filter": { - "junction": "and", - "created_at": { - "conditions": { - "$after": [ - "2021-12-01T00:00:00.000Z" - ] + "in": "query", + "name": "order", + "description": "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." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary containing a list of product collections and details about each product collection.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/product_collections_list_response_body" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "pc_Dj1qSH7bho4SVh7aSDKjU174", + "name": "Products in Poland", + "type": "AUTO_UPDATE", + "filter": { + "junction": "and", + "metadata.product_location": { + "conditions": { + "$in_location": [ + "loc_RcYz537sV07e1t5aG5tIH9FD" + ] + } + } + }, + "created_at": "2022-07-14T16:12:26.377Z", + "object": "products_collection" + }, + { + "id": "pc_FJdBpaQyvK6Gcdul4D2HRChI", + "name": "Price less than 10", + "type": "AUTO_UPDATE", + "filter": { + "junction": "and", + "price": { + "conditions": { + "$less_than": [ + 1000 + ] + } + } + }, + "created_at": "2022-03-17T07:11:25.406Z", + "object": "products_collection" + }, + { + "id": "pc_4ndRXAsTOzwSdHcQcxf489uU", + "name": "Color is brown", + "type": "AUTO_UPDATE", + "filter": { + "junction": "and", + "metadata.color": { + "conditions": { + "$is": [ + "brown" + ] + } + } + }, + "created_at": "2022-03-16T14:27:49.612Z", + "object": "products_collection" + }, + { + "id": "pc_BxofAP7pyM9FO7M6iaIzIouy", + "name": "Color not brown", + "type": "AUTO_UPDATE", + "filter": { + "junction": "and", + "metadata.color": { + "conditions": { + "$is_not": [ + "brown" + ] + } + } + }, + "created_at": "2022-03-16T13:49:05.697Z", + "object": "products_collection" + }, + { + "id": "pc_uHpM9ipEQH2yEpm3D8aohkBM", + "name": "Price less than 20", + "type": "AUTO_UPDATE", + "filter": { + "junction": "and", + "price": { + "conditions": { + "$less_than": [ + 2000 + ] + } + } + }, + "created_at": "2022-03-16T13:46:01.102Z", + "object": "products_collection" + }, + { + "id": "pc_ZgM25PcZAMp6qItKJRtR2mEi", + "name": "Name starts with S", + "type": "AUTO_UPDATE", + "filter": { + "junction": "and", + "name": { + "conditions": { + "$starts_with": [ + "S" + ] + } + } + }, + "created_at": "2022-03-16T13:42:35.917Z", + "object": "products_collection" + }, + { + "id": "pc_41V4DiQQO8YGqj0J2oZD57j4", + "name": "Ends with baby", + "type": "AUTO_UPDATE", + "filter": { + "junction": "and", + "source_id": { + "conditions": { + "$ends_with": [ + "baby" + ] + } + } + }, + "created_at": "2022-03-14T12:50:19.885Z", + "object": "products_collection" + }, + { + "id": "pc_0cRX5wAFt1R1R5Ir6WdTowui", + "name": "C start", + "type": "AUTO_UPDATE", + "filter": { + "junction": "and", + "name": { + "conditions": { + "$starts_with": [ + "C" + ] + } + } + }, + "created_at": "2022-03-14T12:18:15.588Z", + "object": "products_collection" + }, + { + "id": "pc_bQ2p9TycbEhd3YzwFCR3JQYA", + "name": "Shirts", + "type": "STATIC", + "products": [ + { + "id": "prod_0a9f9aeddb019a42db", + "object": "product" + }, + { + "id": "prod_0a9f9ab4ab019a42d5", + "object": "product" + } + ], + "created_at": "2022-02-28T11:42:12.484Z", + "object": "products_collection" + } + ], + "total": 9 } } - }, - "initial_sync_status": "IN_PROGRESS", - "object": "segment" + } } } } } - } - } - } - } - }, - "/v1/custom-event-object": { - "get": { - "operationId": "custom-event-object", - "tags": [ - "EVENTS API" - ], - "summary": "Custom Event Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Custom Event Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/15_req_track_custom_event" - } - } - } - } - } - } - }, - "/v1/events": { - "post": { - "operationId": "track-custom-event", - "tags": [ - "EVENTS API" - ], - "summary": "Track Custom Event", - "description": "To track a custom event, you create an event object. \n\nThe 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.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the details of the custom event.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/15_req_track_custom_event" - }, - "examples": { - "Example": { - "value": { - "event": "event-name", - "customer": { - "source_id": "referee-source_id" - }, - "referral": { - "code": "voucher-code", - "referrer_id": "referrer-source_id" - } - } - }, - "Referral triggered by custom event": { - "value": { - "event": "user_subscribed", - "customer": { - "source_id": "source_customer_event" - }, - "referral": { - "code": "46jL0kYI", - "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" - }, - "metadata": { - "login": "bob", - "pricing_plan": "PP1", - "volume_number": 4 - } - } - }, - "Earning rule triggered by custom event": { - "value": { - "event": "cart_abandoned", - "customer": { - "source_id": "source_customer_event" - }, - "loyalty": { - "code": "6CB4KDAu" - }, - "metadata": { - "date": "2022-12-01", - "flag": true, - "text": "Cart abandoned event", - "date_time": "2022-12-01T09:24:33.061Z", - "number": 1 + }, + "post": { + "operationId": "create-product-collection", + "tags": [ + "PRODUCT COLLECTIONS API" + ], + "summary": "Create Product Collection", + "description": "This method creates a new product collection.", + "responses": { + "200": { + "description": "Returns information about the newly created collection, as well as an array containing the products.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/product_collections_collection_item" + } } } } - } - } - } - }, - "responses": { - "200": { - "description": "Returns the event type if the event was received by the application.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/15_res_track_custom_event" - }, - "examples": { - "Example": { - "value": { - "object": "event", - "type": "cart_abandoned", - "customer": {}, - "referral": null, - "loyalty": null + }, + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/product_collections_create_request_body" } } } } } }, - "400": { - "description": "Returns an error if the request payload is incomplete.", - "content": { - "application/json": { + "/v1/product-collections/{productCollectionId}": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_error_no_translation" + "type": "string", + "example": "pc_41V4DiQQO8YGqj0J2oZD57j4" }, - "examples": { - "Invalid payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Property .referral should have required property 'code'", - "request_id": "v-0c15694e0e022146dd" - } - } - } + "name": "productCollectionId", + "in": "path", + "required": true, + "description": "A unique product collection ID." } - } - } - } - } - }, - "/client/v1/events": { - "post": { - "operationId": "track-custom-event-client-side", - "tags": [ - "EVENTS API" - ], - "summary": "Track Custom Event (client-side)", - "description": "To track a custom event, you create an event object. \n\nThe 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.", - "parameters": [ - { - "$ref": "#/components/parameters/origin" - } - ], - "security": [ - { - "X-Client-Application-Id-1": [], - "X-Client-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the details of the custom event.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/15_req_track_custom_event" - }, - "examples": { - "Referral triggered by custom event": { - "value": { - "event": "user_subscribed", - "customer": { - "source_id": "source_customer_event" - }, - "referral": { - "code": "46jL0kYI", - "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" - }, - "metadata": { - "login": "bob", - "pricing_plan": "PP1", - "volume_number": 4 + ], + "get": { + "operationId": "get-product-collection", + "tags": [ + "PRODUCT COLLECTIONS API" + ], + "summary": "Get Product Collection", + "description": "Retrieves the product collection.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a products collection object if a valid identifier was provided in the path.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/product_collections_get_response_body", + "description": "Returns a products collection object if a valid identifier was provided in the path." + }, + "examples": { + "Dynamic": { + "value": { + "id": "pc_Dj1qSH7bho4SVh7aSDKjU174", + "name": "Products in Poland", + "type": "AUTO_UPDATE", + "filter": { + "junction": "and", + "metadata.product_location": { + "conditions": { + "$in_location": [ + "loc_RcYz537sV07e1t5aG5tIH9FD" + ] + } + } + }, + "created_at": "2022-07-14T16:12:26.377Z", + "object": "products_collection" + } + }, + "Static": { + "value": { + "id": "pc_bQ2p9TycbEhd3YzwFCR3JQYA", + "name": "Shirts", + "type": "STATIC", + "products": [ + { + "id": "prod_0a9f9aeddb019a42db", + "object": "product" + }, + { + "id": "prod_0a9f9ab4ab019a42d5", + "object": "product" + } + ], + "created_at": "2022-02-28T11:42:12.484Z", + "object": "products_collection" + } + } + } } } }, - "Earning rule triggered by custom event": { - "value": { - "event": "cart_abandoned", - "customer": { - "source_id": "source_customer_event" - }, - "loyalty": { - "code": "6CB4KDAu" - }, - "metadata": { - "date": "2022-12-01", - "flag": true, - "text": "Cart abandoned event", - "date_time": "2022-12-01T09:24:33.061Z", - "number": 1 + "404": { + "description": "Returns an error when requesting a product collection that has been deleted or does not exist.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find products_collection with id pc_41V4DiQQO8YGqj0J2oZD57j", + "request_id": "v-0b4ec2530e9646cb15", + "resource_id": "pc_41V4DiQQO8YGqj0J2oZD57j", + "resource_type": "products_collection" + } + } + } } } } } - } - } - }, - "responses": { - "200": { - "description": "Returns the event type if the event was received by the application.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/15_res_track_custom_event" + }, + "delete": { + "operationId": "delete-product-collection", + "tags": [ + "PRODUCT COLLECTIONS API" + ], + "summary": "Delete Product Collection", + "description": "This method deletes a product collection.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." + }, + "400": { + "description": "Returns an error indicating that the product collection with given ID is in use by other resources.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_400_resource_in_use" + }, + "examples": { + "Product Colllection In Use": { + "value": { + "code": 400, + "key": "resource_in_use", + "message": "Resource in use", + "details": "Resource products_collection with id pc_41V4DiQQO8YGqj0J2oZD57j4 is in use by validation_ruless with ids [val_9TB89AjZeVEJ]", + "request_id": "v-0ae3a63aff940ed1b2", + "related_object_ids": [ + "val_9TB89AjZeVEJ" + ], + "related_object_type": "validation_rules" + } + } + } + } + } }, - "examples": { - "Example": { - "value": { - "object": "event", - "type": "cart_abandoned", - "customer": {}, - "referral": null, - "loyalty": null + "404": { + "description": "Returns an error indicating that the product collection with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Product Collection Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find products_collection with id pc_41V4DiQQO8YGqj0J2oZD57j", + "request_id": "v-0ae3a49261d027b870", + "resource_id": "pc_41V4DiQQO8YGqj0J2oZD57j", + "resource_type": "products_collection" + } + } + } } } } } } }, - "400": { - "description": "Returns an error if the request payload is incomplete.", - "content": { - "application/json": { + "/v1/product-collections/{productCollectionId}/products": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_error_no_translation" + "type": "string" }, - "examples": { - "Invalid payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Property .referral should have required property 'code'", - "request_id": "v-0c15694e0e022146dd" - } - } - } + "name": "productCollectionId", + "in": "path", + "required": true, + "description": "Unique product collection ID." } - } - } - } - } - }, - "/v1/consents-object": { - "get": { - "operationId": "consents-object", - "tags": [ - "CONSENTS API" - ], - "summary": "Consents Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Consents Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/18_res_list_consents_GET" + ], + "get": { + "operationId": "list-products-in-collection", + "tags": [ + "PRODUCT COLLECTIONS API" + ], + "summary": "List Products in Collection", + "description": "Retrieves list of products from a products collection; works for both dynamic and static product collections.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" } - } - } - } - } - } - }, - "/v1/consents": { - "get": { - "operationId": "list-consents", - "tags": [ - "CONSENTS API" - ], - "summary": "List Consents", - "description": "List the Marketing Permission definitions within the project along with opt-in consents.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns marketing permission groups and opt-in consents.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/18_res_list_consents_GET" - }, - "examples": { - "Marketing Permissions Groups and Consents": { - "value": { - "groups": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "cnstgr_3c7Z3rcOLv51bsXlRtTZPYj8", - "name": "Consent group", - "description": "Consent group", - "consents": [ - "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", - "cnst_VCmucIvAsmDYw2PPAok6bcYy" - ], - "created_at": "2022-04-13T09:12:47.743Z", - "updated_at": "2022-04-13T09:45:46.616Z", - "object": "consent_group" - }, - { - "id": "cnstgr_EAIakTj5lNG2ZpiQEauGqBlY", - "name": "Consent group 2", - "description": "Consent group 2", - "consents": [ - "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", - "cnst_VCmucIvAsmDYw2PPAok6bcYy" + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary of products and/or SKUs grouped in the collection with each product's/SKU's details.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/product_collections_list_products_response_body" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "prod_0bae45ffc7003ffc52", + "source_id": "second_product", + "name": "Samsung Phone 2", + "price": 230000, + "attributes": [ + "color", + "memory", + "processor" + ], + "metadata": { + "test": true, + "vendor": "Online Store - 4" + }, + "image_url": "https://www.images.com/image4.png", + "created_at": "2022-09-12T14:44:13.212Z", + "updated_at": null, + "object": "product" + }, + { + "id": "sku_0bae3b28f610fd0da1", + "source_id": "first_product_sku_1", + "product_id": "prod_0bae2dc5a090fd0184", + "sku": "Samsung phone 256GB", + "price": 210000, + "attributes": { + "color": "vintage-black", + "memory": "256", + "processor": "Intel" + }, + "image_url": "https://www.website.com/image.png", + "metadata": { + "test": false, + "vendor": "Online Stores", + "imported": true + }, + "created_at": "2022-09-12T13:56:51.828Z", + "updated_at": "2022-09-12T14:09:40.859Z", + "object": "sku", + "product": { + "id": "prod_0bae2dc5a090fd0184", + "source_id": "first_product", + "name": "Samsung Phone", + "price": null, + "attributes": [], + "metadata": {}, + "object": "product" + } + }, + { + "id": "prod_0bae2dc5a090fd0184", + "source_id": "first_product", + "name": "Samsung Phone 1", + "price": 220000, + "attributes": [ + "color", + "memory", + "processor" + ], + "metadata": { + "test": true, + "vendor": "Online Store - 3" + }, + "image_url": "https://www.images.com/image2.png", + "created_at": "2022-09-12T12:58:22.232Z", + "updated_at": "2022-09-12T14:44:13.208Z", + "object": "product" + }, + { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku": "Comics1", + "price": 1700, + "attributes": {}, + "image_url": null, + "metadata": { + "color": [ + "golden" + ], + "vendor": "islands" + }, + "created_at": "2022-08-05T17:23:14.084Z", + "updated_at": "2022-09-09T09:24:43.806Z", + "object": "sku", + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": null, + "attributes": [], + "metadata": {}, + "object": "product" + } + }, + { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100, + "attributes": [], + "metadata": { + "color": [ + "silver" + ], + "vendor": "Bookstore1" + }, + "image_url": "https://www.images.com/image1.png", + "created_at": "2022-08-05T17:23:14.071Z", + "updated_at": "2022-09-09T09:24:43.728Z", + "object": "product" + }, + { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "price": 60000, + "attributes": [], + "metadata": { + "color": [ + "purple" + ], + "vendor": "mall" + }, + "image_url": null, + "created_at": "2022-08-05T17:15:55.270Z", + "updated_at": "2022-09-09T09:24:43.704Z", + "object": "product" + } ], - "created_at": "2022-04-13T10:03:46.564Z", - "updated_at": null, - "object": "consent_group" + "total": 6 } - ], - "total": 2 - }, - "consents": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", - "name": "Consent", - "description": "Consent for marketing", - "category": "New", - "created_at": "2022-04-13T09:11:27.037Z", - "updated_at": null, - "object": "consent" - }, - { - "id": "cnst_VCmucIvAsmDYw2PPAok6bcYy", - "name": "Consent 2", - "description": "Consent 2", - "category": "Trial", - "created_at": "2022-04-13T09:45:37.597Z", - "updated_at": null, - "object": "consent" - } - ], - "total": 2 + } } } } - } - } - } - } - } - } - }, - "/client/v1/consents#": { - "get": { - "operationId": "list-consents-client-side", - "tags": [ - "CONSENTS API" - ], - "summary": "List Consents (client-side)", - "description": "List the Marketing Permission definitions within the project along with opt-in consents.", - "parameters": [ - { - "$ref": "#/components/parameters/origin" - } - ], - "security": [ - { - "X-Client-Application-Id-1": [], - "X-Client-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns marketing permission groups and opt-in consents.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/18_res_list_consents_GET" - }, - "examples": { - "Marketing Permissions Groups and Consents": { - "value": { - "groups": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "cnstgr_3c7Z3rcOLv51bsXlRtTZPYj8", - "name": "Consent group", - "description": "Consent group", - "consents": [ - "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", - "cnst_VCmucIvAsmDYw2PPAok6bcYy" - ], - "created_at": "2022-04-13T09:12:47.743Z", - "updated_at": "2022-04-13T09:45:46.616Z", - "object": "consent_group" - }, - { - "id": "cnstgr_EAIakTj5lNG2ZpiQEauGqBlY", - "name": "Consent group 2", - "description": "Consent group 2", - "consents": [ - "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", - "cnst_VCmucIvAsmDYw2PPAok6bcYy" - ], - "created_at": "2022-04-13T10:03:46.564Z", - "updated_at": null, - "object": "consent_group" - } - ], - "total": 2 - }, - "consents": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", - "name": "Consent", - "description": "Consent for marketing", - "category": "New", - "created_at": "2022-04-13T09:11:27.037Z", - "updated_at": null, - "object": "consent" - }, - { - "id": "cnst_VCmucIvAsmDYw2PPAok6bcYy", - "name": "Consent 2", - "description": "Consent 2", - "category": "Trial", - "created_at": "2022-04-13T09:45:37.597Z", - "updated_at": null, - "object": "consent" + }, + "404": { + "description": "Returns an error when requesting a product collection that has been deleted or does not exist.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find products_collection with id pc_M5XgaWPx3Sl4v26atA15zFj", + "request_id": "v-0b4ec6429e5646d089", + "resource_id": "pc_M5XgaWPx3Sl4v26atA15zFj", + "resource_type": "products_collection" } - ], - "total": 2 + } } } } } } } - } - } - } - }, - "/v1/async-action-object": { - "get": { - "operationId": "async-action-object", - "tags": [ - "ASYNC ACTIONS API" - ], - "summary": "Async Action Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Async Action Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/17_obj_async_action_object" - } - } - } - } - } - } - }, - "/v1/async-actions": { - "get": { - "operationId": "list-async-actions", - "tags": [ - "ASYNC ACTIONS API" - ], - "summary": "List Async Actions", - "description": "Track asynchronous operations scheduled in your project. \n\nThe table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import).\n\n| **Types by Context** | **Endpoint** |\n|:---|:---|\n| **CAMPAIGN** | |\n| CAMPAIGN.VOUCHERS_IMPORT | **POST** [/campaigns/{campaignId}/import](ref:import-vouchers-to-campaign) |\n| CAMPAIGN.VOUCHERS_IMPORT_CSV | **POST** [/campaigns/{campaignId}/importCSV](ref:import-vouchers-to-campaign-using-csv) |\n| CAMPAIGN.VOUCHERS_UPDATE | **PUT** [/campaigns/{campaignId}](ref:update-campaign) |\n| CAMPAIGN.VOUCHERS_DELETE | **DELETE** [/campaigns/{campaignId}](ref:delete-campaign) |\n| CAMPAIGN.VOUCHERS_GENERATE |
  • **POST** [/campaigns](ref:create-campaign): asynchronous for campaigns with more than 1 voucher, synchronous for campaign with 1 voucher
  • **POST** [/campaigns/{campaignId}/vouchers](ref:add-vouchers-to-campaign)
    • |\n| **CUSTOMERS** | |\n| CUSTOMERS.IMPORT_CSV | **POST** [/customers/importCSV](ref:import-customers-using-csv) |\n| CUSTOMERS.BULK_UPDATE | **POST** [/customers/bulk/async](ref:update-customers-in-bulk) |\n| CUSTOMERS.METADATA_UPDATE | **POST** [/customers/metadata/async](ref:update-customers-metadata-in-bulk) |\n| **PRODUCTS** | |\n| PRODUCTS.BULK_UPDATE | **POST** [/products/bulk/async](ref:update-products-in-bulk)
      |\n| PRODUCTS.METADATA_UPDATE | **POST** [/products/metadata/async](ref:update-products-metadata-in-bulk) |\n| PRODUCTS.IMPORT_CSV | **POST** [/products/importCSV](ref:import-products-using-csv) |\n| SKUS.IMPORT_CSV | **POST** [/skus/importCSV](ref:import-skus-using-csv) |\n| **VOUCHERS** | |\n| VOUCHERS.IMPORT | **POST** [/vouchers/import](ref:import-vouchers) |\n| VOUCHERS.IMPORT_CSV | **POST** [/vouchers/importCSV](ref:import-vouchers-using-csv) |\n| VOUCHERS.BULK_UPDATE | **POST** [/vouchers/bulk/async](ref:update-vouchers-in-bulk)
      |\n| VOUCHERS.METADATA_UPDATE | **POST** [/vouchers/metadata/async](ref:update-vouchers-metadata-in-bulk) | \n| **ORDERS** | |\n| ORDERS.IMPORT | **POST** [/orders/import](ref:import-orders) |\n| **METADATA KEY PURGE** | |\n| CAMPAIGNS.METADATA_KEY_PURGE
      CUSTOMERS.METADATA_KEY_PURGE
      PRODUCTS.METADATA_KEY_PURGE
      VOUCHERS.METADATA_KEY_PURGE
      ORDERS.METADATA_KEY_PURGE | No API endpoint equivalent. You can perform this action through the Dashboard. See Dashboard documentation: Dashboard > [Project Settings](https://support.voucherify.io/article/99-schema-validation-metadata#maintenance) |", - "parameters": [ - { - "schema": { - "type": "integer" - }, - "in": "query", - "name": "limit", - "description": "Limit the number of asynchronous actions that the API returns in the response." }, - { - "schema": { - "type": "string", - "example": "2021-09-08T13:52:18.227Z", - "format": "date-time" - }, - "in": "query", - "name": "end_date", - "description": "Limits results to actions scheduled before the `end_date`. The date format needs to be consistent with ISO 8601 format (`2016-11-16T14:14:31Z` or `2016-11-16`). " - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a list of all scheduled asynchronous actions and detailed information for each scheduled action. Note that a status `DONE`doesn't include the result of the completed action. If you need more information about the result, use the ID of the respective async action to call the [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/17_res_list_async_actions_GET" - }, - "examples": { - "List Async Actions": { - "value": { - "object": "list", - "data_ref": "async_actions", - "async_actions": [ - { - "id": "aa_0ba518c55290c6fd62", - "type": "CUSTOMERS.BULK_UPDATE", - "status": "DONE", - "created_at": "2022-09-05T11:40:17.098Z", - "updated_at": "2022-09-05T11:40:17.887Z", - "request_id": "v-0ba518c52bc99858f0", - "progress": 100, - "object": "async_action" - }, - { - "id": "aa_0ba50a7ff4d3574568", - "type": "CUSTOMERS.METADATA_UPDATE", - "status": "DONE", - "created_at": "2022-09-05T10:37:56.051Z", - "updated_at": "2022-09-05T10:37:56.862Z", - "request_id": "v-0ba50a7feb49984902", - "progress": 100, - "object": "async_action" - } - ] + "/v1/validation-rule-object": { + "get": { + "operationId": "validation-rule-object", + "tags": [ + "VALIDATION RULES API" + ], + "summary": "Validation Rule Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Validation Rule Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/13_obj_validation_rule_object" + } } } } } } }, - "400": { - "description": "Returns an error if incorrect query parameters were provided.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Invalid Query Parameters": { - "value": { - "code": 400, - "key": "invalid_query_params", - "message": "Invalid query params", - "details": "Property .end_date cannot be recognized as a ISO-8601 compliant date", - "request_id": "v-0c54493e444b0f61a6" + "/v1/validation-rule-assignment-object": { + "get": { + "operationId": "validation-rule-assignment-object", + "tags": [ + "VALIDATION RULES API" + ], + "summary": "Validation Rule Assignment Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Validation Rule Assignment Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/13_obj_validation_rule_assignment_object" + } } } } } } - } - } - } - }, - "/v1/async-actions/{asyncActionId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "aa_0afb3d009a55814a48" }, - "name": "asyncActionId", - "in": "path", - "required": true, - "description": "Unique ID of the asynchronous operation." - } - ], - "get": { - "operationId": "get-async-action", - "tags": [ - "ASYNC ACTIONS API" - ], - "summary": "Get Async Action", - "description": "Check the result of a scheduled asynchronous operation. \n\nThe table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import).\n\n| **Types by Context** | **Endpoint** |\n|:---|:---|\n| **CAMPAIGN** | |\n| CAMPAIGN.VOUCHERS_IMPORT | **POST** [/campaigns/{campaignId}/import](ref:import-vouchers-to-campaign) |\n| CAMPAIGN.VOUCHERS_IMPORT_CSV | **POST** [/campaigns/{campaignId}/importCSV](ref:import-vouchers-to-campaign-using-csv) |\n| CAMPAIGN.VOUCHERS_UPDATE | **PUT** [/campaigns/{campaignId}](ref:update-campaign) |\n| CAMPAIGN.VOUCHERS_DELETE | **DELETE** [/campaigns/{campaignId}](ref:delete-campaign) |\n| CAMPAIGN.VOUCHERS_GENERATE |
      • **POST** [/campaigns](ref:create-campaign): asynchronous for campaigns with more than 1 voucher, synchronous for campaign with 1 voucher
      • **POST** [/campaigns/{campaignId}/vouchers](ref:add-vouchers-to-campaign)
        • |\n| **CUSTOMERS** | |\n| CUSTOMERS.IMPORT_CSV | **POST** [/customers/importCSV](ref:import-customers-using-csv) |\n| CUSTOMERS.BULK_UPDATE | **POST** [/customers/bulk/async](ref:update-customers-in-bulk) |\n| CUSTOMERS.METADATA_UPDATE | **POST** [/customers/metadata/async](ref:update-customers-metadata-in-bulk) |\n| **PRODUCTS** | |\n| PRODUCTS.BULK_UPDATE | **POST** [/products/bulk/async](ref:update-products-in-bulk)
          |\n| PRODUCTS.METADATA_UPDATE | **POST** [/products/metadata/async](ref:update-products-metadata-in-bulk) |\n| PRODUCTS.IMPORT_CSV | **POST** [/products/importCSV](ref:import-products-using-csv) |\n| SKUS.IMPORT_CSV | **POST** [/skus/importCSV](ref:import-skus-using-csv) |\n| **VOUCHERS** | |\n| VOUCHERS.IMPORT | **POST** [/vouchers/import](ref:import-vouchers) |\n| VOUCHERS.IMPORT_CSV | **POST** [/vouchers/importCSV](ref:import-vouchers-using-csv) |\n| VOUCHERS.BULK_UPDATE | **POST** [/vouchers/bulk/async](ref:update-vouchers-in-bulk)
          |\n| VOUCHERS.METADATA_UPDATE | **POST** [/vouchers/metadata/async](ref:update-vouchers-metadata-in-bulk) | \n| **ORDERS** | |\n| ORDERS.IMPORT | **POST** [/orders/import](ref:import-orders) |\n| **METADATA KEY PURGE** | |\n| CAMPAIGNS.METADATA_KEY_PURGE
          CUSTOMERS.METADATA_KEY_PURGE
          PRODUCTS.METADATA_KEY_PURGE
          VOUCHERS.METADATA_KEY_PURGE
          ORDERS.METADATA_KEY_PURGE | No API endpoint equivalent. You can perform this action through the Dashboard. See Dashboard documentation: Dashboard > [Project Settings](https://support.voucherify.io/article/99-schema-validation-metadata#maintenance) |", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns detailed information about the async action result.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/17_obj_async_action_object" + "/v1/validation-rules": { + "get": { + "operationId": "list-validation-rules", + "tags": [ + "VALIDATION RULES API" + ], + "summary": "List Validation Rules", + "description": "Retrieve validation rules.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" }, - "examples": { - "CAMPAIGN.VOUCHERS_IMPORT": { - "value": { - "id": "aa_0af9b22296cf473a10", - "type": "CAMPAIGN.VOUCHERS_IMPORT", - "status": "DONE", - "result": { - "message": "0 voucher(s) imported successfully, 3 failed.", - "failed": [ - { - "code": "CODE9", - "reason": "unit: must be a number, property is required (actual value is 'EUR')" - }, - { - "code": "CODE8", - "reason": "unit: must be a number, property is required (actual value is 'EUR')" - }, - { - "code": "CODE7", - "reason": "unit: must be a number, property is required (actual value is 'EUR')" - } - ], - "done_count": 0, - "failed_count": 3 - }, - "created_at": "2023-01-20T07:23:43.289Z", - "updated_at": "2023-01-20T07:23:44.044Z", - "request_id": "v-0c553fdb325688d510", - "progress": 100, - "processing_time": 755, - "object": "async_action" - } - }, - "CAMPAIGN.VOUCHERS_IMPORT_CSV": { - "value": { - "id": "aa_0c5543f00797b6113f", - "type": "CUSTOMERS.IMPORT_CSV", - "status": "DONE", - "result": { - "message": "0 customer(s) imported successfully, 2 failed.", - "failed": [ - { - "source_id": "test-user@voucherify.io", - "row": 1, - "reason": "acquisition_channel: must be a string, property is required, must be equal to one of Facebook,Twitter,Website (actual value is 'snap')" - }, - { - "source_id": "", - "row": 2, - "reason": "acquisition_channel: must be a string, property is required, must be equal to one of Facebook,Twitter,Website (actual value is 'insta')" - } - ], - "done_count": 0, - "failed_count": 2 - }, - "created_at": "2023-01-20T07:41:33.086Z", - "updated_at": "2023-01-20T07:41:33.216Z", - "request_id": "v-0c5543eff2cb0f547f", - "progress": 100, - "processing_time": 130, - "object": "async_action" - } - }, - "CAMPAIGN.VOUCHERS_DELETE": { - "value": { - "id": "aa_0c553853d957b67bd4", - "type": "CAMPAIGN.VOUCHERS_DELETE", - "status": "DONE", - "result": { - "message": "Deleted 2 vouchers.", - "done_count": 2 - }, - "created_at": "2023-01-20T06:50:49.573Z", - "updated_at": "2023-01-20T06:50:50.053Z", - "request_id": "v-0c553853b5c418c826", - "progress": 100, - "processing_time": 480, - "object": "async_action" - } - }, - "CAMPAIGN.VOUCHERS_UPDATE": { - "value": { - "id": "aa_0c5440c25c0e5728d0", - "type": "CAMPAIGN.VOUCHERS_UPDATE", - "status": "DONE", - "result": { - "message": "Updated 1 vouchers.", - "done_count": 1 - }, - "created_at": "2023-01-19T12:49:11.024Z", - "updated_at": "2023-01-19T12:49:11.852Z", - "request_id": "v-0c5440c24304189e44", - "progress": 100, - "processing_time": 828, - "object": "async_action" - } - }, - "CAMPAIGN.VOUCHERS_GENERATE": { - "value": { - "id": "aa_0c54441d14d7b60014", - "type": "CAMPAIGN.VOUCHERS_GENERATE", - "status": "DONE", - "result": { - "message": "Generated 2 vouchers.", - "done_count": 2 - }, - "created_at": "2023-01-19T13:03:50.355Z", - "updated_at": "2023-01-19T13:03:51.030Z", - "request_id": "v-0c54441d0e4418b647", - "progress": 100, - "processing_time": 675, - "object": "async_action" - } - }, - "CAMPAIGNS.METADATA_KEY_PURGE": { - "value": { - "id": "aa_0c554b22664a0eb5fc", - "type": "CAMPAIGNS.METADATA_KEY_PURGE", - "status": "DONE", - "result": { - "message": "Updated 0 campaigns.", - "done_count": 0 - }, - "created_at": "2023-01-20T08:12:59.673Z", - "updated_at": "2023-01-20T08:13:00.638Z", - "request_id": "w-0c554b225f8a0eb5fb", - "progress": 100, - "processing_time": 965, - "object": "async_action" - } - }, - "CUSTOMERS.IMPORT_CSV": { - "value": { - "id": "aa_0c5543f00797b6113f", - "type": "CUSTOMERS.IMPORT_CSV", - "status": "DONE", - "result": { - "message": "0 customer(s) imported successfully, 2 failed.", - "failed": [ - { - "source_id": "test-user@voucherify.io", - "row": 1, - "reason": "acquisition_channel: must be a string, property is required, must be equal to one of Facebook,Twitter,Website (actual value is 'snap')" - }, - { - "source_id": "", - "row": 2, - "reason": "acquisition_channel: must be a string, property is required, must be equal to one of Facebook,Twitter,Website (actual value is 'insta')" - } - ], - "done_count": 0, - "failed_count": 2 - }, - "created_at": "2023-01-20T07:41:33.086Z", - "updated_at": "2023-01-20T07:41:33.216Z", - "request_id": "v-0c5543eff2cb0f547f", - "progress": 100, - "processing_time": 130, - "object": "async_action" - } - }, - "CUSTOMERS.BULK_UPDATE": { - "value": { - "id": "aa_0c5547cc5e17b617b6", - "type": "CUSTOMERS.BULK_UPDATE", - "status": "DONE", - "result": { - "results": [ - { - "source_id": "source_id_1", - "updated": true, - "found": true - }, - { - "source_id": "source_id_2", - "updated": true, - "found": true - }, - { - "source_id": "source_id_3", - "updated": true, - "found": true - } - ], - "done_count": 3 - }, - "created_at": "2023-01-20T07:58:25.144Z", - "updated_at": "2023-01-20T07:58:25.869Z", - "request_id": "v-0c5547cc4d8b0f5be4", - "progress": 100, - "processing_time": 725, - "object": "async_action" - } - }, - "CUSTOMERS.METADATA_UPDATE": { - "value": { - "id": "aa_0c554a92030e576181", - "type": "CUSTOMERS.METADATA_UPDATE", - "status": "DONE", - "result": { - "results": [ - { - "source_id": "source_1", - "updated": true, - "found": true - }, - { - "source_id": "source_2", - "updated": true, - "found": true - } - ], - "done_count": 2 - }, - "created_at": "2023-01-20T08:10:31.821Z", - "updated_at": "2023-01-20T08:10:32.564Z", - "request_id": "v-0c554a91fb4b0f61a2", - "progress": 100, - "processing_time": 743, - "object": "async_action" - } - }, - "CUSTOMERS.METADATA_KEY_PURGE": { - "value": { - "id": "aa_0c5551f2ab0a0ebf0e", - "type": "CUSTOMERS.METADATA_KEY_PURGE", - "status": "DONE", - "result": { - "message": "Updated 0 customers.", - "done_count": 0 - }, - "created_at": "2023-01-20T08:42:45.804Z", - "updated_at": "2023-01-20T08:42:46.079Z", - "request_id": "w-0c5551f2a38a0ebf0d", - "progress": 100, - "processing_time": 275, - "object": "async_action" - } - }, - "PRODUCTS.BULK_UPDATE": { - "value": { - "id": "aa_0c5553f0f457b6328e", - "type": "PRODUCTS.BULK_UPDATE", - "status": "DONE", - "result": { - "results": [ - { - "source_id": "first_product", - "updated": false, - "found": true - }, - { - "source_id": "second_product", - "updated": false, - "found": true - } - ], - "done_count": 2 - }, - "created_at": "2023-01-20T08:51:28.337Z", - "updated_at": "2023-01-20T08:51:28.439Z", - "request_id": "v-0c5553f0e94b0f7502", - "progress": 100, - "processing_time": 102, - "object": "async_action" - } - }, - "PRODUCTS.METADATA_UPDATE": { - "value": { - "id": "aa_0c5554869b97b633b4", - "type": "PRODUCTS.METADATA_UPDATE", - "status": "DONE", - "result": { - "results": [ - { - "source_id": "123-567-3433", - "updated": false, - "found": true - }, - { - "source_id": "test_volleyball", - "updated": false, - "found": true - } - ], - "done_count": 2 - }, - "created_at": "2023-01-20T08:54:01.582Z", - "updated_at": "2023-01-20T08:54:02.436Z", - "request_id": "v-0c55548694c418f9dd", - "progress": 100, - "processing_time": 854, - "object": "async_action" - } - }, - "PRODUCTS.METADATA_KEY_PURGE": { - "value": { - "id": "aa_0c5552d997ca0ec03a", - "type": "PRODUCTS.METADATA_KEY_PURGE", - "status": "DONE", - "result": { - "message": "Updated 2 products.", - "done_count": 2 - }, - "created_at": "2023-01-20T08:46:42.271Z", - "updated_at": "2023-01-20T08:46:43.240Z", - "request_id": "w-0c5552d98e8a0ec039", - "progress": 100, - "processing_time": 969, - "object": "async_action" - } - }, - "VOUCHERS.IMPORT": { - "value": { - "id": "aa_0c5559be44d7b63c06", - "type": "VOUCHERS.IMPORT", - "status": "DONE", - "result": { - "message": "0 voucher(s) imported successfully, 3 failed.", - "failed": [ - { - "code": "PROMO-CODE31", - "reason": "unit: must be a number, must be equal to one of 1,2 (actual value is 'EUR')" - }, - { - "code": "PROMO-CODE21", - "reason": "unit: must be a number, must be equal to one of 1,2 (actual value is 'EUR')" - }, - { - "code": "GIFT-CARD-100-1", - "reason": "unit: must be a number, must be equal to one of 1,2 (actual value is 'EUR')" - } - ], - "done_count": 0, - "failed_count": 3 - }, - "created_at": "2023-01-20T09:16:49.299Z", - "updated_at": "2023-01-20T09:16:50.238Z", - "request_id": "v-0c5559be25c418824a", - "progress": 100, - "processing_time": 939, - "object": "async_action" - } + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at", + "name", + "-name" + ] }, - "VOUCHERS.IMPORT_CSV": { - "value": { - "id": "aa_0c555db3d697b643e1", - "type": "VOUCHERS.IMPORT_CSV", - "status": "DONE", - "result": { - "message": "0 voucher(s) imported successfully, 2 failed.", - "failed": [ - { - "code": "FALL2023", - "row": 1, - "reason": "Voucher Type is required" - }, - { - "code": "FALL2024", - "row": 2, - "reason": "Voucher Type is required" + "in": "query", + "name": "order", + "description": "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." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary of validation rules.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/13_res_list_validation_rules" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "val_auLlxlfTR9Ps", + "name": "Customer in Segment", + "rules": { + "1": { + "name": "customer.segment", + "rules": {}, + "property": null, + "conditions": { + "$is": [ + "seg_18tD3HR0h8ymPC07rBMLryk3" + ] + } + }, + "logic": "1" + }, + "applicable_to": { + "excluded": [], + "included": [], + "included_all": false + }, + "created_at": "2021-12-10T11:08:16.499Z", + "updated_at": "2021-12-10T12:01:41.665Z", + "type": "advanced", + "context_type": "earning_rule.order.paid", + "assignments_count": 1, + "object": "validation_rules" + }, + { + "id": "val_AvIe1WWuBXre", + "name": "Order Volume - Price of Any Item - = 1500 USD", + "rules": { + "1": { + "name": "order.items.price_any", + "rules": {}, + "property": null, + "conditions": { + "$is": [ + 150000 + ] + } + }, + "logic": "1" + }, + "applicable_to": { + "excluded": [], + "included": [], + "included_all": false + }, + "created_at": "2021-12-13T06:54:06.864Z", + "type": "advanced", + "context_type": "reward_assignment.pay_with_points", + "object": "validation_rules" + }, + { + "id": "val_aZhPe4tQYMgr", + "name": "Business Validation Rule - excluded", + "rules": { + "logic": "" + }, + "applicable_to": { + "excluded": [ + { + "object": "products_collection", + "id": "pc_7fVU2RxybhR66YxC7r7BKKRh", + "source_id": null + }, + { + "object": "sku", + "id": "sku_0bae3b28f610fd0da1", + "source_id": "first_product_sku_1" + } + ], + "included": [], + "included_all": true + }, + "created_at": "2022-09-13T14:38:33.710Z", + "type": "basic", + "context_type": "campaign.discount_coupons.discount.apply_to_items_by_quantity", + "assignments_count": 1, + "object": "validation_rules" + }, + { + "id": "val_bbJCAXAWtYX0", + "name": "Business Validation Rule - Test - Discount Effect - Amount - Items - each unit of matched product", + "rules": { + "logic": "" + }, + "applicable_to": { + "excluded": [], + "included": [ + { + "object": "products_collection", + "id": "pc_a11pr0dUc75", + "source_id": null, + "effect": "APPLY_TO_EVERY", + "quantity_limit": 1 + } + ], + "included_all": false + }, + "created_at": "2022-09-02T17:04:23.814Z", + "type": "basic", + "context_type": "campaign.discount_coupons.discount.apply_to_items_by_quantity", + "assignments_count": 1, + "object": "validation_rules" + }, + { + "id": "val_BkV21MUJGaiT", + "name": "Order Volume - Total Amount More than 100", + "rules": { + "1": { + "name": "order.amount", + "rules": {}, + "property": null, + "conditions": { + "$more_than": [ + 10000 + ] + } + }, + "logic": "1" + }, + "applicable_to": { + "excluded": [], + "included": [], + "included_all": false + }, + "created_at": "2021-12-10T14:01:10.750Z", + "type": "advanced", + "context_type": "reward_assignment.pay_with_points", + "object": "validation_rules" + }, + { + "id": "val_BTQg027UGl0v", + "name": "Business Validation Rule - Get some $ off", + "rules": { + "logic": "" + }, + "applicable_to": { + "excluded": [], + "included": [ + { + "object": "product", + "id": "prod_0a41dd45dc85fcab40", + "source_id": "10474", + "strict": false + } + ], + "included_all": false + }, + "created_at": "2021-12-07T06:58:23.759Z", + "updated_at": "2021-12-22T08:11:18.773Z", + "type": "advanced", + "context_type": "campaign.discount_coupons.discount.apply_to_items", + "assignments_count": 1, + "object": "validation_rules" + } + ], + "total": 6 } - ], - "done_count": 0, - "failed_count": 2 - }, - "created_at": "2023-01-20T09:34:07.194Z", - "updated_at": "2023-01-20T09:34:07.367Z", - "request_id": "v-0c555db3ba8b0f0767", - "progress": 100, - "processing_time": 173, - "object": "async_action" + } + } } - }, - "VOUCHERS.BULK_UPDATE": { - "value": { - "id": "aa_0c555e8115d7b64504", - "type": "VOUCHERS.BULK_UPDATE", - "status": "DONE", - "result": { - "results": [ - { - "code": "PROMO-CODE81019", - "updated": false, - "found": false + } + } + } + }, + "post": { + "operationId": "create-validation-rules", + "tags": [ + "VALIDATION RULES API" + ], + "summary": "Create Validation Rules", + "description": "Create validation rules.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/13_req_create_validation_rule" + }, + "examples": { + "Example": { + "value": { + "name": "Set of Validation Rules", + "error": { + "message": "Your order does not meet at least one of the required criteria." }, - { - "code": "PROMO-CODE7264786", - "updated": false, - "found": false - } - ], - "done_count": 2 - }, - "created_at": "2023-01-20T09:37:37.367Z", - "updated_at": "2023-01-20T09:37:37.520Z", - "request_id": "v-0c555e810904188aa4", - "progress": 100, - "processing_time": 153, - "object": "async_action" - } - }, - "VOUCHERS.METADATA_UPDATE": { - "value": { - "id": "aa_0c555ed40857b6463a", - "type": "VOUCHERS.METADATA_UPDATE", - "status": "DONE", - "result": { - "results": [ - { - "code": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "updated": false, - "found": false + "applicable_to": { + "included_all": false, + "excluded": [ + { + "object": "product", + "id": "prod_0bae45ffc7003ffc52", + "source_id": "second_product", + "strict": false, + "effect": "APPLY_TO_EVERY" + } + ], + "included": [ + { + "object": "product", + "id": "prod_0b72b00ffed198e344", + "source_id": null, + "effect": "APPLY_TO_MOST_EXPENSIVE", + "quantity_limit": 1 + }, + { + "object": "products_collection", + "id": "pc_4ndRXAsTOzwSdHcQcxf489uU", + "source_id": null, + "effect": "APPLY_TO_EVERY", + "quantity_limit": 5 + } + ] }, - { - "code": "LOYALTY-CARD-xLPbpbXR", - "updated": false, - "found": false + "rules": { + "1": { + "name": "order.metadata", + "property": "location", + "rules": {}, + "conditions": { + "$is": [ + "Santorini" + ] + }, + "error": { + "message": "Your order must be placed at one of our Santorini shops." + } + }, + "2": { + "name": "custom_event.metadata", + "property": "test", + "rules": {}, + "conditions": { + "$greater_than_or_equal": [ + 1 + ] + } + }, + "3": { + "name": "order.items.every", + "rules": { + "1": { + "name": "order.items.metadata", + "property": "test", + "rules": {}, + "conditions": { + "$greater_than_or_equal": [ + 1 + ] + } + } + }, + "conditions": { + "$is": [ + { + "id": "", + "effect": "APPLY_TO_EVERY", + "object": "product", + "source_id": "" + } + ] + } + }, + "logic": "1 or 2" } - ], - "done_count": 2 - }, - "created_at": "2023-01-20T09:39:02.305Z", - "updated_at": "2023-01-20T09:39:02.640Z", - "request_id": "v-0c555ed40084188b55", - "progress": 100, - "processing_time": 335, - "object": "async_action" - } - }, - "VOUCHERS.METADATA_KEY_PURGE": { - "value": { - "id": "aa_0c55534bd64a0ec0e0", - "type": "VOUCHERS.METADATA_KEY_PURGE", - "status": "DONE", - "result": { - "message": "Updated 9 vouchers.", - "done_count": 9 - }, - "created_at": "2023-01-20T08:48:39.257Z", - "updated_at": "2023-01-20T08:48:40.503Z", - "request_id": "w-0c55534bcfca0ec0df", - "progress": 100, - "processing_time": 1246, - "object": "async_action" - } - }, - "SKUS.IMPORT_CSV": { - "value": { - "id": "aa_0c5558728d0e577e67", - "type": "SKUS.IMPORT_CSV", - "status": "DONE", - "result": { - "message": "4 sku(s) imported successfully, 0 failed.", - "failed": [], - "done_count": 4, - "failed_count": 0 - }, - "created_at": "2023-01-20T09:11:09.620Z", - "updated_at": "2023-01-20T09:11:10.270Z", - "request_id": "v-0c5558726f0b0f7d82", - "progress": 100, - "processing_time": 650, - "object": "async_action" + } + } } - }, - "PRODUCTS.IMPORT_CSV": { - "value": { - "id": "aa_0c55578e914e577cf1", - "type": "PRODUCTS.IMPORT_CSV", - "status": "DONE", - "result": { - "message": "1 product(s) imported successfully, 1 failed.", - "failed": [ - { - "row": 1, - "reason": "vendor: must be a string, property is required, must be equal to one of Vendor 1,Vendor 2 (actual value is 'Vendor 3')" + } + }, + "description": "Specify the validation rules parameters." + }, + "responses": { + "200": { + "description": "Returns a validation rule object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/13_obj_validation_rule_object" + }, + "examples": { + "Example": { + "value": { + "id": "val_eR1c41hu0vUU", + "name": "Business Validation Rule", + "rules": { + "1": { + "name": "string", + "property": "string", + "conditions": { + "$one_of_voucherify_conditions": [ + "string" + ] + }, + "rules": { + "1": { + "name": "string", + "property": "string", + "conditions": {}, + "rules": {} + }, + "logic": "string" + }, + "error": { + "message": "string" + } + }, + "logic": "(1 and 2) and (3)" + }, + "error": { + "message": "string" + }, + "applicable_to": { + "excluded": [ + { + "object": "product", + "id": "string", + "source_id": "string", + "strict": true, + "effect": "APPLY_TO_EVERY" + } + ], + "included": [ + { + "object": "product", + "id": "string", + "source_id": "string", + "strict": true, + "effect": "APPLY_TO_EVERY", + "quantity_limit": 0 + } + ], + "included_all": true + }, + "created_at": "2022-03-23T07:44:00.444Z", + "updated_at": "2022-04-26T08:35:54.960Z", + "type": "basic", + "context_type": "earning_rule.order.paid", + "object": "validation_rules" } - ], - "done_count": 1, - "failed_count": 1 - }, - "created_at": "2023-01-20T09:07:16.165Z", - "updated_at": "2023-01-20T09:07:17.025Z", - "request_id": "v-0c55578e7a0418fef5", - "progress": 100, - "processing_time": 860, - "object": "async_action" - } - }, - "ORDERS.METADATA_KEY_PURGE": { - "value": { - "id": "aa_0c555fda50472c83a8", - "type": "ORDERS.METADATA_KEY_PURGE", - "status": "DONE", - "result": { - "message": "Updated 1 orders.", - "done_count": 1 - }, - "created_at": "2023-01-20T09:43:30.881Z", - "updated_at": "2023-01-20T09:43:31.217Z", - "request_id": "w-0c555fda45c72c83a7", - "progress": 100, - "processing_time": 336, - "object": "async_action" + } + } } - }, - "ORDERS.IMPORT": { - "value": { - "id": "aa_0c5564b67d0e571534", - "type": "ORDERS.IMPORT", - "status": "DONE", - "result": { - "message": "1 order(s) imported successfully, 1 failed.", - "failed": [ - { - "source_id": null, - "reason": "Internal error" + } + }, + "400": { + "description": "Returns an error if the request parameters were not specified correctly.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_400_invalid_validation_rules" + }, + "examples": { + "Invalid Validation Rules": { + "value": { + "code": 400, + "key": "invalid_validation_rules", + "message": "Invalid Validation Rule Definition", + "details": "Rule 'custom_event.metadata' must have a 'property'" } - ], - "done_count": 1, - "failed_count": 1 - }, - "created_at": "2023-01-20T10:04:44.916Z", - "updated_at": "2023-01-20T10:04:46.102Z", - "request_id": "v-0c5564b6688b0f155d", - "progress": 100, - "processing_time": 1186, - "object": "async_action" + } + } } } } } } }, - "404": { - "description": "Returns an error indicating that the async action with given ID was not found.", - "content": { - "application/json": { + "/v1/validation-rules/{validationRuleId}": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_404_not_found" + "type": "string", + "example": "val_TU4de3EP4dlL" }, - "examples": { - "Async-Action-Not-Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find async_action with id aa_0aeb82bd55d5beffb", - "request_id": "v-0aeb88df54c82af560", - "resource_id": "aa_0aeb82bd55d5beffb", - "resource_type": "async_action" + "name": "validationRuleId", + "in": "path", + "required": true, + "description": "A unique validation rule ID." + } + ], + "get": { + "operationId": "get-validation-rule", + "tags": [ + "VALIDATION RULES API" + ], + "summary": "Get Validation Rule", + "description": "Retrieve the details of a validation rule.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns the validation rule object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/13_obj_validation_rule_object" + }, + "examples": { + "Example": { + "value": { + "id": "val_TU4de3EP4dlL", + "name": "Order is less than $40", + "rules": { + "1": { + "name": "order.amount", + "property": null, + "conditions": { + "$less_than": [ + 4000 + ] + }, + "rules": {} + }, + "logic": "1" + }, + "applicable_to": { + "excluded": [], + "included": [], + "included_all": false + }, + "created_at": "2022-08-11T16:42:13.630Z", + "type": "advanced", + "context_type": "reward_assignment.pay_with_points", + "object": "validation_rules" + } + } + } } } } } - } - } - } - } - }, - "/v1/export-object": { - "get": { - "operationId": "export-object", - "tags": [ - "EXPORTS API" - ], - "summary": "Export Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Export Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/16_obj_export_object" + }, + "put": { + "operationId": "update-validation-rule", + "tags": [ + "VALIDATION RULES API" + ], + "summary": "Update Validation Rule", + "description": "Update validation rule parameters.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the parameters to be updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/13_req_create_validation_rule" + }, + "examples": { + "Example": { + "value": { + "name": "Set of Validation Rules Updated", + "error": { + "message": "Your orders do not meet at least one of the required criteria." + }, + "applicable_to": { + "included_all": false, + "excluded": [ + { + "object": "product", + "id": "prod_0bae45ffc7003ffccc", + "source_id": "second_product", + "strict": false, + "effect": "APPLY_TO_EVERY" + } + ], + "included": [ + { + "object": "product", + "id": "prod_0b72b00ffed198e333", + "source_id": null, + "effect": "APPLY_TO_CHEAPEST", + "quantity_limit": 1 + }, + { + "object": "products_collection", + "id": "pc_4ndRXAsTOzwSdHcQcxf489uU", + "source_id": null, + "effect": "APPLY_TO_EVERY", + "quantity_limit": 5 + } + ] + }, + "rules": { + "1": { + "name": "order.metadata", + "property": "place", + "rules": {}, + "conditions": { + "$is": [ + "Santorini" + ] + }, + "error": { + "message": "Your order must be placed at one of our Santorini shops on the beach." + } + }, + "2": { + "name": "custom_event.metadata", + "property": "lining", + "rules": {}, + "conditions": { + "$greater_than_or_equal": [ + 1 + ] + } + }, + "3": { + "name": "order.items.every", + "rules": { + "1": { + "name": "order.items.metadata", + "property": "test", + "rules": {}, + "conditions": { + "$greater_than_or_equal": [ + 1 + ] + } + } + }, + "conditions": { + "$is": [ + { + "id": "", + "effect": "APPLY_TO_EVERY", + "object": "product", + "source_id": "" + } + ] + } + }, + "logic": "1 and 2" + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns the validation rule object with the updated parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/13_obj_validation_rule_object" + }, + "examples": { + "Example": { + "value": { + "id": "val_VZ91fqqtoVmw", + "name": "Set of Validation Rules Updated", + "rules": { + "1": { + "name": "order.metadata", + "property": "place", + "conditions": { + "$is": [ + "Santorini" + ] + }, + "rules": {}, + "error": { + "message": "Your order must be placed at one of our Santorini shops on the beach." + } + }, + "2": { + "name": "custom_event.metadata", + "property": "lining", + "conditions": { + "$greater_than_or_equal": [ + 1 + ] + }, + "rules": {} + }, + "3": { + "name": "order.items.every", + "conditions": { + "$is": [ + { + "id": "", + "effect": "APPLY_TO_EVERY", + "object": "product", + "source_id": "" + } + ] + }, + "rules": { + "1": { + "name": "order.items.metadata", + "property": "test", + "conditions": { + "$greater_than_or_equal": [ + 1 + ] + }, + "rules": {} + } + } + }, + "logic": "1 and 2" + }, + "error": { + "message": "Your orders do not meet at least one of the required criteria." + }, + "applicable_to": { + "excluded": [ + { + "object": "product", + "id": "prod_0bae45ffc7003ffccc", + "source_id": "second_product", + "strict": false, + "effect": "APPLY_TO_EVERY" + } + ], + "included": [ + { + "object": "product", + "id": "prod_0b72b00ffed198e333", + "source_id": null, + "strict": false, + "effect": "APPLY_TO_CHEAPEST", + "quantity_limit": 1 + }, + { + "object": "products_collection", + "id": "pc_4ndRXAsTOzwSdHcQcxf489uU", + "source_id": null, + "strict": false, + "effect": "APPLY_TO_EVERY", + "quantity_limit": 5 + } + ], + "included_all": false + }, + "created_at": "2022-09-14T05:54:51.099Z", + "updated_at": "2022-09-14T06:06:32.855Z", + "type": "complex", + "context_type": "global", + "object": "validation_rules" + } + } + } + } + } } } - } - } - } - } - }, - "/v1/exports": { - "post": { - "operationId": "create-export", - "tags": [ - "EXPORTS API" - ], - "summary": "Create Export", - "description": "Create export object. The export can be any of the following types: `voucher`, `redemption`, `publication`, `customer`, `order`, `points_expiration`, or `voucher_transactions`. \n\n## Defaults\n\nIf you only specify the object type in the request body without specifying the fields, the API will return the following fields per export object:\n\n| **Export Object** | **Default fields returned** |\n|:---|:---|\n| order | `id`, `source_id`, `status` |\n| voucher | `code`, `voucher_type`, `value`, `discount_type` |\n| publication | `code`, `customer_id`, `date`, `channel` |\n| redemption | `id`, `object`, `voucher_code`, `customer_id`, `date`, `result` |\n| customer | `name`, `source_id` |\n| points_expiration | `id`, `campaign_id`, `voucher_id`, `status`, `expires_at`, `points` |\n| voucher_transactions | `id`, `type`, `source_id`, `status`, `reason`, `source`, `balance`, `amount`, `created_at` |\n\n\n## Fetching particular data sets\n\nUsing the `parameters` body parameter, you can narrow down which fields to export and how to filter the results. The fields are an array of strings containing the data that you would like to export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:\n\n## Orders \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique order ID. | ord_A69RIxEdRsPuC6i8gFGVHUft |\n| source_id | Unique order source ID. | 8638 |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the order was created. | 2022-03-09T09:16:32.521Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the order was last updated. | 2022-03-09T09:16:33.331Z |\n| status | Order status. | `PAID`, `CREATED`, `FULFILLED`, `CANCELED` |\n| amount | Total amount of order items. | 7700 |\n| discount_amount | Represents total amount of the discount applied to whole cart. | 500 |\n| items_discount_amount | Represents total amount of the discount applied to order line items. | 100 |\n| total_discount_amount | All discounts applied to the order including discounts applied to particular order line items and discounts applied to the whole cart. | 600 |\n| total_amount | Total order amount after applying all discounts. | 7100 |\n| customer_id | Customer unique ID. | cust_2G4fUQdCXUqp35nXNleav7bO |\n| referrer_id | Referrer unique ID. | cust_IkrTR674vvQvr9a4rDMiqglY |\n| metadata | Order metadata; expressed as metadata.X, where X is the name of the custom metadata property. | 1 |\n\n## Vouchers \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique voucher ID. | v_HSnGD2vNIHYighTQxwcB4dtVAv8VOmZD |\n| code | Unique voucher code. | WELCOME100 |\n| voucher_type | Type of voucher. | `DISCOUNT_VOUCHER`, `GIFT_VOUCHER`, `LOYALTY_CARD` |\n| value | Value of voucher. | `DISCOUNT_VOUCHER` : amount, percent, unit
          `GIFT_VOUCHER`: amount left to spend
          `LOYALTY_CARD`: available usable points |\n| discount_type | The type of discount for a `DISCOUNT_VOUCHER`. | `AMOUNT`, `PERCENT`, `UNIT`, `FIXED` |\n| campaign | Unique campaign name. | Summer Discounts 20% off |\n| category | Tag defining the category that this voucher belongs to. | |\n| start_date | Start date defines when the code starts to be active. Activation timestamp in ISO 8601 format. Voucher is _inactive_ before this date. | 2020-12-10T23:00:00.000Z |\n| expiration_date | Expiration date defines when the code expires. Expiration timestamp in ISO 8601 format. Voucher is _inactive_ after this date. | 2023-12-31T23:00:00.000Z |\n| gift_balance | Amount left to spend. | 1000 |\n| loyalty_balance | Available usable points. | 2000 |\n| redemption_quantity | Maximum number of times a voucher can be redeemed. | 2 |\n| redemption_count | Total redemptions. | 59 |\n| active | Boolean indicating whether the voucher is available for use. | `true`, `false` |\n| qr_code | URL to QR representation of encrypted code. | |\n| bar_code | URL to barcode representation of encrypted code. | |\n| metadata | Custom voucher metadata. | |\n| is_referral_code | Boolean indicating whether the voucher is a referral code. | `true`, `false` |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the voucher was created. | 2022-04-14T09:55:46.814Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the voucher was last updated. | 2022-04-14T10:02:18.036Z |\n| validity_timeframe_interval | Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an interval of `P2D` will be active every other day. | P2D |\n| validity_timeframe_duration | Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a duration of `PT1H` will be valid for a duration of one hour. | PT1H |\n| validity_day_of_week | Array corresponding to the particular days of the week in which the voucher is valid. | \"1,2,3,4,5\" |\n| discount_amount_limit | For `PERCENT` discount type, this is the maximum threshold allowed to be deducted. | 50 |\n| campaign_id | Parent campaign ID. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| additional_info | An optional field to keep any extra textual information about the code such as a code description and details. | |\n| customer_id | Unique customer ID of the assigned owner to whom the voucher was published. | cust_7iUa6ICKyU6gH40dBU25kQU1 |\n| discount_unit_type | For `UNIT` discount type, either a shipping or product ID for a `UNIT` discount with one product. | prod_5h1pp1ng, prod_0a9f9aeddb019a42db |\n| discount_unit_effect | `UNIT` discount effect. | `ADD_MANY_ITEMS`, `ADD_MISSING_ITEMS`,`ADD_NEW_ITEMS` |\n| customer_source_id | Unique customer source id of the assigned owner to whom the voucher was published. | name.lastname@email.com |\n\n\n## Publications\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| voucher_code | Unique voucher code. | WELCOME100 |\n| customer_id | Customer unique ID. | cust_7iUa6ICKyU6gH40dBU25kQU1 |\n| customer_source_id | Unique customer source id of the assigned owner to whom the voucher was published. | name.lastname@email.com |\n| date | Timestamp in ISO 8601 format representing the date and time when the voucher was published. | 2022-04-28T10:19:30.792Z |\n| channel | Publication channel. | voucherify-website |\n| campaign | Unique campaign name. | Summer Discounts 20% off |\n| is_winner | | |\n| metadata | Custom publication metadata. | |\n\n## Redemptions\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique redemption ID. | r_0acf3a6dae00e679c8, rf_0acf3a495740e679b8 |\n| object | Object being exported; by default `redemption`. | redemption |\n| date | Timestamp in ISO 8601 format representing the date and time when the voucher was redeemed. | 2022-03-23T08:52:24.867Z |\n| voucher_code | Unique voucher code redeemed. | WELCOME100 |\n| campaign | Parent campaign name of voucher if applicable. | Summer Discounts 20% off |\n| promotion_tier_id | | promo_Mwy9XpA0TLctSGriM5kum0qp |\n| customer_id | Unique customer ID of redeeming customer. | cust_nk0N1uNQ1YnupAoJGOgvsODC |\n| customer_source_id | Unique source ID of redeeming customer. | name.lastname@email.com |\n| customer_name | Customer name. | John Smith |\n| tracking_id | | track_Pw6r3ejnml43kIwNS4Zj09KZ67xOfLUy |\n| order_amount | Total order amount before applying all discounts. | 1000 |\n| gift_amount | Gift credits used for redemption. | 10 |\n| loyalty_points | | 12 |\n| result | Tells you whether the redemption succeeded. | `SUCCESS`, `FAILURE` |\n| failure_code | Internal Voucherify code for reason why redemption failed. | invalid_customer |\n| failure_message | A human-readable message providing a short description explaining why the redemption failed. | Customer must be a holder of a loyalty card. |\n| metadata | Custom redemption metadata. | |\n\n## Customers\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| name | Customer name. | John Smith |\n| id | Unique customer ID. | cust_J1CDUdbqn5Exva8ASWk1Fq0j |\n| description | An arbitrary string that you can attach to a customer object. | Customer requesting to be added to VIP tier. |\n| email | Customer's email. | name.lastname@email.com |\n| source_id | Unique custom customer identifier. | name.lastname@email.com |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the customer was created. | 2022-02-03T13:10:11.928Z |\n| address_city | City | Houston |\n| address_state | State | TX |\n| address_line_1 | First line of customer's address. | 72738 Main St |\n| address_line_2 | Second line of customer's address. | Bld 2, Apt 4 |\n| address_country | Country | United States of America |\n| address_postal_code | Postal code (ZIP code) | 77042-4143 |\n| redemptions_total_redeemed | Total customer redemptions. | 5 |\n| redemptions_total_failed | Total customer failed redemptions. | 2 |\n| redemptions_total_succeeded | Total customer succeeded redemptions. | 3 |\n| redemptions_total_rolled_back | Total customer redemptions that were rolled back. | 3 |\n| redemptions_total_rollback_failed | Total customer redemptions that were unsuccessfully rolled back. | 2 |\n| redemptions_total_rollback_succeeded | Total customer redemptions that were successfully rolled back. | 1 |\n| orders_total_amount | Total sum of order amounts over customer lifetime. Value is multiplied by 100 to precisely represent 2 decimal places. | 10000 (represents $100) |\n| orders_total_count | Total number of customer orders. | 2 |\n| orders_average_amount | Average amount spent on orders. Value is multiplied by 100 to precisely represent 2 decimal places. | 5000 (represents $50) |\n| orders_last_order_amount | How much did the customer spend on their last order. Value is multiplied by 100 to precisely represent 2 decimal places. | 5000 (represents $50) |\n| orders_last_order_date | When was the last customer order; timestamp in ISO 8601 format representing the date and time. | 2022-02-03T13:17:30.630Z |\n| loyalty_points | Sum of customer's loyalty points to go across all loyalty cards. | 2000 |\n| loyalty_referred_customers | How many customers were referred by this customer. | 3 |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the customer was updated. | 2022-02-14T14:10:14.305Z |\n| phone | Customer's phone number. | +1 (294) 752-1846 |\n| birthday | Customer's birthday. | 2022-01-01 |\n| metadata | Customer metadata. | All metadata fields defined in Metadata Schema for the Customer object. |\n| birthdate | Customer's birthdate. | 2022-01-01 |\n\n## Points Expirations\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n |\n| campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 |\n| status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` |\n| expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 |\n| points | Number of points. | 1000 |\n\n ## Gift Card Transactions\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
          - `CREDITS_ADDITION`
          - `CREDITS_REFUND`
          - `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n\n ## Loyalty Card Transactions\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID assigned by Voucherify. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `POINTS_EXPIRATION`
          - `POINTS_ADDITION`
          - `POINTS_REMOVAL`
          - `POINTS_TRANSFER_OUT`
          - `POINTS_ACCRUAL`
          - `POINTS_REFUND`
          - `POINTS_REDEMPTION` |\n| source_id | Custom source ID of the transaction if one was included originally. | source_id_custom |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The loyalty card balance after the transaction. | |\n| amount | The amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | - `API`
          - `voucherify-web-ui`
          - `Automation` |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n| related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the details of the export that you would like to create.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/16_req_create_export_POST" - } - } - } - }, - "responses": { - "200": { - "description": "Returns export object and URL of CSV file.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/16_obj_export_object" + }, + "delete": { + "operationId": "delete-validation-rules", + "tags": [ + "VALIDATION RULES API" + ], + "summary": "Delete Validation Rule", + "description": "This method deletes a validation rule.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." + }, + "404": { + "description": "Returns an error indicating that the validation rule with the given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Validation Rule Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find validation_rules with id val_TGN3rqZ8vEm", + "request_id": "v-0ae3b3436346b778be", + "resource_id": "val_TGN3rqZ8vEm", + "resource_type": "validation_rules" + } + } + } + } + } } } } }, - "400": { - "description": "Returns an error if an invalid payload is provided.", - "content": { - "application/json": { - "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/e_400_invalid_payload" - }, - { - "$ref": "#/components/schemas/e_400_invalid_export_fields" - } - ] + "/v1/validation-rules-assignments": { + "get": { + "operationId": "list-validation-rules-assignments", + "tags": [ + "VALIDATION RULES API" + ], + "summary": "List Validation Rules' Assignment(s)", + "description": "List all validation rules' assignments or filter the results using the related object ID or the validation rule ID query parameters. \n\n## How to retrieve specific validaiton rule assignments(s)\n\n### Related object ID\n\nTo find an assignment for a particular resource, you can use the ID of the object to which the validation rule was assigned. This could be, for example, an ID of a: voucher, campaign, distribution, reward assignment, earning rule, promotion tier. \n\n\n\n```curl\ncurl -X GET \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\" \\\n -H \"Content-Type: application/json\" \\\n https://api.voucherify.io/v1/validation-rules-assignments?related_object_id=promo_kJliy076IuJYtuYWSHE9fSuT\n```\n\n```json\n{\n \"object\": \"list\",\n \"data_ref\": \"data\",\n \"data\": [\n {\n \"id\": \"asgm_tZaqxeO8gP4q91jG\",\n \"rule_id\": \"val_WB6ETAiFztw5\",\n \"related_object_id\": \"promo_kJliy076IuJYtuYWSHE9fSuT\",\n \"related_object_type\": \"promotion_tier\",\n \"created_at\": \"2022-08-10T10:30:39.986Z\",\n \"object\": \"validation_rules_assignment\"\n }\n ],\n \"total\": 1\n}\n```\n\n### Validation rule ID\n\nYou can use the validation rule ID to find assignment(s) for a specific validation rule.\n\n\n\n```curl\ncurl -X GET \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\" \\\n -H \"Content-Type: application/json\" \\\n https://api.voucherify.io/v1/validation-rules-assignments?rule=val_ZEZmA9oit8aU\n```\n\n```json\n{\n \"object\": \"list\",\n \"data_ref\": \"data\",\n \"data\": [\n {\n \"id\": \"asgm_vef0G6d9Al0rABxq\",\n \"rule_id\": \"val_ZEZmA9oit8aU\",\n \"related_object_id\": \"camp_rRsfatlwN7unSeUIJDCYedal\",\n \"related_object_type\": \"campaign\",\n \"created_at\": \"2022-06-29T11:43:52.953Z\",\n \"object\": \"validation_rules_assignment\"\n },\n {\n \"id\": \"asgm_sFV4wEFvldwIvgfb\",\n \"rule_id\": \"val_ZEZmA9oit8aU\",\n \"related_object_id\": \"distr_9QKI02wqgjWyvZXeQkFEPmkkYe\",\n \"related_object_type\": \"distribution\",\n \"created_at\": \"2022-06-29T11:41:07.680Z\",\n \"object\": \"validation_rules_assignment\"\n },\n {\n \"id\": \"asgm_69Qifyv6UZynFIIQ\",\n \"rule_id\": \"val_ZEZmA9oit8aU\",\n \"related_object_id\": \"promo_g83qUzYZpfX0OMAFOVoQuOYG\",\n \"related_object_type\": \"promotion_tier\",\n \"created_at\": \"2022-06-29T11:29:41.906Z\",\n \"object\": \"validation_rules_assignment\"\n }\n ],\n \"total\": 3\n}\n```\n", + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "related_object_id", + "description": "The resource ID to which the validation rule was assigned; this could be, for example, a resource ID of a voucher, campaign, earning rule, reward assignment, promotion tier, or distribution." }, - "examples": { - "Invalid Export Fields": { - "value": { - "code": 400, - "key": "invalid_export_fields", - "message": "Invalid Export", - "details": "Unsupported field used. Allowed fields: id, object, date, voucher_code, campaign, promotion_tier_id, customer_id, customer_source_id, customer_name, tracking_id, order_amount, gift_amount, loyalty_points, result, failure_code, failure_message, metadata", - "request_id": "v-0afdb603910a1a14e0" - } + { + "schema": { + "type": "string", + "example": "val_30Qo2rclFi4T" + }, + "in": "query", + "name": "rule", + "description": "Validation rule ID." + }, + { + "$ref": "#/components/parameters/page" + }, + { + "$ref": "#/components/parameters/limit" + }, + { + "schema": { + "type": "string" }, - "Invalid Payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Property .exported_object should be equal to one of the allowed values [ voucher, redemption, customer, publication, order, points_expiration ]", - "request_id": "v-0afdb5bd68d20bdb81" + "in": "query", + "description": "Sorts the results using one of the filtering options: `-created_at`, `created_at`, where the dash `-` preceding a sorting option means sorting in a descending order.", + "name": "order" + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with a data property that contains an array of validation rule assignments. Each entry in the array is a separate object. If no more validation rule assignments are available, the resulting array will be empty. The result can be narrowed down according to default filters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/13_res_validation-rules_validationRuleId_assignments" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_2S7Xm4dab4UvYAgm", + "rule_id": "val_5ix74ru7e", + "related_object_id": "camp_YDsFdX8TgFtT0RUuKEFyhqs3", + "related_object_type": "campaign", + "created_at": "2022-02-08T10:49:30.534Z", + "object": "validation_rules_assignment" + }, + { + "id": "asgm_sFV4wEFvldwIvgfb", + "rule_id": "val_ZEZmA9oit8aU", + "related_object_id": "distr_9QKI02wqgjWyvZXeQkFEPmkkYe", + "related_object_type": "distribution", + "created_at": "2022-06-29T11:41:07.680Z", + "object": "validation_rules_assignment" + }, + { + "id": "asgm_8xelF5R4zB8ue168", + "rule_id": "val_ggDODO6fakMs", + "related_object_id": "ern_xrRuGEV7EW0X8wtMaze3HOfw", + "related_object_type": "earning_rule", + "created_at": "2022-02-28T12:25:56.783Z", + "object": "validation_rules_assignment" + }, + { + "id": "asgm_tZaqxeO8gP4q91jG", + "rule_id": "val_WB6ETAiFztw5", + "related_object_id": "promo_kJliy076IuJYtuYWSHE9fSuT", + "related_object_type": "promotion_tier", + "created_at": "2022-08-10T10:30:39.986Z", + "object": "validation_rules_assignment" + }, + { + "id": "asgm_xTMHiyPGSz3rp5m2", + "rule_id": "val_2AxnWmW2ra6X", + "related_object_id": "rewa_m9hEAu10KsPcLhGXiHG85aY0", + "related_object_type": "reward_assignment", + "created_at": "2021-12-10T11:38:35.922Z", + "object": "validation_rules_assignment" + }, + { + "id": "asgm_DhlDn54JwqVFJzR6", + "rule_id": "val_eR1c41hu0vUU", + "related_object_id": "v_XuF7icVlUcVpHsSY9nG7n7yJa5wx27Va", + "related_object_type": "voucher", + "created_at": "2022-03-23T07:50:31.068Z", + "object": "validation_rules_assignment" + } + ], + "total": 6 + } + }, + "No Assignments": { + "value": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + } + } + } } } } } } - } - } - }, - "get": { - "operationId": "list-exports", - "tags": [ - "EXPORTS API" - ], - "summary": "List Exports", - "description": "List all exports. ", - "parameters": [ - { - "$ref": "#/components/parameters/limit" }, - { - "$ref": "#/components/parameters/page" - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "status", - "-status" - ] - }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "A dictionary with an exports property that contains an array of exports. Each entry in the array is a separate export object. The list will return the following types of exported objects: `voucher`, `redemption`, `publication`, `customer`, `order`, `points_expiration`, or `voucher_transactions`. \n\nThe `channel` parameter in the response body returns the channel that was used to generate the particular export. The `user_id` identifies the specific user who initiated the export through the Voucherify Dashboard; this `user_id` is returned when the channel value is `WEBSITE`.", - "content": { - "application/json": { + "/v1/validation-rules/{validationRuleId}/assignments": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/16_res_list_exports" - }, - "examples": { - "List Exports": { - "value": { - "object": "list", - "data_ref": "exports", - "exports": [ - { - "id": "exp_323UOPsH42twhJVaDZXf4UNo", - "object": "export", - "created_at": "2022-08-04T09:11:25.208Z", - "status": "DONE", - "channel": "API", - "exported_object": "order", - "parameters": { - "order": "-created_at", - "fields": [ - "id", - "source_id", - "status" - ], - "filters": { - "junction": "and" - } - }, - "result": { - "url": "https://download.voucherify.io/v1/exports/exp_323UOPsH42twhJVaDZXf4UNo?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnQiOiJzYW11ZWwuamFuaWtAdm91Y2hlcmlmeS5pbyIsImV4cG9ydElkIjoiZXhwXzMyM1VPUHNINDJ0d2hKVmFEWlhmNFVObyIsImlhdCI6MTY1OTYwNDI4NiwiZXhwIjoxNjU5NjA1MTg2fQ.IgFnKagyoQ7_O2tGswZxpegUMtllSbzMfPMX-_89W7o" - }, - "user_id": null - }, - { - "id": "exp_sPQR0na2gU0pIVUKIz4wdQI9", - "object": "export", - "created_at": "2022-05-02T06:44:03.186Z", - "status": "DONE", - "channel": "API", - "exported_object": "voucher", - "parameters": { - "order": "-created_at", - "fields": [ - "id", - "code", - "voucher_type", - "value" + "type": "string" + }, + "name": "validationRuleId", + "in": "path", + "required": true, + "description": "Unique validation rule ID." + } + ], + "get": { + "operationId": "list-validation-rule-assignments", + "tags": [ + "VALIDATION RULES API" + ], + "summary": "List Validation Rule Assignments", + "description": "Retrieve validation rule assignments for a specific validation rule.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at" + ] + }, + "in": "query", + "name": "order", + "description": "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." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary of validation rule assignments. If the validation rule ID provided in the path parameter cannot be found, the endpoint will return an empty `data` array and a total of `0`.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/13_res_validation-rules_validationRuleId_assignments" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_74F7QZoYbUoljwQO", + "rule_id": "val_4j7DCRm2IS59", + "related_object_id": "v_MBOEmHelKwvykVZ8JcT4TE5Kla5IMJyc", + "related_object_type": "voucher", + "created_at": "2022-02-17T09:05:34.642Z", + "object": "validation_rules_assignment" + }, + { + "id": "asgm_zzLBm8mIzGQStXl9", + "rule_id": "val_4j7DCRm2IS59", + "related_object_id": "v_JtWunK6jUo7X2qOFj0SyRHq4p9tgENlT", + "related_object_type": "voucher", + "created_at": "2022-02-17T08:18:15.085Z", + "object": "validation_rules_assignment" + }, + { + "id": "asgm_JztMAws0e0Qx2Xy6", + "rule_id": "val_4j7DCRm2IS59", + "related_object_id": "camp_kjja4moiVB7hQKPGOT61026Z", + "related_object_type": "campaign", + "created_at": "2022-02-15T13:26:34.807Z", + "object": "validation_rules_assignment" + } ], - "filters": { - "junction": "and" - } - }, - "result": { - "url": "https://download.voucherify.io/v1/exports/exp_sPQR0na2gU0pIVUKIz4wdQI9?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnQiOiJzYW11ZWwuamFuaWtAdm91Y2hlcmlmeS5pbyIsImV4cG9ydElkIjoiZXhwX3NQUVIwbmEyZ1UwcElWVUtJejR3ZFFJOSIsImlhdCI6MTY1MTQ3Mzg0NCwiZXhwIjoxNjUxNDc0NzQ0fQ.yNIQHcHMO-HSKYejtgNjRVh3cRa_JqnmhBXdnAX2vHQ" - }, - "user_id": null + "total": 3 + } }, - { - "id": "exp_CGnCVltmWjI9V1pGlnunw2Nf", - "object": "export", - "created_at": "2022-01-13T09:03:18.293Z", - "status": "DONE", - "channel": "API", - "exported_object": "customer", - "parameters": { - "order": "", - "fields": [ - "name", - "id", - "email", - "source_id", - "created_at" - ], - "filters": { - "junction": "and" - }, - "response_format": "CSV" - }, - "result": { - "url": "https://download.voucherify.io/v1/exports/exp_CGnCVltmWjI9V1pGlnunw2Nf?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ" - }, - "user_id": null + "No Assignments": { + "value": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + } } - ], - "total": 3 + } } } } } - } - } - } - } - }, - "/v1/exports/{exportId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "exp_2bYLdY2lQ2886wmYIHyeBWUZ" - }, - "name": "exportId", - "in": "path", - "required": true, - "description": "Unique export object ID of previously created export. This object can be a: `voucher`, `redemption`, `publication`, `customer`, `order`, `points_expiration`, or `voucher_transactions`." - } - ], - "get": { - "operationId": "get-export", - "tags": [ - "EXPORTS API" - ], - "summary": "Get Export", - "description": "Retrieves the URL of the downloadable file, which was generated via the [Create Export](ref:create-export) method.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns the export object if a valid identifier was provided in the path.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/16_obj_export_object" - }, - "examples": { - "Get Export": { - "value": { - "id": "exp_CGnCVltmWjI9V1pGlnunw2Nf", - "object": "export", - "created_at": "2022-01-13T09:03:18.293Z", - "status": "DONE", - "channel": "API", - "exported_object": "customer", - "parameters": { - "order": "", - "fields": [ - "name", - "id", - "email", - "source_id", - "created_at" - ], - "filters": { - "junction": "and" - }, - "response_format": "CSV" + }, + "post": { + "operationId": "create-validation-rule-assignment", + "tags": [ + "VALIDATION RULES API" + ], + "summary": "Create Validation Rules Assignments", + "description": "Assign validation rule to either one of the following objects: voucher, campaign, promotion tier, earning rule, reward, distribution.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the resource that you would like to assign the validation rule to.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/13_req_create_validation_rule_assignments" + }, + "examples": { + "Voucher": { + "value": { + "voucher": "v_ssR6vhswwh5odSloN2Vc3O60w7aea018" + } }, - "result": { - "url": "https://download.voucherify.io/v1/exports/exp_CGnCVltmWjI9V1pGlnunw2Nf?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ" + "Campaign": { + "value": { + "campaign": "camp_Rv9EuIrkT08YEORb2pUMGSUo" + } + }, + "Distribution": { + "value": { + "distribution": "distr_2nUIekYnS9L1Vm1I55vmC7kSvd" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a validation rules assignment object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/13_obj_validation_rule_assignment_object" }, - "user_id": null + "examples": { + "Example": { + "value": { + "id": "asgm_kPPiNW3smQLRMWiF", + "rule_id": "val_ZEZmA9oit8aU", + "related_object_id": "camp_Rv9EuIrkT08YEORb2pUMGSUo", + "related_object_type": "campaign", + "created_at": "2022-09-14T07:06:49.557Z", + "object": "validation_rules_assignment" + } + } + } + } + } + }, + "409": { + "description": "Returns an error if an duplicate assignment is found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_409_duplicate_found" + }, + "examples": { + "Duplicate": { + "value": { + "code": 409, + "key": "duplicate_found", + "message": "Duplicated resource found", + "details": "Duplicated validation_rules_assignment exists with id asgm_ixJEwQbUv8hfPlhO", + "request_id": "v-0bb06fd1c3478dcb47", + "resource_id": "asgm_ixJEwQbUv8hfPlhO", + "resource_type": "validation_rules_assignment" + } + } + } } } } } } }, - "404": { - "description": "Returns an error indicating that the export with given ID was not found if an incorrect ID is provided in the path.", - "content": { - "application/json": { + "/v1/validation-rules/{validationRuleId}/assignments/{assignmentId}": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_404_not_found" + "type": "string" + }, + "name": "validationRuleId", + "in": "path", + "required": true, + "description": "A unique validation rule ID." + }, + { + "schema": { + "type": "string" }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find export with id exp_8fNoLwgVPuhoxNzVsr50kq0", - "request_id": "v-0b029305af4524cf42", - "resource_id": "exp_8fNoLwgVPuhoxNzVsr50kq0", - "resource_type": "export" + "name": "assignmentId", + "in": "path", + "required": true, + "description": "A unique validation rule assignment ID." + } + ], + "delete": { + "operationId": "delete-validation-rule-assignment", + "tags": [ + "VALIDATION RULES API" + ], + "summary": "Delete Validation Rule Assignment", + "description": "This method deletes a validation rule assignment.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." + }, + "404": { + "description": "Returns an error indicating that the validation rule or validation rule assignment with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Validation Rule Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find validation_rules with id val_4j7DCRm2IS5", + "request_id": "v-0ae3b84bac0683f697", + "resource_id": "val_4j7DCRm2IS5", + "resource_type": "validation_rules" + } + }, + "Validation Rule Assignment Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find validation_rules_assignment with id asgm_tDN7MJNayjrf1wy", + "request_id": "v-0ae3b87eeb9027c916", + "resource_id": "asgm_tDN7MJNayjrf1wy", + "resource_type": "validation_rules_assignment" + } + } + } } } } } } - } - } - }, - "delete": { - "operationId": "delete-export", - "tags": [ - "EXPORTS API" - ], - "summary": "Delete Export", - "description": "This method deletes a previously created export object.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." }, - "404": { - "description": "Returns an error indicating that the export with given ID was not found.", - "content": { - "application/json": { + "/v1/segments/{segmentId}": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/e_404_not_found" + "type": "string", + "example": "seg_DNAOhUtJffvX0f57ajLMFBYR" + }, + "name": "segmentId", + "in": "path", + "required": true, + "description": "A unique customer segment ID." + } + ], + "get": { + "operationId": "get-segment", + "tags": [ + "SEGMENTS API" + ], + "summary": "Get Segment", + "description": "Retrieves the segment with given segment ID.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns segment object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/14_obj_segment_object" + }, + "examples": { + "Tier Segment": { + "value": { + "id": "seg_Mv5w1b2FIEbiCCO5ioT8TfI2", + "name": "Tiers 2 - Senior", + "created_at": "2022-06-09T13:21:26.656Z", + "type": "auto-update", + "filter": { + "junction": "and", + "loyalty_points.campaigns.Tiers 2.points": { + "conditions": { + "$more_than_equal": [ + 41 + ] + } + } + }, + "initial_sync_status": "DONE", + "object": "segment" + } + } + } + } + } }, - "examples": { - "Export Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find export with id exp_2bYLdY2lQ2886wmYIHyeBWUZ", - "request_id": "v-0ae2a97a399027d719", - "resource_id": "exp_2bYLdY2lQ2886wmYIHyeBWUZ", - "resource_type": "export" + "404": { + "description": "Returns an error when requesting a segment that has been deleted or does not exist.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find segment with id seg_Mv5w1b2FIEbiCCO5ioT8TfI", + "request_id": "v-0b4d7a37a105797650", + "resource_id": "seg_Mv5w1b2FIEbiCCO5ioT8TfI", + "resource_type": "segment" + } + } + } + } + } + } + } + }, + "delete": { + "operationId": "delete-segment", + "tags": [ + "SEGMENTS API" + ], + "summary": "Delete Segment", + "description": "This method deletes a customer segment.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." + }, + "404": { + "description": "Returns an error indicating that the customer segment with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Customer Segment Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find segment with id seg_DNAOhUtJffvX0f57ajLMFBY", + "request_id": "v-0ae3bb40409027cb63", + "resource_id": "seg_DNAOhUtJffvX0f57ajLMFBY", + "resource_type": "segment" + } + } + } } } } } } - } - } - } - }, - "/v1/exports/{export_Id}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "exp_ex6zq0x0EEa9S0N68QcqhxcQ" }, - "name": "export_Id", - "in": "path", - "required": true, - "description": "Unique export object ID." - } - ], - "get": { - "operationId": "download-export", - "tags": [ - "EXPORTS API" - ], - "summary": "Download Export", - "description": "Download the contents of the exported CSV file. \n\n\n\n> 📘 Important notes\n>\n> **Base URL:** \n> - `https://download.voucherify.io` (Europe) \n> - `https://us1.download.voucherify.io` (US) \n> - `https://as1.download.voucherify.io` (Asia) \n>\n> **Token:** Can be found within the `result` parameter of the [Get Export](ref:get-export) method response.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [], - "Download-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns contents of CSV file.", - "content": { - "text/plain": { - "schema": { - "type": "string" - }, - "examples": { - "CSV file contents": { - "value": "ID,Code,Voucher Type,Value v_mKNYXWf5168jyW3EvwnAf73d7vnTiXaa,iuCvt3BT,GIFT_VOUCHER,2000.00 v_xb5KuIw90ViUY7NrNbDZzf1JwFmyTUi0,M3X8IwW8,GIFT_VOUCHER,2000.00 v_flCSHFGOfjxuM582jhriJTWQuetb2xHX,6vpzmKaC,GIFT_VOUCHER,2050.00 v_YtzZG4UJaWm9DNCY3AvIqVbc7Dt5WToU,lRvBOUPl,LOYALTY_CARD,0" + "/v1/customer-segment-object": { + "get": { + "operationId": "customer-segment-object", + "tags": [ + "SEGMENTS API" + ], + "summary": "Customer Segment Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Customer Segment Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/14_obj_segment_object" + } + } } } } } }, - "401": { - "description": "Returns an error if an invalid token was provided.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "code": { - "type": "string", - "default": 401, - "description": "Error's HTTP status code." - }, - "message": { - "type": "string", - "default": "Unauthorized", - "description": "A human-readable message providing a short description about the error." + "/v1/segments": { + "post": { + "operationId": "create-segment", + "tags": [ + "SEGMENTS API" + ], + "summary": "Create Segment", + "description": "Create a customer segment.\n\n> 🚧 Limit on Static Segments\n>\n> There is a cap on the number of customers that you can assign to a static segment: **20,000**. If you would like to create a bigger segment, then you can use the unlimited auto-update segment instead and use some customer metadata to build this segment.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the boundary conditions for the customer segment.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/14_req_create_segment" }, - "key": { - "type": "string", - "default": "unauthorized", - "description": "Short string describing the kind of error which occurred." + "examples": { + "Static Segment": { + "value": { + "name": "Customers in a new Segment", + "type": "static", + "customers": [ + "cust_iajsExT2QB4sGWzABY85WRqV", + "cust_sehkNIi8Uq2qQuRqSr7xn4Zi" + ] + } + }, + "Dynamic": { + "value": { + "name": "Customers in a new Dynamic Segment", + "type": "auto-update", + "filter": { + "junction": "and", + "created_at": { + "conditions": { + "$after": [ + "2021-12-01T00:00:00.000Z" + ] + } + } + } + } + } } } - }, - "examples": { - "Unauthorized": { - "value": { - "code": 401, - "message": "Unauthorized", - "key": "unauthorized" + } + }, + "responses": { + "200": { + "description": "Returns a customer segment object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/14_obj_segment_object" + }, + "examples": { + "Static": { + "value": { + "id": "seg_vC8iOSCqUG02EsPzsHynLv8i", + "name": "Customers in a new Segment", + "created_at": "2022-09-13T08:57:15.801Z", + "type": "static", + "filter": null, + "initial_sync_status": "DONE", + "object": "segment" + } + }, + "Dynamic": { + "value": { + "id": "seg_nZULMFHhVWIFm9vQ0dytg83Q", + "name": "Customers in a new Dynamic Segment", + "created_at": "2022-09-13T09:03:32.764Z", + "type": "auto-update", + "filter": { + "junction": "and", + "created_at": { + "conditions": { + "$after": [ + "2021-12-01T00:00:00.000Z" + ] + } + } + }, + "initial_sync_status": "IN_PROGRESS", + "object": "segment" + } + } + } } } } } } - } - } - } - }, - "/v1/category-object": { - "get": { - "operationId": "category-object", - "tags": [ - "CATEGORIES API" - ], - "summary": "Category Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Category Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/20_obj_category_object" + }, + "/v1/custom-event-object": { + "get": { + "operationId": "custom-event-object", + "tags": [ + "EVENTS API" + ], + "summary": "Custom Event Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Custom Event Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/15_req_track_custom_event" + } + } + } } } } - } - } - } - }, - "/v1/categories": { - "get": { - "operationId": "list-categories", - "tags": [ - "CATEGORIES API" - ], - "summary": "List Categories", - "description": "List all categories.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary of category objects.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/20_res_list_categories" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "cat_0b5f49fb31c3bf6ab0", - "name": "Sixth", - "hierarchy": 6, - "created_at": "2022-07-13T06:21:36.852Z", - "object": "category" - }, - { - "id": "cat_0b5f49e6e1ce5bd2ba", - "name": "Fifth", - "hierarchy": 5, - "created_at": "2022-07-13T06:21:16.039Z", - "object": "category" - }, - { - "id": "cat_0b5f49deafce5bd2b5", - "name": "Fourth", - "hierarchy": 4, - "created_at": "2022-07-13T06:21:07.662Z", - "object": "category" - }, - { - "id": "cat_0b5f49d45c43bf6a99", - "name": "Third", - "hierarchy": 3, - "created_at": "2022-07-13T06:20:57.094Z", - "object": "category" - }, - { - "id": "cat_0b5f3f9881ce5bccb6", - "name": "Second", - "hierarchy": 2, - "created_at": "2022-07-13T05:36:14.355Z", - "object": "category" - }, - { - "id": "cat_0b53bc388dc2f108ba", - "name": "First", - "hierarchy": 1, - "created_at": "2022-07-04T06:58:57.734Z", - "object": "category" + }, + "/v1/events": { + "post": { + "operationId": "track-custom-event", + "tags": [ + "EVENTS API" + ], + "summary": "Track Custom Event", + "description": "To track a custom event, you create an event object. \n\nThe 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.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the details of the custom event.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/15_req_track_custom_event" + }, + "examples": { + "Example": { + "value": { + "event": "event-name", + "customer": { + "source_id": "referee-source_id" + }, + "referral": { + "code": "voucher-code", + "referrer_id": "referrer-source_id" + } } - ], - "total": 6 + }, + "Referral triggered by custom event": { + "value": { + "event": "user_subscribed", + "customer": { + "source_id": "source_customer_event" + }, + "referral": { + "code": "46jL0kYI", + "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" + }, + "metadata": { + "login": "bob", + "pricing_plan": "PP1", + "volume_number": 4 + } + } + }, + "Earning rule triggered by custom event": { + "value": { + "event": "cart_abandoned", + "customer": { + "source_id": "source_customer_event" + }, + "loyalty": { + "code": "6CB4KDAu" + }, + "metadata": { + "date": "2022-12-01", + "flag": true, + "text": "Cart abandoned event", + "date_time": "2022-12-01T09:24:33.061Z", + "number": 1 + } + } + } } } } - } - } - } - } - }, - "post": { - "operationId": "create-category", - "tags": [ - "CATEGORIES API" - ], - "summary": "Create Category", - "description": "Create category with a specific name and hierarchy.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the details of the category that you would like to create.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/20_req_create_category" }, - "examples": { - "Example": { - "value": { - "name": "Eighth", - "hierarchy": 8 + "responses": { + "200": { + "description": "Returns the event type if the event was received by the application.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/15_res_track_custom_event" + }, + "examples": { + "Example": { + "value": { + "object": "event", + "type": "cart_abandoned", + "customer": {}, + "referral": null, + "loyalty": null + } + } + } + } } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns a newly created category object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/20_res_create_category" - }, - "examples": { - "Example": { - "value": { - "id": "cat_0b8b5a427a0283c854", - "name": "Eighth", - "hierarchy": 8, - "created_at": "2022-08-16T11:45:54.171Z", - "object": "category" + }, + "400": { + "description": "Returns an error if the request payload is incomplete.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Invalid payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Property .referral should have required property 'code'", + "request_id": "v-0c15694e0e022146dd" + } + } + } } } } } } }, - "400": { - "description": "Returns an error if the payload is incomplete.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_400_invalid_payload" - }, - "examples": { - "Missing name": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Payload should have required property 'name'", - "request_id": "v-0b8b5b960990210b25" + "/client/v1/events": { + "post": { + "operationId": "track-custom-event-client-side", + "tags": [ + "EVENTS API" + ], + "summary": "Track Custom Event (client-side)", + "description": "To track a custom event, you create an event object. \n\nThe 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.", + "parameters": [ + { + "$ref": "#/components/parameters/origin" + } + ], + "security": [ + { + "X-Client-Application-Id-1": [], + "X-Client-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the details of the custom event.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/15_req_track_custom_event" + }, + "examples": { + "Referral triggered by custom event": { + "value": { + "event": "user_subscribed", + "customer": { + "source_id": "source_customer_event" + }, + "referral": { + "code": "46jL0kYI", + "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" + }, + "metadata": { + "login": "bob", + "pricing_plan": "PP1", + "volume_number": 4 + } + } + }, + "Earning rule triggered by custom event": { + "value": { + "event": "cart_abandoned", + "customer": { + "source_id": "source_customer_event" + }, + "loyalty": { + "code": "6CB4KDAu" + }, + "metadata": { + "date": "2022-12-01", + "flag": true, + "text": "Cart abandoned event", + "date_time": "2022-12-01T09:24:33.061Z", + "number": 1 + } + } + } } - }, - "Missing hierarchy": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Payload should have required property 'hierarchy'", - "request_id": "v-0b8b5bf9d9c6824a2f" + } + } + }, + "responses": { + "200": { + "description": "Returns the event type if the event was received by the application.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/15_res_track_custom_event" + }, + "examples": { + "Example": { + "value": { + "object": "event", + "type": "cart_abandoned", + "customer": {}, + "referral": null, + "loyalty": null + } + } + } + } + } + }, + "400": { + "description": "Returns an error if the request payload is incomplete.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Invalid payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Property .referral should have required property 'code'", + "request_id": "v-0c15694e0e022146dd" + } + } + } } } } } } - } - } - } - }, - "/v1/categories/{categoryId}": { - "parameters": [ - { - "schema": { - "type": "string" }, - "name": "categoryId", - "in": "path", - "required": true, - "description": "Unique category ID assigned by Voucherify." - } - ], - "get": { - "operationId": "get-category", - "tags": [ - "CATEGORIES API" - ], - "summary": "Get Category", - "description": "Retrieve a category by the category ID.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a category object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/20_obj_category_object" - }, - "examples": { - "Example": { - "value": { - "id": "cat_0b5f49fb31c3bf6ab0", - "name": "Sixth", - "hierarchy": 6, - "created_at": "2022-07-13T06:21:36.852Z", - "object": "category" + "/v1/consents-object": { + "get": { + "operationId": "consents-object", + "tags": [ + "CONSENTS API" + ], + "summary": "Consents Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Consents Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/18_res_list_consents_GET" + } } } } } } - } - } - }, - "delete": { - "operationId": "delete-category", - "tags": [ - "CATEGORIES API" - ], - "summary": "Delete Category", - "description": "Delete a category by the category ID.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "No content is returned." }, - "404": { - "description": "Returns an error indicating that the category with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find category with id example_category", - "request_id": "v-0b8b49205f902176c9", - "resource_id": "example_category", - "resource_type": "category" + "/v1/consents": { + "get": { + "operationId": "list-consents", + "tags": [ + "CONSENTS API" + ], + "summary": "List Consents", + "description": "List the Marketing Permission definitions within the project along with opt-in consents.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns marketing permission groups and opt-in consents.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/18_res_list_consents_GET" + }, + "examples": { + "Marketing Permissions Groups and Consents": { + "value": { + "groups": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "cnstgr_3c7Z3rcOLv51bsXlRtTZPYj8", + "name": "Consent group", + "description": "Consent group", + "consents": [ + "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", + "cnst_VCmucIvAsmDYw2PPAok6bcYy" + ], + "created_at": "2022-04-13T09:12:47.743Z", + "updated_at": "2022-04-13T09:45:46.616Z", + "object": "consent_group" + }, + { + "id": "cnstgr_EAIakTj5lNG2ZpiQEauGqBlY", + "name": "Consent group 2", + "description": "Consent group 2", + "consents": [ + "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", + "cnst_VCmucIvAsmDYw2PPAok6bcYy" + ], + "created_at": "2022-04-13T10:03:46.564Z", + "updated_at": null, + "object": "consent_group" + } + ], + "total": 2 + }, + "consents": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", + "name": "Consent", + "description": "Consent for marketing", + "category": "New", + "created_at": "2022-04-13T09:11:27.037Z", + "updated_at": null, + "object": "consent" + }, + { + "id": "cnst_VCmucIvAsmDYw2PPAok6bcYy", + "name": "Consent 2", + "description": "Consent 2", + "category": "Trial", + "created_at": "2022-04-13T09:45:37.597Z", + "updated_at": null, + "object": "consent" + } + ], + "total": 2 + } + } + } + } } } } } } - } - } - }, - "put": { - "operationId": "update-category", - "tags": [ - "CATEGORIES API" - ], - "summary": "Update Category", - "description": "Update category using the category ID.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the details of the category that you would like to update.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/20_req_update_categories_categoryId" - }, - "examples": { - "Example": { - "value": { - "name": "Summer", - "hierarchy": 1 + }, + "/client/v1/consents#": { + "get": { + "operationId": "list-consents-client-side", + "tags": [ + "CONSENTS API" + ], + "summary": "List Consents (client-side)", + "description": "List the Marketing Permission definitions within the project along with opt-in consents.", + "parameters": [ + { + "$ref": "#/components/parameters/origin" + } + ], + "security": [ + { + "X-Client-Application-Id-1": [], + "X-Client-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns marketing permission groups and opt-in consents.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/18_res_list_consents_GET" + }, + "examples": { + "Marketing Permissions Groups and Consents": { + "value": { + "groups": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "cnstgr_3c7Z3rcOLv51bsXlRtTZPYj8", + "name": "Consent group", + "description": "Consent group", + "consents": [ + "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", + "cnst_VCmucIvAsmDYw2PPAok6bcYy" + ], + "created_at": "2022-04-13T09:12:47.743Z", + "updated_at": "2022-04-13T09:45:46.616Z", + "object": "consent_group" + }, + { + "id": "cnstgr_EAIakTj5lNG2ZpiQEauGqBlY", + "name": "Consent group 2", + "description": "Consent group 2", + "consents": [ + "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", + "cnst_VCmucIvAsmDYw2PPAok6bcYy" + ], + "created_at": "2022-04-13T10:03:46.564Z", + "updated_at": null, + "object": "consent_group" + } + ], + "total": 2 + }, + "consents": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", + "name": "Consent", + "description": "Consent for marketing", + "category": "New", + "created_at": "2022-04-13T09:11:27.037Z", + "updated_at": null, + "object": "consent" + }, + { + "id": "cnst_VCmucIvAsmDYw2PPAok6bcYy", + "name": "Consent 2", + "description": "Consent 2", + "category": "Trial", + "created_at": "2022-04-13T09:45:37.597Z", + "updated_at": null, + "object": "consent" + } + ], + "total": 2 + } + } + } + } + } } } } } - } - }, - "responses": { - "200": { - "description": "Returns a category object with a refreshed `updated_at` property.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/20_obj_category_object" - }, - "examples": { - "Example": { - "value": { - "id": "cat_0b60cfe7d0d7ddbb55", - "name": "Update", - "hierarchy": 1, - "created_at": "2022-07-14T10:45:13.156Z", - "updated_at": "2022-08-16T11:03:54.727Z", - "object": "category" + }, + "/v1/async-action-object": { + "get": { + "operationId": "async-action-object", + "tags": [ + "ASYNC ACTIONS API" + ], + "summary": "Async Action Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Async Action Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/17_obj_async_action_object" + } } } } } } }, - "400": { - "description": "Returns an error indicating an invalid payload if the required request body parameters were not included in the request.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_400_invalid_payload" + "/v1/async-actions": { + "get": { + "operationId": "list-async-actions", + "tags": [ + "ASYNC ACTIONS API" + ], + "summary": "List Async Actions", + "description": "Track asynchronous operations scheduled in your project. \n\nThe table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import).\n\n| **Types by Context** | **Endpoint** |\n|:---|:---|\n| **CAMPAIGN** | |\n| CAMPAIGN.VOUCHERS_IMPORT | **POST** [/campaigns/{campaignId}/import](ref:import-vouchers-to-campaign) |\n| CAMPAIGN.VOUCHERS_IMPORT_CSV | **POST** [/campaigns/{campaignId}/importCSV](ref:import-vouchers-to-campaign-using-csv) |\n| CAMPAIGN.VOUCHERS_UPDATE | **PUT** [/campaigns/{campaignId}](ref:update-campaign) |\n| CAMPAIGN.VOUCHERS_DELETE | **DELETE** [/campaigns/{campaignId}](ref:delete-campaign) |\n| CAMPAIGN.VOUCHERS_GENERATE |
          • **POST** [/campaigns](ref:create-campaign): asynchronous for campaigns with more than 1 voucher, synchronous for campaign with 1 voucher
          • **POST** [/campaigns/{campaignId}/vouchers](ref:add-vouchers-to-campaign)
            • |\n| **CUSTOMERS** | |\n| CUSTOMERS.IMPORT_CSV | **POST** [/customers/importCSV](ref:import-customers-using-csv) |\n| CUSTOMERS.BULK_UPDATE | **POST** [/customers/bulk/async](ref:update-customers-in-bulk) |\n| CUSTOMERS.METADATA_UPDATE | **POST** [/customers/metadata/async](ref:update-customers-metadata-in-bulk) |\n| **PRODUCTS** | |\n| PRODUCTS.BULK_UPDATE | **POST** [/products/bulk/async](ref:update-products-in-bulk)
              |\n| PRODUCTS.METADATA_UPDATE | **POST** [/products/metadata/async](ref:update-products-metadata-in-bulk) |\n| PRODUCTS.IMPORT_CSV | **POST** [/products/importCSV](ref:import-products-using-csv) |\n| SKUS.IMPORT_CSV | **POST** [/skus/importCSV](ref:import-skus-using-csv) |\n| **VOUCHERS** | |\n| VOUCHERS.IMPORT | **POST** [/vouchers/import](ref:import-vouchers) |\n| VOUCHERS.IMPORT_CSV | **POST** [/vouchers/importCSV](ref:import-vouchers-using-csv) |\n| VOUCHERS.BULK_UPDATE | **POST** [/vouchers/bulk/async](ref:update-vouchers-in-bulk)
              |\n| VOUCHERS.METADATA_UPDATE | **POST** [/vouchers/metadata/async](ref:update-vouchers-metadata-in-bulk) | \n| **ORDERS** | |\n| ORDERS.IMPORT | **POST** [/orders/import](ref:import-orders) |\n| **METADATA KEY PURGE** | |\n| CAMPAIGNS.METADATA_KEY_PURGE
              CUSTOMERS.METADATA_KEY_PURGE
              PRODUCTS.METADATA_KEY_PURGE
              VOUCHERS.METADATA_KEY_PURGE
              ORDERS.METADATA_KEY_PURGE | No API endpoint equivalent. You can perform this action through the Dashboard. See Dashboard documentation: Dashboard > [Project Settings](https://support.voucherify.io/article/99-schema-validation-metadata#maintenance) |", + "parameters": [ + { + "schema": { + "type": "integer" + }, + "in": "query", + "name": "limit", + "description": "Limit the number of asynchronous actions that the API returns in the response." }, - "examples": { - "Missing hierarchy": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Payload should have required property 'hierarchy'", - "request_id": "v-0b8b4e6b6210217c93" - } + { + "schema": { + "type": "string", + "example": "2021-09-08T13:52:18.227Z", + "format": "date-time" }, - "Missing name": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Payload should have required property 'name'", - "request_id": "v-0b8b4f418390217d82" + "in": "query", + "name": "end_date", + "description": "Limits results to actions scheduled before the `end_date`. The date format needs to be consistent with ISO 8601 format (`2016-11-16T14:14:31Z` or `2016-11-16`). " + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of all scheduled asynchronous actions and detailed information for each scheduled action. Note that a status `DONE`doesn't include the result of the completed action. If you need more information about the result, use the ID of the respective async action to call the [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/17_res_list_async_actions_GET" + }, + "examples": { + "List Async Actions": { + "value": { + "object": "list", + "data_ref": "async_actions", + "async_actions": [ + { + "id": "aa_0ba518c55290c6fd62", + "type": "CUSTOMERS.BULK_UPDATE", + "status": "DONE", + "created_at": "2022-09-05T11:40:17.098Z", + "updated_at": "2022-09-05T11:40:17.887Z", + "request_id": "v-0ba518c52bc99858f0", + "progress": 100, + "object": "async_action" + }, + { + "id": "aa_0ba50a7ff4d3574568", + "type": "CUSTOMERS.METADATA_UPDATE", + "status": "DONE", + "created_at": "2022-09-05T10:37:56.051Z", + "updated_at": "2022-09-05T10:37:56.862Z", + "request_id": "v-0ba50a7feb49984902", + "progress": 100, + "object": "async_action" + } + ] + } + } + } + } + } + }, + "400": { + "description": "Returns an error if incorrect query parameters were provided.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Invalid Query Parameters": { + "value": { + "code": 400, + "key": "invalid_query_params", + "message": "Invalid query params", + "details": "Property .end_date cannot be recognized as a ISO-8601 compliant date", + "request_id": "v-0c54493e444b0f61a6" + } + } + } } } } } } - } - } - } - }, - "/v1/metadata-schema-object": { - "get": { - "operationId": "metadata-schema-object", - "tags": [ - "METADATA SCHEMAS API" - ], - "summary": "Metadata Schema Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Metadata Schema Object", - "content": { - "application/json": { + }, + "/v1/async-actions/{asyncActionId}": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/21_obj_metadata_schema_object" - } + "type": "string", + "example": "aa_0afb3d009a55814a48" + }, + "name": "asyncActionId", + "in": "path", + "required": true, + "description": "Unique ID of the asynchronous operation." } - } - } - } - } - }, - "/v1/metadata-schemas": { - "get": { - "operationId": "list-metadata-schemas", - "tags": [ - "METADATA SCHEMAS API" - ], - "summary": "List Metadata Schemas", - "description": "Retrieve metadata schema definitions.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns an array of metadata schema definitions. The response does not include unknown metadata properties in the response, i.e. those that have been defined outside of the **Project Settings** > **Metadata Schema** definitions. For example, an unknown metadata property can be defined in the campaign manager while creating a campaign.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/21_res_list_metadata_shemas" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "schemas", - "schemas": [ - { - "id": "ms_yqMHRHH6S1KYIHPmQHealNf4", - "related_object": "Payment", - "properties": { - "payment_tax": { - "type": "number", - "array": false, - "optional": true, - "objectType": null + ], + "get": { + "operationId": "get-async-action", + "tags": [ + "ASYNC ACTIONS API" + ], + "summary": "Get Async Action", + "description": "Check the result of a scheduled asynchronous operation. \n\nThe table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import).\n\n| **Types by Context** | **Endpoint** |\n|:---|:---|\n| **CAMPAIGN** | |\n| CAMPAIGN.VOUCHERS_IMPORT | **POST** [/campaigns/{campaignId}/import](ref:import-vouchers-to-campaign) |\n| CAMPAIGN.VOUCHERS_IMPORT_CSV | **POST** [/campaigns/{campaignId}/importCSV](ref:import-vouchers-to-campaign-using-csv) |\n| CAMPAIGN.VOUCHERS_UPDATE | **PUT** [/campaigns/{campaignId}](ref:update-campaign) |\n| CAMPAIGN.VOUCHERS_DELETE | **DELETE** [/campaigns/{campaignId}](ref:delete-campaign) |\n| CAMPAIGN.VOUCHERS_GENERATE |
              • **POST** [/campaigns](ref:create-campaign): asynchronous for campaigns with more than 1 voucher, synchronous for campaign with 1 voucher
              • **POST** [/campaigns/{campaignId}/vouchers](ref:add-vouchers-to-campaign)
                • |\n| **CUSTOMERS** | |\n| CUSTOMERS.IMPORT_CSV | **POST** [/customers/importCSV](ref:import-customers-using-csv) |\n| CUSTOMERS.BULK_UPDATE | **POST** [/customers/bulk/async](ref:update-customers-in-bulk) |\n| CUSTOMERS.METADATA_UPDATE | **POST** [/customers/metadata/async](ref:update-customers-metadata-in-bulk) |\n| **PRODUCTS** | |\n| PRODUCTS.BULK_UPDATE | **POST** [/products/bulk/async](ref:update-products-in-bulk)
                  |\n| PRODUCTS.METADATA_UPDATE | **POST** [/products/metadata/async](ref:update-products-metadata-in-bulk) |\n| PRODUCTS.IMPORT_CSV | **POST** [/products/importCSV](ref:import-products-using-csv) |\n| SKUS.IMPORT_CSV | **POST** [/skus/importCSV](ref:import-skus-using-csv) |\n| **VOUCHERS** | |\n| VOUCHERS.IMPORT | **POST** [/vouchers/import](ref:import-vouchers) |\n| VOUCHERS.IMPORT_CSV | **POST** [/vouchers/importCSV](ref:import-vouchers-using-csv) |\n| VOUCHERS.BULK_UPDATE | **POST** [/vouchers/bulk/async](ref:update-vouchers-in-bulk)
                  |\n| VOUCHERS.METADATA_UPDATE | **POST** [/vouchers/metadata/async](ref:update-vouchers-metadata-in-bulk) | \n| **ORDERS** | |\n| ORDERS.IMPORT | **POST** [/orders/import](ref:import-orders) |\n| **METADATA KEY PURGE** | |\n| CAMPAIGNS.METADATA_KEY_PURGE
                  CUSTOMERS.METADATA_KEY_PURGE
                  PRODUCTS.METADATA_KEY_PURGE
                  VOUCHERS.METADATA_KEY_PURGE
                  ORDERS.METADATA_KEY_PURGE | No API endpoint equivalent. You can perform this action through the Dashboard. See Dashboard documentation: Dashboard > [Project Settings](https://support.voucherify.io/article/99-schema-validation-metadata#maintenance) |", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns detailed information about the async action result.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/17_obj_async_action_object" + }, + "examples": { + "CAMPAIGN.VOUCHERS_IMPORT": { + "value": { + "id": "aa_0af9b22296cf473a10", + "type": "CAMPAIGN.VOUCHERS_IMPORT", + "status": "DONE", + "result": { + "message": "0 voucher(s) imported successfully, 3 failed.", + "failed": [ + { + "code": "CODE9", + "reason": "unit: must be a number, property is required (actual value is 'EUR')" + }, + { + "code": "CODE8", + "reason": "unit: must be a number, property is required (actual value is 'EUR')" + }, + { + "code": "CODE7", + "reason": "unit: must be a number, property is required (actual value is 'EUR')" + } + ], + "done_count": 0, + "failed_count": 3 }, - "payment_method": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": true, - "created_at": "2022-03-07T11:01:01.747Z", - "updated_at": "2022-03-07T11:01:44.785Z", - "object": "metadata_schema" + "created_at": "2023-01-20T07:23:43.289Z", + "updated_at": "2023-01-20T07:23:44.044Z", + "request_id": "v-0c553fdb325688d510", + "progress": 100, + "processing_time": 755, + "object": "async_action" + } }, - { - "id": "ms_DwUjpX32sY3fJEoQELpS7bN3", - "related_object": "campaign", - "properties": { - "Store": { - "type": "string", - "array": false, - "deleted": true, - "optional": true, - "objectType": null - }, - "locale": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "date_tag": { - "type": "date", - "array": false, - "optional": true, - "objectType": null - }, - "store_names": { - "eq": [ - "Store 1 - New York - Broadway", - "Store 2 - Florida - Miami", - "Store 3 - London - Heathrow", - "Store 4 - Berlin - Alexanderplatz" + "CAMPAIGN.VOUCHERS_IMPORT_CSV": { + "value": { + "id": "aa_0c5543f00797b6113f", + "type": "CUSTOMERS.IMPORT_CSV", + "status": "DONE", + "result": { + "message": "0 customer(s) imported successfully, 2 failed.", + "failed": [ + { + "source_id": "test-user@voucherify.io", + "row": 1, + "reason": "acquisition_channel: must be a string, property is required, must be equal to one of Facebook,Twitter,Website (actual value is 'snap')" + }, + { + "source_id": "", + "row": 2, + "reason": "acquisition_channel: must be a string, property is required, must be equal to one of Facebook,Twitter,Website (actual value is 'insta')" + } ], - "type": "string", - "array": false, - "optional": true, - "objectType": null + "done_count": 0, + "failed_count": 2 }, - "date_time_tag": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null + "created_at": "2023-01-20T07:41:33.086Z", + "updated_at": "2023-01-20T07:41:33.216Z", + "request_id": "v-0c5543eff2cb0f547f", + "progress": 100, + "processing_time": 130, + "object": "async_action" + } + }, + "CAMPAIGN.VOUCHERS_DELETE": { + "value": { + "id": "aa_0c553853d957b67bd4", + "type": "CAMPAIGN.VOUCHERS_DELETE", + "status": "DONE", + "result": { + "message": "Deleted 2 vouchers.", + "done_count": 2 }, - "favorite_brands": { - "type": "string", - "array": true, - "deleted": true, - "optional": true, - "objectType": null - }, - "height_customer_number": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "location_country_string": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2021-12-03T13:33:44.556Z", - "updated_at": "2022-07-26T13:57:42.288Z", - "object": "metadata_schema" + "created_at": "2023-01-20T06:50:49.573Z", + "updated_at": "2023-01-20T06:50:50.053Z", + "request_id": "v-0c553853b5c418c826", + "progress": 100, + "processing_time": 480, + "object": "async_action" + } }, - { - "id": "ms_f0r4hm3ta6a4a5ch3ma", - "related_object": "customer", - "properties": { - "birth_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - }, - "CRM_created_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - }, - "customer_location": { - "type": "geopoint", - "array": false, - "optional": true, - "objectType": null - }, - "acquisition_channel": { - "eq": [ - "Facebook", - "Twitter", - "Website" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "customer_life_time_value": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2021-12-03T06:33:45.894Z", - "updated_at": "2022-07-14T15:15:34.928Z", - "object": "metadata_schema" + "CAMPAIGN.VOUCHERS_UPDATE": { + "value": { + "id": "aa_0c5440c25c0e5728d0", + "type": "CAMPAIGN.VOUCHERS_UPDATE", + "status": "DONE", + "result": { + "message": "Updated 1 vouchers.", + "done_count": 1 + }, + "created_at": "2023-01-19T12:49:11.024Z", + "updated_at": "2023-01-19T12:49:11.852Z", + "request_id": "v-0c5440c24304189e44", + "progress": 100, + "processing_time": 828, + "object": "async_action" + } }, - { - "id": "ms_7X7krsG84H6MeNuIaKkb4LXN", - "related_object": "earning_rule", - "properties": { - "Type": { - "type": "string", - "array": false, - "optional": true, - "minLength": 6, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-07-27T08:54:07.980Z", - "updated_at": null, - "object": "metadata_schema" + "CAMPAIGN.VOUCHERS_GENERATE": { + "value": { + "id": "aa_0c54441d14d7b60014", + "type": "CAMPAIGN.VOUCHERS_GENERATE", + "status": "DONE", + "result": { + "message": "Generated 2 vouchers.", + "done_count": 2 + }, + "created_at": "2023-01-19T13:03:50.355Z", + "updated_at": "2023-01-19T13:03:51.030Z", + "request_id": "v-0c54441d0e4418b647", + "progress": 100, + "processing_time": 675, + "object": "async_action" + } }, - { - "id": "ms_OF36L2rk4EqhdxvZs56IW9iE", - "related_object": "loyalty_tier", - "properties": { - "has_funds": { - "type": "boolean", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-03-30T06:22:16.685Z", - "updated_at": "2022-07-27T08:55:01.628Z", - "object": "metadata_schema" + "CAMPAIGNS.METADATA_KEY_PURGE": { + "value": { + "id": "aa_0c554b22664a0eb5fc", + "type": "CAMPAIGNS.METADATA_KEY_PURGE", + "status": "DONE", + "result": { + "message": "Updated 0 campaigns.", + "done_count": 0 + }, + "created_at": "2023-01-20T08:12:59.673Z", + "updated_at": "2023-01-20T08:13:00.638Z", + "request_id": "w-0c554b225f8a0eb5fb", + "progress": 100, + "processing_time": 965, + "object": "async_action" + } }, - { - "id": "ms_f1r5Tm3ta6a4a5ch3ma", - "related_object": "order", - "properties": { - "Payment": { - "type": "object", - "array": false, - "deleted": true, - "optional": true, - "objectType": "Payment" - }, - "day_of_week": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "location_id": { - "eq": [ - "L1", - "L2", - "L3" + "CUSTOMERS.IMPORT_CSV": { + "value": { + "id": "aa_0c5543f00797b6113f", + "type": "CUSTOMERS.IMPORT_CSV", + "status": "DONE", + "result": { + "message": "0 customer(s) imported successfully, 2 failed.", + "failed": [ + { + "source_id": "test-user@voucherify.io", + "row": 1, + "reason": "acquisition_channel: must be a string, property is required, must be equal to one of Facebook,Twitter,Website (actual value is 'snap')" + }, + { + "source_id": "", + "row": 2, + "reason": "acquisition_channel: must be a string, property is required, must be equal to one of Facebook,Twitter,Website (actual value is 'insta')" + } ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "payment_mean": { - "eq": [ - "credit-card", - "wire-transfer", - "paypal" + "done_count": 0, + "failed_count": 2 + }, + "created_at": "2023-01-20T07:41:33.086Z", + "updated_at": "2023-01-20T07:41:33.216Z", + "request_id": "v-0c5543eff2cb0f547f", + "progress": 100, + "processing_time": 130, + "object": "async_action" + } + }, + "CUSTOMERS.BULK_UPDATE": { + "value": { + "id": "aa_0c5547cc5e17b617b6", + "type": "CUSTOMERS.BULK_UPDATE", + "status": "DONE", + "result": { + "results": [ + { + "source_id": "source_id_1", + "updated": true, + "found": true + }, + { + "source_id": "source_id_2", + "updated": true, + "found": true + }, + { + "source_id": "source_id_3", + "updated": true, + "found": true + } ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "booking_end_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - }, - "booking_start_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - }, - "number_of_store_visits": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2021-12-03T06:33:45.798Z", - "updated_at": "2022-04-20T06:47:10.350Z", - "object": "metadata_schema" + "done_count": 3 + }, + "created_at": "2023-01-20T07:58:25.144Z", + "updated_at": "2023-01-20T07:58:25.869Z", + "request_id": "v-0c5547cc4d8b0f5be4", + "progress": 100, + "processing_time": 725, + "object": "async_action" + } }, - { - "id": "ms_0qgIlxP7bYb8H59DqpnWBCUN", - "related_object": "order_item", - "properties": { - "Size": { - "type": "number", - "array": false, - "optional": true, - "objectType": null + "CUSTOMERS.METADATA_UPDATE": { + "value": { + "id": "aa_0c554a92030e576181", + "type": "CUSTOMERS.METADATA_UPDATE", + "status": "DONE", + "result": { + "results": [ + { + "source_id": "source_1", + "updated": true, + "found": true + }, + { + "source_id": "source_2", + "updated": true, + "found": true + } + ], + "done_count": 2 }, - "Color": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "Thickness": { - "eq": [ - "Thin", - "Medium", - "Thick" + "created_at": "2023-01-20T08:10:31.821Z", + "updated_at": "2023-01-20T08:10:32.564Z", + "request_id": "v-0c554a91fb4b0f61a2", + "progress": 100, + "processing_time": 743, + "object": "async_action" + } + }, + "CUSTOMERS.METADATA_KEY_PURGE": { + "value": { + "id": "aa_0c5551f2ab0a0ebf0e", + "type": "CUSTOMERS.METADATA_KEY_PURGE", + "status": "DONE", + "result": { + "message": "Updated 0 customers.", + "done_count": 0 + }, + "created_at": "2023-01-20T08:42:45.804Z", + "updated_at": "2023-01-20T08:42:46.079Z", + "request_id": "w-0c5551f2a38a0ebf0d", + "progress": 100, + "processing_time": 275, + "object": "async_action" + } + }, + "PRODUCTS.BULK_UPDATE": { + "value": { + "id": "aa_0c5553f0f457b6328e", + "type": "PRODUCTS.BULK_UPDATE", + "status": "DONE", + "result": { + "results": [ + { + "source_id": "first_product", + "updated": false, + "found": true + }, + { + "source_id": "second_product", + "updated": false, + "found": true + } ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-03-11T13:32:55.029Z", - "updated_at": "2022-05-23T13:46:01.463Z", - "object": "metadata_schema" + "done_count": 2 + }, + "created_at": "2023-01-20T08:51:28.337Z", + "updated_at": "2023-01-20T08:51:28.439Z", + "request_id": "v-0c5553f0e94b0f7502", + "progress": 100, + "processing_time": 102, + "object": "async_action" + } }, - { - "id": "ms_s3c0N6m3ta6a4a5ch3ma", - "related_object": "product", - "properties": { - "color": { - "type": "string", - "array": true, - "optional": true, - "objectType": null + "PRODUCTS.METADATA_UPDATE": { + "value": { + "id": "aa_0c5554869b97b633b4", + "type": "PRODUCTS.METADATA_UPDATE", + "status": "DONE", + "result": { + "results": [ + { + "source_id": "123-567-3433", + "updated": false, + "found": true + }, + { + "source_id": "test_volleyball", + "updated": false, + "found": true + } + ], + "done_count": 2 }, - "origin": { - "type": "string", - "array": false, - "optional": true, - "minLength": 1, - "objectType": null - }, - "product_location": { - "type": "geopoint", - "array": false, - "optional": true, - "objectType": null - }, - "metadata_attribute_name_with_date_property": { - "type": "date", - "array": false, - "optional": true, - "objectType": null - }, - "metadata_attribute_name_with_number_property": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "metadata_attribute_name_with_boolean_property": { - "type": "boolean", - "array": false, - "optional": true, - "objectType": null - }, - "metadata_attribute_name_with_datetime_property": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2021-12-03T06:33:45.880Z", - "updated_at": "2022-07-14T15:46:47.994Z", - "object": "metadata_schema" + "created_at": "2023-01-20T08:54:01.582Z", + "updated_at": "2023-01-20T08:54:02.436Z", + "request_id": "v-0c55548694c418f9dd", + "progress": 100, + "processing_time": 854, + "object": "async_action" + } }, - { - "id": "ms_th8YHt9yFYY1yAA99XOasT5W", - "related_object": "promotion_tier", - "properties": { - "has_budget": { - "type": "boolean", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-01-24T07:22:21.523Z", - "updated_at": "2022-07-27T08:54:42.909Z", - "object": "metadata_schema" + "PRODUCTS.METADATA_KEY_PURGE": { + "value": { + "id": "aa_0c5552d997ca0ec03a", + "type": "PRODUCTS.METADATA_KEY_PURGE", + "status": "DONE", + "result": { + "message": "Updated 2 products.", + "done_count": 2 + }, + "created_at": "2023-01-20T08:46:42.271Z", + "updated_at": "2023-01-20T08:46:43.240Z", + "request_id": "w-0c5552d98e8a0ec039", + "progress": 100, + "processing_time": 969, + "object": "async_action" + } }, - { - "id": "ms_Z7niydc0OpGjDRL4yB40niXn", - "related_object": "publication", - "properties": { - "year": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-03-30T06:23:49.715Z", - "updated_at": "2022-04-19T10:28:24.568Z", - "object": "metadata_schema" + "VOUCHERS.IMPORT": { + "value": { + "id": "aa_0c5559be44d7b63c06", + "type": "VOUCHERS.IMPORT", + "status": "DONE", + "result": { + "message": "0 voucher(s) imported successfully, 3 failed.", + "failed": [ + { + "code": "PROMO-CODE31", + "reason": "unit: must be a number, must be equal to one of 1,2 (actual value is 'EUR')" + }, + { + "code": "PROMO-CODE21", + "reason": "unit: must be a number, must be equal to one of 1,2 (actual value is 'EUR')" + }, + { + "code": "GIFT-CARD-100-1", + "reason": "unit: must be a number, must be equal to one of 1,2 (actual value is 'EUR')" + } + ], + "done_count": 0, + "failed_count": 3 + }, + "created_at": "2023-01-20T09:16:49.299Z", + "updated_at": "2023-01-20T09:16:50.238Z", + "request_id": "v-0c5559be25c418824a", + "progress": 100, + "processing_time": 939, + "object": "async_action" + } }, - { - "id": "ms_t4ir0Dm3ta6a4a5ch3ma", - "related_object": "redemption", - "properties": { - "location_id": { - "eq": [ - "L1", - "L2", - "L3" + "VOUCHERS.IMPORT_CSV": { + "value": { + "id": "aa_0c555db3d697b643e1", + "type": "VOUCHERS.IMPORT_CSV", + "status": "DONE", + "result": { + "message": "0 voucher(s) imported successfully, 2 failed.", + "failed": [ + { + "code": "FALL2023", + "row": 1, + "reason": "Voucher Type is required" + }, + { + "code": "FALL2024", + "row": 2, + "reason": "Voucher Type is required" + } ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "store_names": { - "eq": [ - "Store 1 - New York - Broadway", - "Store 2 - Florida - Miami", - "Store 3 - London - Heathrow", - "Store 4 - Berlin - Alexanderplatz" + "done_count": 0, + "failed_count": 2 + }, + "created_at": "2023-01-20T09:34:07.194Z", + "updated_at": "2023-01-20T09:34:07.367Z", + "request_id": "v-0c555db3ba8b0f0767", + "progress": 100, + "processing_time": 173, + "object": "async_action" + } + }, + "VOUCHERS.BULK_UPDATE": { + "value": { + "id": "aa_0c555e8115d7b64504", + "type": "VOUCHERS.BULK_UPDATE", + "status": "DONE", + "result": { + "results": [ + { + "code": "PROMO-CODE81019", + "updated": false, + "found": false + }, + { + "code": "PROMO-CODE7264786", + "updated": false, + "found": false + } ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2021-12-03T06:33:45.890Z", - "updated_at": "2022-07-26T14:58:24.546Z", - "object": "metadata_schema" + "done_count": 2 + }, + "created_at": "2023-01-20T09:37:37.367Z", + "updated_at": "2023-01-20T09:37:37.520Z", + "request_id": "v-0c555e810904188aa4", + "progress": 100, + "processing_time": 153, + "object": "async_action" + } }, - { - "id": "ms_EnSASZVEIDsZAYa8Z0nG8Rlg", - "related_object": "reward", - "properties": { - "Type": { - "type": "string", - "array": false, - "optional": true, - "objectType": null, - "exactLength": 4 - } - }, - "allow_defined_only": false, - "created_at": "2022-07-27T08:53:32.257Z", - "updated_at": "2022-07-27T08:53:48.542Z", - "object": "metadata_schema" + "VOUCHERS.METADATA_UPDATE": { + "value": { + "id": "aa_0c555ed40857b6463a", + "type": "VOUCHERS.METADATA_UPDATE", + "status": "DONE", + "result": { + "results": [ + { + "code": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "updated": false, + "found": false + }, + { + "code": "LOYALTY-CARD-xLPbpbXR", + "updated": false, + "found": false + } + ], + "done_count": 2 + }, + "created_at": "2023-01-20T09:39:02.305Z", + "updated_at": "2023-01-20T09:39:02.640Z", + "request_id": "v-0c555ed40084188b55", + "progress": 100, + "processing_time": 335, + "object": "async_action" + } + }, + "VOUCHERS.METADATA_KEY_PURGE": { + "value": { + "id": "aa_0c55534bd64a0ec0e0", + "type": "VOUCHERS.METADATA_KEY_PURGE", + "status": "DONE", + "result": { + "message": "Updated 9 vouchers.", + "done_count": 9 + }, + "created_at": "2023-01-20T08:48:39.257Z", + "updated_at": "2023-01-20T08:48:40.503Z", + "request_id": "w-0c55534bcfca0ec0df", + "progress": 100, + "processing_time": 1246, + "object": "async_action" + } }, - { - "id": "ms_xUHvkRBPvVJAlWcTkVzufKx4", - "related_object": "voucher", - "properties": { - "unit": { - "type": "number", - "array": false, - "optional": true, - "objectType": null + "SKUS.IMPORT_CSV": { + "value": { + "id": "aa_0c5558728d0e577e67", + "type": "SKUS.IMPORT_CSV", + "status": "DONE", + "result": { + "message": "4 sku(s) imported successfully, 0 failed.", + "failed": [], + "done_count": 4, + "failed_count": 0 }, - "Region": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "Season": { - "eq": [ - "Spring", - "Summer", - "Fall", - "Winter" + "created_at": "2023-01-20T09:11:09.620Z", + "updated_at": "2023-01-20T09:11:10.270Z", + "request_id": "v-0c5558726f0b0f7d82", + "progress": 100, + "processing_time": 650, + "object": "async_action" + } + }, + "PRODUCTS.IMPORT_CSV": { + "value": { + "id": "aa_0c55578e914e577cf1", + "type": "PRODUCTS.IMPORT_CSV", + "status": "DONE", + "result": { + "message": "1 product(s) imported successfully, 1 failed.", + "failed": [ + { + "row": 1, + "reason": "vendor: must be a string, property is required, must be equal to one of Vendor 1,Vendor 2 (actual value is 'Vendor 3')" + } ], - "type": "string", - "array": false, - "optional": true, - "objectType": null + "done_count": 1, + "failed_count": 1 }, - "CATEGORY": { - "type": "string", - "array": false, - "optional": true, - "objectType": null + "created_at": "2023-01-20T09:07:16.165Z", + "updated_at": "2023-01-20T09:07:17.025Z", + "request_id": "v-0c55578e7a0418fef5", + "progress": 100, + "processing_time": 860, + "object": "async_action" + } + }, + "ORDERS.METADATA_KEY_PURGE": { + "value": { + "id": "aa_0c555fda50472c83a8", + "type": "ORDERS.METADATA_KEY_PURGE", + "status": "DONE", + "result": { + "message": "Updated 1 orders.", + "done_count": 1 }, - "active_on_calendar_month": { - "eq": [ - 1, - 2, - 3, - 5, - 7, - 9, - 10, - 11, - 12 + "created_at": "2023-01-20T09:43:30.881Z", + "updated_at": "2023-01-20T09:43:31.217Z", + "request_id": "w-0c555fda45c72c83a7", + "progress": 100, + "processing_time": 336, + "object": "async_action" + } + }, + "ORDERS.IMPORT": { + "value": { + "id": "aa_0c5564b67d0e571534", + "type": "ORDERS.IMPORT", + "status": "DONE", + "result": { + "message": "1 order(s) imported successfully, 1 failed.", + "failed": [ + { + "source_id": null, + "reason": "Internal error" + } ], - "type": "number", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-01-24T07:22:01.281Z", - "updated_at": "2022-06-22T07:22:09.577Z", - "object": "metadata_schema" + "done_count": 1, + "failed_count": 1 + }, + "created_at": "2023-01-20T10:04:44.916Z", + "updated_at": "2023-01-20T10:04:46.102Z", + "request_id": "v-0c5564b6688b0f155d", + "progress": 100, + "processing_time": 1186, + "object": "async_action" + } } - ], - "total": 13 + } + } + } + }, + "404": { + "description": "Returns an error indicating that the async action with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Async-Action-Not-Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find async_action with id aa_0aeb82bd55d5beffb", + "request_id": "v-0aeb88df54c82af560", + "resource_id": "aa_0aeb82bd55d5beffb", + "resource_type": "async_action" + } + } + } } } } } } - } - } - } - }, - "/v1/metadata-schemas/{resource}": { - "parameters": [ - { - "schema": { - "type": "string" }, - "name": "resource", - "in": "path", - "required": true, - "description": "There is an infinite number of possibilities for retrieving metadata schemas by the resource type because you can define custom metadata schemas." - } - ], - "get": { - "operationId": "get-metadata-schema", - "tags": [ - "METADATA SCHEMAS API" - ], - "summary": "Get Metadata Schema", - "description": "Retrieve metadata schema per resource type.\n\n## Resource types\n\n### Standard\n\nYou can retrieve metadata schemas for the standard metadata schema definitions listed below. Add one of these types as the resource path parameter.\n\n- `campaign`\n- `customer`\n- `earning_rule`\n- `loyalty_tier`\n- `order`\n- `order_item`\n- `product`\n- `promotion_tier`\n- `publication`\n- `redemption`\n- `reward`\n- `voucher`\n\n### Custom\n\nThere is an infinite number of possibilities for retrieving metadata schemas by the resource type because you can define custom metadata schemas. Provide one of the resource types that you have defined as a resource type. [Read more](https://support.voucherify.io/article/99-schema-validation-metadata#add-metadata).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "The response does not include unknown metadata properties in the response, i.e. those that have been defined outside of the **Project Settings** > **Metadata Schema** definitions. For example, an unknown metadata property can be defined in the campaign manager.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/21_obj_metadata_schema_object" + "/v1/export-object": { + "get": { + "operationId": "export-object", + "tags": [ + "EXPORTS API" + ], + "summary": "Export Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Export Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/16_obj_export_object" + } + } + } + } + } + } + }, + "/v1/exports": { + "post": { + "operationId": "create-export", + "tags": [ + "EXPORTS API" + ], + "summary": "Create Export", + "description": "Create export object. The export can be any of the following types: `voucher`, `redemption`, `publication`, `customer`, `order`, `points_expiration`, or `voucher_transactions`. \n\n## Defaults\n\nIf you only specify the object type in the request body without specifying the fields, the API will return the following fields per export object:\n\n| **Export Object** | **Default fields returned** |\n|:---|:---|\n| order | `id`, `source_id`, `status` |\n| voucher | `code`, `voucher_type`, `value`, `discount_type` |\n| publication | `code`, `customer_id`, `date`, `channel` |\n| redemption | `id`, `object`, `voucher_code`, `customer_id`, `date`, `result` |\n| customer | `name`, `source_id` |\n| points_expiration | `id`, `campaign_id`, `voucher_id`, `status`, `expires_at`, `points` |\n| voucher_transactions | `id`, `type`, `source_id`, `status`, `reason`, `source`, `balance`, `amount`, `created_at` |\n\n\n## Fetching particular data sets\n\nUsing the `parameters` body parameter, you can narrow down which fields to export and how to filter the results. The fields are an array of strings containing the data that you would like to export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:\n\n## Orders \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique order ID. | ord_A69RIxEdRsPuC6i8gFGVHUft |\n| source_id | Unique order source ID. | 8638 |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the order was created. | 2022-03-09T09:16:32.521Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the order was last updated. | 2022-03-09T09:16:33.331Z |\n| status | Order status. | `PAID`, `CREATED`, `FULFILLED`, `CANCELED` |\n| amount | Total amount of order items. | 7700 |\n| discount_amount | Represents total amount of the discount applied to whole cart. | 500 |\n| items_discount_amount | Represents total amount of the discount applied to order line items. | 100 |\n| total_discount_amount | All discounts applied to the order including discounts applied to particular order line items and discounts applied to the whole cart. | 600 |\n| total_amount | Total order amount after applying all discounts. | 7100 |\n| customer_id | Customer unique ID. | cust_2G4fUQdCXUqp35nXNleav7bO |\n| referrer_id | Referrer unique ID. | cust_IkrTR674vvQvr9a4rDMiqglY |\n| metadata | Order metadata; expressed as metadata.X, where X is the name of the custom metadata property. | 1 |\n\n## Vouchers \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique voucher ID. | v_HSnGD2vNIHYighTQxwcB4dtVAv8VOmZD |\n| code | Unique voucher code. | WELCOME100 |\n| voucher_type | Type of voucher. | `DISCOUNT_VOUCHER`, `GIFT_VOUCHER`, `LOYALTY_CARD` |\n| value | Value of voucher. | `DISCOUNT_VOUCHER` : amount, percent, unit
                  `GIFT_VOUCHER`: amount left to spend
                  `LOYALTY_CARD`: available usable points |\n| discount_type | The type of discount for a `DISCOUNT_VOUCHER`. | `AMOUNT`, `PERCENT`, `UNIT`, `FIXED` |\n| campaign | Unique campaign name. | Summer Discounts 20% off |\n| category | Tag defining the category that this voucher belongs to. | |\n| start_date | Start date defines when the code starts to be active. Activation timestamp in ISO 8601 format. Voucher is _inactive_ before this date. | 2020-12-10T23:00:00.000Z |\n| expiration_date | Expiration date defines when the code expires. Expiration timestamp in ISO 8601 format. Voucher is _inactive_ after this date. | 2023-12-31T23:00:00.000Z |\n| gift_balance | Amount left to spend. | 1000 |\n| loyalty_balance | Available usable points. | 2000 |\n| redemption_quantity | Maximum number of times a voucher can be redeemed. | 2 |\n| redemption_count | Total redemptions. | 59 |\n| active | Boolean indicating whether the voucher is available for use. | `true`, `false` |\n| qr_code | URL to QR representation of encrypted code. | |\n| bar_code | URL to barcode representation of encrypted code. | |\n| metadata | Custom voucher metadata. | |\n| is_referral_code | Boolean indicating whether the voucher is a referral code. | `true`, `false` |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the voucher was created. | 2022-04-14T09:55:46.814Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the voucher was last updated. | 2022-04-14T10:02:18.036Z |\n| validity_timeframe_interval | Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an interval of `P2D` will be active every other day. | P2D |\n| validity_timeframe_duration | Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a duration of `PT1H` will be valid for a duration of one hour. | PT1H |\n| validity_day_of_week | Array corresponding to the particular days of the week in which the voucher is valid. | \"1,2,3,4,5\" |\n| discount_amount_limit | For `PERCENT` discount type, this is the maximum threshold allowed to be deducted. | 50 |\n| campaign_id | Parent campaign ID. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| additional_info | An optional field to keep any extra textual information about the code such as a code description and details. | |\n| customer_id | Unique customer ID of the assigned owner to whom the voucher was published. | cust_7iUa6ICKyU6gH40dBU25kQU1 |\n| discount_unit_type | For `UNIT` discount type, either a shipping or product ID for a `UNIT` discount with one product. | prod_5h1pp1ng, prod_0a9f9aeddb019a42db |\n| discount_unit_effect | `UNIT` discount effect. | `ADD_MANY_ITEMS`, `ADD_MISSING_ITEMS`,`ADD_NEW_ITEMS` |\n| customer_source_id | Unique customer source id of the assigned owner to whom the voucher was published. | name.lastname@email.com |\n\n\n## Publications\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| voucher_code | Unique voucher code. | WELCOME100 |\n| customer_id | Customer unique ID. | cust_7iUa6ICKyU6gH40dBU25kQU1 |\n| customer_source_id | Unique customer source id of the assigned owner to whom the voucher was published. | name.lastname@email.com |\n| date | Timestamp in ISO 8601 format representing the date and time when the voucher was published. | 2022-04-28T10:19:30.792Z |\n| channel | Publication channel. | voucherify-website |\n| campaign | Unique campaign name. | Summer Discounts 20% off |\n| is_winner | | |\n| metadata | Custom publication metadata. | |\n\n## Redemptions\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique redemption ID. | r_0acf3a6dae00e679c8, rf_0acf3a495740e679b8 |\n| object | Object being exported; by default `redemption`. | redemption |\n| date | Timestamp in ISO 8601 format representing the date and time when the voucher was redeemed. | 2022-03-23T08:52:24.867Z |\n| voucher_code | Unique voucher code redeemed. | WELCOME100 |\n| campaign | Parent campaign name of voucher if applicable. | Summer Discounts 20% off |\n| promotion_tier_id | | promo_Mwy9XpA0TLctSGriM5kum0qp |\n| customer_id | Unique customer ID of redeeming customer. | cust_nk0N1uNQ1YnupAoJGOgvsODC |\n| customer_source_id | Unique source ID of redeeming customer. | name.lastname@email.com |\n| customer_name | Customer name. | John Smith |\n| tracking_id | | track_Pw6r3ejnml43kIwNS4Zj09KZ67xOfLUy |\n| order_amount | Total order amount before applying all discounts. | 1000 |\n| gift_amount | Gift credits used for redemption. | 10 |\n| loyalty_points | | 12 |\n| result | Tells you whether the redemption succeeded. | `SUCCESS`, `FAILURE` |\n| failure_code | Internal Voucherify code for reason why redemption failed. | invalid_customer |\n| failure_message | A human-readable message providing a short description explaining why the redemption failed. | Customer must be a holder of a loyalty card. |\n| metadata | Custom redemption metadata. | |\n\n## Customers\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| name | Customer name. | John Smith |\n| id | Unique customer ID. | cust_J1CDUdbqn5Exva8ASWk1Fq0j |\n| description | An arbitrary string that you can attach to a customer object. | Customer requesting to be added to VIP tier. |\n| email | Customer's email. | name.lastname@email.com |\n| source_id | Unique custom customer identifier. | name.lastname@email.com |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the customer was created. | 2022-02-03T13:10:11.928Z |\n| address_city | City | Houston |\n| address_state | State | TX |\n| address_line_1 | First line of customer's address. | 72738 Main St |\n| address_line_2 | Second line of customer's address. | Bld 2, Apt 4 |\n| address_country | Country | United States of America |\n| address_postal_code | Postal code (ZIP code) | 77042-4143 |\n| redemptions_total_redeemed | Total customer redemptions. | 5 |\n| redemptions_total_failed | Total customer failed redemptions. | 2 |\n| redemptions_total_succeeded | Total customer succeeded redemptions. | 3 |\n| redemptions_total_rolled_back | Total customer redemptions that were rolled back. | 3 |\n| redemptions_total_rollback_failed | Total customer redemptions that were unsuccessfully rolled back. | 2 |\n| redemptions_total_rollback_succeeded | Total customer redemptions that were successfully rolled back. | 1 |\n| orders_total_amount | Total sum of order amounts over customer lifetime. Value is multiplied by 100 to precisely represent 2 decimal places. | 10000 (represents $100) |\n| orders_total_count | Total number of customer orders. | 2 |\n| orders_average_amount | Average amount spent on orders. Value is multiplied by 100 to precisely represent 2 decimal places. | 5000 (represents $50) |\n| orders_last_order_amount | How much did the customer spend on their last order. Value is multiplied by 100 to precisely represent 2 decimal places. | 5000 (represents $50) |\n| orders_last_order_date | When was the last customer order; timestamp in ISO 8601 format representing the date and time. | 2022-02-03T13:17:30.630Z |\n| loyalty_points | Sum of customer's loyalty points to go across all loyalty cards. | 2000 |\n| loyalty_referred_customers | How many customers were referred by this customer. | 3 |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the customer was updated. | 2022-02-14T14:10:14.305Z |\n| phone | Customer's phone number. | +1 (294) 752-1846 |\n| birthday | Customer's birthday. | 2022-01-01 |\n| metadata | Customer metadata. | All metadata fields defined in Metadata Schema for the Customer object. |\n| birthdate | Customer's birthdate. | 2022-01-01 |\n\n## Points Expirations\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n |\n| campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 |\n| status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` |\n| expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 |\n| points | Number of points. | 1000 |\n\n ## Gift Card Transactions\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
                  - `CREDITS_ADDITION`
                  - `CREDITS_REFUND`
                  - `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n\n ## Loyalty Card Transactions\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID assigned by Voucherify. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `POINTS_EXPIRATION`
                  - `POINTS_ADDITION`
                  - `POINTS_REMOVAL`
                  - `POINTS_TRANSFER_OUT`
                  - `POINTS_ACCRUAL`
                  - `POINTS_REFUND`
                  - `POINTS_REDEMPTION` |\n| source_id | Custom source ID of the transaction if one was included originally. | source_id_custom |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The loyalty card balance after the transaction. | |\n| amount | The amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | - `API`
                  - `voucherify-web-ui`
                  - `Automation` |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n| related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the details of the export that you would like to create.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/16_req_create_export_POST" + } + } + } + }, + "responses": { + "200": { + "description": "Returns export object and URL of CSV file.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/16_obj_export_object" + } + } + } }, - "examples": { - "earning_rule": { - "value": { - "id": "ms_27vMXZqBAkkqBoOuw8EYTRLn", - "related_object": "earning_rule", - "properties": { - "channel_id": { - "type": "string", - "array": true, - "optional": true, - "objectType": null, - "exactLength": 5 + "400": { + "description": "Returns an error if an invalid payload is provided.", + "content": { + "application/json": { + "schema": { + "anyOf": [ + { + "$ref": "#/components/schemas/e_400_invalid_payload" + }, + { + "$ref": "#/components/schemas/e_400_invalid_export_fields" + } + ] + }, + "examples": { + "Invalid Export Fields": { + "value": { + "code": 400, + "key": "invalid_export_fields", + "message": "Invalid Export", + "details": "Unsupported field used. Allowed fields: id, object, date, voucher_code, campaign, promotion_tier_id, customer_id, customer_source_id, customer_name, tracking_id, order_amount, gift_amount, loyalty_points, result, failure_code, failure_message, metadata", + "request_id": "v-0afdb603910a1a14e0" + } }, - "channel_name": { - "eq": [ - "instagram", - "facebook", - "google", - "twitter", - "linkedin", - "website" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null + "Invalid Payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Property .exported_object should be equal to one of the allowed values [ voucher, redemption, customer, publication, order, points_expiration ]", + "request_id": "v-0afdb5bd68d20bdb81" + } } - }, - "allow_defined_only": false, - "created_at": "2022-08-25T13:09:59.970Z", - "updated_at": "2022-08-25T13:11:15.704Z", - "object": "metadata_schema" + } } + } + } + } + }, + "get": { + "operationId": "list-exports", + "tags": [ + "EXPORTS API" + ], + "summary": "List Exports", + "description": "List all exports. ", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "status", + "-status" + ] }, - "campaign": { - "value": { - "id": "ms_psGSDpVl6JcPilPA7toZ83Kj", - "related_object": "campaign", - "properties": { - "region": { - "eq": [ - "EMEA", - "AMER", - "APAC" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "A dictionary with an exports property that contains an array of exports. Each entry in the array is a separate export object. The list will return the following types of exported objects: `voucher`, `redemption`, `publication`, `customer`, `order`, `points_expiration`, or `voucher_transactions`. \n\nThe `channel` parameter in the response body returns the channel that was used to generate the particular export. The `user_id` identifies the specific user who initiated the export through the Voucherify Dashboard; this `user_id` is returned when the channel value is `WEBSITE`.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/16_res_list_exports" + }, + "examples": { + "List Exports": { + "value": { + "object": "list", + "data_ref": "exports", + "exports": [ + { + "id": "exp_323UOPsH42twhJVaDZXf4UNo", + "object": "export", + "created_at": "2022-08-04T09:11:25.208Z", + "status": "DONE", + "channel": "API", + "exported_object": "order", + "parameters": { + "order": "-created_at", + "fields": [ + "id", + "source_id", + "status" + ], + "filters": { + "junction": "and" + } + }, + "result": { + "url": "https://download.voucherify.io/v1/exports/exp_323UOPsH42twhJVaDZXf4UNo?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnQiOiJzYW11ZWwuamFuaWtAdm91Y2hlcmlmeS5pbyIsImV4cG9ydElkIjoiZXhwXzMyM1VPUHNINDJ0d2hKVmFEWlhmNFVObyIsImlhdCI6MTY1OTYwNDI4NiwiZXhwIjoxNjU5NjA1MTg2fQ.IgFnKagyoQ7_O2tGswZxpegUMtllSbzMfPMX-_89W7o" + }, + "user_id": null + }, + { + "id": "exp_sPQR0na2gU0pIVUKIz4wdQI9", + "object": "export", + "created_at": "2022-05-02T06:44:03.186Z", + "status": "DONE", + "channel": "API", + "exported_object": "voucher", + "parameters": { + "order": "-created_at", + "fields": [ + "id", + "code", + "voucher_type", + "value" + ], + "filters": { + "junction": "and" + } + }, + "result": { + "url": "https://download.voucherify.io/v1/exports/exp_sPQR0na2gU0pIVUKIz4wdQI9?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnQiOiJzYW11ZWwuamFuaWtAdm91Y2hlcmlmeS5pbyIsImV4cG9ydElkIjoiZXhwX3NQUVIwbmEyZ1UwcElWVUtJejR3ZFFJOSIsImlhdCI6MTY1MTQ3Mzg0NCwiZXhwIjoxNjUxNDc0NzQ0fQ.yNIQHcHMO-HSKYejtgNjRVh3cRa_JqnmhBXdnAX2vHQ" + }, + "user_id": null + }, + { + "id": "exp_CGnCVltmWjI9V1pGlnunw2Nf", + "object": "export", + "created_at": "2022-01-13T09:03:18.293Z", + "status": "DONE", + "channel": "API", + "exported_object": "customer", + "parameters": { + "order": "", + "fields": [ + "name", + "id", + "email", + "source_id", + "created_at" + ], + "filters": { + "junction": "and" + }, + "response_format": "CSV" + }, + "result": { + "url": "https://download.voucherify.io/v1/exports/exp_CGnCVltmWjI9V1pGlnunw2Nf?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ" + }, + "user_id": null + } + ], + "total": 3 + } } - }, - "allow_defined_only": false, - "created_at": "2022-08-25T13:12:58.447Z", - "updated_at": null, - "object": "metadata_schema" + } } - }, - "customer": { - "value": { - "id": "ms_f0r4hm3ta6a4a5ch3ma", - "related_object": "customer", - "properties": { - "age": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "city_id": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "location": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "favorite_brands": { - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "acquisition_channel": { - "eq": [ - "Facebook", - "Twitter", - "Website" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "customer_life_time_value": { - "type": "number", - "array": false, - "optional": true, - "objectType": null + } + } + } + } + }, + "/v1/exports/{exportId}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "exp_2bYLdY2lQ2886wmYIHyeBWUZ" + }, + "name": "exportId", + "in": "path", + "required": true, + "description": "Unique export object ID of previously created export. This object can be a: `voucher`, `redemption`, `publication`, `customer`, `order`, `points_expiration`, or `voucher_transactions`." + } + ], + "get": { + "operationId": "get-export", + "tags": [ + "EXPORTS API" + ], + "summary": "Get Export", + "description": "Retrieves the URL of the downloadable file, which was generated via the [Create Export](ref:create-export) method.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns the export object if a valid identifier was provided in the path.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/16_obj_export_object" + }, + "examples": { + "Get Export": { + "value": { + "id": "exp_CGnCVltmWjI9V1pGlnunw2Nf", + "object": "export", + "created_at": "2022-01-13T09:03:18.293Z", + "status": "DONE", + "channel": "API", + "exported_object": "customer", + "parameters": { + "order": "", + "fields": [ + "name", + "id", + "email", + "source_id", + "created_at" + ], + "filters": { + "junction": "and" + }, + "response_format": "CSV" + }, + "result": { + "url": "https://download.voucherify.io/v1/exports/exp_CGnCVltmWjI9V1pGlnunw2Nf?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ" + }, + "user_id": null + } } - }, - "allow_defined_only": false, - "created_at": "2021-12-01T08:00:48.889Z", - "updated_at": "2022-09-12T07:34:49.163Z", - "object": "metadata_schema" + } } - }, - "loyalty_tier": { - "value": { - "id": "ms_jHUoFlgepKVEftxK1pKPGZlO", - "related_object": "loyalty_tier", - "properties": { - "level_name": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "audience_restricted": { - "type": "boolean", - "array": false, - "optional": true, - "objectType": null + } + }, + "404": { + "description": "Returns an error indicating that the export with given ID was not found if an incorrect ID is provided in the path.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find export with id exp_8fNoLwgVPuhoxNzVsr50kq0", + "request_id": "v-0b029305af4524cf42", + "resource_id": "exp_8fNoLwgVPuhoxNzVsr50kq0", + "resource_type": "export" + } } - }, - "allow_defined_only": false, - "created_at": "2022-08-25T13:14:54.954Z", - "updated_at": "2022-08-25T13:15:24.436Z", - "object": "metadata_schema" + } } - }, - "order": { - "value": { - "id": "ms_f1r5Tm3ta6a4a5ch3ma", - "related_object": "order", - "properties": { - "card": { - "eq": [ - "Visa", - "MasterCard", - "Other" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "currency": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "location": { - "ne": [ - 1, - 2, - 18, - 22 - ], - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "store_city": { - "eq": [ - "Hampden", - "San Francisco", - "Warsaw" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "location_id": { - "eq": [ - "L1", - "L2", - "L3" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "payment_mean": { - "eq": [ - "credit-card", - "wire-transfer", - "paypal" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "booking_end_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - }, - "booking_start_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null + } + } + } + }, + "delete": { + "operationId": "delete-export", + "tags": [ + "EXPORTS API" + ], + "summary": "Delete Export", + "description": "This method deletes a previously created export object.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." + }, + "404": { + "description": "Returns an error indicating that the export with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Export Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find export with id exp_2bYLdY2lQ2886wmYIHyeBWUZ", + "request_id": "v-0ae2a97a399027d719", + "resource_id": "exp_2bYLdY2lQ2886wmYIHyeBWUZ", + "resource_type": "export" + } } + } + } + } + } + } + } + }, + "/v1/exports/{export_Id}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "exp_ex6zq0x0EEa9S0N68QcqhxcQ" + }, + "name": "export_Id", + "in": "path", + "required": true, + "description": "Unique export object ID." + } + ], + "get": { + "operationId": "download-export", + "tags": [ + "EXPORTS API" + ], + "summary": "Download Export", + "description": "Download the contents of the exported CSV file. \n\n\n\n> 📘 Important notes\n>\n> **Base URL:** \n> - `https://download.voucherify.io` (Europe) \n> - `https://us1.download.voucherify.io` (US) \n> - `https://as1.download.voucherify.io` (Asia) \n>\n> **Token:** Can be found within the `result` parameter of the [Get Export](ref:get-export) method response.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [], + "Download-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns contents of CSV file.", + "content": { + "text/plain": { + "schema": { + "type": "string" }, - "allow_defined_only": false, - "created_at": "2021-12-01T08:00:47.575Z", - "updated_at": "2022-10-25T10:05:18.978Z", - "object": "metadata_schema" + "examples": { + "CSV file contents": { + "value": "ID,Code,Voucher Type,Value v_mKNYXWf5168jyW3EvwnAf73d7vnTiXaa,iuCvt3BT,GIFT_VOUCHER,2000.00 v_xb5KuIw90ViUY7NrNbDZzf1JwFmyTUi0,M3X8IwW8,GIFT_VOUCHER,2000.00 v_flCSHFGOfjxuM582jhriJTWQuetb2xHX,6vpzmKaC,GIFT_VOUCHER,2050.00 v_YtzZG4UJaWm9DNCY3AvIqVbc7Dt5WToU,lRvBOUPl,LOYALTY_CARD,0" + } + } } - }, - "order_item": { - "value": { - "id": "ms_7ux44AEnt82bqo8ww5V1SXzV", - "related_object": "order_item", - "properties": { - "manufacturer_id": { - "gte": 15, - "type": "number", - "array": false, - "optional": true, - "objectType": null + } + }, + "401": { + "description": "Returns an error if an invalid token was provided.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "default": 401, + "description": "Error's HTTP status code." + }, + "message": { + "type": "string", + "default": "Unauthorized", + "description": "A human-readable message providing a short description about the error." + }, + "key": { + "type": "string", + "default": "unauthorized", + "description": "Short string describing the kind of error which occurred." + } } }, - "allow_defined_only": false, - "created_at": "2022-08-25T13:16:03.167Z", - "updated_at": null, - "object": "metadata_schema" + "examples": { + "Unauthorized": { + "value": { + "code": 401, + "message": "Unauthorized", + "key": "unauthorized" + } + } + } } - }, - "product": { - "value": { - "id": "ms_s3c0N6m3ta6a4a5ch3ma", - "related_object": "product", - "properties": { - "vendor": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "category": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "location": { - "type": "geopoint", - "array": false, - "optional": true, - "objectType": null + } + } + } + } + }, + "/v1/category-object": { + "get": { + "operationId": "category-object", + "tags": [ + "CATEGORIES API" + ], + "summary": "Category Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Category Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/20_obj_category_object" + } + } + } + } + } + } + }, + "/v1/categories": { + "get": { + "operationId": "list-categories", + "tags": [ + "CATEGORIES API" + ], + "summary": "List Categories", + "description": "List all categories.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary of category objects.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/20_res_list_categories" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "cat_0b5f49fb31c3bf6ab0", + "name": "Sixth", + "hierarchy": 6, + "created_at": "2022-07-13T06:21:36.852Z", + "object": "category" + }, + { + "id": "cat_0b5f49e6e1ce5bd2ba", + "name": "Fifth", + "hierarchy": 5, + "created_at": "2022-07-13T06:21:16.039Z", + "object": "category" + }, + { + "id": "cat_0b5f49deafce5bd2b5", + "name": "Fourth", + "hierarchy": 4, + "created_at": "2022-07-13T06:21:07.662Z", + "object": "category" + }, + { + "id": "cat_0b5f49d45c43bf6a99", + "name": "Third", + "hierarchy": 3, + "created_at": "2022-07-13T06:20:57.094Z", + "object": "category" + }, + { + "id": "cat_0b5f3f9881ce5bccb6", + "name": "Second", + "hierarchy": 2, + "created_at": "2022-07-13T05:36:14.355Z", + "object": "category" + }, + { + "id": "cat_0b53bc388dc2f108ba", + "name": "First", + "hierarchy": 1, + "created_at": "2022-07-04T06:58:57.734Z", + "object": "category" + } + ], + "total": 6 + } } - }, - "allow_defined_only": false, - "created_at": "2021-12-01T08:00:48.298Z", - "updated_at": "2022-07-14T15:53:29.226Z", - "object": "metadata_schema" + } } - }, - "promotion_tier": { - "value": { - "id": "ms_dNb5aLMzU0VBCiRuxLOeMNwn", - "related_object": "promotion_tier", - "properties": { - "level": { - "type": "string", - "array": false, - "optional": true, - "objectType": null + } + } + } + }, + "post": { + "operationId": "create-category", + "tags": [ + "CATEGORIES API" + ], + "summary": "Create Category", + "description": "Create category with a specific name and hierarchy.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the details of the category that you would like to create.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/20_req_create_category" + }, + "examples": { + "Example": { + "value": { + "name": "Eighth", + "hierarchy": 8 } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a newly created category object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/20_res_create_category" }, - "allow_defined_only": false, - "created_at": "2022-01-24T10:42:04.937Z", - "updated_at": "2022-09-23T08:51:46.266Z", - "object": "metadata_schema" + "examples": { + "Example": { + "value": { + "id": "cat_0b8b5a427a0283c854", + "name": "Eighth", + "hierarchy": 8, + "created_at": "2022-08-16T11:45:54.171Z", + "object": "category" + } + } + } } - }, - "publication": { - "value": { - "id": "ms_fzvWNh7sU4LeykEQ2Abpg6jG", - "related_object": "publication", - "properties": { - "file_uploaded": { - "type": "image_url", - "array": false, - "optional": true, - "objectType": null + } + }, + "400": { + "description": "Returns an error if the payload is incomplete.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_400_invalid_payload" + }, + "examples": { + "Missing name": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Payload should have required property 'name'", + "request_id": "v-0b8b5b960990210b25" + } }, - "publication_method": { - "type": "string", - "array": false, - "optional": true, - "objectType": null + "Missing hierarchy": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Payload should have required property 'hierarchy'", + "request_id": "v-0b8b5bf9d9c6824a2f" + } } - }, - "allow_defined_only": false, - "created_at": "2022-08-25T13:16:35.534Z", - "updated_at": "2022-09-12T10:26:31.135Z", - "object": "metadata_schema" + } } - }, - "redemption": { - "value": { - "id": "ms_t4ir0Dm3ta6a4a5ch3ma", - "related_object": "redemption", - "properties": { - "location_id": { - "eq": [ - "L1", - "L2", - "L3" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "redemption_location": { - "type": "object", - "array": false, - "optional": true, - "objectType": "Location" + } + } + } + } + }, + "/v1/categories/{categoryId}": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "categoryId", + "in": "path", + "required": true, + "description": "Unique category ID assigned by Voucherify." + } + ], + "get": { + "operationId": "get-category", + "tags": [ + "CATEGORIES API" + ], + "summary": "Get Category", + "description": "Retrieve a category by the category ID.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a category object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/20_obj_category_object" + }, + "examples": { + "Example": { + "value": { + "id": "cat_0b5f49fb31c3bf6ab0", + "name": "Sixth", + "hierarchy": 6, + "created_at": "2022-07-13T06:21:36.852Z", + "object": "category" + } } - }, - "allow_defined_only": false, - "created_at": "2021-12-01T08:00:48.794Z", - "updated_at": "2022-08-25T13:19:50.497Z", - "object": "metadata_schema" + } } - }, - "reward": { - "value": { - "id": "ms_PwrAtwqCFXeH4Qix22gEkqhl", - "related_object": "reward", - "properties": { - "reward_type": { - "eq": [ - "MATERIAL", - "PAY-WITH-POINTS", - "DISCOUNT-COUPON", - "GIFT-CARD-CREDITS", - "LOYALTY POINTS" - ], - "type": "string", - "array": false, - "optional": false, - "objectType": null + } + } + } + }, + "delete": { + "operationId": "delete-category", + "tags": [ + "CATEGORIES API" + ], + "summary": "Delete Category", + "description": "Delete a category by the category ID.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "No content is returned." + }, + "404": { + "description": "Returns an error indicating that the category with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find category with id example_category", + "request_id": "v-0b8b49205f902176c9", + "resource_id": "example_category", + "resource_type": "category" + } + } + } + } + } + } + } + }, + "put": { + "operationId": "update-category", + "tags": [ + "CATEGORIES API" + ], + "summary": "Update Category", + "description": "Update category using the category ID.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the details of the category that you would like to update.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/20_req_update_categories_categoryId" + }, + "examples": { + "Example": { + "value": { + "name": "Summer", + "hierarchy": 1 } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a category object with a refreshed `updated_at` property.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/20_obj_category_object" }, - "allow_defined_only": true, - "created_at": "2022-08-25T13:07:13.689Z", - "updated_at": "2022-08-25T13:08:26.696Z", - "object": "metadata_schema" + "examples": { + "Example": { + "value": { + "id": "cat_0b60cfe7d0d7ddbb55", + "name": "Update", + "hierarchy": 1, + "created_at": "2022-07-14T10:45:13.156Z", + "updated_at": "2022-08-16T11:03:54.727Z", + "object": "category" + } + } + } } - }, - "voucher": { - "value": { - "id": "ms_9uE6eP17Jvoxl46mCqL6Q3Ut", - "related_object": "voucher", - "properties": { - "lang": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "Season": { - "eq": [ - "Spring", - "Summer", - "Fall", - "Winter" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "marketing_text": { - "type": "string", - "array": false, - "optional": true, - "objectType": null + } + }, + "400": { + "description": "Returns an error indicating an invalid payload if the required request body parameters were not included in the request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_400_invalid_payload" + }, + "examples": { + "Missing hierarchy": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Payload should have required property 'hierarchy'", + "request_id": "v-0b8b4e6b6210217c93" + } }, - "ProductionVoucherCodeMetaData": { - "type": "string", - "array": false, - "deleted": true, - "optional": true, - "objectType": null + "Missing name": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Payload should have required property 'name'", + "request_id": "v-0b8b4f418390217d82" + } } - }, - "allow_defined_only": false, - "created_at": "2022-01-24T10:42:23.994Z", - "updated_at": "2022-09-19T14:13:30.590Z", - "object": "metadata_schema" + } } } } } } }, - "404": { - "description": "Returns an error if the resource provided in the path is not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find metadata schema with id earning_rules", - "request_id": "v-0c1b9ce0098a391421", - "resource_id": "earning_rules", - "resource_type": "metadata schema" + "/v1/metadata-schema-object": { + "get": { + "operationId": "metadata-schema-object", + "tags": [ + "METADATA SCHEMAS API" + ], + "summary": "Metadata Schema Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Metadata Schema Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/21_obj_metadata_schema_object" + } } } } } } - } - } - } - }, - "/v1/location-object": { - "get": { - "operationId": "location-object", - "tags": [ - "LOCATIONS API" - ], - "summary": "Location Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Location Object", - "content": { - "application/json": { + }, + "/v1/metadata-schemas": { + "get": { + "operationId": "list-metadata-schemas", + "tags": [ + "METADATA SCHEMAS API" + ], + "summary": "List Metadata Schemas", + "description": "Retrieve metadata schema definitions.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns an array of metadata schema definitions. The response does not include unknown metadata properties in the response, i.e. those that have been defined outside of the **Project Settings** > **Metadata Schema** definitions. For example, an unknown metadata property can be defined in the campaign manager while creating a campaign.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/21_res_list_metadata_shemas" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "schemas", + "schemas": [ + { + "id": "ms_yqMHRHH6S1KYIHPmQHealNf4", + "related_object": "Payment", + "properties": { + "payment_tax": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "payment_method": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": true, + "created_at": "2022-03-07T11:01:01.747Z", + "updated_at": "2022-03-07T11:01:44.785Z", + "object": "metadata_schema" + }, + { + "id": "ms_DwUjpX32sY3fJEoQELpS7bN3", + "related_object": "campaign", + "properties": { + "Store": { + "type": "string", + "array": false, + "deleted": true, + "optional": true, + "objectType": null + }, + "locale": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "date_tag": { + "type": "date", + "array": false, + "optional": true, + "objectType": null + }, + "store_names": { + "eq": [ + "Store 1 - New York - Broadway", + "Store 2 - Florida - Miami", + "Store 3 - London - Heathrow", + "Store 4 - Berlin - Alexanderplatz" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "date_time_tag": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + }, + "favorite_brands": { + "type": "string", + "array": true, + "deleted": true, + "optional": true, + "objectType": null + }, + "height_customer_number": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "location_country_string": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2021-12-03T13:33:44.556Z", + "updated_at": "2022-07-26T13:57:42.288Z", + "object": "metadata_schema" + }, + { + "id": "ms_f0r4hm3ta6a4a5ch3ma", + "related_object": "customer", + "properties": { + "birth_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + }, + "CRM_created_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + }, + "customer_location": { + "type": "geopoint", + "array": false, + "optional": true, + "objectType": null + }, + "acquisition_channel": { + "eq": [ + "Facebook", + "Twitter", + "Website" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "customer_life_time_value": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2021-12-03T06:33:45.894Z", + "updated_at": "2022-07-14T15:15:34.928Z", + "object": "metadata_schema" + }, + { + "id": "ms_7X7krsG84H6MeNuIaKkb4LXN", + "related_object": "earning_rule", + "properties": { + "Type": { + "type": "string", + "array": false, + "optional": true, + "minLength": 6, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-07-27T08:54:07.980Z", + "updated_at": null, + "object": "metadata_schema" + }, + { + "id": "ms_OF36L2rk4EqhdxvZs56IW9iE", + "related_object": "loyalty_tier", + "properties": { + "has_funds": { + "type": "boolean", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-03-30T06:22:16.685Z", + "updated_at": "2022-07-27T08:55:01.628Z", + "object": "metadata_schema" + }, + { + "id": "ms_f1r5Tm3ta6a4a5ch3ma", + "related_object": "order", + "properties": { + "Payment": { + "type": "object", + "array": false, + "deleted": true, + "optional": true, + "objectType": "Payment" + }, + "day_of_week": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "location_id": { + "eq": [ + "L1", + "L2", + "L3" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "payment_mean": { + "eq": [ + "credit-card", + "wire-transfer", + "paypal" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "booking_end_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + }, + "booking_start_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + }, + "number_of_store_visits": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2021-12-03T06:33:45.798Z", + "updated_at": "2022-04-20T06:47:10.350Z", + "object": "metadata_schema" + }, + { + "id": "ms_0qgIlxP7bYb8H59DqpnWBCUN", + "related_object": "order_item", + "properties": { + "Size": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "Color": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "Thickness": { + "eq": [ + "Thin", + "Medium", + "Thick" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-03-11T13:32:55.029Z", + "updated_at": "2022-05-23T13:46:01.463Z", + "object": "metadata_schema" + }, + { + "id": "ms_s3c0N6m3ta6a4a5ch3ma", + "related_object": "product", + "properties": { + "color": { + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "origin": { + "type": "string", + "array": false, + "optional": true, + "minLength": 1, + "objectType": null + }, + "product_location": { + "type": "geopoint", + "array": false, + "optional": true, + "objectType": null + }, + "metadata_attribute_name_with_date_property": { + "type": "date", + "array": false, + "optional": true, + "objectType": null + }, + "metadata_attribute_name_with_number_property": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "metadata_attribute_name_with_boolean_property": { + "type": "boolean", + "array": false, + "optional": true, + "objectType": null + }, + "metadata_attribute_name_with_datetime_property": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2021-12-03T06:33:45.880Z", + "updated_at": "2022-07-14T15:46:47.994Z", + "object": "metadata_schema" + }, + { + "id": "ms_th8YHt9yFYY1yAA99XOasT5W", + "related_object": "promotion_tier", + "properties": { + "has_budget": { + "type": "boolean", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-01-24T07:22:21.523Z", + "updated_at": "2022-07-27T08:54:42.909Z", + "object": "metadata_schema" + }, + { + "id": "ms_Z7niydc0OpGjDRL4yB40niXn", + "related_object": "publication", + "properties": { + "year": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-03-30T06:23:49.715Z", + "updated_at": "2022-04-19T10:28:24.568Z", + "object": "metadata_schema" + }, + { + "id": "ms_t4ir0Dm3ta6a4a5ch3ma", + "related_object": "redemption", + "properties": { + "location_id": { + "eq": [ + "L1", + "L2", + "L3" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "store_names": { + "eq": [ + "Store 1 - New York - Broadway", + "Store 2 - Florida - Miami", + "Store 3 - London - Heathrow", + "Store 4 - Berlin - Alexanderplatz" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2021-12-03T06:33:45.890Z", + "updated_at": "2022-07-26T14:58:24.546Z", + "object": "metadata_schema" + }, + { + "id": "ms_EnSASZVEIDsZAYa8Z0nG8Rlg", + "related_object": "reward", + "properties": { + "Type": { + "type": "string", + "array": false, + "optional": true, + "objectType": null, + "exactLength": 4 + } + }, + "allow_defined_only": false, + "created_at": "2022-07-27T08:53:32.257Z", + "updated_at": "2022-07-27T08:53:48.542Z", + "object": "metadata_schema" + }, + { + "id": "ms_xUHvkRBPvVJAlWcTkVzufKx4", + "related_object": "voucher", + "properties": { + "unit": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "Region": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "Season": { + "eq": [ + "Spring", + "Summer", + "Fall", + "Winter" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "CATEGORY": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "active_on_calendar_month": { + "eq": [ + 1, + 2, + 3, + 5, + 7, + 9, + 10, + 11, + 12 + ], + "type": "number", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-01-24T07:22:01.281Z", + "updated_at": "2022-06-22T07:22:09.577Z", + "object": "metadata_schema" + } + ], + "total": 13 + } + } + } + } + } + } + } + } + }, + "/v1/metadata-schemas/{resource}": { + "parameters": [ + { "schema": { - "$ref": "#/components/schemas/22_obj_location_object" + "type": "string" + }, + "name": "resource", + "in": "path", + "required": true, + "description": "There is an infinite number of possibilities for retrieving metadata schemas by the resource type because you can define custom metadata schemas." + } + ], + "get": { + "operationId": "get-metadata-schema", + "tags": [ + "METADATA SCHEMAS API" + ], + "summary": "Get Metadata Schema", + "description": "Retrieve metadata schema per resource type.\n\n## Resource types\n\n### Standard\n\nYou can retrieve metadata schemas for the standard metadata schema definitions listed below. Add one of these types as the resource path parameter.\n\n- `campaign`\n- `customer`\n- `earning_rule`\n- `loyalty_tier`\n- `order`\n- `order_item`\n- `product`\n- `promotion_tier`\n- `publication`\n- `redemption`\n- `reward`\n- `voucher`\n\n### Custom\n\nThere is an infinite number of possibilities for retrieving metadata schemas by the resource type because you can define custom metadata schemas. Provide one of the resource types that you have defined as a resource type. [Read more](https://support.voucherify.io/article/99-schema-validation-metadata#add-metadata).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "The response does not include unknown metadata properties in the response, i.e. those that have been defined outside of the **Project Settings** > **Metadata Schema** definitions. For example, an unknown metadata property can be defined in the campaign manager.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/21_obj_metadata_schema_object" + }, + "examples": { + "earning_rule": { + "value": { + "id": "ms_27vMXZqBAkkqBoOuw8EYTRLn", + "related_object": "earning_rule", + "properties": { + "channel_id": { + "type": "string", + "array": true, + "optional": true, + "objectType": null, + "exactLength": 5 + }, + "channel_name": { + "eq": [ + "instagram", + "facebook", + "google", + "twitter", + "linkedin", + "website" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-08-25T13:09:59.970Z", + "updated_at": "2022-08-25T13:11:15.704Z", + "object": "metadata_schema" + } + }, + "campaign": { + "value": { + "id": "ms_psGSDpVl6JcPilPA7toZ83Kj", + "related_object": "campaign", + "properties": { + "region": { + "eq": [ + "EMEA", + "AMER", + "APAC" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-08-25T13:12:58.447Z", + "updated_at": null, + "object": "metadata_schema" + } + }, + "customer": { + "value": { + "id": "ms_f0r4hm3ta6a4a5ch3ma", + "related_object": "customer", + "properties": { + "age": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "city_id": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "location": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "favorite_brands": { + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "acquisition_channel": { + "eq": [ + "Facebook", + "Twitter", + "Website" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "customer_life_time_value": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2021-12-01T08:00:48.889Z", + "updated_at": "2022-09-12T07:34:49.163Z", + "object": "metadata_schema" + } + }, + "loyalty_tier": { + "value": { + "id": "ms_jHUoFlgepKVEftxK1pKPGZlO", + "related_object": "loyalty_tier", + "properties": { + "level_name": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "audience_restricted": { + "type": "boolean", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-08-25T13:14:54.954Z", + "updated_at": "2022-08-25T13:15:24.436Z", + "object": "metadata_schema" + } + }, + "order": { + "value": { + "id": "ms_f1r5Tm3ta6a4a5ch3ma", + "related_object": "order", + "properties": { + "card": { + "eq": [ + "Visa", + "MasterCard", + "Other" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "currency": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "location": { + "ne": [ + 1, + 2, + 18, + 22 + ], + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "store_city": { + "eq": [ + "Hampden", + "San Francisco", + "Warsaw" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "location_id": { + "eq": [ + "L1", + "L2", + "L3" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "payment_mean": { + "eq": [ + "credit-card", + "wire-transfer", + "paypal" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "booking_end_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + }, + "booking_start_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2021-12-01T08:00:47.575Z", + "updated_at": "2022-10-25T10:05:18.978Z", + "object": "metadata_schema" + } + }, + "order_item": { + "value": { + "id": "ms_7ux44AEnt82bqo8ww5V1SXzV", + "related_object": "order_item", + "properties": { + "manufacturer_id": { + "gte": 15, + "type": "number", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-08-25T13:16:03.167Z", + "updated_at": null, + "object": "metadata_schema" + } + }, + "product": { + "value": { + "id": "ms_s3c0N6m3ta6a4a5ch3ma", + "related_object": "product", + "properties": { + "vendor": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "category": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "location": { + "type": "geopoint", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2021-12-01T08:00:48.298Z", + "updated_at": "2022-07-14T15:53:29.226Z", + "object": "metadata_schema" + } + }, + "promotion_tier": { + "value": { + "id": "ms_dNb5aLMzU0VBCiRuxLOeMNwn", + "related_object": "promotion_tier", + "properties": { + "level": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-01-24T10:42:04.937Z", + "updated_at": "2022-09-23T08:51:46.266Z", + "object": "metadata_schema" + } + }, + "publication": { + "value": { + "id": "ms_fzvWNh7sU4LeykEQ2Abpg6jG", + "related_object": "publication", + "properties": { + "file_uploaded": { + "type": "image_url", + "array": false, + "optional": true, + "objectType": null + }, + "publication_method": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-08-25T13:16:35.534Z", + "updated_at": "2022-09-12T10:26:31.135Z", + "object": "metadata_schema" + } + }, + "redemption": { + "value": { + "id": "ms_t4ir0Dm3ta6a4a5ch3ma", + "related_object": "redemption", + "properties": { + "location_id": { + "eq": [ + "L1", + "L2", + "L3" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "redemption_location": { + "type": "object", + "array": false, + "optional": true, + "objectType": "Location" + } + }, + "allow_defined_only": false, + "created_at": "2021-12-01T08:00:48.794Z", + "updated_at": "2022-08-25T13:19:50.497Z", + "object": "metadata_schema" + } + }, + "reward": { + "value": { + "id": "ms_PwrAtwqCFXeH4Qix22gEkqhl", + "related_object": "reward", + "properties": { + "reward_type": { + "eq": [ + "MATERIAL", + "PAY-WITH-POINTS", + "DISCOUNT-COUPON", + "GIFT-CARD-CREDITS", + "LOYALTY POINTS" + ], + "type": "string", + "array": false, + "optional": false, + "objectType": null + } + }, + "allow_defined_only": true, + "created_at": "2022-08-25T13:07:13.689Z", + "updated_at": "2022-08-25T13:08:26.696Z", + "object": "metadata_schema" + } + }, + "voucher": { + "value": { + "id": "ms_9uE6eP17Jvoxl46mCqL6Q3Ut", + "related_object": "voucher", + "properties": { + "lang": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "Season": { + "eq": [ + "Spring", + "Summer", + "Fall", + "Winter" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "marketing_text": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "ProductionVoucherCodeMetaData": { + "type": "string", + "array": false, + "deleted": true, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-01-24T10:42:23.994Z", + "updated_at": "2022-09-19T14:13:30.590Z", + "object": "metadata_schema" + } + } + } + } + } + }, + "404": { + "description": "Returns an error if the resource provided in the path is not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find metadata schema with id earning_rules", + "request_id": "v-0c1b9ce0098a391421", + "resource_id": "earning_rules", + "resource_type": "metadata schema" + } + } + } + } + } } } } - } - } - } - }, - "/v1/locations": { - "get": { - "operationId": "list-locations", - "tags": [ - "LOCATIONS API" - ], - "summary": "List Locations", - "description": "Returns a list of your locations.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" }, - { - "name": "order", - "in": "query", - "required": false, - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ] - }, - "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." + "/v1/location-object": { + "get": { + "operationId": "location-object", + "tags": [ + "LOCATIONS API" + ], + "summary": "Location Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Location Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/22_obj_location_object" + } + } + } + } + } + } }, - { - "name": "filters", - "in": "query", - "required": false, - "schema": { - "anyOf": [ + "/v1/locations": { + "get": { + "operationId": "list-locations", + "tags": [ + "LOCATIONS API" + ], + "summary": "List Locations", + "description": "Returns a list of your locations.", + "parameters": [ { - "$ref": "#/components/schemas/22_filter_updated_at" + "$ref": "#/components/parameters/limit" }, { - "$ref": "#/components/schemas/22_filter_created_at" + "name": "order", + "in": "query", + "required": false, + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + }, + "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." }, { - "$ref": "#/components/schemas/22_filter_name" + "name": "filters", + "in": "query", + "required": false, + "schema": { + "anyOf": [ + { + "$ref": "#/components/schemas/22_filter_updated_at" + }, + { + "$ref": "#/components/schemas/22_filter_created_at" + }, + { + "$ref": "#/components/schemas/22_filter_name" + }, + { + "$ref": "#/components/schemas/22_filter_id" + } + ] + }, + "description": "Filter the locations using one of the available filters.", + "style": "deepObject", + "explode": true }, { - "$ref": "#/components/schemas/22_filter_id" + "name": "end_date", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + }, + "description": "A filter on the list based on the end date. This will filter out all locations who's end date falls before the specified date and time. A date value must be presented in ISO 8601 format (`2016-11-16T14:14:31Z` or `2016-11-16`)." } - ] - }, - "description": "Filter the locations using one of the available filters.", - "style": "deepObject", - "explode": true + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary that contains an array of locations. Each entry in the array is a separate location object. If no more locations are available, the resulting array will be empty. The result can be narrowed down according to specified (or default) filters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/22_res_list_locations" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "loc_NoMGXmHO9OUs7iz9mGWpamma", + "object": "location", + "name": "Belleville", + "shape": { + "type": "circle", + "format": "distance", + "distance": { + "center": "geo:40.79372699823857,-74.15092132694554", + "radius": "1.54 km" + } + }, + "created_at": "2022-07-15T06:04:36.924Z", + "updated_at": null + }, + { + "id": "loc_ae2gKWpAFMsuRhyMqGx2FZFF", + "object": "location", + "name": "New York", + "shape": { + "type": "polygon", + "format": "geojson", + "geojson": { + "type": "Polygon", + "coordinates": [ + [ + [ + -74.016167, + 40.703186 + ], + [ + -74.008687, + 40.750656 + ], + [ + -73.943597, + 40.851838 + ], + [ + -73.928559, + 40.845285 + ], + [ + -73.936152, + 40.8356 + ], + [ + -73.934298, + 40.810015 + ], + [ + -73.92711, + 40.795145 + ], + [ + -73.978623, + 40.710432 + ], + [ + -74.013201, + 40.701619 + ], + [ + -74.016167, + 40.703186 + ] + ] + ] + } + }, + "created_at": "2022-07-15T05:37:45.299Z", + "updated_at": null + }, + { + "id": "loc_f5HqjVaiq7g9ISlmivpytxSf", + "object": "location", + "name": "Germany", + "shape": { + "type": "circle", + "format": "distance", + "distance": { + "center": "geo:51.303908897065064,10.222253628401518", + "radius": "192.37 km" + } + }, + "created_at": "2022-07-14T15:51:39.265Z", + "updated_at": null + }, + { + "id": "loc_RcYz537sV07e1t5aG5tIH9FD", + "object": "location", + "name": "Poland", + "shape": { + "type": "polygon", + "format": "geojson", + "geojson": { + "type": "Polygon", + "coordinates": [ + [ + [ + 18.553923, + 50.559107 + ], + [ + 18.528805, + 51.087437 + ], + [ + 19.591667, + 50.832424 + ], + [ + 19.425109, + 50.497984 + ], + [ + 19.375814, + 50.330652 + ], + [ + 19.398107, + 50.111652 + ], + [ + 18.73906, + 49.981498 + ], + [ + 18.272477, + 50.088707 + ], + [ + 18.553923, + 50.559107 + ] + ] + ] + } + }, + "created_at": "2022-07-14T15:21:55.085Z", + "updated_at": null + } + ], + "total": 4, + "has_more": false + } + } + } + } + } + } + } + } }, - { - "name": "end_date", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "date-time" - }, - "description": "A filter on the list based on the end date. This will filter out all locations who's end date falls before the specified date and time. A date value must be presented in ISO 8601 format (`2016-11-16T14:14:31Z` or `2016-11-16`)." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary that contains an array of locations. Each entry in the array is a separate location object. If no more locations are available, the resulting array will be empty. The result can be narrowed down according to specified (or default) filters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/22_res_list_locations" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "loc_NoMGXmHO9OUs7iz9mGWpamma", - "object": "location", - "name": "Belleville", - "shape": { - "type": "circle", - "format": "distance", - "distance": { - "center": "geo:40.79372699823857,-74.15092132694554", - "radius": "1.54 km" - } - }, - "created_at": "2022-07-15T06:04:36.924Z", - "updated_at": null - }, - { - "id": "loc_ae2gKWpAFMsuRhyMqGx2FZFF", - "object": "location", - "name": "New York", - "shape": { - "type": "polygon", - "format": "geojson", - "geojson": { - "type": "Polygon", - "coordinates": [ - [ - [ - -74.016167, - 40.703186 - ], - [ - -74.008687, - 40.750656 - ], - [ - -73.943597, - 40.851838 - ], - [ - -73.928559, - 40.845285 - ], - [ - -73.936152, - 40.8356 - ], - [ - -73.934298, - 40.810015 - ], - [ - -73.92711, - 40.795145 - ], - [ - -73.978623, - 40.710432 - ], - [ - -74.013201, - 40.701619 - ], - [ - -74.016167, - 40.703186 - ] - ] - ] - } - }, - "created_at": "2022-07-15T05:37:45.299Z", - "updated_at": null - }, - { - "id": "loc_f5HqjVaiq7g9ISlmivpytxSf", - "object": "location", - "name": "Germany", - "shape": { - "type": "circle", - "format": "distance", - "distance": { - "center": "geo:51.303908897065064,10.222253628401518", - "radius": "192.37 km" - } - }, - "created_at": "2022-07-14T15:51:39.265Z", - "updated_at": null + "/v1/locations/{locationId}": { + "get": { + "operationId": "get-location", + "tags": [ + "LOCATIONS API" + ], + "summary": "Get Location", + "description": "Returns a location object.", + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "locationId", + "in": "path", + "required": true, + "description": "The unique location ID." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a location object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/22_obj_location_object" + }, + "examples": { + "Circle Example": { + "value": { + "id": "loc_NoMGXmHO9OUs7iz9mGWpamma", + "object": "location", + "name": "Belleville", + "shape": { + "type": "circle", + "format": "distance", + "distance": { + "center": "geo:40.79372699823857,-74.15092132694554", + "radius": "1.54 km" + } + }, + "created_at": "2022-07-15T06:04:36.924Z", + "updated_at": null + } }, - { - "id": "loc_RcYz537sV07e1t5aG5tIH9FD", - "object": "location", - "name": "Poland", - "shape": { - "type": "polygon", - "format": "geojson", - "geojson": { - "type": "Polygon", - "coordinates": [ - [ - [ - 18.553923, - 50.559107 - ], - [ - 18.528805, - 51.087437 - ], - [ - 19.591667, - 50.832424 - ], + "Polygon Example": { + "value": { + "id": "loc_RcYz537sV07e1t5aG5tIH9FD", + "object": "location", + "name": "Poland", + "shape": { + "type": "polygon", + "format": "geojson", + "geojson": { + "type": "Polygon", + "coordinates": [ [ - 19.425109, - 50.497984 - ], - [ - 19.375814, - 50.330652 - ], - [ - 19.398107, - 50.111652 - ], - [ - 18.73906, - 49.981498 - ], - [ - 18.272477, - 50.088707 - ], - [ - 18.553923, - 50.559107 + [ + 18.553923, + 50.559107 + ], + [ + 18.528805, + 51.087437 + ], + [ + 19.591667, + 50.832424 + ], + [ + 19.425109, + 50.497984 + ], + [ + 19.375814, + 50.330652 + ], + [ + 19.398107, + 50.111652 + ], + [ + 18.73906, + 49.981498 + ], + [ + 18.272477, + 50.088707 + ], + [ + 18.553923, + 50.559107 + ] ] ] - ] - } - }, - "created_at": "2022-07-14T15:21:55.085Z", - "updated_at": null + } + }, + "created_at": "2022-07-14T15:21:55.085Z", + "updated_at": null + } } - ], - "total": 4, - "has_more": false + } } } } } } - } - } - } - }, - "/v1/locations/{locationId}": { - "get": { - "operationId": "get-location", - "tags": [ - "LOCATIONS API" - ], - "summary": "Get Location", - "description": "Returns a location object.", - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "locationId", - "in": "path", - "required": true, - "description": "The unique location ID." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a location object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/22_obj_location_object" - }, - "examples": { - "Circle Example": { - "value": { - "id": "loc_NoMGXmHO9OUs7iz9mGWpamma", - "object": "location", - "name": "Belleville", - "shape": { - "type": "circle", - "format": "distance", - "distance": { - "center": "geo:40.79372699823857,-74.15092132694554", - "radius": "1.54 km" - } - }, - "created_at": "2022-07-15T06:04:36.924Z", - "updated_at": null - } - }, - "Polygon Example": { - "value": { - "id": "loc_RcYz537sV07e1t5aG5tIH9FD", - "object": "location", - "name": "Poland", - "shape": { - "type": "polygon", - "format": "geojson", - "geojson": { - "type": "Polygon", - "coordinates": [ - [ - [ - 18.553923, - 50.559107 - ], - [ - 18.528805, - 51.087437 - ], - [ - 19.591667, - 50.832424 - ], - [ - 19.425109, - 50.497984 - ], - [ - 19.375814, - 50.330652 - ], - [ - 19.398107, - 50.111652 - ], - [ - 18.73906, - 49.981498 - ], - [ - 18.272477, - 50.088707 - ], - [ - 18.553923, - 50.559107 - ] - ] - ] - } - }, - "created_at": "2022-07-14T15:21:55.085Z", - "updated_at": null + }, + "/v1/qualification-object": { + "get": { + "operationId": "qualification-object", + "tags": [ + "QUALIFICATIONS API" + ], + "summary": "Qualification Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Qualification Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/23_obj_qualification_object" + } } } } } } - } - } - } - }, - "/v1/qualification-object": { - "get": { - "operationId": "qualification-object", - "tags": [ - "QUALIFICATIONS API" - ], - "summary": "Qualification Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Qualification Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/23_obj_qualification_object" + }, + "/v1/qualifications": { + "post": { + "operationId": "check-eligibility", + "tags": [ + "QUALIFICATIONS API" + ], + "summary": "Check Eligibility", + "description": "Generate a list of redeemables that are applicable in the context of the customer and order.\n\nThe new qualifications method is an improved version of [Campaign Qualifications](ref:examine-campaigns-qualification), [Voucher Qualifications](ref:examine-vouchers-qualification), and [Promotions Validation](ref:validate-promotions) API requests. The new qualification method introduces the following improvements:\n\n- Qualification results are returned faster\n- No limit on the number of returned redeemables\n- Introduces new qualification scenarios, not available in the previous version\n\n> 👍 Scenario Guide\n>\n> Read our dedicated guide to learn about some use cases this endpoint can cover [here](doc:checking-eligibility).\n\n## Paging \n\nThe 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.\n\nTo process of paging the redeemables works in the following manner:\n\n- You send the first API request for Qualifications without the `starting_after` parameter.\n- The response will contain a parameter named `has_more`. If the parameter's value is set to `true`, then more redeemables are available.\n- 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.\n- 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.\n- Voucherify will return the next page of redeemables.\n- If the `has_more` parameter is set to `true`, apply steps 3-5 to get the next page of redeemables.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] } - } - } - } - } - } - }, - "/v1/qualifications": { - "post": { - "operationId": "check-eligibility", - "tags": [ - "QUALIFICATIONS API" - ], - "summary": "Check Eligibility", - "description": "Generate a list of redeemables that are applicable in the context of the customer and order.\n\nThe new qualifications method is an improved version of [Campaign Qualifications](ref:examine-campaigns-qualification), [Voucher Qualifications](ref:examine-vouchers-qualification), and [Promotions Validation](ref:validate-promotions) API requests. The new qualification method introduces the following improvements:\n\n- Qualification results are returned faster\n- No limit on the number of returned redeemables\n- Introduces new qualification scenarios, not available in the previous version\n\n> 👍 Scenario Guide\n>\n> Read our dedicated guide to learn about some use cases this endpoint can cover [here](doc:checking-eligibility).\n\n## Paging \n\nThe 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.\n\nTo process of paging the redeemables works in the following manner:\n\n- You send the first API request for Qualifications without the `starting_after` parameter.\n- The response will contain a parameter named `has_more`. If the parameter's value is set to `true`, then more redeemables are available.\n- 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.\n- 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.\n- Voucherify will return the next page of redeemables.\n- If the `has_more` parameter is set to `true`, apply steps 3-5 to get the next page of redeemables.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Define order and customer context.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/23_req_create_qualification" - } - } - } - }, - "responses": { - "200": { - "description": "Returns a qualifications object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/23_obj_qualification_object" + ], + "requestBody": { + "description": "Define order and customer context.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/23_req_create_qualification" + } + } + } + }, + "responses": { + "200": { + "description": "Returns a qualifications object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/23_obj_qualification_object" + } + } + } } } } - } - } - } - }, - "/client/v1/qualifications": { - "post": { - "operationId": "check-eligibility-client-side", - "tags": [ - "QUALIFICATIONS API" - ], - "summary": "Check Eligibility (client-side)", - "description": "Generate a list of redeemables that are applicable in the context of the customer and order.\n\nThe new qualifications method is an improved version of [Campaign Qualifications](ref:examine-campaigns-qualification), [Voucher Qualifications](ref:examine-vouchers-qualification), and [Promotions Validation](ref:validate-promotions) API requests. The new qualification method introduces the following improvements:\n\n- Qualification results are returned faster\n- No limit on the number of returned redeemables\n- Introduces new qualification scenarios, not available in the previous version\n\n> 👍 Scenario Guide\n>\n> Read our dedicated guide to learn about some use cases this endpoint can cover [here](doc:checking-eligibility).\n\n## Paging \n\nThe 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.\n\nTo process of paging the redeemables works in the following manner:\n\n- You send the first API request for Qualifications without the `starting_after` parameter.\n- The response will contain a parameter named `has_more`. If the parameter's value is set to `true`, then more redeemables are available.\n- 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.\n- 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.\n- Voucherify will return the next page of redeemables.\n- If the `has_more` parameter is set to `true`, apply steps 3-5 to get the next page of redeemables.", - "parameters": [], - "security": [ - { - "X-Client-Application-Id-1": [], - "X-Client-Token-1": [] - } - ], - "requestBody": { - "description": "Define order and customer context.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/23_req_create_qualification" - } - } - } - }, - "responses": { - "200": { - "description": "Returns a qualifications object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/23_obj_qualification_object" + }, + "/client/v1/qualifications": { + "post": { + "operationId": "check-eligibility-client-side", + "tags": [ + "QUALIFICATIONS API" + ], + "summary": "Check Eligibility (client-side)", + "description": "Generate a list of redeemables that are applicable in the context of the customer and order.\n\nThe new qualifications method is an improved version of [Campaign Qualifications](ref:examine-campaigns-qualification), [Voucher Qualifications](ref:examine-vouchers-qualification), and [Promotions Validation](ref:validate-promotions) API requests. The new qualification method introduces the following improvements:\n\n- Qualification results are returned faster\n- No limit on the number of returned redeemables\n- Introduces new qualification scenarios, not available in the previous version\n\n> 👍 Scenario Guide\n>\n> Read our dedicated guide to learn about some use cases this endpoint can cover [here](doc:checking-eligibility).\n\n## Paging \n\nThe 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.\n\nTo process of paging the redeemables works in the following manner:\n\n- You send the first API request for Qualifications without the `starting_after` parameter.\n- The response will contain a parameter named `has_more`. If the parameter's value is set to `true`, then more redeemables are available.\n- 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.\n- 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.\n- Voucherify will return the next page of redeemables.\n- If the `has_more` parameter is set to `true`, apply steps 3-5 to get the next page of redeemables.", + "parameters": [], + "security": [ + { + "X-Client-Application-Id-1": [], + "X-Client-Token-1": [] + } + ], + "requestBody": { + "description": "Define order and customer context.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/23_req_create_qualification" + } + } + } + }, + "responses": { + "200": { + "description": "Returns a qualifications object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/23_obj_qualification_object" + } + } + } } } } From e7fdec9bf0ef16cb87613102f682541d2dab7f4f Mon Sep 17 00:00:00 2001 From: weronika-kurczyna <117282008+weronika-kurczyna@users.noreply.github.com> Date: Tue, 17 Oct 2023 13:15:07 +0200 Subject: [PATCH 02/21] Revert "update list gift card transactions" This reverts commit 8960194f456d87febd621e6d49ea5f3f6eb0d9ba. --- Changelog.md | 2 - ...UCHERS-API-List-Gift-Card-Transactions.md} | 4 +- reference/OpenAPI.json | 154316 ++++++++------- 3 files changed, 77195 insertions(+), 77127 deletions(-) rename docs/reference-docs/{VOUCHERS-API-List-Voucher-Transactions.md => VOUCHERS-API-List-Gift-Card-Transactions.md} (85%) diff --git a/Changelog.md b/Changelog.md index addb76030..da4deaaf3 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,7 +1,5 @@ # Changelog -# 20231017 -- Vouchers - List Gift Card Transactions (**GET** `/vouchers/{code}/transactions`) renamed to List Voucher Transactions ## 20231012 - Product Collections diff --git a/docs/reference-docs/VOUCHERS-API-List-Voucher-Transactions.md b/docs/reference-docs/VOUCHERS-API-List-Gift-Card-Transactions.md similarity index 85% rename from docs/reference-docs/VOUCHERS-API-List-Voucher-Transactions.md rename to docs/reference-docs/VOUCHERS-API-List-Gift-Card-Transactions.md index d9c3268fd..0c0946408 100644 --- a/docs/reference-docs/VOUCHERS-API-List-Voucher-Transactions.md +++ b/docs/reference-docs/VOUCHERS-API-List-Gift-Card-Transactions.md @@ -1,8 +1,8 @@ --- -title: List Voucher Transactions +title: List Gift Card Transactions type: endpoint categorySlug: voucherify-api -slug: list-voucher-transactions +slug: list-gift-card-transactions parentDocSlug: vouchers-api hidden: false order: 11 diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index 98178cc31..dae42e817 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -3890,8 +3890,8 @@ } } }, - "vouchers_list_transactions_response_body": { - "title": "Get Voucher Transactions Response Body", + "1_res_vouchers_code_transactions": { + "title": "Get Gift Card Transactions Response Body", "type": "object", "description": "List of voucher transactions", "properties": { @@ -3909,58 +3909,36 @@ "type": "array", "description": "A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object.", "items": { - "$ref": "#/components/schemas/voucher_transaction" + "$ref": "#/components/schemas/1_obj_gift_card_transaction_object" } }, "has_more": { "type": "boolean", "description": "As query results are always limited (by the limit parameter), the `has_more` flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results." } - }, - "required": [ - "object", - "data_ref", - "data", - "has_more" - ] - }, - "voucher_transaction": { - "title": "Voucher Transaction", - "description": "Voucher transaction object", - "oneOf": [ - { - "$ref": "#/components/schemas/gift_card_transaction", - "x-stoplight": { - "id": "z5j73encc7u23" - } - }, - { - "$ref": "#/components/schemas/LoyaltyCardTransaction", - "x-stoplight": { - "id": "57gaoie3qn3il" - } - } - ] + } }, - "gift_card_transaction": { - "title": "Gift Card Transaction", + "1_obj_gift_card_transaction_object": { + "title": "Gift Card Transaction Object", "description": "Gift card transaction object", - "allOf": [ + "anyOf": [ { - "$ref": "#/components/schemas/gift_card_transaction_identity" + "$ref": "#/components/schemas/1_obj_gift_card_transaction_object_redemption" }, { - "$ref": "#/components/schemas/gift_card_transaction_base" + "$ref": "#/components/schemas/1_obj_gift_card_transaction_object_refund" }, { - "$ref": "#/components/schemas/gift_card_transaction_response_data" + "$ref": "#/components/schemas/1_obj_gift_card_transaction_object_addition" }, { - "$ref": "#/components/schemas/gift_card_transaction_details" + "$ref": "#/components/schemas/1_obj_gift_card_transaction_object_removal" } ] }, - "gift_card_transaction_identity": { + "1_obj_gift_card_transaction_object_redemption": { + "title": "Redemption", + "description": "When credits are used to pay for an order.", "type": "object", "properties": { "id": { @@ -3969,96 +3947,19 @@ "example": "vtx_0c9dccc4d5813e71bd" }, "source_id": { - "type": [ - "string", - "null" - ], + "type": "string", "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is `null`." - } - }, - "required": [ - "id", - "source_id" - ], - "title": "Gift Card Transaction Base" - }, - "gift_card_transaction_base": { - "type": "object", - "properties": { + }, "voucher_id": { "type": "string", "description": "Unique voucher ID.", "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" }, "campaign_id": { - "type": [ - "string", - "null" - ], + "type": "string", "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaing that generates bulk codes.", "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" }, - "related_transaction_id": { - "type": [ - "string", - "null" - ], - "description": "This field is `null` in the case of gift voucher transactions." - }, - "reason": { - "type": [ - "string", - "null" - ], - "description": "Reason why the transaction occurred. In case of a redemption, this value is `null`." - } - }, - "required": [ - "voucher_id", - "campaign_id", - "related_transaction_id", - "reason" - ], - "title": "Gift Card Transaction Base" - }, - "gift_card_transaction_response_data": { - "type": "object", - "title": "Gift Card Transaction Response Data", - "properties": { - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." - } - }, - "required": [ - "created_at" - ] - }, - "gift_card_transaction_details": { - "title": "Gift Card Transaction Details", - "anyOf": [ - { - "$ref": "#/components/schemas/gift_card_transaction_redemption_details" - }, - { - "$ref": "#/components/schemas/gift_card_transaction_refund_details" - }, - { - "$ref": "#/components/schemas/gift_card_transaction_addition_details" - }, - { - "$ref": "#/components/schemas/gift_card_transaction_removal_details" - } - ], - "type": "object" - }, - "gift_card_transaction_redemption_details": { - "title": "Redemption", - "description": "When credits are used to pay for an order.", - "type": "object", - "properties": { "source": { "type": "string", "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is `null`.", @@ -4067,6 +3968,10 @@ "API" ] }, + "reason": { + "type": "string", + "description": "Reason why the transaction occurred. In case of a redemption, this value is `null`." + }, "type": { "type": "string", "description": "Type of transaction.", @@ -4150,1685 +4055,2028 @@ } } } + }, + "related_transaction_id": { + "type": "string", + "description": "This field is `null` in the case of gift voucher transactions." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." } - }, - "gift_card_transaction_refund_details": { - "title": "Refund", - "description": "When funds are credited back to a card through a redemption rollback.", - "type": "object", - "properties": { - "source": { - "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption rollback, this value is `null`.", - "enum": [ - "voucherify-web-ui", - "API" - ] - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "CREDITS_REFUND", - "enum": [ - "CREDITS_REFUND" - ] - }, - "details": { - "type": "object", - "description": "Contains the detailed information about the transaction.", - "properties": { - "balance": { - "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", - "properties": { - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "gift_voucher" - }, - "total": { - "type": "integer", - "description": "Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "amount": { - "type": "integer", - "description": "The amount being returned. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, - "balance": { - "type": "integer", - "description": "The credit balance on the gift card after the amount is added back to the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "related_object": { - "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "type": { - "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" - } + } + }, + "1_obj_gift_card_transaction_object_refund": { + "title": "Refund", + "description": "When funds are credited back to a card through a redemption rollback.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique transaction ID.", + "example": "vtx_0c9dccc4d5813e71bd" + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption rollback, this value is `null`." + }, + "voucher_id": { + "type": "string", + "description": "Unique voucher ID.", + "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaing that generates bulk codes.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "source": { + "type": "string", + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption rollback, this value is `null`.", + "enum": [ + "voucherify-web-ui", + "API" + ] + }, + "reason": { + "type": "string", + "description": "Reason why the transaction occurred. In case of a redemption rollback, this value is `null`." + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "CREDITS_REFUND", + "enum": [ + "CREDITS_REFUND" + ] + }, + "details": { + "type": "object", + "description": "Contains the detailed information about the transaction.", + "properties": { + "balance": { + "type": "object", + "description": "Contains information on how the balance was affected by the transaction.", + "properties": { + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "gift_voucher" + }, + "total": { + "type": "integer", + "description": "Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "amount": { + "type": "integer", + "description": "The amount being returned. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON.", + "default": "balance" + }, + "balance": { + "type": "integer", + "description": "The credit balance on the gift card after the amount is added back to the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "related_object": { + "type": "object", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "type": { + "type": "string", + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" } } } - }, - "order": { - "type": "object", - "description": "Contains information about the original order.", - "properties": { - "id": { - "type": "string", - "description": "Unique order ID.", - "example": "ord_jj5EzDxDOd2xFPsAJJ18IaZK" - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - } + } + }, + "order": { + "type": "object", + "description": "Contains information about the original order.", + "properties": { + "id": { + "type": "string", + "description": "Unique order ID.", + "example": "ord_jj5EzDxDOd2xFPsAJJ18IaZK" + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." } - }, - "redemption": { - "type": "object", - "description": "Contains information about the original redemption.", - "properties": { - "id": { - "type": "string", - "description": "Unique redemption ID.", - "example": "r_0c94ed583fcafc31c1" - } + } + }, + "redemption": { + "type": "object", + "description": "Contains information about the original redemption.", + "properties": { + "id": { + "type": "string", + "description": "Unique redemption ID.", + "example": "r_0c94ed583fcafc31c1" } - }, - "rollback": { - "type": "object", - "description": "Contains information about the redemption rollback.", - "properties": { - "id": { - "type": "string", - "description": "Unique redemption rollback ID.", - "example": "rr_0c94edbb8d0bef5d9e" - } + } + }, + "rollback": { + "type": "object", + "description": "Contains information about the redemption rollback.", + "properties": { + "id": { + "type": "string", + "description": "Unique redemption rollback ID.", + "example": "rr_0c94edbb8d0bef5d9e" } } } } }, - "gift_card_transaction_addition_details": { - "title": "Addition", - "description": "When funds are deposited to a gift card.", + "related_transaction_id": { + "type": "string", + "description": "This field is `null` in the case of gift voucher transactions." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." + } + } + }, + "1_obj_gift_card_transaction_object_addition": { + "title": "Addition", + "description": "When funds are deposited to a gift card.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique transaction ID.", + "example": "vtx_0c9dccc4d5813e71bd" + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." + }, + "voucher_id": { + "type": "string", + "description": "Unique voucher ID.", + "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaing that generates bulk codes.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "source": { + "type": "string", + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", + "enum": [ + "voucherify-web-ui", + "API" + ] + }, + "reason": { + "type": "string", + "description": "Reason why the transaction occurred." + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "CREDITS_ADDITION", + "enum": [ + "CREDITS_ADDITION" + ] + }, + "details": { "type": "object", + "description": "Contains the detailed information about the transaction.", "properties": { - "source": { - "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", - "enum": [ - "voucherify-web-ui", - "API" - ] - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "CREDITS_ADDITION", - "enum": [ - "CREDITS_ADDITION" - ] - }, - "details": { + "balance": { "type": "object", - "description": "Contains the detailed information about the transaction.", + "description": "Contains information on how the balance was affected by the transaction.", "properties": { + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "gift_voucher" + }, + "total": { + "type": "integer", + "description": "Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "amount": { + "type": "integer", + "description": "The amount being added. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON.", + "default": "balance" + }, "balance": { + "type": "integer", + "description": "The credit balance on the gift card after the amount is added to the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "related_object": { "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", "properties": { - "type": { + "id": { "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "gift_voucher" - }, - "total": { - "type": "integer", - "description": "Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "amount": { - "type": "integer", - "description": "The amount being added. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" }, - "object": { + "type": { "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, - "balance": { - "type": "integer", - "description": "The credit balance on the gift card after the amount is added to the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "related_object": { - "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "type": { - "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" - } - } + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" } } } } - }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of gift voucher transactions." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." } } }, - "gift_card_transaction_removal_details": { - "title": "Removal", - "description": "When funds are removed from a gift card.", + "related_transaction_id": { + "type": "string", + "description": "This field is `null` in the case of gift voucher transactions." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." + } + } + }, + "1_obj_gift_card_transaction_object_removal": { + "title": "Removal", + "description": "When funds are removed from a gift card.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique transaction ID.", + "example": "vtx_0c9dccc4d5813e71bd" + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." + }, + "voucher_id": { + "type": "string", + "description": "Unique voucher ID.", + "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaing that generates bulk codes.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "source": { + "type": "string", + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", + "enum": [ + "voucherify-web-ui", + "API" + ] + }, + "reason": { + "type": "string", + "description": "Reason why the transaction occurred." + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "CREDITS_REMOVAL", + "enum": [ + "CREDITS_REMOVAL" + ] + }, + "details": { "type": "object", + "description": "Contains the detailed information about the transaction.", "properties": { - "source": { - "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", - "enum": [ - "voucherify-web-ui", - "API" - ] - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "CREDITS_REMOVAL", - "enum": [ - "CREDITS_REMOVAL" - ] - }, - "details": { + "balance": { "type": "object", - "description": "Contains the detailed information about the transaction.", + "description": "Contains information on how the balance was affected by the transaction.", "properties": { + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "gift_voucher" + }, + "total": { + "type": "integer", + "description": "Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "amount": { + "type": "integer", + "description": "The amount being subtracted. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON.", + "default": "balance" + }, "balance": { + "type": "integer", + "description": "The credit balance on the gift card after the amount is subtracted from the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "related_object": { "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", "properties": { - "type": { + "id": { "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "gift_voucher" - }, - "total": { - "type": "integer", - "description": "Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "amount": { - "type": "integer", - "description": "The amount being subtracted. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" }, - "object": { + "type": { "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, - "balance": { - "type": "integer", - "description": "The credit balance on the gift card after the amount is subtracted from the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "related_object": { - "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "type": { - "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" - } - } + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" } } } } } - }, - "1_req_create_gift_card_transactions_export": { - "type": "object", - "title": "Create Gift Card Transactions Export Request Body", - "description": "Request body schema for **POST** `/vouchers/transactions/export`.", - "properties": { - "parameters": { - "$ref": "#/components/schemas/1_obj_export_gift_card_transactions", - "description": "Contains the parameters that define the data to be exported." - } - } - }, - "1_obj_export_gift_card_transactions": { - "description": "List of available fields and filters that can be exported with a gift card transactions export along with the sorting order of the returned data.", - "title": "Export Transactions", - "type": "object", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "-created_at", - "created_at" - ] - }, - "fields": { - "type": "array", - "enum": [ - [ - "id", - "type", - "source_id", - "reason", - "balance", - "amount", - "created_at", - "voucher_id", - "campaign_id", - "source", - "details" - ] - ], - "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
                  - `CREDITS_ADDITION`
                  - `CREDITS_REFUND`
                  - `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |", - "items": { - "type": "string" - } - } + } + }, + "related_transaction_id": { + "type": "string", + "description": "This field is `null` in the case of gift voucher transactions." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." + } + } + }, + "1_req_create_gift_card_transactions_export": { + "type": "object", + "title": "Create Gift Card Transactions Export Request Body", + "description": "Request body schema for **POST** `/vouchers/transactions/export`.", + "properties": { + "parameters": { + "$ref": "#/components/schemas/1_obj_export_gift_card_transactions", + "description": "Contains the parameters that define the data to be exported." + } + } + }, + "1_obj_export_gift_card_transactions": { + "description": "List of available fields and filters that can be exported with a gift card transactions export along with the sorting order of the returned data.", + "title": "Export Transactions", + "type": "object", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "-created_at", + "created_at" + ] + }, + "fields": { + "type": "array", + "enum": [ + [ + "id", + "type", + "source_id", + "reason", + "balance", + "amount", + "created_at", + "voucher_id", + "campaign_id", + "source", + "details" + ] + ], + "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
                  - `CREDITS_ADDITION`
                  - `CREDITS_REFUND`
                  - `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |", + "items": { + "type": "string" + } + } + } + }, + "1_obj_export_transactions_object": { + "title": "Export Object", + "type": "object", + "description": "This is an object representing an export. \n\n Using this endpoint, you can export [gift card transactions](ref:list-gift-card-transactions) as a CSV file. This functionality works asynchronously and comes down to the following steps: \n* create an export object and return its `id` so you can track its `status`\n* trigger a CSV file generation, change the status to `SCHEDULED`\n* when the generation is over, store the file in S3 and change the `status` to `DONE`\n* now you can (ref:download-export) it\n\nWith `parameters` you can select which `fields` will be exported. An export request will almost always result in a single file being generated by the system. However, when your volume of data is large, the system may split the results into multiple chunks.", + "properties": { + "id": { + "type": "string", + "description": "Unique export ID.", + "example": "exp_FFfp9o7daWuJqJCKp5xqqli4" + }, + "object": { + "type": "string", + "default": "export", + "description": "The type of object being represented. This object stores information about the `export`." + }, + "created_at": { + "type": "string", + "example": "2022-04-28T11:23:20.922Z", + "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format.", + "format": "date-time" + }, + "status": { + "type": "string", + "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.", + "enum": [ + "SCHEDULED", + "IN_PROGRESS", + "DONE", + "ERROR" + ] + }, + "channel": { + "type": "string", + "description": "The channel through which the export was triggered.", + "default": "API" + }, + "exported_object": { + "type": "string", + "description": "The type of exported object.", + "default": "voucher_transactions" + }, + "parameters": { + "$ref": "#/components/schemas/16_obj_export_gift_card_transactions" + }, + "result": { + "type": "object", + "description": "Contains the URL of the CSV file.", + "properties": { + "url": { + "type": "string", + "description": "URL of the CSV file location. It contains the `token` used for authorization in the [Download export](ref:download-export) method." } + } + }, + "user_id": { + "type": "string", + "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the `channel` value is `WEBSITE`.", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH" + } + } + }, + "1_req_vouchers_import": { + "title": "Import Vouchers Request Body", + "type": "array", + "description": "Request body schema for **POST** `/vouchers/import`.", + "items": { + "anyOf": [ + { + "$ref": "#/components/schemas/1_obj_vouchers_import_gift_voucher" }, - "1_obj_export_transactions_object": { - "title": "Export Object", - "type": "object", - "description": "This is an object representing an export. \n\n Using this endpoint, you can export [gift card transactions](ref:list-gift-card-transactions) as a CSV file. This functionality works asynchronously and comes down to the following steps: \n* create an export object and return its `id` so you can track its `status`\n* trigger a CSV file generation, change the status to `SCHEDULED`\n* when the generation is over, store the file in S3 and change the `status` to `DONE`\n* now you can (ref:download-export) it\n\nWith `parameters` you can select which `fields` will be exported. An export request will almost always result in a single file being generated by the system. However, when your volume of data is large, the system may split the results into multiple chunks.", - "properties": { - "id": { - "type": "string", - "description": "Unique export ID.", - "example": "exp_FFfp9o7daWuJqJCKp5xqqli4" - }, - "object": { - "type": "string", - "default": "export", - "description": "The type of object being represented. This object stores information about the `export`." - }, - "created_at": { - "type": "string", - "example": "2022-04-28T11:23:20.922Z", - "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format.", - "format": "date-time" - }, - "status": { - "type": "string", - "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.", - "enum": [ - "SCHEDULED", - "IN_PROGRESS", - "DONE", - "ERROR" - ] - }, - "channel": { - "type": "string", - "description": "The channel through which the export was triggered.", - "default": "API" - }, - "exported_object": { - "type": "string", - "description": "The type of exported object.", - "default": "voucher_transactions" - }, - "parameters": { - "$ref": "#/components/schemas/16_obj_export_gift_card_transactions" - }, - "result": { - "type": "object", - "description": "Contains the URL of the CSV file.", - "properties": { - "url": { - "type": "string", - "description": "URL of the CSV file location. It contains the `token` used for authorization in the [Download export](ref:download-export) method." - } - } - }, - "user_id": { - "type": "string", - "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the `channel` value is `WEBSITE`.", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH" - } + { + "$ref": "#/components/schemas/1_obj_vouchers_import_discount_voucher" + } + ] + } + }, + "1_obj_vouchers_import_gift_voucher": { + "title": "Import Gift Voucher", + "type": "object", + "description": "Object model for gift voucher object being imported.", + "properties": { + "code": { + "type": "string", + "description": "Value representing the imported code." + }, + "category": { + "type": "string", + "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the [List Vouchers](ref:list-vouchers) endpoint." + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" + }, + "type": { + "type": "string", + "description": "Represents the voucher type. ", + "default": "GIFT_VOUCHER" + }, + "gift": { + "type": "object", + "properties": { + "amount": { + "type": "string", + "description": "Total gift card income. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." } }, - "1_req_vouchers_import": { - "title": "Import Vouchers Request Body", - "type": "array", - "description": "Request body schema for **POST** `/vouchers/import`.", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/1_obj_vouchers_import_gift_voucher" - }, - { - "$ref": "#/components/schemas/1_obj_vouchers_import_discount_voucher" - } - ] + "required": [ + "amount" + ] + }, + "start_date": { + "type": "string", + "description": "Activation timestamp in ISO 8601 format. Voucher is *inactive before* this date. Start date defines when the code starts to be active.\nAllowed date formats are:\n- YYYY-MM-DD\n- YYYY-MM-DDTHH\n- YYYY-MM-DDTHH:mm\n- YYYY-MM-DDTHH:mm:ss\n- YYYY-MM-DDTHH:mm:ssZ\n- YYYY-MM-DDTHH:mm:ss.SSSZ", + "format": "date-time", + "example": "2020-12-28T12:49:16.272Z" + }, + "expiration_date": { + "type": "string", + "description": "Expiration date defines when the code expires. Expiration timestamp in ISO 8601 format. Voucher is *inactive after* this date.\nAllowed date formats are:\n- YYYY-MM-DD\n- YYYY-MM-DDTHH\n- YYYY-MM-DDTHH:mm\n- YYYY-MM-DDTHH:mm:ss\n- YYYY-MM-DDTHH:mm:ssZ\n- YYYY-MM-DDTHH:mm:ss.SSSZ", + "format": "date-time", + "example": "2053-12-28T12:49:16.272Z" + }, + "redemption": { + "type": "object", + "description": "Stores the quantity of redemptions that can be applied to the voucher.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited.", + "example": 10 } - }, - "1_obj_vouchers_import_gift_voucher": { - "title": "Import Gift Voucher", - "type": "object", - "description": "Object model for gift voucher object being imported.", - "properties": { - "code": { - "type": "string", - "description": "Value representing the imported code." - }, - "category": { - "type": "string", - "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the [List Vouchers](ref:list-vouchers) endpoint." - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" - }, - "type": { - "type": "string", - "description": "Represents the voucher type. ", - "default": "GIFT_VOUCHER" - }, - "gift": { - "type": "object", - "properties": { - "amount": { - "type": "string", - "description": "Total gift card income. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - } - }, - "required": [ - "amount" - ] - }, - "start_date": { - "type": "string", - "description": "Activation timestamp in ISO 8601 format. Voucher is *inactive before* this date. Start date defines when the code starts to be active.\nAllowed date formats are:\n- YYYY-MM-DD\n- YYYY-MM-DDTHH\n- YYYY-MM-DDTHH:mm\n- YYYY-MM-DDTHH:mm:ss\n- YYYY-MM-DDTHH:mm:ssZ\n- YYYY-MM-DDTHH:mm:ss.SSSZ", - "format": "date-time", - "example": "2020-12-28T12:49:16.272Z" - }, - "expiration_date": { - "type": "string", - "description": "Expiration date defines when the code expires. Expiration timestamp in ISO 8601 format. Voucher is *inactive after* this date.\nAllowed date formats are:\n- YYYY-MM-DD\n- YYYY-MM-DDTHH\n- YYYY-MM-DDTHH:mm\n- YYYY-MM-DDTHH:mm:ss\n- YYYY-MM-DDTHH:mm:ssZ\n- YYYY-MM-DDTHH:mm:ss.SSSZ", - "format": "date-time", - "example": "2053-12-28T12:49:16.272Z" - }, - "redemption": { - "type": "object", - "description": "Stores the quantity of redemptions that can be applied to the voucher.", - "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited.", - "example": 10 - } - } + } + }, + "additional_info": { + "type": "string", + "description": "An optional field to keep any extra textual information about the code such as a code description and details." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + } + }, + "required": [ + "code" + ] + }, + "1_obj_vouchers_import_discount_voucher": { + "title": "Import Discount Voucher", + "type": "object", + "description": "Object model for discount voucher object being imported.", + "properties": { + "code": { + "type": "string", + "description": "Value representing the imported code." + }, + "category": { + "type": "string", + "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the [List Vouchers](ref:list-vouchers) endpoint." + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" + }, + "type": { + "type": "string", + "description": "Represents the voucher type.", + "default": "DISCOUNT_VOUCHER" + }, + "discount": { + "anyOf": [ + { + "$ref": "#/components/schemas/1_obj_vouchers_import_discount_amount" + }, + { + "$ref": "#/components/schemas/1_obj_vouchers_import_discount_percentage" + }, + { + "$ref": "#/components/schemas/1_obj_vouchers_import_discount_fixed" + }, + { + "$ref": "#/components/schemas/1_obj_vouchers_import_discount_unit_one" + }, + { + "$ref": "#/components/schemas/1_obj_vouchers_import_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/1_obj_vouchers_import_discount_shipping" + } + ] + }, + "start_date": { + "type": "string", + "description": "Activation timestamp in ISO 8601 format. Voucher is *inactive before* this date. Start date defines when the code starts to be active.\nAllowed formats of dates are:\n- YYYY-MM-DD\n- YYYY-MM-DDTHH\n- YYYY-MM-DDTHH:mm\n- YYYY-MM-DDTHH:mm:ss\n- YYYY-MM-DDTHH:mm:ssZ\n- YYYY-MM-DDTHH:mm:ss.SSSZ", + "format": "date-time", + "example": "2020-12-28T12:49:16.272Z" + }, + "expiration_date": { + "type": "string", + "description": "Expiration date defines when the code expires. Expiration timestamp in ISO 8601 format. Voucher is *inactive after* this date.\nAllowed formats of dates are:\n- YYYY-MM-DD\n- YYYY-MM-DDTHH\n- YYYY-MM-DDTHH:mm\n- YYYY-MM-DDTHH:mm:ss\n- YYYY-MM-DDTHH:mm:ssZ\n- YYYY-MM-DDTHH:mm:ss.SSSZ", + "format": "date-time", + "example": "2053-12-28T12:49:16.272Z" + }, + "redemption": { + "type": "object", + "description": "Stores the quantity of redemptions that can be applied to the voucher.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited.", + "example": 10 + } + } + }, + "additional_info": { + "type": "string", + "description": "An optional field to keep any extra textual information about the code such as a code description and details." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + } + }, + "required": [ + "code" + ] + }, + "1_req_vouchers_importCSV": { + "type": "object", + "title": "Import Vouchers by CSV Request Body", + "description": "Request body schema for `vouchers/importCSV`.", + "format": "binary", + "properties": { + "file": { + "type": "string", + "format": "binary", + "description": "The property name 'file' will be used for the file path." + } + } + }, + "1_res_vouchers_qualification": { + "title": "Vouchers Qualification Response Body", + "type": "object", + "description": "Response body schema for vouchers/qualification", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. Default is `list`." + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of qualified vouchers." + }, + "data": { + "type": "array", + "description": "Array of qualified vouchers.", + "items": { + "allOf": [ + { + "$ref": "#/components/schemas/1_obj_voucher_object" }, - "additional_info": { - "type": "string", - "description": "An optional field to keep any extra textual information about the code such as a code description and details." + { + "$ref": "#/components/schemas/1_res_obj_vouchers_qualification_applicable_to" }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + { + "$ref": "#/components/schemas/1_res_obj_vouchers_qualification_inapplicable_to" } - }, - "required": [ - "code" ] + } + }, + "total": { + "type": "integer", + "example": 37, + "description": "Total valid and active vouchers matching the qualification criteria in given context. " + }, + "id": { + "type": "string", + "example": "qfl_nAMVLoxIqSLh9O6YmfoAXRPG", + "description": "Unique qualification ID." + }, + "created_at": { + "type": "string", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the qualification was created in ISO 8601 format.", + "format": "date-time" + }, + "tracking_id": { + "type": "string", + "description": "Hashed customer source ID." + } + } + }, + "1_res_obj_vouchers_qualification_applicable_to": { + "title": "ApplicableToObject", + "type": "object", + "description": "", + "properties": { + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" + } + } + }, + "1_res_obj_vouchers_qualification_inapplicable_to": { + "title": "InapplicableToObject", + "type": "object", + "properties": { + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" + } + } + }, + "1_req_vouchers_bulk_async": { + "title": "Vouchers Bulk Async Request Body", + "type": "array", + "description": "Array of objects each containing the code to be updated and the metadata object containing the key/value pairs to be updated.", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Unique voucher code." }, - "1_obj_vouchers_import_discount_voucher": { - "title": "Import Discount Voucher", + "metadata": { "type": "object", - "description": "Object model for discount voucher object being imported.", - "properties": { - "code": { - "type": "string", - "description": "Value representing the imported code." - }, - "category": { - "type": "string", - "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the [List Vouchers](ref:list-vouchers) endpoint." - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" - }, - "type": { - "type": "string", - "description": "Represents the voucher type.", - "default": "DISCOUNT_VOUCHER" - }, - "discount": { + "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + } + } + } + }, + "1_req_vouchers_qualification": { + "title": "Vouchers Qualification Request Body", + "type": "object", + "description": "Request body schema for /vouchers/qualification.", + "properties": { + "customer": { + "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_customer" + }, + "order": { + "type": "object", + "description": "Tracks purchase transactions. You can send the order in the request body to check against vouchers requiring specific order validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", + "properties": { + "id": { + "type": "string", + "description": "The ID of an existing order in Voucherify's system that will be linked to the redemption of this request. This ID was assigned by the Voucherify API. You can send the order id in the request body to check against vouchers requiring specific order validation rules to be satisfied.", + "example": "ord_gqj1QYW2j2A1E3Ula2YjdPf4" + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of an integration between multiple systems. It can be an order ID from a CRM system, database or 3rd-party service." + }, + "amount": { + "type": "integer", + "minimum": 0, + "description": "Pre-discount order amount represents the total amount of order items' amounts (sum of each item's `amount` property). You can send the total order amount or the amount of each item individually in the request body to check against vouchers requiring specific total order amount validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order volume_ → _Total amount_ \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "items": { + "type": "array", + "description": "List of Order Items constituting the order. Order items can be defined either by `product_id` or `sku_id`. For every item, you must define the quantity.", + "items": { "anyOf": [ { - "$ref": "#/components/schemas/1_obj_vouchers_import_discount_amount" - }, - { - "$ref": "#/components/schemas/1_obj_vouchers_import_discount_percentage" + "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_product" }, { - "$ref": "#/components/schemas/1_obj_vouchers_import_discount_fixed" + "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_sku" }, { - "$ref": "#/components/schemas/1_obj_vouchers_import_discount_unit_one" + "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_product_using_product_id" }, { - "$ref": "#/components/schemas/1_obj_vouchers_import_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/1_obj_vouchers_import_discount_shipping" + "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_product_using_source_id" } ] - }, - "start_date": { - "type": "string", - "description": "Activation timestamp in ISO 8601 format. Voucher is *inactive before* this date. Start date defines when the code starts to be active.\nAllowed formats of dates are:\n- YYYY-MM-DD\n- YYYY-MM-DDTHH\n- YYYY-MM-DDTHH:mm\n- YYYY-MM-DDTHH:mm:ss\n- YYYY-MM-DDTHH:mm:ssZ\n- YYYY-MM-DDTHH:mm:ss.SSSZ", - "format": "date-time", - "example": "2020-12-28T12:49:16.272Z" - }, - "expiration_date": { - "type": "string", - "description": "Expiration date defines when the code expires. Expiration timestamp in ISO 8601 format. Voucher is *inactive after* this date.\nAllowed formats of dates are:\n- YYYY-MM-DD\n- YYYY-MM-DDTHH\n- YYYY-MM-DDTHH:mm\n- YYYY-MM-DDTHH:mm:ss\n- YYYY-MM-DDTHH:mm:ssZ\n- YYYY-MM-DDTHH:mm:ss.SSSZ", - "format": "date-time", - "example": "2053-12-28T12:49:16.272Z" - }, - "redemption": { - "type": "object", - "description": "Stores the quantity of redemptions that can be applied to the voucher.", - "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited.", - "example": 10 - } - } - }, - "additional_info": { - "type": "string", - "description": "An optional field to keep any extra textual information about the code such as a code description and details." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." } }, - "required": [ - "code" - ] - }, - "1_req_vouchers_importCSV": { - "type": "object", - "title": "Import Vouchers by CSV Request Body", - "description": "Request body schema for `vouchers/importCSV`.", - "format": "binary", - "properties": { - "file": { - "type": "string", - "format": "binary", - "description": "The property name 'file' will be used for the file path." - } - } - }, - "1_res_vouchers_qualification": { - "title": "Vouchers Qualification Response Body", - "type": "object", - "description": "Response body schema for vouchers/qualification", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. Default is `list`." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of qualified vouchers." - }, - "data": { - "type": "array", - "description": "Array of qualified vouchers.", - "items": { - "allOf": [ - { - "$ref": "#/components/schemas/1_obj_voucher_object" - }, - { - "$ref": "#/components/schemas/1_res_obj_vouchers_qualification_applicable_to" - }, - { - "$ref": "#/components/schemas/1_res_obj_vouchers_qualification_inapplicable_to" - } - ] - } - }, - "total": { - "type": "integer", - "example": 37, - "description": "Total valid and active vouchers matching the qualification criteria in given context. " - }, - "id": { - "type": "string", - "example": "qfl_nAMVLoxIqSLh9O6YmfoAXRPG", - "description": "Unique qualification ID." - }, - "created_at": { - "type": "string", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the qualification was created in ISO 8601 format.", - "format": "date-time" - }, - "tracking_id": { - "type": "string", - "description": "Hashed customer source ID." - } - } - }, - "1_res_obj_vouchers_qualification_applicable_to": { - "title": "ApplicableToObject", - "type": "object", - "description": "", - "properties": { - "applicable_to": { - "$ref": "#/components/schemas/6_res_applicable_to_object" - } + "customer": { + "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_customer" + }, + "referrer": { + "description": "The person who referred the customer to make the order.", + "type": "object" + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order** metadata validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Order metadata satisfy_ or _Basic Builder_ → _Attributes match_ → _ORDER METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." } - }, - "1_res_obj_vouchers_qualification_inapplicable_to": { - "title": "InapplicableToObject", - "type": "object", - "properties": { - "inapplicable_to": { - "$ref": "#/components/schemas/6_res_inapplicable_to_object" - } + } + }, + "reward": { + "type": "object", + "properties": { + "points": { + "type": "integer" + }, + "assignment_id": { + "type": "string" + }, + "id": { + "type": "string" } - }, - "1_req_vouchers_bulk_async": { - "title": "Vouchers Bulk Async Request Body", - "type": "array", - "description": "Array of objects each containing the code to be updated and the metadata object containing the key/value pairs to be updated.", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - } - } + } + }, + "metadata": { + "type": "object", + "description": "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 qualification runs against rules that are defined through the [Create Validation Rules](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + } + } + }, + "1_req_obj_vouchers_qualification_customer": { + "title": "Customer Object", + "type": "object", + "description": "This object stores customer details. You can send this object in the request body to check against vouchers requiring specific customer validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](https://docs.voucherify.io/reference/create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Audience_ → _Customer segment_ or _Basic Builder_ → _Customer Activity_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). ", + "properties": { + "id": { + "type": "string", + "description": "The ID of an existing customer that will be linked to the redemption in this request. This ID was assigned by the Voucherify API.", + "example": "cust_J1CDUdbqn5Exva8ASWk1Fq0j" + }, + "source_id": { + "type": "string", + "description": "A unique customer identifier. This is a tracking identifier of a user that is validating a voucher. The `source_id` is built based on your internal id (e.g., email, database ID). If you also pass a customer ID, the source ID will be ignored. Otherwise, if you do not pass a customer ID, the source ID you provide must either be a token, like the one returned in the original voucher validation method done by a specific customer, or a string identifying the customer (e.g., email, database ID, CRM ID).", + "example": "firstname.lastname@mycompany.com" + }, + "name": { + "type": "string", + "description": "First and Last Name. You can send the name in the request body to check against vouchers requiring specific name validation rules to be satisfied.", + "example": "FirstName LastName" + }, + "email": { + "type": "string", + "description": "You can send the email in the request body to check against vouchers requiring specific email validation rules to be satisfied.", + "example": "firstname.lastname@mycompany.com" + }, + "phone": { + "type": "string", + "minLength": 1, + "maxLength": 30, + "pattern": "^[-+.() 0-9]", + "description": "You can send the phone in the request body to check against vouchers requiring specific phone validation rules to be satisfied." + }, + "address": { + "type": "object", + "additionalProperties": false, + "description": "A set of key/value pairs which describes the address. You can send the address in the request body to check against vouchers requiring specific address validation rules to be satisfied.", + "properties": { + "city": { + "type": "string", + "description": "You can send the city in the request body to check against vouchers requiring specific city validation rules to be satisfied.", + "example": "New York" + }, + "country": { + "type": "string", + "description": "You can send the country in the request body to check against vouchers requiring specific country validation rules to be satisfied.", + "example": "United States of America" + }, + "postal_code": { + "type": "string", + "description": "You can send the postal code in the request body to check against vouchers requiring specific postal code validation rules to be satisfied.", + "example": "10001" + }, + "state": { + "type": "string", + "description": "You can send the state in the request body to check against vouchers requiring specific state validation rules to be satisfied.", + "example": "NY" } - }, - "1_req_vouchers_qualification": { - "title": "Vouchers Qualification Request Body", - "type": "object", - "description": "Request body schema for /vouchers/qualification.", - "properties": { - "customer": { - "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_customer" - }, - "order": { - "type": "object", - "description": "Tracks purchase transactions. You can send the order in the request body to check against vouchers requiring specific order validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", - "properties": { - "id": { - "type": "string", - "description": "The ID of an existing order in Voucherify's system that will be linked to the redemption of this request. This ID was assigned by the Voucherify API. You can send the order id in the request body to check against vouchers requiring specific order validation rules to be satisfied.", - "example": "ord_gqj1QYW2j2A1E3Ula2YjdPf4" - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of an integration between multiple systems. It can be an order ID from a CRM system, database or 3rd-party service." - }, - "amount": { - "type": "integer", - "minimum": 0, - "description": "Pre-discount order amount represents the total amount of order items' amounts (sum of each item's `amount` property). You can send the total order amount or the amount of each item individually in the request body to check against vouchers requiring specific total order amount validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order volume_ → _Total amount_ \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "items": { - "type": "array", - "description": "List of Order Items constituting the order. Order items can be defined either by `product_id` or `sku_id`. For every item, you must define the quantity.", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_product" - }, - { - "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_sku" - }, - { - "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_product_using_product_id" - }, - { - "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_product_using_source_id" - } - ] - } - }, - "customer": { - "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_customer" - }, - "referrer": { - "description": "The person who referred the customer to make the order.", - "type": "object" - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order** metadata validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Order metadata satisfy_ or _Basic Builder_ → _Attributes match_ → _ORDER METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - } - } - }, - "reward": { - "type": "object", - "properties": { - "points": { - "type": "integer" - }, - "assignment_id": { - "type": "string" - }, - "id": { - "type": "string" - } - } - }, - "metadata": { - "type": "object", - "description": "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 qualification runs against rules that are defined through the [Create Validation Rules](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." - } + } + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **customer** metadata validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Audience_ → _Customer metadata satisfy_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "birthdate": { + "type": "string", + "example": "2022-01-01", + "format": "date", + "description": "You can send the birthdate in the request body to check against vouchers requiring specific birthdate validation rules to be satisfied." + } + } + }, + "1_req_obj_vouchers_qualification_product": { + "title": "Product Item", + "type": "object", + "description": "Schema model for a product item. You can send this object in the request body to check against vouchers requiring specific product validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", + "properties": { + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system. __Requires__ the `related_object` property to be defined. \n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on Source Id filters_ . [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", + "example": "product_1234" + }, + "product_id": { + "type": "string", + "description": "A unique identifier that represents the product and is assigned by Voucherify.", + "example": "prod_0a9f9aeddb019a42db" + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`). You can send the total item amount to check against vouchers requiring specific order amount validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order volume_ → _Total amount_. The qualification adds the individual amounts of the items and checks whether the sum meets the limits set by the _Total amount_. Additionally, another rule checked is one that is defined in _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Subtotal of matched items_. \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.\n", + "example": 10000 + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart. \n\nThe qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. Another validation rule against which the qualification does the checks is defined in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Quantity of matched items_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", + "example": 1 + }, + "price": { + "type": "integer", + "description": "Unit price of an item. [This is not true in the case of using sourceid what was the case that this happened.]This `price` property takes precedence. If you provide a value at this level, then a price property defined once again in the `related_object` will be ignored. If this property will not be defined here, then the `price` property in the `related_object` will be used in the qualification.\n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Unit Price of any matching order line_ and also _Order Volume_ → _Price of each item/Price of any item_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).\n\n Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order line item** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Metadata of matched items_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "related_object": { + "type": "string", + "enum": [ + "product" + ], + "description": "A reference to the object containing details of the related product. __Required__ when sending `source_id` in payload." + }, + "product": { + "type": "object", + "description": "An object containing details of the related product. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", + "properties": { + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "product_1234" + }, + "name": { + "type": "string", + "description": "Product name.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on name filters_.", + "example": "Phone" + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." } - }, - "1_req_obj_vouchers_qualification_customer": { - "title": "Customer Object", - "type": "object", - "description": "This object stores customer details. You can send this object in the request body to check against vouchers requiring specific customer validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](https://docs.voucherify.io/reference/create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Audience_ → _Customer segment_ or _Basic Builder_ → _Customer Activity_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). ", - "properties": { - "id": { - "type": "string", - "description": "The ID of an existing customer that will be linked to the redemption in this request. This ID was assigned by the Voucherify API.", - "example": "cust_J1CDUdbqn5Exva8ASWk1Fq0j" - }, - "source_id": { - "type": "string", - "description": "A unique customer identifier. This is a tracking identifier of a user that is validating a voucher. The `source_id` is built based on your internal id (e.g., email, database ID). If you also pass a customer ID, the source ID will be ignored. Otherwise, if you do not pass a customer ID, the source ID you provide must either be a token, like the one returned in the original voucher validation method done by a specific customer, or a string identifying the customer (e.g., email, database ID, CRM ID).", - "example": "firstname.lastname@mycompany.com" - }, - "name": { - "type": "string", - "description": "First and Last Name. You can send the name in the request body to check against vouchers requiring specific name validation rules to be satisfied.", - "example": "FirstName LastName" - }, - "email": { - "type": "string", - "description": "You can send the email in the request body to check against vouchers requiring specific email validation rules to be satisfied.", - "example": "firstname.lastname@mycompany.com" - }, - "phone": { - "type": "string", - "minLength": 1, - "maxLength": 30, - "pattern": "^[-+.() 0-9]", - "description": "You can send the phone in the request body to check against vouchers requiring specific phone validation rules to be satisfied." - }, - "address": { - "type": "object", - "additionalProperties": false, - "description": "A set of key/value pairs which describes the address. You can send the address in the request body to check against vouchers requiring specific address validation rules to be satisfied.", - "properties": { - "city": { - "type": "string", - "description": "You can send the city in the request body to check against vouchers requiring specific city validation rules to be satisfied.", - "example": "New York" - }, - "country": { - "type": "string", - "description": "You can send the country in the request body to check against vouchers requiring specific country validation rules to be satisfied.", - "example": "United States of America" - }, - "postal_code": { - "type": "string", - "description": "You can send the postal code in the request body to check against vouchers requiring specific postal code validation rules to be satisfied.", - "example": "10001" - }, - "state": { - "type": "string", - "description": "You can send the state in the request body to check against vouchers requiring specific state validation rules to be satisfied.", - "example": "NY" - } - } - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **customer** metadata validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Audience_ → _Customer metadata satisfy_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "birthdate": { - "type": "string", - "example": "2022-01-01", - "format": "date", - "description": "You can send the birthdate in the request body to check against vouchers requiring specific birthdate validation rules to be satisfied." - } + } + } + } + }, + "1_req_obj_vouchers_qualification_product_using_product_id": { + "title": "Product Item using product_id", + "type": "object", + "description": "Schema model for a product item sent using the `product_id`. \n\nYou can send this object in the request body to check against vouchers requiring specific product validation rules to be satisfied. \nThe qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", + "properties": { + "product_id": { + "type": "string", + "description": "A unique identifier that represents the product and is assigned by Voucherify.", + "example": "prod_0a9f9aeddb019a42db" + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`). You can send the total item amount to check against vouchers requiring specific order amount validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order volume_ → _Total amount_. The qualification adds the individual amounts of the items and checks whether the sum meets the limits set by the _Total amount_. Additionally, another rule checked is one that is defined in _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Subtotal of matched items_. \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.\n", + "example": 10000 + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart. \n\nThe qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. Another validation rule against which the qualification does the checks is defined in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Quantity of matched items_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", + "example": 1 + }, + "price": { + "type": "integer", + "description": "Unit price of an item. [This is not true in the case of using sourceid what was the case that this happened.]This `price` property takes precedence. If you provide a value at this level, then a price property defined once again in the `related_object` will be ignored. If this property will not be defined here, then the `price` property in the `related_object` will be used in the qualification.\n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Unit Price of any matching order line_ and also _Order Volume_ → _Price of each item/Price of any item_. Even if this price is explicitly provided, it will not override the `price` when running qualifications against _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select/create a product collection filtered by a Price_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).\n\n Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order line item** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Metadata of matched items_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "product": { + "type": "object", + "description": "An object containing details of the related product. These details will be used for qualification on top of details already stored in the system.", + "properties": { + "name": { + "type": "string", + "description": "Product name.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on name filters_.", + "example": "Phone" + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." } - }, - "1_req_obj_vouchers_qualification_product": { - "title": "Product Item", - "type": "object", - "description": "Schema model for a product item. You can send this object in the request body to check against vouchers requiring specific product validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", - "properties": { - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system. __Requires__ the `related_object` property to be defined. \n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on Source Id filters_ . [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", - "example": "product_1234" - }, - "product_id": { - "type": "string", - "description": "A unique identifier that represents the product and is assigned by Voucherify.", - "example": "prod_0a9f9aeddb019a42db" - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`). You can send the total item amount to check against vouchers requiring specific order amount validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order volume_ → _Total amount_. The qualification adds the individual amounts of the items and checks whether the sum meets the limits set by the _Total amount_. Additionally, another rule checked is one that is defined in _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Subtotal of matched items_. \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.\n", - "example": 10000 - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart. \n\nThe qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. Another validation rule against which the qualification does the checks is defined in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Quantity of matched items_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", - "example": 1 - }, - "price": { - "type": "integer", - "description": "Unit price of an item. [This is not true in the case of using sourceid what was the case that this happened.]This `price` property takes precedence. If you provide a value at this level, then a price property defined once again in the `related_object` will be ignored. If this property will not be defined here, then the `price` property in the `related_object` will be used in the qualification.\n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Unit Price of any matching order line_ and also _Order Volume_ → _Price of each item/Price of any item_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).\n\n Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order line item** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Metadata of matched items_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "related_object": { - "type": "string", - "enum": [ - "product" - ], - "description": "A reference to the object containing details of the related product. __Required__ when sending `source_id` in payload." - }, - "product": { - "type": "object", - "description": "An object containing details of the related product. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", - "properties": { - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "product_1234" - }, - "name": { - "type": "string", - "description": "Product name.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on name filters_.", - "example": "Phone" - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - } - } - } + } + } + } + }, + "1_req_obj_vouchers_qualification_product_using_source_id": { + "title": "Product Item using source_id", + "type": "object", + "description": "Schema model for a product item. You can send this object in the request body to check against vouchers requiring specific product validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", + "properties": { + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system. __Requires__ the `related_object` property to be defined. \n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on Source Id filters_ . [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", + "example": "product_1234" + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`). You can send the total item amount to check against vouchers requiring specific order amount validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order volume_ → _Total amount_. The qualification adds the individual amounts of the items and checks whether the sum meets the limits set by the _Total amount_. Additionally, another rule checked is one that is defined in _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Subtotal of matched items_. \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.\n", + "example": 10000 + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart. \n\nThe qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. Another validation rule against which the qualification does the checks is defined in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Quantity of matched items_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", + "example": 1 + }, + "price": { + "type": "integer", + "description": "Unit price of an item. [This is not true in the case of using sourceid what was the case that this happened.]This `price` property takes precedence. If you provide a value at this level, then a price property defined once again in the `related_object` will be ignored. If this property will not be defined here, then the `price` property in the `related_object` will be used in the qualification.\n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Unit Price of any matching order line_ and also _Order Volume_ → _Price of each item/Price of any item_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).\n\n Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order line item** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Metadata of matched items_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "related_object": { + "type": "string", + "enum": [ + "product" + ], + "description": "A reference to the object containing details of the related product. __Required__ when sending `source_id` in payload." + }, + "product": { + "type": "object", + "description": "An object containing details of the related product. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", + "properties": { + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "product_1234" + }, + "name": { + "type": "string", + "description": "Product name.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on name filters_.", + "example": "Phone" + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." } - }, - "1_req_obj_vouchers_qualification_product_using_product_id": { - "title": "Product Item using product_id", - "type": "object", - "description": "Schema model for a product item sent using the `product_id`. \n\nYou can send this object in the request body to check against vouchers requiring specific product validation rules to be satisfied. \nThe qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", - "properties": { - "product_id": { - "type": "string", - "description": "A unique identifier that represents the product and is assigned by Voucherify.", - "example": "prod_0a9f9aeddb019a42db" - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`). You can send the total item amount to check against vouchers requiring specific order amount validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order volume_ → _Total amount_. The qualification adds the individual amounts of the items and checks whether the sum meets the limits set by the _Total amount_. Additionally, another rule checked is one that is defined in _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Subtotal of matched items_. \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.\n", - "example": 10000 - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart. \n\nThe qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. Another validation rule against which the qualification does the checks is defined in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Quantity of matched items_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", - "example": 1 - }, - "price": { - "type": "integer", - "description": "Unit price of an item. [This is not true in the case of using sourceid what was the case that this happened.]This `price` property takes precedence. If you provide a value at this level, then a price property defined once again in the `related_object` will be ignored. If this property will not be defined here, then the `price` property in the `related_object` will be used in the qualification.\n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Unit Price of any matching order line_ and also _Order Volume_ → _Price of each item/Price of any item_. Even if this price is explicitly provided, it will not override the `price` when running qualifications against _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select/create a product collection filtered by a Price_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).\n\n Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order line item** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Metadata of matched items_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "product": { - "type": "object", - "description": "An object containing details of the related product. These details will be used for qualification on top of details already stored in the system.", - "properties": { - "name": { - "type": "string", - "description": "Product name.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on name filters_.", - "example": "Phone" - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - } - } - } + } + } + }, + "required": [ + "source_id", + "related_object" + ] + }, + "1_req_obj_vouchers_qualification_product-copy-2-use-for-other-objects-as-reference": { + "title": "Product Item", + "type": "object", + "description": "Schema model for a product item. You can send this object in the request body to check against vouchers requiring specific product validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", + "properties": { + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system. __Requires__ the `related_object` property to be defined. \n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on Source Id filters_ . [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", + "example": "product_1234" + }, + "product_id": { + "type": "string", + "description": "A unique identifier that represents the product and is assigned by Voucherify.", + "example": "prod_0a9f9aeddb019a42db" + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`). You can send the total item amount to check against vouchers requiring specific order amount validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order volume_ → _Total amount_. The qualification adds the individual amounts of the items and checks whether the sum meets the limits set by the _Total amount_. Additionally, another rule checked is one that is defined in _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Subtotal of matched items_. \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.\n", + "example": 10000 + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart. \n\nThe qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. Another validation rule against which the qualification does the checks is defined in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Quantity of matched items_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", + "example": 1 + }, + "price": { + "type": "integer", + "description": "Unit price of an item. [This is not true in the case of using sourceid what was the case that this happened.]This `price` property takes precedence. If you provide a value at this level, then a price property defined once again in the `related_object` will be ignored. If this property will not be defined here, then the `price` property in the `related_object` will be used in the qualification.\n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Unit Price of any matching order line_ and also _Order Volume_ → _Price of each item/Price of any item_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).\n\n Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order line item** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Metadata of matched items_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "related_object": { + "type": "string", + "enum": [ + "product" + ], + "description": "A reference to the object containing details of the related product. __Required__ when sending `source_id` in payload." + }, + "product": { + "type": [ + "object", + "null" + ], + "description": "An object containing details of the related product. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", + "properties": { + "source_id": { + "type": [ + "string", + "null" + ], + "description": "A unique product identifier from your inventory system.", + "example": "product_1234" + }, + "name": { + "type": [ + "string", + "null" + ], + "description": "Product name.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on name filters_.", + "example": "Phone" + }, + "price": { + "type": [ + "integer", + "null" + ], + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "metadata": { + "type": [ + "object", + "null" + ], + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "override": { + "type": [ + "boolean", + "null" + ], + "description": "The override is used to store the product in the system. If product does not exist, it will be created with the use of `source_id`." } - }, - "1_req_obj_vouchers_qualification_product_using_source_id": { - "title": "Product Item using source_id", - "type": "object", - "description": "Schema model for a product item. You can send this object in the request body to check against vouchers requiring specific product validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", - "properties": { - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system. __Requires__ the `related_object` property to be defined. \n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on Source Id filters_ . [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", - "example": "product_1234" - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`). You can send the total item amount to check against vouchers requiring specific order amount validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order volume_ → _Total amount_. The qualification adds the individual amounts of the items and checks whether the sum meets the limits set by the _Total amount_. Additionally, another rule checked is one that is defined in _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Subtotal of matched items_. \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.\n", - "example": 10000 - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart. \n\nThe qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. Another validation rule against which the qualification does the checks is defined in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Quantity of matched items_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", - "example": 1 - }, - "price": { - "type": "integer", - "description": "Unit price of an item. [This is not true in the case of using sourceid what was the case that this happened.]This `price` property takes precedence. If you provide a value at this level, then a price property defined once again in the `related_object` will be ignored. If this property will not be defined here, then the `price` property in the `related_object` will be used in the qualification.\n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Unit Price of any matching order line_ and also _Order Volume_ → _Price of each item/Price of any item_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).\n\n Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order line item** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Metadata of matched items_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "related_object": { - "type": "string", - "enum": [ - "product" - ], - "description": "A reference to the object containing details of the related product. __Required__ when sending `source_id` in payload." - }, - "product": { - "type": "object", - "description": "An object containing details of the related product. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", - "properties": { - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "product_1234" - }, - "name": { - "type": "string", - "description": "Product name.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on name filters_.", - "example": "Phone" - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - } - } - } + } + } + } + }, + "1_req_obj_vouchers_qualification_sku": { + "title": "SKU Item", + "type": "object", + "description": "Schema model for a SKU item.", + "properties": { + "source_id": { + "type": "string", + "description": "A unique sku identifier from your inventory system. __Requires__ the `related_object` property to be defined. \n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on Source Id filters_ . [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", + "example": "product_1234" + }, + "sku_id": { + "type": "string", + "example": "sku_0a41e31c7b41c28358", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "amount": { + "type": "integer", + "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item.[I'm not sure what this means here, it's from the original docs]", + "example": 10000 + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart. The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", + "example": 1 + }, + "related_object": { + "type": "string", + "enum": [ + "product", + "sku" + ], + "description": "A reference to the object containing details of the related product/sku. __Required__ when sending `source_id` in payload." + }, + "product": { + "type": "object", + "description": "An object containing details of the related product. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", + "properties": { + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "product_1234" }, - "required": [ - "source_id", - "related_object" - ] - }, - "1_req_obj_vouchers_qualification_product-copy-2-use-for-other-objects-as-reference": { - "title": "Product Item", - "type": "object", - "description": "Schema model for a product item. You can send this object in the request body to check against vouchers requiring specific product validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", - "properties": { - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system. __Requires__ the `related_object` property to be defined. \n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on Source Id filters_ . [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", - "example": "product_1234" - }, - "product_id": { - "type": "string", - "description": "A unique identifier that represents the product and is assigned by Voucherify.", - "example": "prod_0a9f9aeddb019a42db" - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`). You can send the total item amount to check against vouchers requiring specific order amount validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order volume_ → _Total amount_. The qualification adds the individual amounts of the items and checks whether the sum meets the limits set by the _Total amount_. Additionally, another rule checked is one that is defined in _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Subtotal of matched items_. \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.\n", - "example": 10000 - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart. \n\nThe qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. Another validation rule against which the qualification does the checks is defined in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Quantity of matched items_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", - "example": 1 - }, - "price": { - "type": "integer", - "description": "Unit price of an item. [This is not true in the case of using sourceid what was the case that this happened.]This `price` property takes precedence. If you provide a value at this level, then a price property defined once again in the `related_object` will be ignored. If this property will not be defined here, then the `price` property in the `related_object` will be used in the qualification.\n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item_ → _Unit Price of any matching order line_ and also _Order Volume_ → _Price of each item/Price of any item_. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).\n\n Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order line item** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item_ → _Metadata of matched items_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "related_object": { - "type": "string", - "enum": [ - "product" - ], - "description": "A reference to the object containing details of the related product. __Required__ when sending `source_id` in payload." - }, - "product": { - "type": [ - "object", - "null" - ], - "description": "An object containing details of the related product. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", - "properties": { - "source_id": { - "type": [ - "string", - "null" - ], - "description": "A unique product identifier from your inventory system.", - "example": "product_1234" - }, - "name": { - "type": [ - "string", - "null" - ], - "description": "Product name.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on name filters_.", - "example": "Phone" - }, - "price": { - "type": [ - "integer", - "null" - ], - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { - "type": [ - "object", - "null" - ], - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "override": { - "type": [ - "boolean", - "null" - ], - "description": "The override is used to store the product in the system. If product does not exist, it will be created with the use of `source_id`." - } - } - } + "name": { + "type": "string", + "description": "Product name.", + "example": "Phone" + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." } - }, - "1_req_obj_vouchers_qualification_sku": { - "title": "SKU Item", - "type": "object", - "description": "Schema model for a SKU item.", - "properties": { - "source_id": { - "type": "string", - "description": "A unique sku identifier from your inventory system. __Requires__ the `related_object` property to be defined. \n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on Source Id filters_ . [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", - "example": "product_1234" - }, - "sku_id": { - "type": "string", - "example": "sku_0a41e31c7b41c28358", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "amount": { - "type": "integer", - "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item.[I'm not sure what this means here, it's from the original docs]", - "example": 10000 - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart. The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", - "example": 1 - }, - "related_object": { - "type": "string", - "enum": [ - "product", - "sku" - ], - "description": "A reference to the object containing details of the related product/sku. __Required__ when sending `source_id` in payload." - }, - "product": { - "type": "object", - "description": "An object containing details of the related product. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", - "properties": { - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "product_1234" - }, - "name": { - "type": "string", - "description": "Product name.", - "example": "Phone" - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - } - } - }, - "sku": { - "type": "object", - "description": "An object containing details of the related SKU. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", - "properties": { - "source_id": { - "type": "string", - "description": "A unique SKU identifier from your inventory system.", - "example": "sku_1234" - }, - "sku": { - "type": "string", - "description": "SKU name.", - "example": "iPhone 12" - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to a SKU." - } - } - } + } + }, + "sku": { + "type": "object", + "description": "An object containing details of the related SKU. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", + "properties": { + "source_id": { + "type": "string", + "description": "A unique SKU identifier from your inventory system.", + "example": "sku_1234" + }, + "sku": { + "type": "string", + "description": "SKU name.", + "example": "iPhone 12" + }, + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to a SKU." } - }, - "1_req_obj_vouchers_qualification_sku-copy-2_forfuturereference": { - "title": "SKU Item", - "type": "object", - "description": "Schema model for a SKU item.", - "properties": { - "source_id": { - "type": [ - "string", - "null" - ], - "description": "A unique sku identifier from your inventory system. __Requires__ the `related_object` property to be defined. \n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on Source Id filters_ . [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", - "example": "product_1234" - }, - "sku_id": { - "type": [ - "string", - "null" - ], - "example": "sku_0a41e31c7b41c28358", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "amount": { - "type": [ - "integer", - "null" - ], - "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item.[I'm not sure what this means here, it's from the original docs]", - "example": 10000 - }, - "quantity": { - "type": [ - "integer", - "null" - ], - "description": "Quantity of the item in the cart. The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", - "example": 1 - }, - "related_object": { - "type": [ - "string", - "null" - ], - "enum": [ - "product", - "sku" - ], - "description": "A reference to the object containing details of the related product/sku. __Required__ when sending `source_id` in payload." - }, - "product": { - "type": [ - "object", - "null" - ], - "description": "An object containing details of the related product. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", - "properties": { - "source_id": { - "type": [ - "string", - "null" - ], - "description": "A unique product identifier from your inventory system.", - "example": "product_1234" - }, - "name": { - "type": [ - "string", - "null" - ], - "description": "Product name.", - "example": "Phone" - }, - "price": { - "type": [ - "integer", - "null" - ], - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { - "type": [ - "object", - "null" - ], - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "override": { - "type": [ - "boolean", - "null" - ], - "description": "The override is used to store the product in the system. If the product does not exist, it will be created with the use of `source_id`." - } - } - }, - "sku": { - "type": [ - "object", - "null" - ], - "description": "An object containing details of the related SKU. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", - "properties": { - "source_id": { - "type": [ - "string", - "null" - ], - "description": "A unique SKU identifier from your inventory system.", - "example": "sku_1234" - }, - "sku": { - "type": [ - "string", - "null" - ], - "description": "SKU name.", - "example": "iPhone 12" - }, - "price": { - "type": [ - "integer", - "null" - ], - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "metadata": { - "type": [ - "object", - "null" - ], - "description": "A set of custom key/value pairs that you can attach to a SKU." - }, - "override": { - "type": [ - "boolean", - "null" - ], - "description": "The override is used once the product should be stored in system. If sku does not exist, it will be created with the use of `source_id`. If a SKU does not exist, it's required to set `product_id` that it belongs to." - } + } + } + } + }, + "1_req_obj_vouchers_qualification_sku-copy-2_forfuturereference": { + "title": "SKU Item", + "type": "object", + "description": "Schema model for a SKU item.", + "properties": { + "source_id": { + "type": [ + "string", + "null" + ], + "description": "A unique sku identifier from your inventory system. __Requires__ the `related_object` property to be defined. \n\n The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on Source Id filters_ . [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", + "example": "product_1234" + }, + "sku_id": { + "type": [ + "string", + "null" + ], + "example": "sku_0a41e31c7b41c28358", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "amount": { + "type": [ + "integer", + "null" + ], + "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item.[I'm not sure what this means here, it's from the original docs]", + "example": 10000 + }, + "quantity": { + "type": [ + "integer", + "null" + ], + "description": "Quantity of the item in the cart. The qualification runs against rules that are defined through the Create Validation Rules endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order Volume_ → _Items quantity_. The qualification adds the individual quantities of the items and checks whether the sum meets the limits set by _Items quantity_ validation rule. [Read more](https://support.voucherify.io/article/529-validation-rules-campaign-limits).", + "example": 1 + }, + "related_object": { + "type": [ + "string", + "null" + ], + "enum": [ + "product", + "sku" + ], + "description": "A reference to the object containing details of the related product/sku. __Required__ when sending `source_id` in payload." + }, + "product": { + "type": [ + "object", + "null" + ], + "description": "An object containing details of the related product. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", + "properties": { + "source_id": { + "type": [ + "string", + "null" + ], + "description": "A unique product identifier from your inventory system.", + "example": "product_1234" + }, + "name": { + "type": [ + "string", + "null" + ], + "description": "Product name.", + "example": "Phone" + }, + "price": { + "type": [ + "integer", + "null" + ], + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "metadata": { + "type": [ + "object", + "null" + ], + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **product** metadata validation rules to be satisfied.\n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Every order item/Any order item/None of the order items_ → _Select a product collection or create a new product collection based on metadata filters_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "override": { + "type": [ + "boolean", + "null" + ], + "description": "The override is used to store the product in the system. If the product does not exist, it will be created with the use of `source_id`." + } + } + }, + "sku": { + "type": [ + "object", + "null" + ], + "description": "An object containing details of the related SKU. __Required__ when sending `source_id` in payload. These details will be used for qualification on top of details already stored in the system.", + "properties": { + "source_id": { + "type": [ + "string", + "null" + ], + "description": "A unique SKU identifier from your inventory system.", + "example": "sku_1234" + }, + "sku": { + "type": [ + "string", + "null" + ], + "description": "SKU name.", + "example": "iPhone 12" + }, + "price": { + "type": [ + "integer", + "null" + ], + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "metadata": { + "type": [ + "object", + "null" + ], + "description": "A set of custom key/value pairs that you can attach to a SKU." + }, + "override": { + "type": [ + "boolean", + "null" + ], + "description": "The override is used once the product should be stored in system. If sku does not exist, it will be created with the use of `source_id`. If a SKU does not exist, it's required to set `product_id` that it belongs to." + } + } + } + } + }, + "1_req_obj_vouchers_qualification_sku-copy": { + "title": "SKU Item", + "type": "object", + "description": "Schema model for a SKU item.", + "properties": { + "id": { + "type": [ + "string", + "null" + ] + }, + "source_id": { + "type": [ + "string", + "null" + ], + "description": "The merchant’s product/SKU ID (if it is different from the Voucherify product/SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce, a database or a 3rd-party service." + }, + "product_id": { + "type": [ + "string", + "null" + ] + }, + "related_object": { + "type": [ + "string", + "null" + ], + "enum": [ + "product", + "sku" + ] + }, + "amount": { + "type": [ + "integer", + "null" + ], + "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item.[I'm not sure what this means here, it's from the original docs]" + }, + "quantity": { + "type": [ + "integer", + "null" + ], + "description": "Quantity of the item in the cart." + }, + "price": { + "type": [ + "integer", + "null" + ], + "description": "Unit price of an item" + }, + "sku": { + "type": [ + "object", + "null" + ], + "description": "An object containing details of the related SKU. These details will be used for validation and redemption processes on top of details already stored in the system.", + "properties": { + "id": { + "type": [ + "string", + "null" + ] + }, + "source_id": { + "type": [ + "string", + "null" + ] + }, + "sku": { + "type": [ + "string", + "null" + ] + }, + "price": { + "type": [ + "integer", + "null" + ] + }, + "metadata": { + "type": [ + "object", + "null" + ] + }, + "override": { + "type": [ + "boolean", + "null" + ], + "description": "The override is used once the product should be stored in system. If sku does not exist it will be created with the use of `source_id`. If sku does not exists it's required to set `product_id` that it belongs to." + } + } + } + } + }, + "1_req_vouchers_qualification_copy_for_reverting_changes": { + "title": "Vouchers Qualification Request Body", + "type": "object", + "description": "Request body schema for /vouchers/qualification.", + "properties": { + "customer": { + "type": [ + "object", + "null" + ], + "description": "This object stores customer details. You can send this object in the request body to check against vouchers requiring specific customer validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Audience_ → _Customer segment_ or _Basic Builder_ → _Customer Activity_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). ", + "properties": { + "id": { + "type": "string", + "description": "The ID of an existing customer that will be linked to the redemption in this request. This ID was assigned by the Voucherify API.", + "example": "cust_J1CDUdbqn5Exva8ASWk1Fq0j" + }, + "source_id": { + "type": [ + "string", + "null" + ], + "description": "A unique customer identifier. This is a tracking identifier of a user that is validating a voucher. The `source_id` is built based on your internal id (e.g., email, database ID). If you also pass a customer ID, the source ID will be ignored. Otherwise, if you do not pass a customer ID, the source ID you provide must either be a token, like the one returned in the original voucher validation method done by a specific customer, or a string identifying the customer (e.g., email, database ID, CRM ID).", + "example": "firstname.lastname@mycompany.com" + }, + "name": { + "type": [ + "string", + "null" + ], + "description": "First and Last Name. You can send the name in the request body to check against vouchers requiring specific name validation rules to be satisfied.", + "example": "FirstName LastName" + }, + "email": { + "type": [ + "string", + "null" + ], + "description": "You can send the email in the request body to check against vouchers requiring specific email validation rules to be satisfied.", + "example": "firstname.lastname@mycompany.com" + }, + "phone": { + "type": [ + "string", + "null" + ], + "minLength": 1, + "maxLength": 30, + "pattern": "^[-+.() 0-9]", + "description": "You can send the phone in the request body to check against vouchers requiring specific phone validation rules to be satisfied." + }, + "address": { + "type": [ + "object", + "null" + ], + "additionalProperties": false, + "description": "A set of key/value pairs which describes the address. You can send the address in the request body to check against vouchers requiring specific address validation rules to be satisfied.", + "properties": { + "city": { + "type": [ + "string", + "null" + ], + "description": "You can send the city in the request body to check against vouchers requiring specific city validation rules to be satisfied.", + "example": "New York" + }, + "country": { + "type": [ + "string", + "null" + ], + "description": "You can send the country in the request body to check against vouchers requiring specific country validation rules to be satisfied.", + "example": "United States of America" + }, + "postal_code": { + "type": [ + "string", + "null" + ], + "description": "You can send the postal code in the request body to check against vouchers requiring specific postal code validation rules to be satisfied.", + "example": "10001" + }, + "state": { + "type": [ + "string", + "null" + ], + "description": "You can send the state in the request body to check against vouchers requiring specific state validation rules to be satisfied.", + "example": "NY" } } + }, + "metadata": { + "type": [ + "object", + "null" + ], + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **customer** metadata validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Audience_ → _Customer metadata satisfy_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "birthdate": { + "type": [ + "string", + "null" + ], + "format": "date", + "description": "You can send the birthdate in the request body to check against vouchers requiring specific birthdate validation rules to be satisfied, i.e. `YYYY-MM-DD`." } - }, - "1_req_obj_vouchers_qualification_sku-copy": { - "title": "SKU Item", - "type": "object", - "description": "Schema model for a SKU item.", - "properties": { - "id": { - "type": [ - "string", - "null" - ] - }, - "source_id": { - "type": [ - "string", - "null" - ], - "description": "The merchant’s product/SKU ID (if it is different from the Voucherify product/SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce, a database or a 3rd-party service." - }, - "product_id": { - "type": [ - "string", - "null" - ] - }, - "related_object": { - "type": [ - "string", - "null" - ], - "enum": [ - "product", - "sku" - ] - }, - "amount": { - "type": [ - "integer", - "null" - ], - "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item.[I'm not sure what this means here, it's from the original docs]" - }, - "quantity": { - "type": [ - "integer", - "null" - ], - "description": "Quantity of the item in the cart." - }, - "price": { - "type": [ - "integer", - "null" - ], - "description": "Unit price of an item" - }, - "sku": { - "type": [ - "object", - "null" - ], - "description": "An object containing details of the related SKU. These details will be used for validation and redemption processes on top of details already stored in the system.", - "properties": { - "id": { - "type": [ - "string", - "null" - ] - }, - "source_id": { - "type": [ - "string", - "null" - ] - }, - "sku": { - "type": [ - "string", - "null" - ] - }, - "price": { - "type": [ - "integer", - "null" - ] - }, - "metadata": { - "type": [ - "object", - "null" - ] + } + }, + "order": { + "type": [ + "object", + "null" + ], + "description": "Tracks purchase transactions. You can send the order in the request body to check against vouchers requiring specific order validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", + "properties": { + "id": { + "type": [ + "string", + "null" + ], + "description": "The ID of an existing order in Voucherify's system that will be linked to the redemption of this request. This ID was assigned by the Voucherify API. You can send the order id in the request body to check against vouchers requiring specific order validation rules to be satisfied.", + "example": "ord_gqj1QYW2j2A1E3Ula2YjdPf4" + }, + "source_id": { + "type": [ + "string", + "null" + ], + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of an integration between multiple systems. It can be an order ID from a CRM system, database or 3rd-party service." + }, + "amount": { + "type": [ + "integer", + "null" + ], + "minimum": 0, + "description": "Pre-discount order amount represents the total amount of order items' amounts (sum of each item's `amount` property). You can send the amount in the request body to check against vouchers requiring specific order amount validation rules to be satisfied. \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", + "example": 10000 + }, + "items": { + "type": "array", + "description": "List of Order Items constituting the order. Order items can be defined either by `product_id` or `sku_id`. For every item, you must define the quantity. Read more about the [order item object] (hyperlink the Order Item Object).\n", + "items": { + "anyOf": [ + { + "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_product" }, - "override": { - "type": [ - "boolean", - "null" - ], - "description": "The override is used once the product should be stored in system. If sku does not exist it will be created with the use of `source_id`. If sku does not exists it's required to set `product_id` that it belongs to." + { + "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_sku" } - } + ] } + }, + "customer": { + "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_customer" + }, + "referrer": { + "description": "The person who referred the customer to make the order.", + "type": [ + "object", + "null" + ] + }, + "metadata": { + "type": [ + "string", + "null" + ], + "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order** metadata validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Order metadata satisfy_ or _Basic Builder_ → _Attributes match_ → _ORDER METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." } - }, - "1_req_vouchers_qualification_copy_for_reverting_changes": { - "title": "Vouchers Qualification Request Body", - "type": "object", - "description": "Request body schema for /vouchers/qualification.", - "properties": { - "customer": { - "type": [ - "object", - "null" - ], - "description": "This object stores customer details. You can send this object in the request body to check against vouchers requiring specific customer validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Audience_ → _Customer segment_ or _Basic Builder_ → _Customer Activity_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). ", - "properties": { - "id": { - "type": "string", - "description": "The ID of an existing customer that will be linked to the redemption in this request. This ID was assigned by the Voucherify API.", - "example": "cust_J1CDUdbqn5Exva8ASWk1Fq0j" - }, - "source_id": { - "type": [ - "string", - "null" - ], - "description": "A unique customer identifier. This is a tracking identifier of a user that is validating a voucher. The `source_id` is built based on your internal id (e.g., email, database ID). If you also pass a customer ID, the source ID will be ignored. Otherwise, if you do not pass a customer ID, the source ID you provide must either be a token, like the one returned in the original voucher validation method done by a specific customer, or a string identifying the customer (e.g., email, database ID, CRM ID).", - "example": "firstname.lastname@mycompany.com" - }, - "name": { - "type": [ - "string", - "null" - ], - "description": "First and Last Name. You can send the name in the request body to check against vouchers requiring specific name validation rules to be satisfied.", - "example": "FirstName LastName" - }, - "email": { - "type": [ - "string", - "null" - ], - "description": "You can send the email in the request body to check against vouchers requiring specific email validation rules to be satisfied.", - "example": "firstname.lastname@mycompany.com" - }, - "phone": { - "type": [ - "string", - "null" - ], - "minLength": 1, - "maxLength": 30, - "pattern": "^[-+.() 0-9]", - "description": "You can send the phone in the request body to check against vouchers requiring specific phone validation rules to be satisfied." - }, - "address": { - "type": [ - "object", - "null" - ], - "additionalProperties": false, - "description": "A set of key/value pairs which describes the address. You can send the address in the request body to check against vouchers requiring specific address validation rules to be satisfied.", - "properties": { - "city": { - "type": [ - "string", - "null" - ], - "description": "You can send the city in the request body to check against vouchers requiring specific city validation rules to be satisfied.", - "example": "New York" - }, - "country": { - "type": [ - "string", - "null" - ], - "description": "You can send the country in the request body to check against vouchers requiring specific country validation rules to be satisfied.", - "example": "United States of America" - }, - "postal_code": { - "type": [ - "string", - "null" - ], - "description": "You can send the postal code in the request body to check against vouchers requiring specific postal code validation rules to be satisfied.", - "example": "10001" - }, - "state": { - "type": [ - "string", - "null" - ], - "description": "You can send the state in the request body to check against vouchers requiring specific state validation rules to be satisfied.", - "example": "NY" - } - } - }, - "metadata": { - "type": [ - "object", - "null" - ], - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **customer** metadata validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Audience_ → _Customer metadata satisfy_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "birthdate": { - "type": [ - "string", - "null" - ], - "format": "date", - "description": "You can send the birthdate in the request body to check against vouchers requiring specific birthdate validation rules to be satisfied, i.e. `YYYY-MM-DD`." - } - } - }, - "order": { - "type": [ - "object", - "null" - ], - "description": "Tracks purchase transactions. You can send the order in the request body to check against vouchers requiring specific order validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure/Order volume_ or _Basic Builder_ → _Order_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).", - "properties": { - "id": { - "type": [ - "string", - "null" - ], - "description": "The ID of an existing order in Voucherify's system that will be linked to the redemption of this request. This ID was assigned by the Voucherify API. You can send the order id in the request body to check against vouchers requiring specific order validation rules to be satisfied.", - "example": "ord_gqj1QYW2j2A1E3Ula2YjdPf4" - }, - "source_id": { - "type": [ - "string", - "null" - ], - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of an integration between multiple systems. It can be an order ID from a CRM system, database or 3rd-party service." - }, - "amount": { - "type": [ - "integer", - "null" - ], - "minimum": 0, - "description": "Pre-discount order amount represents the total amount of order items' amounts (sum of each item's `amount` property). You can send the amount in the request body to check against vouchers requiring specific order amount validation rules to be satisfied. \n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000.", - "example": 10000 - }, - "items": { - "type": "array", - "description": "List of Order Items constituting the order. Order items can be defined either by `product_id` or `sku_id`. For every item, you must define the quantity. Read more about the [order item object] (hyperlink the Order Item Object).\n", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_product" - }, - { - "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_sku" - } - ] - } - }, - "customer": { - "$ref": "#/components/schemas/1_req_obj_vouchers_qualification_customer" - }, - "referrer": { - "description": "The person who referred the customer to make the order.", - "type": [ - "object", - "null" - ] - }, - "metadata": { - "type": [ - "string", - "null" - ], - "description": "A set of key/value pairs that you can send in the request body to check against vouchers requiring **order** metadata validation rules to be satisfied. The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard; in the _Advanced Rule Builder_ → _Order structure_ → _Order metadata satisfy_ or _Basic Builder_ → _Attributes match_ → _ORDER METADATA_. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule)." - } - } - }, - "reward": { - "type": [ - "object", - "null" - ], - "properties": { - "points": { - "type": [ - "number", - "null" - ] - }, - "assignment_id": { - "type": [ - "string", - "null" - ] - }, - "id": { - "type": [ - "string", - "null" - ] - } + } + }, + "reward": { + "type": [ + "object", + "null" + ], + "properties": { + "points": { + "type": [ + "number", + "null" + ] + }, + "assignment_id": { + "type": [ + "string", + "null" + ] + }, + "id": { + "type": [ + "string", + "null" + ] + } + } + }, + "metadata": { + "type": [ + "object", + "null" + ], + "description": "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 qualification runs against rules that are defined through the [Create Validation Rules](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + } + } + }, + "1_req_obj_vouchers_qualification_product-copy": { + "title": "Product Item", + "type": "object", + "description": "Schema model for a product item.", + "properties": { + "id": { + "type": [ + "string", + "null" + ] + }, + "source_id": { + "type": [ + "string", + "null" + ], + "description": "Product/SKU reference ID" + }, + "product_id": { + "type": [ + "string", + "null" + ] + }, + "sku_id": { + "type": [ + "string", + "null" + ] + }, + "related_object": { + "type": [ + "string", + "null" + ], + "enum": [ + "product", + "sku" + ] + }, + "amount": { + "type": [ + "integer", + "null" + ], + "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item." + }, + "quantity": { + "type": [ + "integer", + "null" + ], + "description": "Quantity of the item in the cart." + }, + "price": { + "type": [ + "integer", + "null" + ], + "description": "Unit price of an item" + }, + "product": { + "type": [ + "object", + "null" + ], + "description": "An object containing details of the related product. These details will be used for validation and redemption processes on top of details already stored in the system.", + "properties": { + "id": { + "type": [ + "string", + "null" + ] + }, + "source_id": { + "type": [ + "string", + "null" + ] + }, + "name": { + "type": [ + "string", + "null" + ] + }, + "price": { + "type": [ + "integer", + "null" + ] + }, + "metadata": { + "type": [ + "object", + "null" + ] + }, + "override": { + "type": [ + "boolean", + "null" + ] + } + } + }, + "sku": { + "type": [ + "object", + "null" + ], + "description": "An object containing details of the related SKU. These details will be used for validation and redemption processes on top of details already stored in the system.", + "properties": { + "id": { + "type": [ + "string", + "null" + ] + }, + "source_id": { + "type": [ + "string", + "null" + ] + }, + "sku": { + "type": [ + "string", + "null" + ] + }, + "price": { + "type": [ + "string", + "null" + ] + }, + "metadata": { + "type": [ + "object", + "null" + ] + }, + "override": { + "type": [ + "boolean", + "null" + ], + "description": "The override is used once the product should be stored in system. If sku does not exists it will be created with the use of `source_id`. If sku does not exists it's required to set `product_id` that it belongs to." + } + } + } + } + }, + "1_req_vouchers_qualification-prepforcampaignqualification": { + "title": "RequestBodyVouchersQualification", + "type": "object", + "description": "Request body schema for /vouchers/qualification.", + "properties": { + "customer": { + "type": [ + "object", + "null" + ], + "description": "This object stores customer details.", + "properties": { + "id": { + "type": "string", + "description": "The ID of an existing customer that will be linked to the redemption in this request. Assigned by the Voucherify API, identifies the customer.", + "example": "cust_J1CDUdbqn5Exva8ASWk1Fq0j" + }, + "source_id": { + "type": [ + "string", + "null" + ], + "description": "A unique customer identifier. You can provide your own (e.g. CRM id) or use the one returned by Voucherify, see tracking_id from Validate Voucher (client-side). A tracking identifier of a user that validate a voucher. It is build based on your internal id (e.g., email, database ID). If you also pass a customer ID, the source ID will be ignored. Otherwise, if you do not pass a customer ID, the source ID you provide must either be a token, like the ones returned in origin voucher validation method done by specific customer, or a string identifying customer (e.g., email, database ID, CRM ID)." + }, + "name": { + "type": [ + "string", + "null" + ], + "description": "First and Last Name" + }, + "email": { + "type": [ + "string", + "null" + ] + }, + "phone": { + "type": [ + "string", + "null" + ], + "minLength": 1, + "maxLength": 30, + "pattern": "^[-+.() 0-9]" + }, + "address": { + "type": [ + "object", + "null" + ], + "additionalProperties": false, + "description": "A set of key/value pairs which describes the address.", + "properties": { + "city": { + "type": [ + "string", + "null" + ] + }, + "country": { + "type": [ + "string", + "null" + ] + }, + "postal_code": { + "type": [ + "string", + "null" + ] + }, + "state": { + "type": [ + "string", + "null" + ] } - }, - "metadata": { - "type": [ - "object", - "null" - ], - "description": "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 qualification runs against rules that are defined through the [Create Validation Rules](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." } + }, + "metadata": { + "type": [ + "object", + "null" + ], + "description": "A set of key/value pairs that you can attach to a customer object for segment building. It can be useful for storing additional information about the customer in a structured format." + }, + "birthdate": { + "type": [ + "string", + "null" + ], + "description": "Customer's birthdate, i.e. `YYYY-MM-DD`.", + "format": "date" } - }, - "1_req_obj_vouchers_qualification_product-copy": { - "title": "Product Item", - "type": "object", - "description": "Schema model for a product item.", - "properties": { - "id": { - "type": [ - "string", - "null" - ] - }, - "source_id": { - "type": [ - "string", - "null" - ], - "description": "Product/SKU reference ID" - }, - "product_id": { - "type": [ - "string", - "null" - ] - }, - "sku_id": { - "type": [ - "string", - "null" - ] - }, - "related_object": { - "type": [ - "string", - "null" - ], - "enum": [ - "product", - "sku" - ] - }, - "amount": { - "type": [ - "integer", - "null" - ], - "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item." - }, - "quantity": { - "type": [ - "integer", - "null" - ], - "description": "Quantity of the item in the cart." - }, - "price": { - "type": [ - "integer", - "null" - ], - "description": "Unit price of an item" - }, - "product": { + } + }, + "order": { + "type": [ + "object", + "null" + ], + "description": "Tracks purchase transactions.", + "properties": { + "id": { + "type": [ + "string", + "null" + ], + "description": "The ID of an existing order that will be linked to redemption in this request." + }, + "status": { + "type": [ + "string", + "null" + ], + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULFILLED" + ] + }, + "source_id": { + "type": [ + "string", + "null" + ], + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + }, + "amount": { + "type": [ + "integer", + "null" + ], + "minimum": 0, + "description": "Represents a total amount of order items (sum of item.amount)\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "discount_amount": { + "type": [ + "integer", + "null" + ], + "minimum": 0, + "description": "Summarize all discounts applied to the order inlcuding discounts applied to particular order line items and discounts applied to the whole cart.\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "items": { + "type": "array", + "description": "List of Order Items constituting the order. Order items can be defined either by product_id or sku_id. Along with every item you must define quantity.A list of Order Items that have been applied to the order. hyperlink the Order Items to another object.\n", + "items": { "type": [ "object", "null" ], - "description": "An object containing details of the related product. These details will be used for validation and redemption processes on top of details already stored in the system.", "properties": { "id": { "type": [ @@ -5840,203 +6088,444 @@ "type": [ "string", "null" - ] - }, - "name": { - "type": [ - "string", - "null" - ] - }, - "price": { - "type": [ - "integer", - "null" - ] - }, - "metadata": { - "type": [ - "object", - "null" - ] - }, - "override": { - "type": [ - "boolean", - "null" - ] - } - } - }, - "sku": { - "type": [ - "object", - "null" - ], - "description": "An object containing details of the related SKU. These details will be used for validation and redemption processes on top of details already stored in the system.", - "properties": { - "id": { - "type": [ - "string", - "null" - ] + ], + "description": "Product/SKU reference ID" }, - "source_id": { + "product_id": { "type": [ "string", "null" ] }, - "sku": { + "sku_id": { "type": [ "string", "null" ] }, - "price": { + "related_object": { "type": [ "string", "null" - ] - }, - "metadata": { - "type": [ - "object", - "null" - ] + ], + "enum": [ + "product", + "sku" + ], + "description": "Allowed values: `product`, `sku`" }, - "override": { + "amount": { "type": [ - "boolean", + "integer", "null" ], - "description": "The override is used once the product should be stored in system. If sku does not exists it will be created with the use of `source_id`. If sku does not exists it's required to set `product_id` that it belongs to." - } - } - } - } - }, - "1_req_vouchers_qualification-prepforcampaignqualification": { - "title": "RequestBodyVouchersQualification", - "type": "object", - "description": "Request body schema for /vouchers/qualification.", - "properties": { - "customer": { - "type": [ - "object", - "null" - ], - "description": "This object stores customer details.", - "properties": { - "id": { - "type": "string", - "description": "The ID of an existing customer that will be linked to the redemption in this request. Assigned by the Voucherify API, identifies the customer.", - "example": "cust_J1CDUdbqn5Exva8ASWk1Fq0j" + "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item." }, - "source_id": { + "discount_amount": { "type": [ - "string", + "integer", "null" ], - "description": "A unique customer identifier. You can provide your own (e.g. CRM id) or use the one returned by Voucherify, see tracking_id from Validate Voucher (client-side). A tracking identifier of a user that validate a voucher. It is build based on your internal id (e.g., email, database ID). If you also pass a customer ID, the source ID will be ignored. Otherwise, if you do not pass a customer ID, the source ID you provide must either be a token, like the ones returned in origin voucher validation method done by specific customer, or a string identifying customer (e.g., email, database ID, CRM ID)." + "description": "Represents total amount of the discount applied to order line items\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." }, - "name": { + "quantity": { "type": [ - "string", + "integer", "null" - ], - "description": "First and Last Name" + ] }, - "email": { + "discount_quantity": { "type": [ - "string", + "integer", "null" - ] + ], + "description": "number of items being discounted\t" }, - "phone": { + "price": { "type": [ - "string", + "integer", "null" ], - "minLength": 1, - "maxLength": 30, - "pattern": "^[-+.() 0-9]" + "description": "Unit price of an item" }, - "address": { + "product": { "type": [ "object", "null" ], - "additionalProperties": false, - "description": "A set of key/value pairs which describes the address.", + "description": "An object containing details of related product. Those details will be used for validation and redemption processes on top of details already stored in system.", "properties": { - "city": { + "id": { "type": [ "string", "null" ] }, - "country": { + "source_id": { "type": [ "string", "null" ] }, - "postal_code": { + "name": { "type": [ "string", "null" ] }, - "state": { + "price": { "type": [ - "string", + "null", + "integer" + ] + }, + "metadata": { + "type": [ + "object", "null" ] + }, + "override": { + "type": [ + "boolean", + "null" + ], + "description": "The `override` is used once the product should be stored in system. If product does not exists it will be created with the use of `source_id`." } } }, - "metadata": { + "sku": { "type": [ "object", "null" ], - "description": "A set of key/value pairs that you can attach to a customer object for segment building. It can be useful for storing additional information about the customer in a structured format." - }, - "birthdate": { - "type": [ - "string", - "null" - ], - "description": "Customer's birthdate, i.e. `YYYY-MM-DD`.", - "format": "date" + "description": "An object containing details of related SKU. Those details will be used for validation and redemption processes on top of details already stored in system.", + "properties": { + "id": { + "type": [ + "string", + "null" + ] + }, + "source_id": { + "type": [ + "string", + "null" + ] + }, + "sku": { + "type": [ + "string", + "null" + ] + }, + "price": { + "type": [ + "string", + "null" + ] + }, + "metadata": { + "type": [ + "object", + "null" + ] + }, + "override": { + "type": [ + "boolean", + "null" + ], + "description": "The override is used once the product should be stored in system. If sku does not exists it will be created with the use of `source_id`. If sku does not exists it's required to set `product_id` that it belongs to." + } + } } } - }, - "order": { - "type": [ - "object", - "null" - ], - "description": "Tracks purchase transactions.", - "properties": { - "id": { - "type": [ - "string", - "null" - ], - "description": "The ID of an existing order that will be linked to redemption in this request." - }, - "status": { - "type": [ + } + }, + "customer": { + "type": [ + "object", + "null" + ], + "description": "The customer used for the order." + }, + "referrer": { + "description": "The person who referred the customer to make the order.", + "type": [ + "object", + "null" + ] + }, + "metadata": { + "type": [ + "string", + "null" + ] + } + } + }, + "reward": { + "type": [ + "object", + "null" + ], + "properties": { + "points": { + "type": [ + "number", + "null" + ] + }, + "assignment_id": { + "type": [ + "string", + "null" + ] + }, + "id": { + "type": [ + "string", + "null" + ] + } + } + }, + "metadata": { + "type": [ + "object", + "null" + ], + "description": "Metadata can be a string, number, boolean, date, datetime, image_url, object, geopoint, unknown. | related objects: campaign, voucher, publication, redemption, product, customer, order, order_item, loyalty_tier, promotion_tier." + } + } + }, + "1_req_vouchers_qualification-copy": { + "title": "RequestBodyVouchersQualification", + "type": "object", + "description": "Request body schema for /vouchers/qualification.", + "properties": { + "customer": { + "type": [ + "object", + "null" + ], + "description": "This object stores customer details.", + "properties": { + "id": { + "type": "string", + "description": "The ID of an existing customer that will be linked to the redemption in this request. Assigned by the Voucherify API, identifies the customer.", + "example": "cust_J1CDUdbqn5Exva8ASWk1Fq0j" + }, + "source_id": { + "type": [ + "string", + "null" + ], + "description": "A unique customer identifier. You can provide your own (e.g. CRM id) or use the one returned by Voucherify, see tracking_id from Validate Voucher (client-side). A tracking identifier of a user that validate a voucher. It is build based on your internal id (e.g., email, database ID). If you also pass a customer ID, the source ID will be ignored. Otherwise, if you do not pass a customer ID, the source ID you provide must either be a token, like the ones returned in origin voucher validation method done by specific customer, or a string identifying customer (e.g., email, database ID, CRM ID)." + }, + "name": { + "type": [ + "string", + "null" + ], + "description": "First and Last Name" + }, + "description": { + "type": [ + "string", + "null" + ], + "description": "An arbitrary string that you can attach to a customer object. It is displayed alongside a customer in the dashboard.\t" + }, + "email": { + "type": [ + "string", + "null" + ] + }, + "phone": { + "type": [ + "string", + "null" + ] + }, + "address": { + "type": [ + "object", + "null" + ], + "additionalProperties": false, + "description": "A set of key/value pairs which describes the address.", + "properties": { + "city": { + "type": [ + "string", + "null" + ] + }, + "country": { + "type": [ + "string", + "null" + ] + }, + "line_1": { + "type": [ + "string", + "null" + ] + }, + "line_2": { + "type": [ + "string", + "null" + ] + }, + "postal_code": { + "type": [ + "string", + "null" + ] + }, + "state": { + "type": [ + "string", + "null" + ] + } + } + }, + "metadata": { + "type": [ + "object", + "null" + ], + "description": "A set of key/value pairs that you can attach to a customer object for segment building. It can be useful for storing additional information about the customer in a structured format." + }, + "email_unsubscribed": { + "type": [ + "boolean", + "null" + ] + }, + "birthday": { + "type": [ + "string", + "null" + ], + "description": "Customer's birthdate.", + "format": "date", + "example": "2022-03-07" + }, + "birthdate": { + "type": [ + "string", + "null" + ], + "description": "Customer's birthdate", + "example": "2022-03-07", + "format": "date" + }, + "customer_landing_page": { + "type": [ + "object", + "null" + ], + "properties": { + "custom_event": { + "type": [ + "object", + "null" + ] + }, + "consents": { + "type": [ + "object", + "null" + ] + }, + "publication_id": { + "type": [ + "string", + "null" + ] + }, + "voucher_code": { + "type": [ + "string", + "null" + ] + } + } + }, + "created_at": { + "type": "string" + } + } + }, + "order": { + "type": [ + "object", + "null" + ], + "description": "Tracks purchase transactions.", + "properties": { + "id": { + "type": [ + "string", + "null" + ], + "description": "The ID of an existing order that will be linked to redemption in this request." + }, + "status": { + "type": [ + "string", + "null" + ], + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULFILLED" + ] + }, + "source_id": { + "type": [ + "string", + "null" + ], + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + }, + "amount": { + "type": [ + "integer", + "null" + ], + "minimum": 0, + "description": "Represents a total amount of order items (sum of item.amount)\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "discount_amount": { + "type": [ + "integer", + "null" + ], + "minimum": 0, + "description": "Summarize all discounts applied to the order inlcuding discounts applied to particular order line items and discounts applied to the whole cart.\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "items": { + "type": "array", + "description": "List of Order Items constituting the order. Order items can be defined either by product_id or sku_id. Along with every item you must define quantity.A list of Order Items that have been applied to the order. hyperlink the Order Items to another object.\n", + "items": { + "type": [ + "object", + "null" + ], + "properties": { + "id": { + "type": [ "string", "null" - ], - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULFILLED" ] }, "source_id": { @@ -6044,37284 +6533,36814 @@ "string", "null" ], - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - }, - "amount": { - "type": [ - "integer", - "null" - ], - "minimum": 0, - "description": "Represents a total amount of order items (sum of item.amount)\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "discount_amount": { - "type": [ - "integer", - "null" - ], - "minimum": 0, - "description": "Summarize all discounts applied to the order inlcuding discounts applied to particular order line items and discounts applied to the whole cart.\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "items": { - "type": "array", - "description": "List of Order Items constituting the order. Order items can be defined either by product_id or sku_id. Along with every item you must define quantity.A list of Order Items that have been applied to the order. hyperlink the Order Items to another object.\n", - "items": { - "type": [ - "object", - "null" - ], - "properties": { - "id": { - "type": [ - "string", - "null" - ] - }, - "source_id": { - "type": [ - "string", - "null" - ], - "description": "Product/SKU reference ID" - }, - "product_id": { - "type": [ - "string", - "null" - ] - }, - "sku_id": { - "type": [ - "string", - "null" - ] - }, - "related_object": { - "type": [ - "string", - "null" - ], - "enum": [ - "product", - "sku" - ], - "description": "Allowed values: `product`, `sku`" - }, - "amount": { - "type": [ - "integer", - "null" - ], - "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item." - }, - "discount_amount": { - "type": [ - "integer", - "null" - ], - "description": "Represents total amount of the discount applied to order line items\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "quantity": { - "type": [ - "integer", - "null" - ] - }, - "discount_quantity": { - "type": [ - "integer", - "null" - ], - "description": "number of items being discounted\t" - }, - "price": { - "type": [ - "integer", - "null" - ], - "description": "Unit price of an item" - }, - "product": { - "type": [ - "object", - "null" - ], - "description": "An object containing details of related product. Those details will be used for validation and redemption processes on top of details already stored in system.", - "properties": { - "id": { - "type": [ - "string", - "null" - ] - }, - "source_id": { - "type": [ - "string", - "null" - ] - }, - "name": { - "type": [ - "string", - "null" - ] - }, - "price": { - "type": [ - "null", - "integer" - ] - }, - "metadata": { - "type": [ - "object", - "null" - ] - }, - "override": { - "type": [ - "boolean", - "null" - ], - "description": "The `override` is used once the product should be stored in system. If product does not exists it will be created with the use of `source_id`." - } - } - }, - "sku": { - "type": [ - "object", - "null" - ], - "description": "An object containing details of related SKU. Those details will be used for validation and redemption processes on top of details already stored in system.", - "properties": { - "id": { - "type": [ - "string", - "null" - ] - }, - "source_id": { - "type": [ - "string", - "null" - ] - }, - "sku": { - "type": [ - "string", - "null" - ] - }, - "price": { - "type": [ - "string", - "null" - ] - }, - "metadata": { - "type": [ - "object", - "null" - ] - }, - "override": { - "type": [ - "boolean", - "null" - ], - "description": "The override is used once the product should be stored in system. If sku does not exists it will be created with the use of `source_id`. If sku does not exists it's required to set `product_id` that it belongs to." - } - } - } - } - } - }, - "customer": { - "type": [ - "object", - "null" - ], - "description": "The customer used for the order." - }, - "referrer": { - "description": "The person who referred the customer to make the order.", - "type": [ - "object", - "null" - ] + "description": "Product/SKU reference ID" }, - "metadata": { + "product_id": { "type": [ "string", "null" ] - } - } - }, - "reward": { - "type": [ - "object", - "null" - ], - "properties": { - "points": { - "type": [ - "number", - "null" - ] }, - "assignment_id": { + "sku_id": { "type": [ "string", "null" ] }, - "id": { + "related_object": { "type": [ "string", "null" - ] - } - } - }, - "metadata": { - "type": [ - "object", - "null" - ], - "description": "Metadata can be a string, number, boolean, date, datetime, image_url, object, geopoint, unknown. | related objects: campaign, voucher, publication, redemption, product, customer, order, order_item, loyalty_tier, promotion_tier." - } - } - }, - "1_req_vouchers_qualification-copy": { - "title": "RequestBodyVouchersQualification", - "type": "object", - "description": "Request body schema for /vouchers/qualification.", - "properties": { - "customer": { - "type": [ - "object", - "null" - ], - "description": "This object stores customer details.", - "properties": { - "id": { - "type": "string", - "description": "The ID of an existing customer that will be linked to the redemption in this request. Assigned by the Voucherify API, identifies the customer.", - "example": "cust_J1CDUdbqn5Exva8ASWk1Fq0j" + ], + "enum": [ + "product", + "sku" + ], + "description": "Allowed values: `product`, `sku`" }, - "source_id": { + "amount": { "type": [ - "string", + "integer", "null" ], - "description": "A unique customer identifier. You can provide your own (e.g. CRM id) or use the one returned by Voucherify, see tracking_id from Validate Voucher (client-side). A tracking identifier of a user that validate a voucher. It is build based on your internal id (e.g., email, database ID). If you also pass a customer ID, the source ID will be ignored. Otherwise, if you do not pass a customer ID, the source ID you provide must either be a token, like the ones returned in origin voucher validation method done by specific customer, or a string identifying customer (e.g., email, database ID, CRM ID)." + "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item." }, - "name": { + "discount_amount": { "type": [ - "string", + "integer", "null" ], - "description": "First and Last Name" + "description": "Represents total amount of the discount applied to order line items\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." }, - "description": { + "quantity": { "type": [ - "string", + "integer", "null" - ], - "description": "An arbitrary string that you can attach to a customer object. It is displayed alongside a customer in the dashboard.\t" + ] }, - "email": { + "discount_quantity": { "type": [ - "string", + "integer", "null" - ] + ], + "description": "number of items being discounted\t" }, - "phone": { + "price": { "type": [ - "string", + "integer", "null" - ] + ], + "description": "Unit price of an item" }, - "address": { + "product": { "type": [ "object", "null" ], - "additionalProperties": false, - "description": "A set of key/value pairs which describes the address.", + "description": "An object containing details of related product. Those details will be used for validation and redemption processes on top of details already stored in system.", "properties": { - "city": { + "id": { "type": [ "string", "null" ] }, - "country": { + "source_id": { "type": [ "string", "null" ] }, - "line_1": { + "name": { "type": [ "string", "null" ] }, - "line_2": { + "price": { "type": [ - "string", - "null" + "null", + "integer" ] }, - "postal_code": { + "metadata": { "type": [ - "string", + "object", "null" ] }, - "state": { + "override": { "type": [ - "string", + "boolean", "null" - ] + ], + "description": "The `override` is used once the product should be stored in system. If product does not exists it will be created with the use of `source_id`." } } }, - "metadata": { - "type": [ - "object", - "null" - ], - "description": "A set of key/value pairs that you can attach to a customer object for segment building. It can be useful for storing additional information about the customer in a structured format." - }, - "email_unsubscribed": { - "type": [ - "boolean", - "null" - ] - }, - "birthday": { - "type": [ - "string", - "null" - ], - "description": "Customer's birthdate.", - "format": "date", - "example": "2022-03-07" - }, - "birthdate": { - "type": [ - "string", - "null" - ], - "description": "Customer's birthdate", - "example": "2022-03-07", - "format": "date" - }, - "customer_landing_page": { + "sku": { "type": [ "object", "null" ], + "description": "An object containing details of related SKU. Those details will be used for validation and redemption processes on top of details already stored in system.", "properties": { - "custom_event": { + "id": { "type": [ - "object", + "string", "null" ] }, - "consents": { + "source_id": { "type": [ - "object", + "string", "null" ] }, - "publication_id": { + "sku": { "type": [ "string", "null" ] }, - "voucher_code": { + "price": { "type": [ "string", "null" ] + }, + "metadata": { + "type": [ + "object", + "null" + ] + }, + "override": { + "type": [ + "boolean", + "null" + ], + "description": "The override is used once the product should be stored in system. If sku does not exists it will be created with the use of `source_id`. If sku does not exists it's required to set `product_id` that it belongs to." } } - }, - "created_at": { - "type": "string" } } - }, - "order": { - "type": [ - "object", - "null" - ], - "description": "Tracks purchase transactions.", - "properties": { - "id": { - "type": [ - "string", - "null" - ], - "description": "The ID of an existing order that will be linked to redemption in this request." - }, - "status": { - "type": [ - "string", - "null" - ], - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULFILLED" - ] - }, - "source_id": { - "type": [ - "string", - "null" - ], - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - }, - "amount": { - "type": [ - "integer", - "null" - ], - "minimum": 0, - "description": "Represents a total amount of order items (sum of item.amount)\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "discount_amount": { - "type": [ - "integer", - "null" - ], - "minimum": 0, - "description": "Summarize all discounts applied to the order inlcuding discounts applied to particular order line items and discounts applied to the whole cart.\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "items": { - "type": "array", - "description": "List of Order Items constituting the order. Order items can be defined either by product_id or sku_id. Along with every item you must define quantity.A list of Order Items that have been applied to the order. hyperlink the Order Items to another object.\n", - "items": { - "type": [ - "object", - "null" - ], - "properties": { - "id": { - "type": [ - "string", - "null" - ] - }, - "source_id": { - "type": [ - "string", - "null" - ], - "description": "Product/SKU reference ID" - }, - "product_id": { - "type": [ - "string", - "null" - ] - }, - "sku_id": { - "type": [ - "string", - "null" - ] - }, - "related_object": { - "type": [ - "string", - "null" - ], - "enum": [ - "product", - "sku" - ], - "description": "Allowed values: `product`, `sku`" - }, - "amount": { - "type": [ - "integer", - "null" - ], - "description": "Represents a total amount of order item (price * quantity).\n\nYou should provide it to retrieve `discount_amount` if the discount is applied only to this item." - }, - "discount_amount": { - "type": [ - "integer", - "null" - ], - "description": "Represents total amount of the discount applied to order line items\n\nValue is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "quantity": { - "type": [ - "integer", - "null" - ] - }, - "discount_quantity": { - "type": [ - "integer", - "null" - ], - "description": "number of items being discounted\t" - }, - "price": { - "type": [ - "integer", - "null" - ], - "description": "Unit price of an item" - }, - "product": { - "type": [ - "object", - "null" - ], - "description": "An object containing details of related product. Those details will be used for validation and redemption processes on top of details already stored in system.", - "properties": { - "id": { - "type": [ - "string", - "null" - ] - }, - "source_id": { - "type": [ - "string", - "null" - ] - }, - "name": { - "type": [ - "string", - "null" - ] - }, - "price": { - "type": [ - "null", - "integer" - ] - }, - "metadata": { - "type": [ - "object", - "null" - ] - }, - "override": { - "type": [ - "boolean", - "null" - ], - "description": "The `override` is used once the product should be stored in system. If product does not exists it will be created with the use of `source_id`." - } - } - }, - "sku": { - "type": [ - "object", - "null" - ], - "description": "An object containing details of related SKU. Those details will be used for validation and redemption processes on top of details already stored in system.", - "properties": { - "id": { - "type": [ - "string", - "null" - ] - }, - "source_id": { - "type": [ - "string", - "null" - ] - }, - "sku": { - "type": [ - "string", - "null" - ] - }, - "price": { - "type": [ - "string", - "null" - ] - }, - "metadata": { - "type": [ - "object", - "null" - ] - }, - "override": { - "type": [ - "boolean", - "null" - ], - "description": "The override is used once the product should be stored in system. If sku does not exists it will be created with the use of `source_id`. If sku does not exists it's required to set `product_id` that it belongs to." - } - } - } - } - } - }, - "customer": { - "type": [ - "object", - "null" - ], - "description": "The customer used for the order." - }, - "referrer": { - "description": "The person who referred the customer to make the order.", - "type": [ - "object", - "null" - ] - }, - "metadata": { - "type": [ - "string", - "null" - ] - } - } - }, - "reward": { - "type": [ - "object", - "null" - ], - "properties": { - "points": { - "type": [ - "number", - "null" - ] - }, - "assignment_id": { - "type": [ - "string", - "null" - ] - }, - "id": { - "type": [ - "string", - "null" - ] - } - } - }, - "metadata": { - "type": [ - "object", - "null" - ], - "description": "Metadata can be a string, number, boolean, date, datetime, image_url, object, geopoint, unknown. | related objects: campaign, voucher, publication, redemption, product, customer, order, order_item, loyalty_tier, promotion_tier." - }, - "gift": { - "type": [ - "object", - "null" - ], - "properties": { - "credits": { - "type": [ - "number", - "null" - ] - } - } - }, - "session": { - "type": [ - "object", - "null" - ], - "properties": { - "key": { - "type": [ - "string", - "null" - ], - "description": "Unique session identifier assigned by the Voucherify API." - }, - "type": { - "type": [ - "string", - "null" - ], - "enum": [ - "COUNT_PER_CUSTOMER", - "ORDER", - "LOCK" - ], - "description": "The type of session. Required to establish a new session. \n\n`LOCK`: Locks the following parameters within the session:\n\n- redemption quantity by 1\n- redemption gift credits specified with the requests\n- redemption loyalty points specified with the request" - }, - "ttl": { - "type": [ - "number", - "null" - ], - "description": "Value for the period of time that the session is active. Units for this parameter are defined by `session.ttl_unit`." - }, - "ttl_unit": { - "type": [ - "string", - "null" - ], - "enum": [ - "DAYS", - "HOURS", - "MICROSECONDS", - "MILLISECONDS", - "MINUTES", - "NANOSECONDS", - "SECONDS" - ], - "description": "Defines the type of unit in which the session time is counted." - } - } - }, - "tracking_id": { - "type": [ - "string", - "null" - ], - "maxLength": 2500, - "example": "track_fxEMFisanb7t4l96X8WKcemyGNPnHpGM3KTfUsqZGCOx/p57/J2+Yw==", - "description": "A tracking identifier of a user that validated a voucher. Identifier generated during voucher validation. This is a hashed customer source ID." } + }, + "customer": { + "type": [ + "object", + "null" + ], + "description": "The customer used for the order." + }, + "referrer": { + "description": "The person who referred the customer to make the order.", + "type": [ + "object", + "null" + ] + }, + "metadata": { + "type": [ + "string", + "null" + ] } - }, - "1_req_obj_vouchers_qualification_order": { - "title": "OrderObject", - "type": "object", - "properties": { - "id": { - "type": "string" - } + } + }, + "reward": { + "type": [ + "object", + "null" + ], + "properties": { + "points": { + "type": [ + "number", + "null" + ] + }, + "assignment_id": { + "type": [ + "string", + "null" + ] + }, + "id": { + "type": [ + "string", + "null" + ] } - }, - "1_req_obj_vouchers_qualification_reward": { - "title": "RewardObject", - "type": "object", - "properties": { - "id": { - "type": "string" - } + } + }, + "metadata": { + "type": [ + "object", + "null" + ], + "description": "Metadata can be a string, number, boolean, date, datetime, image_url, object, geopoint, unknown. | related objects: campaign, voucher, publication, redemption, product, customer, order, order_item, loyalty_tier, promotion_tier." + }, + "gift": { + "type": [ + "object", + "null" + ], + "properties": { + "credits": { + "type": [ + "number", + "null" + ] } - }, - "0_obj_metadata": { - "title": "MetadataObject", - "type": "object", - "properties": { - "id": { - "type": "string" - } + } + }, + "session": { + "type": [ + "object", + "null" + ], + "properties": { + "key": { + "type": [ + "string", + "null" + ], + "description": "Unique session identifier assigned by the Voucherify API." + }, + "type": { + "type": [ + "string", + "null" + ], + "enum": [ + "COUNT_PER_CUSTOMER", + "ORDER", + "LOCK" + ], + "description": "The type of session. Required to establish a new session. \n\n`LOCK`: Locks the following parameters within the session:\n\n- redemption quantity by 1\n- redemption gift credits specified with the requests\n- redemption loyalty points specified with the request" + }, + "ttl": { + "type": [ + "number", + "null" + ], + "description": "Value for the period of time that the session is active. Units for this parameter are defined by `session.ttl_unit`." + }, + "ttl_unit": { + "type": [ + "string", + "null" + ], + "enum": [ + "DAYS", + "HOURS", + "MICROSECONDS", + "MILLISECONDS", + "MINUTES", + "NANOSECONDS", + "SECONDS" + ], + "description": "Defines the type of unit in which the session time is counted." } - }, - "res_empty_json": { - "type": "object", - "description": "Schema model for an empty json.", - "title": "Empty JSON", - "examples": [ - {} - ] - }, - "2_obj_campaign_object": { - "type": "object", - "title": "Campaign Object", - "description": "This is an object representing a campaign.", - "x-tags": [ - "CAMPAIGNS API" - ], - "properties": { - "id": { - "type": "string", - "description": "Unique campaign ID, assigned by Voucherify.", - "example": "camp_f7fBbQxUuTN7dI7tGOo5XMDA" - }, - "name": { - "type": "string", - "description": "Campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "campaign_type": { - "type": "string", - "enum": [ - "LOYALTY_PROGRAM", - "GIFT_VOUCHERS", - "DISCOUNT_COUPONS", - "PROMOTION", - "REFERRAL_PROGRAM", - "LUCKY_DRAW" - ], - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria \n- `STATIC`: vouchers need to be manually published", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "voucher": { - "anyOf": [ - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" - }, - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_GIFT_CARD" - }, - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_LOYALTY_CARD" - } - ] - }, - "auto_join": { - "type": "boolean", - "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" + } + }, + "tracking_id": { + "type": [ + "string", + "null" + ], + "maxLength": 2500, + "example": "track_fxEMFisanb7t4l96X8WKcemyGNPnHpGM3KTfUsqZGCOx/p57/J2+Yw==", + "description": "A tracking identifier of a user that validated a voucher. Identifier generated during voucher validation. This is a hashed customer source ID." + } + } + }, + "1_req_obj_vouchers_qualification_order": { + "title": "OrderObject", + "type": "object", + "properties": { + "id": { + "type": "string" + } + } + }, + "1_req_obj_vouchers_qualification_reward": { + "title": "RewardObject", + "type": "object", + "properties": { + "id": { + "type": "string" + } + } + }, + "0_obj_metadata": { + "title": "MetadataObject", + "type": "object", + "properties": { + "id": { + "type": "string" + } + } + }, + "res_empty_json": { + "type": "object", + "description": "Schema model for an empty json.", + "title": "Empty JSON", + "examples": [ + {} + ] + }, + "2_obj_campaign_object": { + "type": "object", + "title": "Campaign Object", + "description": "This is an object representing a campaign.", + "x-tags": [ + "CAMPAIGNS API" + ], + "properties": { + "id": { + "type": "string", + "description": "Unique campaign ID, assigned by Voucherify.", + "example": "camp_f7fBbQxUuTN7dI7tGOo5XMDA" + }, + "name": { + "type": "string", + "description": "Campaign name." + }, + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "campaign_type": { + "type": "string", + "enum": [ + "LOYALTY_PROGRAM", + "GIFT_VOUCHERS", + "DISCOUNT_COUPONS", + "PROMOTION", + "REFERRAL_PROGRAM", + "LUCKY_DRAW" + ], + "description": "Type of campaign." + }, + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria \n- `STATIC`: vouchers need to be manually published", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + }, + "voucher": { + "anyOf": [ + { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" + }, + { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_GIFT_CARD" + }, + { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_LOYALTY_CARD" + } + ] + }, + "auto_join": { + "type": "boolean", + "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "use_voucher_metadata_schema": { + "type": "boolean", + "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "vouchers_count": { + "type": "integer", + "description": "Total number of unique vouchers in campaign." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2021-12-01T08:00:50.038Z", + "description": "Timestamp representing the date and time when the campaign was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-09-20T09:18:19.623Z", + "description": "Timestamp representing the date and time when the voucher was updated in ISO 8601 format." + }, + "category": { + "type": "string", + "description": "Unique category name." + }, + "creation_status": { + "type": "string", + "enum": [ + "DONE", + "IN_PROGRESS", + "FAILED", + "DRAFT", + "MODIFYING" + ], + "description": "Indicates the status of the campaign creation." + }, + "vouchers_generation_status": { + "type": "string", + "description": "Indicates the status of the campaign's vouchers.", + "enum": [ + "DONE", + "IN_PROGRESS", + "FAILED", + "DRAFT" + ] + }, + "protected": { + "type": "boolean", + "description": "Indicates whether the resource can be deleted." + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to.", + "example": "cat_0b688929a2476386a7" + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" + }, + "object": { + "type": "string", + "default": "campaign", + "description": "The type of object represented by JSON. This object stores information about the campaign." + }, + "referral_program": { + "type": "object", + "description": "Defines the referee reward and the way a referral is triggered. Context: `REFERRAL_PROGRAM`.", + "properties": { + "conversion_event_type": { + "type": "string", + "enum": [ + "redemption", + "custom_event" + ], + "description": "How a referral is triggered." + }, + "custom_event": { + "type": "object", + "description": "Contains details about the custom event.", + "properties": { + "id": { + "type": "string", + "example": "ms_fi47Dcu5T0m3v3nT5ch3ma", + "description": "Unique custom event ID." + }, + "name": { + "type": "string", + "description": "Custom event name." } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2021-12-01T08:00:50.038Z", - "description": "Timestamp representing the date and time when the campaign was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-09-20T09:18:19.623Z", - "description": "Timestamp representing the date and time when the voucher was updated in ISO 8601 format." - }, - "category": { - "type": "string", - "description": "Unique category name." - }, - "creation_status": { - "type": "string", - "enum": [ - "DONE", - "IN_PROGRESS", - "FAILED", - "DRAFT", - "MODIFYING" - ], - "description": "Indicates the status of the campaign creation." - }, - "vouchers_generation_status": { - "type": "string", - "description": "Indicates the status of the campaign's vouchers.", - "enum": [ - "DONE", - "IN_PROGRESS", - "FAILED", - "DRAFT" - ] - }, - "protected": { - "type": "boolean", - "description": "Indicates whether the resource can be deleted." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to.", - "example": "cat_0b688929a2476386a7" - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object" - }, - "object": { - "type": "string", - "default": "campaign", - "description": "The type of object represented by JSON. This object stores information about the campaign." - }, - "referral_program": { - "type": "object", - "description": "Defines the referee reward and the way a referral is triggered. Context: `REFERRAL_PROGRAM`.", - "properties": { - "conversion_event_type": { - "type": "string", - "enum": [ - "redemption", - "custom_event" - ], - "description": "How a referral is triggered." - }, - "custom_event": { - "type": "object", - "description": "Contains details about the custom event.", - "properties": { - "id": { - "type": "string", - "example": "ms_fi47Dcu5T0m3v3nT5ch3ma", - "description": "Unique custom event ID." - }, - "name": { - "type": "string", - "description": "Custom event name." - } - } - }, - "referee_reward": { - "type": "object", - "description": "Defines the referee reward.", - "properties": { - "related_object_parent": { - "type": "object", - "description": "Details of the resource from which the reward originates.", - "properties": { - "id": { - "type": "string", - "description": "Unique ID of the reward source." - }, - "name": { - "type": "string", - "description": "Name of the reward source." - }, - "object": { - "type": "string", - "description": "Type of resource represented by the source of the reward." - } - } - }, - "type": { - "type": "string", - "description": "Type of reward.", - "enum": [ - "LOYALTY_CARD", - "GIFT_VOUCHER" - ] - }, - "amount": { - "type": "string", - "description": "The number of `points` to add to a loyalty card or `credits` to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - } + } + }, + "referee_reward": { + "type": "object", + "description": "Defines the referee reward.", + "properties": { + "related_object_parent": { + "type": "object", + "description": "Details of the resource from which the reward originates.", + "properties": { + "id": { + "type": "string", + "description": "Unique ID of the reward source." + }, + "name": { + "type": "string", + "description": "Name of the reward source." + }, + "object": { + "type": "string", + "description": "Type of resource represented by the source of the reward." } } + }, + "type": { + "type": "string", + "description": "Type of reward.", + "enum": [ + "LOYALTY_CARD", + "GIFT_VOUCHER" + ] + }, + "amount": { + "type": "string", + "description": "The number of `points` to add to a loyalty card or `credits` to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." } - }, - "promotion": { - "$ref": "#/components/schemas/3_res_list_promotion_tiers_from_campaign" - }, - "loyalty_tiers_expiration": { - "type": "object", - "description": "Defines the expiration mechanism for loyalty tiers.", - "anyOf": [ - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance" - }, - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_points_in_period" - } - ] } } - }, - "2_loyalty_tiers_expiration_balance": { - "title": "Balance", - "type": "object", - "description": "Defines the Balance expiration mechanism for loyalty tiers.", - "properties": { - "qualification_type": { - "type": "string", - "enum": [ - "BALANCE" - ], - "description": "Tier qualification. \n\n`BALANCE`: Points balance is based on the customer's current points balance. Customers qualify for the tier if their points balance is in the points range of the tier." - }, - "start_date": { - "type": "object", - "description": "Defines the conditions for the start date of the tier.", - "properties": { - "type": { - "type": "string", - "enum": [ - "IMMEDIATE" - ], - "description": "What triggers the tier to be valid for a customer. \n`IMMEDIATE`: After reaching the minimum required points." - } - } - }, - "expiration_date": { - "description": "Defines the conditions for the expiration date of a tier.", - "anyOf": [ - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance_expiration_date_balance_drop" - }, - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance_expiration_date_custom" - } - ] - } + } + }, + "promotion": { + "$ref": "#/components/schemas/3_res_list_promotion_tiers_from_campaign" + }, + "loyalty_tiers_expiration": { + "type": "object", + "description": "Defines the expiration mechanism for loyalty tiers.", + "anyOf": [ + { + "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance" + }, + { + "$ref": "#/components/schemas/2_loyalty_tiers_expiration_points_in_period" } - }, - "2_loyalty_tiers_expiration_balance_expiration_date_balance_drop": { - "title": "Balance Drop", - "type": "object", - "description": "Defines the conditions for the expiration date of a tier based on a pure balance drop.", - "properties": { - "type": { - "type": "string", - "enum": [ - "BALANCE_DROP" - ], - "description": "What triggers the tier to expire for a customer. \n`BALANCE_DROP`: Tier expires when the points balance drops below the required range of the tier." - } + ] + } + } + }, + "2_loyalty_tiers_expiration_balance": { + "title": "Balance", + "type": "object", + "description": "Defines the Balance expiration mechanism for loyalty tiers.", + "properties": { + "qualification_type": { + "type": "string", + "enum": [ + "BALANCE" + ], + "description": "Tier qualification. \n\n`BALANCE`: Points balance is based on the customer's current points balance. Customers qualify for the tier if their points balance is in the points range of the tier." + }, + "start_date": { + "type": "object", + "description": "Defines the conditions for the start date of the tier.", + "properties": { + "type": { + "type": "string", + "enum": [ + "IMMEDIATE" + ], + "description": "What triggers the tier to be valid for a customer. \n`IMMEDIATE`: After reaching the minimum required points." } - }, - "2_loyalty_tiers_expiration_balance_expiration_date_custom": { - "title": "Custom", - "type": "object", - "description": "Defines the custom conditions for the expiration date of a tier.", - "properties": { - "type": { - "type": "string", - "enum": [ - "CUSTOM" - ], - "description": "What triggers the tier to expire for a customer. \n`CUSTOM`: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier." - }, - "extend": { - "type": "string", - "description": "Defines the amount of time the tier will remain active in ISO 8601 format. The expiration date counter starts at the moment when the customer reaches the minimum required points that are required to be in the tier. For example, a tier with a duration of P3M will be valid for a duration of 3 months." - }, - "rounding": { - "description": "Defines the rounding mechanism for tier expiration.", - "anyOf": [ - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_expiration_date_rounding_default_options" - }, - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_expiration_date_rounding_custom" - } - ] - } + } + }, + "expiration_date": { + "description": "Defines the conditions for the expiration date of a tier.", + "anyOf": [ + { + "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance_expiration_date_balance_drop" + }, + { + "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance_expiration_date_custom" } - }, - "2_loyalty_tiers_expiration_expiration_date_rounding_default_options": { - "title": "Calendar Periods", - "type": "object", - "description": "Defines the rounding mechanism for tier expiration based on a list of available time periods.", - "properties": { - "type": { - "type": "string", - "enum": [ - "MONTH", - "QUARTER", - "HALF_YEAR", - "YEAR" - ], - "description": "Period to which the expiration will be rounded to. \n- `MONTH`: The expiration date will be rounded to the end of the month. \n- `QUARTER`: The expiration date will be rounded to the end of the quarter. \n- `HALF_YEAR`: The expiration date will be rounded to the half year. \n- `YEAR`: The expiration date will be rounded to the end of the year." - }, - "strategy": { - "type": "string", - "description": "Which portion of the given period should the rounding be applied to.", - "enum": [ - "END" - ] - } + ] + } + } + }, + "2_loyalty_tiers_expiration_balance_expiration_date_balance_drop": { + "title": "Balance Drop", + "type": "object", + "description": "Defines the conditions for the expiration date of a tier based on a pure balance drop.", + "properties": { + "type": { + "type": "string", + "enum": [ + "BALANCE_DROP" + ], + "description": "What triggers the tier to expire for a customer. \n`BALANCE_DROP`: Tier expires when the points balance drops below the required range of the tier." + } + } + }, + "2_loyalty_tiers_expiration_balance_expiration_date_custom": { + "title": "Custom", + "type": "object", + "description": "Defines the custom conditions for the expiration date of a tier.", + "properties": { + "type": { + "type": "string", + "enum": [ + "CUSTOM" + ], + "description": "What triggers the tier to expire for a customer. \n`CUSTOM`: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier." + }, + "extend": { + "type": "string", + "description": "Defines the amount of time the tier will remain active in ISO 8601 format. The expiration date counter starts at the moment when the customer reaches the minimum required points that are required to be in the tier. For example, a tier with a duration of P3M will be valid for a duration of 3 months." + }, + "rounding": { + "description": "Defines the rounding mechanism for tier expiration.", + "anyOf": [ + { + "$ref": "#/components/schemas/2_loyalty_tiers_expiration_expiration_date_rounding_default_options" + }, + { + "$ref": "#/components/schemas/2_loyalty_tiers_expiration_expiration_date_rounding_custom" } - }, - "2_loyalty_tiers_expiration_expiration_date_rounding_custom": { - "title": "Specific Month", - "type": "object", - "description": "Defines the custom rounding mechanism for tier expiration.", - "properties": { - "type": { - "type": "string", - "enum": [ - "CUSTOM" - ], - "description": "This mechanism describes a custom rounding for the expiration date." - }, - "strategy": { - "type": "string", - "description": "Which portion of the given period should the rounding be applied to.", - "enum": [ - "END" - ] - }, - "unit": { - "type": "string", - "description": "Defines the type of unit of time in which the rounding period is counted.", - "enum": [ - "MONTH" - ] - }, - "value": { - "type": "integer", - "description": "Value for the unit of time that the rounding applies to. Units for this parameter are defined by the `rounding.unit` parameter. \n- `0`: January\n- `1`: February\n- `2`: March\n- `3`: April\n- `4`: May\n- `5`: June\n- `6`: July\n- `7`: August\n- `8`: September\n- `9`: October\n- `10`: November\n- `11`: December" - } + ] + } + } + }, + "2_loyalty_tiers_expiration_expiration_date_rounding_default_options": { + "title": "Calendar Periods", + "type": "object", + "description": "Defines the rounding mechanism for tier expiration based on a list of available time periods.", + "properties": { + "type": { + "type": "string", + "enum": [ + "MONTH", + "QUARTER", + "HALF_YEAR", + "YEAR" + ], + "description": "Period to which the expiration will be rounded to. \n- `MONTH`: The expiration date will be rounded to the end of the month. \n- `QUARTER`: The expiration date will be rounded to the end of the quarter. \n- `HALF_YEAR`: The expiration date will be rounded to the half year. \n- `YEAR`: The expiration date will be rounded to the end of the year." + }, + "strategy": { + "type": "string", + "description": "Which portion of the given period should the rounding be applied to.", + "enum": [ + "END" + ] + } + } + }, + "2_loyalty_tiers_expiration_expiration_date_rounding_custom": { + "title": "Specific Month", + "type": "object", + "description": "Defines the custom rounding mechanism for tier expiration.", + "properties": { + "type": { + "type": "string", + "enum": [ + "CUSTOM" + ], + "description": "This mechanism describes a custom rounding for the expiration date." + }, + "strategy": { + "type": "string", + "description": "Which portion of the given period should the rounding be applied to.", + "enum": [ + "END" + ] + }, + "unit": { + "type": "string", + "description": "Defines the type of unit of time in which the rounding period is counted.", + "enum": [ + "MONTH" + ] + }, + "value": { + "type": "integer", + "description": "Value for the unit of time that the rounding applies to. Units for this parameter are defined by the `rounding.unit` parameter. \n- `0`: January\n- `1`: February\n- `2`: March\n- `3`: April\n- `4`: May\n- `5`: June\n- `6`: July\n- `7`: August\n- `8`: September\n- `9`: October\n- `10`: November\n- `11`: December" + } + } + }, + "2_loyalty_tiers_expiration_points_in_period": { + "title": "Points in Period", + "type": "object", + "description": "Defines the Points in Period expiration mechanism for loyalty tiers.", + "properties": { + "qualification_type": { + "type": "string", + "enum": [ + "POINTS_IN_PERIOD" + ], + "description": "Tier qualification. \n\n`POINTS_IN_PERIOD`: A customer qualifies for the tier only if the sum of the accumulated points in a **defined time interval** reaches the tier threshold." + }, + "qualification_period": { + "type": "string", + "description": "Customers can qualify for the tier if they collected enough points in a given time period. So, in addition to the customer having to reach a points range, they also need to have collected the points within a set time period. \n\n| **Period** | **Definition** |\n|:---|:---|\n| **Calendar Month** | Points collected in one calendar month
                  January, February, March, etc. |\n| **Calendar Quarter** | Points collected in the quarter
                  - January - March
                  - April - June
                  - July - September
                  - October - December |\n| **Calendar Half-year** | Points collected in the half-year
                  - January - June
                  - July - December |\n| **Calendar Year** | Points collected in one calendar year
                  January - December |", + "enum": [ + "MONTH", + "QUARTER", + "HALF_YEAR", + "YEAR" + ] + }, + "start_date": { + "type": "object", + "description": "Defines the conditions for the start date of the tier.", + "properties": { + "type": { + "type": "string", + "enum": [ + "IMMEDIATE", + "NEXT_PERIOD" + ], + "description": "What triggers the tier to be valid for a customer. \n`IMMEDIATE`: After reaching the minimum required points. \n`NEXT_PERIOD`: When the next qualification period starts." } - }, - "2_loyalty_tiers_expiration_points_in_period": { - "title": "Points in Period", - "type": "object", - "description": "Defines the Points in Period expiration mechanism for loyalty tiers.", - "properties": { - "qualification_type": { - "type": "string", - "enum": [ - "POINTS_IN_PERIOD" - ], - "description": "Tier qualification. \n\n`POINTS_IN_PERIOD`: A customer qualifies for the tier only if the sum of the accumulated points in a **defined time interval** reaches the tier threshold." - }, - "qualification_period": { - "type": "string", - "description": "Customers can qualify for the tier if they collected enough points in a given time period. So, in addition to the customer having to reach a points range, they also need to have collected the points within a set time period. \n\n| **Period** | **Definition** |\n|:---|:---|\n| **Calendar Month** | Points collected in one calendar month
                  January, February, March, etc. |\n| **Calendar Quarter** | Points collected in the quarter
                  - January - March
                  - April - June
                  - July - September
                  - October - December |\n| **Calendar Half-year** | Points collected in the half-year
                  - January - June
                  - July - December |\n| **Calendar Year** | Points collected in one calendar year
                  January - December |", - "enum": [ - "MONTH", - "QUARTER", - "HALF_YEAR", - "YEAR" - ] - }, - "start_date": { - "type": "object", - "description": "Defines the conditions for the start date of the tier.", - "properties": { - "type": { - "type": "string", - "enum": [ - "IMMEDIATE", - "NEXT_PERIOD" - ], - "description": "What triggers the tier to be valid for a customer. \n`IMMEDIATE`: After reaching the minimum required points. \n`NEXT_PERIOD`: When the next qualification period starts." - } - } - }, - "expiration_date": { - "type": "object", - "description": "Defines the conditions for the expiration date of a tier.", - "properties": { - "type": { - "type": "string", - "enum": [ - "END_OF_PERIOD", - "END_OF_NEXT_PERIOD" - ], - "description": "What triggers the tier to expire for a customer. \n`END_OF_PERIOD`: Expire tier at the end of the period. \n`END_OF_NEXT_PERIOD`: Expire tier at the end of the next period." - }, - "extend": { - "type": "string", - "description": "Extend the expiration by adding extra months or days in ISO 8601 format. The tier will remain active even though it reaches its expiration time period. For example, a tier with a duration of `P3M` will be valid for an additional duration of 3 months and a tier with a duration of `P1D` will be valid for an additional duration of 1 day." - } - } - } + } + }, + "expiration_date": { + "type": "object", + "description": "Defines the conditions for the expiration date of a tier.", + "properties": { + "type": { + "type": "string", + "enum": [ + "END_OF_PERIOD", + "END_OF_NEXT_PERIOD" + ], + "description": "What triggers the tier to expire for a customer. \n`END_OF_PERIOD`: Expire tier at the end of the period. \n`END_OF_NEXT_PERIOD`: Expire tier at the end of the next period." + }, + "extend": { + "type": "string", + "description": "Extend the expiration by adding extra months or days in ISO 8601 format. The tier will remain active even though it reaches its expiration time period. For example, a tier with a duration of `P3M` will be valid for an additional duration of 3 months and a tier with a duration of `P1D` will be valid for an additional duration of 1 day." } - }, - "2_req_create_campaign": { - "title": "Create Campaign Request Body", - "description": "Request body schema for **POST** `/campaigns`.", - "oneOf": [ - { - "$ref": "#/components/schemas/2_req_create_campaign_discount_voucher" - }, - { - "$ref": "#/components/schemas/2_req_create_campaign_loyalty" - }, - { - "$ref": "#/components/schemas/2_req_create_campaign_gift" - }, - { - "$ref": "#/components/schemas/2_req_create_campaign_promotion" - }, - { - "$ref": "#/components/schemas/2_req_create_campaign_referral" - } - ] - }, - "2_req_create_campaign_discount_voucher": { - "type": "object", - "title": "Discount Campaign", - "description": "Request body schema for creating a discount voucher campaign using **POST** `/campaigns`.", - "properties": { - "name": { - "type": "string", - "description": "Campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "campaign_type": { - "type": "string", - "default": "DISCOUNT_COUPONS", - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign (size of campaign)." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "voucher": { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" - } + } + } + } + }, + "2_req_create_campaign": { + "title": "Create Campaign Request Body", + "description": "Request body schema for **POST** `/campaigns`.", + "oneOf": [ + { + "$ref": "#/components/schemas/2_req_create_campaign_discount_voucher" + }, + { + "$ref": "#/components/schemas/2_req_create_campaign_loyalty" + }, + { + "$ref": "#/components/schemas/2_req_create_campaign_gift" + }, + { + "$ref": "#/components/schemas/2_req_create_campaign_promotion" + }, + { + "$ref": "#/components/schemas/2_req_create_campaign_referral" + } + ] + }, + "2_req_create_campaign_discount_voucher": { + "type": "object", + "title": "Discount Campaign", + "description": "Request body schema for creating a discount voucher campaign using **POST** `/campaigns`.", + "properties": { + "name": { + "type": "string", + "description": "Campaign name." + }, + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "campaign_type": { + "type": "string", + "default": "DISCOUNT_COUPONS", + "description": "Type of campaign." + }, + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "use_voucher_metadata_schema": { + "type": "boolean", + "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." + }, + "vouchers_count": { + "type": "integer", + "description": "Total number of unique vouchers in campaign (size of campaign)." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." } - }, - "2_req_create_campaign_loyalty": { - "type": "object", - "title": "Loyalty Campaign", - "description": "Request body schema for creating a loyalty campaign using **POST** `/campaigns`.", - "properties": { - "name": { - "type": "string", - "description": "Campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "campaign_type": { - "type": "string", - "default": "LOYALTY_PROGRAM", - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "auto_join": { - "type": "boolean", - "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. CONTEXT: `LOYALTY_PROGRAM`." - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign (size of campaign)." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "voucher": { - "$ref": "#/components/schemas/2_req_campaign_object_voucher_object_LOYALTY_CARD" - } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", + "example": "cat_0b688929a2476386a7" + }, + "category": { + "type": "string", + "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + }, + "voucher": { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" + } + } + }, + "2_req_create_campaign_loyalty": { + "type": "object", + "title": "Loyalty Campaign", + "description": "Request body schema for creating a loyalty campaign using **POST** `/campaigns`.", + "properties": { + "name": { + "type": "string", + "description": "Campaign name." + }, + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "campaign_type": { + "type": "string", + "default": "LOYALTY_PROGRAM", + "description": "Type of campaign." + }, + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + }, + "auto_join": { + "type": "boolean", + "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. CONTEXT: `LOYALTY_PROGRAM`." + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "use_voucher_metadata_schema": { + "type": "boolean", + "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." + }, + "vouchers_count": { + "type": "integer", + "description": "Total number of unique vouchers in campaign (size of campaign)." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." } - }, - "2_req_create_campaign_gift": { - "type": "object", - "title": "Gift Card campaign", - "description": "Request body schema for creating a gift card campaign using **POST** `/campaigns`.", - "properties": { - "name": { - "type": "string", - "description": "Campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "campaign_type": { - "type": "string", - "default": "GIFT_VOUCHERS", - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign (size of campaign)." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "voucher": { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_GIFT_CARD" - } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", + "example": "cat_0b688929a2476386a7" + }, + "category": { + "type": "string", + "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + }, + "voucher": { + "$ref": "#/components/schemas/2_req_campaign_object_voucher_object_LOYALTY_CARD" + } + } + }, + "2_req_create_campaign_gift": { + "type": "object", + "title": "Gift Card campaign", + "description": "Request body schema for creating a gift card campaign using **POST** `/campaigns`.", + "properties": { + "name": { + "type": "string", + "description": "Campaign name." + }, + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "campaign_type": { + "type": "string", + "default": "GIFT_VOUCHERS", + "description": "Type of campaign." + }, + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "use_voucher_metadata_schema": { + "type": "boolean", + "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." + }, + "vouchers_count": { + "type": "integer", + "description": "Total number of unique vouchers in campaign (size of campaign)." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." } - }, - "2_req_create_campaign_referral": { - "type": "object", - "title": "Referral Campaign", - "description": "Request body schema for creating a referral campaign using **POST** `/campaigns`.", - "properties": { - "name": { - "type": "string", - "description": "Campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "campaign_type": { - "type": "string", - "default": "REFERRAL_PROGRAM", - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign (size of campaign)." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "voucher": { - "anyOf": [ - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" - }, - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_GIFT_CARD" - }, - { - "$ref": "#/components/schemas/2_req_campaign_object_voucher_object_LOYALTY_CARD" - } - ] - }, - "referral_program": { - "description": "Defines the referee reward and the way a referral is triggered. Context: `REFERRAL_PROGRAM`.", - "type": "object", - "properties": { - "conversion_event_type": { - "type": "string", - "enum": [ - "redemption", - "custom_event" - ], - "description": "Define how a referral is triggered." - }, - "custom_event": { - "type": "object", - "description": "Contains details about the custom event.", - "properties": { - "id": { - "type": "string", - "example": "ms_Ll9enAm2BCN0M1s4VxWobLFM", - "description": "Unique custom event ID." - }, - "name": { - "type": "string", - "description": "Custom event name." - } - } - }, - "referee_reward": { - "type": "object", - "description": "Defines the referee reward.", - "properties": { - "related_object_parent": { - "type": "object", - "description": "Details of the resource from which the reward originates.", - "properties": { - "id": { - "type": "string", - "example": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", - "description": "Unique ID of the reward source." - }, - "name": { - "type": "string", - "description": "Name of the reward source." - }, - "object": { - "type": "string", - "enum": [ - "CAMPAIGN" - ], - "description": "Type of resource represented by the source of the reward." - } - } - }, - "type": { - "type": "string", - "enum": [ - "LOYALTY_CARD", - "GIFT_VOUCHER" - ], - "description": "Type of reward." - }, - "amount": { - "type": "string", - "description": "Define the number of `points` to add to a loyalty card or `credits` to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - } - } - } - } - } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", + "example": "cat_0b688929a2476386a7" + }, + "category": { + "type": "string", + "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + }, + "voucher": { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_GIFT_CARD" + } + } + }, + "2_req_create_campaign_referral": { + "type": "object", + "title": "Referral Campaign", + "description": "Request body schema for creating a referral campaign using **POST** `/campaigns`.", + "properties": { + "name": { + "type": "string", + "description": "Campaign name." + }, + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "campaign_type": { + "type": "string", + "default": "REFERRAL_PROGRAM", + "description": "Type of campaign." + }, + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "use_voucher_metadata_schema": { + "type": "boolean", + "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." + }, + "vouchers_count": { + "type": "integer", + "description": "Total number of unique vouchers in campaign (size of campaign)." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." } - }, - "2_req_create_campaign_promotion": { - "type": "object", - "title": "Promotion", - "description": "Request body schema for creating a promotions campaign using **POST** `/campaigns`.", - "properties": { - "name": { - "type": "string", - "description": "Campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "campaign_type": { - "type": "string", - "default": "PROMOTION", - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign (size of campaign)." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "promotion": { - "type": "object", - "description": "Define the promotion tiers within the campaign.", - "properties": { - "tiers": { - "type": "array", - "items": { - "$ref": "#/components/schemas/3_req_add_promotion_tier_to_campaign" - } - } - } - } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", + "example": "cat_0b688929a2476386a7" + }, + "category": { + "type": "string", + "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + }, + "voucher": { + "anyOf": [ + { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" + }, + { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_GIFT_CARD" + }, + { + "$ref": "#/components/schemas/2_req_campaign_object_voucher_object_LOYALTY_CARD" } - }, - "2_req_update_campaign": { - "type": "object", - "title": "Update Campaign Request Body", - "description": "Request body schema for **PUT** `/campaigns/{campaignId}`.", - "properties": { - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "auto_join": { - "type": "boolean", - "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" + ] + }, + "referral_program": { + "description": "Defines the referee reward and the way a referral is triggered. Context: `REFERRAL_PROGRAM`.", + "type": "object", + "properties": { + "conversion_event_type": { + "type": "string", + "enum": [ + "redemption", + "custom_event" + ], + "description": "Define how a referral is triggered." + }, + "custom_event": { + "type": "object", + "description": "Contains details about the custom event.", + "properties": { + "id": { + "type": "string", + "example": "ms_Ll9enAm2BCN0M1s4VxWobLFM", + "description": "Unique custom event ID." + }, + "name": { + "type": "string", + "description": "Custom event name." } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter or the `category` parameter.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id` parameter." } - } - }, - "2_req_add_vouchers_to_campaign": { - "type": "object", - "title": "Add Vouchers to Campaign Request Body", - "description": "Request body schema for **POST** `/campaigns/{campaignId}/vouchers`.", - "properties": { - "category_id": { - "type": "string", - "description": "Unique category ID that you would like to assign to the voucher.", - "example": "cat_0b688929a2476386a7" - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - }, - "redemption": { - "type": "object", - "description": "Stores the quantity of redemptions that can be applied to the voucher.", - "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited." - } - } - }, - "additional_info": { - "type": "string", - "description": "An optional field to keep any extra textual information about the code such as a code description and details." - }, - "code_config": { - "type": "object", - "description": "Defines code's pattern (prefix, suffix, length, charset, etc). ", - "properties": { - "length": { - "type": "string", - "description": "Number of characters in a generated code (excluding prefix and postfix)." - }, - "charset": { - "type": "string", - "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" - }, - "prefix": { - "type": "string", - "description": "A text appended before the code." - }, - "postfix": { - "type": "string", - "description": "A text appended after the code." - }, - "pattern": { - "type": "string", - "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." + }, + "referee_reward": { + "type": "object", + "description": "Defines the referee reward.", + "properties": { + "related_object_parent": { + "type": "object", + "description": "Details of the resource from which the reward originates.", + "properties": { + "id": { + "type": "string", + "example": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", + "description": "Unique ID of the reward source." + }, + "name": { + "type": "string", + "description": "Name of the reward source." + }, + "object": { + "type": "string", + "enum": [ + "CAMPAIGN" + ], + "description": "Type of resource represented by the source of the reward." + } } + }, + "type": { + "type": "string", + "enum": [ + "LOYALTY_CARD", + "GIFT_VOUCHER" + ], + "description": "Type of reward." + }, + "amount": { + "type": "string", + "description": "Define the number of `points` to add to a loyalty card or `credits` to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." } } } - }, - "2_req_add_vouchers_with_specific_code_to_campaign": { - "type": "object", - "title": "Add Vouchers with Specific Code to Campaign Request Body", - "description": "Request body schema for **POST** `/campaigns/{campaignId}/vouchers/{code}`.", - "properties": { - "category_id": { - "type": "string", - "description": "Unique category ID that you would like to assign to the voucher.", - "example": "cat_0b688929a2476386a7" - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - }, - "redemption": { - "type": "object", - "description": "Stores the quantity of redemptions that can be applied to the voucher.", - "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited." - } - } - }, - "additional_info": { - "type": "string", - "description": "An optional field to keep any extra textual information about the code such as a code description and details." - } + } + } + } + }, + "2_req_create_campaign_promotion": { + "type": "object", + "title": "Promotion", + "description": "Request body schema for creating a promotions campaign using **POST** `/campaigns`.", + "properties": { + "name": { + "type": "string", + "description": "Campaign name." + }, + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "campaign_type": { + "type": "string", + "default": "PROMOTION", + "description": "Type of campaign." + }, + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "use_voucher_metadata_schema": { + "type": "boolean", + "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." + }, + "vouchers_count": { + "type": "integer", + "description": "Total number of unique vouchers in campaign (size of campaign)." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." } - }, - "2_req_import_vouchers_to_campaign": { - "type": "array", - "title": "Import Vouchers to Campaign Request Body", - "description": "Request body schema for **POST** `/campaigns/{campaignId}/import`.", - "items": { - "$ref": "#/components/schemas/2_obj_import_vouchers_to_campaign_object" + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", + "example": "cat_0b688929a2476386a7" + }, + "category": { + "type": "string", + "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + }, + "promotion": { + "type": "object", + "description": "Define the promotion tiers within the campaign.", + "properties": { + "tiers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/3_req_add_promotion_tier_to_campaign" + } } - }, - "2_obj_import_vouchers_to_campaign_object": { - "type": "object", - "title": "Import Vouchers to Campaign", - "description": "Import Vouchers to Campaign", - "properties": { - "code": { - "type": "string", - "description": "Unique custom voucher code." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that you would like to assign to the voucher. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - }, - "redemption": { - "type": "object", - "description": "Stores the quantity of redemptions that can be applied to the voucher.", - "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited." - } - } - }, - "additional_info": { - "type": "string", - "description": "An optional field to keep any extra textual information about the code such as a code description and details." - }, - "loyalty_card": { - "type": "object", - "description": " Assign an initial points balance for a loyalty card. Context: `LOYALTY_PROGRAM`.", - "properties": { - "points": { - "type": "integer", - "description": "The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card." - } - } - }, - "gift": { + } + } + } + }, + "2_req_update_campaign": { + "type": "object", + "title": "Update Campaign Request Body", + "description": "Request body schema for **PUT** `/campaigns/{campaignId}`.", + "properties": { + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + }, + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "auto_join": { + "type": "boolean", + "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to. Either pass this parameter or the `category` parameter.", + "example": "cat_0b688929a2476386a7" + }, + "category": { + "type": "string", + "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id` parameter." + } + } + }, + "2_req_add_vouchers_to_campaign": { + "type": "object", + "title": "Add Vouchers to Campaign Request Body", + "description": "Request body schema for **POST** `/campaigns/{campaignId}/vouchers`.", + "properties": { + "category_id": { + "type": "string", + "description": "Unique category ID that you would like to assign to the voucher.", + "example": "cat_0b688929a2476386a7" + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + }, + "redemption": { + "type": "object", + "description": "Stores the quantity of redemptions that can be applied to the voucher.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } + }, + "additional_info": { + "type": "string", + "description": "An optional field to keep any extra textual information about the code such as a code description and details." + }, + "code_config": { + "type": "object", + "description": "Defines code's pattern (prefix, suffix, length, charset, etc). ", + "properties": { + "length": { + "type": "string", + "description": "Number of characters in a generated code (excluding prefix and postfix)." + }, + "charset": { + "type": "string", + "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" + }, + "prefix": { + "type": "string", + "description": "A text appended before the code." + }, + "postfix": { + "type": "string", + "description": "A text appended after the code." + }, + "pattern": { + "type": "string", + "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." + } + } + } + } + }, + "2_req_add_vouchers_with_specific_code_to_campaign": { + "type": "object", + "title": "Add Vouchers with Specific Code to Campaign Request Body", + "description": "Request body schema for **POST** `/campaigns/{campaignId}/vouchers/{code}`.", + "properties": { + "category_id": { + "type": "string", + "description": "Unique category ID that you would like to assign to the voucher.", + "example": "cat_0b688929a2476386a7" + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + }, + "redemption": { + "type": "object", + "description": "Stores the quantity of redemptions that can be applied to the voucher.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } + }, + "additional_info": { + "type": "string", + "description": "An optional field to keep any extra textual information about the code such as a code description and details." + } + } + }, + "2_req_import_vouchers_to_campaign": { + "type": "array", + "title": "Import Vouchers to Campaign Request Body", + "description": "Request body schema for **POST** `/campaigns/{campaignId}/import`.", + "items": { + "$ref": "#/components/schemas/2_obj_import_vouchers_to_campaign_object" + } + }, + "2_obj_import_vouchers_to_campaign_object": { + "type": "object", + "title": "Import Vouchers to Campaign", + "description": "Import Vouchers to Campaign", + "properties": { + "code": { + "type": "string", + "description": "Unique custom voucher code." + }, + "category_id": { + "type": "string", + "description": "Unique category ID that you would like to assign to the voucher. Either pass this parameter OR the `category`.", + "example": "cat_0b688929a2476386a7" + }, + "category": { + "type": "string", + "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the voucher. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + }, + "redemption": { + "type": "object", + "description": "Stores the quantity of redemptions that can be applied to the voucher.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } + }, + "additional_info": { + "type": "string", + "description": "An optional field to keep any extra textual information about the code such as a code description and details." + }, + "loyalty_card": { + "type": "object", + "description": " Assign an initial points balance for a loyalty card. Context: `LOYALTY_PROGRAM`.", + "properties": { + "points": { + "type": "integer", + "description": "The initial number of points to assign to the loyalty card. This is the current loyalty card score i.e. the number of loyalty points on the card." + } + } + }, + "gift": { + "type": "object", + "description": "Assign an initial cash balance for a gift card. Context: `GIFT_VOUCHERS`.", + "properties": { + "amount": { + "type": "integer", + "description": "The cash balance to assign to the gift card. This is the current gift card balance." + } + } + } + }, + "required": [ + "code" + ] + }, + "2_req_examine_qualification": { + "type": "object", + "title": "Examine Qualification Request Body", + "description": "Request body schema for **POST** `/campaigns/qualification`.", + "examples": [], + "properties": { + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" + } + ], + "description": "Order information. This object enables you to pass purchase transaction data. Read what properties you can use in the [Order object](ref:get-order)." + } + } + }, + "2_res_examine_qualification": { + "type": "object", + "title": "Examine Qualification Response Body", + "description": "Response body schema for **POST** `/campaigns/qualification`.", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about campaigns in a dictionary.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of campaign objects.", + "default": "data" + }, + "data": { + "type": "array", + "description": "Contains array of campaign objects.", + "items": { + "$ref": "#/components/schemas/2_obj_campaign_object_campaigns_qualification" + } + }, + "total": { + "type": "integer", + "description": "Total valid and active campaigns matching the qualification criteria in given context." + }, + "id": { + "type": "string", + "description": "Unique qualification ID.", + "example": "qfl_dNZ3gWfKVNa8Zw15hn30uqdU" + }, + "created_at": { + "type": "string", + "format": "datetime", + "description": "Timestamp representing the date and time when the qualification was created in ISO 8601 format.", + "example": "2023-04-04T13:13:03.119Z" + }, + "tracking_id": { + "type": "string", + "description": "Hashed customer source ID." + } + } + }, + "2_obj_campaign_object_campaigns_qualification": { + "type": "object", + "title": "Campaign Object", + "description": "This is an object representing a campaign.", + "properties": { + "id": { + "type": "string", + "description": "Unique campaign ID, assigned by Voucherify.", + "example": "camp_f7fBbQxUuTN7dI7tGOo5XMDA" + }, + "name": { + "type": "string", + "description": "Campaign name." + }, + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "campaign_type": { + "type": "string", + "enum": [ + "GIFT_VOUCHERS", + "DISCOUNT_COUPONS", + "REFERRAL_PROGRAM" + ], + "description": "Type of campaign." + }, + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria \n- `STATIC`: vouchers need to be manually published", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + }, + "voucher": { + "anyOf": [ + { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" + }, + { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_GIFT_CARD" + }, + { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_LOYALTY_CARD" + } + ] + }, + "auto_join": { + "type": "boolean", + "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "use_voucher_metadata_schema": { + "type": "boolean", + "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "vouchers_count": { + "type": "integer", + "description": "Total number of unique vouchers in campaign." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2021-12-01T08:00:50.038Z", + "description": "Timestamp representing the date and time when the campaign was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-09-20T09:18:19.623Z", + "description": "Timestamp representing the date and time when the voucher was updated in ISO 8601 format." + }, + "category": { + "type": "string", + "description": "Unique category name." + }, + "creation_status": { + "type": "string", + "enum": [ + "DONE", + "IN_PROGRESS", + "FAILED", + "DRAFT", + "MODIFYING" + ], + "description": "Indicates the status of the campaign creation." + }, + "vouchers_generation_status": { + "type": "string", + "description": "Indicates the status of the campaign's vouchers.", + "enum": [ + "DONE", + "IN_PROGRESS", + "FAILED", + "DRAFT" + ] + }, + "protected": { + "type": "boolean", + "description": "Indicates whether the resource can be deleted." + }, + "validation_rules_assignments": { + "type": "object", + "description": "Stores information about validation rules assigned to the campaign.", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented is by default `list`.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of validation rule assignments.", + "default": "data" + }, + "data": { + "type": "array", + "description": "Array of validation rule assignment objects. Each validation rule assignment object contains details about the rule.", + "items": { "type": "object", - "description": "Assign an initial cash balance for a gift card. Context: `GIFT_VOUCHERS`.", "properties": { - "amount": { - "type": "integer", - "description": "The cash balance to assign to the gift card. This is the current gift card balance." - } - } - } - }, - "required": [ - "code" - ] - }, - "2_req_examine_qualification": { - "type": "object", - "title": "Examine Qualification Request Body", - "description": "Request body schema for **POST** `/campaigns/qualification`.", - "examples": [], - "properties": { - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + "id": { + "type": "string", + "example": "asgm_N7t39epaQR2SkQcW", + "description": "Assigned by the Voucherify API, identifies the validation rule assignment." }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + "rule_id": { + "type": "string", + "example": "val_ssbxf1L9aKri", + "description": "Assigned by the Voucherify API, identifies the validation rule." }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + "related_object_id": { + "type": "string", + "example": "camp_AaP9MC1Y0GpBII84UTIuasvb", + "description": "ID of the object from which the rule originates." }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + "related_object_type": { + "type": "string", + "example": "campaign", + "description": "Which object does the rule originate from: the `voucher` itself or inherited from its parent `campaign`." }, - { - "$ref": "#/components/schemas/10_req_create_order" + "created_at": { + "type": "string", + "example": "2022-02-14T15:12:06.817Z", + "description": "Timestamp representing the date and time when the validation rule was created in ISO 8601 format.", + "format": "date-time" + }, + "object": { + "type": "string", + "default": "validation_rules_assignment", + "description": "The type of resource represented by the object. Default is `validation_rules_assignment`." + }, + "rule": { + "type": "object", + "description": "Describes the details of the rule." } - ], - "description": "Order information. This object enables you to pass purchase transaction data. Read what properties you can use in the [Order object](ref:get-order)." + } } + }, + "total": { + "type": "integer", + "description": "Total number of validation rules assigned to the campaign." } - }, - "2_res_examine_qualification": { - "type": "object", - "title": "Examine Qualification Response Body", - "description": "Response body schema for **POST** `/campaigns/qualification`.", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about campaigns in a dictionary.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of campaign objects.", - "default": "data" - }, - "data": { - "type": "array", - "description": "Contains array of campaign objects.", - "items": { - "$ref": "#/components/schemas/2_obj_campaign_object_campaigns_qualification" + } + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to.", + "example": "cat_0b688929a2476386a7" + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" + }, + "object": { + "type": "string", + "default": "campaign", + "description": "The type of object represented by JSON. This object stores information about the campaign." + }, + "referral_program": { + "type": "object", + "description": "Defines the referee reward and the way a referral is triggered. Context: `REFERRAL_PROGRAM`.", + "properties": { + "conversion_event_type": { + "type": "string", + "enum": [ + "redemption", + "custom_event" + ], + "description": "How a referral is triggered." + }, + "custom_event": { + "type": "object", + "description": "Contains details about the custom event.", + "properties": { + "id": { + "type": "string", + "example": "ms_fi47Dcu5T0m3v3nT5ch3ma", + "description": "Unique custom event ID." + }, + "name": { + "type": "string", + "description": "Custom event name." + } + } + }, + "referee_reward": { + "type": "object", + "description": "Defines the referee reward.", + "properties": { + "related_object_parent": { + "type": "object", + "description": "Details of the resource from which the reward originates.", + "properties": { + "id": { + "type": "string", + "description": "Unique ID of the reward source." + }, + "name": { + "type": "string", + "description": "Name of the reward source." + }, + "object": { + "type": "string", + "description": "Type of resource represented by the source of the reward." + } + } + }, + "type": { + "type": "string", + "description": "Type of reward.", + "enum": [ + "LOYALTY_CARD", + "GIFT_VOUCHER" + ] + }, + "amount": { + "type": "string", + "description": "The number of `points` to add to a loyalty card or `credits` to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." } - }, - "total": { - "type": "integer", - "description": "Total valid and active campaigns matching the qualification criteria in given context." - }, - "id": { - "type": "string", - "description": "Unique qualification ID.", - "example": "qfl_dNZ3gWfKVNa8Zw15hn30uqdU" - }, - "created_at": { - "type": "string", - "format": "datetime", - "description": "Timestamp representing the date and time when the qualification was created in ISO 8601 format.", - "example": "2023-04-04T13:13:03.119Z" - }, - "tracking_id": { - "type": "string", - "description": "Hashed customer source ID." } } - }, - "2_obj_campaign_object_campaigns_qualification": { - "type": "object", - "title": "Campaign Object", - "description": "This is an object representing a campaign.", - "properties": { - "id": { - "type": "string", - "description": "Unique campaign ID, assigned by Voucherify.", - "example": "camp_f7fBbQxUuTN7dI7tGOo5XMDA" - }, - "name": { - "type": "string", - "description": "Campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "campaign_type": { - "type": "string", - "enum": [ - "GIFT_VOUCHERS", - "DISCOUNT_COUPONS", - "REFERRAL_PROGRAM" - ], - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria \n- `STATIC`: vouchers need to be manually published", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "voucher": { - "anyOf": [ - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_DISCOUNT" - }, - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_GIFT_CARD" - }, - { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_LOYALTY_CARD" - } - ] - }, - "auto_join": { - "type": "boolean", - "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2021-12-01T08:00:50.038Z", - "description": "Timestamp representing the date and time when the campaign was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-09-20T09:18:19.623Z", - "description": "Timestamp representing the date and time when the voucher was updated in ISO 8601 format." - }, - "category": { - "type": "string", - "description": "Unique category name." - }, - "creation_status": { - "type": "string", - "enum": [ - "DONE", - "IN_PROGRESS", - "FAILED", - "DRAFT", - "MODIFYING" - ], - "description": "Indicates the status of the campaign creation." - }, - "vouchers_generation_status": { - "type": "string", - "description": "Indicates the status of the campaign's vouchers.", - "enum": [ - "DONE", - "IN_PROGRESS", - "FAILED", - "DRAFT" - ] - }, - "protected": { - "type": "boolean", - "description": "Indicates whether the resource can be deleted." - }, - "validation_rules_assignments": { - "type": "object", - "description": "Stores information about validation rules assigned to the campaign.", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented is by default `list`.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of validation rule assignments.", - "default": "data" - }, - "data": { - "type": "array", - "description": "Array of validation rule assignment objects. Each validation rule assignment object contains details about the rule.", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string", - "example": "asgm_N7t39epaQR2SkQcW", - "description": "Assigned by the Voucherify API, identifies the validation rule assignment." - }, - "rule_id": { - "type": "string", - "example": "val_ssbxf1L9aKri", - "description": "Assigned by the Voucherify API, identifies the validation rule." - }, - "related_object_id": { - "type": "string", - "example": "camp_AaP9MC1Y0GpBII84UTIuasvb", - "description": "ID of the object from which the rule originates." - }, - "related_object_type": { - "type": "string", - "example": "campaign", - "description": "Which object does the rule originate from: the `voucher` itself or inherited from its parent `campaign`." - }, - "created_at": { - "type": "string", - "example": "2022-02-14T15:12:06.817Z", - "description": "Timestamp representing the date and time when the validation rule was created in ISO 8601 format.", - "format": "date-time" - }, - "object": { - "type": "string", - "default": "validation_rules_assignment", - "description": "The type of resource represented by the object. Default is `validation_rules_assignment`." - }, - "rule": { - "type": "object", - "description": "Describes the details of the rule." - } - } - } - }, - "total": { - "type": "integer", - "description": "Total number of validation rules assigned to the campaign." - } - } - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to.", - "example": "cat_0b688929a2476386a7" - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object" - }, - "object": { - "type": "string", - "default": "campaign", - "description": "The type of object represented by JSON. This object stores information about the campaign." - }, - "referral_program": { - "type": "object", - "description": "Defines the referee reward and the way a referral is triggered. Context: `REFERRAL_PROGRAM`.", - "properties": { - "conversion_event_type": { - "type": "string", - "enum": [ - "redemption", - "custom_event" - ], - "description": "How a referral is triggered." - }, - "custom_event": { - "type": "object", - "description": "Contains details about the custom event.", - "properties": { - "id": { - "type": "string", - "example": "ms_fi47Dcu5T0m3v3nT5ch3ma", - "description": "Unique custom event ID." - }, - "name": { - "type": "string", - "description": "Custom event name." - } - } - }, - "referee_reward": { - "type": "object", - "description": "Defines the referee reward.", - "properties": { - "related_object_parent": { - "type": "object", - "description": "Details of the resource from which the reward originates.", - "properties": { - "id": { - "type": "string", - "description": "Unique ID of the reward source." - }, - "name": { - "type": "string", - "description": "Name of the reward source." - }, - "object": { - "type": "string", - "description": "Type of resource represented by the source of the reward." - } - } - }, - "type": { - "type": "string", - "description": "Type of reward.", - "enum": [ - "LOYALTY_CARD", - "GIFT_VOUCHER" - ] - }, - "amount": { - "type": "string", - "description": "The number of `points` to add to a loyalty card or `credits` to the balance on a gift card. In case of the gift card, the value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - } - } - } - } - } + } + } + } + }, + "2_res_list_campaigns": { + "type": "object", + "description": "Schema model for **GET** `/campaigns`.", + "title": "List Campaigns Response Body", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about campaigns in a dictionary.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of campaign objects.", + "default": "campaigns" + }, + "campaigns": { + "type": "array", + "description": "Contains array of campaign objects.", + "items": { + "$ref": "#/components/schemas/2_obj_campaign_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of campaigns." + } + } + }, + "2_obj_campaign_object_voucher_object_DISCOUNT": { + "type": "object", + "description": "Schema model for a discount voucher.", + "title": "Discount Voucher", + "properties": { + "type": { + "type": "string", + "default": "DISCOUNT_VOUCHER", + "description": "Type of voucher." + }, + "discount": { + "oneOf": [ + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" } - }, - "2_res_list_campaigns": { - "type": "object", - "description": "Schema model for **GET** `/campaigns`.", - "title": "List Campaigns Response Body", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about campaigns in a dictionary.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of campaign objects.", - "default": "campaigns" - }, - "campaigns": { - "type": "array", - "description": "Contains array of campaign objects.", - "items": { - "$ref": "#/components/schemas/2_obj_campaign_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of campaigns." - } + ], + "description": "Defines the voucher discount type and details." + }, + "redemption": { + "type": "object", + "description": "Defines the redemption limits on vouchers.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." } - }, - "2_obj_campaign_object_voucher_object_DISCOUNT": { - "type": "object", - "description": "Schema model for a discount voucher.", - "title": "Discount Voucher", - "properties": { - "type": { - "type": "string", - "default": "DISCOUNT_VOUCHER", - "description": "Type of voucher." - }, - "discount": { - "oneOf": [ - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" - } - ], - "description": "Defines the voucher discount type and details." - }, - "redemption": { - "type": "object", - "description": "Defines the redemption limits on vouchers.", - "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited." - } - } - }, - "code_config": { - "type": "object", - "description": "Defines code's pattern (prefix, suffix, length, charset, etc). ", - "properties": { - "length": { - "type": "string", - "description": "Number of characters in a generated code (excluding prefix and postfix)." - }, - "charset": { - "type": "string", - "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" - }, - "prefix": { - "type": "string", - "description": "A text appended before the code." - }, - "postfix": { - "type": "string", - "description": "A text appended after the code." - }, - "pattern": { - "type": "string", - "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." - } + } + }, + "code_config": { + "type": "object", + "description": "Defines code's pattern (prefix, suffix, length, charset, etc). ", + "properties": { + "length": { + "type": "string", + "description": "Number of characters in a generated code (excluding prefix and postfix)." + }, + "charset": { + "type": "string", + "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" + }, + "prefix": { + "type": "string", + "description": "A text appended before the code." + }, + "postfix": { + "type": "string", + "description": "A text appended after the code." + }, + "pattern": { + "type": "string", + "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." + } + } + }, + "is_referral_code": { + "type": "boolean", + "description": "Indicates whether the voucher is a referral code; this is `true` for campaign type `REFERRAL_PROGRAM`." + } + } + }, + "2_obj_campaign_object_voucher_object_GIFT_CARD": { + "type": "object", + "description": "Schema model for a gift card.", + "title": "Gift Card", + "properties": { + "type": { + "type": "string", + "default": "GIFT_VOUCHER", + "description": "Type of voucher." + }, + "gift": { + "description": "Defines the gift card details.", + "type": "object", + "properties": { + "amount": { + "type": "integer", + "description": "Initial gift card income to be applied to the gift card at voucher generation. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "effect": { + "type": "string", + "description": "Defines how the credits are applied to the customer's order.", + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS" + ] + } + } + }, + "redemption": { + "type": "object", + "description": "Defines the redemption limits on vouchers.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } + }, + "code_config": { + "type": "object", + "description": "Defines code's pattern (prefix, suffix, length, charset, etc). ", + "properties": { + "length": { + "type": "string", + "description": "Number of characters in a generated code (excluding prefix and postfix)." + }, + "charset": { + "type": "string", + "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" + }, + "prefix": { + "type": "string", + "description": "A text appended before the code." + }, + "postfix": { + "type": "string", + "description": "A text appended after the code." + }, + "pattern": { + "type": "string", + "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." + } + } + }, + "is_referral_code": { + "type": "boolean", + "description": "Indicates whether the voucher is a referral code; this is `true` for campaign type `REFERRAL_PROGRAM`." + } + } + }, + "2_obj_campaign_object_voucher_object_LOYALTY_CARD": { + "type": "object", + "description": "Schema model for a loyalty card.", + "title": "Loyalty Card", + "properties": { + "type": { + "type": "string", + "default": "LOYALTY_CARD", + "description": "Type of voucher." + }, + "loyalty_card": { + "description": "Defines the loyalty card details.", + "type": "object", + "properties": { + "points": { + "type": "integer", + "description": "Initial loyalty card income in points to be applied to the loyalty card at voucher generation." + }, + "expiration_rules": { + "type": "object", + "description": "Defines point expiration rules.", + "properties": { + "period_type": { + "type": "string", + "enum": [ + "MONTH" + ], + "description": "The expiration period." + }, + "period_value": { + "type": "integer", + "description": "How many periods should pass before the expiration occurs." + }, + "rounding_type": { + "type": "string", + "enum": [ + "END_OF_MONTH", + "END_OF_QUARTER", + "END_OF_HALF_YEAR", + "END_OF_YEAR", + "PARTICULAR_MONTH" + ], + "description": "Round up expiration till the end of the given period type." } - }, - "is_referral_code": { - "type": "boolean", - "description": "Indicates whether the voucher is a referral code; this is `true` for campaign type `REFERRAL_PROGRAM`." } } - }, - "2_obj_campaign_object_voucher_object_GIFT_CARD": { - "type": "object", - "description": "Schema model for a gift card.", - "title": "Gift Card", - "properties": { - "type": { - "type": "string", - "default": "GIFT_VOUCHER", - "description": "Type of voucher." - }, - "gift": { - "description": "Defines the gift card details.", - "type": "object", - "properties": { - "amount": { - "type": "integer", - "description": "Initial gift card income to be applied to the gift card at voucher generation. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "effect": { - "type": "string", - "description": "Defines how the credits are applied to the customer's order.", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS" - ] - } - } - }, - "redemption": { - "type": "object", - "description": "Defines the redemption limits on vouchers.", - "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited." - } - } - }, - "code_config": { - "type": "object", - "description": "Defines code's pattern (prefix, suffix, length, charset, etc). ", - "properties": { - "length": { - "type": "string", - "description": "Number of characters in a generated code (excluding prefix and postfix)." - }, - "charset": { - "type": "string", - "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" - }, - "prefix": { - "type": "string", - "description": "A text appended before the code." - }, - "postfix": { - "type": "string", - "description": "A text appended after the code." - }, - "pattern": { - "type": "string", - "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." - } + } + }, + "redemption": { + "type": "object", + "description": "Defines the redemption limits on vouchers.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + } + } + }, + "code_config": { + "type": "object", + "description": "Defines code's pattern (prefix, suffix, length, charset, etc). ", + "properties": { + "length": { + "type": "string", + "description": "Number of characters in a generated code (excluding prefix and postfix)." + }, + "charset": { + "type": "string", + "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" + }, + "prefix": { + "type": "string", + "description": "A text appended before the code." + }, + "postfix": { + "type": "string", + "description": "A text appended after the code." + }, + "pattern": { + "type": "string", + "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." + } + } + }, + "is_referral_code": { + "type": "boolean", + "description": "Indicates whether the voucher is a referral code; this is `true` for campaign type `REFERRAL_PROGRAM`." + } + } + }, + "2_req_campaign_object_voucher_object_LOYALTY_CARD": { + "type": "object", + "description": "Schema model for a loyalty card.", + "title": "Loyalty Card", + "properties": { + "type": { + "type": "string", + "default": "LOYALTY_CARD", + "description": "Type of voucher." + }, + "loyalty_card": { + "description": "Defines the loyalty card details.", + "type": "object", + "properties": { + "points": { + "type": "integer", + "description": "Initial loyalty card income in points to be applied to the loyalty card at voucher generation." + }, + "expiration_rules": { + "type": "object", + "description": "Defines point expiration rules.", + "properties": { + "period_type": { + "type": "string", + "enum": [ + "MONTH" + ], + "description": "The expiration period." + }, + "period_value": { + "type": "integer", + "description": "How many periods should pass before the expiration occurs." + }, + "rounding_type": { + "type": "string", + "enum": [ + "END_OF_MONTH", + "END_OF_QUARTER", + "END_OF_HALF_YEAR", + "END_OF_YEAR", + "PARTICULAR_MONTH" + ], + "description": "Round up expiration till the end of the given period type." } - }, - "is_referral_code": { - "type": "boolean", - "description": "Indicates whether the voucher is a referral code; this is `true` for campaign type `REFERRAL_PROGRAM`." } } - }, - "2_obj_campaign_object_voucher_object_LOYALTY_CARD": { - "type": "object", - "description": "Schema model for a loyalty card.", - "title": "Loyalty Card", - "properties": { - "type": { - "type": "string", - "default": "LOYALTY_CARD", - "description": "Type of voucher." - }, - "loyalty_card": { - "description": "Defines the loyalty card details.", - "type": "object", - "properties": { - "points": { - "type": "integer", - "description": "Initial loyalty card income in points to be applied to the loyalty card at voucher generation." - }, - "expiration_rules": { - "type": "object", - "description": "Defines point expiration rules.", - "properties": { - "period_type": { - "type": "string", - "enum": [ - "MONTH" - ], - "description": "The expiration period." - }, - "period_value": { - "type": "integer", - "description": "How many periods should pass before the expiration occurs." - }, - "rounding_type": { - "type": "string", - "enum": [ - "END_OF_MONTH", - "END_OF_QUARTER", - "END_OF_HALF_YEAR", - "END_OF_YEAR", - "PARTICULAR_MONTH" - ], - "description": "Round up expiration till the end of the given period type." - } - } - } - } - }, - "redemption": { - "type": "object", - "description": "Defines the redemption limits on vouchers.", - "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited." - } - } - }, - "code_config": { - "type": "object", - "description": "Defines code's pattern (prefix, suffix, length, charset, etc). ", - "properties": { - "length": { - "type": "string", - "description": "Number of characters in a generated code (excluding prefix and postfix)." - }, - "charset": { - "type": "string", - "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" - }, - "prefix": { - "type": "string", - "description": "A text appended before the code." - }, - "postfix": { - "type": "string", - "description": "A text appended after the code." - }, - "pattern": { - "type": "string", - "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." - } - } - }, - "is_referral_code": { - "type": "boolean", - "description": "Indicates whether the voucher is a referral code; this is `true` for campaign type `REFERRAL_PROGRAM`." - } + } + }, + "redemption": { + "type": "object", + "description": "Defines the redemption limits on vouchers.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." } - }, - "2_req_campaign_object_voucher_object_LOYALTY_CARD": { - "type": "object", - "description": "Schema model for a loyalty card.", - "title": "Loyalty Card", - "properties": { - "type": { - "type": "string", - "default": "LOYALTY_CARD", - "description": "Type of voucher." - }, - "loyalty_card": { - "description": "Defines the loyalty card details.", - "type": "object", - "properties": { - "points": { - "type": "integer", - "description": "Initial loyalty card income in points to be applied to the loyalty card at voucher generation." - }, - "expiration_rules": { - "type": "object", - "description": "Defines point expiration rules.", - "properties": { - "period_type": { - "type": "string", - "enum": [ - "MONTH" - ], - "description": "The expiration period." - }, - "period_value": { - "type": "integer", - "description": "How many periods should pass before the expiration occurs." - }, - "rounding_type": { - "type": "string", - "enum": [ - "END_OF_MONTH", - "END_OF_QUARTER", - "END_OF_HALF_YEAR", - "END_OF_YEAR", - "PARTICULAR_MONTH" - ], - "description": "Round up expiration till the end of the given period type." - } - } - } - } - }, - "redemption": { - "type": "object", - "description": "Defines the redemption limits on vouchers.", - "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited." - } - } - }, - "code_config": { - "type": "object", - "description": "Defines code's pattern (prefix, suffix, length, charset, etc). ", - "properties": { - "length": { - "type": "string", - "description": "Number of characters in a generated code (excluding prefix and postfix)." - }, - "charset": { - "type": "string", - "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" - }, - "prefix": { - "type": "string", - "description": "A text appended before the code." - }, - "postfix": { - "type": "string", - "description": "A text appended after the code." - }, - "pattern": { - "type": "string", - "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." - } - } - } + } + }, + "code_config": { + "type": "object", + "description": "Defines code's pattern (prefix, suffix, length, charset, etc). ", + "properties": { + "length": { + "type": "string", + "description": "Number of characters in a generated code (excluding prefix and postfix)." + }, + "charset": { + "type": "string", + "description": "Characters that can appear in the code. \n\nExamples:\n\n- Alphanumeric: `0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic: `abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Alphabetic Lowercase: `abcdefghijklmnopqrstuvwxyz` \n- Alphabetic Uppercase: `ABCDEFGHIJKLMNOPQRSTUVWXYZ` \n- Numbers: `0123456789` \n- Custom: a custom character set" + }, + "prefix": { + "type": "string", + "description": "A text appended before the code." + }, + "postfix": { + "type": "string", + "description": "A text appended after the code." + }, + "pattern": { + "type": "string", + "description": "A pattern for codes where hashes (#) will be replaced with random characters. Overrides `length`." } - }, - "3_obj_promotion_tier_object": { - "type": "object", - "description": "This is an object representing a promotion tier. Promotion tiers are always assigned to a campaign and cannot be used standalone.", - "title": "Promotion Tier Object", - "x-tags": [ - "PROMOTIONS API" - ], - "properties": { - "id": { - "type": "string", - "example": "promo_63fYCt81Aw0h7lzyRkrGZh9p", - "description": "Unique promotion tier ID." - }, - "created_at": { - "type": "string", - "example": "2021-12-15T11:34:01.333Z", - "format": "date-time", - "description": "Timestamp representing the date and time when the promotion tier was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "example": "2022-02-09T09:20:05.603Z", - "format": "date-time", - "description": "Timestamp representing the date and time when the promotion tier was updated in ISO 8601 format." - }, - "name": { - "type": "string", - "description": "Name of the promotion tier." - }, - "banner": { - "type": "string", - "description": "Text to be displayed to your customers on your website." - }, - "action": { - "type": "object", - "description": "Contains details about the discount applied by the promotion tier.", - "properties": { - "discount": { - "anyOf": [ - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" - } - ], - "description": "The type of discount that will be applied to a customer's order." - } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." - }, - "hierarchy": { - "type": "integer", - "description": "The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy." - }, - "campaign": { - "type": "object", - "description": "Contains details about promotion tier's parent campaign.", - "properties": { - "id": { - "type": "string", - "description": "Unique campaign ID." - }, - "start_date": { - "type": "string", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "format": "date-time", - "example": "2022-09-22T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "active": { - "type": "boolean", - "description": "A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" - }, - "category_id": { - "type": "string", - "example": "cat_0b688929a2476386a6", - "description": "Unique category ID that this campaign belongs to." - }, - "object": { - "type": "string", - "description": "The type of object represented by the campaign object. This object stores information about the campaign.", - "default": "campaign" - } - } - }, - "campaign_id": { - "type": "string", - "description": "Promotion tier's parent campaign's unique ID." - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* promotion tier\n- `false` indicates an *inactive* promotion tier" - }, - "start_date": { - "type": "string", - "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ", - "format": "date-time", - "example": "2022-09-23T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ", - "format": "date-time", - "example": "2022-09-26T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the promotion tier is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a promotion tier with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the promotion tier will be active in ISO 8601 format. For example, a promotion tier with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the promotion tier is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "summary": { - "type": "object", - "description": "Contains statistics about promotion tier redemptions and orders.", - "properties": { - "redemptions": { - "type": "object", - "description": "Contains statistics about promotion tier redemptions.", - "properties": { - "total_redeemed": { - "type": "integer", - "description": "Number of times the promotion tier was redeemed." - } - } - }, - "orders": { - "type": "object", - "description": "Contains statistics about orders related to the promotion tier.", - "properties": { - "total_amount": { - "type": "integer", - "description": "Sum of order totals." - }, - "total_discount_amount": { - "type": "integer", - "description": "Sum of total discount applied using the promotion tier." - } - } - } + } + } + } + }, + "3_obj_promotion_tier_object": { + "type": "object", + "description": "This is an object representing a promotion tier. Promotion tiers are always assigned to a campaign and cannot be used standalone.", + "title": "Promotion Tier Object", + "x-tags": [ + "PROMOTIONS API" + ], + "properties": { + "id": { + "type": "string", + "example": "promo_63fYCt81Aw0h7lzyRkrGZh9p", + "description": "Unique promotion tier ID." + }, + "created_at": { + "type": "string", + "example": "2021-12-15T11:34:01.333Z", + "format": "date-time", + "description": "Timestamp representing the date and time when the promotion tier was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "example": "2022-02-09T09:20:05.603Z", + "format": "date-time", + "description": "Timestamp representing the date and time when the promotion tier was updated in ISO 8601 format." + }, + "name": { + "type": "string", + "description": "Name of the promotion tier." + }, + "banner": { + "type": "string", + "description": "Text to be displayed to your customers on your website." + }, + "action": { + "type": "object", + "description": "Contains details about the discount applied by the promotion tier.", + "properties": { + "discount": { + "anyOf": [ + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" } - }, - "object": { - "type": "string", - "default": "promotion_tier", - "description": "The type of object represented by JSON. This object stores information about the promotion tier." - }, - "validation_rule_assignments": { - "$ref": "#/components/schemas/13_res_validation-rules_validationRuleId_assignments" - }, - "category_id": { - "type": "string", - "description": "Promotion tier category ID.", - "example": "cat_0c9da30e7116ba6bba" - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object", - "description": "Details about the category assigned to the promotion tier." - } + ], + "description": "The type of discount that will be applied to a customer's order." } - }, - "3_req_add_promotion_tier_to_campaign": { - "type": "object", - "description": "Request body schema for creating a promotion tier within a campaign in **POST** `/promotions/{campaignId}/tiers`.", - "title": "Add Promotion Tier to Campaign Request Body", - "properties": { - "name": { - "type": "string", - "description": "Name of the promotion tier." - }, - "banner": { - "type": "string", - "description": "Text to be displayed to your customers on your website.\t" - }, - "action": { - "type": "object", - "description": "Contains details about the discount applied by the promotion tier.", - "properties": { - "discount": { - "anyOf": [ - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" - } - ], - "description": "The type of discount that will be applied to a customer's order." - } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* promotion tier\n- `false` indicates an *inactive* promotion tier" - }, - "start_date": { - "type": "string", - "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ", - "format": "date-time", - "example": "2022-09-23T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ", - "format": "date-time", - "example": "2022-09-26T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the promotion tier is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a promotion tier with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the promotion tier will be active in ISO 8601 format. For example, a promotion tier with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the promotion tier is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "validation_rules": { - "type": "array", - "description": "Array containing the ID of the validation rule associated with the promotion tier.", - "items": { - "type": "string" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." + }, + "hierarchy": { + "type": "integer", + "description": "The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy." + }, + "campaign": { + "type": "object", + "description": "Contains details about promotion tier's parent campaign.", + "properties": { + "id": { + "type": "string", + "description": "Unique campaign ID." + }, + "start_date": { + "type": "string", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "format": "date-time", + "example": "2022-09-22T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." } - }, - "category": { - "type": "string", - "description": "Assign category to the promotion tier." - }, - "category_id": { - "type": "string", - "description": "Instead of using the category name, you can alternatively assign a new category to a promotion tier using a unique category ID, i.e. `cat_0c9da30e7116ba6bba`.", - "example": "cat_0c9da30e7116ba6bba" } - } - }, - "3_req_update_promotion_tier": { - "type": "object", - "description": "Request body schema for updating a promotion tier within a campaign in **POST** `/promotions/tiers/{promotionTierId}`.", - "title": "Update Promotion Tier Request Body", - "properties": { - "name": { - "type": "string", - "description": "Name of the promotion tier." - }, - "banner": { - "type": "string", - "description": "Text to be displayed to your customers on your website.\t" - }, - "action": { - "type": "object", - "description": "Contains details about the discount applied by the promotion tier.", - "properties": { - "discount": { - "anyOf": [ - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" - } - ], - "description": "The type of discount that will be applied to a customer's order." - } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." - }, - "start_date": { - "type": "string", - "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ", - "format": "date-time", - "example": "2022-09-23T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ", - "format": "date-time", - "example": "2022-09-26T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the promotion tier is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a promotion tier with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the promotion tier will be active in ISO 8601 format. For example, a promotion tier with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the promotion tier is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "hierarchy": { - "type": "integer", - "description": "The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. If you update a hierarchy of a promotion tier, then the remaining promotion tier hierarchies will be recalculated." - }, - "category": { - "type": "string", - "description": "Assign a new or update the promotion tier's category." - }, - "category_id": { - "type": "string", - "description": "Instead of using the category name, you can alternatively assign a new category to a promotion tier using a unique category ID, i.e. `cat_0c9da30e7116ba6bba`.", - "example": "cat_0c9da30e7116ba6bba" + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" } + }, + "active": { + "type": "boolean", + "description": "A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date` using the [Disable Campaign](ref:disable-campaign) endpoint. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" + }, + "category_id": { + "type": "string", + "example": "cat_0b688929a2476386a6", + "description": "Unique category ID that this campaign belongs to." + }, + "object": { + "type": "string", + "description": "The type of object represented by the campaign object. This object stores information about the campaign.", + "default": "campaign" } - }, - "3_res_list_promotion_tiers": { - "type": "object", - "description": "Promotion Tiers", - "title": "Promotion Tiers", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about promotion tiers in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "tiers", - "description": "Identifies the name of the attribute that contains the array of promotion tier objects." - }, - "tiers": { - "type": "array", - "description": "Contains array of promotion tier objects.", - "items": { - "$ref": "#/components/schemas/3_obj_promotion_tier_object" + } + }, + "campaign_id": { + "type": "string", + "description": "Promotion tier's parent campaign's unique ID." + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* promotion tier\n- `false` indicates an *inactive* promotion tier" + }, + "start_date": { + "type": "string", + "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ", + "format": "date-time", + "example": "2022-09-23T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ", + "format": "date-time", + "example": "2022-09-26T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the promotion tier is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a promotion tier with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the promotion tier will be active in ISO 8601 format. For example, a promotion tier with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the promotion tier is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "summary": { + "type": "object", + "description": "Contains statistics about promotion tier redemptions and orders.", + "properties": { + "redemptions": { + "type": "object", + "description": "Contains statistics about promotion tier redemptions.", + "properties": { + "total_redeemed": { + "type": "integer", + "description": "Number of times the promotion tier was redeemed." } - }, - "total": { - "type": "integer", - "description": "Total number of promotion tiers." } - } - }, - "3_res_list_promotion_stacks": { - "type": "object", - "description": "Promotion Stacks", - "title": "Promotion Stacks", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about promotion stacks in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of promotion stack objects." - }, - "data": { - "type": "array", - "description": "Contains array of promotion stack objects.", - "items": { - "$ref": "#/components/schemas/3_obj_promotion_stack_object" + }, + "orders": { + "type": "object", + "description": "Contains statistics about orders related to the promotion tier.", + "properties": { + "total_amount": { + "type": "integer", + "description": "Sum of order totals." + }, + "total_discount_amount": { + "type": "integer", + "description": "Sum of total discount applied using the promotion tier." } - }, - "total": { - "type": "integer", - "description": "Total number of promotion stacks." } } - }, - "3_obj_promotion_stack_object": { - "type": "object", - "title": "Promotion Stack Object", - "description": "Model schema for a promotion stack.", - "properties": { - "id": { - "type": "string", - "example": "stack_p0WhtyyDU95crobleMpRabhH", - "description": "Unique promotion stack ID." - }, - "name": { - "type": "string", - "description": "Promotion stack name." - }, - "created_at": { - "type": "string", - "example": "2022-09-22T13:03:25.740Z", - "format": "date-time", - "description": "Timestamp representing the date and time when the promotion stack was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "example": "2022-09-23T07:59:44.172Z", - "format": "date-time", - "description": "Timestamp representing the date and time when the promotion stack was updated in ISO 8601 format." - }, - "campaign_id": { - "type": "string", - "example": "camp_99HUWI53bVyLzPN1Fg5TBLWX", - "description": "Promotion stack's parent campaign's unique ID." - }, - "object": { - "type": "string", - "default": "promotion_stack", - "description": "The type of object represented by JSON. This object stores information about the promotion tier." - }, - "tiers": { - "type": "object", - "description": "Contains the tier configuration.", - "properties": { - "ids": { - "type": "array", - "description": "Contains the list of tiers in a pre-defined sequence.", - "items": { - "type": "string" - } - }, - "hierarchy_mode": { - "type": "string", - "default": "MANUAL" - } - } - }, - "category_id": { - "type": "string", - "description": "Promotion stack category ID.", - "example": "cat_0c9da30e7116ba6bba" - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object", - "description": "Details about the category assigned to the promotion stack." - } - } - }, - "3_req_create_promotion_stack": { - "type": "object", - "title": "Create Promotion Stack Request Body", - "description": "Model schema for a creating a promotion stack using **POST** `/promotions/{campaignId}/stacks`.", - "properties": { - "name": { - "type": "string", - "description": "Promotion stack name." - }, - "tiers": { - "type": "object", - "description": "Contains the tier configuration.", - "properties": { - "ids": { - "type": "array", - "description": "Contains the list of tiers in a pre-defined sequence.", - "items": { - "type": "string" - } - }, - "hierarchy_mode": { - "type": "string", - "example": "MANUAL" - } + } + }, + "object": { + "type": "string", + "default": "promotion_tier", + "description": "The type of object represented by JSON. This object stores information about the promotion tier." + }, + "validation_rule_assignments": { + "$ref": "#/components/schemas/13_res_validation-rules_validationRuleId_assignments" + }, + "category_id": { + "type": "string", + "description": "Promotion tier category ID.", + "example": "cat_0c9da30e7116ba6bba" + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object", + "description": "Details about the category assigned to the promotion tier." + } + } + }, + "3_req_add_promotion_tier_to_campaign": { + "type": "object", + "description": "Request body schema for creating a promotion tier within a campaign in **POST** `/promotions/{campaignId}/tiers`.", + "title": "Add Promotion Tier to Campaign Request Body", + "properties": { + "name": { + "type": "string", + "description": "Name of the promotion tier." + }, + "banner": { + "type": "string", + "description": "Text to be displayed to your customers on your website.\t" + }, + "action": { + "type": "object", + "description": "Contains details about the discount applied by the promotion tier.", + "properties": { + "discount": { + "anyOf": [ + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" } - }, - "category": { - "type": "string", - "description": "Assign a category." - }, - "category_id": { - "type": "string", - "description": "Instead of using the category name, you can alternatively assign a new category to a promotion stack using a unique category ID, i.e. `cat_0c9da30e7116ba6bba`.", - "example": "cat_0c9da30e7116ba6bba" - } + ], + "description": "The type of discount that will be applied to a customer's order." } - }, - "3_res_list_promotion_tiers_from_campaign": { - "type": "object", - "description": "Promotion Tiers", - "title": "Promotion Tiers", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about promotion tiers in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "tiers", - "description": "Identifies the name of the attribute that contains the array of promotion tier objects." - }, - "tiers": { - "type": "array", - "description": "Contains array of promotion tier objects.", - "items": { - "$ref": "#/components/schemas/3_obj_promotion_tier_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of promotion tiers." - }, - "has_more": { - "type": "boolean", - "description": "As query results are always limited (by the limit parameter), the `has_more` flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results." - } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the promotion tier on or off. You can disable a promotion tier even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* promotion tier\n- `false` indicates an *inactive* promotion tier" + }, + "start_date": { + "type": "string", + "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ", + "format": "date-time", + "example": "2022-09-23T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ", + "format": "date-time", + "example": "2022-09-26T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the promotion tier is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a promotion tier with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the promotion tier will be active in ISO 8601 format. For example, a promotion tier with a `duration` of `P1D` will be valid for a duration of one day." } - }, - "4_obj_reward_object": { - "title": "Reward Object", - "type": "object", - "description": "This is an object representing a reward.", - "x-tags": [ - "REWARDS API" - ], - "properties": { - "id": { - "type": "string", - "example": "rew_nIy4gHpQHle2c3pNMwuj7G6j", - "description": "Unique reward ID, assigned by Voucherify." - }, - "name": { - "type": "string", - "description": "Reward name." - }, - "type": { - "type": "string", - "enum": [ - "CAMPAIGN", - "COIN", - "MATERIAL" - ], - "description": "Reward type." - }, - "parameters": { - "oneOf": [ - { - "$ref": "#/components/schemas/4_obj_reward_object_parameters_CAMPAIGN" - }, - { - "$ref": "#/components/schemas/4_obj_reward_object_parameters_COIN" - }, - { - "$ref": "#/components/schemas/4_obj_reward_object_parameters_MATERIAL" - } - ], - "description": "Defines how the reward is generated." - }, - "stock": { - "type": "integer", - "description": "Configurable for **material rewards**. The number of units of the product that you want to share as reward." - }, - "redeemed": { - "type": "integer", - "description": "Defines the number of already invoked (successful) reward redemptions.\t" - }, - "attributes": { - "type": "object", - "description": "These properties are configurable for **material rewards**.", - "properties": { - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file." - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a material reward." - } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the promotion tier is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "validation_rules": { + "type": "array", + "description": "Array containing the ID of the validation rule associated with the promotion tier.", + "items": { + "type": "string" + } + }, + "category": { + "type": "string", + "description": "Assign category to the promotion tier." + }, + "category_id": { + "type": "string", + "description": "Instead of using the category name, you can alternatively assign a new category to a promotion tier using a unique category ID, i.e. `cat_0c9da30e7116ba6bba`.", + "example": "cat_0c9da30e7116ba6bba" + } + } + }, + "3_req_update_promotion_tier": { + "type": "object", + "description": "Request body schema for updating a promotion tier within a campaign in **POST** `/promotions/tiers/{promotionTierId}`.", + "title": "Update Promotion Tier Request Body", + "properties": { + "name": { + "type": "string", + "description": "Name of the promotion tier." + }, + "banner": { + "type": "string", + "description": "Text to be displayed to your customers on your website.\t" + }, + "action": { + "type": "object", + "description": "Contains details about the discount applied by the promotion tier.", + "properties": { + "discount": { + "anyOf": [ + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" } - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the reward was created in ISO 8601 format.", - "example": "2022-08-11T14:49:22.586Z", - "format": "date-time" - }, - "updated_at": { - "type": [ - "string", - "null" - ], - "description": "Timestamp representing the date and time when the reward was updated in ISO 8601 format.", - "example": "2022-08-11T16:01:34.885Z", - "format": "date-time" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." - }, - "object": { - "type": "string", - "default": "reward", - "description": "The type of object represented by the JSON. This object stores information about the reward." - } + ], + "description": "The type of discount that will be applied to a customer's order." } - }, - "4_obj_reward_object_parameters_CAMPAIGN": { - "title": "Digital", - "type": "object", - "description": "These are parameters representing a digital (CAMPAIGN) reward. These can be in the form of discount coupons, gift card credits, or loyalty point credits.", - "properties": { - "campaign": { - "description": "Objects stores information about the campaign related to the reward.", - "anyOf": [ - { - "$ref": "#/components/schemas/4_obj_reward_object_parameters_CAMPAIGN_DISCOUNT_COUPONS" - }, - { - "$ref": "#/components/schemas/4_obj_reward_object_parameters_CAMPAIGN_GIFT_VOUCHERS" - }, - { - "$ref": "#/components/schemas/4_obj_reward_object_parameters_CAMPAIGN_LOYALTY_PROGRAM" - } - ] - } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." + }, + "start_date": { + "type": "string", + "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Promotion tier is *inactive before* this date. ", + "format": "date-time", + "example": "2022-09-23T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive after* this date. ", + "format": "date-time", + "example": "2022-09-26T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the promotion tier is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a promotion tier with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the promotion tier will be active in ISO 8601 format. For example, a promotion tier with a `duration` of `P1D` will be valid for a duration of one day." } - }, - "4_obj_reward_object_parameters_CAMPAIGN_DISCOUNT_COUPONS": { - "title": "Discount Coupons", - "type": "object", - "description": "These are parameters representing a discount coupon, which is a subset of a Digital (CAMPAIGN) reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique campaign ID, assigned by Voucherify.", - "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" - }, - "type": { - "type": "string", - "description": "Campaign type.", - "default": "DISCOUNT_COUPONS" + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the promotion tier is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "hierarchy": { + "type": "integer", + "description": "The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy. If you update a hierarchy of a promotion tier, then the remaining promotion tier hierarchies will be recalculated." + }, + "category": { + "type": "string", + "description": "Assign a new or update the promotion tier's category." + }, + "category_id": { + "type": "string", + "description": "Instead of using the category name, you can alternatively assign a new category to a promotion tier using a unique category ID, i.e. `cat_0c9da30e7116ba6bba`.", + "example": "cat_0c9da30e7116ba6bba" + } + } + }, + "3_res_list_promotion_tiers": { + "type": "object", + "description": "Promotion Tiers", + "title": "Promotion Tiers", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about promotion tiers in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "tiers", + "description": "Identifies the name of the attribute that contains the array of promotion tier objects." + }, + "tiers": { + "type": "array", + "description": "Contains array of promotion tier objects.", + "items": { + "$ref": "#/components/schemas/3_obj_promotion_tier_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of promotion tiers." + } + } + }, + "3_res_list_promotion_stacks": { + "type": "object", + "description": "Promotion Stacks", + "title": "Promotion Stacks", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about promotion stacks in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of promotion stack objects." + }, + "data": { + "type": "array", + "description": "Contains array of promotion stack objects.", + "items": { + "$ref": "#/components/schemas/3_obj_promotion_stack_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of promotion stacks." + } + } + }, + "3_obj_promotion_stack_object": { + "type": "object", + "title": "Promotion Stack Object", + "description": "Model schema for a promotion stack.", + "properties": { + "id": { + "type": "string", + "example": "stack_p0WhtyyDU95crobleMpRabhH", + "description": "Unique promotion stack ID." + }, + "name": { + "type": "string", + "description": "Promotion stack name." + }, + "created_at": { + "type": "string", + "example": "2022-09-22T13:03:25.740Z", + "format": "date-time", + "description": "Timestamp representing the date and time when the promotion stack was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "example": "2022-09-23T07:59:44.172Z", + "format": "date-time", + "description": "Timestamp representing the date and time when the promotion stack was updated in ISO 8601 format." + }, + "campaign_id": { + "type": "string", + "example": "camp_99HUWI53bVyLzPN1Fg5TBLWX", + "description": "Promotion stack's parent campaign's unique ID." + }, + "object": { + "type": "string", + "default": "promotion_stack", + "description": "The type of object represented by JSON. This object stores information about the promotion tier." + }, + "tiers": { + "type": "object", + "description": "Contains the tier configuration.", + "properties": { + "ids": { + "type": "array", + "description": "Contains the list of tiers in a pre-defined sequence.", + "items": { + "type": "string" } + }, + "hierarchy_mode": { + "type": "string", + "default": "MANUAL" } - }, - "4_obj_reward_object_parameters_CAMPAIGN_GIFT_VOUCHERS": { - "title": "Gift Vouchers", - "type": "object", - "description": "These are parameters representing a gift voucher, which is a subset of a Digital (CAMPAIGN) reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique campaign ID, assigned by Voucherify.", - "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" - }, - "balance": { - "type": "integer", - "description": "The incremental amout to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "type": { - "type": "string", - "description": "Campaign type.", - "default": "GIFT_VOUCHERS" + } + }, + "category_id": { + "type": "string", + "description": "Promotion stack category ID.", + "example": "cat_0c9da30e7116ba6bba" + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object", + "description": "Details about the category assigned to the promotion stack." + } + } + }, + "3_req_create_promotion_stack": { + "type": "object", + "title": "Create Promotion Stack Request Body", + "description": "Model schema for a creating a promotion stack using **POST** `/promotions/{campaignId}/stacks`.", + "properties": { + "name": { + "type": "string", + "description": "Promotion stack name." + }, + "tiers": { + "type": "object", + "description": "Contains the tier configuration.", + "properties": { + "ids": { + "type": "array", + "description": "Contains the list of tiers in a pre-defined sequence.", + "items": { + "type": "string" } + }, + "hierarchy_mode": { + "type": "string", + "example": "MANUAL" } - }, - "4_obj_reward_object_parameters_CAMPAIGN_LOYALTY_PROGRAM": { - "title": "Points on loyalty card", - "type": "object", - "description": "These are parameters representing points on a loyalty card, which is a subset of a Digital (CAMPAIGN) reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique campaign ID, assigned by Voucherify.", - "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" - }, - "balance": { - "type": "integer", - "description": "The incremental points to be added to the current balance on the loyalty card." - }, - "type": { - "type": "string", - "description": "Campaign type.", - "default": "LOYALTY_PROGRAM" - } + } + }, + "category": { + "type": "string", + "description": "Assign a category." + }, + "category_id": { + "type": "string", + "description": "Instead of using the category name, you can alternatively assign a new category to a promotion stack using a unique category ID, i.e. `cat_0c9da30e7116ba6bba`.", + "example": "cat_0c9da30e7116ba6bba" + } + } + }, + "3_res_list_promotion_tiers_from_campaign": { + "type": "object", + "description": "Promotion Tiers", + "title": "Promotion Tiers", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about promotion tiers in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "tiers", + "description": "Identifies the name of the attribute that contains the array of promotion tier objects." + }, + "tiers": { + "type": "array", + "description": "Contains array of promotion tier objects.", + "items": { + "$ref": "#/components/schemas/3_obj_promotion_tier_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of promotion tiers." + }, + "has_more": { + "type": "boolean", + "description": "As query results are always limited (by the limit parameter), the `has_more` flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results." + } + } + }, + "4_obj_reward_object": { + "title": "Reward Object", + "type": "object", + "description": "This is an object representing a reward.", + "x-tags": [ + "REWARDS API" + ], + "properties": { + "id": { + "type": "string", + "example": "rew_nIy4gHpQHle2c3pNMwuj7G6j", + "description": "Unique reward ID, assigned by Voucherify." + }, + "name": { + "type": "string", + "description": "Reward name." + }, + "type": { + "type": "string", + "enum": [ + "CAMPAIGN", + "COIN", + "MATERIAL" + ], + "description": "Reward type." + }, + "parameters": { + "oneOf": [ + { + "$ref": "#/components/schemas/4_obj_reward_object_parameters_CAMPAIGN" + }, + { + "$ref": "#/components/schemas/4_obj_reward_object_parameters_COIN" + }, + { + "$ref": "#/components/schemas/4_obj_reward_object_parameters_MATERIAL" } - }, - "4_obj_reward_object_parameters_COIN": { - "title": "Pay with Points", - "type": "object", - "description": "These are parameters representing a Pay with Points (COIN) reward. ", - "properties": { - "coin": { - "type": "object", - "description": "Defines the ratio by mapping the number of loyalty points in `points_ratio` to a predefined cash amount in `exchange_ratio`.", - "properties": { - "exchange_ratio": { - "type": "integer", - "description": "The cash equivalent of the points defined in the `points_ratio` property." - }, - "points_ratio": { - "type": "integer", - "description": "The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property." - } - } - } + ], + "description": "Defines how the reward is generated." + }, + "stock": { + "type": "integer", + "description": "Configurable for **material rewards**. The number of units of the product that you want to share as reward." + }, + "redeemed": { + "type": "integer", + "description": "Defines the number of already invoked (successful) reward redemptions.\t" + }, + "attributes": { + "type": "object", + "description": "These properties are configurable for **material rewards**.", + "properties": { + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file." + }, + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a material reward." } - }, - "4_obj_reward_object_parameters_MATERIAL": { - "title": "Material", - "type": "object", - "description": "These are parameters representing products as a (MATERIAL) reward.", - "properties": { - "product": { - "type": "object", - "description": "Contains information about the product given as a reward.", - "properties": { - "id": { - "type": "string", - "example": "prod_0b7d7dfb05cbe5c616", - "description": "Unique product ID, assigned by Voucherify. " - }, - "sku_id": { - "type": [ - "string", - "null" - ], - "description": "Unique SKU ID, assigned by Voucherify, of the SKU given as a reward.", - "example": "sku_0b7d7dfb090be5c619" - } - } - } + } + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the reward was created in ISO 8601 format.", + "example": "2022-08-11T14:49:22.586Z", + "format": "date-time" + }, + "updated_at": { + "type": [ + "string", + "null" + ], + "description": "Timestamp representing the date and time when the reward was updated in ISO 8601 format.", + "example": "2022-08-11T16:01:34.885Z", + "format": "date-time" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." + }, + "object": { + "type": "string", + "default": "reward", + "description": "The type of object represented by the JSON. This object stores information about the reward." + } + } + }, + "4_obj_reward_object_parameters_CAMPAIGN": { + "title": "Digital", + "type": "object", + "description": "These are parameters representing a digital (CAMPAIGN) reward. These can be in the form of discount coupons, gift card credits, or loyalty point credits.", + "properties": { + "campaign": { + "description": "Objects stores information about the campaign related to the reward.", + "anyOf": [ + { + "$ref": "#/components/schemas/4_obj_reward_object_parameters_CAMPAIGN_DISCOUNT_COUPONS" + }, + { + "$ref": "#/components/schemas/4_obj_reward_object_parameters_CAMPAIGN_GIFT_VOUCHERS" + }, + { + "$ref": "#/components/schemas/4_obj_reward_object_parameters_CAMPAIGN_LOYALTY_PROGRAM" } - }, - "4_req_create_reward": { - "title": "Create Reward Request Body", - "description": "Request body schema for **POST** `/rewards`.", - "anyOf": [ - { - "$ref": "#/components/schemas/4_req_create_reward_CAMPAIGN" - }, - { - "$ref": "#/components/schemas/4_req_create_reward_MATERIAL" - }, - { - "$ref": "#/components/schemas/4_req_create_reward_COIN" - } - ] - }, - "4_req_create_reward-copy": { - "title": "Create Reward Request Body", - "type": "object", - "description": "Request body schema for **POST** `/rewards`.", - "properties": { - "name": { - "type": "string", - "description": "Reward name." - }, - "type": { - "type": "string", - "enum": [ - "CAMPAIGN", - "COIN", - "MATERIAL" - ], - "description": "Reward type." - }, - "parameters": { - "oneOf": [ - { - "$ref": "#/components/schemas/4_req_reward_parameters_COIN" - }, - { - "$ref": "#/components/schemas/4_req_reward_parameters_MATERIAL" - }, - { - "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN" - } - ], - "description": "Defines how the reward is generated." - }, - "stock": { - "type": "integer", - "description": "Configurable for material rewards. The number of units of the product that you want to share as a reward." - }, - "attributes": { - "type": "object", - "description": "These properties are configurable for material rewards.", - "properties": { - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file." - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a material reward." - } - } - }, - "metadata": { - "type": "string", - "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." - } - } - }, - "4_req_create_reward_CAMPAIGN": { - "title": "Digital Reward", - "type": "object", - "description": "Request body schema for creating a digital reward using **POST** `/rewards`.", - "properties": { - "name": { - "type": "string", - "description": "Reward name." - }, - "type": { - "type": "string", - "enum": [ - "CAMPAIGN" - ], - "description": "Reward type." - }, - "parameters": { - "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN" - }, - "metadata": { - "type": "string", - "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." - } - } - }, - "4_req_create_reward_COIN": { - "title": "Pay with Points Reward", - "type": "object", - "description": "Request body schema for creating a pay with points reward using **POST** `/rewards`.", - "properties": { - "name": { - "type": "string", - "description": "Reward name." - }, - "type": { - "type": "string", - "enum": [ - "COIN" - ], - "description": "Reward type." - }, - "parameters": { - "$ref": "#/components/schemas/4_req_reward_parameters_COIN" - }, - "metadata": { - "type": "string", - "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." - } + ] + } + } + }, + "4_obj_reward_object_parameters_CAMPAIGN_DISCOUNT_COUPONS": { + "title": "Discount Coupons", + "type": "object", + "description": "These are parameters representing a discount coupon, which is a subset of a Digital (CAMPAIGN) reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique campaign ID, assigned by Voucherify.", + "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" + }, + "type": { + "type": "string", + "description": "Campaign type.", + "default": "DISCOUNT_COUPONS" + } + } + }, + "4_obj_reward_object_parameters_CAMPAIGN_GIFT_VOUCHERS": { + "title": "Gift Vouchers", + "type": "object", + "description": "These are parameters representing a gift voucher, which is a subset of a Digital (CAMPAIGN) reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique campaign ID, assigned by Voucherify.", + "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" + }, + "balance": { + "type": "integer", + "description": "The incremental amout to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "type": { + "type": "string", + "description": "Campaign type.", + "default": "GIFT_VOUCHERS" + } + } + }, + "4_obj_reward_object_parameters_CAMPAIGN_LOYALTY_PROGRAM": { + "title": "Points on loyalty card", + "type": "object", + "description": "These are parameters representing points on a loyalty card, which is a subset of a Digital (CAMPAIGN) reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique campaign ID, assigned by Voucherify.", + "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" + }, + "balance": { + "type": "integer", + "description": "The incremental points to be added to the current balance on the loyalty card." + }, + "type": { + "type": "string", + "description": "Campaign type.", + "default": "LOYALTY_PROGRAM" + } + } + }, + "4_obj_reward_object_parameters_COIN": { + "title": "Pay with Points", + "type": "object", + "description": "These are parameters representing a Pay with Points (COIN) reward. ", + "properties": { + "coin": { + "type": "object", + "description": "Defines the ratio by mapping the number of loyalty points in `points_ratio` to a predefined cash amount in `exchange_ratio`.", + "properties": { + "exchange_ratio": { + "type": "integer", + "description": "The cash equivalent of the points defined in the `points_ratio` property." + }, + "points_ratio": { + "type": "integer", + "description": "The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property." } - }, - "4_req_create_reward_MATERIAL": { - "title": "Material Reward", - "type": "object", - "description": "Request body schema to create a material reward using\n **POST** `/rewards`.", - "properties": { - "name": { - "type": "string", - "description": "Reward name." - }, - "type": { - "type": "string", - "enum": [ - "MATERIAL" - ], - "description": "Reward type." - }, - "parameters": { - "$ref": "#/components/schemas/4_req_reward_parameters_MATERIAL" - }, - "stock": { - "type": "integer", - "description": "The number of units of the product that you want to share as a reward." - }, - "attributes": { - "type": "object", - "description": "These properties are configurable for material rewards.", - "properties": { - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file." - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a material reward." - } - } - }, - "metadata": { - "type": "string", - "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." - } + } + } + } + }, + "4_obj_reward_object_parameters_MATERIAL": { + "title": "Material", + "type": "object", + "description": "These are parameters representing products as a (MATERIAL) reward.", + "properties": { + "product": { + "type": "object", + "description": "Contains information about the product given as a reward.", + "properties": { + "id": { + "type": "string", + "example": "prod_0b7d7dfb05cbe5c616", + "description": "Unique product ID, assigned by Voucherify. " + }, + "sku_id": { + "type": [ + "string", + "null" + ], + "description": "Unique SKU ID, assigned by Voucherify, of the SKU given as a reward.", + "example": "sku_0b7d7dfb090be5c619" } - }, - "4_req_update_reward": { - "title": "Update Reward Request Body", - "description": "Request body schema for **PUT** `/rewards/{rewardId}`.", - "anyOf": [ - { - "$ref": "#/components/schemas/4_req_update_reward_CAMPAIGN" - }, - { - "$ref": "#/components/schemas/4_req_update_reward_COIN" - }, - { - "$ref": "#/components/schemas/4_req_update_reward_MATERIAL" - } - ] - }, - "4_req_update_reward-copy": { - "title": "Update Reward Request Body", - "type": "object", - "description": "Request body schema for **PUT** `/rewards/{rewardId}`.", - "properties": { - "name": { - "type": "string", - "description": "Reward name." - }, - "parameters": { - "oneOf": [ - { - "$ref": "#/components/schemas/4_req_reward_parameters_COIN" - }, - { - "$ref": "#/components/schemas/4_req_reward_parameters_MATERIAL" - }, - { - "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN" - } - ], - "description": "Defines how the reward is generated." - }, - "stock": { - "type": "integer", - "description": "Configurable for material rewards. The number of units of the product that you want to share as a reward." - }, - "attributes": { - "type": "object", - "description": "These properties are configurable for material rewards.", - "properties": { - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file." - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a material reward." - } - } - }, - "metadata": { - "type": "string", - "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." - } + } + } + } + }, + "4_req_create_reward": { + "title": "Create Reward Request Body", + "description": "Request body schema for **POST** `/rewards`.", + "anyOf": [ + { + "$ref": "#/components/schemas/4_req_create_reward_CAMPAIGN" + }, + { + "$ref": "#/components/schemas/4_req_create_reward_MATERIAL" + }, + { + "$ref": "#/components/schemas/4_req_create_reward_COIN" + } + ] + }, + "4_req_create_reward-copy": { + "title": "Create Reward Request Body", + "type": "object", + "description": "Request body schema for **POST** `/rewards`.", + "properties": { + "name": { + "type": "string", + "description": "Reward name." + }, + "type": { + "type": "string", + "enum": [ + "CAMPAIGN", + "COIN", + "MATERIAL" + ], + "description": "Reward type." + }, + "parameters": { + "oneOf": [ + { + "$ref": "#/components/schemas/4_req_reward_parameters_COIN" + }, + { + "$ref": "#/components/schemas/4_req_reward_parameters_MATERIAL" + }, + { + "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN" } - }, - "4_req_update_reward_CAMPAIGN": { - "title": "Digital Reward", - "type": "object", - "description": "Request body schema for updating a digital reward using **PUT** `/rewards/{rewardId}`.", - "properties": { - "name": { - "type": "string", - "description": "Reward name." - }, - "parameters": { - "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN" - }, - "metadata": { - "type": "string", - "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." - } + ], + "description": "Defines how the reward is generated." + }, + "stock": { + "type": "integer", + "description": "Configurable for material rewards. The number of units of the product that you want to share as a reward." + }, + "attributes": { + "type": "object", + "description": "These properties are configurable for material rewards.", + "properties": { + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file." + }, + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a material reward." } - }, - "4_req_update_reward_COIN": { - "title": "Pay with Points Reward", - "type": "object", - "description": "Request body schema for updating a pay with points reward using **PUT** `/rewards/{rewardId}`.", - "properties": { - "name": { - "type": "string", - "description": "Reward name." - }, - "parameters": { - "$ref": "#/components/schemas/4_req_reward_parameters_COIN" - }, - "metadata": { - "type": "string", - "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." - } + } + }, + "metadata": { + "type": "string", + "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." + } + } + }, + "4_req_create_reward_CAMPAIGN": { + "title": "Digital Reward", + "type": "object", + "description": "Request body schema for creating a digital reward using **POST** `/rewards`.", + "properties": { + "name": { + "type": "string", + "description": "Reward name." + }, + "type": { + "type": "string", + "enum": [ + "CAMPAIGN" + ], + "description": "Reward type." + }, + "parameters": { + "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN" + }, + "metadata": { + "type": "string", + "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." + } + } + }, + "4_req_create_reward_COIN": { + "title": "Pay with Points Reward", + "type": "object", + "description": "Request body schema for creating a pay with points reward using **POST** `/rewards`.", + "properties": { + "name": { + "type": "string", + "description": "Reward name." + }, + "type": { + "type": "string", + "enum": [ + "COIN" + ], + "description": "Reward type." + }, + "parameters": { + "$ref": "#/components/schemas/4_req_reward_parameters_COIN" + }, + "metadata": { + "type": "string", + "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." + } + } + }, + "4_req_create_reward_MATERIAL": { + "title": "Material Reward", + "type": "object", + "description": "Request body schema to create a material reward using\n **POST** `/rewards`.", + "properties": { + "name": { + "type": "string", + "description": "Reward name." + }, + "type": { + "type": "string", + "enum": [ + "MATERIAL" + ], + "description": "Reward type." + }, + "parameters": { + "$ref": "#/components/schemas/4_req_reward_parameters_MATERIAL" + }, + "stock": { + "type": "integer", + "description": "The number of units of the product that you want to share as a reward." + }, + "attributes": { + "type": "object", + "description": "These properties are configurable for material rewards.", + "properties": { + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file." + }, + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a material reward." } - }, - "4_req_update_reward_MATERIAL": { - "title": "Material Reward", - "type": "object", - "description": "Request body schema for updating a material reward using **PUT** `/rewards/{rewardId}`.", - "properties": { - "name": { - "type": "string", - "description": "Reward name." - }, - "parameters": { - "$ref": "#/components/schemas/4_req_reward_parameters_MATERIAL" - }, - "stock": { - "type": "integer", - "description": "The number of units of the product that you want to share as a reward." - }, - "attributes": { - "type": "object", - "description": "These properties are configurable for material rewards.", - "properties": { - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file." - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a material reward." - } - } - }, - "metadata": { - "type": "string", - "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." - } + } + }, + "metadata": { + "type": "string", + "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." + } + } + }, + "4_req_update_reward": { + "title": "Update Reward Request Body", + "description": "Request body schema for **PUT** `/rewards/{rewardId}`.", + "anyOf": [ + { + "$ref": "#/components/schemas/4_req_update_reward_CAMPAIGN" + }, + { + "$ref": "#/components/schemas/4_req_update_reward_COIN" + }, + { + "$ref": "#/components/schemas/4_req_update_reward_MATERIAL" + } + ] + }, + "4_req_update_reward-copy": { + "title": "Update Reward Request Body", + "type": "object", + "description": "Request body schema for **PUT** `/rewards/{rewardId}`.", + "properties": { + "name": { + "type": "string", + "description": "Reward name." + }, + "parameters": { + "oneOf": [ + { + "$ref": "#/components/schemas/4_req_reward_parameters_COIN" + }, + { + "$ref": "#/components/schemas/4_req_reward_parameters_MATERIAL" + }, + { + "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN" } - }, - "4_req_reward_parameters_CAMPAIGN_LOYALTY_PROGRAM": { - "title": "Points on loyalty card", - "type": "object", - "description": "Configure a reward that adds points to a loyalty card. This type of reward is a subset of a Digital (CAMPAIGN) reward.", - "properties": { - "id": { - "type": "string", - "description": "Assign the reward to the campaign that contains the loyalty cards that will be replenished by the reward. Provide the unique campaign ID, assigned by Voucherify.", - "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" - }, - "balance": { - "type": "integer", - "description": "The incremental points to be added to the current balance on the loyalty card." - } + ], + "description": "Defines how the reward is generated." + }, + "stock": { + "type": "integer", + "description": "Configurable for material rewards. The number of units of the product that you want to share as a reward." + }, + "attributes": { + "type": "object", + "description": "These properties are configurable for material rewards.", + "properties": { + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file." + }, + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a material reward." } - }, - "4_req_reward_parameters_CAMPAIGN_GIFT_VOUCHERS": { - "title": "Gift Vouchers", - "type": "object", - "description": "Configure a reward that adds cash to a gift card. This type of reward is a subset of a Digital (CAMPAIGN) reward.", - "properties": { - "id": { - "type": "string", - "description": "Assign the reward to the campaign that contains the gift cards that will be replenished by the reward. Provide the unique campaign ID, assigned by Voucherify.", - "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" - }, - "balance": { - "type": "integer", - "description": "The incremental amout to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - } + } + }, + "metadata": { + "type": "string", + "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." + } + } + }, + "4_req_update_reward_CAMPAIGN": { + "title": "Digital Reward", + "type": "object", + "description": "Request body schema for updating a digital reward using **PUT** `/rewards/{rewardId}`.", + "properties": { + "name": { + "type": "string", + "description": "Reward name." + }, + "parameters": { + "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN" + }, + "metadata": { + "type": "string", + "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." + } + } + }, + "4_req_update_reward_COIN": { + "title": "Pay with Points Reward", + "type": "object", + "description": "Request body schema for updating a pay with points reward using **PUT** `/rewards/{rewardId}`.", + "properties": { + "name": { + "type": "string", + "description": "Reward name." + }, + "parameters": { + "$ref": "#/components/schemas/4_req_reward_parameters_COIN" + }, + "metadata": { + "type": "string", + "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." + } + } + }, + "4_req_update_reward_MATERIAL": { + "title": "Material Reward", + "type": "object", + "description": "Request body schema for updating a material reward using **PUT** `/rewards/{rewardId}`.", + "properties": { + "name": { + "type": "string", + "description": "Reward name." + }, + "parameters": { + "$ref": "#/components/schemas/4_req_reward_parameters_MATERIAL" + }, + "stock": { + "type": "integer", + "description": "The number of units of the product that you want to share as a reward." + }, + "attributes": { + "type": "object", + "description": "These properties are configurable for material rewards.", + "properties": { + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file." + }, + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a material reward." } - }, - "4_req_reward_parameters_CAMPAIGN_DISCOUNT_COUPONS": { - "title": "Discount Coupons", - "type": "object", - "description": "Configure a reward that provides a discount coupon. This type of reward is a subset of a Digital (CAMPAIGN) reward.", - "properties": { - "id": { - "type": "string", - "description": "Assign the reward to the campaign that contains the vouchers that will be the source of the reward. Provide the unique campaign ID, assigned by Voucherify.", - "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" - } + } + }, + "metadata": { + "type": "string", + "description": "The metadata object stores all custom attributes assigned to the reward. A set of key/value pairs that you can attach to a reward object. It can be useful for storing additional information about the reward in a structured format." + } + } + }, + "4_req_reward_parameters_CAMPAIGN_LOYALTY_PROGRAM": { + "title": "Points on loyalty card", + "type": "object", + "description": "Configure a reward that adds points to a loyalty card. This type of reward is a subset of a Digital (CAMPAIGN) reward.", + "properties": { + "id": { + "type": "string", + "description": "Assign the reward to the campaign that contains the loyalty cards that will be replenished by the reward. Provide the unique campaign ID, assigned by Voucherify.", + "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" + }, + "balance": { + "type": "integer", + "description": "The incremental points to be added to the current balance on the loyalty card." + } + } + }, + "4_req_reward_parameters_CAMPAIGN_GIFT_VOUCHERS": { + "title": "Gift Vouchers", + "type": "object", + "description": "Configure a reward that adds cash to a gift card. This type of reward is a subset of a Digital (CAMPAIGN) reward.", + "properties": { + "id": { + "type": "string", + "description": "Assign the reward to the campaign that contains the gift cards that will be replenished by the reward. Provide the unique campaign ID, assigned by Voucherify.", + "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" + }, + "balance": { + "type": "integer", + "description": "The incremental amout to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + } + } + }, + "4_req_reward_parameters_CAMPAIGN_DISCOUNT_COUPONS": { + "title": "Discount Coupons", + "type": "object", + "description": "Configure a reward that provides a discount coupon. This type of reward is a subset of a Digital (CAMPAIGN) reward.", + "properties": { + "id": { + "type": "string", + "description": "Assign the reward to the campaign that contains the vouchers that will be the source of the reward. Provide the unique campaign ID, assigned by Voucherify.", + "example": "camp_13BbZ0kQsNinhqsX3wUts2UP" + } + } + }, + "4_req_reward_parameters_CAMPAIGN": { + "title": "Digital Reward", + "type": "object", + "description": "Configure a digital (CAMPAIGN) reward. These can be in the form of discount coupons, gift card credits, or loyalty point credits.", + "properties": { + "campaign": { + "description": "Objects stores information about the campaign related to the reward.", + "anyOf": [ + { + "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN_LOYALTY_PROGRAM" + }, + { + "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN_GIFT_VOUCHERS" + }, + { + "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN_DISCOUNT_COUPONS" } - }, - "4_req_reward_parameters_CAMPAIGN": { - "title": "Digital Reward", - "type": "object", - "description": "Configure a digital (CAMPAIGN) reward. These can be in the form of discount coupons, gift card credits, or loyalty point credits.", - "properties": { - "campaign": { - "description": "Objects stores information about the campaign related to the reward.", - "anyOf": [ - { - "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN_LOYALTY_PROGRAM" - }, - { - "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN_GIFT_VOUCHERS" - }, - { - "$ref": "#/components/schemas/4_req_reward_parameters_CAMPAIGN_DISCOUNT_COUPONS" - } - ] - } + ] + } + } + }, + "4_req_reward_parameters_MATERIAL": { + "title": "Material Reward", + "type": "object", + "description": "Configure parameters representing products as a (MATERIAL) reward.", + "properties": { + "product": { + "type": "object", + "description": "Define the product given as a reward.", + "properties": { + "id": { + "type": "string", + "example": "prod_0b7d7dfb05cbe5c616", + "description": "Unique product ID, assigned by Voucherify, given as a reward." + }, + "sku_id": { + "type": [ + "string", + "null" + ], + "description": "Unique SKU ID, assigned by Voucherify, of the SKU given as a reward.", + "example": "sku_0b7d7dfb090be5c619" } - }, - "4_req_reward_parameters_MATERIAL": { - "title": "Material Reward", - "type": "object", - "description": "Configure parameters representing products as a (MATERIAL) reward.", - "properties": { - "product": { - "type": "object", - "description": "Define the product given as a reward.", - "properties": { - "id": { - "type": "string", - "example": "prod_0b7d7dfb05cbe5c616", - "description": "Unique product ID, assigned by Voucherify, given as a reward." - }, - "sku_id": { - "type": [ - "string", - "null" - ], - "description": "Unique SKU ID, assigned by Voucherify, of the SKU given as a reward.", - "example": "sku_0b7d7dfb090be5c619" - } - } - } + } + } + } + }, + "4_req_reward_parameters_COIN": { + "title": "Pay with Points Reward", + "type": "object", + "description": "Configure parameters representing a Pay with Points (COIN) reward. ", + "properties": { + "coin": { + "type": "object", + "description": "Define the ratio by mapping the number of loyalty points in `points_ratio` to a predefined cash amount in `exchange_ratio`.", + "properties": { + "exchange_ratio": { + "type": [ + "string", + "integer" + ], + "description": "The cash equivalent of the points defined in the `points_ratio` property." + }, + "points_ratio": { + "type": [ + "string", + "integer" + ], + "description": "The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property." } - }, - "4_req_reward_parameters_COIN": { - "title": "Pay with Points Reward", - "type": "object", - "description": "Configure parameters representing a Pay with Points (COIN) reward. ", - "properties": { - "coin": { - "type": "object", - "description": "Define the ratio by mapping the number of loyalty points in `points_ratio` to a predefined cash amount in `exchange_ratio`.", - "properties": { - "exchange_ratio": { - "type": [ - "string", - "integer" - ], - "description": "The cash equivalent of the points defined in the `points_ratio` property." - }, - "points_ratio": { - "type": [ - "string", - "integer" - ], - "description": "The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property." - } - } - } - } - }, - "4_res_list_rewards": { - "type": "object", - "description": "Response body schema for **GET** `/rewards`.", - "title": "List Rewards Response Body", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about rewards in a dictionary.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of rewards.", - "default": "data" - }, - "data": { - "type": "array", - "description": "Contains array of reward objects.", - "items": { - "$ref": "#/components/schemas/4_obj_reward_object" + } + } + } + }, + "4_res_list_rewards": { + "type": "object", + "description": "Response body schema for **GET** `/rewards`.", + "title": "List Rewards Response Body", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about rewards in a dictionary.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of rewards.", + "default": "data" + }, + "data": { + "type": "array", + "description": "Contains array of reward objects.", + "items": { + "$ref": "#/components/schemas/4_obj_reward_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of rewards." + } + } + }, + "4_obj_reward_assignment_object": { + "title": "Reward Assignment Object", + "type": "object", + "description": "This is an object representing a reward assignment.", + "x-tags": [ + "REWARDS API" + ], + "properties": { + "id": { + "type": "string", + "example": "rewa_PbIRoMXpwe5QhobW4JKu0VjH", + "description": "Unique reward assignment ID, assigned by Voucherify." + }, + "reward_id": { + "type": "string", + "description": "Associated reward ID.", + "example": "rew_C7wS9eHFDN4CIbXI5PpLSkGY" + }, + "related_object_id": { + "type": "string", + "description": "Related object ID to which the reward was assigned.", + "example": "camp_wciTvaOfYmAa3EmIIW3QpXXZ" + }, + "related_object_type": { + "type": "string", + "description": "Related object type to which the reward was assigned.", + "example": "campaign" + }, + "parameters": { + "description": "Defines the cost of the reward.", + "type": "object", + "properties": { + "loyalty": { + "type": "object", + "description": "Defines the equivalent points value of the reward.", + "properties": { + "points": { + "type": "integer", + "description": "The number of points required to redeem the reward." } - }, - "total": { - "type": "integer", - "description": "Total number of rewards." } } - }, - "4_obj_reward_assignment_object": { - "title": "Reward Assignment Object", - "type": "object", - "description": "This is an object representing a reward assignment.", - "x-tags": [ - "REWARDS API" - ], - "properties": { - "id": { - "type": "string", - "example": "rewa_PbIRoMXpwe5QhobW4JKu0VjH", - "description": "Unique reward assignment ID, assigned by Voucherify." - }, - "reward_id": { - "type": "string", - "description": "Associated reward ID.", - "example": "rew_C7wS9eHFDN4CIbXI5PpLSkGY" - }, - "related_object_id": { - "type": "string", - "description": "Related object ID to which the reward was assigned.", - "example": "camp_wciTvaOfYmAa3EmIIW3QpXXZ" - }, - "related_object_type": { - "type": "string", - "description": "Related object type to which the reward was assigned.", - "example": "campaign" - }, - "parameters": { - "description": "Defines the cost of the reward.", - "type": "object", - "properties": { - "loyalty": { - "type": "object", - "description": "Defines the equivalent points value of the reward.", - "properties": { - "points": { - "type": "integer", - "description": "The number of points required to redeem the reward." - } - } - } + } + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the reward assignment was created in ISO 8601 format.", + "example": "2022-08-11T14:49:22.586Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format.", + "example": "2022-08-11T16:01:34.885Z", + "format": "date-time" + }, + "object": { + "type": "string", + "default": "reward_assignment", + "description": "The type of object represented by the JSON. This object stores information about the reward assignment." + } + } + }, + "4_res_list_reward_assignments": { + "type": "object", + "description": "Response body schema for **GET** `/rewards/{rewardID}/assignments`.", + "title": "List Reward Assignments Response Body", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about reward assignments in a dictionary.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of reward assignments.", + "default": "data" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/4_obj_reward_assignment_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of reward assignments." + } + } + }, + "4_req_update_reward_assignment": { + "type": "object", + "description": "Request body schema for **PUT** `/rewards/{rewardID}/assignments/{assignmentID}`.", + "title": "Update Reward Assignment Request Body", + "properties": { + "parameters": { + "type": "object", + "description": "Defines the cost of the reward.", + "properties": { + "loyalty": { + "type": "object", + "description": "Defines the equivalent points value of the reward.", + "properties": { + "points": { + "type": "integer", + "description": "Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed." } - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the reward assignment was created in ISO 8601 format.", - "example": "2022-08-11T14:49:22.586Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format.", - "example": "2022-08-11T16:01:34.885Z", - "format": "date-time" - }, - "object": { - "type": "string", - "default": "reward_assignment", - "description": "The type of object represented by the JSON. This object stores information about the reward assignment." } } - }, - "4_res_list_reward_assignments": { - "type": "object", - "description": "Response body schema for **GET** `/rewards/{rewardID}/assignments`.", - "title": "List Reward Assignments Response Body", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about reward assignments in a dictionary.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of reward assignments.", - "default": "data" - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" + } + } + } + }, + "4_req_create_reward_assignment": { + "type": "object", + "description": "Request body schema for **POST** `/rewards/{rewardID}/assignments`.", + "title": "Create Reward Assignment Request Body", + "properties": { + "campaign": { + "type": "string", + "description": "The campaign ID of the campaign to which the reward is to be assigned." + }, + "parameters": { + "type": "object", + "description": "Defines the cost of the reward.", + "required": [ + "loyalty" + ], + "properties": { + "loyalty": { + "type": "object", + "description": "Defines the equivalent points value of the reward.", + "properties": { + "points": { + "type": "integer", + "description": "Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed." } - }, - "total": { - "type": "integer", - "description": "Total number of reward assignments." } } - }, - "4_req_update_reward_assignment": { - "type": "object", - "description": "Request body schema for **PUT** `/rewards/{rewardID}/assignments/{assignmentID}`.", - "title": "Update Reward Assignment Request Body", - "properties": { - "parameters": { - "type": "object", - "description": "Defines the cost of the reward.", - "properties": { - "loyalty": { - "type": "object", - "description": "Defines the equivalent points value of the reward.", - "properties": { - "points": { - "type": "integer", - "description": "Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed." - } - } - } - } - } + } + } + }, + "required": [ + "campaign", + "parameters" + ] + }, + "5_obj_publication_object": { + "title": "Publication Object", + "type": "object", + "description": "This is an object representing a publication. ", + "x-tags": [ + "PUBLICATIONS API" + ], + "properties": { + "id": { + "type": "string", + "example": "pub_BbjAXnmm8e0SIm3zG8qvvFCP0KuLywtp", + "description": "Unique publication ID, assigned by Voucherify." + }, + "object": { + "type": "string", + "default": "publication", + "description": "The type of object represented by the JSON. This object stores information about the publication." + }, + "created_at": { + "type": "string", + "example": "2022-09-23T09:57:00.434Z", + "description": "Timestamp representing the date and time when the publication was created in ISO 8601 format.", + "format": "date-time" + }, + "customer_id": { + "type": "string", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "description": "Unique customer ID of the customer receiving the publication." + }, + "tracking_id": { + "type": "string", + "description": "Customer's `source_id`." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." + }, + "channel": { + "type": "string", + "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", + "enum": [ + "voucherify-website", + "Dashboard", + "Automation", + "API", + "Braze", + "Reward", + "SMS", + "Email", + "Activecampaign", + "Webhook", + "Intercom", + "Mailchimp", + "Shopify" + ] + }, + "source_id": { + "type": "string", + "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. " + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Status of the publication attempt." + }, + "customer": { + "type": "object", + "description": "Contains information about the customer to whom the publication was directed.", + "properties": { + "id": { + "type": "string", + "description": "Unique customer ID, assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's name." + }, + "email": { + "type": "string", + "description": "Customer's email." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs attached to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments." + }, + "object": { + "type": "string", + "default": "customer", + "description": "The type of object represented by the JSON. This object stores information about the customer." } - }, - "4_req_create_reward_assignment": { - "type": "object", - "description": "Request body schema for **POST** `/rewards/{rewardID}/assignments`.", - "title": "Create Reward Assignment Request Body", - "properties": { - "campaign": { - "type": "string", - "description": "The campaign ID of the campaign to which the reward is to be assigned." - }, - "parameters": { - "type": "object", - "description": "Defines the cost of the reward.", - "required": [ - "loyalty" - ], - "properties": { - "loyalty": { - "type": "object", - "description": "Defines the equivalent points value of the reward.", - "properties": { - "points": { - "type": "integer", - "description": "Number of points that will be subtracted from the loyalty card points balance if the reward is redeemed." - } - } - } - } - } + } + }, + "voucher": { + "description": "Contains information about the voucher being published.", + "anyOf": [ + { + "$ref": "#/components/schemas/5_obj_publication_object_discount" }, - "required": [ - "campaign", - "parameters" - ] - }, - "5_obj_publication_object": { - "title": "Publication Object", - "type": "object", - "description": "This is an object representing a publication. ", - "x-tags": [ - "PUBLICATIONS API" - ], - "properties": { - "id": { - "type": "string", - "example": "pub_BbjAXnmm8e0SIm3zG8qvvFCP0KuLywtp", - "description": "Unique publication ID, assigned by Voucherify." - }, - "object": { - "type": "string", - "default": "publication", - "description": "The type of object represented by the JSON. This object stores information about the publication." - }, - "created_at": { - "type": "string", - "example": "2022-09-23T09:57:00.434Z", - "description": "Timestamp representing the date and time when the publication was created in ISO 8601 format.", - "format": "date-time" - }, - "customer_id": { - "type": "string", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "description": "Unique customer ID of the customer receiving the publication." - }, - "tracking_id": { - "type": "string", - "description": "Customer's `source_id`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." - }, - "channel": { - "type": "string", - "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", - "enum": [ - "voucherify-website", - "Dashboard", - "Automation", - "API", - "Braze", - "Reward", - "SMS", - "Email", - "Activecampaign", - "Webhook", - "Intercom", - "Mailchimp", - "Shopify" - ] - }, - "source_id": { - "type": "string", - "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. " - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Status of the publication attempt." - }, - "customer": { - "type": "object", - "description": "Contains information about the customer to whom the publication was directed.", - "properties": { - "id": { - "type": "string", - "description": "Unique customer ID, assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's name." - }, - "email": { - "type": "string", - "description": "Customer's email." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs attached to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments." - }, - "object": { - "type": "string", - "default": "customer", - "description": "The type of object represented by the JSON. This object stores information about the customer." - } - } - }, - "voucher": { - "description": "Contains information about the voucher being published.", - "anyOf": [ - { - "$ref": "#/components/schemas/5_obj_publication_object_discount" - }, - { - "$ref": "#/components/schemas/5_obj_publication_object_loyalty_card" - }, - { - "$ref": "#/components/schemas/5_obj_publication_object_gift_card" - } - ] - }, - "vouchers_id": { - "type": "array", - "description": "Contains the unique internal voucher ID that was assigned by Voucherify.", - "items": { - "type": "string", - "example": "[ v_Bw3qWZWv47yb1Onra8F2LlFI1enLakfA ]" - } - } + { + "$ref": "#/components/schemas/5_obj_publication_object_loyalty_card" + }, + { + "$ref": "#/components/schemas/5_obj_publication_object_gift_card" } - }, - "5_req_create_publication_standalone_voucher": { - "title": "Standalone Voucher", - "type": "object", - "description": "Create publication for standalone voucher.", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. " - }, - "channel": { - "type": "string", - "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", - "enum": [ - "voucherify-website", - "Dashboard", - "Automation", - "API", - "Braze", - "Reward", - "SMS", - "Email", - "Activecampaign", - "Webhook", - "Intercom", - "Mailchimp", - "Shopify" - ] - }, - "customer": { - "description": "Contains information about the customer to whom the publication was directed.", - "anyOf": [ - { - "$ref": "#/components/schemas/5_res_create_publication_customer_id" - }, - { - "$ref": "#/components/schemas/5_res_create_publication_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ] - }, - "voucher": { - "description": "Code of voucher being published.", - "type": "string" - }, - "campaign": { - "type": "string", - "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." - } + ] + }, + "vouchers_id": { + "type": "array", + "description": "Contains the unique internal voucher ID that was assigned by Voucherify.", + "items": { + "type": "string", + "example": "[ v_Bw3qWZWv47yb1Onra8F2LlFI1enLakfA ]" + } + } + } + }, + "5_req_create_publication_standalone_voucher": { + "title": "Standalone Voucher", + "type": "object", + "description": "Create publication for standalone voucher.", + "properties": { + "source_id": { + "type": "string", + "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. " + }, + "channel": { + "type": "string", + "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", + "enum": [ + "voucherify-website", + "Dashboard", + "Automation", + "API", + "Braze", + "Reward", + "SMS", + "Email", + "Activecampaign", + "Webhook", + "Intercom", + "Mailchimp", + "Shopify" + ] + }, + "customer": { + "description": "Contains information about the customer to whom the publication was directed.", + "anyOf": [ + { + "$ref": "#/components/schemas/5_res_create_publication_customer_id" + }, + { + "$ref": "#/components/schemas/5_res_create_publication_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" } - }, - "5_req_create_publication_from_campaign": { - "title": "Voucher from Campaign", - "description": "Create a publication for a voucher from a campaign.", - "oneOf": [ - { - "$ref": "#/components/schemas/5_req_create_publication_from_campaign_auto_update" - }, - { - "$ref": "#/components/schemas/5_req_create_publication_from_campaign_one_specific_voucher" - }, - { - "$ref": "#/components/schemas/5_req_create_publication_from_campaign_multiple_vouchers" - } - ] - }, - "5_req_create_publication_from_campaign_auto_update": { - "title": "Voucher from Auto-Update Campaign", - "type": "object", - "description": "Create a publication for a voucher from an auto-update campaign. It will choose the next available voucher.", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. " - }, - "channel": { - "type": "string", - "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", - "enum": [ - "voucherify-website", - "Dashboard", - "Automation", - "API", - "Braze", - "Reward", - "SMS", - "Email", - "Activecampaign", - "Webhook", - "Intercom", - "Mailchimp", - "Shopify" - ] - }, - "customer": { - "description": "Contains information about the customer to whom the publication was directed.", - "anyOf": [ - { - "$ref": "#/components/schemas/5_res_create_publication_customer_id" - }, - { - "$ref": "#/components/schemas/5_res_create_publication_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ] - }, - "campaign": { - "type": "string", - "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." - } + ] + }, + "voucher": { + "description": "Code of voucher being published.", + "type": "string" + }, + "campaign": { + "type": "string", + "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." + } + } + }, + "5_req_create_publication_from_campaign": { + "title": "Voucher from Campaign", + "description": "Create a publication for a voucher from a campaign.", + "oneOf": [ + { + "$ref": "#/components/schemas/5_req_create_publication_from_campaign_auto_update" + }, + { + "$ref": "#/components/schemas/5_req_create_publication_from_campaign_one_specific_voucher" + }, + { + "$ref": "#/components/schemas/5_req_create_publication_from_campaign_multiple_vouchers" + } + ] + }, + "5_req_create_publication_from_campaign_auto_update": { + "title": "Voucher from Auto-Update Campaign", + "type": "object", + "description": "Create a publication for a voucher from an auto-update campaign. It will choose the next available voucher.", + "properties": { + "source_id": { + "type": "string", + "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. " + }, + "channel": { + "type": "string", + "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", + "enum": [ + "voucherify-website", + "Dashboard", + "Automation", + "API", + "Braze", + "Reward", + "SMS", + "Email", + "Activecampaign", + "Webhook", + "Intercom", + "Mailchimp", + "Shopify" + ] + }, + "customer": { + "description": "Contains information about the customer to whom the publication was directed.", + "anyOf": [ + { + "$ref": "#/components/schemas/5_res_create_publication_customer_id" + }, + { + "$ref": "#/components/schemas/5_res_create_publication_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" } - }, - "5_req_create_publication_from_campaign_one_specific_voucher": { - "title": "Voucher from Campaign", - "type": "object", - "description": "Create a publication for a specific voucher code from a campaign.", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service." - }, - "channel": { - "type": "string", - "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", - "enum": [ - "voucherify-website", - "Dashboard", - "Automation", - "API", - "Braze", - "Reward", - "SMS", - "Email", - "Activecampaign", - "Webhook", - "Intercom", - "Mailchimp", - "Shopify" - ] - }, - "customer": { - "description": "Contains information about the customer to whom the publication was directed.", - "anyOf": [ - { - "$ref": "#/components/schemas/5_res_create_publication_customer_id" - }, - { - "$ref": "#/components/schemas/5_res_create_publication_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ] - }, - "voucher": { - "description": "Code of voucher being published.", - "type": "string" - }, - "campaign": { - "type": "string", - "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." - } + ] + }, + "campaign": { + "type": "string", + "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." + } + } + }, + "5_req_create_publication_from_campaign_one_specific_voucher": { + "title": "Voucher from Campaign", + "type": "object", + "description": "Create a publication for a specific voucher code from a campaign.", + "properties": { + "source_id": { + "type": "string", + "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service." + }, + "channel": { + "type": "string", + "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", + "enum": [ + "voucherify-website", + "Dashboard", + "Automation", + "API", + "Braze", + "Reward", + "SMS", + "Email", + "Activecampaign", + "Webhook", + "Intercom", + "Mailchimp", + "Shopify" + ] + }, + "customer": { + "description": "Contains information about the customer to whom the publication was directed.", + "anyOf": [ + { + "$ref": "#/components/schemas/5_res_create_publication_customer_id" + }, + { + "$ref": "#/components/schemas/5_res_create_publication_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" } - }, - "5_req_create_publication_from_campaign_multiple_vouchers": { - "title": "Vouchers from Campaign", - "type": "object", - "description": "Create a publication of multiple vouchers from a campaign.", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. " - }, - "channel": { - "type": "string", - "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", - "enum": [ - "voucherify-website", - "Dashboard", - "Automation", - "API", - "Braze", - "Reward", - "SMS", - "Email", - "Activecampaign", - "Webhook", - "Intercom", - "Mailchimp", - "Shopify" - ] - }, - "customer": { - "description": "Contains information about the customer to whom the publication was directed.", - "anyOf": [ - { - "$ref": "#/components/schemas/5_res_create_publication_customer_id" - }, - { - "$ref": "#/components/schemas/5_res_create_publication_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ] - }, - "voucher": { - "description": "Code of voucher being published.", - "type": "string" - }, - "campaign": { - "type": "object", - "description": "Contains name of source campaign and number of vouchers to be published.", - "properties": { - "name": { - "type": "string", - "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`." - }, - "count": { - "type": "string", - "description": "Number of vouchers to be published to customer." - } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." - } - } - }, - "5_req_create_publication": { - "title": "Create Publication Request Body", - "description": "Request body schema for publishing a voucher.", - "oneOf": [ - { - "$ref": "#/components/schemas/5_req_create_publication_standalone_voucher" - }, - { - "$ref": "#/components/schemas/5_req_create_publication_from_campaign" - } - ] - }, - "5_res_create_publication": { - "title": "Create Publication Response Body", - "type": "object", - "description": "Response schema model for publishing a voucher to a specific customer.", - "properties": { - "id": { - "type": "string", - "example": "pub_BbjAXnmm8e0SIm3zG8qvvFCP0KuLywtp", - "description": "Unique publication ID, assigned by Voucherify." - }, - "object": { - "type": "string", - "default": "publication", - "description": "The type of object represented by the JSON. This object stores information about the `publication`." - }, - "created_at": { - "type": "string", - "example": "2022-09-23T09:57:00.434Z", - "description": "Timestamp representing the date and time when the publication was created in ISO 8601 format.", - "format": "date-time" - }, - "customer_id": { - "type": "string", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "description": "Unique customer ID of the customer receiving the publication." - }, - "tracking_id": { - "type": "string", - "description": "Customer's `source_id`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." - }, - "channel": { - "type": "string", - "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", - "enum": [ - "voucherify-website", - "Dashboard", - "Automation", - "API", - "Braze", - "Reward", - "SMS", - "Email", - "Activecampaign", - "Webhook", - "Intercom", - "Mailchimp", - "Shopify" - ] - }, - "source_id": { - "type": "string", - "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. " - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Status of the publication attempt." - }, - "customer": { - "description": "Contains information about the customer to whom the publication was directed.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique customer ID, assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's name." - }, - "email": { - "type": "string", - "description": "Customer's email." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs attached to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments." - }, - "object": { - "type": "string", - "default": "customer", - "description": "The type of object represented by the JSON. This object stores information about the `customer`." - } - } - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object" - }, - "vouchers_id": { - "type": "array", - "description": "Contains the unique internal voucher ID that was assigned by Voucherify.", - "items": { - "type": "string", - "example": "[ v_Bw3qWZWv47yb1Onra8F2LlFI1enLakfA ]" - } - } - } - }, - "5_req_create_publication_campaign_id": { - "title": "Campaign ID", - "type": "object", - "description": "Campaign's unique ID assigned by Voucherify.", - "properties": { - "id": { - "type": "string", - "example": "camp_7AZCZeF1VvD6EHC5anAMtvcK", - "description": "Unique campaign ID, assigned by Voucherify." - } - } - }, - "5_req_create_publication_campaign_name": { - "title": "Campaign's name", - "type": "object", - "description": "Campaign's name.", - "properties": { - "name": { - "type": "string", - "example": "Summer Campaign", - "description": "Campaign's name." - } - } - }, - "5_req_create_publication_campaign": { - "title": "Campaign's name or ID", - "type": "string", - "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`. " - }, - "5_res_create_publication_customer_id": { - "title": "Customer ID", - "type": "object", - "description": "Customer's unique ID assigned by Voucherify.", - "properties": { - "id": { - "type": "string", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "description": "Unique customer ID, assigned by Voucherify." - } - } - }, - "5_res_create_publication_customer_source_id": { - "title": "Customer's Source ID", - "type": "object", - "description": "The merchant’s customer ID.", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - } - } - }, - "5_req_create_publication_customer": { - "title": "Source ID or Unique Customer ID", - "type": "string", - "description": "Customer's unique ID assigned by Voucherify, i.e. `cust_eWgXlBBiY6THFRJwX45Iakv4`, or the merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "5_obj_publication_object_discount": { - "title": "Discount Voucher", - "type": "object", - "description": "This is an object representing a publication of a discount voucher. ", - "properties": { - "code": { - "type": "string", - "description": "Voucher code." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the voucher.", - "default": "voucher" - }, - "campaign": { - "type": "string", - "description": "Name of voucher's parent campaign." - }, - "discount": { - "anyOf": [ - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" - } - ] - }, - "is_referral_code": { - "type": "boolean", - "description": "Whether this voucher is a referral code." - } - } - }, - "5_obj_publication_object_loyalty_card": { - "title": "Loyalty Card", - "type": "object", - "description": "This is an object representing a publication of a loyalty card. ", - "properties": { - "code": { - "type": "string", - "description": "Voucher code." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the voucher.", - "default": "voucher" - }, - "campaign": { - "type": "string", - "description": "Name of voucher's parent campaign." - }, - "loyalty_card": { - "type": "object", - "description": "Contains information about the loyalty card being published.", - "properties": { - "points": { - "type": "integer", - "description": "The incremental points to be added to the loyalty card as the initial balance on the card." - }, - "balance": { - "type": "integer", - "description": "The points balance after the incremental points are added to the loyalty card." - } - } - }, - "is_referral_code": { - "type": "boolean", - "description": "Whether this voucher is a referral code." - } - } - }, - "5_obj_publication_object_gift_card": { - "title": "Gift Card", - "type": "object", - "description": "This is an object representing a publication of a gift card. ", - "properties": { - "code": { - "type": "string", - "description": "Voucher code." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the voucher.", - "default": "voucher" - }, - "campaign": { - "type": "string", - "description": "Name of voucher's parent campaign." - }, - "gift": { - "type": "object", - "description": "Contains information about the gift card being published.", - "properties": { - "amount": { - "type": "integer", - "description": "The incremental amount to be added as the initial balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "balance": { - "type": "integer", - "description": "The credit balance on the gift card after the initial incremental amount is added to the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS" - ], - "description": "How the credits are applied to the customer's order." - } - } - }, - "is_referral_code": { - "type": "boolean", - "description": "Whether this voucher is a referral code." - } - } - }, - "5_res_list_publications": { - "type": "object", - "description": "Response body schema for listing publications using **GET** `/publications`.", - "title": "List Publications Response Body", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about publications in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "publications", - "description": "Identifies the name of the attribute that contains the array of publications." - }, - "publications": { - "type": "array", - "description": "Contains array of publication objects.", - "items": { - "$ref": "#/components/schemas/5_obj_publication_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of publications." - } + ] + }, + "voucher": { + "description": "Code of voucher being published.", + "type": "string" + }, + "campaign": { + "type": "string", + "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." + } + } + }, + "5_req_create_publication_from_campaign_multiple_vouchers": { + "title": "Vouchers from Campaign", + "type": "object", + "description": "Create a publication of multiple vouchers from a campaign.", + "properties": { + "source_id": { + "type": "string", + "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. " + }, + "channel": { + "type": "string", + "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", + "enum": [ + "voucherify-website", + "Dashboard", + "Automation", + "API", + "Braze", + "Reward", + "SMS", + "Email", + "Activecampaign", + "Webhook", + "Intercom", + "Mailchimp", + "Shopify" + ] + }, + "customer": { + "description": "Contains information about the customer to whom the publication was directed.", + "anyOf": [ + { + "$ref": "#/components/schemas/5_res_create_publication_customer_id" + }, + { + "$ref": "#/components/schemas/5_res_create_publication_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" } - }, - "6_obj_validation_object": { - "title": "Validation Object", - "description": "This is an object representing a validation.", - "x-tags": [ - "VALIDATIONS API" - ], - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_code" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_gift_card" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_loyalty_card" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_false" - }, - { - "$ref": "#/components/schemas/6_res_validate_promotion_object" - } - ] - }, - "6_req_validate_voucher": { - "title": "Validate Voucher Request Body", - "description": "Request schema model for validating a voucher using **POST** `/vouchers/{code}/validate`.", - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_discount_code" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_gift_card" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_loyalty_card" - } - ] - }, - "6_req_validate_voucher_customer_id": { - "title": "Customer ID", - "description": "You can pass the unique customer ID that was assigned by Voucherify.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The ID of an existing customer that will be linked to redemption in this request.", - "example": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" - } + ] + }, + "voucher": { + "description": "Code of voucher being published.", + "type": "string" + }, + "campaign": { + "type": "object", + "description": "Contains name of source campaign and number of vouchers to be published.", + "properties": { + "name": { + "type": "string", + "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`." + }, + "count": { + "type": "string", + "description": "Number of vouchers to be published to customer." } - }, - "6_req_rollback_redemption_customer_id": { - "title": "Customer ID", - "description": "You can pass the unique customer ID that was assigned by Voucherify.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The ID of an existing customer that will be linked to redemption rollback in this request.", - "example": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" - } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." + } + } + }, + "5_req_create_publication": { + "title": "Create Publication Request Body", + "description": "Request body schema for publishing a voucher.", + "oneOf": [ + { + "$ref": "#/components/schemas/5_req_create_publication_standalone_voucher" + }, + { + "$ref": "#/components/schemas/5_req_create_publication_from_campaign" + } + ] + }, + "5_res_create_publication": { + "title": "Create Publication Response Body", + "type": "object", + "description": "Response schema model for publishing a voucher to a specific customer.", + "properties": { + "id": { + "type": "string", + "example": "pub_BbjAXnmm8e0SIm3zG8qvvFCP0KuLywtp", + "description": "Unique publication ID, assigned by Voucherify." + }, + "object": { + "type": "string", + "default": "publication", + "description": "The type of object represented by the JSON. This object stores information about the `publication`." + }, + "created_at": { + "type": "string", + "example": "2022-09-23T09:57:00.434Z", + "description": "Timestamp representing the date and time when the publication was created in ISO 8601 format.", + "format": "date-time" + }, + "customer_id": { + "type": "string", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "description": "Unique customer ID of the customer receiving the publication." + }, + "tracking_id": { + "type": "string", + "description": "Customer's `source_id`." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." + }, + "channel": { + "type": "string", + "description": "How the publication was originated. It can be your own custom channel or an example value provided here.", + "enum": [ + "voucherify-website", + "Dashboard", + "Automation", + "API", + "Braze", + "Reward", + "SMS", + "Email", + "Activecampaign", + "Webhook", + "Intercom", + "Mailchimp", + "Shopify" + ] + }, + "source_id": { + "type": "string", + "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service. " + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Status of the publication attempt." + }, + "customer": { + "description": "Contains information about the customer to whom the publication was directed.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique customer ID, assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's name." + }, + "email": { + "type": "string", + "description": "Customer's email." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs attached to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments." + }, + "object": { + "type": "string", + "default": "customer", + "description": "The type of object represented by the JSON. This object stores information about the `customer`." } - }, - "6_req_validate_voucher_customer_id_string": { + } + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object" + }, + "vouchers_id": { + "type": "array", + "description": "Contains the unique internal voucher ID that was assigned by Voucherify.", + "items": { "type": "string", - "title": "Customer ID", - "description": "You can pass the unique customer ID that was assigned by Voucherify.", - "example": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" - }, - "6_req_validate_voucher_customer_source_id": { - "title": "Customer Source ID", - "description": "You can send the source ID that you used to create the customer in Voucherify.", - "type": "object", - "properties": { - "source_id": { - "type": "string", - "description": "A unique identifier of a customer that validates a voucher. It can be a customer ID or email from a CRM system, database or 3rd-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored." - } - } - }, - "6_req_rollback_redemption_customer_source_id": { - "title": "Customer Source ID", - "description": "You can send the source ID that you used to create the customer in Voucherify.", - "type": "object", - "properties": { - "source_id": { - "type": "string", - "description": "A unique identifier of a customer that redeemed a resource. It can be a customer ID or email from a CRM system, database or 3rd-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored." - } + "example": "[ v_Bw3qWZWv47yb1Onra8F2LlFI1enLakfA ]" + } + } + } + }, + "5_req_create_publication_campaign_id": { + "title": "Campaign ID", + "type": "object", + "description": "Campaign's unique ID assigned by Voucherify.", + "properties": { + "id": { + "type": "string", + "example": "camp_7AZCZeF1VvD6EHC5anAMtvcK", + "description": "Unique campaign ID, assigned by Voucherify." + } + } + }, + "5_req_create_publication_campaign_name": { + "title": "Campaign's name", + "type": "object", + "description": "Campaign's name.", + "properties": { + "name": { + "type": "string", + "example": "Summer Campaign", + "description": "Campaign's name." + } + } + }, + "5_req_create_publication_campaign": { + "title": "Campaign's name or ID", + "type": "string", + "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`. " + }, + "5_res_create_publication_customer_id": { + "title": "Customer ID", + "type": "object", + "description": "Customer's unique ID assigned by Voucherify.", + "properties": { + "id": { + "type": "string", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "description": "Unique customer ID, assigned by Voucherify." + } + } + }, + "5_res_create_publication_customer_source_id": { + "title": "Customer's Source ID", + "type": "object", + "description": "The merchant’s customer ID.", + "properties": { + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + } + } + }, + "5_req_create_publication_customer": { + "title": "Source ID or Unique Customer ID", + "type": "string", + "description": "Customer's unique ID assigned by Voucherify, i.e. `cust_eWgXlBBiY6THFRJwX45Iakv4`, or the merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "5_obj_publication_object_discount": { + "title": "Discount Voucher", + "type": "object", + "description": "This is an object representing a publication of a discount voucher. ", + "properties": { + "code": { + "type": "string", + "description": "Voucher code." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the voucher.", + "default": "voucher" + }, + "campaign": { + "type": "string", + "description": "Name of voucher's parent campaign." + }, + "discount": { + "anyOf": [ + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" } - }, - "6_req_validate_voucher_order_id": { - "title": "Order ID", - "description": "You can pass the unique order ID that was assigned by Voucherify.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request." - } + ] + }, + "is_referral_code": { + "type": "boolean", + "description": "Whether this voucher is a referral code." + } + } + }, + "5_obj_publication_object_loyalty_card": { + "title": "Loyalty Card", + "type": "object", + "description": "This is an object representing a publication of a loyalty card. ", + "properties": { + "code": { + "type": "string", + "description": "Voucher code." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the voucher.", + "default": "voucher" + }, + "campaign": { + "type": "string", + "description": "Name of voucher's parent campaign." + }, + "loyalty_card": { + "type": "object", + "description": "Contains information about the loyalty card being published.", + "properties": { + "points": { + "type": "integer", + "description": "The incremental points to be added to the loyalty card as the initial balance on the card." + }, + "balance": { + "type": "integer", + "description": "The points balance after the incremental points are added to the loyalty card." } - }, - "6_req_validate_voucher_order_source_id": { - "title": "Order Source ID", - "description": "You can send the source ID that you used to create the order in Voucherify.", - "type": "object", - "properties": { - "source_id": { - "type": "string", - "description": "Unique source ID of an existing order that will be linked to the redemption of this request." - } + } + }, + "is_referral_code": { + "type": "boolean", + "description": "Whether this voucher is a referral code." + } + } + }, + "5_obj_publication_object_gift_card": { + "title": "Gift Card", + "type": "object", + "description": "This is an object representing a publication of a gift card. ", + "properties": { + "code": { + "type": "string", + "description": "Voucher code." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the voucher.", + "default": "voucher" + }, + "campaign": { + "type": "string", + "description": "Name of voucher's parent campaign." + }, + "gift": { + "type": "object", + "description": "Contains information about the gift card being published.", + "properties": { + "amount": { + "type": "integer", + "description": "The incremental amount to be added as the initial balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "balance": { + "type": "integer", + "description": "The credit balance on the gift card after the initial incremental amount is added to the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS" + ], + "description": "How the credits are applied to the customer's order." } - }, - "6_req_rollback_redemption_order_id": { - "title": "Order ID", - "description": "You can pass the unique order ID that was assigned by Voucherify.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique ID assigned by Voucherify of an existing order that will be linked to the redemption rollback of this request." - }, - "status": { - "type": "string", - "description": "After a redemption rollback, Voucherify will default the order status to `CANCELED`. You can set the order status to one of the other options: `CREATED`, `PAID`, `FULFILLED`.", - "enum": [ - "CREATED", - "PAID", - "FULFILLED" - ] - } + } + }, + "is_referral_code": { + "type": "boolean", + "description": "Whether this voucher is a referral code." + } + } + }, + "5_res_list_publications": { + "type": "object", + "description": "Response body schema for listing publications using **GET** `/publications`.", + "title": "List Publications Response Body", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about publications in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "publications", + "description": "Identifies the name of the attribute that contains the array of publications." + }, + "publications": { + "type": "array", + "description": "Contains array of publication objects.", + "items": { + "$ref": "#/components/schemas/5_obj_publication_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of publications." + } + } + }, + "6_obj_validation_object": { + "title": "Validation Object", + "description": "This is an object representing a validation.", + "x-tags": [ + "VALIDATIONS API" + ], + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_code" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_gift_card" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_loyalty_card" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_false" + }, + { + "$ref": "#/components/schemas/6_res_validate_promotion_object" + } + ] + }, + "6_req_validate_voucher": { + "title": "Validate Voucher Request Body", + "description": "Request schema model for validating a voucher using **POST** `/vouchers/{code}/validate`.", + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_discount_code" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_gift_card" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_loyalty_card" + } + ] + }, + "6_req_validate_voucher_customer_id": { + "title": "Customer ID", + "description": "You can pass the unique customer ID that was assigned by Voucherify.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The ID of an existing customer that will be linked to redemption in this request.", + "example": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" + } + } + }, + "6_req_rollback_redemption_customer_id": { + "title": "Customer ID", + "description": "You can pass the unique customer ID that was assigned by Voucherify.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The ID of an existing customer that will be linked to redemption rollback in this request.", + "example": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" + } + } + }, + "6_req_validate_voucher_customer_id_string": { + "type": "string", + "title": "Customer ID", + "description": "You can pass the unique customer ID that was assigned by Voucherify.", + "example": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" + }, + "6_req_validate_voucher_customer_source_id": { + "title": "Customer Source ID", + "description": "You can send the source ID that you used to create the customer in Voucherify.", + "type": "object", + "properties": { + "source_id": { + "type": "string", + "description": "A unique identifier of a customer that validates a voucher. It can be a customer ID or email from a CRM system, database or 3rd-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored." + } + } + }, + "6_req_rollback_redemption_customer_source_id": { + "title": "Customer Source ID", + "description": "You can send the source ID that you used to create the customer in Voucherify.", + "type": "object", + "properties": { + "source_id": { + "type": "string", + "description": "A unique identifier of a customer that redeemed a resource. It can be a customer ID or email from a CRM system, database or 3rd-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored." + } + } + }, + "6_req_validate_voucher_order_id": { + "title": "Order ID", + "description": "You can pass the unique order ID that was assigned by Voucherify.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request." + } + } + }, + "6_req_validate_voucher_order_source_id": { + "title": "Order Source ID", + "description": "You can send the source ID that you used to create the order in Voucherify.", + "type": "object", + "properties": { + "source_id": { + "type": "string", + "description": "Unique source ID of an existing order that will be linked to the redemption of this request." + } + } + }, + "6_req_rollback_redemption_order_id": { + "title": "Order ID", + "description": "You can pass the unique order ID that was assigned by Voucherify.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique ID assigned by Voucherify of an existing order that will be linked to the redemption rollback of this request." + }, + "status": { + "type": "string", + "description": "After a redemption rollback, Voucherify will default the order status to `CANCELED`. You can set the order status to one of the other options: `CREATED`, `PAID`, `FULFILLED`.", + "enum": [ + "CREATED", + "PAID", + "FULFILLED" + ] + } + } + }, + "6_req_rollback_redemption_order_source_id": { + "title": "Order Source ID", + "description": "You can send the source ID that you used to create the order in Voucherify.", + "type": "object", + "properties": { + "source_id": { + "type": "string", + "description": "Unique source ID of an existing order that will be linked to the redemption rollback of this request." + }, + "status": { + "type": "string", + "description": "After a redemption rollback, Voucherify will default the order status to `CANCELED`. You can set the order status to one of the other options: `CREATED`, `PAID`, `FULFILLED`.", + "enum": [ + "CREATED", + "PAID", + "FULFILLED" + ] + } + } + }, + "6_req_validate_voucher_discount_code": { + "title": "Discount Code", + "type": "object", + "description": "Request schema model for validating a discount code voucher using **POST** `/vouchers/{code}/validate`.", + "properties": { + "session": { + "$ref": "#/components/schemas/6_req_session_lock_discount_code" + }, + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" } - }, - "6_req_rollback_redemption_order_source_id": { - "title": "Order Source ID", - "description": "You can send the source ID that you used to create the order in Voucherify.", - "type": "object", - "properties": { - "source_id": { - "type": "string", - "description": "Unique source ID of an existing order that will be linked to the redemption rollback of this request." - }, - "status": { - "type": "string", - "description": "After a redemption rollback, Voucherify will default the order status to `CANCELED`. You can set the order status to one of the other options: `CREATED`, `PAID`, `FULFILLED`.", - "enum": [ - "CREATED", - "PAID", - "FULFILLED" - ] - } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" } - }, - "6_req_validate_voucher_discount_code": { - "title": "Discount Code", - "type": "object", - "description": "Request schema model for validating a discount code voucher using **POST** `/vouchers/{code}/validate`.", - "properties": { - "session": { - "$ref": "#/components/schemas/6_req_session_lock_discount_code" - }, - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" - }, - { - "$ref": "#/components/schemas/10_req_create_order" - } - ], - "description": "Order information." - }, - "metadata": { - "type": "object", - "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." - } + ], + "description": "Order information." + }, + "metadata": { + "type": "object", + "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + } + } + }, + "6_req_validate_voucher_gift_card": { + "title": "Gift Card", + "type": "object", + "description": "Request schema model for validating a gift card voucher using **POST** `/vouchers/{code}/validate`.", + "properties": { + "session": { + "$ref": "#/components/schemas/6_req_session_lock_gift_card" + }, + "gift": { + "type": "object", + "description": "Contains information on the number of gift card credits that the customer wants to apply to the order.", + "properties": { + "credits": { + "type": "integer", + "description": "The number of credits that the user wants to use from the gift card to fulfil the order. The value of credits cannot be higher than the current balance on the gift card. If the user gives more points than he has on the gift card, the application will return an error code in response. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." } - }, - "6_req_validate_voucher_gift_card": { - "title": "Gift Card", - "type": "object", - "description": "Request schema model for validating a gift card voucher using **POST** `/vouchers/{code}/validate`.", - "properties": { - "session": { - "$ref": "#/components/schemas/6_req_session_lock_gift_card" - }, - "gift": { - "type": "object", - "description": "Contains information on the number of gift card credits that the customer wants to apply to the order.", - "properties": { - "credits": { - "type": "integer", - "description": "The number of credits that the user wants to use from the gift card to fulfil the order. The value of credits cannot be higher than the current balance on the gift card. If the user gives more points than he has on the gift card, the application will return an error code in response. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - }, - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" - }, - { - "$ref": "#/components/schemas/10_req_create_order" - } - ], - "description": "Order information." - }, - "metadata": { - "type": "object", - "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." - } + } + }, + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" } - }, - "6_req_validate_voucher_loyalty_card": { - "title": "Loyalty Card", - "type": "object", - "description": "Request schema model for validating a loyalty card voucher using **POST** `/vouchers/{code}/validate`.", - "properties": { - "session": { - "$ref": "#/components/schemas/6_req_session_lock_loyalty_card" - }, - "reward": { - "type": "object", - "description": "Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward." - }, - "points": { - "type": "integer", - "description": "The number of loyalty points that the user wants to spend in order to fulfill the order. The number of points cannot be higher than the current balance on the loyalty card. If the user gives more points than he/she has on the loyalty card, the application will return an error code in response." - } - } - }, - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" - }, - { - "$ref": "#/components/schemas/10_req_create_order" - } - ], - "description": "Order information." - }, - "metadata": { - "type": "object", - "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." - } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" } - }, - "6_req_validate_voucher_unpublished_discount_code": { - "title": "Unpublished Discount Code", - "type": "object", - "description": "Request schema model for validating a voucher using **POST** `/vouchers/{code}/validate`.", - "properties": { - "session": { - "type": "string" - } + ], + "description": "Order information." + }, + "metadata": { + "type": "object", + "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + } + } + }, + "6_req_validate_voucher_loyalty_card": { + "title": "Loyalty Card", + "type": "object", + "description": "Request schema model for validating a loyalty card voucher using **POST** `/vouchers/{code}/validate`.", + "properties": { + "session": { + "$ref": "#/components/schemas/6_req_session_lock_loyalty_card" + }, + "reward": { + "type": "object", + "description": "Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward." + }, + "points": { + "type": "integer", + "description": "The number of loyalty points that the user wants to spend in order to fulfill the order. The number of points cannot be higher than the current balance on the loyalty card. If the user gives more points than he/she has on the loyalty card, the application will return an error code in response." } - }, - "6_req_session_lock_discount_code": { - "title": "Discount Code Session Lock", - "type": "object", - "description": "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](doc:locking-validation-session).", - "properties": { - "type": { - "type": "string", - "description": "This parameter is **required** to establish a new session. The session locks the redemption **quantity** by 1.", - "enum": [ - "LOCK" - ] - }, - "key": { - "type": "string", - "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", - "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" - }, - "ttl_unit": { - "type": "string", - "description": "Defines the type of unit in which the session time is counted.", - "enum": [ - "HOURS", - "DAYS", - "MINUTES", - "SECONDS", - "MILLISECONDS", - "MICROSECONDS", - "NANOSECONDS" - ] - }, - "ttl": { - "type": "integer", - "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." - } + } + }, + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" } - }, - "6_req_session_lock_gift_card": { - "title": "Gift Card Session Lock", - "type": "object", - "description": "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](doc:locking-validation-session).", - "properties": { - "type": { - "type": "string", - "description": "This parameter is **required** to establish a new session. The session locks the redemption **quantity** by 1 and the redemption **gift credits** specified within the request.", - "enum": [ - "LOCK" - ] - }, - "key": { - "type": "string", - "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", - "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" - }, - "ttl_unit": { - "type": "string", - "description": "Defines the type of unit in which the session time is counted.", - "enum": [ - "HOURS", - "DAYS", - "MINUTES", - "SECONDS", - "MILLISECONDS", - "MICROSECONDS", - "NANOSECONDS" - ] - }, - "ttl": { - "type": "integer", - "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." - } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" } + ], + "description": "Order information." + }, + "metadata": { + "type": "object", + "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + } + } + }, + "6_req_validate_voucher_unpublished_discount_code": { + "title": "Unpublished Discount Code", + "type": "object", + "description": "Request schema model for validating a voucher using **POST** `/vouchers/{code}/validate`.", + "properties": { + "session": { + "type": "string" + } + } + }, + "6_req_session_lock_discount_code": { + "title": "Discount Code Session Lock", + "type": "object", + "description": "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](doc:locking-validation-session).", + "properties": { + "type": { + "type": "string", + "description": "This parameter is **required** to establish a new session. The session locks the redemption **quantity** by 1.", + "enum": [ + "LOCK" + ] + }, + "key": { + "type": "string", + "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", + "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" + }, + "ttl_unit": { + "type": "string", + "description": "Defines the type of unit in which the session time is counted.", + "enum": [ + "HOURS", + "DAYS", + "MINUTES", + "SECONDS", + "MILLISECONDS", + "MICROSECONDS", + "NANOSECONDS" + ] + }, + "ttl": { + "type": "integer", + "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." + } + } + }, + "6_req_session_lock_gift_card": { + "title": "Gift Card Session Lock", + "type": "object", + "description": "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](doc:locking-validation-session).", + "properties": { + "type": { + "type": "string", + "description": "This parameter is **required** to establish a new session. The session locks the redemption **quantity** by 1 and the redemption **gift credits** specified within the request.", + "enum": [ + "LOCK" + ] + }, + "key": { + "type": "string", + "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", + "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" + }, + "ttl_unit": { + "type": "string", + "description": "Defines the type of unit in which the session time is counted.", + "enum": [ + "HOURS", + "DAYS", + "MINUTES", + "SECONDS", + "MILLISECONDS", + "MICROSECONDS", + "NANOSECONDS" + ] + }, + "ttl": { + "type": "integer", + "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." + } + } + }, + "6_req_session_lock_loyalty_card": { + "title": "Loyalty Card Session Lock", + "type": "object", + "description": "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](doc:locking-validation-session).", + "properties": { + "type": { + "type": "string", + "description": "This parameter is **required** to establish a new session. The session locks the redemption **quantity** by 1 and the redemption **loyalty points** specified within the request.", + "enum": [ + "LOCK" + ] + }, + "key": { + "type": "string", + "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", + "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" + }, + "ttl_unit": { + "type": "string", + "description": "Defines the type of unit in which the session time is counted.", + "enum": [ + "HOURS", + "DAYS", + "MINUTES", + "SECONDS", + "MILLISECONDS", + "MICROSECONDS", + "NANOSECONDS" + ] + }, + "ttl": { + "type": "integer", + "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." + } + } + }, + "6_res_session_lock_discount_voucher": { + "title": "Session Lock", + "type": "object", + "description": "Schema model for `session` lock object. The session object contains information about the session key that was used to establish a session between multiple parallel validation and redemption requests.", + "properties": { + "type": { + "type": "string", + "description": "This session locks the redemption **quantity** by 1.", + "default": "LOCK" + }, + "key": { + "type": "string", + "description": "The session unique ID assigned by Voucherify or your own unique session ID. ", + "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" + }, + "ttl_unit": { + "type": "string", + "description": "Defines the type of unit in which the session time is counted.", + "enum": [ + "HOURS", + "DAYS", + "MINUTES", + "SECONDS", + "MILLISECONDS", + "MICROSECONDS", + "NANOSECONDS" + ] + }, + "ttl": { + "type": "integer", + "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." + } + } + }, + "6_res_session_lock_gift_card": { + "title": "Session Lock", + "type": "object", + "description": "Schema model for `session` lock object. The session object contains information about the session key that was used to establish a session between multiple parallel validation and redemption requests.", + "properties": { + "type": { + "type": "string", + "description": "This session locks the redemption **quantity** by 1 and the redemption **gift credits** specified within the request.", + "default": "LOCK" + }, + "key": { + "type": "string", + "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", + "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" + }, + "ttl_unit": { + "type": "string", + "description": "Defines the type of unit in which the session time is counted.", + "enum": [ + "HOURS", + "DAYS", + "MINUTES", + "SECONDS", + "MILLISECONDS", + "MICROSECONDS", + "NANOSECONDS" + ] + }, + "ttl": { + "type": "integer", + "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." + } + } + }, + "6_res_session_lock_loyalty_card": { + "title": "Session Lock", + "type": "object", + "description": "Schema model for `session` lock object. The session object contains information about the session key that was used to establish a session between multiple parallel validation and redemption requests.", + "properties": { + "type": { + "type": "string", + "description": "This session locks the redemption **quantity** by 1 and the redemption **loyalty points** specified within the request.", + "default": "LOCK" + }, + "key": { + "type": "string", + "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", + "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" + }, + "ttl_unit": { + "type": "string", + "description": "Defines the type of unit in which the session time is counted.", + "enum": [ + "HOURS", + "DAYS", + "MINUTES", + "SECONDS", + "MILLISECONDS", + "MICROSECONDS", + "NANOSECONDS" + ] + }, + "ttl": { + "type": "integer", + "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." + } + } + }, + "6_res_validate_voucher_false": { + "type": "object", + "title": "Not Valid", + "description": "Response schema for a voucher that is not valid.", + "examples": [ + { + "valid": false, + "reason": "voucher is disabled", + "error": { + "message": "Voucher has been disabled and is not active anymore." }, - "6_req_session_lock_loyalty_card": { - "title": "Loyalty Card Session Lock", - "type": "object", - "description": "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](doc:locking-validation-session).", - "properties": { - "type": { - "type": "string", - "description": "This parameter is **required** to establish a new session. The session locks the redemption **quantity** by 1 and the redemption **loyalty points** specified within the request.", - "enum": [ - "LOCK" - ] - }, - "key": { - "type": "string", - "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", - "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" - }, - "ttl_unit": { - "type": "string", - "description": "Defines the type of unit in which the session time is counted.", - "enum": [ - "HOURS", - "DAYS", - "MINUTES", - "SECONDS", - "MILLISECONDS", - "MICROSECONDS", - "NANOSECONDS" - ] - }, - "ttl": { - "type": "integer", - "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." - } - } + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", + "code": "WFf5XAUc", + "metadata": {} + }, + { + "valid": false, + "reason": "Customer must be a holder of a loyalty card.", + "error": { + "message": "You are not the right person." }, - "6_res_session_lock_discount_voucher": { - "title": "Session Lock", - "type": "object", - "description": "Schema model for `session` lock object. The session object contains information about the session key that was used to establish a session between multiple parallel validation and redemption requests.", - "properties": { - "type": { - "type": "string", - "description": "This session locks the redemption **quantity** by 1.", - "default": "LOCK" - }, - "key": { - "type": "string", - "description": "The session unique ID assigned by Voucherify or your own unique session ID. ", - "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" - }, - "ttl_unit": { - "type": "string", - "description": "Defines the type of unit in which the session time is counted.", - "enum": [ - "HOURS", - "DAYS", - "MINUTES", - "SECONDS", - "MILLISECONDS", - "MICROSECONDS", - "NANOSECONDS" - ] - }, - "ttl": { - "type": "integer", - "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." - } - } + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", + "code": "3TCjkel8", + "metadata": {} + }, + { + "valid": false, + "reason": "loyalty card points exceeded", + "error": { + "message": "You need more loyalty points to be able to redeem a reward." }, - "6_res_session_lock_gift_card": { - "title": "Session Lock", - "type": "object", - "description": "Schema model for `session` lock object. The session object contains information about the session key that was used to establish a session between multiple parallel validation and redemption requests.", - "properties": { - "type": { - "type": "string", - "description": "This session locks the redemption **quantity** by 1 and the redemption **gift credits** specified within the request.", - "default": "LOCK" - }, - "key": { - "type": "string", - "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", - "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" - }, - "ttl_unit": { - "type": "string", - "description": "Defines the type of unit in which the session time is counted.", - "enum": [ - "HOURS", - "DAYS", - "MINUTES", - "SECONDS", - "MILLISECONDS", - "MICROSECONDS", - "NANOSECONDS" - ] - }, - "ttl": { - "type": "integer", - "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." - } + "tracking_id": "track_QjgJ4Z5Gv10OpRCXZM8cMIOPCB1PNuli", + "code": "pfeDMTsj", + "metadata": {} + }, + { + "valid": false, + "reason": "order does not match validation rules", + "error": { + "code": 400, + "key": "order_rules_violated", + "message": "order does not match validation rules", + "details": "Loyalty Card cannot be redeemed because of violated validation rules: val_RU9fm8GiQaRT", + "request_id": "v-0bcbde194f1305ad88" + }, + "tracking_id": "track_QjgJ4Z5Gv10OpRCXZM8cMIOPCB1PNuli", + "code": "pfeDMTsj", + "metadata": {} + } + ], + "properties": { + "valid": { + "type": "boolean", + "default": false, + "description": "Indicates whether the voucher is valid within the context of the parameters provided in the request body." + }, + "reason": { + "type": "string", + "description": "System generated cause for the voucher being invalid in the context of the provided parameters." + }, + "error": { + "type": "object", + "description": "Detailed failure cause for the invalid voucher if the reason has a translation defined in the Dashboard → Project Settings → Error Messages.", + "properties": { + "message": { + "type": "string", + "description": "Customized error message." } - }, - "6_res_session_lock_loyalty_card": { - "title": "Session Lock", - "type": "object", - "description": "Schema model for `session` lock object. The session object contains information about the session key that was used to establish a session between multiple parallel validation and redemption requests.", - "properties": { - "type": { - "type": "string", - "description": "This session locks the redemption **quantity** by 1 and the redemption **loyalty points** specified within the request.", - "default": "LOCK" - }, - "key": { - "type": "string", - "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", - "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" - }, - "ttl_unit": { - "type": "string", - "description": "Defines the type of unit in which the session time is counted.", - "enum": [ - "HOURS", - "DAYS", - "MINUTES", - "SECONDS", - "MILLISECONDS", - "MICROSECONDS", - "NANOSECONDS" - ] - }, - "ttl": { - "type": "integer", - "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." - } + } + }, + "tracking_id": { + "type": "string", + "description": "Hashed customer source ID." + }, + "code": { + "type": "string", + "description": "Voucher code." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + } + } + }, + "6_res_validate_voucher_discount_amount": { + "title": "Amount Discount", + "type": "object", + "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", + "properties": { + "type": { + "type": "string", + "default": "AMOUNT", + "description": "Defines the type of voucher." + }, + "effect": { + "type": "string", + "description": "Defines how the discount is applied to the customer's order.", + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS", + "APPLY_TO_ITEMS_PROPORTIONALLY", + "APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY", + "APPLY_TO_ITEMS_BY_QUANTITY" + ] + }, + "amount_off": { + "type": "integer", + "description": "Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. " + } + } + }, + "6_res_validate_voucher_discount_percent": { + "title": "Percent Discount", + "type": "object", + "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", + "properties": { + "type": { + "type": "string", + "default": "PERCENT", + "description": "Defines the type of voucher." + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS" + ], + "description": "Defines how the discount is applied to the customer's order." + }, + "percent_off": { + "type": "integer", + "description": "The percent discount that the customer will receive." + }, + "amount_limit": { + "type": "integer", + "description": "Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600." + }, + "is_dynamic": { + "type": "boolean", + "description": "Flag indicating whether the discount was calculated using a formula." + } + } + }, + "6_res_validate_voucher_discount_fixed": { + "title": "Fixed Discount", + "type": "object", + "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value. A fixed discounts sets a fixed total on cart or item(s) and then calculates the discount to apply.", + "properties": { + "type": { + "type": "string", + "default": "FIXED", + "description": "Type of discount." + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS" + ], + "description": "Defines how the discount is applied to the customer's order. \n \n| **Effect** | **Definition** |\n|---|---|\n| **APPLY_TO_ORDER** | Sets the order total amount to the value of the fixed amount. The discount value is calculated during the redemption as it's a difference between the total amount of the customer's order and the fixed amount. |\n| **APPLY_TO_ITEMS** | Sets a new price on items. The total discount amount is calculated during the redemption and it's a difference between the initial item price and the fixed amount. |" + }, + "fixed_amount": { + "type": "integer", + "description": "Set a fixed valued for an order total or price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. In case of the fixed amount being calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value." + } + } + }, + "6_res_validate_voucher_discount_unit": { + "title": "Unit Discount, single item", + "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", + "oneOf": [ + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_product" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_sku" + } + ] + }, + "6_res_validate_voucher_discount_unit_product": { + "title": "Unit Discount, Product", + "type": "object", + "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", + "properties": { + "type": { + "type": "string", + "default": "UNIT", + "description": "Discount type." + }, + "effect": { + "type": "string", + "enum": [ + "ADD_MISSING_ITEMS", + "ADD_NEW_ITEMS" + ], + "description": "Defines how the unit is added to the customer's order." + }, + "unit_off": { + "type": "integer", + "description": "Number of units to be granted a full value discount." + }, + "unit_type": { + "type": "string", + "example": "prod_0a9f9ab4ab019a42d5", + "description": "The product deemed as free, chosen from product inventory (e.g. time, items)." + }, + "product": { + "type": "object", + "description": "Contains information about the product.", + "properties": { + "id": { + "type": "string", + "description": "Unique product ID, assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "Product's source ID." + }, + "name": { + "type": "string", + "description": "Product name." } - }, - "6_res_validate_voucher_false": { - "type": "object", - "title": "Not Valid", - "description": "Response schema for a voucher that is not valid.", - "examples": [ + } + } + } + }, + "6_res_validate_voucher_discount_unit_sku": { + "title": "Unit Discount, SKU", + "type": "object", + "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", + "properties": { + "type": { + "type": "string", + "default": "UNIT", + "description": "Discount type." + }, + "effect": { + "type": "string", + "enum": [ + "ADD_MISSING_ITEMS", + "ADD_NEW_ITEMS" + ], + "description": "Defines how the unit is added to the customer's order." + }, + "unit_off": { + "type": "integer", + "description": "Number of units to be granted a full value discount." + }, + "unit_type": { + "type": "string", + "example": "sku_0bae3b28f610fd0da1", + "description": "The product variant deemed as free, chosen from product inventory (e.g. time, items)." + }, + "sku": { + "type": "object", + "description": "Contains information about the SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_0bae3b28f610fd0da1", + "description": "Unique SKU ID, assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "Product variant's source ID." + }, + "sku": { + "type": "string", + "description": "Product varient's name." + } + } + }, + "product": { + "type": "object", + "description": "Contains information about the parent product.", + "properties": { + "id": { + "type": "string", + "description": "Unique parent product ID, assigned by Voucherify.", + "example": "prod_0bae2dc5a090fd0184" + }, + "source_id": { + "type": "string", + "description": "Source ID of parent product." + }, + "name": { + "type": "string", + "description": "Name of parent product." + } + } + } + } + }, + "6_res_validate_voucher_discount_unit_multiple": { + "title": "Unit Discount, multiple items", + "type": "object", + "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", + "properties": { + "type": { + "type": "string", + "default": "UNIT", + "description": "Discount type." + }, + "effect": { + "type": "string", + "default": "ADD_MANY_ITEMS", + "description": "Defines how the discount is applied to the customer's order." + }, + "units": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_product_multiple" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_sku_multiple" + } + ] + } + } + }, + "6_res_validate_voucher_discount_unit_product_multiple": { + "title": "Product Item", + "type": "object", + "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", + "properties": { + "effect": { + "type": "string", + "enum": [ + "ADD_MISSING_ITEMS", + "ADD_NEW_ITEMS" + ], + "description": "Defines how the unit is added to the customer's order." + }, + "unit_off": { + "type": "integer", + "description": "Number of units to be granted a full value discount." + }, + "unit_type": { + "type": "string", + "example": "prod_0a9f9ab4ab019a42d5", + "description": "The product deemed as free, chosen from product inventory (e.g. time, items)." + }, + "product": { + "type": "object", + "description": "Contains information about the product.", + "properties": { + "id": { + "type": "string", + "description": "Unique product ID, assigned by Voucherify.", + "example": "prod_0a9f9ab4ab019a42d5" + }, + "source_id": { + "type": "string", + "description": "Product's source ID." + }, + "name": { + "type": "string", + "description": "Product name." + } + } + } + } + }, + "6_res_validate_voucher_discount_unit_sku_multiple": { + "title": "SKU Item", + "type": "object", + "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", + "properties": { + "effect": { + "type": "string", + "enum": [ + "ADD_MISSING_ITEMS", + "ADD_NEW_ITEMS" + ], + "description": "Defines how the unit is added to the customer's order." + }, + "unit_off": { + "type": "integer", + "description": "Number of units to be granted a full value discount." + }, + "unit_type": { + "type": "string", + "example": "sku_0bae3b28f610fd0da1", + "description": "The product variant deemed as free, chosen from product inventory (e.g. time, items)." + }, + "sku": { + "type": "object", + "description": "Contains information about the SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_0bae3b28f610fd0da1", + "description": "Unique SKU ID, assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "Product variant's source ID." + }, + "sku": { + "type": "string", + "description": "Product varient's name." + } + } + }, + "product": { + "type": "object", + "description": "Contains information about the parent product.", + "properties": { + "id": { + "type": "string", + "description": "Unique parent product ID, assigned by Voucherify.", + "example": "prod_0b7d7dfb05cbe5c616" + }, + "source_id": { + "type": "string", + "description": "Source ID of parent product." + }, + "name": { + "type": "string", + "description": "Name of parent product." + } + } + } + } + }, + "6_res_validate_voucher_discount_shipping": { + "title": "Shipping Discount", + "type": "object", + "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", + "properties": { + "type": { + "type": "string", + "default": "UNIT", + "description": "Discount type." + }, + "effect": { + "type": "string", + "description": "Defines how the unit is added to the customer's order.", + "default": "ADD_MISSING_ITEMS" + }, + "unit_off": { + "type": "integer", + "description": "Number of units to be granted a full value discount.", + "default": 1 + }, + "unit_type": { + "type": "string", + "description": "The shipping \"product\" deemed as free.", + "default": "prod_5h1pp1ng" + }, + "product": { + "type": "object", + "description": "Contains information about the shipping \"product\".", + "properties": { + "id": { + "type": "string", + "description": "Unique shipping \"product\" ID, assigned by Voucherify.", + "default": "prod_5h1pp1ng" + }, + "source_id": { + "type": "string", + "description": "\"Product's\" source ID.", + "default": "5h1pp1ng" + }, + "name": { + "type": "string", + "description": "\"Product\" name.", + "default": "Shipping" + } + } + } + } + }, + "6_res_validate_voucher": { + "title": "Valid", + "description": "Response schema model for validating a voucher using **POST** `/vouchers/{code}/validate`.", + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_code" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_gift_card" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_loyalty_card" + } + ] + }, + "6_res_validate_voucher_discount_code": { + "type": "object", + "title": "Valid - Discount Code", + "description": "Response schema model for validating a discount code using **POST** `/vouchers/{code}/validate`.", + "properties": { + "valid": { + "type": "boolean", + "description": "Indicates whether the voucher is valid within the context of the parameters provided in the request body." + }, + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" + }, + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" + }, + "tracking_id": { + "type": "string", + "description": "Hashed customer source ID." + }, + "order": { + "$ref": "#/components/schemas/6_obj_order_object" + }, + "code": { + "type": "string", + "description": "Voucher code." + }, + "discount": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_amount" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_percent" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_fixed" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_shipping" + } + ], + "description": "Contains information about the discount to be applied to the order." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + }, + "start_date": { + "type": "string", + "format": "date-time", + "example": "2022-10-04T00:00:00.000Z", + "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is _inactive_ before this date." + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-10-31T00:00:00.000Z", + "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is _inactive_ after this date." + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "example": "camp_W8DJVd8J0btqXT6FBwn7BSkC", + "description": "Voucher's parent campaign's unique ID." + }, + "session": { + "$ref": "#/components/schemas/6_res_session_lock_discount_voucher" + } + } + }, + "6_res_validate_voucher_gift_card": { + "type": "object", + "title": "Valid - Gift Card", + "description": "Response schema model for validating a gift card using **POST** `/vouchers/{code}/validate`.", + "properties": { + "valid": { + "type": "boolean", + "description": "Indicates whether the voucher is valid within the context of the parameters provided in the request body." + }, + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" + }, + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" + }, + "tracking_id": { + "type": "string", + "description": "Hashed customer source ID." + }, + "order": { + "$ref": "#/components/schemas/6_obj_order_object" + }, + "code": { + "type": "string", + "description": "Voucher code." + }, + "gift": { + "type": "object", + "description": "Contains current gift card balance information.", + "properties": { + "amount": { + "type": "integer", + "description": "Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "balance": { + "type": "integer", + "description": "Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS" + ], + "description": "Defines how the credits are applied to the customer's order." + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + }, + "start_date": { + "type": "string", + "format": "date-time", + "example": "2022-10-04T00:00:00.000Z", + "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is _inactive_ before this date." + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-10-31T00:00:00.000Z", + "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is _inactive_ after this date." + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "example": "camp_W8DJVd8J0btqXT6FBwn7BSkC", + "description": "Voucher's parent campaign's unique ID." + }, + "session": { + "$ref": "#/components/schemas/6_res_session_lock_gift_card" + } + } + }, + "6_res_validate_voucher_loyalty_card": { + "type": "object", + "title": "Valid - Loyalty Card", + "description": "Response schema model for validating a loyalty card using **POST** `/vouchers/{code}/validate`.", + "properties": { + "valid": { + "type": "boolean", + "description": "Indicates whether the voucher is valid within the context of the parameters provided in the request body." + }, + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" + }, + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" + }, + "tracking_id": { + "type": "string", + "description": "Hashed customer source ID." + }, + "order": { + "$ref": "#/components/schemas/6_obj_order_object_apply_to_order" + }, + "code": { + "type": "string", + "description": "Voucher code." + }, + "loyalty": { + "type": "object", + "description": "Contains the cost of reward in points.", + "properties": { + "points_cost": { + "type": "integer", + "description": "Number of points that wlil be deducted from loyaty card for the associated reward." + } + } + }, + "reward": { + "type": "object", + "description": "Contains information about the reward that is being validated.", + "properties": { + "id": { + "type": "string", + "description": "Unique reward ID assigned by Voucherify.", + "example": "rew_Crmu3hu2FKZWZIML59AeAs1n" + }, + "assignment_id": { + "type": "string", + "example": "rewa_xZr6Ks0j5AHeMRVdELmpI9sc", + "description": "Unique reward assignment ID assigned by Voucherify." + }, + "points": { + "type": "integer", + "description": "Number of points applied to the reward." + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + }, + "start_date": { + "type": "string", + "format": "date-time", + "example": "2022-10-04T00:00:00.000Z", + "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is _inactive_ before this date." + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-10-31T00:00:00.000Z", + "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is _inactive_ after this date." + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "example": "camp_W8DJVd8J0btqXT6FBwn7BSkC", + "description": "Voucher's parent campaign's unique ID." + }, + "session": { + "$ref": "#/components/schemas/6_res_session_lock_loyalty_card" + } + } + }, + "6_res_applicable_to_object": { + "title": "Included Items", + "type": "object", + "description": "Contains list of items that qualify in the scope of the discount. These are definitions of included products, SKUs, and product collections. These can be discounted.", + "properties": { + "data": { + "type": "array", + "description": "Contains array of items to which the discount can apply.", + "items": { + "anyOf": [ { - "valid": false, - "reason": "voucher is disabled", - "error": { - "message": "Voucher has been disabled and is not active anymore." - }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "code": "WFf5XAUc", - "metadata": {} + "$ref": "#/components/schemas/6_res_product_collection" }, { - "valid": false, - "reason": "Customer must be a holder of a loyalty card.", - "error": { - "message": "You are not the right person." - }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "code": "3TCjkel8", - "metadata": {} + "$ref": "#/components/schemas/6_res_product_collection_unit" }, { - "valid": false, - "reason": "loyalty card points exceeded", - "error": { - "message": "You need more loyalty points to be able to redeem a reward." - }, - "tracking_id": "track_QjgJ4Z5Gv10OpRCXZM8cMIOPCB1PNuli", - "code": "pfeDMTsj", - "metadata": {} + "$ref": "#/components/schemas/6_res_product_collection_fixed_amount" }, { - "valid": false, - "reason": "order does not match validation rules", - "error": { - "code": 400, - "key": "order_rules_violated", - "message": "order does not match validation rules", - "details": "Loyalty Card cannot be redeemed because of violated validation rules: val_RU9fm8GiQaRT", - "request_id": "v-0bcbde194f1305ad88" - }, - "tracking_id": "track_QjgJ4Z5Gv10OpRCXZM8cMIOPCB1PNuli", - "code": "pfeDMTsj", - "metadata": {} - } - ], - "properties": { - "valid": { - "type": "boolean", - "default": false, - "description": "Indicates whether the voucher is valid within the context of the parameters provided in the request body." - }, - "reason": { - "type": "string", - "description": "System generated cause for the voucher being invalid in the context of the provided parameters." - }, - "error": { - "type": "object", - "description": "Detailed failure cause for the invalid voucher if the reason has a translation defined in the Dashboard → Project Settings → Error Messages.", - "properties": { - "message": { - "type": "string", - "description": "Customized error message." - } - } + "$ref": "#/components/schemas/6_res_product" }, - "tracking_id": { - "type": "string", - "description": "Hashed customer source ID." + { + "$ref": "#/components/schemas/6_res_product_unit" }, - "code": { - "type": "string", - "description": "Voucher code." + { + "$ref": "#/components/schemas/6_res_product_fixed_amount" }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - } - } - }, - "6_res_validate_voucher_discount_amount": { - "title": "Amount Discount", - "type": "object", - "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", - "properties": { - "type": { - "type": "string", - "default": "AMOUNT", - "description": "Defines the type of voucher." + { + "$ref": "#/components/schemas/6_res_sku" }, - "effect": { - "type": "string", - "description": "Defines how the discount is applied to the customer's order.", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS", - "APPLY_TO_ITEMS_PROPORTIONALLY", - "APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY", - "APPLY_TO_ITEMS_BY_QUANTITY" - ] + { + "$ref": "#/components/schemas/6_res_sku_unit" }, - "amount_off": { - "type": "integer", - "description": "Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. " + { + "$ref": "#/components/schemas/6_res_sku_unit_fixed_amount" } - } - }, - "6_res_validate_voucher_discount_percent": { - "title": "Percent Discount", - "type": "object", - "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", - "properties": { - "type": { - "type": "string", - "default": "PERCENT", - "description": "Defines the type of voucher." - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS" - ], - "description": "Defines how the discount is applied to the customer's order." - }, - "percent_off": { - "type": "integer", - "description": "The percent discount that the customer will receive." - }, - "amount_limit": { - "type": "integer", - "description": "Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600." - }, - "is_dynamic": { - "type": "boolean", - "description": "Flag indicating whether the discount was calculated using a formula." - } - } - }, - "6_res_validate_voucher_discount_fixed": { - "title": "Fixed Discount", - "type": "object", - "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value. A fixed discounts sets a fixed total on cart or item(s) and then calculates the discount to apply.", - "properties": { - "type": { - "type": "string", - "default": "FIXED", - "description": "Type of discount." - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS" - ], - "description": "Defines how the discount is applied to the customer's order. \n \n| **Effect** | **Definition** |\n|---|---|\n| **APPLY_TO_ORDER** | Sets the order total amount to the value of the fixed amount. The discount value is calculated during the redemption as it's a difference between the total amount of the customer's order and the fixed amount. |\n| **APPLY_TO_ITEMS** | Sets a new price on items. The total discount amount is calculated during the redemption and it's a difference between the initial item price and the fixed amount. |" + ] + } + }, + "total": { + "type": "integer", + "description": "Total number of objects defining included products, SKUs, or product collections." + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of included objects." + }, + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about included products, SKUs, or product collections in a dictionary." + } + } + }, + "6_res_inapplicable_to_object": { + "title": "Excluded Items", + "type": "object", + "description": "Contains list of items that **do not** qualify in the scope of the discount. These are definitions of excluded products, SKUs, and product collections. These **CANNOT** be discounted.", + "properties": { + "data": { + "description": "Contains array of items to which the discount cannot apply.", + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_product_collection_excluded" }, - "fixed_amount": { - "type": "integer", - "description": "Set a fixed valued for an order total or price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000. In case of the fixed amount being calculated by the formula, i.e. the `fixed_amount_formula` parameter is present in the fixed amount definition, this value becomes the **fallback value**. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed value." - } - } - }, - "6_res_validate_voucher_discount_unit": { - "title": "Unit Discount, single item", - "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", - "oneOf": [ { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_product" + "$ref": "#/components/schemas/6_res_product_excluded" }, { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_sku" + "$ref": "#/components/schemas/6_res_sku_excluded" } ] - }, - "6_res_validate_voucher_discount_unit_product": { - "title": "Unit Discount, Product", + } + }, + "total": { + "type": "integer", + "description": "Total number of objects defining excluded products, SKUs, or product collections." + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of excluded objects." + }, + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about excluded products, SKUs, or product collections in a dictionary." + } + } + }, + "6_res_product_collection": { + "title": "Product Collection", + "type": "object", + "description": "Contains definition for a product collection.", + "properties": { + "object": { + "type": "string", + "default": "products_collection", + "description": "This object stores information about the product collection." + }, + "id": { + "type": "string", + "example": "pc_4ndRXAsTOzwSdHcQcxf489uU", + "description": "Unique product collection ID assigned by Voucherify." + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Defines how the discount is applied to the customer's order." + } + } + }, + "6_res_product_collection_unit": { + "title": "Product Collection for Unit Discount", + "type": "object", + "description": "Contains definition for a product collection.", + "properties": { + "object": { + "type": "string", + "default": "products_collection", + "description": "This object stores information about the product collection." + }, + "id": { + "type": "string", + "example": "pc_4ndRXAsTOzwSdHcQcxf489uU", + "description": "Unique product collection ID assigned by Voucherify." + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Defines how the discount is applied to the customer's order." + }, + "quantity_limit": { + "type": "integer", + "description": "The maximum number of units allowed to be discounted per order line item." + }, + "aggregated_quantity_limit": { + "type": "integer", + "description": "The maximum number of units allowed to be discounted combined across all matched order line items." + } + } + }, + "6_res_product_collection_fixed_amount": { + "title": "Product Collection for Fixed Amount Discount", + "type": "object", + "description": "Contains definition for a product collection.", + "properties": { + "object": { + "type": "string", + "default": "products_collection", + "description": "This object stores information about the product collection." + }, + "id": { + "type": "string", + "example": "pc_4ndRXAsTOzwSdHcQcxf489uU", + "description": "Unique product collection ID assigned by Voucherify." + }, + "strict": { + "type": "boolean" + }, + "price": { + "type": "integer", + "description": "New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the `price_formula` parameter is present in the fixed price definition, this value becomes the **fallback value**. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price." + }, + "price_formula": { + "type": "string", + "description": "Formula used to calculate the discounted price of an item.", + "example": "\"IF(ORDER_AMOUNT > 300;ORDER_ITEM_PRICE * 0.8;ORDER_ITEM_PRICE)" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Defines how the discount is applied to the customer's order." + } + } + }, + "6_res_product_collection_excluded": { + "title": "Product Collection", + "type": "object", + "description": "Contains definition for a product collection.", + "properties": { + "object": { + "type": "string", + "default": "products_collection", + "description": "This object stores information about the product collection." + }, + "id": { + "type": "string", + "example": "pc_4ndRXAsTOzwSdHcQcxf489uU", + "description": "Unique product collection ID assigned by Voucherify." + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY" + ], + "description": "Defines how the discount is applied to the customer's order." + } + } + }, + "6_res_sku": { + "title": "SKU", + "type": "object", + "description": "Contains definition for a product variant.", + "properties": { + "object": { + "type": "string", + "default": "sku", + "description": "This object stores information about the product variant." + }, + "id": { + "type": "string", + "description": "Unique SKU ID assigned by Voucherify.", + "example": "sku_0b7d7dfb090be5c619" + }, + "source_id": { + "type": "string", + "description": "The source ID from your inventory system." + }, + "product_id": { + "type": "string", + "description": "Parent product's unique ID assigned by Voucherify." + }, + "product_source_id": { + "type": "string", + "description": "Parent product's source ID from your inventory system." + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Defines how the discount is applied to the customer's order." + } + } + }, + "6_res_sku_unit": { + "title": "SKU for Unit Discount", + "type": "object", + "description": "Contains definition for a product variant.", + "properties": { + "object": { + "type": "string", + "default": "sku", + "description": "This object stores information about the product variant." + }, + "id": { + "type": "string", + "description": "Unique SKU ID assigned by Voucherify.", + "example": "sku_0b7d7dfb090be5c619" + }, + "source_id": { + "type": "string", + "description": "The source ID from your inventory system." + }, + "product_id": { + "type": "string", + "description": "Parent product's unique ID assigned by Voucherify." + }, + "product_source_id": { + "type": "string", + "description": "Parent product's source ID from your inventory system." + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Defines how the discount is applied to the customer's order." + }, + "quantity_limit": { + "type": "integer", + "description": "The maximum number of units allowed to be discounted per order line item." + }, + "aggregated_quantity_limit": { + "type": "integer", + "description": "The maximum number of units allowed to be discounted combined across all matched order line items." + } + } + }, + "6_res_sku_unit_fixed_amount": { + "title": "SKU for Amount Discount", + "type": "object", + "description": "Contains definition for a product variant.", + "properties": { + "object": { + "type": "string", + "default": "sku", + "description": "This object stores information about the product variant." + }, + "id": { + "type": "string", + "description": "Unique SKU ID assigned by Voucherify.", + "example": "sku_0b7d7dfb090be5c619" + }, + "source_id": { + "type": "string", + "description": "The source ID from your inventory system." + }, + "product_id": { + "type": "string", + "description": "Parent product's unique ID assigned by Voucherify." + }, + "product_source_id": { + "type": "string", + "description": "Parent product's source ID from your inventory system." + }, + "strict": { + "type": "boolean" + }, + "price": { + "type": "integer", + "description": "New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the `price_formula` parameter is present in the fixed price definition, this value becomes the **fallback value**. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price." + }, + "price_formula": { + "type": "string", + "description": "Formula used to calculate the discounted price of an item.", + "example": "IF(ORDER_AMOUNT > 200;ORDER_ITEM_PRICE * 0.2;6)" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Defines how the discount is applied to the customer's order." + } + } + }, + "6_res_sku_excluded": { + "title": "SKU", + "type": "object", + "description": "Contains definition for a product variant.", + "properties": { + "object": { + "type": "string", + "default": "sku", + "description": "This object stores information about the product variant." + }, + "id": { + "type": "string", + "description": "Unique SKU ID assigned by Voucherify.", + "example": "sku_0b7d7dfb090be5c619" + }, + "source_id": { + "type": "string", + "description": "The source ID from your inventory system." + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY" + ], + "description": "Defines how the discount is applied to the customer's order." + } + } + }, + "6_res_product": { + "title": "Product", + "type": "object", + "description": "Contains definition for a product.", + "properties": { + "object": { + "type": "string", + "default": "product", + "description": "This object stores information about the product." + }, + "id": { + "type": "string", + "description": "Unique product ID assigned by Voucherify.", + "example": "prod_0bae2dc5a090fd0184" + }, + "source_id": { + "type": "string", + "description": "The product ID from your inventory system." + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Defines how the discount is applied to the customer's order." + } + } + }, + "6_res_product_unit": { + "title": "Product for Unit Discount", + "type": "object", + "description": "Contains definition for a product.", + "properties": { + "object": { + "type": "string", + "default": "product", + "description": "This object stores information about the product." + }, + "id": { + "type": "string", + "description": "Unique product ID assigned by Voucherify.", + "example": "prod_0bae2dc5a090fd0184" + }, + "source_id": { + "type": "string", + "description": "The product ID from your inventory system." + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Defines how the discount is applied to the customer's order." + }, + "quantity_limit": { + "type": "integer", + "description": "The maximum number of units allowed to be discounted per order line item." + }, + "aggregated_quantity_limit": { + "type": "integer", + "description": "The maximum number of units allowed to be discounted combined across all matched order line items." + } + } + }, + "6_res_product_fixed_amount": { + "title": "Product for Fixed Amount Discount", + "type": "object", + "description": "Contains definition for a product.", + "properties": { + "object": { + "type": "string", + "default": "product", + "description": "This object stores information about the product." + }, + "id": { + "type": "string", + "description": "Unique product ID assigned by Voucherify.", + "example": "prod_0bae2dc5a090fd0184" + }, + "source_id": { + "type": "string", + "description": "The product ID from your inventory system." + }, + "strict": { + "type": "boolean" + }, + "price": { + "type": "integer", + "description": "New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the `price_formula` parameter is present in the fixed price definition, this value becomes the **fallback value**. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price." + }, + "price_formula": { + "type": "string", + "description": "Formula used to calculate the discounted price of an item.", + "example": "IF(ORDER_AMOUNT > 300;ORDER_ITEM_PRICE * 0.8;ORDER_ITEM_PRICE)" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Defines how the discount is applied to the customer's order." + } + } + }, + "6_res_product_excluded": { + "title": "Product", + "type": "object", + "description": "Contains definition for a product.", + "properties": { + "object": { + "type": "string", + "default": "product", + "description": "This product stores information about the product." + }, + "id": { + "type": "string", + "description": "Unique product ID assigned by Voucherify.", + "example": "prod_0bae2dc5a090fd0184" + }, + "source_id": { + "type": "string", + "description": "The product ID from your inventory system." + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY" + ], + "description": "Defines how the discount is applied to the customer's order." + } + } + }, + "6_obj_order_object": { + "title": "Order object", + "description": "This is an object representing an order with calculated discounts applied using the voucher code.", + "oneOf": [ + { + "$ref": "#/components/schemas/6_obj_order_object_apply_to_order" + }, + { + "$ref": "#/components/schemas/6_obj_order_object_apply_to_items" + } + ] + }, + "6_obj_order_object_apply_to_order": { + "type": "object", + "title": "Order object - Effect: Apply to order", + "description": "This is an object representing an order with calculated discounts applied using the voucher code.", + "properties": { + "id": { + "type": "string", + "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", + "description": "Unique order ID, assigned by Voucherify. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:40:48.705Z", + "description": "Timestamp representing the date and time when the order was created in ISO 8601 format. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:47:20.760Z", + "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." + }, + "status": { + "type": "string", + "description": "Order status. This parameter is returned if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body or if you send the request body parameter when defining an order in the request body. This parameter can be passed but it's not required for validation at all. It's used in the redemption process. Normally after the redemption is done, the order is automatically to a `PAID` status. To avoid such default behaviour, the user can pass any of the other status options and it will be set the order status after the redemption instead of the default `PAID`.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULFILLED" + ] + }, + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "discount_amount": { + "type": "integer", + "description": "Sum of all order-level discounts applied to the order." + }, + "total_discount_amount": { + "type": "integer", + "description": "Sum of all order-level discounts." + }, + "total_amount": { + "type": "integer", + "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" + }, + "applied_discount_amount": { + "type": "integer", + "description": "This field shows the order-level discount applied." + }, + "total_applied_discount_amount": { + "type": "integer", + "description": "This field sums up all order-level discounts applied to the order." + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", + "items": { "type": "object", - "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", "properties": { - "type": { + "object": { "type": "string", - "default": "UNIT", - "description": "Discount type." + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." }, - "effect": { + "product_id": { "type": "string", - "enum": [ - "ADD_MISSING_ITEMS", - "ADD_NEW_ITEMS" - ], - "description": "Defines how the unit is added to the customer's order." + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, - "unit_off": { + "sku_id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "quantity": { "type": "integer", - "description": "Number of units to be granted a full value discount." + "description": "Quantity of the item in the cart." }, - "unit_type": { - "type": "string", - "example": "prod_0a9f9ab4ab019a42d5", - "description": "The product deemed as free, chosen from product inventory (e.g. time, items)." + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" }, "product": { "type": "object", - "description": "Contains information about the product.", + "description": "This object stores more information about the related product.", "properties": { "id": { "type": "string", - "description": "Unique product ID, assigned by Voucherify." + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, "source_id": { "type": "string", - "description": "Product's source ID." + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" }, "name": { "type": "string", + "example": "Brewing System", "description": "Product name." + }, + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." } } - } - } - }, - "6_res_validate_voucher_discount_unit_sku": { - "title": "Unit Discount, SKU", - "type": "object", - "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", - "properties": { - "type": { - "type": "string", - "default": "UNIT", - "description": "Discount type." - }, - "effect": { - "type": "string", - "enum": [ - "ADD_MISSING_ITEMS", - "ADD_NEW_ITEMS" - ], - "description": "Defines how the unit is added to the customer's order." - }, - "unit_off": { - "type": "integer", - "description": "Number of units to be granted a full value discount." - }, - "unit_type": { - "type": "string", - "example": "sku_0bae3b28f610fd0da1", - "description": "The product variant deemed as free, chosen from product inventory (e.g. time, items)." }, "sku": { "type": "object", - "description": "Contains information about the SKU.", + "description": "This object stores more information about the related SKU.", "properties": { "id": { "type": "string", - "example": "sku_0bae3b28f610fd0da1", - "description": "Unique SKU ID, assigned by Voucherify." + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." }, "source_id": { "type": "string", - "description": "Product variant's source ID." + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." }, "sku": { "type": "string", - "description": "Product varient's name." - } - } - }, - "product": { - "type": "object", - "description": "Contains information about the parent product.", - "properties": { - "id": { - "type": "string", - "description": "Unique parent product ID, assigned by Voucherify.", - "example": "prod_0bae2dc5a090fd0184" - }, - "source_id": { - "type": "string", - "description": "Source ID of parent product." + "description": "SKU name." }, - "name": { - "type": "string", - "description": "Name of parent product." + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." } } } } - }, - "6_res_validate_voucher_discount_unit_multiple": { - "title": "Unit Discount, multiple items", - "type": "object", - "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", - "properties": { - "type": { - "type": "string", - "default": "UNIT", - "description": "Discount type." - }, - "effect": { - "type": "string", - "default": "ADD_MANY_ITEMS", - "description": "Defines how the discount is applied to the customer's order." - }, - "units": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_product_multiple" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_sku_multiple" - } - ] - } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "customer": { + "type": "object", + "description": "Object containing information about the customer that is making the purchase.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique customer ID of the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `customer` object." } - }, - "6_res_validate_voucher_discount_unit_product_multiple": { - "title": "Product Item", - "type": "object", - "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", - "properties": { - "effect": { - "type": "string", - "enum": [ - "ADD_MISSING_ITEMS", - "ADD_NEW_ITEMS" - ], - "description": "Defines how the unit is added to the customer's order." - }, - "unit_off": { - "type": "integer", - "description": "Number of units to be granted a full value discount." - }, - "unit_type": { - "type": "string", - "example": "prod_0a9f9ab4ab019a42d5", - "description": "The product deemed as free, chosen from product inventory (e.g. time, items)." - }, - "product": { - "type": "object", - "description": "Contains information about the product.", - "properties": { - "id": { - "type": "string", - "description": "Unique product ID, assigned by Voucherify.", - "example": "prod_0a9f9ab4ab019a42d5" - }, - "source_id": { - "type": "string", - "description": "Product's source ID." - }, - "name": { - "type": "string", - "description": "Product name." - } - } - } + } + }, + "referrer": { + "type": "object", + "description": "Object containing information about the referrer.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique referrer ID, who referred the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `referrer` object." } - }, - "6_res_validate_voucher_discount_unit_sku_multiple": { - "title": "SKU Item", + } + }, + "customer_id": { + "type": "string", + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" + }, + "referrer_id": { + "type": "string", + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + } + } + }, + "6_obj_order_object_apply_to_items": { + "type": "object", + "title": "Order object - Effect: Apply to items", + "description": "This is an object representing an order with calculated discounts applied using the voucher code.", + "properties": { + "id": { + "type": "string", + "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", + "description": "Unique order ID, assigned by Voucherify. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:40:48.705Z", + "description": "Timestamp representing the date and time when the order was created in ISO 8601 format. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:47:20.760Z", + "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." + }, + "status": { + "type": "string", + "description": "Order status. This parameter is returned if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body or if you send the request body parameter when defining an order in the request body. This parameter can be passed but it's not required for validation at all. It's used in the redemption process. Normally after the redemption is done, the order is automatically to a `PAID` status. To avoid such default behaviour, the user can pass any of the other status options and it will be set the order status after the redemption instead of the default `PAID`.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULFILLED" + ] + }, + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "items_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied. \n`sum(items, i => i.discount_amount)`" + }, + "total_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied." + }, + "total_amount": { + "type": "integer", + "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" + }, + "items_applied_discount_amount": { + "type": "integer", + "description": "Product-specifc discounts applied to all the items." + }, + "total_applied_discount_amount": { + "type": "integer", + "description": "Product-specific discounts applied in the order." + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", + "items": { "type": "object", - "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", "properties": { - "effect": { + "object": { "type": "string", - "enum": [ - "ADD_MISSING_ITEMS", - "ADD_NEW_ITEMS" - ], - "description": "Defines how the unit is added to the customer's order." + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." }, - "unit_off": { - "type": "integer", - "description": "Number of units to be granted a full value discount." + "product_id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, - "unit_type": { + "sku_id": { "type": "string", - "example": "sku_0bae3b28f610fd0da1", - "description": "The product variant deemed as free, chosen from product inventory (e.g. time, items)." + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." }, - "sku": { - "type": "object", - "description": "Contains information about the SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_0bae3b28f610fd0da1", - "description": "Unique SKU ID, assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "Product variant's source ID." - }, - "sku": { - "type": "string", - "description": "Product varient's name." - } - } + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." }, - "product": { - "type": "object", - "description": "Contains information about the parent product.", - "properties": { - "id": { - "type": "string", - "description": "Unique parent product ID, assigned by Voucherify.", - "example": "prod_0b7d7dfb05cbe5c616" - }, - "source_id": { - "type": "string", - "description": "Source ID of parent product." - }, - "name": { - "type": "string", - "description": "Name of parent product." - } - } - } - } - }, - "6_res_validate_voucher_discount_shipping": { - "title": "Shipping Discount", - "type": "object", - "description": "This is an object representing the discount that the customer would receive in the context of the provided request body parameters. If the discount is calculated based on a formula, this object will return either the discount calculated based on the formula or the fallback value.", - "properties": { - "type": { - "type": "string", - "default": "UNIT", - "description": "Discount type." + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." }, - "effect": { - "type": "string", - "description": "Defines how the unit is added to the customer's order.", - "default": "ADD_MISSING_ITEMS" + "discount_amount": { + "type": "integer", + "description": "The item-level discount applied to the item." }, - "unit_off": { + "applied_discount_amount": { "type": "integer", - "description": "Number of units to be granted a full value discount.", - "default": 1 + "description": "The item-level discount applied to the item." }, - "unit_type": { - "type": "string", - "description": "The shipping \"product\" deemed as free.", - "default": "prod_5h1pp1ng" + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" }, "product": { "type": "object", - "description": "Contains information about the shipping \"product\".", + "description": "This object stores more information about the related product.", "properties": { "id": { "type": "string", - "description": "Unique shipping \"product\" ID, assigned by Voucherify.", - "default": "prod_5h1pp1ng" + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, "source_id": { "type": "string", - "description": "\"Product's\" source ID.", - "default": "5h1pp1ng" + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" }, "name": { "type": "string", - "description": "\"Product\" name.", - "default": "Shipping" - } - } - } - } - }, - "6_res_validate_voucher": { - "title": "Valid", - "description": "Response schema model for validating a voucher using **POST** `/vouchers/{code}/validate`.", - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_code" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_gift_card" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_loyalty_card" - } - ] - }, - "6_res_validate_voucher_discount_code": { - "type": "object", - "title": "Valid - Discount Code", - "description": "Response schema model for validating a discount code using **POST** `/vouchers/{code}/validate`.", - "properties": { - "valid": { - "type": "boolean", - "description": "Indicates whether the voucher is valid within the context of the parameters provided in the request body." - }, - "applicable_to": { - "$ref": "#/components/schemas/6_res_applicable_to_object" - }, - "inapplicable_to": { - "$ref": "#/components/schemas/6_res_inapplicable_to_object" - }, - "tracking_id": { - "type": "string", - "description": "Hashed customer source ID." - }, - "order": { - "$ref": "#/components/schemas/6_obj_order_object" - }, - "code": { - "type": "string", - "description": "Voucher code." - }, - "discount": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_amount" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_percent" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_fixed" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_shipping" - } - ], - "description": "Contains information about the discount to be applied to the order." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - }, - "start_date": { - "type": "string", - "format": "date-time", - "example": "2022-10-04T00:00:00.000Z", - "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is _inactive_ before this date." - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-10-31T00:00:00.000Z", - "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is _inactive_ after this date." - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "example": "camp_W8DJVd8J0btqXT6FBwn7BSkC", - "description": "Voucher's parent campaign's unique ID." - }, - "session": { - "$ref": "#/components/schemas/6_res_session_lock_discount_voucher" - } - } - }, - "6_res_validate_voucher_gift_card": { - "type": "object", - "title": "Valid - Gift Card", - "description": "Response schema model for validating a gift card using **POST** `/vouchers/{code}/validate`.", - "properties": { - "valid": { - "type": "boolean", - "description": "Indicates whether the voucher is valid within the context of the parameters provided in the request body." - }, - "applicable_to": { - "$ref": "#/components/schemas/6_res_applicable_to_object" - }, - "inapplicable_to": { - "$ref": "#/components/schemas/6_res_inapplicable_to_object" - }, - "tracking_id": { - "type": "string", - "description": "Hashed customer source ID." - }, - "order": { - "$ref": "#/components/schemas/6_obj_order_object" - }, - "code": { - "type": "string", - "description": "Voucher code." - }, - "gift": { - "type": "object", - "description": "Contains current gift card balance information.", - "properties": { - "amount": { - "type": "integer", - "description": "Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "balance": { - "type": "integer", - "description": "Available funds. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + "example": "Brewing System", + "description": "Product name." }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS" - ], - "description": "Defines how the credits are applied to the customer's order." - } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - }, - "start_date": { - "type": "string", - "format": "date-time", - "example": "2022-10-04T00:00:00.000Z", - "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is _inactive_ before this date." - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-10-31T00:00:00.000Z", - "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is _inactive_ after this date." - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "example": "camp_W8DJVd8J0btqXT6FBwn7BSkC", - "description": "Voucher's parent campaign's unique ID." - }, - "session": { - "$ref": "#/components/schemas/6_res_session_lock_gift_card" - } - } - }, - "6_res_validate_voucher_loyalty_card": { - "type": "object", - "title": "Valid - Loyalty Card", - "description": "Response schema model for validating a loyalty card using **POST** `/vouchers/{code}/validate`.", - "properties": { - "valid": { - "type": "boolean", - "description": "Indicates whether the voucher is valid within the context of the parameters provided in the request body." - }, - "applicable_to": { - "$ref": "#/components/schemas/6_res_applicable_to_object" - }, - "inapplicable_to": { - "$ref": "#/components/schemas/6_res_inapplicable_to_object" - }, - "tracking_id": { - "type": "string", - "description": "Hashed customer source ID." - }, - "order": { - "$ref": "#/components/schemas/6_obj_order_object_apply_to_order" - }, - "code": { - "type": "string", - "description": "Voucher code." - }, - "loyalty": { - "type": "object", - "description": "Contains the cost of reward in points.", - "properties": { - "points_cost": { + "price": { "type": "integer", - "description": "Number of points that wlil be deducted from loyaty card for the associated reward." + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." } } }, - "reward": { + "sku": { "type": "object", - "description": "Contains information about the reward that is being validated.", + "description": "This object stores more information about the related SKU.", "properties": { "id": { "type": "string", - "description": "Unique reward ID assigned by Voucherify.", - "example": "rew_Crmu3hu2FKZWZIML59AeAs1n" + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." }, - "assignment_id": { + "source_id": { "type": "string", - "example": "rewa_xZr6Ks0j5AHeMRVdELmpI9sc", - "description": "Unique reward assignment ID assigned by Voucherify." + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." }, - "points": { + "sku": { + "type": "string", + "description": "SKU name." + }, + "price": { "type": "integer", - "description": "Number of points applied to the reward." + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." } } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - }, - "start_date": { - "type": "string", - "format": "date-time", - "example": "2022-10-04T00:00:00.000Z", - "description": "Activation timestamp defines when the voucher starts to be active in ISO 8601 format. Voucher is _inactive_ before this date." - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-10-31T00:00:00.000Z", - "description": "Expiration timestamp defines when the voucher expires in ISO 8601 format. Voucher is _inactive_ after this date." - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "example": "camp_W8DJVd8J0btqXT6FBwn7BSkC", - "description": "Voucher's parent campaign's unique ID." - }, - "session": { - "$ref": "#/components/schemas/6_res_session_lock_loyalty_card" - } - } - }, - "6_res_applicable_to_object": { - "title": "Included Items", - "type": "object", - "description": "Contains list of items that qualify in the scope of the discount. These are definitions of included products, SKUs, and product collections. These can be discounted.", - "properties": { - "data": { - "type": "array", - "description": "Contains array of items to which the discount can apply.", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_product_collection" - }, - { - "$ref": "#/components/schemas/6_res_product_collection_unit" - }, - { - "$ref": "#/components/schemas/6_res_product_collection_fixed_amount" - }, - { - "$ref": "#/components/schemas/6_res_product" - }, - { - "$ref": "#/components/schemas/6_res_product_unit" - }, - { - "$ref": "#/components/schemas/6_res_product_fixed_amount" - }, - { - "$ref": "#/components/schemas/6_res_sku" - }, - { - "$ref": "#/components/schemas/6_res_sku_unit" - }, - { - "$ref": "#/components/schemas/6_res_sku_unit_fixed_amount" - } - ] - } - }, - "total": { - "type": "integer", - "description": "Total number of objects defining included products, SKUs, or product collections." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of included objects." - }, - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about included products, SKUs, or product collections in a dictionary." } } - }, - "6_res_inapplicable_to_object": { - "title": "Excluded Items", - "type": "object", - "description": "Contains list of items that **do not** qualify in the scope of the discount. These are definitions of excluded products, SKUs, and product collections. These **CANNOT** be discounted.", - "properties": { - "data": { - "description": "Contains array of items to which the discount cannot apply.", - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_product_collection_excluded" - }, - { - "$ref": "#/components/schemas/6_res_product_excluded" - }, - { - "$ref": "#/components/schemas/6_res_sku_excluded" - } - ] - } - }, - "total": { - "type": "integer", - "description": "Total number of objects defining excluded products, SKUs, or product collections." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of excluded objects." - }, - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about excluded products, SKUs, or product collections in a dictionary." - } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "customer": { + "type": "object", + "description": "Object containing information about the customer that is making the purchase.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique customer ID of the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `customer` object." } - }, - "6_res_product_collection": { - "title": "Product Collection", - "type": "object", - "description": "Contains definition for a product collection.", - "properties": { - "object": { - "type": "string", - "default": "products_collection", - "description": "This object stores information about the product collection." - }, - "id": { - "type": "string", - "example": "pc_4ndRXAsTOzwSdHcQcxf489uU", - "description": "Unique product collection ID assigned by Voucherify." - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Defines how the discount is applied to the customer's order." - } + } + }, + "referrer": { + "type": "object", + "description": "Object containing information about the referrer.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique referrer ID, who referred the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `referrer` object." } - }, - "6_res_product_collection_unit": { - "title": "Product Collection for Unit Discount", - "type": "object", - "description": "Contains definition for a product collection.", - "properties": { - "object": { - "type": "string", - "default": "products_collection", - "description": "This object stores information about the product collection." - }, - "id": { - "type": "string", - "example": "pc_4ndRXAsTOzwSdHcQcxf489uU", - "description": "Unique product collection ID assigned by Voucherify." - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Defines how the discount is applied to the customer's order." - }, - "quantity_limit": { - "type": "integer", - "description": "The maximum number of units allowed to be discounted per order line item." - }, - "aggregated_quantity_limit": { - "type": "integer", - "description": "The maximum number of units allowed to be discounted combined across all matched order line items." - } + } + }, + "customer_id": { + "type": "string", + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" + }, + "referrer_id": { + "type": "string", + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + } + } + }, + "6_query_validate_voucher_client_side_orders_order_item": { + "type": "object", + "title": "Order Item", + "description": "This object represents an order line item.", + "properties": { + "source_id": { + "type": "string", + "description": "The merchant’s product/SKU ID (if it is different from the Voucherify product/SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service." + }, + "related_object": { + "type": "string", + "description": "Used along with the `source_id` property, can be set to either `sku` or `product`." + }, + "product_id": { + "type": "string", + "description": "A unique product ID assigned by Voucherify.", + "example": "prod_0a7e62db1fca8322a2" + }, + "sku_id": { + "type": "string", + "description": "A unique SKU ID assigned by Voucherify.", + "example": "sku_0a41e31c7b41c28358" + }, + "quantity": { + "type": "string", + "description": "The quantity of the particular item in the cart." + }, + "price": { + "type": "string", + "description": "The unit price of the item." + }, + "amount": { + "type": "string", + "description": "The total amount of the order item (`price` * `quantity`)." + } + } + }, + "6_req_validate_promotion": { + "title": "Validate Promotion Request Body", + "type": "object", + "description": "Request schema model for validating a promotion using **POST** `/promotions/validation`.", + "properties": { + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" } - }, - "6_res_product_collection_fixed_amount": { - "title": "Product Collection for Fixed Amount Discount", - "type": "object", - "description": "Contains definition for a product collection.", - "properties": { - "object": { - "type": "string", - "default": "products_collection", - "description": "This object stores information about the product collection." - }, - "id": { - "type": "string", - "example": "pc_4ndRXAsTOzwSdHcQcxf489uU", - "description": "Unique product collection ID assigned by Voucherify." - }, - "strict": { - "type": "boolean" - }, - "price": { - "type": "integer", - "description": "New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the `price_formula` parameter is present in the fixed price definition, this value becomes the **fallback value**. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price." - }, - "price_formula": { - "type": "string", - "description": "Formula used to calculate the discounted price of an item.", - "example": "\"IF(ORDER_AMOUNT > 300;ORDER_ITEM_PRICE * 0.8;ORDER_ITEM_PRICE)" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Defines how the discount is applied to the customer's order." - } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" } - }, - "6_res_product_collection_excluded": { - "title": "Product Collection", - "type": "object", - "description": "Contains definition for a product collection.", - "properties": { - "object": { - "type": "string", - "default": "products_collection", - "description": "This object stores information about the product collection." - }, - "id": { - "type": "string", - "example": "pc_4ndRXAsTOzwSdHcQcxf489uU", - "description": "Unique product collection ID assigned by Voucherify." - }, - "strict": { - "type": "boolean" - }, - "effect": { + ], + "description": "Order information." + }, + "metadata": { + "type": "object", + "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "options": { + "type": "object", + "description": "Configure parameters returned in the response.", + "properties": { + "expand": { + "type": "array", + "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. Add `category` as a string in the array to include a `categories` object in the response.", + "items": { "type": "string", "enum": [ - "APPLY_TO_EVERY" + "category" ], - "description": "Defines how the discount is applied to the customer's order." + "example": "category" } } - }, - "6_res_sku": { - "title": "SKU", - "type": "object", - "description": "Contains definition for a product variant.", - "properties": { - "object": { - "type": "string", - "default": "sku", - "description": "This object stores information about the product variant." - }, - "id": { - "type": "string", - "description": "Unique SKU ID assigned by Voucherify.", - "example": "sku_0b7d7dfb090be5c619" - }, - "source_id": { - "type": "string", - "description": "The source ID from your inventory system." - }, - "product_id": { - "type": "string", - "description": "Parent product's unique ID assigned by Voucherify." - }, - "product_source_id": { - "type": "string", - "description": "Parent product's source ID from your inventory system." - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Defines how the discount is applied to the customer's order." - } + } + } + } + }, + "6_res_validate_promotion": { + "title": "Validate Promotion Response Body", + "type": "object", + "description": "Response schema model for validating a promotion using **POST** `/promotions/validation`.", + "properties": { + "valid": { + "type": "boolean", + "description": "Indicates whether the promotion is valid within the context of the parameters provided in the request body and filters in the query parameters." + }, + "tracking_id": { + "type": "string", + "description": "Hashed customer source ID." + }, + "promotions": { + "type": "array", + "description": "Contains an array of promotion tier objects.", + "items": { + "$ref": "#/components/schemas/6_res_validate_promotion_object" + } + } + } + }, + "6_res_validate_promotion_object": { + "title": "Validate Promotion", + "type": "object", + "description": "Validate Promotion", + "properties": { + "valid": { + "type": "string", + "description": "Indicates whether the promotion is valid within the context of the parameters provided in the request body and filters in the query parameters." + }, + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" + }, + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" + }, + "tracking_id": { + "type": "string", + "description": "Hashed customer source ID." + }, + "order": { + "$ref": "#/components/schemas/6_obj_order_object" + }, + "id": { + "type": "string", + "example": "promo_4TqHr24boFISDrcOHSlfAxwm", + "description": "Unique promotion tier ID." + }, + "name": { + "type": "string", + "description": "Custom promotion tier name." + }, + "banner": { + "type": "string", + "description": "Text to be displayed to your customers on your website.", + "example": "Get 45% off items" + }, + "discount": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_amount" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_percent" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_fixed" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_shipping" } - }, - "6_res_sku_unit": { - "title": "SKU for Unit Discount", + ], + "description": "Contains information about the discount to be applied to the order." + }, + "start_date": { + "type": "string", + "format": "date-time", + "example": "2022-11-02T00:00:00.000Z", + "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Campaign is *inactive* before this date." + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-11-04T00:00:00.000Z", + "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive* after this date." + }, + "campaign": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "camp_h8RyP6FV94F3Ev2odP24j5p1", + "description": "Unique promotion tier ID." + }, + "start_date": { + "type": "string", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive* before this date.", + "example": "2022-11-01T00:00:00.000Z", + "format": "date-time" + }, + "expiration_date": { + "type": "string", + "description": "Activation timestamp defines when the campaign expires in ISO 8601 format. Promotion tier is *inactive* after this date.", + "example": "2022-11-30T00:00:00.000Z", + "format": "date-time" + }, + "active": { + "type": "boolean", + "description": "A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" + }, + "object": { + "type": "string", + "default": "campaign", + "description": "The type of object represented by the campaign object. This object stores information about the campaign." + } + } + }, + "hierarchy": { + "type": "integer", + "description": "The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy." + }, + "discount_amount": { + "type": "integer", + "description": "The calculated discount amount based on the discount type and effect." + }, + "applied_discount_amount": { + "type": "integer", + "description": "The effective discount amount that would be applied to the order." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." + }, + "object": { + "type": "string", + "default": "promotion_tier", + "description": "The type of object represented by JSON. This object stores information about the promotion tier." + }, + "category_id": { + "type": "string", + "description": "Promotion tier category ID.", + "example": "cat_0c9da30e7116ba6bba" + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object", + "description": "Details about the category assigned to the promotion tier." + } + } + }, + "6_req_validate_promotion_tier": { + "title": "Validate Promotion Tier Request Body", + "type": "object", + "description": "Request schema model for validating a promotion using **POST** `/promotions/tiers/{tierId}/validation`.", + "properties": { + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" + } + ], + "description": "Order information." + }, + "metadata": { + "type": "object", + "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + } + } + }, + "6_res_validate_promotion_tier": { + "title": "Validate Promotion Tier Response Body", + "description": "Response schema model for validating a promotion using **POST** `/promotions/tiers/{tierId}/validation`.", + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_promotion_tier_true" + }, + { + "$ref": "#/components/schemas/6_res_validate_promotion_tier_false" + } + ] + }, + "6_res_validate_promotion_tier_true": { + "title": "Promotion Tier Valid", + "type": "object", + "description": "Response schema model for valid promotion tier when validating a promotion using **POST** `/promotions/tiers/{tierId}/validation`.", + "properties": { + "valid": { + "type": "string", + "description": "Indicates whether the promotion is valid within the context of the parameters provided in the request body and filters in the query parameters." + }, + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" + }, + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" + }, + "tracking_id": { + "type": "string", + "description": "Hashed customer source ID." + }, + "order": { + "$ref": "#/components/schemas/6_obj_order_object" + }, + "id": { + "type": "string", + "example": "promo_4TqHr24boFISDrcOHSlfAxwm", + "description": "Unique promotion tier ID." + }, + "name": { + "type": "string", + "description": "Custom promotion tier name." + }, + "banner": { + "type": "string", + "description": "Text to be displayed to your customers on your website.", + "example": "Get 45% off items" + }, + "discount": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_amount" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_percent" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_fixed" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_shipping" + } + ], + "description": "Contains information about the discount to be applied to the order." + }, + "start_date": { + "type": "string", + "format": "date-time", + "example": "2022-11-02T00:00:00.000Z", + "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Campaign is *inactive* before this date." + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-11-04T00:00:00.000Z", + "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive* after this date." + }, + "campaign": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "camp_h8RyP6FV94F3Ev2odP24j5p1", + "description": "Unique promotion tier ID." + }, + "start_date": { + "type": "string", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive* before this date.", + "example": "2022-11-01T00:00:00.000Z", + "format": "date-time" + }, + "expiration_date": { + "type": "string", + "description": "Activation timestamp defines when the campaign expires in ISO 8601 format. Promotion tier is *inactive* after this date.", + "example": "2022-11-30T00:00:00.000Z", + "format": "date-time" + }, + "active": { + "type": "boolean", + "description": "A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" + }, + "object": { + "type": "string", + "default": "campaign", + "description": "The type of object represented by the campaign object. This object stores information about the campaign." + } + } + }, + "hierarchy": { + "type": "integer", + "description": "The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy." + }, + "discount_amount": { + "type": "integer", + "description": "The calculated discount amount based on the discount type and effect." + }, + "applied_discount_amount": { + "type": "integer", + "description": "The effective discount amount that would be applied to the order." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." + }, + "object": { + "type": "string", + "default": "promotion_tier", + "description": "The type of object represented by JSON. This object stores information about the promotion tier." + } + } + }, + "6_res_validate_promotion_tier_false": { + "type": "object", + "description": "Response schema model for a non-valid promotion tier when validating a promotion using **POST** `/promotions/tiers/{tierId}/validation`.", + "title": "Promotion Tier Not Valid", + "properties": { + "valid": { + "type": "boolean", + "description": "Response schema for a voucher that is not valid." + }, + "reason": { + "type": "string", + "description": "System generated cause for the voucher being invalid in the context of the provided parameters." + }, + "error": { + "description": "Detailed failure cause for the invalid voucher if the reason has a translation defined in the Dashboard → Project Settings → Error Messages.", + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_promotion_tier_false_custom_message" + }, + { + "$ref": "#/components/schemas/e_error_no_translation" + } + ] + }, + "tracking_id": { + "type": "string", + "description": "Hashed customer source ID." + }, + "id": { + "type": "string", + "example": "promo_ByIIAHC1Mz9ouJsitzAWsush", + "description": "Promotion tier ID." + }, + "name": { + "type": "string", + "description": "Custom promotion tier name." + }, + "banner": { + "type": "string", + "description": "Text to be displayed to your customers on your website.", + "example": "Get 25% off" + }, + "discount": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_amount" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_percent" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_fixed" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_discount_shipping" + } + ], + "description": "Contains information about the discount to be applied to the order." + }, + "start_date": { + "type": "string", + "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Campaign is *inactive* before this date.", + "format": "date-time", + "example": "2022-11-02T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive* after this date.", + "format": "date-time", + "example": "2022-11-04T00:00:00.000Z" + }, + "campaign": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique promotion tier ID." + }, + "start_date": { + "type": "string", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive* before this date.", + "format": "date-time", + "example": "2022-11-01T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign expires in ISO 8601 format. Promotion tier is *inactive* after this date.", + "example": "2022-11-30T00:00:00.000Z" + }, + "active": { + "type": "boolean", + "description": "A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" + }, + "object": { + "type": "string", + "description": "The type of object represented by the campaign object. This object stores information about the campaign.", + "default": "campaign" + } + } + }, + "hierarchy": { + "type": "integer", + "description": "The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." + }, + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about the promotion tier.", + "default": "promotion_tier" + } + } + }, + "6_res_validate_promotion_tier_false_custom_message": { + "type": "object", + "description": "Custom Error Message", + "title": "Custom Message", + "properties": { + "message": { + "type": "string", + "description": "Customized error message." + } + } + }, + "19_req_session_lock": { + "title": "Session Lock", + "type": "object", + "description": "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](doc:locking-validation-session).", + "properties": { + "type": { + "type": "string", + "description": "This parameter is **required** to establish a new session. The session locks the redemption **quantity** by 1 and the redemption **gift credits** and **loyalty points** specified within the request.", + "enum": [ + "LOCK" + ] + }, + "key": { + "type": "string", + "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", + "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" + }, + "ttl_unit": { + "type": "string", + "description": "Defines the type of unit in which the session time is counted.", + "enum": [ + "HOURS", + "DAYS", + "MINUTES", + "SECONDS", + "MILLISECONDS", + "MICROSECONDS", + "NANOSECONDS" + ] + }, + "ttl": { + "type": "integer", + "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." + } + } + }, + "19_res_session_lock": { + "title": "Session Lock", + "type": "object", + "description": "Schema model for `session` lock object. The session object contains information about the session key that was used to establish a session between multiple parallel validation and redemption requests.", + "properties": { + "type": { + "type": "string", + "description": "This session locks the redemption **quantity** by 1.", + "default": "LOCK" + }, + "key": { + "type": "string", + "description": "The session unique ID assigned by Voucherify or your own unique session ID.", + "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" + }, + "ttl_unit": { + "type": "string", + "description": "Defines the type of unit in which the session time is counted.", + "enum": [ + "HOURS", + "DAYS", + "MINUTES", + "SECONDS", + "MILLISECONDS", + "MICROSECONDS", + "NANOSECONDS" + ] + }, + "ttl": { + "type": "integer", + "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." + } + } + }, + "19_obj_order_object_rollback_stacked": { + "title": "Order object", + "description": "This is an object representing an order that was rolled back for a stacked redemption.", + "properties": { + "id": { + "type": "string", + "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", + "description": "Unique order ID, assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:40:48.705Z", + "description": "Timestamp representing the date and time when the order was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:47:20.760Z", + "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format." + }, + "status": { + "type": "string", + "description": "Order status.", + "enum": [ + "CANCELED" + ] + }, + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "total_amount": { + "type": "integer", + "description": "Order amount after undoing all the discounts through the rollback redemption." + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order.", + "items": { "type": "object", - "description": "Contains definition for a product variant.", "properties": { "object": { "type": "string", - "default": "sku", - "description": "This object stores information about the product variant." - }, - "id": { - "type": "string", - "description": "Unique SKU ID assigned by Voucherify.", - "example": "sku_0b7d7dfb090be5c619" - }, - "source_id": { - "type": "string", - "description": "The source ID from your inventory system." + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." }, "product_id": { "type": "string", - "description": "Parent product's unique ID assigned by Voucherify." + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, - "product_source_id": { + "sku_id": { "type": "string", - "description": "Parent product's source ID from your inventory system." + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." }, - "strict": { - "type": "boolean" + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Defines how the discount is applied to the customer's order." + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." }, - "quantity_limit": { + "price": { "type": "integer", - "description": "The maximum number of units allowed to be discounted per order line item." + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." }, - "aggregated_quantity_limit": { + "subtotal_amount": { "type": "integer", - "description": "The maximum number of units allowed to be discounted combined across all matched order line items." + "description": "Final order item amount after the removing an item-level discount." + }, + "product": { + "type": "object", + "description": "This object stores more information about the related product.", + "properties": { + "id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" + }, + "name": { + "type": "string", + "example": "Brewing System", + "description": "Product name." + }, + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + }, + "sku": { + "type": "object", + "description": "This object stores more information about the related SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." + }, + "sku": { + "type": "string", + "description": "SKU name." + }, + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } } } - }, - "6_res_sku_unit_fixed_amount": { - "title": "SKU for Amount Discount", + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "customer": { + "type": "object", + "description": "Object containing information about the customer that is making the purchase.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique customer ID of the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `customer` object." + } + } + }, + "referrer": { + "type": "object", + "description": "Object containing information about the referrer.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique referrer ID, who referred the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `referrer` object." + } + } + }, + "customer_id": { + "type": "string", + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" + }, + "referrer_id": { + "type": "string", + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + }, + "redemptions": { + "description": "Lists details related to the redemption and redemption rollback.", + "properties": { + "redemption_ID": { + "type": "object", + "description": "The property name is the unique redemption ID; i.e. `r_0ba186c4824e4881e1`. This object contains information about the redemption rollback of incentives.", + "properties": { + "date": { + "type": "string", + "description": "Timestamp representing the date and time when the redemption was created in ISO 8601 format.", + "example": "2022-09-02T17:06:56.649Z", + "format": "date-time" + }, + "rollback_id": { + "type": "string", + "description": "Unique ID of the redemption rollback.", + "example": "rr_0c63c84eb78ee0a6c0" + }, + "rollback_date": { + "type": "string", + "description": "Timestamp representing the date and tiem when the redemption rollback was created in ISO 8601 format.", + "example": "2023-01-31T14:18:37.150Z", + "format": "date-time" + }, + "related_object_type": { + "type": "string", + "description": "The source of the redemption is a `redemption` because this rollback is in the context of a stacked redemption.", + "enum": [ + "redemption" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique ID of the parent redemption.", + "example": "r_0ba186c4824e4881e1" + }, + "stacked": { + "type": "array", + "description": "Lists the stacked redemption IDs in the initial redemption request.", + "items": { + "type": "string" + } + }, + "rollback_stacked": { + "type": "array", + "description": "Lists the rollback redemption IDs of the particular child redemptions.", + "items": { + "type": "string" + } + } + } + } + } + } + } + }, + "19_obj_order_object_rollback_stacked_per_redemption_apply_to_order": { + "title": "Order object", + "description": "This is an object representing an order that was rolled back for a stacked redemption.", + "properties": { + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "total_amount": { + "type": "integer", + "description": "Order amount after undoing all the discounts through the rollback redemption." + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order.", + "items": { "type": "object", - "description": "Contains definition for a product variant.", "properties": { "object": { "type": "string", - "default": "sku", - "description": "This object stores information about the product variant." - }, - "id": { - "type": "string", - "description": "Unique SKU ID assigned by Voucherify.", - "example": "sku_0b7d7dfb090be5c619" - }, - "source_id": { - "type": "string", - "description": "The source ID from your inventory system." + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." }, "product_id": { "type": "string", - "description": "Parent product's unique ID assigned by Voucherify." + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, - "product_source_id": { + "sku_id": { "type": "string", - "description": "Parent product's source ID from your inventory system." - }, - "strict": { - "type": "boolean" + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." }, - "price": { + "quantity": { "type": "integer", - "description": "New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the `price_formula` parameter is present in the fixed price definition, this value becomes the **fallback value**. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price." + "description": "Quantity of the item in the cart." }, - "price_formula": { - "type": "string", - "description": "Formula used to calculate the discounted price of an item.", - "example": "IF(ORDER_AMOUNT > 200;ORDER_ITEM_PRICE * 0.2;6)" + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Defines how the discount is applied to the customer's order." - } - } - }, - "6_res_sku_excluded": { - "title": "SKU", - "type": "object", - "description": "Contains definition for a product variant.", - "properties": { - "object": { - "type": "string", - "default": "sku", - "description": "This object stores information about the product variant." - }, - "id": { - "type": "string", - "description": "Unique SKU ID assigned by Voucherify.", - "example": "sku_0b7d7dfb090be5c619" - }, - "source_id": { - "type": "string", - "description": "The source ID from your inventory system." - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY" - ], - "description": "Defines how the discount is applied to the customer's order." - } - } - }, - "6_res_product": { - "title": "Product", - "type": "object", - "description": "Contains definition for a product.", - "properties": { - "object": { - "type": "string", - "default": "product", - "description": "This object stores information about the product." - }, - "id": { - "type": "string", - "description": "Unique product ID assigned by Voucherify.", - "example": "prod_0bae2dc5a090fd0184" - }, - "source_id": { - "type": "string", - "description": "The product ID from your inventory system." - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Defines how the discount is applied to the customer's order." + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." } } - }, - "6_res_product_unit": { - "title": "Product for Unit Discount", + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + } + } + }, + "19_obj_order_object_rollback_stacked_per_redemption_apply_to_items": { + "title": "Order object", + "description": "This is an object representing an order that was rolled back for a stacked redemption.", + "properties": { + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "items_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied to the order.`" + }, + "total_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied to the order." + }, + "total_amount": { + "type": "integer", + "description": "Order amount after undoing all the discounts through the rollback redemption." + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order.", + "items": { "type": "object", - "description": "Contains definition for a product.", "properties": { "object": { "type": "string", - "default": "product", - "description": "This object stores information about the product." - }, - "id": { - "type": "string", - "description": "Unique product ID assigned by Voucherify.", - "example": "prod_0bae2dc5a090fd0184" + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." }, - "source_id": { + "product_id": { "type": "string", - "description": "The product ID from your inventory system." - }, - "strict": { - "type": "boolean" + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, - "effect": { + "sku_id": { "type": "string", - "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Defines how the discount is applied to the customer's order." + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." }, - "quantity_limit": { + "quantity": { "type": "integer", - "description": "The maximum number of units allowed to be discounted per order line item." + "description": "Quantity of the item in the cart." }, - "aggregated_quantity_limit": { + "amount": { "type": "integer", - "description": "The maximum number of units allowed to be discounted combined across all matched order line items." - } - } - }, - "6_res_product_fixed_amount": { - "title": "Product for Fixed Amount Discount", - "type": "object", - "description": "Contains definition for a product.", - "properties": { - "object": { - "type": "string", - "default": "product", - "description": "This object stores information about the product." - }, - "id": { - "type": "string", - "description": "Unique product ID assigned by Voucherify.", - "example": "prod_0bae2dc5a090fd0184" - }, - "source_id": { - "type": "string", - "description": "The product ID from your inventory system." - }, - "strict": { - "type": "boolean" + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." }, "price": { "type": "integer", - "description": "New fixed price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 price is written as 1000. In case of the fixed price being calculated by the formula, i.e. the `price_formula` parameter is present in the fixed price definition, this value becomes the **fallback value**. Such that in a case where the formula cannot be calculated due to missing metadata, for example, this value will be used as the fixed price." - }, - "price_formula": { - "type": "string", - "description": "Formula used to calculate the discounted price of an item.", - "example": "IF(ORDER_AMOUNT > 300;ORDER_ITEM_PRICE * 0.8;ORDER_ITEM_PRICE)" + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." }, - "effect": { + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the removing an item-level discount." + } + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + } + } + }, + "19_req_redeemables_gift_card": { + "title": "Gift Card", + "type": "object", + "description": "Redeem a gift card.", + "properties": { + "id": { + "type": "string", + "description": "Unique gift card code." + }, + "object": { + "type": "string", + "description": "Type of object, i.e. `voucher`.", + "default": "voucher" + }, + "gift": { + "type": "object", + "description": "Contains information on the number of gift card credits that the customer wants to apply to the order.", + "properties": { + "credits": { + "type": "integer", + "description": "The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + } + }, + "required": [ + "object", + "id" + ] + }, + "19_req_redeemables_loyalty_card": { + "title": "Loyalty Card", + "type": "object", + "description": "Redeem a loyalty card.", + "properties": { + "id": { + "type": "string", + "description": "Unique loyalty card code." + }, + "object": { + "type": "string", + "description": "Type of object, i.e. `voucher`.", + "default": "voucher" + }, + "reward": { + "type": "object", + "description": "Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward.", + "example": "rew_EPx1hCTpqzF0HW1z9NKckZH4" + }, + "points": { + "type": "integer", + "description": "The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card." + } + } + } + }, + "required": [ + "object", + "id", + "reward" + ] + }, + "19_req_redeemables_discount_referral_promotion_tier_promotion_stack": { + "title": "Discount code, referral code, promotion tier, promotion stack", + "type": "object", + "description": "Redeem a discount code, referral code, promotion tier, or promotion stack.", + "properties": { + "object": { + "type": "string", + "description": "Redeemable object type.", + "enum": [ + "voucher", + "promotion_tier", + "promotion_stack" + ], + "default": "voucher" + }, + "id": { + "type": "string", + "description": "Redeemable code or unique ID such as: \n- discount code, referral code: `DiscountCode100`, `v_6ZPI2BLMtpc6zz8pQVjQgxJH3D4ac3ZT` \n- promotion tier: `promo_Mwy9XpA0TLctSGriM5kum0qp` \n- promotion stack: `stack_KxSD0GahLUg9ULB6TseGfUHJ` " + } + }, + "required": [ + "object", + "id" + ] + }, + "19_req_redemptions": { + "title": "Redeem Stackable Discounts Request Body", + "type": "object", + "description": "This data model represents the request body for redeeming multiple incentives.", + "properties": { + "options": { + "type": "object", + "description": "Configure parameters returned in the response.", + "properties": { + "expand": { + "type": "array", + "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. \n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
                  - Order data with calculated discounts are listed in each child redemption object.
                  - Metadata not included for each discount type. |\n| [\"order\", \"redemption\"] | - Returns redemption object `metadata`.
                  - Order data with calculated discounts are listed in each child redemption object. |\n| [\"redeemable\", \"redemption\"] | - Returns each discount type's `metadata` in each child redemption object.
                  - Returns redemption object `metadata`. |\n| [\"redemption\"] | - Returns redemption object `metadata`. |\n| [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object
                  - Returns redemption object `metadata`.
                  - Returns an expanded `categories` object, showing details about the category. |", + "items": { "type": "string", "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Defines how the discount is applied to the customer's order." + "order", + "redemption", + "redeemable", + "category" + ] } } - }, - "6_res_product_excluded": { - "title": "Product", - "type": "object", - "description": "Contains definition for a product.", - "properties": { - "object": { - "type": "string", - "default": "product", - "description": "This product stores information about the product." - }, - "id": { - "type": "string", - "description": "Unique product ID assigned by Voucherify.", - "example": "prod_0bae2dc5a090fd0184" - }, - "source_id": { - "type": "string", - "description": "The product ID from your inventory system." + } + }, + "redeemables": { + "type": "array", + "minItems": 1, + "maxItems": 5, + "description": "An array of redeemables. You can combine `voucher`(s) and `promotion_tier`(s). Alternatively, send one unique`promotion_stack` in the array.", + "items": { + "anyOf": [ + { + "$ref": "#/components/schemas/19_req_redeemables_discount_referral_promotion_tier_promotion_stack" }, - "strict": { - "type": "boolean" + { + "$ref": "#/components/schemas/19_req_redeemables_gift_card" }, - "effect": { + { + "$ref": "#/components/schemas/19_req_redeemables_loyalty_card" + } + ] + } + }, + "session": { + "$ref": "#/components/schemas/19_req_session_lock" + }, + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" + } + ], + "description": "Order information. This object enables you to pass purchase transaction data. Read what properties you can use in the [Order object](ref:get-order)." + }, + "metadata": { + "type": "object", + "description": "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." + } + }, + "required": [ + "redeemables" + ] + }, + "19_req_validations": { + "title": "Validate Stackable Discounts Request Body", + "type": "object", + "description": "This data model represents the request body for the `/validations` endpoint.", + "properties": { + "options": { + "type": "object", + "description": "Configure parameters returned in the response.", + "properties": { + "expand": { + "type": "array", + "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. \n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
                  - Order data with calculated discounts are listed in each child redeemable object.
                  - Metadata not included for each discount type. |\n| [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. |\n| [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
                  - Includes `metadata` for each discount type. |\n| [\"category\"] | - Returns an expanded `categories` object, showing details about the category. |", + "items": { "type": "string", "enum": [ - "APPLY_TO_EVERY" - ], - "description": "Defines how the discount is applied to the customer's order." + "order", + "redemption", + "redeemable", + "category" + ] } } - }, - "6_obj_order_object": { - "title": "Order object", - "description": "This is an object representing an order with calculated discounts applied using the voucher code.", - "oneOf": [ + } + }, + "redeemables": { + "type": "array", + "minItems": 1, + "maxItems": 5, + "description": "An array of redeemables. You can combine `voucher`(s) and `promotion_tier`(s). Alternatively, send one unique`promotion_stack` in the array.", + "items": { + "anyOf": [ + { + "$ref": "#/components/schemas/19_req_redeemables_discount_referral_promotion_tier_promotion_stack" + }, { - "$ref": "#/components/schemas/6_obj_order_object_apply_to_order" + "$ref": "#/components/schemas/19_req_redeemables_gift_card" }, { - "$ref": "#/components/schemas/6_obj_order_object_apply_to_items" + "$ref": "#/components/schemas/19_req_redeemables_loyalty_card" } ] - }, - "6_obj_order_object_apply_to_order": { + } + }, + "session": { + "$ref": "#/components/schemas/19_req_session_lock" + }, + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" + } + ], + "description": "Order information. This object enables you to pass purchase transaction data. Read what properties you can use in the [Order object](ref:get-order)." + }, + "metadata": { + "type": "object", + "description": "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." + } + }, + "required": [ + "redeemables" + ] + }, + "19_res_validations": { + "title": "Validate Stackable Discounts Response Body", + "description": "Response body schema for POST `/validations`.", + "oneOf": [ + { + "$ref": "#/components/schemas/19_res_validations-true" + }, + { + "$ref": "#/components/schemas/19_res_validations-false" + } + ] + }, + "19_res_validations-false": { + "type": "object", + "title": "False", + "description": "Response body schema for POST `/validations`.", + "properties": { + "valid": { + "type": "boolean", + "description": "The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable.", + "default": false + }, + "redeemables": { + "type": "array", + "description": "Lists validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"`.", + "items": { "type": "object", - "title": "Order object - Effect: Apply to order", - "description": "This is an object representing an order with calculated discounts applied using the voucher code.", "properties": { - "id": { - "type": "string", - "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", - "description": "Unique order ID, assigned by Voucherify. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." - }, - "created_at": { + "status": { "type": "string", - "format": "date-time", - "example": "2022-10-06T11:40:48.705Z", - "description": "Timestamp representing the date and time when the order was created in ISO 8601 format. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." + "enum": [ + "APPLICABLE", + "INAPPLICABLE", + "SKIPPED" + ], + "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules. `SKIPPED` indicates that the validation stopped once it identified at least one unapplicable redeemable and did not continue to validate the given redeemable." }, - "updated_at": { + "id": { "type": "string", - "format": "date-time", - "example": "2022-10-06T11:47:20.760Z", - "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." + "description": "Redeemable ID, i.e. the voucher code." }, - "status": { + "object": { "type": "string", - "description": "Order status. This parameter is returned if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body or if you send the request body parameter when defining an order in the request body. This parameter can be passed but it's not required for validation at all. It's used in the redemption process. Normally after the redemption is done, the order is automatically to a `PAID` status. To avoid such default behaviour, the user can pass any of the other status options and it will be set the order status after the redemption instead of the default `PAID`.", + "description": "Redeemable's object type.", "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULFILLED" + "voucher", + "promotion_tier", + "promotion_stack" ] }, - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "discount_amount": { - "type": "integer", - "description": "Sum of all order-level discounts applied to the order." - }, - "total_discount_amount": { - "type": "integer", - "description": "Sum of all order-level discounts." - }, - "total_amount": { - "type": "integer", - "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" - }, - "applied_discount_amount": { - "type": "integer", - "description": "This field shows the order-level discount applied." - }, - "total_applied_discount_amount": { - "type": "integer", - "description": "This field sums up all order-level discounts applied to the order." - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", - "items": { - "type": "object", - "properties": { - "object": { - "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." - }, - "product_id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "sku_id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" - }, - "product": { - "type": "object", - "description": "This object stores more information about the related product.", - "properties": { - "id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" - }, - "name": { - "type": "string", - "example": "Brewing System", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - }, - "sku": { - "type": "object", - "description": "This object stores more information about the related SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." - }, - "sku": { - "type": "string", - "description": "SKU name." - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - } - } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "customer": { + "result": { "type": "object", - "description": "Object containing information about the customer that is making the purchase.", + "description": "Provides details for an inapplicable redeemable.", "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique customer ID of the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `customer` object." + "error": { + "$ref": "#/components/schemas/e_error" } } }, - "referrer": { + "metadata": { "type": "object", - "description": "Object containing information about the referrer.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique referrer ID, who referred the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `referrer` object." - } - } - }, - "customer_id": { - "type": "string", - "description": "Unique customer ID of the customer making the purchase.", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" - }, - "referrer_id": { - "type": "string", - "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "description": "Unique referrer ID." + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" } } - }, - "6_obj_order_object_apply_to_items": { - "type": "object", - "title": "Order object - Effect: Apply to items", - "description": "This is an object representing an order with calculated discounts applied using the voucher code.", - "properties": { - "id": { - "type": "string", - "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", - "description": "Unique order ID, assigned by Voucherify. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:40:48.705Z", - "description": "Timestamp representing the date and time when the order was created in ISO 8601 format. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:47:20.760Z", - "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format. This parameter is returned only if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body." - }, - "status": { - "type": "string", - "description": "Order status. This parameter is returned if you use the order ID parameter of an already created and synced order in the Voucherify application, i.e by sending the `order.id` parameter in the request body or if you send the request body parameter when defining an order in the request body. This parameter can be passed but it's not required for validation at all. It's used in the redemption process. Normally after the redemption is done, the order is automatically to a `PAID` status. To avoid such default behaviour, the user can pass any of the other status options and it will be set the order status after the redemption instead of the default `PAID`.", - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULFILLED" - ] - }, - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "items_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied. \n`sum(items, i => i.discount_amount)`" - }, - "total_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied." - }, - "total_amount": { - "type": "integer", - "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" - }, - "items_applied_discount_amount": { - "type": "integer", - "description": "Product-specifc discounts applied to all the items." - }, - "total_applied_discount_amount": { - "type": "integer", - "description": "Product-specific discounts applied in the order." - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", - "items": { - "type": "object", - "properties": { - "object": { - "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." - }, - "product_id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "sku_id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." - }, - "discount_amount": { - "type": "integer", - "description": "The item-level discount applied to the item." - }, - "applied_discount_amount": { - "type": "integer", - "description": "The item-level discount applied to the item." - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" - }, - "product": { - "type": "object", - "description": "This object stores more information about the related product.", - "properties": { - "id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" - }, - "name": { - "type": "string", - "example": "Brewing System", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - }, - "sku": { - "type": "object", - "description": "This object stores more information about the related SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." - }, - "sku": { - "type": "string", - "description": "SKU name." - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - } - } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "customer": { - "type": "object", - "description": "Object containing information about the customer that is making the purchase.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique customer ID of the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `customer` object." - } - } + } + }, + "tracking_id": { + "type": "string", + "example": "track_VAVo1/z+G2GI2LPw==", + "description": "Hashed customer source ID." + } + } + }, + "19_res_validations_redeemables_discount_voucher": { + "type": "object", + "description": "Response schema model for validating a discount code.", + "title": "Discount Voucher", + "properties": { + "status": { + "type": "string", + "enum": [ + "APPLICABLE" + ], + "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." + }, + "id": { + "type": "string", + "description": "Redeemable ID, i.e. the voucher code." + }, + "object": { + "type": "string", + "description": "Redeemable's object type.", + "enum": [ + "voucher" + ] + }, + "order": { + "$ref": "#/components/schemas/19_obj_order_object_validation_res_per_redeemable" + }, + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" + }, + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" + }, + "result": { + "description": "Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable.", + "$ref": "#/components/schemas/19_obj_validations-true_result_voucher_code" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" + } + } + }, + "19_res_validations_redeemables_gift_card": { + "type": "object", + "description": "Response schema model for validating a gift card.", + "title": "Gift Card", + "properties": { + "status": { + "type": "string", + "enum": [ + "APPLICABLE" + ], + "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." + }, + "id": { + "type": "string", + "description": "Redeemable ID, i.e. the gift card code." + }, + "object": { + "type": "string", + "description": "Redeemable's object type.", + "enum": [ + "voucher" + ] + }, + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" + }, + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" + }, + "result": { + "description": "Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable.", + "$ref": "#/components/schemas/19_obj_validations-true_result_gift_card" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" + } + } + }, + "19_res_validations_redeemables_loyalty_card": { + "type": "object", + "description": "Response schema model for validating a loyalty card.", + "title": "Loyalty Card", + "properties": { + "status": { + "type": "string", + "enum": [ + "APPLICABLE" + ], + "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." + }, + "id": { + "type": "string", + "description": "Redeemable ID, i.e. the loyalty card code." + }, + "object": { + "type": "string", + "description": "Redeemable's object type.", + "enum": [ + "voucher" + ] + }, + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" + }, + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" + }, + "result": { + "description": "Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable.", + "$ref": "#/components/schemas/19_obj_validations-true_result_loyalty_card" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" + } + } + }, + "19_res_validations_redeemables_promotion_tier": { + "type": "object", + "description": "Response schema model for validating a promotion tier.", + "title": "Promotion Tier", + "properties": { + "status": { + "type": "string", + "enum": [ + "APPLICABLE" + ], + "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." + }, + "id": { + "type": "string", + "description": "Redeemable ID, i.e. the promotion tier ID." + }, + "object": { + "type": "string", + "description": "Redeemable's object type.", + "enum": [ + "promotion_tier" + ] + }, + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" + }, + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" + }, + "result": { + "description": "Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable.", + "$ref": "#/components/schemas/19_obj_validations-true_result_promotion_tier" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" + } + } + }, + "19_res_validations_redeemables_promotion_stack": { + "type": "object", + "description": "Response schema model for validating a promotion stack.", + "title": "Promotion Stack", + "properties": { + "status": { + "type": "string", + "enum": [ + "APPLICABLE" + ], + "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." + }, + "id": { + "type": "string", + "description": "Redeemable ID, i.e. the promotion stack ID." + }, + "object": { + "type": "string", + "description": "Redeemable's object type.", + "enum": [ + "promotion_stack" + ] + }, + "applicable_to": { + "$ref": "#/components/schemas/6_res_applicable_to_object" + }, + "inapplicable_to": { + "$ref": "#/components/schemas/6_res_inapplicable_to_object" + }, + "result": { + "description": "Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable.", + "$ref": "#/components/schemas/19_obj_validations-true_result_promotion_stack" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" + } + } + }, + "19_res_validations-true": { + "type": "object", + "title": "True", + "description": "Response body schema for POST `/validations`.", + "properties": { + "valid": { + "type": "boolean", + "description": "The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable.", + "default": true + }, + "redeemables": { + "type": "array", + "description": "Lists validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"`.", + "items": { + "anyOf": [ + { + "$ref": "#/components/schemas/19_res_validations_redeemables_discount_voucher" }, - "referrer": { - "type": "object", - "description": "Object containing information about the referrer.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique referrer ID, who referred the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `referrer` object." - } - } + { + "$ref": "#/components/schemas/19_res_validations_redeemables_gift_card" }, - "customer_id": { - "type": "string", - "description": "Unique customer ID of the customer making the purchase.", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" + { + "$ref": "#/components/schemas/19_res_validations_redeemables_loyalty_card" }, - "referrer_id": { - "type": "string", - "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "description": "Unique referrer ID." + { + "$ref": "#/components/schemas/19_res_validations_redeemables_promotion_tier" }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." + { + "$ref": "#/components/schemas/19_res_validations_redeemables_promotion_stack" } + ] + } + }, + "order": { + "$ref": "#/components/schemas/19_obj_order_object_validation_res" + }, + "tracking_id": { + "type": "string", + "example": "track_VAVo1/z+G2GI2LPw==", + "description": "Hashed customer source ID." + }, + "session": { + "$ref": "#/components/schemas/19_res_session_lock" + } + } + }, + "19_obj_validations-true_result_voucher_code": { + "type": "object", + "title": "Coupon Code", + "description": "This is a `result` object representing the results for a coupon code.", + "properties": { + "discount": { + "description": "Discount details about the type of discount to be applied for the redeemable.", + "oneOf": [ + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_amount" + }, + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_amount_dynamic" + }, + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_percentage" + }, + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_percentage_dynamic" + }, + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_fixed_order" + }, + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_fixed_items" + }, + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_unit_one" + }, + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/19_obj_voucher_object_discount_shipping" } - }, - "6_query_validate_voucher_client_side_orders_order_item": { + ] + } + } + }, + "19_obj_voucher_object_discount_amount": { + "title": "Static Amount", + "type": "object", + "description": "Amount discount type based on a static value.", + "properties": { + "type": { + "type": "string", + "default": "AMOUNT", + "description": "Applies an amount discount." + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS", + "APPLY_TO_ITEMS_PROPORTIONALLY", + "APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY", + "APPLY_TO_ITEMS_BY_QUANTITY" + ], + "description": "Defines how the discount is applied to the customer's order." + }, + "amount_off": { + "type": "integer", + "example": 100, + "description": "Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000." + }, + "is_dynamic": { + "type": "boolean", + "description": "Flag indicating whether the discount amount is based on a formula that dynamically calculates the discount.", + "enum": [ + false + ] + } + } + }, + "19_obj_voucher_object_discount_amount_dynamic": { + "title": "Dynamic Amount", + "type": "object", + "description": "Amount discount type based on a formula.", + "properties": { + "type": { + "type": "string", + "default": "AMOUNT", + "description": "Applies an amount discount." + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS", + "APPLY_TO_ITEMS_PROPORTIONALLY", + "APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY", + "APPLY_TO_ITEMS_BY_QUANTITY" + ], + "description": "Defines how the discount is applied to the customer's order." + }, + "is_dynamic": { + "type": "boolean", + "description": "Flag indicating whether the discount amount is based on a formula that dynamically calculates the discount.", + "enum": [ + true + ] + } + } + }, + "19_obj_voucher_object_discount_percentage": { + "title": "Percentage", + "type": "object", + "description": "Percentage discount type applied to an order (static or dynamic) or a percentage discount type applied to items (static).", + "properties": { + "type": { + "type": "string", + "default": "PERCENT", + "description": "Applies a percentage discount." + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS" + ], + "description": "Defines how the discount is applied to the customer's order." + }, + "percent_off": { + "type": "integer", + "description": "Percent taken off the subtotal amount. In case of the percent being calculated by the formula and applied to the order level, i.e. the `is_dynamic` parameter is `true`, this value becomes a dynamically calculated value that varies based on the formula.", + "minimum": 0, + "maximum": 100 + }, + "amount_limit": { + "type": "string", + "description": "Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600." + }, + "is_dynamic": { + "type": "boolean", + "description": "Flag indicating whether the discount percentage is based on a formula that dynamically calculates the discount.", + "enum": [ + false, + true + ] + } + } + }, + "19_obj_voucher_object_discount_percentage_dynamic": { + "title": "Dynamic Percentage for Items", + "type": "object", + "description": "Percentage discount type applied to items and based on a formula (dynamic).", + "properties": { + "type": { + "type": "string", + "default": "PERCENT", + "description": "Applies a percentage discount." + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS" + ], + "description": "Defines how the discount is applied to the customer's order." + }, + "amount_limit": { + "type": "string", + "description": "Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600." + }, + "is_dynamic": { + "type": "boolean", + "description": "Flag indicating whether the discount percentage is based on a formula that dynamically calculates the discount.", + "enum": [ + true + ] + } + } + }, + "19_obj_voucher_object_discount_fixed_order": { + "title": "Fixed Order Amount", + "description": "Fixed discount type for an order.", + "type": "object", + "properties": { + "type": { + "type": "string", + "default": "FIXED", + "description": "Sets a fixed total on the cart and then calculates the discount to apply." + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_ORDER" + ], + "description": "\n| **Effect** | **Definition** |\n|:---|:---|\n| **APPLY_TO_ORDER** | Sets the order total amount to the value of the fixed amount. The discount value is calculated dynamically during the redemption as it's a difference between the total amount of the customer's order and the fixed amount. For example, if the fixed amount is set to equal $10 and the order amount equals $25, then the calculated discount will be $15. |" + }, + "fixed_amount": { + "type": "integer", + "description": "Set a fixed valued for an order total. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000.", + "example": 1000 + }, + "is_dynamic": { + "type": "boolean", + "description": "Flag indicating whether the fixed amount is based on a formula that dynamically calculates the fixed amount.", + "enum": [ + false, + true + ] + } + } + }, + "19_obj_voucher_object_discount_fixed_items": { + "title": "New Prices for Items", + "description": "Fixed discount type for item(s).", + "type": "object", + "properties": { + "type": { + "type": "string", + "default": "FIXED", + "description": "Sets a new item price and then calculates the discount to apply." + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_ITEMS" + ], + "description": "\n| **Effect** | **Definition** |\n|:---|:---|\n| **APPLY_TO_ITEMS** | Sets a new price on items. The total discount amount is dynamically calculated during the redemption and it's a difference between the initial item price and the fixed amount. During the redemption, prices for items will change only if the new price is lower than the original price. If the new product price you set is different from the product price in a collection, then the new product price will be passed during the redemption. If a prodct is in more than one collection, the price is always changed to the lowest price. The new price for products with several SKUs will force the price change for SKUs if their original price is higher than the new price. |" + }, + "is_dynamic": { + "type": "boolean", + "description": "Flag defaults to false because each item price could be defined separately and either based on a formula that dynamically calculates the discount or based on a fixed set price.", + "enum": [ + false + ] + } + } + }, + "19_obj_voucher_object_discount_unit_one": { + "title": "Unit, single item", + "type": "object", + "description": "Single item type.", + "properties": { + "type": { + "type": "string", + "default": "UNIT", + "description": "Applies a full value discount to item(s)." + }, + "effect": { + "type": "string", + "enum": [ + "ADD_NEW_ITEMS", + "ADD_MISSING_ITEMS" + ], + "default": "ADD_MISSING_ITEMS", + "description": "Defines how the unit is added to the customer's order." + }, + "unit_off": { + "type": "number", + "description": "Number of units to be granted a full value discount. ", + "example": 1, + "format": "float" + }, + "unit_type": { + "type": "string", + "description": "The product or SKU deemed as free, chosen from the product inventory (e.g. time, items), i.e. `sku_0a3efc90375d1217e2` or `prod_s3C0nDpr0DuC7`.", + "example": "prod_f1r5Tpr0DuC7" + }, + "sku": { + "type": "object", + "description": "Defines the product details of the product or the parent product in case of an SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_0a3efc90375d1217e2", + "description": "Unique SKU ID assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "SKU source ID." + }, + "sku": { + "type": "string", + "description": "SKU name." + } + } + }, + "product": { + "type": "object", + "description": "Defines the product details of the product or the parent product in case of an SKU.", + "properties": { + "id": { + "type": "string", + "example": "prod_0bc3bd76a61082e6b3", + "description": "Unique (parent) product ID assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "Product source ID." + }, + "name": { + "type": "string", + "description": "Product name." + } + } + }, + "is_dynamic": { + "type": "boolean", + "description": "Flag indicating whether the number of items is based on a formula.", + "enum": [ + false, + true + ] + } + } + }, + "19_obj_voucher_object_discount_unit_multiple": { + "title": "Unit, multiple items", + "type": "object", + "description": "Multiple item types.", + "properties": { + "type": { + "type": "string", + "description": "Applies a full value discount to item(s).", + "default": "UNIT" + }, + "effect": { + "type": "string", + "default": "ADD_MANY_ITEMS", + "description": "Defines the effect for adding multiple item types." + }, + "units": { + "type": "array", + "description": "Array of objects defining items to be offered for free. Each item type can have a different discount effect assigned.", + "items": { "type": "object", - "title": "Order Item", - "description": "This object represents an order line item.", + "description": "Object defining a unit discount.", "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s product/SKU ID (if it is different from the Voucherify product/SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service." - }, - "related_object": { - "type": "string", - "description": "Used along with the `source_id` property, can be set to either `sku` or `product`." - }, - "product_id": { - "type": "string", - "description": "A unique product ID assigned by Voucherify.", - "example": "prod_0a7e62db1fca8322a2" - }, - "sku_id": { - "type": "string", - "description": "A unique SKU ID assigned by Voucherify.", - "example": "sku_0a41e31c7b41c28358" - }, - "quantity": { + "effect": { "type": "string", - "description": "The quantity of the particular item in the cart." + "enum": [ + "ADD_NEW_ITEMS", + "ADD_MISSING_ITEMS" + ], + "description": "Defines how the unit is added to the customer's order." }, - "price": { - "type": "string", - "description": "The unit price of the item." + "unit_off": { + "type": "integer", + "description": "Number of units to be granted a full value discount. In case of the unit being calculated by a formula, this value is the result of the dynamic calculation.", + "example": 1 }, - "amount": { + "unit_type": { "type": "string", - "description": "The total amount of the order item (`price` * `quantity`)." - } - } - }, - "6_req_validate_promotion": { - "title": "Validate Promotion Request Body", - "type": "object", - "description": "Request schema model for validating a promotion using **POST** `/promotions/validation`.", - "properties": { - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." + "description": "The product or SKU deemed as free, chosen from the product inventory (e.g. time, items), i.e. `prod_0bc3bd76a61082e6b3` or `sku_0a3efc90701d121820`.", + "example": "prod_f1r5Tpr0DuC7" }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + "sku": { + "type": "object", + "description": "Defines the product details of the product or the parent product in case of an SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_0a3efc90375d1217e2", + "description": "Unique SKU ID assigned by Voucherify." }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + "source_id": { + "type": "string", + "description": "SKU source ID." }, - { - "$ref": "#/components/schemas/10_req_create_order" + "sku": { + "type": "string", + "description": "SKU name." } - ], - "description": "Order information." - }, - "metadata": { - "type": "object", - "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + } }, - "options": { + "product": { "type": "object", - "description": "Configure parameters returned in the response.", + "description": "Defines the product details of the product or the parent product in case of an SKU.", "properties": { - "expand": { - "type": "array", - "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. Add `category` as a string in the array to include a `categories` object in the response.", - "items": { - "type": "string", - "enum": [ - "category" - ], - "example": "category" - } + "id": { + "type": "string", + "example": "prod_0bc3bd76a61082e6b3", + "description": "Unique (parent) product ID assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "Product source ID." + }, + "name": { + "type": "string", + "description": "Product name." } } } } - }, - "6_res_validate_promotion": { - "title": "Validate Promotion Response Body", - "type": "object", - "description": "Response schema model for validating a promotion using **POST** `/promotions/validation`.", - "properties": { - "valid": { - "type": "boolean", - "description": "Indicates whether the promotion is valid within the context of the parameters provided in the request body and filters in the query parameters." - }, - "tracking_id": { - "type": "string", - "description": "Hashed customer source ID." - }, - "promotions": { - "type": "array", - "description": "Contains an array of promotion tier objects.", - "items": { - "$ref": "#/components/schemas/6_res_validate_promotion_object" - } - } + } + }, + "is_dynamic": { + "type": "boolean", + "description": "Flag indicating whether the number of items is based on a formula." + } + } + }, + "19_obj_voucher_object_discount_shipping": { + "title": "Shipping", + "description": "Shipping discount type.", + "type": "object", + "properties": { + "type": { + "type": "string", + "default": "UNIT", + "description": "Applies a full value discount to item(s)." + }, + "effect": { + "type": "string", + "description": "Defines how the unit is added to the customer's order.", + "default": "ADD_MISSING_ITEMS" + }, + "unit_off": { + "type": "number", + "format": "float", + "description": "Subtracts 1 shipping item from the subtotal.", + "default": 1 + }, + "unit_type": { + "type": "string", + "description": "The shipping product deemed as free.", + "default": "prod_5h1pp1ng" + }, + "product": { + "type": "object", + "description": "Defines the product details of the shipping product.", + "properties": { + "id": { + "type": "string", + "example": "prod_5h1pp1ng", + "description": "Unique product ID assigned by Voucherify, i.e. `prod_5h1pp1ng`.", + "default": "prod_5h1pp1ng" + }, + "source_id": { + "type": "string", + "description": "Product source ID.", + "default": "5h1pp1ng", + "example": "5h1pp1ng" + }, + "name": { + "type": "string", + "description": "Product name.", + "example": "Shipping", + "default": "Shipping" } - }, - "6_res_validate_promotion_object": { - "title": "Validate Promotion", + } + }, + "is_dynamic": { + "type": "boolean", + "description": "Flag indicating whether the number of shipping items is based on a formula.", + "default": false, + "enum": [ + false + ] + } + } + }, + "19_obj_validations-true_result_gift_card": { + "type": "object", + "title": "Gift Card", + "description": "This is a `result` object representing the results for a gift card.", + "properties": { + "gift": { + "description": "Stores the amount of gift card credits to be applied in the redemption.", + "type": "object", + "properties": { + "credits": { + "type": "integer", + "description": "Total number of gift card credits to be applied in the redemption expressed as the smallest currency unit (that is, 100 cents for $1.00)." + } + } + } + } + }, + "19_obj_validations-true_result_loyalty_card": { + "type": "object", + "title": "Loyalty Card", + "description": "This is a `result` object representing the results for a loyalty card.", + "properties": { + "loyalty_card": { + "description": "Stores the amount of loyalty card points to be applied in the redemption.", + "type": "object", + "properties": { + "points": { + "type": "integer", + "description": "Total number of loyalty points to be applied in the redemption." + } + } + } + } + }, + "19_obj_validations-true_result_promotion_tier": { + "type": "object", + "title": "Promotion Tier", + "description": "This is a `result` object representing the results for a promotion tier.", + "properties": { + "discount": { + "description": "Discount details about the type of discount to be applied for the redeemable.", + "oneOf": [ + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" + } + ] + } + } + }, + "19_obj_validations-true_result_promotion_stack": { + "type": "object", + "title": "Promotion Stack", + "description": "This is a `result` object representing the results for a promotion stack.", + "properties": { + "loyalty_card": { + "description": "Stores the amount of loyalty card points to be applied in the redemption.", + "type": "object", + "properties": { + "points": { + "type": "integer", + "description": "Total number of loyalty points to be applied in the redemption." + } + } + } + } + }, + "19_obj_order_object_validation_res": { + "type": "object", + "title": "Order", + "description": "Contains the combined effect of all redeemables taken into account on the order object properties.", + "properties": { + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "discount_amount": { + "type": "integer", + "description": "Sum of all order-level discounts applied to the order. \n`sum(redeemables.order.applied_discount_amount)`" + }, + "items_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" + }, + "total_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`\t" + }, + "total_amount": { + "type": "integer", + "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" + }, + "applied_discount_amount": { + "type": "integer", + "description": "Sum of all order-level discounts applied in a particular request. \n`sum(redeemables.order.applied_discount_amount)`" + }, + "items_applied_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied in a particular request. \n`sum(items, i => i.applied_discount_amount)`" + }, + "total_applied_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied in a particular request. \n`total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount`" + }, + "items": { + "type": "array", + "description": "Array of order items showing the effects of particular discounts on the item-level.", + "items": { "type": "object", - "description": "Validate Promotion", "properties": { - "valid": { - "type": "string", - "description": "Indicates whether the promotion is valid within the context of the parameters provided in the request body and filters in the query parameters." - }, - "applicable_to": { - "$ref": "#/components/schemas/6_res_applicable_to_object" - }, - "inapplicable_to": { - "$ref": "#/components/schemas/6_res_inapplicable_to_object" - }, - "tracking_id": { + "object": { "type": "string", - "description": "Hashed customer source ID." - }, - "order": { - "$ref": "#/components/schemas/6_obj_order_object" + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." }, - "id": { + "product_id": { "type": "string", - "example": "promo_4TqHr24boFISDrcOHSlfAxwm", - "description": "Unique promotion tier ID." + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, - "name": { + "sku_id": { "type": "string", - "description": "Custom promotion tier name." + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." }, - "banner": { - "type": "string", - "description": "Text to be displayed to your customers on your website.", - "example": "Get 45% off items" + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." }, - "discount": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_amount" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_percent" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_fixed" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_shipping" - } - ], - "description": "Contains information about the discount to be applied to the order." + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." }, - "start_date": { - "type": "string", - "format": "date-time", - "example": "2022-11-02T00:00:00.000Z", - "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Campaign is *inactive* before this date." + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-11-04T00:00:00.000Z", - "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive* after this date." + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`applied_discount_amount`" }, - "campaign": { + "product": { "type": "object", + "description": "This object stores more information about the related product.", "properties": { "id": { "type": "string", - "example": "camp_h8RyP6FV94F3Ev2odP24j5p1", - "description": "Unique promotion tier ID." + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, - "start_date": { + "source_id": { "type": "string", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive* before this date.", - "example": "2022-11-01T00:00:00.000Z", - "format": "date-time" + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" }, - "expiration_date": { + "name": { "type": "string", - "description": "Activation timestamp defines when the campaign expires in ISO 8601 format. Promotion tier is *inactive* after this date.", - "example": "2022-11-30T00:00:00.000Z", - "format": "date-time" - }, - "active": { - "type": "boolean", - "description": "A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object" + "example": "Brewing System", + "description": "Product name." }, - "object": { - "type": "string", - "default": "campaign", - "description": "The type of object represented by the campaign object. This object stores information about the campaign." + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." } } }, - "hierarchy": { - "type": "integer", - "description": "The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy." - }, - "discount_amount": { - "type": "integer", - "description": "The calculated discount amount based on the discount type and effect." - }, - "applied_discount_amount": { - "type": "integer", - "description": "The effective discount amount that would be applied to the order." - }, - "metadata": { + "sku": { "type": "object", - "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." - }, - "object": { - "type": "string", - "default": "promotion_tier", - "description": "The type of object represented by JSON. This object stores information about the promotion tier." - }, - "category_id": { - "type": "string", - "description": "Promotion tier category ID.", - "example": "cat_0c9da30e7116ba6bba" - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object", - "description": "Details about the category assigned to the promotion tier." - } - } - }, - "6_req_validate_promotion_tier": { - "title": "Validate Promotion Tier Request Body", - "type": "object", - "description": "Request schema model for validating a promotion using **POST** `/promotions/tiers/{tierId}/validation`.", - "properties": { - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + "description": "This object stores more information about the related SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + "source_id": { + "type": "string", + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + "sku": { + "type": "string", + "description": "SKU name." }, - { - "$ref": "#/components/schemas/10_req_create_order" + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." } - ], - "description": "Order information." - }, - "metadata": { - "type": "object", - "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + } } } - }, - "6_res_validate_promotion_tier": { - "title": "Validate Promotion Tier Response Body", - "description": "Response schema model for validating a promotion using **POST** `/promotions/tiers/{tierId}/validation`.", - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_promotion_tier_true" - }, - { - "$ref": "#/components/schemas/6_res_validate_promotion_tier_false" - } - ] - }, - "6_res_validate_promotion_tier_true": { - "title": "Promotion Tier Valid", + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "customer_id": { + "type": "null" + }, + "referrer_id": { + "type": "null" + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + } + } + }, + "19_obj_order_object_validation_res_per_redeemable": { + "type": "object", + "title": "Order", + "description": "Contains the effect of each redeemable on the order and specific cart items. The amounts are consecutively built on the previous redeemable's effects, such that for each redeemable, the amounts are further reduced by the redeemable. The sequence in the request body is important because that will be the sequence the redeemables are applied one on top of the other.", + "properties": { + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "discount_amount": { + "type": "integer", + "description": "Sum of all order-level discounts applied to the order. \n`sum(redeemables.order.applied_discount_amount)`" + }, + "items_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" + }, + "total_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`\t" + }, + "total_amount": { + "type": "integer", + "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" + }, + "applied_discount_amount": { + "type": "integer", + "description": "Sum of all order-level discounts applied in a particular request. \n`sum(redeemables.order.applied_discount_amount)`" + }, + "items_applied_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied in a particular request. \n`sum(items, i => i.applied_discount_amount)`" + }, + "total_applied_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied in a particular request. \n`total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount`" + }, + "items": { + "type": "array", + "description": "Array of order items showing the effects of particular discounts on the item-level.", + "items": { "type": "object", - "description": "Response schema model for valid promotion tier when validating a promotion using **POST** `/promotions/tiers/{tierId}/validation`.", "properties": { - "valid": { - "type": "string", - "description": "Indicates whether the promotion is valid within the context of the parameters provided in the request body and filters in the query parameters." - }, - "applicable_to": { - "$ref": "#/components/schemas/6_res_applicable_to_object" - }, - "inapplicable_to": { - "$ref": "#/components/schemas/6_res_inapplicable_to_object" - }, - "tracking_id": { + "object": { "type": "string", - "description": "Hashed customer source ID." - }, - "order": { - "$ref": "#/components/schemas/6_obj_order_object" + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." }, - "id": { + "product_id": { "type": "string", - "example": "promo_4TqHr24boFISDrcOHSlfAxwm", - "description": "Unique promotion tier ID." + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, - "name": { + "sku_id": { "type": "string", - "description": "Custom promotion tier name." + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." }, - "banner": { - "type": "string", - "description": "Text to be displayed to your customers on your website.", - "example": "Get 45% off items" + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." }, - "discount": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_amount" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_percent" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_fixed" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_shipping" - } - ], - "description": "Contains information about the discount to be applied to the order." + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." }, - "start_date": { - "type": "string", - "format": "date-time", - "example": "2022-11-02T00:00:00.000Z", - "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Campaign is *inactive* before this date." + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-11-04T00:00:00.000Z", - "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive* after this date." + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`applied_discount_amount`" }, - "campaign": { + "product": { "type": "object", + "description": "This object stores more information about the related product.", "properties": { "id": { "type": "string", - "example": "camp_h8RyP6FV94F3Ev2odP24j5p1", - "description": "Unique promotion tier ID." + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, - "start_date": { + "source_id": { "type": "string", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive* before this date.", - "example": "2022-11-01T00:00:00.000Z", - "format": "date-time" + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" }, - "expiration_date": { + "name": { "type": "string", - "description": "Activation timestamp defines when the campaign expires in ISO 8601 format. Promotion tier is *inactive* after this date.", - "example": "2022-11-30T00:00:00.000Z", - "format": "date-time" - }, - "active": { - "type": "boolean", - "description": "A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object" + "example": "Brewing System", + "description": "Product name." }, - "object": { - "type": "string", - "default": "campaign", - "description": "The type of object represented by the campaign object. This object stores information about the campaign." + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." } } }, - "hierarchy": { - "type": "integer", - "description": "The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy." - }, - "discount_amount": { - "type": "integer", - "description": "The calculated discount amount based on the discount type and effect." - }, - "applied_discount_amount": { - "type": "integer", - "description": "The effective discount amount that would be applied to the order." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." - }, - "object": { - "type": "string", - "default": "promotion_tier", - "description": "The type of object represented by JSON. This object stores information about the promotion tier." - } - } - }, - "6_res_validate_promotion_tier_false": { - "type": "object", - "description": "Response schema model for a non-valid promotion tier when validating a promotion using **POST** `/promotions/tiers/{tierId}/validation`.", - "title": "Promotion Tier Not Valid", - "properties": { - "valid": { - "type": "boolean", - "description": "Response schema for a voucher that is not valid." - }, - "reason": { - "type": "string", - "description": "System generated cause for the voucher being invalid in the context of the provided parameters." - }, - "error": { - "description": "Detailed failure cause for the invalid voucher if the reason has a translation defined in the Dashboard → Project Settings → Error Messages.", - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_promotion_tier_false_custom_message" - }, - { - "$ref": "#/components/schemas/e_error_no_translation" - } - ] - }, - "tracking_id": { - "type": "string", - "description": "Hashed customer source ID." - }, - "id": { - "type": "string", - "example": "promo_ByIIAHC1Mz9ouJsitzAWsush", - "description": "Promotion tier ID." - }, - "name": { - "type": "string", - "description": "Custom promotion tier name." - }, - "banner": { - "type": "string", - "description": "Text to be displayed to your customers on your website.", - "example": "Get 25% off" - }, - "discount": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_amount" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_percent" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_fixed" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_discount_shipping" - } - ], - "description": "Contains information about the discount to be applied to the order." - }, - "start_date": { - "type": "string", - "description": "Activation timestamp defines when the promotion tier starts to be active in ISO 8601 format. Campaign is *inactive* before this date.", - "format": "date-time", - "example": "2022-11-02T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "description": "Activation timestamp defines when the promotion tier expires in ISO 8601 format. Promotion tier is *inactive* after this date.", - "format": "date-time", - "example": "2022-11-04T00:00:00.000Z" - }, - "campaign": { + "sku": { "type": "object", + "description": "This object stores more information about the related SKU.", "properties": { "id": { "type": "string", - "description": "Unique promotion tier ID." + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." }, - "start_date": { + "source_id": { "type": "string", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive* before this date.", - "format": "date-time", - "example": "2022-11-01T00:00:00.000Z" + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." }, - "expiration_date": { + "sku": { "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign expires in ISO 8601 format. Promotion tier is *inactive* after this date.", - "example": "2022-11-30T00:00:00.000Z" - }, - "active": { - "type": "boolean", - "description": "A flag indicating whether the campaign is active or not active. A campaign can be disabled even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" + "description": "SKU name." }, - "object": { - "type": "string", - "description": "The type of object represented by the campaign object. This object stores information about the campaign.", - "default": "campaign" + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." } } - }, - "hierarchy": { - "type": "integer", - "description": "The promotions hierarchy defines the order in which the discounts from different tiers will be applied to a customer's order. If a customer qualifies for discounts from more than one tier, discounts will be applied in the order defined in the hierarchy." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that you can attach to a promotion tier object. It can be useful for storing additional information about the promotion tier in a structured format." - }, - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about the promotion tier.", - "default": "promotion_tier" - } - } - }, - "6_res_validate_promotion_tier_false_custom_message": { - "type": "object", - "description": "Custom Error Message", - "title": "Custom Message", - "properties": { - "message": { - "type": "string", - "description": "Customized error message." } } - }, - "19_req_session_lock": { - "title": "Session Lock", - "type": "object", - "description": "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](doc:locking-validation-session).", - "properties": { - "type": { - "type": "string", - "description": "This parameter is **required** to establish a new session. The session locks the redemption **quantity** by 1 and the redemption **gift credits** and **loyalty points** specified within the request.", - "enum": [ - "LOCK" - ] + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "customer_id": { + "type": "null" + }, + "referrer_id": { + "type": "null" + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + } + } + }, + "19_res_redemptions_parentRedemptionId_rollbacks": { + "type": "object", + "properties": { + "rollbacks": { + "type": "array", + "description": "Contains the rollback redemption objects of the particular incentives.", + "items": { + "anyOf": [ + { + "$ref": "#/components/schemas/19_obj_redemption_rollback_object_discount_voucher_stacked" }, - "key": { - "type": "string", - "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated.", - "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" + { + "$ref": "#/components/schemas/19_obj_redemption_rollback_object_loyalty_card_stacked" }, - "ttl_unit": { - "type": "string", - "description": "Defines the type of unit in which the session time is counted.", - "enum": [ - "HOURS", - "DAYS", - "MINUTES", - "SECONDS", - "MILLISECONDS", - "MICROSECONDS", - "NANOSECONDS" - ] + { + "$ref": "#/components/schemas/19_obj_redemption_rollback_object_gift_card_stacked" }, - "ttl": { - "type": "integer", - "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." + { + "$ref": "#/components/schemas/19_obj_redemption_rollback_object_promotion_tier_stacked" } - } - }, - "19_res_session_lock": { - "title": "Session Lock", - "type": "object", - "description": "Schema model for `session` lock object. The session object contains information about the session key that was used to establish a session between multiple parallel validation and redemption requests.", - "properties": { - "type": { - "type": "string", - "description": "This session locks the redemption **quantity** by 1.", - "default": "LOCK" - }, - "key": { - "type": "string", - "description": "The session unique ID assigned by Voucherify or your own unique session ID.", - "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" - }, - "ttl_unit": { - "type": "string", - "description": "Defines the type of unit in which the session time is counted.", - "enum": [ - "HOURS", - "DAYS", - "MINUTES", - "SECONDS", - "MILLISECONDS", - "MICROSECONDS", - "NANOSECONDS" - ] - }, - "ttl": { - "type": "integer", - "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session.ttl_unit` parameter." - } - } - }, - "19_obj_order_object_rollback_stacked": { - "title": "Order object", - "description": "This is an object representing an order that was rolled back for a stacked redemption.", - "properties": { - "id": { - "type": "string", - "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", - "description": "Unique order ID, assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:40:48.705Z", - "description": "Timestamp representing the date and time when the order was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:47:20.760Z", - "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format." - }, - "status": { - "type": "string", - "description": "Order status.", - "enum": [ - "CANCELED" - ] - }, - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "total_amount": { - "type": "integer", - "description": "Order amount after undoing all the discounts through the rollback redemption." - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order.", + ] + } + }, + "parent_rollback": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "rr_0c675efbc2039b83b3", + "description": "Unique redemption rollback ID." + }, + "customer_id": { + "type": "string", + "example": "cust_QszL0PS1NekVjQaHGxrbpPHu", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "description": "Hashed customer source ID.", + "example": "track_fxEMFisanb4sbl4Z4yCn" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2023-02-03T09:12:22.536Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "order": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", + "description": "Unique order ID, assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + }, + "status": { + "type": "string", + "description": "Order status.", + "enum": [ + "CANCELED" + ] + }, + "customer_id": { + "type": "string", + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" + }, + "referrer_id": { + "type": "string", + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." + }, + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "total_amount": { + "type": "integer", + "description": "Order amount after undoing all the discounts through the rollback redemption." + }, "items": { - "type": "object", - "properties": { - "object": { - "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." - }, - "product_id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "sku_id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the removing an item-level discount." - }, - "product": { - "type": "object", - "description": "This object stores more information about the related product.", - "properties": { - "id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" - }, - "name": { - "type": "string", - "example": "Brewing System", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - }, - "sku": { - "type": "object", - "description": "This object stores more information about the related SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." - }, - "sku": { - "type": "string", - "description": "SKU name." - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - } - } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "customer": { - "type": "object", - "description": "Object containing information about the customer that is making the purchase.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique customer ID of the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `customer` object." - } - } - }, - "referrer": { - "type": "object", - "description": "Object containing information about the referrer.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique referrer ID, who referred the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `referrer` object." - } - } - }, - "customer_id": { - "type": "string", - "description": "Unique customer ID of the customer making the purchase.", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" - }, - "referrer_id": { - "type": "string", - "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "description": "Unique referrer ID." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - }, - "redemptions": { - "description": "Lists details related to the redemption and redemption rollback.", - "properties": { - "redemption_ID": { + "type": "array", + "description": "Array of order items that have been applied to the order.", + "items": { "type": "object", - "description": "The property name is the unique redemption ID; i.e. `r_0ba186c4824e4881e1`. This object contains information about the redemption rollback of incentives.", "properties": { - "date": { + "object": { "type": "string", - "description": "Timestamp representing the date and time when the redemption was created in ISO 8601 format.", - "example": "2022-09-02T17:06:56.649Z", - "format": "date-time" + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." }, - "rollback_id": { + "product_id": { "type": "string", - "description": "Unique ID of the redemption rollback.", - "example": "rr_0c63c84eb78ee0a6c0" + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, - "rollback_date": { + "sku_id": { "type": "string", - "description": "Timestamp representing the date and tiem when the redemption rollback was created in ISO 8601 format.", - "example": "2023-01-31T14:18:37.150Z", - "format": "date-time" + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." }, - "related_object_type": { - "type": "string", - "description": "The source of the redemption is a `redemption` because this rollback is in the context of a stacked redemption.", - "enum": [ - "redemption" - ] + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." }, - "related_object_id": { - "type": "string", - "description": "Unique ID of the parent redemption.", - "example": "r_0ba186c4824e4881e1" + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." }, - "stacked": { - "type": "array", - "description": "Lists the stacked redemption IDs in the initial redemption request.", - "items": { - "type": "string" + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the removing an item-level discount." + }, + "product": { + "type": "object", + "description": "This object stores more information about the related product.", + "properties": { + "id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" + }, + "name": { + "type": "string", + "example": "Brewing System", + "description": "Product name." + }, + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } } }, - "rollback_stacked": { - "type": "array", - "description": "Lists the rollback redemption IDs of the particular child redemptions.", - "items": { - "type": "string" + "sku": { + "type": "object", + "description": "This object stores more information about the related SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." + }, + "sku": { + "type": "string", + "description": "SKU name." + }, + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } } } } } - } - } - } - }, - "19_obj_order_object_rollback_stacked_per_redemption_apply_to_order": { - "title": "Order object", - "description": "This is an object representing an order that was rolled back for a stacked redemption.", - "properties": { - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "total_amount": { - "type": "integer", - "description": "Order amount after undoing all the discounts through the rollback redemption." - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order.", - "items": { + }, + "metadata": { "type": "object", - "properties": { - "object": { - "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." - }, - "product_id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "sku_id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." } - } - }, - "19_obj_order_object_rollback_stacked_per_redemption_apply_to_items": { - "title": "Order object", - "description": "This is an object representing an order that was rolled back for a stacked redemption.", - "properties": { - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "items_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied to the order.`" - }, - "total_discount_amount": { - "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied to the order." - }, - "total_amount": { - "type": "integer", - "description": "Order amount after undoing all the discounts through the rollback redemption." - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order.", - "items": { + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { "type": "object", - "properties": { - "object": { - "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." - }, - "product_id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "sku_id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the removing an item-level discount." - } - } + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." } + }, + "result": { + "type": "string", + "description": "Redemption rollback result", + "enum": [ + "SUCCESS" + ] + }, + "redemption": { + "type": "string", + "example": "r_0c656311b5878a2031", + "description": "Unique redemption ID of the initial redemption." } - }, - "19_req_redeemables_gift_card": { - "title": "Gift Card", - "type": "object", - "description": "Redeem a gift card.", - "properties": { - "id": { - "type": "string", - "description": "Unique gift card code." - }, - "object": { - "type": "string", - "description": "Type of object, i.e. `voucher`.", - "default": "voucher" - }, - "gift": { - "type": "object", - "description": "Contains information on the number of gift card credits that the customer wants to apply to the order.", - "properties": { - "credits": { - "type": "integer", - "description": "The number of credits that the user wants to use from the gift card to fulfill the order. The value of credits cannot be higher than the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - } + } + }, + "order": { + "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked" + } + }, + "description": "Response body schema for POST `/redemptions/{parentRedemptionID}/rollbacks`.", + "title": "Rollback Stackable Redemptions Response Body" + }, + "19_obj_redemption_rollback_object_discount_voucher_stacked": { + "type": "object", + "title": "Rollback Discount Voucher", + "description": "This is an object representing a redemption rollback for a discount voucher.", + "properties": { + "id": { + "type": "string", + "example": "rr_0c5eba630bc4979e70", + "description": "Unique redemption rollback ID." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "anyOf": [ + { + "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_order" }, - "required": [ - "object", - "id" - ] - }, - "19_req_redeemables_loyalty_card": { - "title": "Loyalty Card", - "type": "object", - "description": "Redeem a loyalty card.", - "properties": { - "id": { - "type": "string", - "description": "Unique loyalty card code." - }, - "object": { - "type": "string", - "description": "Type of object, i.e. `voucher`.", - "default": "voucher" - }, - "reward": { - "type": "object", - "description": "Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward.", - "example": "rew_EPx1hCTpqzF0HW1z9NKckZH4" - }, - "points": { - "type": "integer", - "description": "The number of loyalty points that the user wants to spend in order to fulfill the order using a **pay with points** reward. The number of points cannot be higher than the current balance on the loyalty card." - } - } - } + { + "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_items" + } + ] + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" }, - "required": [ - "object", - "id", - "reward" - ] - }, - "19_req_redeemables_discount_referral_promotion_tier_promotion_stack": { - "title": "Discount code, referral code, promotion tier, promotion stack", - "type": "object", - "description": "Redeem a discount code, referral code, promotion tier, or promotion stack.", - "properties": { - "object": { - "type": "string", - "description": "Redeemable object type.", - "enum": [ - "voucher", - "promotion_tier", - "promotion_stack" - ], - "default": "voucher" - }, - "id": { - "type": "string", - "description": "Redeemable code or unique ID such as: \n- discount code, referral code: `DiscountCode100`, `v_6ZPI2BLMtpc6zz8pQVjQgxJH3D4ac3ZT` \n- promotion tier: `promo_Mwy9XpA0TLctSGriM5kum0qp` \n- promotion stack: `stack_KxSD0GahLUg9ULB6TseGfUHJ` " - } + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." }, - "required": [ - "object", - "id" - ] - }, - "19_req_redemptions": { - "title": "Redeem Stackable Discounts Request Body", - "type": "object", - "description": "This data model represents the request body for redeeming multiple incentives.", - "properties": { - "options": { - "type": "object", - "description": "Configure parameters returned in the response.", - "properties": { - "expand": { - "type": "array", - "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. \n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
                  - Order data with calculated discounts are listed in each child redemption object.
                  - Metadata not included for each discount type. |\n| [\"order\", \"redemption\"] | - Returns redemption object `metadata`.
                  - Order data with calculated discounts are listed in each child redemption object. |\n| [\"redeemable\", \"redemption\"] | - Returns each discount type's `metadata` in each child redemption object.
                  - Returns redemption object `metadata`. |\n| [\"redemption\"] | - Returns redemption object `metadata`. |\n| [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object
                  - Returns redemption object `metadata`.
                  - Returns an expanded `categories` object, showing details about the category. |", - "items": { - "type": "string", - "enum": [ - "order", - "redemption", - "redeemable", - "category" - ] - } - } - } - }, - "redeemables": { - "type": "array", - "minItems": 1, - "maxItems": 5, - "description": "An array of redeemables. You can combine `voucher`(s) and `promotion_tier`(s). Alternatively, send one unique`promotion_stack` in the array.", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/19_req_redeemables_discount_referral_promotion_tier_promotion_stack" - }, - { - "$ref": "#/components/schemas/19_req_redeemables_gift_card" - }, - { - "$ref": "#/components/schemas/19_req_redeemables_loyalty_card" - } - ] - } - }, - "session": { - "$ref": "#/components/schemas/19_req_session_lock" - }, - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" - }, - { - "$ref": "#/components/schemas/10_req_create_order" - } - ], - "description": "Order information. This object enables you to pass purchase transaction data. Read what properties you can use in the [Order object](ref:get-order)." - }, - "metadata": { - "type": "object", - "description": "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": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." }, - "required": [ - "redeemables" - ] - }, - "19_req_validations": { - "title": "Validate Stackable Discounts Request Body", - "type": "object", - "description": "This data model represents the request body for the `/validations` endpoint.", - "properties": { - "options": { - "type": "object", - "description": "Configure parameters returned in the response.", - "properties": { - "expand": { - "type": "array", - "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. \n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
                  - Order data with calculated discounts are listed in each child redeemable object.
                  - Metadata not included for each discount type. |\n| [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. |\n| [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
                  - Includes `metadata` for each discount type. |\n| [\"category\"] | - Returns an expanded `categories` object, showing details about the category. |", - "items": { - "type": "string", - "enum": [ - "order", - "redemption", - "redeemable", - "category" - ] - } - } - } - }, - "redeemables": { - "type": "array", - "minItems": 1, - "maxItems": 5, - "description": "An array of redeemables. You can combine `voucher`(s) and `promotion_tier`(s). Alternatively, send one unique`promotion_stack` in the array.", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/19_req_redeemables_discount_referral_promotion_tier_promotion_stack" - }, - { - "$ref": "#/components/schemas/19_req_redeemables_gift_card" - }, - { - "$ref": "#/components/schemas/19_req_redeemables_loyalty_card" - } - ] + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "voucher": { + "type": "object", + "description": "Defines the details of the voucher.", + "properties": { + "id": { + "type": "string", + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "discount": { + "oneOf": [ + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" + }, + { + "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" } - }, - "session": { - "$ref": "#/components/schemas/19_req_session_lock" - }, - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" - }, - { - "$ref": "#/components/schemas/10_req_create_order" - } - ], - "description": "Order information. This object enables you to pass purchase transaction data. Read what properties you can use in the [Order object](ref:get-order)." - }, - "metadata": { - "type": "object", - "description": "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." - } + ] }, - "required": [ - "redeemables" - ] - }, - "19_res_validations": { - "title": "Validate Stackable Discounts Response Body", - "description": "Response body schema for POST `/validations`.", - "oneOf": [ - { - "$ref": "#/components/schemas/19_res_validations-true" - }, - { - "$ref": "#/components/schemas/19_res_validations-false" + "type": { + "type": "string", + "description": "Indicates the voucher type.", + "enum": [ + "DISCOUNT_VOUCHER" + ] + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + }, + "is_referral_code": { + "type": "boolean", + "description": "Flag indicating whether this voucher is a referral code." + } + } + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the original redemption." + } + } + }, + "19_obj_redemption_rollback_object_loyalty_card_stacked": { + "type": "object", + "title": "Rollback Loyalty Card Voucher", + "description": "This is an object representing a redemption rollback for a loyalty card.", + "properties": { + "id": { + "type": "string", + "example": "rr_0c5eaf4060133bf784", + "description": "Unique redemption rollback ID." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "amount": { + "type": "integer", + "description": "Number of points being returned to the loyalty card." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "anyOf": [ + { + "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_order" + }, + { + "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_items" + } + ] + }, + "reward": { + "description": "Defines the reward that was initially redeemed.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" + } + ] + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the reward.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "voucher": { + "type": "object", + "description": "Defines the details of the voucher.", + "properties": { + "id": { + "type": "string", + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "loyalty_card": { + "type": "object", + "description": "Stores the number of points being added back to the loyalty card for the reward redemption rollback.", + "properties": { + "points": { + "type": "integer", + "example": 7000, + "description": "Total points incurred over lifespan of loyalty card." + }, + "balance": { + "type": "integer", + "example": 6970, + "description": "Points available for reward redemption after the redemption rollback." + } } - ] - }, - "19_res_validations-false": { - "type": "object", - "title": "False", - "description": "Response body schema for POST `/validations`.", - "properties": { - "valid": { - "type": "boolean", - "description": "The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable.", - "default": false - }, - "redeemables": { - "type": "array", - "description": "Lists validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"`.", - "items": { - "type": "object", - "properties": { - "status": { - "type": "string", - "enum": [ - "APPLICABLE", - "INAPPLICABLE", - "SKIPPED" - ], - "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules. `SKIPPED` indicates that the validation stopped once it identified at least one unapplicable redeemable and did not continue to validate the given redeemable." - }, - "id": { - "type": "string", - "description": "Redeemable ID, i.e. the voucher code." - }, - "object": { - "type": "string", - "description": "Redeemable's object type.", - "enum": [ - "voucher", - "promotion_tier", - "promotion_stack" - ] - }, - "result": { - "type": "object", - "description": "Provides details for an inapplicable redeemable.", - "properties": { - "error": { - "$ref": "#/components/schemas/e_error" - } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object" - } - } + }, + "type": { + "type": "string", + "description": "Indicates the voucher type.", + "enum": [ + "LOYALTY_CARD" + ] + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + }, + "is_referral_code": { + "type": "boolean", + "description": "Flag indicating whether this voucher is a referral code." + }, + "holder_id": { + "type": "string", + "description": "Unique customer ID of the loyalty card owner.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + } + } + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the original redemption." + } + } + }, + "19_obj_redemption_rollback_object_gift_card_stacked": { + "type": "object", + "title": "Rollback Gift Card", + "description": "This is an object representing a gift card redemption rollback.", + "properties": { + "id": { + "type": "string", + "example": "rr_0bc92f81a6801f9bca", + "description": "Unique redemption rollback ID." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "amount": { + "type": "integer", + "description": "The amount added back to the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "anyOf": [ + { + "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_order" + }, + { + "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_items" + } + ] + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the gift card.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "voucher": { + "type": "object", + "description": "Defines the details of the voucher.", + "properties": { + "id": { + "type": "string", + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "gift": { + "type": "object", + "description": "Contains the balance of the gift card after credits are added back to the gift card for the redemption rollback.", + "properties": { + "amount": { + "type": "integer", + "example": 10000, + "description": "Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "balance": { + "type": "integer", + "example": 500, + "description": "Available funds after the redemption rollback credits back the amount used up during the initial redemption. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_ORDER", + "APPLY_TO_ITEMS" + ], + "description": "Defines how the credits are applied to the customer's order." } - }, - "tracking_id": { - "type": "string", - "example": "track_VAVo1/z+G2GI2LPw==", - "description": "Hashed customer source ID." } + }, + "type": { + "type": "string", + "description": "Indicates the voucher type.", + "enum": [ + "GIFT_VOUCHER" + ] + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + }, + "is_referral_code": { + "type": "boolean", + "description": "Flag indicating whether this voucher is a referral code." } - }, - "19_res_validations_redeemables_discount_voucher": { - "type": "object", - "description": "Response schema model for validating a discount code.", - "title": "Discount Voucher", - "properties": { - "status": { - "type": "string", - "enum": [ - "APPLICABLE" - ], - "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." - }, - "id": { - "type": "string", - "description": "Redeemable ID, i.e. the voucher code." - }, - "object": { - "type": "string", - "description": "Redeemable's object type.", - "enum": [ - "voucher" - ] - }, - "order": { - "$ref": "#/components/schemas/19_obj_order_object_validation_res_per_redeemable" - }, - "applicable_to": { - "$ref": "#/components/schemas/6_res_applicable_to_object" - }, - "inapplicable_to": { - "$ref": "#/components/schemas/6_res_inapplicable_to_object" - }, - "result": { - "description": "Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable.", - "$ref": "#/components/schemas/19_obj_validations-true_result_voucher_code" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object" + } + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the initial redemption.", + "example": "r_0c5bf3323008a35032" + } + } + }, + "19_obj_redemption_rollback_object_promotion_tier_stacked": { + "type": "object", + "title": "Promotion Tier", + "description": "This is an object representing a promotion tier redemption rollback", + "properties": { + "id": { + "type": "string", + "example": "rr_0bc92f81a6801f9bca", + "description": "Unique redemption rollback ID." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "anyOf": [ + { + "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_order" + }, + { + "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_items" + } + ] + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "promotion_tier": { + "type": "object", + "description": "Contains details of the promotion tier and the parent campaign.", + "properties": { + "id": { + "type": "string", + "description": "Unique promotion tier ID assigned by Voucherify.", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" + }, + "name": { + "type": "string", + "description": "Promotion tier name." + }, + "banner": { + "type": "string", + "description": "Text to be displayed to your customers on your website." + }, + "campaign": { + "type": "object", + "description": "Promotion tier's parent campaign.", + "properties": { + "id": { + "type": "string", + "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." + } } } - }, - "19_res_validations_redeemables_gift_card": { - "type": "object", - "description": "Response schema model for validating a gift card.", - "title": "Gift Card", - "properties": { - "status": { - "type": "string", - "enum": [ - "APPLICABLE" - ], - "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." - }, - "id": { - "type": "string", - "description": "Redeemable ID, i.e. the gift card code." - }, - "object": { - "type": "string", - "description": "Redeemable's object type.", - "enum": [ - "voucher" - ] - }, - "applicable_to": { - "$ref": "#/components/schemas/6_res_applicable_to_object" - }, - "inapplicable_to": { - "$ref": "#/components/schemas/6_res_inapplicable_to_object" + } + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of initial redemption." + } + } + }, + "19_res_redemptions_POST": { + "type": "object", + "title": "Stackable Redemptions Response Body", + "description": "Response body schema for POST `/redemptions`.", + "properties": { + "redemptions": { + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_discount_voucher_extended_stacked" }, - "result": { - "description": "Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable.", - "$ref": "#/components/schemas/19_obj_validations-true_result_gift_card" + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_extended_stacked" }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." + { + "$ref": "#/components/schemas/7_obj_redemption_object_gift_card_extended_stacked" }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object" + { + "$ref": "#/components/schemas/7_obj_redemption_object_promotion_tier_extended_stacked" + } + ] + } + }, + "parent_redemption": { + "type": "object", + "title": "Stacked Redemption", + "description": "This is an object representing a stacked redemption.", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object_stacked_redemptions" + }, + "customer": { + "type": "object", + "description": "Defines the customer making the stacked redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.", + "enum": [ + "redemption" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. r_0c5d07222e08a34ace for a redemption." + }, + "voucher": { + "type": "null" } - }, - "19_res_validations_redeemables_loyalty_card": { + } + }, + "order": { + "description": "Contains the order details associated with the redemption.", + "$ref": "#/components/schemas/7_obj_order_object_stacked_redemptions" + } + } + }, + "7_obj_order_object_rollback": { + "title": "Order object", + "description": "This is an object representing an order that was rolled back.", + "properties": { + "id": { + "type": "string", + "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", + "description": "Unique order ID, assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:40:48.705Z", + "description": "Timestamp representing the date and time when the order was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:47:20.760Z", + "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format." + }, + "status": { + "type": "string", + "description": "Order status.", + "enum": [ + "CANCELED" + ] + }, + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "total_amount": { + "type": "integer", + "description": "Order amount after undoing all the discounts through the rollback redemption." + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order.", + "items": { "type": "object", - "description": "Response schema model for validating a loyalty card.", - "title": "Loyalty Card", "properties": { - "status": { - "type": "string", - "enum": [ - "APPLICABLE" - ], - "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." - }, - "id": { - "type": "string", - "description": "Redeemable ID, i.e. the loyalty card code." - }, "object": { "type": "string", - "description": "Redeemable's object type.", - "enum": [ - "voucher" - ] - }, - "applicable_to": { - "$ref": "#/components/schemas/6_res_applicable_to_object" - }, - "inapplicable_to": { - "$ref": "#/components/schemas/6_res_inapplicable_to_object" - }, - "result": { - "description": "Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable.", - "$ref": "#/components/schemas/19_obj_validations-true_result_loyalty_card" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object" - } - } - }, - "19_res_validations_redeemables_promotion_tier": { - "type": "object", - "description": "Response schema model for validating a promotion tier.", - "title": "Promotion Tier", - "properties": { - "status": { + "product_id": { "type": "string", - "enum": [ - "APPLICABLE" - ], - "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, - "id": { + "sku_id": { "type": "string", - "description": "Redeemable ID, i.e. the promotion tier ID." + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." }, - "object": { - "type": "string", - "description": "Redeemable's object type.", - "enum": [ - "promotion_tier" - ] + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." }, - "applicable_to": { - "$ref": "#/components/schemas/6_res_applicable_to_object" + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." }, - "inapplicable_to": { - "$ref": "#/components/schemas/6_res_inapplicable_to_object" + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." }, - "result": { - "description": "Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable.", - "$ref": "#/components/schemas/19_obj_validations-true_result_promotion_tier" + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the removing an item-level discount." }, - "metadata": { + "product": { "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object" - } - } - }, - "19_res_validations_redeemables_promotion_stack": { - "type": "object", - "description": "Response schema model for validating a promotion stack.", - "title": "Promotion Stack", - "properties": { - "status": { - "type": "string", - "enum": [ - "APPLICABLE" - ], - "description": "Indicates whether the redeemable can be applied or not applied based on the validation rules." - }, - "id": { - "type": "string", - "description": "Redeemable ID, i.e. the promotion stack ID." - }, - "object": { - "type": "string", - "description": "Redeemable's object type.", - "enum": [ - "promotion_stack" - ] - }, - "applicable_to": { - "$ref": "#/components/schemas/6_res_applicable_to_object" - }, - "inapplicable_to": { - "$ref": "#/components/schemas/6_res_inapplicable_to_object" - }, - "result": { - "description": "Specifies the redeemable's end effect on the order. This object is unique to each type of redeemable.", - "$ref": "#/components/schemas/19_obj_validations-true_result_promotion_stack" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redeemable." - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object" - } - } - }, - "19_res_validations-true": { - "type": "object", - "title": "True", - "description": "Response body schema for POST `/validations`.", - "properties": { - "valid": { - "type": "boolean", - "description": "The result of the validation. It takes all of the redeemables into account and returns a `false` if at least one redeemable is inapplicable. Returns `true` if all redeemables are applicable.", - "default": true - }, - "redeemables": { - "type": "array", - "description": "Lists validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"`.", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/19_res_validations_redeemables_discount_voucher" - }, - { - "$ref": "#/components/schemas/19_res_validations_redeemables_gift_card" - }, - { - "$ref": "#/components/schemas/19_res_validations_redeemables_loyalty_card" - }, - { - "$ref": "#/components/schemas/19_res_validations_redeemables_promotion_tier" - }, - { - "$ref": "#/components/schemas/19_res_validations_redeemables_promotion_stack" - } - ] - } - }, - "order": { - "$ref": "#/components/schemas/19_obj_order_object_validation_res" - }, - "tracking_id": { - "type": "string", - "example": "track_VAVo1/z+G2GI2LPw==", - "description": "Hashed customer source ID." - }, - "session": { - "$ref": "#/components/schemas/19_res_session_lock" - } - } - }, - "19_obj_validations-true_result_voucher_code": { - "type": "object", - "title": "Coupon Code", - "description": "This is a `result` object representing the results for a coupon code.", - "properties": { - "discount": { - "description": "Discount details about the type of discount to be applied for the redeemable.", - "oneOf": [ - { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_amount" - }, - { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_amount_dynamic" - }, - { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_percentage" + "description": "This object stores more information about the related product.", + "properties": { + "id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, - { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_percentage_dynamic" + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" }, - { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_fixed_order" + "name": { + "type": "string", + "example": "Brewing System", + "description": "Product name." }, - { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_fixed_items" + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + }, + "sku": { + "type": "object", + "description": "This object stores more information about the related SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." }, - { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_unit_one" + "source_id": { + "type": "string", + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." }, - { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_unit_multiple" + "sku": { + "type": "string", + "description": "SKU name." }, - { - "$ref": "#/components/schemas/19_obj_voucher_object_discount_shipping" + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." } - ] + } } } - }, - "19_obj_voucher_object_discount_amount": { - "title": "Static Amount", - "type": "object", - "description": "Amount discount type based on a static value.", - "properties": { - "type": { - "type": "string", - "default": "AMOUNT", - "description": "Applies an amount discount." - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS", - "APPLY_TO_ITEMS_PROPORTIONALLY", - "APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY", - "APPLY_TO_ITEMS_BY_QUANTITY" - ], - "description": "Defines how the discount is applied to the customer's order." - }, - "amount_off": { - "type": "integer", - "example": 100, - "description": "Amount taken off the subtotal of a price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000." - }, - "is_dynamic": { - "type": "boolean", - "description": "Flag indicating whether the discount amount is based on a formula that dynamically calculates the discount.", - "enum": [ - false - ] + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "customer": { + "type": "object", + "description": "Object containing information about the customer that is making the purchase.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique customer ID of the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `customer` object." + } + } + }, + "referrer": { + "type": "object", + "description": "Object containing information about the referrer.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique referrer ID, who referred the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `referrer` object." + } + } + }, + "customer_id": { + "type": "string", + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" + }, + "referrer_id": { + "type": "string", + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + }, + "redemptions": { + "description": "Lists details related to the redemption and redemption rollback.", + "properties": { + "redemption_ID": { + "type": "object", + "description": "The property name is the unique redemption ID; i.e. `r_0ba186c4824e4881e1`. This object contains information about the redemption of an incentive.", + "properties": { + "date": { + "type": "string", + "description": "Timestamp representing the date and time when the redemption was created in ISO 8601 format.", + "example": "2022-09-02T17:06:56.649Z", + "format": "date-time" + }, + "rollback_id": { + "type": "string", + "description": "Unique ID of the redemption rollback.", + "example": "rr_0c63c84eb78ee0a6c0" + }, + "rollback_date": { + "type": "string", + "description": "Timestamp representing the date and tiem when the redemption rollback was created in ISO 8601 format.", + "example": "2023-01-31T14:18:37.150Z", + "format": "date-time" + }, + "related_object_type": { + "type": "string", + "description": "The source of the incentive.", + "enum": [ + "voucher", + "promotion_tier" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique ID of the related object that defines the incentive." + }, + "related_object_parent_id": { + "type": "string", + "description": "Represent's the campaign ID of the voucher if the redemption was based on a voucher that was part of bulk codes generated within a campaign." + } } } - }, - "19_obj_voucher_object_discount_amount_dynamic": { - "title": "Dynamic Amount", + } + } + } + }, + "7_obj_order_object": { + "title": "Order object", + "description": "This is an object representing an order with calculated discounts applied using the voucher code.", + "oneOf": [ + { + "$ref": "#/components/schemas/7_obj_order_object_apply_to_order" + }, + { + "$ref": "#/components/schemas/7_obj_order_object_apply_to_items" + } + ] + }, + "7_obj_order_object_apply_to_order": { + "type": "object", + "title": "Order object - Effect: Apply to order", + "description": "This is an object representing an order with calculated discounts applied using the voucher code.", + "properties": { + "id": { + "type": "string", + "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", + "description": "Unique order ID, assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:40:48.705Z", + "description": "Timestamp representing the date and time when the order was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:47:20.760Z", + "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format." + }, + "status": { + "type": "string", + "description": "Order status.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULFILLED" + ] + }, + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "discount_amount": { + "type": "integer", + "description": "Sum of all order-level discounts applied to the order." + }, + "total_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`" + }, + "total_amount": { + "type": "integer", + "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" + }, + "applied_discount_amount": { + "type": "integer", + "description": "This field shows the order-level discount applied." + }, + "total_applied_discount_amount": { + "type": "integer", + "description": "This field sums up all order-level and all product-specific discounts applied in a particular request." + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", + "items": { "type": "object", - "description": "Amount discount type based on a formula.", "properties": { - "type": { - "type": "string", - "default": "AMOUNT", - "description": "Applies an amount discount." - }, - "effect": { + "object": { "type": "string", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS", - "APPLY_TO_ITEMS_PROPORTIONALLY", - "APPLY_TO_ITEMS_PROPORTIONALLY_BY_QUANTITY", - "APPLY_TO_ITEMS_BY_QUANTITY" - ], - "description": "Defines how the discount is applied to the customer's order." + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." }, - "is_dynamic": { - "type": "boolean", - "description": "Flag indicating whether the discount amount is based on a formula that dynamically calculates the discount.", - "enum": [ - true - ] - } - } - }, - "19_obj_voucher_object_discount_percentage": { - "title": "Percentage", - "type": "object", - "description": "Percentage discount type applied to an order (static or dynamic) or a percentage discount type applied to items (static).", - "properties": { - "type": { + "product_id": { "type": "string", - "default": "PERCENT", - "description": "Applies a percentage discount." + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, - "effect": { + "sku_id": { "type": "string", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS" - ], - "description": "Defines how the discount is applied to the customer's order." + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." }, - "percent_off": { + "quantity": { "type": "integer", - "description": "Percent taken off the subtotal amount. In case of the percent being calculated by the formula and applied to the order level, i.e. the `is_dynamic` parameter is `true`, this value becomes a dynamically calculated value that varies based on the formula.", - "minimum": 0, - "maximum": 100 + "description": "Quantity of the item in the cart." }, - "amount_limit": { - "type": "string", - "description": "Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600." + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." }, - "is_dynamic": { - "type": "boolean", - "description": "Flag indicating whether the discount percentage is based on a formula that dynamically calculates the discount.", - "enum": [ - false, - true - ] - } - } - }, - "19_obj_voucher_object_discount_percentage_dynamic": { - "title": "Dynamic Percentage for Items", - "type": "object", - "description": "Percentage discount type applied to items and based on a formula (dynamic).", - "properties": { - "type": { - "type": "string", - "default": "PERCENT", - "description": "Applies a percentage discount." + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS" - ], - "description": "Defines how the discount is applied to the customer's order." + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" }, - "amount_limit": { - "type": "string", - "description": "Upper limit allowed to be applied as a discount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $6 maximum discount is written as 600." + "product": { + "type": "object", + "description": "This object stores more information about the related product.", + "properties": { + "id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" + }, + "name": { + "type": "string", + "example": "Brewing System", + "description": "Product name." + }, + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } }, - "is_dynamic": { - "type": "boolean", - "description": "Flag indicating whether the discount percentage is based on a formula that dynamically calculates the discount.", - "enum": [ - true - ] + "sku": { + "type": "object", + "description": "This object stores more information about the related SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." + }, + "sku": { + "type": "string", + "description": "SKU name." + }, + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } } } - }, - "19_obj_voucher_object_discount_fixed_order": { - "title": "Fixed Order Amount", - "description": "Fixed discount type for an order.", + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "customer": { + "type": "object", + "description": "Object containing information about the customer that is making the purchase.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique customer ID of the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `customer` object." + } + } + }, + "referrer": { + "type": "object", + "description": "Object containing information about the referrer.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique referrer ID, who referred the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `referrer` object." + } + } + }, + "customer_id": { + "type": "string", + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" + }, + "referrer_id": { + "type": "string", + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + }, + "redemptions": { + "description": "Lists details related to the redemption.", + "$ref": "#/components/schemas/10_obj_order_object_unstacked_redemptions" + } + } + }, + "7_obj_order_object_apply_to_items": { + "type": "object", + "title": "Order object - Effect: Apply to items", + "description": "This is an object representing an order with calculated discounts applied using the voucher code.", + "properties": { + "id": { + "type": "string", + "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", + "description": "Unique order ID, assigned by Voucherify. " + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:40:48.705Z", + "description": "Timestamp representing the date and time when the order was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:47:20.760Z", + "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format." + }, + "status": { + "type": "string", + "description": "Order status.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULFILLED" + ] + }, + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "items_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" + }, + "total_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied to the order." + }, + "total_amount": { + "type": "integer", + "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" + }, + "items_applied_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied." + }, + "total_applied_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied to the order." + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", + "items": { "type": "object", "properties": { - "type": { + "object": { "type": "string", - "default": "FIXED", - "description": "Sets a fixed total on the cart and then calculates the discount to apply." + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." }, - "effect": { + "product_id": { "type": "string", - "enum": [ - "APPLY_TO_ORDER" - ], - "description": "\n| **Effect** | **Definition** |\n|:---|:---|\n| **APPLY_TO_ORDER** | Sets the order total amount to the value of the fixed amount. The discount value is calculated dynamically during the redemption as it's a difference between the total amount of the customer's order and the fixed amount. For example, if the fixed amount is set to equal $10 and the order amount equals $25, then the calculated discount will be $15. |" - }, - "fixed_amount": { - "type": "integer", - "description": "Set a fixed valued for an order total. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 discount is written as 1000.", - "example": 1000 + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, - "is_dynamic": { - "type": "boolean", - "description": "Flag indicating whether the fixed amount is based on a formula that dynamically calculates the fixed amount.", - "enum": [ - false, - true - ] - } - } - }, - "19_obj_voucher_object_discount_fixed_items": { - "title": "New Prices for Items", - "description": "Fixed discount type for item(s).", - "type": "object", - "properties": { - "type": { + "sku_id": { "type": "string", - "default": "FIXED", - "description": "Sets a new item price and then calculates the discount to apply." + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_ITEMS" - ], - "description": "\n| **Effect** | **Definition** |\n|:---|:---|\n| **APPLY_TO_ITEMS** | Sets a new price on items. The total discount amount is dynamically calculated during the redemption and it's a difference between the initial item price and the fixed amount. During the redemption, prices for items will change only if the new price is lower than the original price. If the new product price you set is different from the product price in a collection, then the new product price will be passed during the redemption. If a prodct is in more than one collection, the price is always changed to the lowest price. The new price for products with several SKUs will force the price change for SKUs if their original price is higher than the new price. |" + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." }, - "is_dynamic": { - "type": "boolean", - "description": "Flag defaults to false because each item price could be defined separately and either based on a formula that dynamically calculates the discount or based on a fixed set price.", - "enum": [ - false - ] - } - } - }, - "19_obj_voucher_object_discount_unit_one": { - "title": "Unit, single item", - "type": "object", - "description": "Single item type.", - "properties": { - "type": { - "type": "string", - "default": "UNIT", - "description": "Applies a full value discount to item(s)." + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." }, - "effect": { - "type": "string", - "enum": [ - "ADD_NEW_ITEMS", - "ADD_MISSING_ITEMS" - ], - "default": "ADD_MISSING_ITEMS", - "description": "Defines how the unit is added to the customer's order." + "discount_amount": { + "type": "integer", + "description": "The item-level discount applied to the item." }, - "unit_off": { - "type": "number", - "description": "Number of units to be granted a full value discount. ", - "example": 1, - "format": "float" + "applied_discount_amount": { + "type": "integer", + "description": "The item-level discount applied to the item." }, - "unit_type": { - "type": "string", - "description": "The product or SKU deemed as free, chosen from the product inventory (e.g. time, items), i.e. `sku_0a3efc90375d1217e2` or `prod_s3C0nDpr0DuC7`.", - "example": "prod_f1r5Tpr0DuC7" + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." }, - "sku": { + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" + }, + "product": { "type": "object", - "description": "Defines the product details of the product or the parent product in case of an SKU.", + "description": "This object stores more information about the related product.", "properties": { "id": { "type": "string", - "example": "sku_0a3efc90375d1217e2", - "description": "Unique SKU ID assigned by Voucherify." + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, "source_id": { "type": "string", - "description": "SKU source ID." + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" }, - "sku": { + "name": { "type": "string", - "description": "SKU name." + "example": "Brewing System", + "description": "Product name." + }, + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." } } }, - "product": { + "sku": { "type": "object", - "description": "Defines the product details of the product or the parent product in case of an SKU.", + "description": "This object stores more information about the related SKU.", "properties": { "id": { "type": "string", - "example": "prod_0bc3bd76a61082e6b3", - "description": "Unique (parent) product ID assigned by Voucherify." + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." }, "source_id": { "type": "string", - "description": "Product source ID." + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." }, - "name": { + "sku": { "type": "string", - "description": "Product name." + "description": "SKU name." + }, + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." } } - }, - "is_dynamic": { - "type": "boolean", - "description": "Flag indicating whether the number of items is based on a formula.", - "enum": [ - false, - true - ] } } - }, - "19_obj_voucher_object_discount_unit_multiple": { - "title": "Unit, multiple items", - "type": "object", - "description": "Multiple item types.", - "properties": { - "type": { - "type": "string", - "description": "Applies a full value discount to item(s).", - "default": "UNIT" - }, - "effect": { - "type": "string", - "default": "ADD_MANY_ITEMS", - "description": "Defines the effect for adding multiple item types." - }, - "units": { - "type": "array", - "description": "Array of objects defining items to be offered for free. Each item type can have a different discount effect assigned.", - "items": { - "type": "object", - "description": "Object defining a unit discount.", - "properties": { - "effect": { - "type": "string", - "enum": [ - "ADD_NEW_ITEMS", - "ADD_MISSING_ITEMS" - ], - "description": "Defines how the unit is added to the customer's order." - }, - "unit_off": { - "type": "integer", - "description": "Number of units to be granted a full value discount. In case of the unit being calculated by a formula, this value is the result of the dynamic calculation.", - "example": 1 - }, - "unit_type": { - "type": "string", - "description": "The product or SKU deemed as free, chosen from the product inventory (e.g. time, items), i.e. `prod_0bc3bd76a61082e6b3` or `sku_0a3efc90701d121820`.", - "example": "prod_f1r5Tpr0DuC7" - }, - "sku": { - "type": "object", - "description": "Defines the product details of the product or the parent product in case of an SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_0a3efc90375d1217e2", - "description": "Unique SKU ID assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "SKU source ID." - }, - "sku": { - "type": "string", - "description": "SKU name." - } - } - }, - "product": { - "type": "object", - "description": "Defines the product details of the product or the parent product in case of an SKU.", - "properties": { - "id": { - "type": "string", - "example": "prod_0bc3bd76a61082e6b3", - "description": "Unique (parent) product ID assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "Product source ID." - }, - "name": { - "type": "string", - "description": "Product name." - } - } - } - } - } - }, - "is_dynamic": { - "type": "boolean", - "description": "Flag indicating whether the number of items is based on a formula." - } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "customer": { + "type": "object", + "description": "Object containing information about the customer that is making the purchase.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique customer ID of the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `customer` object." } - }, - "19_obj_voucher_object_discount_shipping": { - "title": "Shipping", - "description": "Shipping discount type.", + } + }, + "referrer": { + "type": "object", + "description": "Object containing information about the referrer.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique referrer ID, who referred the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `referrer` object." + } + } + }, + "customer_id": { + "type": "string", + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" + }, + "referrer_id": { + "type": "string", + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + }, + "redemptions": { + "description": "Lists details related to the redemption.", + "$ref": "#/components/schemas/10_obj_order_object_unstacked_redemptions" + } + } + }, + "7_obj_order_object_stacked_redemptions": { + "type": "object", + "title": "Order", + "description": "This is an object representing an order with calculated discounts applied using the voucher code.", + "properties": { + "id": { + "type": "string", + "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", + "description": "Unique order ID, assigned by Voucherify. " + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:40:48.705Z", + "description": "Timestamp representing the date and time when the order was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-06T11:47:20.760Z", + "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format." + }, + "status": { + "type": "string", + "description": "Order status.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULFILLED" + ] + }, + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "discount_amount": { + "type": "integer", + "description": "Sum of all order-level discounts applied to the order." + }, + "items_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" + }, + "total_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`" + }, + "total_amount": { + "type": "integer", + "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" + }, + "applied_discount_amount": { + "type": "integer", + "description": "This field shows the sum of all order-level discounts applied." + }, + "items_applied_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied.\n`sum(items, i => i.applied_discount_amount)`" + }, + "total_applied_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied to the order.\n`total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount`" + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", + "items": { "type": "object", "properties": { - "type": { + "object": { "type": "string", - "default": "UNIT", - "description": "Applies a full value discount to item(s)." + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." }, - "effect": { + "product_id": { "type": "string", - "description": "Defines how the unit is added to the customer's order.", - "default": "ADD_MISSING_ITEMS" - }, - "unit_off": { - "type": "number", - "format": "float", - "description": "Subtracts 1 shipping item from the subtotal.", - "default": 1 + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, - "unit_type": { + "sku_id": { "type": "string", - "description": "The shipping product deemed as free.", - "default": "prod_5h1pp1ng" - }, - "product": { - "type": "object", - "description": "Defines the product details of the shipping product.", - "properties": { - "id": { - "type": "string", - "example": "prod_5h1pp1ng", - "description": "Unique product ID assigned by Voucherify, i.e. `prod_5h1pp1ng`.", - "default": "prod_5h1pp1ng" - }, - "source_id": { - "type": "string", - "description": "Product source ID.", - "default": "5h1pp1ng", - "example": "5h1pp1ng" - }, - "name": { - "type": "string", - "description": "Product name.", - "example": "Shipping", - "default": "Shipping" - } - } - }, - "is_dynamic": { - "type": "boolean", - "description": "Flag indicating whether the number of shipping items is based on a formula.", - "default": false, - "enum": [ - false - ] - } - } - }, - "19_obj_validations-true_result_gift_card": { - "type": "object", - "title": "Gift Card", - "description": "This is a `result` object representing the results for a gift card.", - "properties": { - "gift": { - "description": "Stores the amount of gift card credits to be applied in the redemption.", - "type": "object", - "properties": { - "credits": { - "type": "integer", - "description": "Total number of gift card credits to be applied in the redemption expressed as the smallest currency unit (that is, 100 cents for $1.00)." - } - } - } - } - }, - "19_obj_validations-true_result_loyalty_card": { - "type": "object", - "title": "Loyalty Card", - "description": "This is a `result` object representing the results for a loyalty card.", - "properties": { - "loyalty_card": { - "description": "Stores the amount of loyalty card points to be applied in the redemption.", - "type": "object", - "properties": { - "points": { - "type": "integer", - "description": "Total number of loyalty points to be applied in the redemption." - } - } - } - } - }, - "19_obj_validations-true_result_promotion_tier": { - "type": "object", - "title": "Promotion Tier", - "description": "This is a `result` object representing the results for a promotion tier.", - "properties": { - "discount": { - "description": "Discount details about the type of discount to be applied for the redeemable.", - "oneOf": [ - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" - } - ] - } - } - }, - "19_obj_validations-true_result_promotion_stack": { - "type": "object", - "title": "Promotion Stack", - "description": "This is a `result` object representing the results for a promotion stack.", - "properties": { - "loyalty_card": { - "description": "Stores the amount of loyalty card points to be applied in the redemption.", - "type": "object", - "properties": { - "points": { - "type": "integer", - "description": "Total number of loyalty points to be applied in the redemption." - } - } - } - } - }, - "19_obj_order_object_validation_res": { - "type": "object", - "title": "Order", - "description": "Contains the combined effect of all redeemables taken into account on the order object properties.", - "properties": { - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "discount_amount": { - "type": "integer", - "description": "Sum of all order-level discounts applied to the order. \n`sum(redeemables.order.applied_discount_amount)`" - }, - "items_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" - }, - "total_discount_amount": { - "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`\t" - }, - "total_amount": { - "type": "integer", - "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" - }, - "applied_discount_amount": { - "type": "integer", - "description": "Sum of all order-level discounts applied in a particular request. \n`sum(redeemables.order.applied_discount_amount)`" - }, - "items_applied_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied in a particular request. \n`sum(items, i => i.applied_discount_amount)`" + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." }, - "total_applied_discount_amount": { + "quantity": { "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied in a particular request. \n`total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount`" - }, - "items": { - "type": "array", - "description": "Array of order items showing the effects of particular discounts on the item-level.", - "items": { - "type": "object", - "properties": { - "object": { - "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." - }, - "product_id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "sku_id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`applied_discount_amount`" - }, - "product": { - "type": "object", - "description": "This object stores more information about the related product.", - "properties": { - "id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" - }, - "name": { - "type": "string", - "example": "Brewing System", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - }, - "sku": { - "type": "object", - "description": "This object stores more information about the related SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." - }, - "sku": { - "type": "string", - "description": "SKU name." - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - } - } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "customer_id": { - "type": "null" - }, - "referrer_id": { - "type": "null" + "description": "Quantity of the item in the cart." }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - } - } - }, - "19_obj_order_object_validation_res_per_redeemable": { - "type": "object", - "title": "Order", - "description": "Contains the effect of each redeemable on the order and specific cart items. The amounts are consecutively built on the previous redeemable's effects, such that for each redeemable, the amounts are further reduced by the redeemable. The sequence in the request body is important because that will be the sequence the redeemables are applied one on top of the other.", - "properties": { "amount": { "type": "integer", - "description": "Order amount before applying any discount." + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." }, "discount_amount": { "type": "integer", - "description": "Sum of all order-level discounts applied to the order. \n`sum(redeemables.order.applied_discount_amount)`" - }, - "items_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" - }, - "total_discount_amount": { - "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`\t" - }, - "total_amount": { - "type": "integer", - "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" + "description": "The item-level discount applied to the item." }, "applied_discount_amount": { "type": "integer", - "description": "Sum of all order-level discounts applied in a particular request. \n`sum(redeemables.order.applied_discount_amount)`" + "description": "The item-level discount applied to the item." }, - "items_applied_discount_amount": { + "price": { "type": "integer", - "description": "Sum of all product-specific discounts applied in a particular request. \n`sum(items, i => i.applied_discount_amount)`" + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." }, - "total_applied_discount_amount": { + "subtotal_amount": { "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied in a particular request. \n`total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount`" - }, - "items": { - "type": "array", - "description": "Array of order items showing the effects of particular discounts on the item-level.", - "items": { - "type": "object", - "properties": { - "object": { - "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." - }, - "product_id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "sku_id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`applied_discount_amount`" - }, - "product": { - "type": "object", - "description": "This object stores more information about the related product.", - "properties": { - "id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" - }, - "name": { - "type": "string", - "example": "Brewing System", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - }, - "sku": { - "type": "object", - "description": "This object stores more information about the related SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." - }, - "sku": { - "type": "string", - "description": "SKU name." - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - } - } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "customer_id": { - "type": "null" - }, - "referrer_id": { - "type": "null" - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - } - } - }, - "19_res_redemptions_parentRedemptionId_rollbacks": { - "type": "object", - "properties": { - "rollbacks": { - "type": "array", - "description": "Contains the rollback redemption objects of the particular incentives.", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/19_obj_redemption_rollback_object_discount_voucher_stacked" - }, - { - "$ref": "#/components/schemas/19_obj_redemption_rollback_object_loyalty_card_stacked" - }, - { - "$ref": "#/components/schemas/19_obj_redemption_rollback_object_gift_card_stacked" - }, - { - "$ref": "#/components/schemas/19_obj_redemption_rollback_object_promotion_tier_stacked" - } - ] - } + "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" }, - "parent_rollback": { + "product": { "type": "object", + "description": "This object stores more information about the related product.", "properties": { "id": { "type": "string", - "example": "rr_0c675efbc2039b83b3", - "description": "Unique redemption rollback ID." - }, - "customer_id": { - "type": "string", - "example": "cust_QszL0PS1NekVjQaHGxrbpPHu", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "description": "Hashed customer source ID.", - "example": "track_fxEMFisanb4sbl4Z4yCn" + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, - "date": { + "source_id": { "type": "string", - "format": "date-time", - "example": "2023-02-03T09:12:22.536Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "order": { - "type": "object", - "properties": { - "id": { - "type": "string", - "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", - "description": "Unique order ID, assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - }, - "status": { - "type": "string", - "description": "Order status.", - "enum": [ - "CANCELED" - ] - }, - "customer_id": { - "type": "string", - "description": "Unique customer ID of the customer making the purchase.", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" - }, - "referrer_id": { - "type": "string", - "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "description": "Unique referrer ID." - }, - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "total_amount": { - "type": "integer", - "description": "Order amount after undoing all the discounts through the rollback redemption." - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order.", - "items": { - "type": "object", - "properties": { - "object": { - "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." - }, - "product_id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "sku_id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the removing an item-level discount." - }, - "product": { - "type": "object", - "description": "This object stores more information about the related product.", - "properties": { - "id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" - }, - "name": { - "type": "string", - "example": "Brewing System", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - }, - "sku": { - "type": "object", - "description": "This object stores more information about the related SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." - }, - "sku": { - "type": "string", - "description": "SKU name." - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - } - } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" }, - "result": { + "name": { "type": "string", - "description": "Redemption rollback result", - "enum": [ - "SUCCESS" - ] + "example": "Brewing System", + "description": "Product name." }, - "redemption": { - "type": "string", - "example": "r_0c656311b5878a2031", - "description": "Unique redemption ID of the initial redemption." + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." } } }, - "order": { - "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked" - } - }, - "description": "Response body schema for POST `/redemptions/{parentRedemptionID}/rollbacks`.", - "title": "Rollback Stackable Redemptions Response Body" - }, - "19_obj_redemption_rollback_object_discount_voucher_stacked": { - "type": "object", - "title": "Rollback Discount Voucher", - "description": "This is an object representing a redemption rollback for a discount voucher.", - "properties": { - "id": { - "type": "string", - "example": "rr_0c5eba630bc4979e70", - "description": "Unique redemption rollback ID." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "anyOf": [ - { - "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_order" - }, - { - "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_items" - } - ] - }, - "customer": { + "sku": { "type": "object", - "description": "Defines the customer that is related to the redemption.", + "description": "This object stores more information about the related SKU.", "properties": { "id": { "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." }, "source_id": { "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "voucher": { - "type": "object", - "description": "Defines the details of the voucher.", - "properties": { - "id": { - "type": "string", - "description": "Unique voucher ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "discount": { - "oneOf": [ - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_amount" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_percentage" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_fixed" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_one" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_unit_multiple" - }, - { - "$ref": "#/components/schemas/1_obj_voucher_object_discount_shipping" - } - ] - }, - "type": { - "type": "string", - "description": "Indicates the voucher type.", - "enum": [ - "DISCOUNT_VOUCHER" - ] - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "description": "Unique campaign ID assigned by Voucherify.", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - }, - "is_referral_code": { - "type": "boolean", - "description": "Flag indicating whether this voucher is a referral code." - } - } - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the original redemption." - } - } - }, - "19_obj_redemption_rollback_object_loyalty_card_stacked": { - "type": "object", - "title": "Rollback Loyalty Card Voucher", - "description": "This is an object representing a redemption rollback for a loyalty card.", - "properties": { - "id": { - "type": "string", - "example": "rr_0c5eaf4060133bf784", - "description": "Unique redemption rollback ID." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "amount": { - "type": "integer", - "description": "Number of points being returned to the loyalty card." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "anyOf": [ - { - "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_order" - }, - { - "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_items" - } - ] - }, - "reward": { - "description": "Defines the reward that was initially redeemed.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" - } - ] - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the reward.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "voucher": { - "type": "object", - "description": "Defines the details of the voucher.", - "properties": { - "id": { - "type": "string", - "description": "Unique voucher ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "loyalty_card": { - "type": "object", - "description": "Stores the number of points being added back to the loyalty card for the reward redemption rollback.", - "properties": { - "points": { - "type": "integer", - "example": 7000, - "description": "Total points incurred over lifespan of loyalty card." - }, - "balance": { - "type": "integer", - "example": 6970, - "description": "Points available for reward redemption after the redemption rollback." - } - } - }, - "type": { - "type": "string", - "description": "Indicates the voucher type.", - "enum": [ - "LOYALTY_CARD" - ] - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { + "sku": { "type": "string", - "description": "Unique campaign ID assigned by Voucherify.", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - }, - "is_referral_code": { - "type": "boolean", - "description": "Flag indicating whether this voucher is a referral code." + "description": "SKU name." }, - "holder_id": { - "type": "string", - "description": "Unique customer ID of the loyalty card owner.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." } } - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the original redemption." } } - }, - "19_obj_redemption_rollback_object_gift_card_stacked": { - "type": "object", - "title": "Rollback Gift Card", - "description": "This is an object representing a gift card redemption rollback.", - "properties": { - "id": { - "type": "string", - "example": "rr_0bc92f81a6801f9bca", - "description": "Unique redemption rollback ID." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "amount": { - "type": "integer", - "description": "The amount added back to the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "anyOf": [ - { - "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_order" - }, - { - "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_items" - } - ] - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the gift card.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "voucher": { - "type": "object", - "description": "Defines the details of the voucher.", - "properties": { - "id": { - "type": "string", - "description": "Unique voucher ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "gift": { - "type": "object", - "description": "Contains the balance of the gift card after credits are added back to the gift card for the redemption rollback.", - "properties": { - "amount": { - "type": "integer", - "example": 10000, - "description": "Total gift card income over the lifetime of the card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "balance": { - "type": "integer", - "example": 500, - "description": "Available funds after the redemption rollback credits back the amount used up during the initial redemption. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_ORDER", - "APPLY_TO_ITEMS" - ], - "description": "Defines how the credits are applied to the customer's order." - } - } - }, - "type": { - "type": "string", - "description": "Indicates the voucher type.", - "enum": [ - "GIFT_VOUCHER" - ] - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "description": "Unique campaign ID assigned by Voucherify.", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - }, - "is_referral_code": { - "type": "boolean", - "description": "Flag indicating whether this voucher is a referral code." - } - } - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the initial redemption.", - "example": "r_0c5bf3323008a35032" - } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." + }, + "customer": { + "type": "object", + "description": "Object containing information about the customer that is making the purchase.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique customer ID of the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `customer` object." } - }, - "19_obj_redemption_rollback_object_promotion_tier_stacked": { - "type": "object", - "title": "Promotion Tier", - "description": "This is an object representing a promotion tier redemption rollback", - "properties": { - "id": { - "type": "string", - "example": "rr_0bc92f81a6801f9bca", - "description": "Unique redemption rollback ID." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "anyOf": [ - { - "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_order" - }, - { - "$ref": "#/components/schemas/19_obj_order_object_rollback_stacked_per_redemption_apply_to_items" - } - ] - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "promotion_tier": { - "type": "object", - "description": "Contains details of the promotion tier and the parent campaign.", - "properties": { - "id": { - "type": "string", - "description": "Unique promotion tier ID assigned by Voucherify.", - "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" - }, - "name": { - "type": "string", - "description": "Promotion tier name." - }, - "banner": { - "type": "string", - "description": "Text to be displayed to your customers on your website." - }, - "campaign": { - "type": "object", - "description": "Promotion tier's parent campaign.", - "properties": { - "id": { - "type": "string", - "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." - } - } - } - } - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of initial redemption." - } + } + }, + "referrer": { + "type": "object", + "description": "Object containing information about the referrer.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique referrer ID, who referred the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `referrer` object." } - }, - "19_res_redemptions_POST": { - "type": "object", - "title": "Stackable Redemptions Response Body", - "description": "Response body schema for POST `/redemptions`.", - "properties": { - "redemptions": { - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_discount_voucher_extended_stacked" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_extended_stacked" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_gift_card_extended_stacked" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_promotion_tier_extended_stacked" - } - ] - } - }, - "parent_redemption": { - "type": "object", - "title": "Stacked Redemption", - "description": "This is an object representing a stacked redemption.", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object_stacked_redemptions" - }, - "customer": { - "type": "object", - "description": "Defines the customer making the stacked redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.", - "enum": [ - "redemption" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. r_0c5d07222e08a34ace for a redemption." - }, - "voucher": { - "type": "null" - } - } - }, - "order": { - "description": "Contains the order details associated with the redemption.", - "$ref": "#/components/schemas/7_obj_order_object_stacked_redemptions" - } + } + }, + "customer_id": { + "type": "string", + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" + }, + "referrer_id": { + "type": "string", + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + }, + "redemptions": { + "description": "Lists details related to the redemption", + "$ref": "#/components/schemas/10_obj_order_object_stacked_redemptions" + } + } + }, + "7_obj_redemption_object": { + "title": "Redemption Object", + "description": "This is an object representing a redemption. \n\nRedemption 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 an operation a [redemption rollback](ref:rollback-redemption).", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_discount_voucher" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_gift_card" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_promotion_tier" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_stackable_discounts" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_voucher_fail" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_promotion_tier_fail" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_fail" + } + ] + }, + "7_obj_redemption_object_voucher": { + "title": "Redemption Object", + "description": "This is an object representing an attempted or successful voucher redemption.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_discount_voucher" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_gift_card" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_voucher_fail" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_rollback_object_discount_voucher" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_rollback_object_gift_card" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_rollback_object_loyalty_card" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_rollback_object_voucher_fail" + } + ] + }, + "7_obj_redemption_object_voucher_extended": { + "title": "Redemption Object", + "description": "This is an object representing an attempted or successful voucher redemption.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_discount_voucher_extended" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_extended" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_gift_card_extended" + } + ] + }, + "7_obj_redemption_object_discount_voucher_extended": { + "type": "object", + "title": "Discount Voucher", + "description": "This is an object representing a redemption. \n\nRedemption 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](rollback-redemption).", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } - }, - "7_obj_order_object_rollback": { - "title": "Order object", - "description": "This is an object representing an order that was rolled back.", - "properties": { - "id": { - "type": "string", - "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", - "description": "Unique order ID, assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:40:48.705Z", - "description": "Timestamp representing the date and time when the order was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:47:20.760Z", - "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format." - }, - "status": { - "type": "string", - "description": "Order status.", - "enum": [ - "CANCELED" - ] - }, - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "total_amount": { - "type": "integer", - "description": "Order amount after undoing all the discounts through the rollback redemption." - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order.", - "items": { - "type": "object", - "properties": { - "object": { - "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." - }, - "product_id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "sku_id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the removing an item-level discount." - }, - "product": { - "type": "object", - "description": "This object stores more information about the related product.", - "properties": { - "id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" - }, - "name": { - "type": "string", - "example": "Brewing System", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - }, - "sku": { - "type": "object", - "description": "This object stores more information about the related SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." - }, - "sku": { - "type": "string", - "description": "SKU name." - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - } - } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "customer": { - "type": "object", - "description": "Object containing information about the customer that is making the purchase.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique customer ID of the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `customer` object." - } - } - }, - "referrer": { - "type": "object", - "description": "Object containing information about the referrer.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique referrer ID, who referred the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `referrer` object." - } - } - }, - "customer_id": { - "type": "string", - "description": "Unique customer ID of the customer making the purchase.", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" - }, - "referrer_id": { - "type": "string", - "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "description": "Unique referrer ID." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - }, - "redemptions": { - "description": "Lists details related to the redemption and redemption rollback.", - "properties": { - "redemption_ID": { - "type": "object", - "description": "The property name is the unique redemption ID; i.e. `r_0ba186c4824e4881e1`. This object contains information about the redemption of an incentive.", - "properties": { - "date": { - "type": "string", - "description": "Timestamp representing the date and time when the redemption was created in ISO 8601 format.", - "example": "2022-09-02T17:06:56.649Z", - "format": "date-time" - }, - "rollback_id": { - "type": "string", - "description": "Unique ID of the redemption rollback.", - "example": "rr_0c63c84eb78ee0a6c0" - }, - "rollback_date": { - "type": "string", - "description": "Timestamp representing the date and tiem when the redemption rollback was created in ISO 8601 format.", - "example": "2023-01-31T14:18:37.150Z", - "format": "date-time" - }, - "related_object_type": { - "type": "string", - "description": "The source of the incentive.", - "enum": [ - "voucher", - "promotion_tier" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique ID of the related object that defines the incentive." - }, - "related_object_parent_id": { - "type": "string", - "description": "Represent's the campaign ID of the voucher if the redemption was based on a voucher that was part of bulk codes generated within a campaign." - } - } - } - } - } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" } - }, - "7_obj_order_object": { - "title": "Order object", - "description": "This is an object representing an order with calculated discounts applied using the voucher code.", - "oneOf": [ - { - "$ref": "#/components/schemas/7_obj_order_object_apply_to_order" - }, - { - "$ref": "#/components/schemas/7_obj_order_object_apply_to_items" - } - ] - }, - "7_obj_order_object_apply_to_order": { - "type": "object", - "title": "Order object - Effect: Apply to order", - "description": "This is an object representing an order with calculated discounts applied using the voucher code.", - "properties": { - "id": { - "type": "string", - "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", - "description": "Unique order ID, assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:40:48.705Z", - "description": "Timestamp representing the date and time when the order was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:47:20.760Z", - "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format." - }, - "status": { - "type": "string", - "description": "Order status.", - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULFILLED" - ] - }, - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "discount_amount": { - "type": "integer", - "description": "Sum of all order-level discounts applied to the order." - }, - "total_discount_amount": { - "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`" - }, - "total_amount": { - "type": "integer", - "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" - }, - "applied_discount_amount": { - "type": "integer", - "description": "This field shows the order-level discount applied." - }, - "total_applied_discount_amount": { - "type": "integer", - "description": "This field sums up all order-level and all product-specific discounts applied in a particular request." - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", - "items": { - "type": "object", - "properties": { - "object": { - "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." - }, - "product_id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "sku_id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" - }, - "product": { - "type": "object", - "description": "This object stores more information about the related product.", - "properties": { - "id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" - }, - "name": { - "type": "string", - "example": "Brewing System", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - }, - "sku": { - "type": "object", - "description": "This object stores more information about the related SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." - }, - "sku": { - "type": "string", - "description": "SKU name." - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - } - } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "customer": { - "type": "object", - "description": "Object containing information about the customer that is making the purchase.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique customer ID of the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `customer` object." - } - } - }, - "referrer": { - "type": "object", - "description": "Object containing information about the referrer.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique referrer ID, who referred the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `referrer` object." - } - } - }, - "customer_id": { - "type": "string", - "description": "Unique customer ID of the customer making the purchase.", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" - }, - "referrer_id": { - "type": "string", - "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "description": "Unique referrer ID." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - }, - "redemptions": { - "description": "Lists details related to the redemption.", - "$ref": "#/components/schemas/10_obj_order_object_unstacked_redemptions" - } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Defines the details of the voucher being redeemed." + } + } + }, + "7_obj_redemption_object_discount_voucher_extended_stacked": { + "type": "object", + "title": "Discount Voucher", + "description": "This is an object representing a redemption.", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the parent redemption.", + "example": "r_0c656311b5878a2031" + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } - }, - "7_obj_order_object_apply_to_items": { - "type": "object", - "title": "Order object - Effect: Apply to items", - "description": "This is an object representing an order with calculated discounts applied using the voucher code.", - "properties": { - "id": { - "type": "string", - "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", - "description": "Unique order ID, assigned by Voucherify. " - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:40:48.705Z", - "description": "Timestamp representing the date and time when the order was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:47:20.760Z", - "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format." - }, - "status": { - "type": "string", - "description": "Order status.", - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULFILLED" - ] - }, - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "items_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" - }, - "total_discount_amount": { - "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied to the order." - }, - "total_amount": { - "type": "integer", - "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" - }, - "items_applied_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied." - }, - "total_applied_discount_amount": { - "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied to the order." - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", - "items": { - "type": "object", - "properties": { - "object": { - "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." - }, - "product_id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "sku_id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." - }, - "discount_amount": { - "type": "integer", - "description": "The item-level discount applied to the item." - }, - "applied_discount_amount": { - "type": "integer", - "description": "The item-level discount applied to the item." - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" - }, - "product": { - "type": "object", - "description": "This object stores more information about the related product.", - "properties": { - "id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" - }, - "name": { - "type": "string", - "example": "Brewing System", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - }, - "sku": { - "type": "object", - "description": "This object stores more information about the related SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." - }, - "sku": { - "type": "string", - "description": "SKU name." - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - } - } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "customer": { - "type": "object", - "description": "Object containing information about the customer that is making the purchase.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique customer ID of the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `customer` object." - } - } - }, - "referrer": { - "type": "object", - "description": "Object containing information about the referrer.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique referrer ID, who referred the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `referrer` object." - } - } - }, - "customer_id": { - "type": "string", - "description": "Unique customer ID of the customer making the purchase.", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" - }, - "referrer_id": { - "type": "string", - "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "description": "Unique referrer ID." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - }, - "redemptions": { - "description": "Lists details related to the redemption.", - "$ref": "#/components/schemas/10_obj_order_object_unstacked_redemptions" - } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" } - }, - "7_obj_order_object_stacked_redemptions": { - "type": "object", - "title": "Order", - "description": "This is an object representing an order with calculated discounts applied using the voucher code.", - "properties": { - "id": { - "type": "string", - "example": "ord_OLWs41pBk7VFn6ZTyX9U6keh", - "description": "Unique order ID, assigned by Voucherify. " - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:40:48.705Z", - "description": "Timestamp representing the date and time when the order was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-06T11:47:20.760Z", - "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format." - }, - "status": { - "type": "string", - "description": "Order status.", - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULFILLED" - ] - }, - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "discount_amount": { - "type": "integer", - "description": "Sum of all order-level discounts applied to the order." - }, - "items_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" - }, - "total_discount_amount": { - "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`" - }, - "total_amount": { - "type": "integer", - "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" - }, - "applied_discount_amount": { - "type": "integer", - "description": "This field shows the sum of all order-level discounts applied." - }, - "items_applied_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied.\n`sum(items, i => i.applied_discount_amount)`" - }, - "total_applied_discount_amount": { - "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied to the order.\n`total_applied_discount_amount` = `applied_discount_amount` + `items_applied_discount_amount`" - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", - "items": { - "type": "object", - "properties": { - "object": { - "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." - }, - "product_id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "sku_id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." - }, - "discount_amount": { - "type": "integer", - "description": "The item-level discount applied to the item." - }, - "applied_discount_amount": { - "type": "integer", - "description": "The item-level discount applied to the item." - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" - }, - "product": { - "type": "object", - "description": "This object stores more information about the related product.", - "properties": { - "id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" - }, - "name": { - "type": "string", - "example": "Brewing System", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - }, - "sku": { - "type": "object", - "description": "This object stores more information about the related SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." - }, - "sku": { - "type": "string", - "description": "SKU name." - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - } - } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are att to an order object. Stores additional information about the order in a structured format." - }, - "customer": { - "type": "object", - "description": "Object containing information about the customer that is making the purchase.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique customer ID of the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `customer` object." - } - } - }, - "referrer": { - "type": "object", - "description": "Object containing information about the referrer.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique referrer ID, who referred the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `referrer` object." - } - } - }, - "customer_id": { - "type": "string", - "description": "Unique customer ID of the customer making the purchase.", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" - }, - "referrer_id": { - "type": "string", - "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "description": "Unique referrer ID." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - }, - "redemptions": { - "description": "Lists details related to the redemption", - "$ref": "#/components/schemas/10_obj_order_object_stacked_redemptions" - } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Defines the details of the voucher being redeemed." + } + } + }, + "7_obj_redemption_object_loyalty_card_extended": { + "type": "object", + "title": "Loyalty Card Voucher", + "description": "This is an object representing a redemption. \n\nRedemption 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](rollback-redemption).", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the redemption.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "amount": { + "type": "integer", + "description": "Number of points being redeemed for a reward." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } - }, - "7_obj_redemption_object": { - "title": "Redemption Object", - "description": "This is an object representing a redemption. \n\nRedemption 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 an operation a [redemption rollback](ref:rollback-redemption).", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_discount_voucher" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_gift_card" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_promotion_tier" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_stackable_discounts" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_voucher_fail" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_promotion_tier_fail" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_fail" - } - ] - }, - "7_obj_redemption_object_voucher": { - "title": "Redemption Object", - "description": "This is an object representing an attempted or successful voucher redemption.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_discount_voucher" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_gift_card" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_voucher_fail" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_rollback_object_discount_voucher" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_rollback_object_gift_card" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_rollback_object_loyalty_card" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_rollback_object_voucher_fail" - } - ] - }, - "7_obj_redemption_object_voucher_extended": { - "title": "Redemption Object", - "description": "This is an object representing an attempted or successful voucher redemption.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_discount_voucher_extended" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_extended" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_gift_card_extended" - } - ] - }, - "7_obj_redemption_object_discount_voucher_extended": { - "type": "object", - "title": "Discount Voucher", - "description": "This is an object representing a redemption. \n\nRedemption 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](rollback-redemption).", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Defines the details of the voucher being redeemed." - } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the reward.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" } - }, - "7_obj_redemption_object_discount_voucher_extended_stacked": { - "type": "object", - "title": "Discount Voucher", - "description": "This is an object representing a redemption.", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the parent redemption.", - "example": "r_0c656311b5878a2031" - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Defines the details of the voucher being redeemed." - } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object. i.e. `voucher`.", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Defines the details of the voucher being redeemed." + }, + "reward": { + "description": "Defines the reward being redeemed.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" } - }, - "7_obj_redemption_object_loyalty_card_extended": { - "type": "object", - "title": "Loyalty Card Voucher", - "description": "This is an object representing a redemption. \n\nRedemption 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](rollback-redemption).", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the redemption.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "amount": { - "type": "integer", - "description": "Number of points being redeemed for a reward." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the reward.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object. i.e. `voucher`.", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Defines the details of the voucher being redeemed." - }, - "reward": { - "description": "Defines the reward being redeemed.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" - } - ] - }, - "loyalty_card": { - "type": "object", - "description": "Stores the number of points being subtracted from the loyalty card for the reward redemption.", - "properties": { - "points": { - "type": "integer", - "description": "Number of points being subtracted from the loyalty card for the reward redemption." - } - } - } + ] + }, + "loyalty_card": { + "type": "object", + "description": "Stores the number of points being subtracted from the loyalty card for the reward redemption.", + "properties": { + "points": { + "type": "integer", + "description": "Number of points being subtracted from the loyalty card for the reward redemption." } - }, - "7_obj_redemption_object_loyalty_card_extended_stacked": { - "type": "object", - "title": "Loyalty Card Voucher", - "description": "This is an object representing a redemption.", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the redemption.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "amount": { - "type": "integer", - "description": "Number of points being redeemed for a reward." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the parent redemption.", - "example": "r_0c656311b5878a2031" - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the reward.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object. i.e. `voucher`.", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Defines the details of the voucher being redeemed." - }, - "reward": { - "description": "Defines the reward being redeemed.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" - } - ] - }, - "loyalty_card": { - "type": "object", - "description": "Stores the number of points being subtracted from the loyalty card for the reward redemption.", - "properties": { - "points": { - "type": "integer", - "description": "Number of points being subtracted from the loyalty card for the reward redemption." - } - } - } + } + } + } + }, + "7_obj_redemption_object_loyalty_card_extended_stacked": { + "type": "object", + "title": "Loyalty Card Voucher", + "description": "This is an object representing a redemption.", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the redemption.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "amount": { + "type": "integer", + "description": "Number of points being redeemed for a reward." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the parent redemption.", + "example": "r_0c656311b5878a2031" + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } - }, - "7_obj_redemption_object_gift_card_extended": { - "type": "object", - "title": "Gift Card", - "description": "This is an object representing a gift card redemption.", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "amount": { - "type": "integer", - "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the gift card.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Defines the details of the voucher being redeemed." - }, - "gift": { - "type": "object", - "description": "Contains the amount being subtracted from the gift card for the redemption.", - "properties": { - "amount": { - "type": "integer", - "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." - } - } - } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the reward.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" } - }, - "7_obj_redemption_object_gift_card_extended_stacked": { - "type": "object", - "title": "Gift Card", - "description": "This is an object representing a gift card redemption.", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "amount": { - "type": "integer", - "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the parent redemption.", - "example": "r_0c656311b5878a2031" - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the gift card.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Defines the details of the voucher being redeemed." - }, - "gift": { - "type": "object", - "description": "Contains the amount being subtracted from the gift card for the redemption.", - "properties": { - "amount": { - "type": "integer", - "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." - } - } - } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object. i.e. `voucher`.", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Defines the details of the voucher being redeemed." + }, + "reward": { + "description": "Defines the reward being redeemed.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" } - }, - "7_obj_rollback_redemption_object_truncated": { - "title": "Rollback Redemption Object", - "description": "This is an object representing an attempted or successful voucher or promotion tier rollback.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_rollback_object_discount_voucher" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_rollback_object_loyalty_card" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_rollback_object_gift_card" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_rollback_object_promotion_tier" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_rollback_object_voucher_fail" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_rollback_object_promotion_tier_fail" - } - ] - }, - "7_obj_rollback_redemption_object_extended": { - "title": "Rollback Redemption Object", - "description": "This is an object representing an attempted or successful voucher or promotion tier rollback.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_rollback_redemption_object_discount_voucher_extended" - }, - { - "$ref": "#/components/schemas/7_obj_rollback_redemption_object_loyalty_card_extended" - }, - { - "$ref": "#/components/schemas/7_obj_rollback_redemption_object_gift_card_extended" - }, - { - "$ref": "#/components/schemas/7_obj_rollback_redemption_object_promotion_tier_extended" - } - ] - }, - "7_obj_rollback_redemption_object_discount_voucher_extended": { - "type": "object", - "title": "Discount Voucher", - "description": "This is an object representing a redemption.", - "properties": { - "id": { - "type": "string", - "example": "rr_0bc92f81a6801f9bca", - "description": "Unique rollback redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", - "default": "redemption_rollback" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "redemption": { - "type": "string", - "description": "The unique redemption ID of the initial redemption.", - "example": "r_0c5d6689b35320059a" - }, - "reason": { - "type": "string", - "description": "The reason for the redemption rollback." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "$ref": "#/components/schemas/7_obj_order_object_rollback" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption rollback was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Defines the details of the voucher being redeemed." - } + ] + }, + "loyalty_card": { + "type": "object", + "description": "Stores the number of points being subtracted from the loyalty card for the reward redemption.", + "properties": { + "points": { + "type": "integer", + "description": "Number of points being subtracted from the loyalty card for the reward redemption." } - }, - "7_obj_rollback_redemption_object_loyalty_card_extended": { - "type": "object", - "title": "Loyalty Card Voucher", - "description": "This is an object representing a loyalty card rollback redemption.", - "properties": { - "id": { - "type": "string", - "example": "rr_0bc92f81a6801f9bca", - "description": "Unique redemption rollback ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", - "default": "redemption_rollback" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "amount": { - "type": "integer", - "description": "Number of points being returned to the loyalty card." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the initial redemption.", - "example": "r_0b56726b09cfb73e84" - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "$ref": "#/components/schemas/7_obj_order_object_rollback" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption rollback was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the reward.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object. i.e. `voucher`.", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Defines the details of the voucher being redeemed." - }, - "reward": { - "description": "Defines the reward being redeemed.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" - } - ] - }, - "loyalty_card": { - "type": "object", - "description": "Stores the number of points being added back to the loyalty card for the reward redemption rollback.", - "properties": { - "points": { - "type": "integer", - "description": "Number of points being returned to the loyalty card for the reward redemption rollback." - } - } - } + } + } + } + }, + "7_obj_redemption_object_gift_card_extended": { + "type": "object", + "title": "Gift Card", + "description": "This is an object representing a gift card redemption.", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "amount": { + "type": "integer", + "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } - }, - "7_obj_rollback_redemption_object_gift_card_extended": { - "type": "object", - "title": "Gift Card", - "description": "This is an object representing a gift card rollback redemption.", - "properties": { - "id": { - "type": "string", - "example": "rr_0bc92f81a6801f9bca", - "description": "Unique redemption rollback ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", - "default": "redemption_rollback" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "amount": { - "type": "integer", - "description": "The amount credited back to the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the initial redemption.", - "example": "r_0b56726b09cfb73e84" - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "$ref": "#/components/schemas/7_obj_order_object_rollback" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption rollback was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the gift card.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Defines the details of the voucher being redeemed." - }, - "gift": { - "type": "object", - "description": "Contains the amount being added back to the gift card for the redemption rollback.", - "properties": { - "amount": { - "type": "integer", - "description": "The amount added back on the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." - } - } - } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the gift card.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" } - }, - "7_obj_rollback_redemption_object_promotion_tier_extended": { - "type": "object", - "title": "Promotion Tier", - "description": "This is an object representing a promotion tier rollback redemption.", - "properties": { - "id": { - "type": "string", - "example": "rr_0bc92f81a6801f9bca", - "description": "Unique redemption rollback ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the initial redemption.", - "example": "r_0b56726b09cfb73e84" - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "$ref": "#/components/schemas/7_obj_order_object_rollback" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption rollback was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the rollback redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.", - "enum": [ - "promotion_tier" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." - }, - "voucher": { - "type": "null" - }, - "promotion_tier": { - "type": "object", - "description": "Contains details of the promotion tier and the parent campaign.", - "properties": { - "id": { - "type": "string", - "description": "Unique promotion tier ID assigned by Voucherify.", - "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" - }, - "campaign": { - "type": "object", - "description": "Promotion tier's parent campaign.", - "properties": { - "id": { - "type": "string", - "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." - } - } - } - } - } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Defines the details of the voucher being redeemed." + }, + "gift": { + "type": "object", + "description": "Contains the amount being subtracted from the gift card for the redemption.", + "properties": { + "amount": { + "type": "integer", + "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." } - }, - "7_obj_redemption_object_discount_voucher": { - "type": "object", - "title": "Discount Voucher", - "description": "This is an object representing a redemption. \n\nRedemption 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](rollback-redemption).", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the parent redemption if this particular redemption was issued through a stacked redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "type": "object", - "description": "Defines the details of the voucher being redeemed.", - "properties": { - "id": { - "type": "string", - "description": "Unique voucher ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "description": "Unique campaign ID assigned by Voucherify.", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - } - } - } + } + } + } + }, + "7_obj_redemption_object_gift_card_extended_stacked": { + "type": "object", + "title": "Gift Card", + "description": "This is an object representing a gift card redemption.", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "amount": { + "type": "integer", + "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the parent redemption.", + "example": "r_0c656311b5878a2031" + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } - }, - "7_obj_redemption_rollback_object_discount_voucher": { - "type": "object", - "title": "Rollback Discount Voucher", - "description": "This is an object representing a redemption rollback for a discount voucher.", - "properties": { - "id": { - "type": "string", - "example": "rr_0c5eba630bc4979e70", - "description": "Unique redemption rollback ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", - "default": "redemption_rollback" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the original redemption." - }, - "reason": { - "type": "string", - "description": "The reason for the redemption rollback." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "$ref": "#/components/schemas/7_obj_order_object_rollback" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption rollback was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "type": "object", - "description": "Defines the details of the voucher being redeemed.", - "properties": { - "id": { - "type": "string", - "description": "Unique voucher ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "description": "Unique campaign ID assigned by Voucherify.", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - } - } - } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the gift card.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" } - }, - "7_obj_redemption_rollback_object_loyalty_card": { - "type": "object", - "title": "Rollback Loyalty Card Voucher", - "description": "This is an object representing a redemption rollback for a loyalty card.", - "properties": { - "id": { - "type": "string", - "example": "rr_0c5eaf4060133bf784", - "description": "Unique redemption rollback ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", - "default": "redemption_rollback" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "amount": { - "type": "integer", - "description": "Number of points being returned to the loyalty card." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the original redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "$ref": "#/components/schemas/7_obj_order_object_rollback" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption rollback was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the reward.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object. i.e. `voucher`.", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "type": "object", - "description": "Defines the details of the voucher being redeemed.", - "properties": { - "id": { - "type": "string", - "description": "Unique voucher ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "description": "Unique campaign ID assigned by Voucherify.", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - } - } - }, - "reward": { - "description": "Defines the reward that was initially redeemed.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" - } - ] - }, - "loyalty_card": { - "type": "object", - "description": "Stores the number of points being added back to the loyalty card for the reward redemption rollback.", - "properties": { - "points": { - "type": "integer", - "description": "Number of points being added back to the loyalty card for the reward redemption rollback." - } - } - } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Defines the details of the voucher being redeemed." + }, + "gift": { + "type": "object", + "description": "Contains the amount being subtracted from the gift card for the redemption.", + "properties": { + "amount": { + "type": "integer", + "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." } - }, - "7_obj_redemption_object_loyalty_card": { - "type": "object", - "title": "Loyalty Card Voucher", - "description": "This is an object representing a redemption. \n\nRedemption 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](rollback-redemption).", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the redemption.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "amount": { - "type": "integer", - "description": "Number of points being redeemed for a reward." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the parent redemption if this particular redemption was issued through a stacked redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the reward.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object. i.e. `voucher`.", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "type": "object", - "description": "Defines the details of the voucher being redeemed.", - "properties": { - "id": { - "type": "string", - "description": "Unique voucher ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "description": "Unique campaign ID assigned by Voucherify.", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - } - } - }, - "reward": { - "description": "Defines the reward being redeemed.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" - } - ] - }, - "loyalty_card": { - "type": "object", - "description": "Stores the number of points being subtracted from the loyalty card for the reward redemption.", - "properties": { - "points": { - "type": "integer", - "description": "Number of points being subtracted from the loyalty card for the reward redemption." - } - } - } + } + } + } + }, + "7_obj_rollback_redemption_object_truncated": { + "title": "Rollback Redemption Object", + "description": "This is an object representing an attempted or successful voucher or promotion tier rollback.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_rollback_object_discount_voucher" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_rollback_object_loyalty_card" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_rollback_object_gift_card" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_rollback_object_promotion_tier" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_rollback_object_voucher_fail" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_rollback_object_promotion_tier_fail" + } + ] + }, + "7_obj_rollback_redemption_object_extended": { + "title": "Rollback Redemption Object", + "description": "This is an object representing an attempted or successful voucher or promotion tier rollback.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_rollback_redemption_object_discount_voucher_extended" + }, + { + "$ref": "#/components/schemas/7_obj_rollback_redemption_object_loyalty_card_extended" + }, + { + "$ref": "#/components/schemas/7_obj_rollback_redemption_object_gift_card_extended" + }, + { + "$ref": "#/components/schemas/7_obj_rollback_redemption_object_promotion_tier_extended" + } + ] + }, + "7_obj_rollback_redemption_object_discount_voucher_extended": { + "type": "object", + "title": "Discount Voucher", + "description": "This is an object representing a redemption.", + "properties": { + "id": { + "type": "string", + "example": "rr_0bc92f81a6801f9bca", + "description": "Unique rollback redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", + "default": "redemption_rollback" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "redemption": { + "type": "string", + "description": "The unique redemption ID of the initial redemption.", + "example": "r_0c5d6689b35320059a" + }, + "reason": { + "type": "string", + "description": "The reason for the redemption rollback." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "$ref": "#/components/schemas/7_obj_order_object_rollback" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption rollback was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } - }, - "7_obj_redemption_object_loyalty_card_pay_with_points": { - "type": "object", - "description": "Defines the pay with points reward redeemed for the particular loyalty card.", - "properties": { - "customer": { - "type": "object", - "description": "Defines the customer redeeming the reward.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "assignment_id": { - "type": "string", - "example": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", - "description": "Unique reward assginment ID assigned by Voucherify." - }, - "id": { - "type": "string", - "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "description": "Unique reward ID assigned by Voucherify." - }, - "object": { - "type": "string", - "default": "reward", - "description": "Type of object represented is `reward`." - }, - "name": { - "type": "string", - "description": "Reward name." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the reward was created." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the reward was updated." - }, - "parameters": { - "type": "object", - "description": "These are parameters representing a Pay with Points (COIN) reward.", - "properties": { - "coin": { - "type": "object", - "description": "Defines the ratio by mapping the number of loyalty points in `points_ratio` to a predefined cash amount in `exchange_ratio`.", - "properties": { - "exchange_ratio": { - "type": "integer", - "description": "The cash equivalent of the points defined in the `points_ratio` property." - }, - "points_ratio": { - "type": "integer", - "description": "The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property." - } - } - } - } - }, - "type": { - "type": "string", - "description": "Reward type", - "enum": [ - "COIN" - ] - } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" }, - "title": "Pay with Points Reward" - }, - "7_obj_redemption_object_loyalty_card_material_product": { - "type": "object", - "description": "Defines the product material reward redeemed for the particular loyalty card.", - "properties": { - "customer": { - "type": "object", - "description": "Defines the customer redeeming the reward.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "assignment_id": { - "type": "string", - "example": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", - "description": "Unique reward assginment ID assigned by Voucherify." - }, - "product": { - "description": "Details of the product redeemed as a reward.", - "$ref": "#/components/schemas/11_obj_product_object_truncated" - }, - "id": { - "type": "string", - "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "description": "Unique reward ID assigned by Voucherify." - }, - "object": { - "type": "string", - "default": "reward", - "description": "Type of object represented is `reward`." - }, - "name": { - "type": "string", - "description": "Reward name." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the reward was created." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the reward was updated." - }, - "parameters": { - "type": "object", - "description": "These are parameters representing a material reward.", - "properties": { - "product": { - "type": "object", - "description": "Defines the product redeemed as a reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique product ID assignedy by Voucherify of the product.", - "example": "prod_0b2c2ddf35150b83bb" - }, - "sku_id": { - "type": "null" - } - } - } - } - }, - "type": { - "type": "string", - "description": "Reward type", - "enum": [ - "MATERIAL" - ] - } + "name": { + "type": "string", + "description": "Customer's first and last name." }, - "title": "Product Material Reward" - }, - "7_obj_redemption_object_loyalty_card_material_sku": { - "type": "object", - "description": "Defines the SKU material reward redeemed for the particular loyalty card.", - "properties": { - "customer": { - "type": "object", - "description": "Defines the customer redeeming the reward.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "assignment_id": { - "type": "string", - "example": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", - "description": "Unique reward assginment ID assigned by Voucherify." - }, - "product": { - "description": "Details of the SKU's parent product redeemed as a reward.", - "$ref": "#/components/schemas/11_obj_product_object_truncated" - }, - "sku": { - "description": "Details of the SKU redeemed as a reward.", - "$ref": "#/components/schemas/11_obj_sku_object" - }, - "id": { - "type": "string", - "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "description": "Unique reward ID assigned by Voucherify." - }, - "object": { - "type": "string", - "default": "reward", - "description": "Type of object represented is `reward`." - }, - "name": { - "type": "string", - "description": "Reward name." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the reward was created." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the reward was updated." - }, - "parameters": { - "type": "object", - "description": "These are parameters representing a material reward.", - "properties": { - "product": { - "type": "object", - "description": "Defines the SKU redeemed as a reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique product ID assignedy by Voucherify of the SKU's parent." - }, - "sku_id": { - "type": "string", - "description": "Unique SKU ID assigned by Voucherify of the SKU redeemed as a reward." - } - } - } - } - }, - "type": { - "type": "string", - "description": "Reward type", - "enum": [ - "MATERIAL" - ] - } + "email": { + "type": "string", + "description": "Customer's email address." }, - "title": "SKU Material Reward" - }, - "7_obj_redemption_object_loyalty_card_digital": { - "type": "object", - "description": "Defines the digital reward redeemed for the particular loyalty card.", - "properties": { - "customer": { - "type": "object", - "description": "Defines the customer redeeming the reward.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "assignment_id": { - "type": "string", - "example": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", - "description": "Unique reward assginment ID assigned by Voucherify." - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Voucher object." - }, - "id": { - "type": "string", - "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "description": "Unique reward ID assigned by Voucherify." - }, - "object": { - "type": "string", - "default": "reward", - "description": "Type of object represented is `reward`." - }, - "name": { - "type": "string", - "description": "Reward name." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the reward was created." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the reward was updated." - }, - "parameters": { - "type": "object", - "description": "These are parameters representing a digital reward. These can be in the form of discount coupons, gift card credits, or loyalty point credits.", - "properties": { - "campaign": { - "description": "Defines the source of the digital reward.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital_discount_voucher" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital_gift_card_credits" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital_loyalty_card_points" - } - ] - } - } - }, - "type": { - "type": "string", - "description": "Reward type", - "enum": [ - "CAMPAIGN" - ] - } + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." }, - "title": "Digital Reward" - }, - "7_obj_redemption_object_loyalty_card_digital_discount_voucher": { - "type": "object", - "title": "Discount Voucher", - "description": "Contains information about the source of the digital reward.", - "properties": { - "id": { - "type": "string", - "example": "camp_0dJG7cCAjquzcxWmZ634bA0C", - "description": "Unique parent campaign ID of reward." - }, - "type": { - "type": "string", - "description": "Campaign type.", - "enum": [ - "DISCOUNT_COUPONS" - ] - } - } - }, - "7_obj_redemption_object_loyalty_card_digital_gift_card_credits": { - "type": "object", - "title": "Gift Card", - "description": "Contains information about the source of the digital reward.", - "properties": { - "id": { - "type": "string", - "example": "camp_0dJG7cCAjquzcxWmZ634bA0C", - "description": "Unique parent campaign ID of reward." - }, - "balance": { - "type": "integer", - "description": "The amount credited to the gift card as a reward expressed as the smallest currency unit (that is, 100 cents for $1.00)." - }, - "type": { - "type": "string", - "description": "Campaign type.", - "enum": [ - "GIFT_VOUCHERS" - ] - } + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" } - }, - "7_obj_redemption_object_loyalty_card_digital_loyalty_card_points": { - "type": "object", - "title": "Loyalty Card", - "description": "Contains information about the source of the digital reward.", - "properties": { - "id": { - "type": "string", - "example": "camp_0dJG7cCAjquzcxWmZ634bA0C", - "description": "Unique parent campaign ID of reward." - }, - "balance": { - "type": "integer", - "description": "The number of loyalty points that is added to the loyalty card as a reward." - }, - "type": { - "type": "string", - "description": "Campaign type.", - "enum": [ - "LOYALTY_PROGRAM" - ] - } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Defines the details of the voucher being redeemed." + } + } + }, + "7_obj_rollback_redemption_object_loyalty_card_extended": { + "type": "object", + "title": "Loyalty Card Voucher", + "description": "This is an object representing a loyalty card rollback redemption.", + "properties": { + "id": { + "type": "string", + "example": "rr_0bc92f81a6801f9bca", + "description": "Unique redemption rollback ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", + "default": "redemption_rollback" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "amount": { + "type": "integer", + "description": "Number of points being returned to the loyalty card." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the initial redemption.", + "example": "r_0b56726b09cfb73e84" + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "$ref": "#/components/schemas/7_obj_order_object_rollback" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption rollback was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } - }, - "7_obj_redemption_rollback_object_gift_card": { - "type": "object", - "title": "Rollback Gift Card", - "description": "This is an object representing a gift card redemption rollback.", - "properties": { - "id": { - "type": "string", - "example": "rr_0bc92f81a6801f9bca", - "description": "Unique redemption rollback ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", - "default": "redemption_rollback" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "amount": { - "type": "integer", - "description": "The amount added back to the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the initial redemption.", - "example": "r_0c5bf3323008a35032" - }, - "reason": { - "type": "string", - "description": "The reason for the redemption rollback." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "$ref": "#/components/schemas/7_obj_order_object_rollback" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption rollback was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the gift card.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "type": "object", - "description": "Defines the details of the voucher being redeemed.", - "properties": { - "id": { - "type": "string", - "description": "Unique voucher ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "description": "Unique campaign ID assigned by Voucherify.", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - } - } - }, - "gift": { - "type": "object", - "description": "Contains the amount being adde back to the gift card for the redemption rollback", - "properties": { - "amount": { - "type": "integer", - "description": "The amount added back to the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." - } - } - } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the reward.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" } - }, - "7_obj_redemption_object_gift_card": { - "type": "object", - "title": "Gift Card", - "description": "This is an object representing a gift card redemption.", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "amount": { - "type": "integer", - "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the parent redemption if this particular redemption was issued through a stacked redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the gift card.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "type": "object", - "description": "Defines the details of the voucher being redeemed.", - "properties": { - "id": { - "type": "string", - "description": "Unique voucher ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "description": "Unique campaign ID assigned by Voucherify.", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - } - } - }, - "gift": { - "type": "object", - "description": "Contains the amount being subtracted from the gift card for the redemption.", - "properties": { - "amount": { - "type": "integer", - "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." - } - } - } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object. i.e. `voucher`.", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Defines the details of the voucher being redeemed." + }, + "reward": { + "description": "Defines the reward being redeemed.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" } - }, - "7_obj_redemption_object_voucher_fail": { - "type": "object", - "title": "Failed Voucher Redemption", - "description": "This is an object representing a failed redemption for a voucher.", - "properties": { - "id": { - "type": "string", - "example": "rf_0bbaccc96e0830ff9e", - "description": "Unique failed redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "failure_code": { - "type": "string", - "example": "customer_rules_violated", - "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." - }, - "failure_message": { - "type": "string", - "description": "If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed." - }, - "order": { - "type": "null" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |\n", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "voucher": { - "type": "object", - "description": "Defines the voucher details.", - "properties": { - "id": { - "type": "string", - "description": "Unique voucher ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "description": "Unique campaign ID assigned by Voucherify.", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - } - } - } + ] + }, + "loyalty_card": { + "type": "object", + "description": "Stores the number of points being added back to the loyalty card for the reward redemption rollback.", + "properties": { + "points": { + "type": "integer", + "description": "Number of points being returned to the loyalty card for the reward redemption rollback." } - }, - "7_obj_redemption_object_promotion_tier_fail": { - "type": "object", - "title": "Failed Promotion Tier Redemption", - "description": "This is an object representing a failed redemption for a promotion tier.", - "properties": { - "id": { - "type": "string", - "example": "rf_0bbaccc96e0830ff9e", - "description": "Unique failed redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the redemption.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "failure_code": { - "type": "string", - "example": "customer_rules_violated", - "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." - }, - "failure_message": { - "type": "string", - "description": "If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed." - }, - "order": { - "type": "null" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the promotion.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n", - "enum": [ - "promotion_tier" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify.", - "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" - }, - "voucher": { - "type": "null" - }, - "promotion_tier": { - "type": "object", - "description": "Contains details about the promotion tier and it's parent campaign.", - "properties": { - "id": { - "type": "string", - "description": "Unique promotion tier ID assigned by Voucherify.", - "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" - }, - "campaign": { - "type": "object", - "description": "Promotion tier's parent campaign.", - "properties": { - "id": { - "type": "string", - "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." - } - } - } - } - } + } + } + } + }, + "7_obj_rollback_redemption_object_gift_card_extended": { + "type": "object", + "title": "Gift Card", + "description": "This is an object representing a gift card rollback redemption.", + "properties": { + "id": { + "type": "string", + "example": "rr_0bc92f81a6801f9bca", + "description": "Unique redemption rollback ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", + "default": "redemption_rollback" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "amount": { + "type": "integer", + "description": "The amount credited back to the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the initial redemption.", + "example": "r_0b56726b09cfb73e84" + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "$ref": "#/components/schemas/7_obj_order_object_rollback" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption rollback was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } - }, - "7_obj_redemption_object_fail": { - "type": "object", - "title": "Failed Redemption", - "description": "This is an object representing a failed redemption when a resource to be redeemed cannot be found.", - "properties": { - "id": { - "type": "string", - "example": "rf_0c4c7baf58c243af6b", - "description": "Unique failed redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the redemption.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "null", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "null", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "failure_code": { - "type": "string", - "example": "not_found", - "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." - }, - "failure_message": { - "type": "string", - "description": "If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed." - }, - "order": { - "type": "null" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "null" - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| redemption | Related redemption. |\n", - "enum": [ - "redemption" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify.", - "example": "rf_0c5bde8dfc0156f0e3" - }, - "voucher": { - "type": "null" - } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the gift card.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" } - }, - "7_obj_redemption_rollback_object_voucher_fail": { - "type": "object", - "title": "Failed Voucher Redemption Rollback", - "description": "This is an object representing a failed redemption rollback for a voucher.", - "properties": { - "id": { - "type": "string", - "example": "rrf_0c63990fed133bfb88", - "description": "Unique failed redemption rollback ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", - "default": "redemption_rollback" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "redemption": { - "type": "string", - "description": "The unique redemption ID of the initial redemption.", - "example": "r_0c5d6689b35320059a" - }, - "reason": { - "type": "string", - "description": "The reason for the redemption rollback." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "failure_code": { - "type": "string", - "example": "already_rolled_back", - "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." - }, - "failure_message": { - "type": "string", - "description": "If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed." - }, - "order": { - "type": "null" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption rollback was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |\n", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "voucher": { - "type": "object", - "description": "Defines the voucher details.", - "properties": { - "id": { - "type": "string", - "description": "Unique voucher ID assigned by Voucherify.", - "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - }, - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "campaign": { - "type": "string", - "description": "Voucher's parent campaign name." - }, - "campaign_id": { - "type": "string", - "description": "Unique campaign ID assigned by Voucherify.", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - } - } - } - } - }, - "7_obj_redemption_rollback_object_promotion_tier_fail": { - "type": "object", - "title": "Failed Promotion Tier Redemption Rollback", - "description": "This is an object representing a failed redemption rollback for a promotion tier.", - "properties": { - "id": { - "type": "string", - "example": "rrf_0c5eb3bd884497ed05", - "description": "Unique failed redemption rollback ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", - "default": "redemption_rollback" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "redemption": { - "type": "string", - "description": "The unique redemption ID of the initial redemption.", - "example": "r_0c5d6689b35320059a" - }, - "reason": { - "type": "string", - "description": "The reason for the redemption rollback." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "failure_code": { - "type": "string", - "example": "customer_rules_violated", - "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." - }, - "failure_message": { - "type": "string", - "description": "If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed." - }, - "order": { - "type": "null" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption rollback was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the promotion.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.\n", - "enum": [ - "promotion_tier" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify.", - "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" - }, - "voucher": { - "type": "null" - }, - "promotion_tier": { - "type": "object", - "description": "Contains details about the promotion tier and it's parent campaign.", - "properties": { - "id": { - "type": "string", - "description": "Unique promotion tier ID assigned by Voucherify.", - "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" - }, - "campaign": { - "type": "object", - "description": "Promotion tier's parent campaign.", - "properties": { - "id": { - "type": "string", - "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." - } - } - } - } - } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Defines the details of the voucher being redeemed." + }, + "gift": { + "type": "object", + "description": "Contains the amount being added back to the gift card for the redemption rollback.", + "properties": { + "amount": { + "type": "integer", + "description": "The amount added back on the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." } - }, - "7_obj_redemption_rollback_object_promotion_tier": { - "type": "object", - "title": "Promotion Tier", - "description": "This is an object representing a promotion tier redemption rollback", - "properties": { - "id": { - "type": "string", - "example": "rr_0bc92f81a6801f9bca", - "description": "Unique redemption rollback ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", - "default": "redemption_rollback" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of initial redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption rollback result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption rollback.", - "$ref": "#/components/schemas/7_obj_order_object_rollback" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption rollback was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.", - "enum": [ - "promotion_tier" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." - }, - "voucher": { - "type": "null" - }, - "promotion_tier": { - "type": "object", - "description": "Contains details of the promotion tier and the parent campaign.", - "properties": { - "id": { - "type": "string", - "description": "Unique promotion tier ID assigned by Voucherify.", - "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" - }, - "campaign": { - "type": "object", - "description": "Promotion tier's parent campaign.", - "properties": { - "id": { - "type": "string", - "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." - } - } - } - } - } + } + } + } + }, + "7_obj_rollback_redemption_object_promotion_tier_extended": { + "type": "object", + "title": "Promotion Tier", + "description": "This is an object representing a promotion tier rollback redemption.", + "properties": { + "id": { + "type": "string", + "example": "rr_0bc92f81a6801f9bca", + "description": "Unique redemption rollback ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the initial redemption.", + "example": "r_0b56726b09cfb73e84" + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "$ref": "#/components/schemas/7_obj_order_object_rollback" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption rollback was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the rollback redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } - }, - "7_obj_redemption_object_promotion_tier": { - "type": "object", - "title": "Promotion Tier", - "description": "This is an object representing a promotion tier redemption.", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the parent redemption if this particular redemption was issued through a stacked redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.", - "enum": [ - "promotion_tier" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." - }, - "voucher": { - "type": "null" - }, - "promotion_tier": { - "type": "object", - "description": "Contains details of the promotion tier and the parent campaign.", - "properties": { - "id": { - "type": "string", - "description": "Unique promotion tier ID assigned by Voucherify.", - "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" - }, - "campaign": { - "type": "object", - "description": "Promotion tier's parent campaign.", - "properties": { - "id": { - "type": "string", - "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." - } - } - } - } - } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" } - }, - "7_obj_redemption_object_promotion_tier_extended": { - "type": "object", - "title": "Promotion Tier", - "description": "This is an object representing a promotion tier redemption.", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.", + "enum": [ + "promotion_tier" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." + }, + "voucher": { + "type": "null" + }, + "promotion_tier": { + "type": "object", + "description": "Contains details of the promotion tier and the parent campaign.", + "properties": { + "id": { + "type": "string", + "description": "Unique promotion tier ID assigned by Voucherify.", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" + }, + "campaign": { + "type": "object", + "description": "Promotion tier's parent campaign.", + "properties": { + "id": { + "type": "string", + "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.", - "enum": [ - "promotion_tier" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." - }, - "voucher": { - "type": "null" - }, - "promotion_tier": { - "description": "Contains details of the promotion tier and the parent campaign.", - "$ref": "#/components/schemas/3_obj_promotion_tier_object" } } - }, - "7_obj_redemption_object_promotion_tier_extended_stacked": { - "type": "object", - "title": "Promotion Tier", - "description": "This is an object representing a promotion tier redemption.", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "redemption": { - "type": "string", - "description": "Unique redemption ID of the parent redemption.", - "example": "r_0c656311b5878a2031" - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer that is related to the redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.", - "enum": [ - "promotion_tier" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." - }, - "voucher": { - "type": "null" - }, - "promotion_tier": { - "description": "Contains details of the promotion tier and the parent campaign.", - "$ref": "#/components/schemas/3_obj_promotion_tier_object" - } - } - }, - "7_obj_redemption_object_stackable_discounts": { - "type": "object", - "title": "Stacked Redemption", - "description": "This is an object representing a stacked redemption.", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object_stacked_redemptions" - }, - "channel": { - "type": "object", - "description": "Defines the details of the channel through which the redemption was issued.", - "properties": { - "channel_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." - }, - "channel_type": { - "type": "string", - "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", - "enum": [ - "USER", - "API" - ] - } - } - }, - "customer": { - "type": "object", - "description": "Defines the customer making the stacked redemption.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object.", - "enum": [ - "redemption" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. r_0c5d07222e08a34ace for a redemption." - }, - "voucher": { - "type": "null" - } + } + } + } + }, + "7_obj_redemption_object_discount_voucher": { + "type": "object", + "title": "Discount Voucher", + "description": "This is an object representing a redemption. \n\nRedemption 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](rollback-redemption).", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the parent redemption if this particular redemption was issued through a stacked redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } - }, - "7_res_get_redemption": { - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object" - }, - { - "$ref": "#/components/schemas/7_obj_rollback_redemption_object_truncated" - } - ], - "title": "Get Redemption Response Body", - "description": "Response body schema for **GET** `/redemptions/{redemptionId}" - }, - "7_res_list_redemptions": { - "title": "List Redemptions Response Body", - "type": "object", - "description": "Response body schema for **GET** `/redemptions`.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about redemptions in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "redemptions", - "description": "Identifies the name of the attribute that contains the array of redemption objects." - }, - "redemptions": { - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object" - }, - { - "$ref": "#/components/schemas/7_obj_rollback_redemption_object_truncated" - } - ] - }, - "total": { - "type": "integer", - "description": "Total number of redemptions." - } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" } - }, - "7_filter_conditions_string": { - "title": "Filter by conditions", - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "$in": { - "type": "array", - "description": "Array of resource values that should be included in the results. (multiple values)", - "items": { - "type": "string" - } - }, - "$not_in": { - "type": "array", - "description": "Array of resource values that should be included in the results. (multiple values)", - "items": { - "type": "string" - } - }, - "$is": { - "type": "string", - "description": "Value is exactly this value. (single value)" - }, - "$is_not": { - "type": "string", - "description": "Results omit this value. (single value)" - }, - "$has_value": { - "type": "string", - "description": "Value is NOT null. The value for this parameter is an empty string." - }, - "$is_unknown": { - "type": "string", - "description": "Value is null. The value for this parameter is an empty string." - }, - "$starts_with": { - "type": "string", - "description": "Value starts with the specified string." - }, - "$ends_with": { - "type": "string", - "description": "Value ends with the specified string." - } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "type": "object", + "description": "Defines the details of the voucher being redeemed.", + "properties": { + "id": { + "type": "string", + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" } - }, - "7_res_get_vouchers_redemptions": { - "type": "object", - "title": "Get Voucher's Redemptions Response Body", - "description": "Response body schema for **GET** `/vouchers/{code}/redemption`.", - "properties": { - "quantity": { - "type": "integer", - "description": "The maximum number of times a voucher can be redeemed." - }, - "redeemed_quantity": { - "type": "integer", - "description": "The number of times the voucher was redeemed successfully." - }, - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about redemptions in a dictionary." - }, - "url": { - "type": "string", - "example": "/v1/vouchers/PROMO-CODE2/redemptions?page=1&limit=10", - "description": "URL " - }, - "data_ref": { - "type": "string", - "default": "redemption_entries", - "description": "Identifies the name of the attribute that contains the array of `redemption_entries`." - }, - "total": { - "type": "integer", - "description": "Total number of redemption objects." - }, - "redemption_entries": { - "type": "array", - "description": "Contains the array of successful and failed redemption objects.", - "items": { - "$ref": "#/components/schemas/7_obj_redemption_object_voucher" - } - } + } + } + } + }, + "7_obj_redemption_rollback_object_discount_voucher": { + "type": "object", + "title": "Rollback Discount Voucher", + "description": "This is an object representing a redemption rollback for a discount voucher.", + "properties": { + "id": { + "type": "string", + "example": "rr_0c5eba630bc4979e70", + "description": "Unique redemption rollback ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", + "default": "redemption_rollback" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the original redemption." + }, + "reason": { + "type": "string", + "description": "The reason for the redemption rollback." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "$ref": "#/components/schemas/7_obj_order_object_rollback" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption rollback was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } - }, - "7_req_redeem_voucher": { - "title": "Redeem Voucher Request Body", - "description": "Request body schema for redeeming a voucher using **POST** `/vouchers/{code}/redemption`.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_req_redeem_voucher_discount_code" - }, - { - "$ref": "#/components/schemas/7_req_redeem_voucher_gift_card" - }, - { - "$ref": "#/components/schemas/7_req_redeem_voucher_loyalty_card" - } - ] - }, - "7_res_redeem_voucher": { - "title": "Redeem Voucher Response Body", - "$ref": "#/components/schemas/7_obj_redemption_object_voucher_extended", - "description": "Response body schema for **POST** `/vouchers/{code}/redemption`." - }, - "7_req_redeem_promotion_tier": { - "title": "Redeem Promotion Tier", - "type": "object", - "description": "Redeem a promotion tier.", - "properties": { - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" - }, - { - "$ref": "#/components/schemas/10_req_create_order" - } - ], - "description": "Order information." - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against promotion tiers requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the [Create Validation Rules](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." - } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" } - }, - "7_req_redeem_voucher_discount_code": { - "title": "Discount Code", - "type": "object", - "description": "Redeem a discount code.", - "properties": { - "session": { - "$ref": "#/components/schemas/6_req_session_lock_discount_code" - }, - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" - }, - { - "$ref": "#/components/schemas/10_req_create_order" - } - ], - "description": "Order information." - }, - "metadata": { - "type": "object", - "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "options": { - "type": "object", - "description": "Configure parameters returned in the response.", - "properties": { - "expand": { - "type": "array", - "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. Add `category` as a string in the array to include a `categories` object in the response.", - "items": { - "type": "string", - "enum": [ - "category" - ], - "example": "category" - } - } - } - } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "type": "object", + "description": "Defines the details of the voucher being redeemed.", + "properties": { + "id": { + "type": "string", + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" } - }, - "7_req_redeem_voucher_gift_card": { - "title": "Gift Card", - "type": "object", - "description": "Redeem a gift card.", - "properties": { - "session": { - "$ref": "#/components/schemas/6_req_session_lock_gift_card" - }, - "gift": { - "type": "object", - "description": "Contains information on the number of gift card credits that the customer wants to apply to the order.", - "properties": { - "credits": { - "type": "integer", - "description": "The number of credits that the user wants to use from the gift card to fulfil the order. The value of credits cannot be higher than the current balance on the gift card. If the user gives more points than he has on the gift card, the application will return an error code in response. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - }, - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" - }, - { - "$ref": "#/components/schemas/10_req_create_order" - } - ], - "description": "Order information." - }, - "metadata": { - "type": "object", - "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "options": { - "type": "object", - "description": "Configure parameters returned in the response.", - "properties": { - "expand": { - "type": "array", - "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. Add `category` as a string in the array to include a `categories` object in the response.", - "items": { - "type": "string", - "enum": [ - "category" - ], - "example": "category" - } - } - } - } + } + } + } + }, + "7_obj_redemption_rollback_object_loyalty_card": { + "type": "object", + "title": "Rollback Loyalty Card Voucher", + "description": "This is an object representing a redemption rollback for a loyalty card.", + "properties": { + "id": { + "type": "string", + "example": "rr_0c5eaf4060133bf784", + "description": "Unique redemption rollback ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", + "default": "redemption_rollback" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "amount": { + "type": "integer", + "description": "Number of points being returned to the loyalty card." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the original redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "$ref": "#/components/schemas/7_obj_order_object_rollback" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption rollback was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } - }, - "7_req_redeem_voucher_loyalty_card": { - "title": "Loyalty Card", - "type": "object", - "description": "Redeem a loyalty card.", - "properties": { - "session": { - "$ref": "#/components/schemas/6_req_session_lock_loyalty_card" - }, - "reward": { - "type": "object", - "description": "Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward." - }, - "points": { - "type": "integer", - "description": "The number of loyalty points that the user wants to spend in order to fulfill the order. The number of points cannot be higher than the current balance on the loyalty card. If the user gives more points than he/she has on the loyalty card, the application will return an error code in response." - } - } - }, - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" - }, - { - "$ref": "#/components/schemas/10_req_create_order" - } - ], - "description": "Order information." - }, - "metadata": { - "type": "object", - "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "options": { - "type": "object", - "description": "Configure parameters returned in the response.", - "properties": { - "expand": { - "type": "array", - "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. Add `category` as a string in the array to include a `categories` object in the response.", - "items": { - "type": "string", - "enum": [ - "category" - ], - "example": "category" - } - } - } - } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the reward.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" } - }, - "7_req_rollback_redemption": { - "title": "Rollback Redemption Request Body", - "type": "object", - "properties": { - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_rollback_redemption_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_rollback_redemption_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_rollback_redemption_order_id" - }, - { - "$ref": "#/components/schemas/6_req_rollback_redemption_order_source_id" - } - ], - "description": "Send order information to ensure the correct order is being undone." - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to update **redemption** metadata." - } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object. i.e. `voucher`.", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "type": "object", + "description": "Defines the details of the voucher being redeemed.", + "properties": { + "id": { + "type": "string", + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" }, - "description": "Request body schema for **POST** `/redemptions/{redemptionId}/rollback`." - }, - "7_res_rollback_redemption": { - "title": "Rollback Redemption Response Body", - "$ref": "#/components/schemas/7_obj_rollback_redemption_object_extended", - "description": "Response body schema for **POST** `/redemptions/{redemptionId}/rollback`." - }, - "8_obj_loyalty_campaign_object": { - "title": "Loyalty Campaign Object", - "description": "This is an object representing a loyalty campaign. \n\nThe loyalty campaign object contains details about the loyalty campaign. You can use dedicated endpoints to list loyalty campaigns, list loyalty card holders, member activities, active rewards, earning rules, loyalty tiers for given loyalty campaign.", - "x-tags": [ - "LOYALTIES API" - ], - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique campaign ID, assigned by Voucherify.", - "example": "camp_f7fBbQxUuTN7dI7tGOo5XMDA" - }, - "name": { - "type": "string", - "description": "Loyalty campaign name." - }, - "campaign_type": { - "type": "string", - "enum": [ - "LOYALTY_PROGRAM" - ], - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria \n- `STATIC`: vouchers need to be manually published", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "voucher": { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_LOYALTY_CARD" - }, - "auto_join": { - "type": "boolean", - "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + } + } + }, + "reward": { + "description": "Defines the reward that was initially redeemed.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" + } + ] + }, + "loyalty_card": { + "type": "object", + "description": "Stores the number of points being added back to the loyalty card for the reward redemption rollback.", + "properties": { + "points": { + "type": "integer", + "description": "Number of points being added back to the loyalty card for the reward redemption rollback." + } + } + } + } + }, + "7_obj_redemption_object_loyalty_card": { + "type": "object", + "title": "Loyalty Card Voucher", + "description": "This is an object representing a redemption. \n\nRedemption 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](rollback-redemption).", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the redemption.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "amount": { + "type": "integer", + "description": "Number of points being redeemed for a reward." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the parent redemption if this particular redemption was issued through a stacked redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the reward.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object. i.e. `voucher`.", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "type": "object", + "description": "Defines the details of the voucher being redeemed.", + "properties": { + "id": { + "type": "string", + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + } + } + }, + "reward": { + "description": "Defines the reward being redeemed.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" + } + ] + }, + "loyalty_card": { + "type": "object", + "description": "Stores the number of points being subtracted from the loyalty card for the reward redemption.", + "properties": { + "points": { + "type": "integer", + "description": "Number of points being subtracted from the loyalty card for the reward redemption." + } + } + } + } + }, + "7_obj_redemption_object_loyalty_card_pay_with_points": { + "type": "object", + "description": "Defines the pay with points reward redeemed for the particular loyalty card.", + "properties": { + "customer": { + "type": "object", + "description": "Defines the customer redeeming the reward.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "assignment_id": { + "type": "string", + "example": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", + "description": "Unique reward assginment ID assigned by Voucherify." + }, + "id": { + "type": "string", + "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "description": "Unique reward ID assigned by Voucherify." + }, + "object": { + "type": "string", + "default": "reward", + "description": "Type of object represented is `reward`." + }, + "name": { + "type": "string", + "description": "Reward name." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the reward was created." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the reward was updated." + }, + "parameters": { + "type": "object", + "description": "These are parameters representing a Pay with Points (COIN) reward.", + "properties": { + "coin": { + "type": "object", + "description": "Defines the ratio by mapping the number of loyalty points in `points_ratio` to a predefined cash amount in `exchange_ratio`.", + "properties": { + "exchange_ratio": { + "type": "integer", + "description": "The cash equivalent of the points defined in the `points_ratio` property." + }, + "points_ratio": { + "type": "integer", + "description": "The number of loyalty points that will map to the predefined cash amount defined by the `exchange_ratio` property." } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign." - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2021-12-01T08:00:50.038Z", - "description": "Timestamp representing the date and time when the campaign was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-09-20T09:18:19.623Z", - "description": "Timestamp representing the date and time when the voucher was updated in ISO 8601 format." - }, - "creation_status": { - "type": "string", - "enum": [ - "DONE", - "IN_PROGRESS", - "FAILED", - "DRAFT", - "MODIFYING" - ], - "description": "Indicates the status of the campaign creation." - }, - "vouchers_generation_status": { - "type": "string", - "description": "Indicates the status of the campaign's vouchers.", - "enum": [ - "DONE", - "IN_PROGRESS", - "FAILED", - "DRAFT" - ] - }, - "protected": { - "type": "boolean", - "description": "Indicates whether the resource can be deleted." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to.", - "example": "cat_0b688929a2476386a7" - }, - "categories": { - "$ref": "#/components/schemas/20_obj_category_object" - }, - "loyalty_tiers_expiration": { - "type": "object", - "description": "Defines the expiration mechanism for loyalty tiers.", - "anyOf": [ - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance" - }, - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_points_in_period" - } - ] - }, - "object": { - "type": "string", - "default": "campaign", - "description": "The type of object represented by JSON. This object stores information about the campaign." } } - }, - "8_obj_loyalty_campaign_object_no_extended_categories": { - "title": "Loyalty Campaign Object", - "description": "This is an object representing a loyalty campaign. \n\nThe loyalty campaign object contains details about the loyalty campaign. You can use dedicated endpoints to list loyalty campaigns, list loyalty card holders, member activities, active rewards, earning rules, loyalty tiers for given loyalty campaign.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique campaign ID, assigned by Voucherify.", - "example": "camp_f7fBbQxUuTN7dI7tGOo5XMDA" - }, - "name": { - "type": "string", - "description": "Loyalty campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "campaign_type": { - "type": "string", - "enum": [ - "LOYALTY_PROGRAM" - ], - "description": "Type of campaign." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria \n- `STATIC`: vouchers need to be manually published", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "voucher": { - "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_LOYALTY_CARD" - }, - "auto_join": { - "type": "boolean", - "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign." - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2021-12-01T08:00:50.038Z", - "description": "Timestamp representing the date and time when the campaign was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-09-20T09:18:19.623Z", - "description": "Timestamp representing the date and time when the voucher was updated in ISO 8601 format." - }, - "creation_status": { - "type": "string", - "enum": [ - "DONE", - "IN_PROGRESS", - "FAILED", - "DRAFT", - "MODIFYING" - ], - "description": "Indicates the status of the campaign creation." - }, - "vouchers_generation_status": { - "type": "string", - "description": "Indicates the status of the campaign's vouchers.", - "enum": [ - "DONE", - "IN_PROGRESS", - "FAILED", - "DRAFT" - ] - }, - "protected": { - "type": "boolean", - "description": "Indicates whether the resource can be deleted." - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to.", - "example": "cat_0b688929a2476386a7" - }, - "categories": { - "type": "array", - "description": "Contains details about the category.", - "items": { - "$ref": "#/components/schemas/20_obj_category_object" + } + }, + "type": { + "type": "string", + "description": "Reward type", + "enum": [ + "COIN" + ] + } + }, + "title": "Pay with Points Reward" + }, + "7_obj_redemption_object_loyalty_card_material_product": { + "type": "object", + "description": "Defines the product material reward redeemed for the particular loyalty card.", + "properties": { + "customer": { + "type": "object", + "description": "Defines the customer redeeming the reward.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "assignment_id": { + "type": "string", + "example": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", + "description": "Unique reward assginment ID assigned by Voucherify." + }, + "product": { + "description": "Details of the product redeemed as a reward.", + "$ref": "#/components/schemas/11_obj_product_object_truncated" + }, + "id": { + "type": "string", + "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "description": "Unique reward ID assigned by Voucherify." + }, + "object": { + "type": "string", + "default": "reward", + "description": "Type of object represented is `reward`." + }, + "name": { + "type": "string", + "description": "Reward name." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the reward was created." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the reward was updated." + }, + "parameters": { + "type": "object", + "description": "These are parameters representing a material reward.", + "properties": { + "product": { + "type": "object", + "description": "Defines the product redeemed as a reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique product ID assignedy by Voucherify of the product.", + "example": "prod_0b2c2ddf35150b83bb" + }, + "sku_id": { + "type": "null" } - }, - "loyalty_tiers_expiration": { - "type": "object", - "description": "Defines the expiration mechanism for loyalty tiers.", - "anyOf": [ - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance" - }, - { - "$ref": "#/components/schemas/2_loyalty_tiers_expiration_points_in_period" - } - ] - }, - "object": { - "type": "string", - "default": "campaign", - "description": "The type of object represented by JSON. This object stores information about the campaign." } } - }, - "8_obj_loyalty_card_object": { - "title": "Loyalty Card Object", - "type": "object", - "description": "This is an object representing a loyalty card.", - "examples": [ - { - "id": "v_hrMBBeT4sOP9VSGPmj5KAgJwX202UjiY", - "code": "LOYALTY-CARD-xLPbpbXR", - "campaign": "Loyalty Program Fall 2022", - "campaign_id": "camp_f7fBbQxUuTN7dI7tGOo5XMDA", - "category": "First", - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" - } - ], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 110, - "balance": 100, - "next_expiration_date": "2023-12-31", - "next_expiration_points": 100 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8/6I6hUEqtz/F6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD/DjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8%2F6I6hUEqtz%2FF6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD%2FDjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/SpYuOrU9wd6/o1wzy6E/04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ/FJtiw69djuzQk1f4HdQo8s5gaZ7fd2U+1zbaeAvi9usyvRHZE4=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FSpYuOrU9wd6%2Fo1wzy6E%2F04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ%2FFJtiw69djuzQk1f4HdQo8s5gaZ7fd2U%2B1zbaeAvi9usyvRHZE4%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-19T07:56:22.355Z", - "updated_at": "2022-09-19T08:04:22.458Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 1, - "redeemed_points": 10, - "object": "list", - "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/publications?page=1&limit=10" - }, - "object": "voucher" - } - ], - "properties": { - "id": { - "type": "string", - "example": "v_mkZN9v7vjYUadXnHrMza8W5c34fE5KiV", - "description": "Assigned by the Voucherify API, identifies the voucher." - }, - "code": { - "type": "string", - "example": "WVPblOYX", - "description": "A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters." - }, - "campaign": { - "type": "string", - "example": "Loyalty Card Campaign", - "description": "A unique campaign name, identifies the voucher's parent campaign." - }, - "campaign_id": { - "type": "string", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "description": "Assigned by the Voucherify API, identifies the voucher's parent campaign." - }, - "category": { - "type": "string", - "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint." - }, - "category_id": { - "type": "string", - "description": "Unique category ID assigned by Voucherify.", - "example": "cat_0bb343dee3cdb5ec0c" - }, - "categories": { - "type": "array", - "description": "Contains details about the category.", - "items": { - "$ref": "#/components/schemas/20_obj_category_object" - } - }, - "type": { - "type": "string", - "enum": [ - "LOYALTY_CARD" - ], - "description": "Defines the type of voucher. " - }, - "discount": { - "default": null, - "description": "Object representing discount parameters. Child attributes are present only if `type` is `DISCOUNT_VOUCHER`. Defaults to `null`.", - "type": "null" - }, - "gift": { - "type": "null", - "description": "Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`." - }, - "loyalty_card": { - "type": "object", - "description": "Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`.", - "properties": { - "points": { - "type": "integer", - "example": 7000, - "description": "Total points incurred over lifespan of loyalty card." - }, - "balance": { - "type": "integer", - "example": 6970, - "description": "Points available for reward redemption." - }, - "next_expiration_date": { - "type": "string", - "format": "date", - "example": "2023-05-30", - "description": "The next closest date when the next set of points are due to expire." - }, - "next_expiration_points": { - "type": "integer", - "description": "The amount of points that are set to expire next." - } - } - }, - "start_date": { - "type": "string", - "example": "2021-12-01T00:00:00.000Z", - "format": "date-time", - "description": "Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. " - }, - "expiration_date": { - "type": "string", - "example": "2021-12-31T00:00:00.000Z", - "format": "date-time", - "description": "Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the voucher is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "example": "PT1H", - "description": "Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a `duration` of `PT1H` will be valid for a duration of one hour." - }, - "interval": { - "type": "string", - "example": "P2D", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an `interval` of `P2D` will be active every other day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "enum": [ - [ - 0 - ], - [ - 1 - ], - [ - 2 - ], - [ - 3 - ], - [ - 4 - ], - [ - 5 - ], - [ - 6 - ] - ], - "description": "Integer array corresponding to the particular days of the week in which the voucher is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" - }, - "additional_info": { - "type": "string", - "description": "An optional field to keep any extra textual information about the code such as a code description and details." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - }, - "assets": { - "type": "object", - "description": "Stores links to images of QR and barcode that correspond to an encrypted voucher code.", - "properties": { - "qr": { - "type": "object", - "description": "Stores Quick Response (QR) representation of encrypted code.", - "properties": { - "id": { - "type": "string", - "example": "U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK+t4pp7U7oFzjGJzj9q/bmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg+BaZk5QwXMf8k/OzSlOEVybpwSq+AiqPoNtjeuqtIgkDyvT6Q==", - "description": "Encrypted voucher code ID." - }, - "url": { - "type": "string", - "example": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK%2Bt4pp7U7oFzjGJzj9q%2FbmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg%2BBaZk5QwXMf8k%2FOzSlOEVybpwSq%2BAiqPoNtjeuqtIgkDyvT6Q%3D%3D", - "description": "URL to QR code \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" - } - } - }, - "barcode": { - "type": "object", - "description": "Stores barcode representation of encrypted code.", - "properties": { - "id": { - "type": "string", - "example": "U2FsdGVkX19eJhGfWwUrH9+tulBkON+AnMktic+N6CVWzZ9+fHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ+kJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6/pFs61apEn9SJx32ttCF6d3oxKISQQ==", - "description": "Encrypted voucher code ID." - }, - "url": { - "type": "string", - "example": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19eJhGfWwUrH9%2BtulBkON%2BAnMktic%2BN6CVWzZ9%2BfHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ%2BkJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6%2FpFs61apEn9SJx32ttCF6d3oxKISQQ%3D%3D", - "description": "URL to barcode \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" - } - } - } - } - }, - "is_referral_code": { - "type": "boolean", - "description": "Flag indicating whether this voucher is a referral code." - }, - "created_at": { - "type": "string", - "example": "2021-12-22T10:13:06.487Z", - "description": "Timestamp representing the date and time when the voucher was created in ISO 8601 format.", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "example": "2021-12-22T10:14:45.316Z", - "format": "date-time", - "description": "Timestamp representing the date and time when the voucher was last updated in ISO 8601 format." - }, - "holder_id": { - "type": "string", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "description": "Unique customer ID of voucher owner." - }, - "redemption": { - "type": "object", - "description": "Stores a summary of redemptions that have been applied to the voucher.", - "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited." - }, - "redeemed_quantity": { - "type": "integer", - "example": 1, - "description": "How many times a voucher has already been redeemed." - }, - "redeemed_points": { - "type": "integer", - "example": 100000, - "description": "Total loyalty points redeemed." - }, - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute." - }, - "url": { - "type": "string", - "example": "/v1/vouchers/WVPblOYX/redemptions?page=1&limit=10", - "description": "The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`" - } - } - }, - "publish": { - "type": "object", - "description": "This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or publish voucher API method. \n\n\n\n| Required | Optional |\n| -------- | :------: |\n| `type`:`LOYALTY_CARD` | `type`:`DISCOUNT_VOUCHER` | \n| `is_referral_code`:`true` | `type`:`GIFT_VOUCHER` |\n", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute." - }, - "count": { - "type": "integer", - "example": 0, - "description": "Publication events counter." - }, - "url": { - "type": "string", - "example": "/v1/vouchers/WVPblOYX/publications?page=1&limit=10", - "description": "The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`" - } - } - }, - "object": { - "type": "string", - "description": "The type of object represented by JSON. Default is `voucher`.", - "default": "voucher" - } + } + }, + "type": { + "type": "string", + "description": "Reward type", + "enum": [ + "MATERIAL" + ] + } + }, + "title": "Product Material Reward" + }, + "7_obj_redemption_object_loyalty_card_material_sku": { + "type": "object", + "description": "Defines the SKU material reward redeemed for the particular loyalty card.", + "properties": { + "customer": { + "type": "object", + "description": "Defines the customer redeeming the reward.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" }, - "x-tags": [ - "LOYALTIES API" - ] - }, - "8_obj_loyalty_reward_object": { - "title": "Loyalty Reward Object", - "type": "object", - "description": "This is an object representing a loyalty reward.", - "x-tags": [ - "LOYALTIES API" - ], - "properties": { - "reward": { - "$ref": "#/components/schemas/4_obj_reward_object" - }, - "assignment": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" - }, - "object": { - "type": "string", - "default": "loyalty_reward", - "description": "The type of object represented by JSON. This object stores information about the loyalty reward object." - } + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" } - }, - "8_obj_loyalty_points_bucket": { - "type": "object", - "title": "Loyalty Points Bucket Object", - "description": "This is an object representing a loyalty points bucket.", - "properties": { - "id": { - "type": "string", - "example": "lopb_zdeIBq3EsnPnRSDa7Tyyb6X2", - "description": "Unique loyalty points bucket ID." - }, - "voucher_id": { - "type": "string", - "example": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", - "description": "Unique parent loyalty card ID." - }, - "campaign_id": { - "type": "string", - "example": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "description": "Unique parent campaign ID." - }, - "bucket": { - "type": "object", - "description": "Defines the number of points stored in the given loyalty points bucket.", - "properties": { - "total_points": { - "type": "integer", - "description": "Total number of points in the loyalty points bucket." - } + } + }, + "assignment_id": { + "type": "string", + "example": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", + "description": "Unique reward assginment ID assigned by Voucherify." + }, + "product": { + "description": "Details of the SKU's parent product redeemed as a reward.", + "$ref": "#/components/schemas/11_obj_product_object_truncated" + }, + "sku": { + "description": "Details of the SKU redeemed as a reward.", + "$ref": "#/components/schemas/11_obj_sku_object" + }, + "id": { + "type": "string", + "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "description": "Unique reward ID assigned by Voucherify." + }, + "object": { + "type": "string", + "default": "reward", + "description": "Type of object represented is `reward`." + }, + "name": { + "type": "string", + "description": "Reward name." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the reward was created." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the reward was updated." + }, + "parameters": { + "type": "object", + "description": "These are parameters representing a material reward.", + "properties": { + "product": { + "type": "object", + "description": "Defines the SKU redeemed as a reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique product ID assignedy by Voucherify of the SKU's parent." + }, + "sku_id": { + "type": "string", + "description": "Unique SKU ID assigned by Voucherify of the SKU redeemed as a reward." } - }, - "status": { - "type": "string", - "enum": [ - "ACTIVE" - ], - "description": "Loyalty points bucket point status." - }, - "expires_at": { - "type": "string", - "example": "2022-11-30", - "format": "date", - "description": "Date when the number of points defined in the `bucket` object are due to expire." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-11-21T13:49:54.949Z", - "description": "Timestamp representing the date and time when the loyalty points bucket object was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "example": "2022-08-30T08:34:45.989Z", - "format": "date-time", - "description": "Timestamp representing the date and time when the loyalty points bucket object was updated in ISO 8601 format." - }, - "object": { - "type": "string", - "default": "loyalty_points_bucket", - "description": "The type of object represented by JSON. This object stores information about the loyalty points bucket." } } - }, - "8_obj_loyalty_tier_reward_object": { - "title": "Loyalty Tier Reward Object", - "type": "object", - "description": "This is an object representing a loyalty tier reward.", - "x-tags": [ - "LOYALTIES API" - ], - "properties": { - "reward": { - "$ref": "#/components/schemas/4_obj_reward_object" - }, - "assignment": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" - }, - "object": { - "type": "string", - "default": "loyalty_tier_reward", - "description": "The type of object represented by JSON. This object stores information about the loyalty tier reward." - } + } + }, + "type": { + "type": "string", + "description": "Reward type", + "enum": [ + "MATERIAL" + ] + } + }, + "title": "SKU Material Reward" + }, + "7_obj_redemption_object_loyalty_card_digital": { + "type": "object", + "description": "Defines the digital reward redeemed for the particular loyalty card.", + "properties": { + "customer": { + "type": "object", + "description": "Defines the customer redeeming the reward.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" } - }, - "8_obj_loyalty_card_object_non_expanded_categories": { - "title": "Loyalty Card Object", - "type": "object", - "description": "This is an object representing a loyalty card.", - "examples": [ - { - "id": "v_hrMBBeT4sOP9VSGPmj5KAgJwX202UjiY", - "code": "LOYALTY-CARD-xLPbpbXR", - "campaign": "Loyalty Program Fall 2022", - "campaign_id": "camp_f7fBbQxUuTN7dI7tGOo5XMDA", - "category": "First", - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" - } - ], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 110, - "balance": 100, - "next_expiration_date": "2023-12-31", - "next_expiration_points": 100 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8/6I6hUEqtz/F6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD/DjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8%2F6I6hUEqtz%2FF6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD%2FDjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/SpYuOrU9wd6/o1wzy6E/04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ/FJtiw69djuzQk1f4HdQo8s5gaZ7fd2U+1zbaeAvi9usyvRHZE4=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FSpYuOrU9wd6%2Fo1wzy6E%2F04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ%2FFJtiw69djuzQk1f4HdQo8s5gaZ7fd2U%2B1zbaeAvi9usyvRHZE4%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-19T07:56:22.355Z", - "updated_at": "2022-09-19T08:04:22.458Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 1, - "redeemed_points": 10, - "object": "list", - "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/redemptions?page=1&limit=10" + } + }, + "assignment_id": { + "type": "string", + "example": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", + "description": "Unique reward assginment ID assigned by Voucherify." + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Voucher object." + }, + "id": { + "type": "string", + "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "description": "Unique reward ID assigned by Voucherify." + }, + "object": { + "type": "string", + "default": "reward", + "description": "Type of object represented is `reward`." + }, + "name": { + "type": "string", + "description": "Reward name." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the reward was created." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the reward was updated." + }, + "parameters": { + "type": "object", + "description": "These are parameters representing a digital reward. These can be in the form of discount coupons, gift card credits, or loyalty point credits.", + "properties": { + "campaign": { + "description": "Defines the source of the digital reward.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital_discount_voucher" }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/publications?page=1&limit=10" + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital_gift_card_credits" }, - "object": "voucher" - } - ], - "properties": { - "id": { - "type": "string", - "example": "v_mkZN9v7vjYUadXnHrMza8W5c34fE5KiV", - "description": "Assigned by the Voucherify API, identifies the voucher." - }, - "code": { - "type": "string", - "example": "WVPblOYX", - "description": "A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters." - }, - "campaign": { - "type": "string", - "example": "Loyalty Card Campaign", - "description": "A unique campaign name, identifies the voucher's parent campaign." - }, - "campaign_id": { - "type": "string", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "description": "Assigned by the Voucherify API, identifies the voucher's parent campaign." - }, - "category": { - "type": "string", - "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint." - }, - "category_id": { - "type": "string", - "description": "Unique category ID assigned by Voucherify.", - "example": "cat_0bb343dee3cdb5ec0c" - }, - "categories": { - "type": "array", - "description": "Contains details about the category.", - "items": { - "$ref": "#/components/schemas/20_obj_category_object" - } - }, - "type": { - "type": "string", - "enum": [ - "LOYALTY_CARD" - ], - "description": "Defines the type of voucher. " - }, - "discount": { - "default": null, - "description": "Object representing discount parameters. Child attributes are present only if `type` is `DISCOUNT_VOUCHER`. Defaults to `null`.", - "type": "null" - }, - "gift": { - "type": "null", - "description": "Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`." - }, - "loyalty_card": { - "type": "object", - "description": "Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`.", - "properties": { - "points": { - "type": "integer", - "example": 7000, - "description": "Total points incurred over lifespan of loyalty card." - }, - "balance": { - "type": "integer", - "example": 6970, - "description": "Points available for reward redemption." - }, - "next_expiration_date": { - "type": "string", - "format": "date", - "example": "2023-05-30", - "description": "The next closest date when the next set of points are due to expire." - }, - "next_expiration_points": { - "type": "integer", - "description": "The amount of points that are set to expire next." - } - } - }, - "start_date": { - "type": "string", - "example": "2021-12-01T00:00:00.000Z", - "format": "date-time", - "description": "Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. " - }, - "expiration_date": { - "type": "string", - "example": "2021-12-31T00:00:00.000Z", - "format": "date-time", - "description": "Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the voucher is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "example": "PT1H", - "description": "Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a `duration` of `PT1H` will be valid for a duration of one hour." - }, - "interval": { - "type": "string", - "example": "P2D", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an `interval` of `P2D` will be active every other day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "enum": [ - [ - 0 - ], - [ - 1 - ], - [ - 2 - ], - [ - 3 - ], - [ - 4 - ], - [ - 5 - ], - [ - 6 - ] - ], - "description": "Integer array corresponding to the particular days of the week in which the voucher is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" - }, - "additional_info": { - "type": "string", - "description": "An optional field to keep any extra textual information about the code such as a code description and details." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - }, - "assets": { - "type": "object", - "description": "Stores links to images of QR and barcode that correspond to an encrypted voucher code.", - "properties": { - "qr": { - "type": "object", - "description": "Stores Quick Response (QR) representation of encrypted code.", - "properties": { - "id": { - "type": "string", - "example": "U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK+t4pp7U7oFzjGJzj9q/bmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg+BaZk5QwXMf8k/OzSlOEVybpwSq+AiqPoNtjeuqtIgkDyvT6Q==", - "description": "Encrypted voucher code ID." - }, - "url": { - "type": "string", - "example": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK%2Bt4pp7U7oFzjGJzj9q%2FbmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg%2BBaZk5QwXMf8k%2FOzSlOEVybpwSq%2BAiqPoNtjeuqtIgkDyvT6Q%3D%3D", - "description": "URL to QR code \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" - } - } - }, - "barcode": { - "type": "object", - "description": "Stores barcode representation of encrypted code.", - "properties": { - "id": { - "type": "string", - "example": "U2FsdGVkX19eJhGfWwUrH9+tulBkON+AnMktic+N6CVWzZ9+fHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ+kJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6/pFs61apEn9SJx32ttCF6d3oxKISQQ==", - "description": "Encrypted voucher code ID." - }, - "url": { - "type": "string", - "example": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19eJhGfWwUrH9%2BtulBkON%2BAnMktic%2BN6CVWzZ9%2BfHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ%2BkJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6%2FpFs61apEn9SJx32ttCF6d3oxKISQQ%3D%3D", - "description": "URL to barcode \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" - } - } - } - } - }, - "is_referral_code": { - "type": "boolean", - "description": "Flag indicating whether this voucher is a referral code." - }, - "created_at": { - "type": "string", - "example": "2021-12-22T10:13:06.487Z", - "description": "Timestamp representing the date and time when the voucher was created in ISO 8601 format.", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "example": "2021-12-22T10:14:45.316Z", - "format": "date-time", - "description": "Timestamp representing the date and time when the voucher was last updated in ISO 8601 format." - }, - "holder_id": { - "type": "string", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "description": "Unique customer ID of voucher owner." - }, - "redemption": { - "type": "object", - "description": "Stores a summary of redemptions that have been applied to the voucher.", - "properties": { - "quantity": { - "type": "integer", - "description": "How many times a voucher can be redeemed. A `null` value means unlimited." - }, - "redeemed_quantity": { - "type": "integer", - "example": 1, - "description": "How many times a voucher has already been redeemed." - }, - "redeemed_points": { - "type": "integer", - "example": 100000, - "description": "Total loyalty points redeemed." - }, - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute." - }, - "url": { - "type": "string", - "example": "/v1/vouchers/WVPblOYX/redemptions?page=1&limit=10", - "description": "The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`" - } - } - }, - "publish": { - "type": "object", - "description": "This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or publish voucher API method. \n\n\n\n| Required | Optional |\n| -------- | :------: |\n| `type`:`LOYALTY_CARD` | `type`:`DISCOUNT_VOUCHER` | \n| `is_referral_code`:`true` | `type`:`GIFT_VOUCHER` |\n", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute." - }, - "count": { - "type": "integer", - "example": 0, - "description": "Publication events counter." - }, - "url": { - "type": "string", - "example": "/v1/vouchers/WVPblOYX/publications?page=1&limit=10", - "description": "The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`" - } + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital_loyalty_card_points" } - }, - "object": { - "type": "string", - "description": "The type of object represented by JSON. Default is `voucher`.", - "default": "voucher" - } + ] } - }, - "8_res_get_loyalty_card_transactions": { - "title": "Get Loyalty Card Transactions Response Body", - "type": "object", - "description": "List of loyalty card transactions", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of transaction objects." - }, - "data": { - "type": "array", - "description": "A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object.", - "items": { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object" - } - }, - "has_more": { - "type": "boolean", - "description": "As query results are always limited (by the limit parameter), the `has_more` flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results." - } + } + }, + "type": { + "type": "string", + "description": "Reward type", + "enum": [ + "CAMPAIGN" + ] + } + }, + "title": "Digital Reward" + }, + "7_obj_redemption_object_loyalty_card_digital_discount_voucher": { + "type": "object", + "title": "Discount Voucher", + "description": "Contains information about the source of the digital reward.", + "properties": { + "id": { + "type": "string", + "example": "camp_0dJG7cCAjquzcxWmZ634bA0C", + "description": "Unique parent campaign ID of reward." + }, + "type": { + "type": "string", + "description": "Campaign type.", + "enum": [ + "DISCOUNT_COUPONS" + ] + } + } + }, + "7_obj_redemption_object_loyalty_card_digital_gift_card_credits": { + "type": "object", + "title": "Gift Card", + "description": "Contains information about the source of the digital reward.", + "properties": { + "id": { + "type": "string", + "example": "camp_0dJG7cCAjquzcxWmZ634bA0C", + "description": "Unique parent campaign ID of reward." + }, + "balance": { + "type": "integer", + "description": "The amount credited to the gift card as a reward expressed as the smallest currency unit (that is, 100 cents for $1.00)." + }, + "type": { + "type": "string", + "description": "Campaign type.", + "enum": [ + "GIFT_VOUCHERS" + ] + } + } + }, + "7_obj_redemption_object_loyalty_card_digital_loyalty_card_points": { + "type": "object", + "title": "Loyalty Card", + "description": "Contains information about the source of the digital reward.", + "properties": { + "id": { + "type": "string", + "example": "camp_0dJG7cCAjquzcxWmZ634bA0C", + "description": "Unique parent campaign ID of reward." + }, + "balance": { + "type": "integer", + "description": "The number of loyalty points that is added to the loyalty card as a reward." + }, + "type": { + "type": "string", + "description": "Campaign type.", + "enum": [ + "LOYALTY_PROGRAM" + ] + } + } + }, + "7_obj_redemption_rollback_object_gift_card": { + "type": "object", + "title": "Rollback Gift Card", + "description": "This is an object representing a gift card redemption rollback.", + "properties": { + "id": { + "type": "string", + "example": "rr_0bc92f81a6801f9bca", + "description": "Unique redemption rollback ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", + "default": "redemption_rollback" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "amount": { + "type": "integer", + "description": "The amount added back to the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the initial redemption.", + "example": "r_0c5bf3323008a35032" + }, + "reason": { + "type": "string", + "description": "The reason for the redemption rollback." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "$ref": "#/components/schemas/7_obj_order_object_rollback" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption rollback was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } - }, - "1_obj_loyalty_card_transaction_object": { - "title": "Loyalty Card Transaction Object", - "description": "Loyalty card transaction object", - "anyOf": [ - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_redemption" - }, - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_accrual" - }, - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_accrual_custom_event" - }, - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_refund" - }, - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_addition" - }, - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_removal" - }, - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_expiration" - }, - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_transfer_out" - }, - { - "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_transfer_in" - } - ] - }, - "1_obj_loyalty_card_transaction_object_redemption": { - "title": "Redemption", - "description": "When loyalty points are used to pay for an order.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is `null`." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "source": { - "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is `null`." - }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred. In case of a redemption, this value is `null`." - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "POINTS_REDEMPTION", - "enum": [ - "POINTS_REDEMPTION" - ] - }, - "details": { - "type": "object", - "description": "Contains the detailed information about the transaction.", - "properties": { - "balance": { - "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", - "properties": { - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "loyalty_card" - }, - "total": { - "type": "integer", - "description": "The available points prior to the transaction." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, - "points": { - "type": "integer", - "description": "The amount of points being used up in the transaction." - }, - "balance": { - "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." - }, - "related_object": { - "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "type": { - "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" - } - } - } - } - }, - "order": { - "type": "object", - "description": "Contains information about the original order.", - "properties": { - "id": { - "type": "string", - "description": "Unique order ID.", - "example": "ord_jj5EzDxDOd2xFPsAJJ18IaZK" - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - } - } - }, - "redemption": { - "type": "object", - "description": "Contains information about the original redemption.", - "properties": { - "id": { - "type": "string", - "description": "Unique redemption ID.", - "example": "r_0c94ed583fcafc31c1" - } - } - }, - "reward": { - "type": "object", - "description": "Contains information about the pay with points reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique reward ID.", - "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1" - }, - "name": { - "type": "string", - "description": "Reward name.", - "example": "100 = $20" - } - } - } - } - }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of this type of transaction." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." - } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the gift card.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" } - }, - "1_obj_loyalty_card_transaction_object_accrual": { - "title": "Accrual", - "description": "When points are earned on the card through an earning rule.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a points accrual, this value is `null`." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "source": { - "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", - "enum": [ - "Automation" - ] - }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred. In case of a points accrual, this value is `null`." - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "POINTS_ACCRUAL", - "enum": [ - "POINTS_ACCRUAL" - ] - }, - "details": { - "type": "object", - "description": "Contains the detailed information about the transaction.", - "properties": { - "balance": { - "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", - "properties": { - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "loyalty_card" - }, - "total": { - "type": "integer", - "description": "The available points after the transaction." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, - "points": { - "type": "integer", - "description": "The amount of points being added in the transaction." - }, - "balance": { - "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." - }, - "related_object": { - "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "type": { - "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" - } - } - } - } - }, - "order": { - "type": "object", - "description": "Contains information about the original order.", - "properties": { - "id": { - "type": "string", - "description": "Unique order ID.", - "example": "ord_jj5EzDxDOd2xFPsAJJ18IaZK" - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - } - } - }, - "event": { - "type": "object", - "description": "Contains information about the event that triggers the point accrual.", - "properties": { - "id": { - "type": "string", - "description": "Unique event ID.", - "example": "evcus_0c9c21def34e3c05bf" - }, - "type": { - "type": "string", - "description": "Type of event.", - "example": "customer.order.paid" - } - } - }, - "earning_rule": { - "type": "object", - "description": "Contains information about the earning rule.", - "properties": { - "id": { - "type": "string", - "description": "Unique earning rule ID.", - "example": "ern_2WsCIBEx6Lzf5IAV5IOR7a23" - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name.", - "properties": { - "banner": { - "type": "string", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - } - } - } - } - } - } - }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of this type of transaction." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." - } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "type": "object", + "description": "Defines the details of the voucher being redeemed.", + "properties": { + "id": { + "type": "string", + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" } - }, - "1_obj_loyalty_card_transaction_object_accrual_custom_event": { - "title": "Accrual for Custom Event", - "description": "When points are earned on the card through an earning rule based on a custom event.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a points accrual, this value is `null`." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "source": { - "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", - "enum": [ - "Automation" - ] - }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred. In case of a points accrual, this value is `null`." - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "POINTS_ACCRUAL", - "enum": [ - "POINTS_ACCRUAL" - ] - }, - "details": { - "type": "object", - "description": "Contains the detailed information about the transaction.", - "properties": { - "balance": { - "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", - "properties": { - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "loyalty_card" - }, - "total": { - "type": "integer", - "description": "The available points after the transaction." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, - "points": { - "type": "integer", - "description": "The amount of points being added in the transaction." - }, - "balance": { - "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." - }, - "related_object": { - "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "type": { - "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" - } - } - } - } - }, - "event": { - "type": "object", - "description": "Contains information about the customer event that triggers the point accrual.", - "properties": { - "id": { - "type": "string", - "description": "Unique event ID.", - "example": "evcus_0c9c21def34e3c05bf" - }, - "type": { - "type": "string", - "description": "Type of event.", - "example": "customer.custom_event" - } - } - }, - "earning_rule": { - "type": "object", - "description": "Contains information about the earning rule.", - "properties": { - "id": { - "type": "string", - "description": "Unique earning rule ID.", - "example": "ern_2WsCIBEx6Lzf5IAV5IOR7a23" - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name.", - "properties": { - "banner": { - "type": "string", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - } - } - } - } - }, - "custom_event": { - "type": "object", - "description": "Contains information about the custom event that triggers the point accrual.", - "properties": { - "id": { - "type": "string", - "description": "Unique event ID.", - "example": "event_0cc916d8374bfe8bc2" - }, - "type": { - "type": "string", - "description": "Type of custom event.", - "example": "user_subscribed" - } - } - }, - "event_schema": { - "type": "object", - "description": "Contains information about the custom event metadata schema.", - "properties": { - "id": { - "type": "string", - "description": "Unique metadata schema ID.", - "example": "ms_qpRZ3EmRQyszNH6Z52Gkq8au" - }, - "type": { - "type": "string", - "description": "Type of custom event.", - "example": "user_subscribed" - } - } - } - } - }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of this type of transaction." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." - } + } + }, + "gift": { + "type": "object", + "description": "Contains the amount being adde back to the gift card for the redemption rollback", + "properties": { + "amount": { + "type": "integer", + "description": "The amount added back to the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." } - }, - "1_obj_loyalty_card_transaction_object_refund": { - "title": "Refund", - "description": "When points are credited back to a card through a redemption rollback.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a points refund, this value is `null`." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "source": { - "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a points refund, this value is `null`." - }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred. In case of a points refund, this value is `null`." - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "POINTS_REFUND", - "enum": [ - "POINTS_REFUND" - ] - }, - "details": { - "type": "object", - "description": "Contains the detailed information about the transaction.", - "properties": { - "balance": { - "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", - "properties": { - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "loyalty_card" - }, - "total": { - "type": "integer", - "description": "The available points after the transaction." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, - "points": { - "type": "integer", - "description": "The amount of points being added in the transaction." - }, - "balance": { - "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." - }, - "related_object": { - "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "type": { - "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" - } - } - } - } - }, - "order": { - "type": "object", - "description": "Contains information about the original order.", - "properties": { - "id": { - "type": "string", - "description": "Unique order ID.", - "example": "ord_jj5EzDxDOd2xFPsAJJ18IaZK" - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - } - } - }, - "redemption": { - "type": "object", - "description": "Contains information about the original redemption.", - "properties": { - "id": { - "type": "string", - "description": "Unique redemption ID.", - "example": "r_0c94ed583fcafc31c1" - } - } - }, - "rollback": { - "type": "object", - "description": "Contains information about the redemption rollback.", - "properties": { - "id": { - "type": "string", - "description": "Unique redemption rollback ID.", - "example": "rr_0c9b0967244a862a33" - } - } - }, - "reward": { - "type": "object", - "description": "Contains information about the pay with points reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique reward ID.", - "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1" - }, - "name": { - "type": "string", - "description": "Reward name.", - "example": "100 = $20" - } - } - } - } - }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of this type of transaction." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." - } + } + } + } + }, + "7_obj_redemption_object_gift_card": { + "type": "object", + "title": "Gift Card", + "description": "This is an object representing a gift card redemption.", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "amount": { + "type": "integer", + "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the parent redemption if this particular redemption was issued through a stacked redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } - }, - "1_obj_loyalty_card_transaction_object_addition": { - "title": "Addition", - "description": "When points are added to a card.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "source": { - "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", - "enum": [ - "voucherify-web-ui", - "API" - ] - }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred." - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "POINTS_ADDITION", - "enum": [ - "POINTS_ADDITION" - ] - }, - "details": { - "type": "object", - "description": "Contains the detailed information about the transaction.", - "properties": { - "balance": { - "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", - "properties": { - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "loyalty_card" - }, - "total": { - "type": "integer", - "description": "The available points after the transaction." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, - "points": { - "type": "integer", - "description": "The amount of points being added in the transaction." - }, - "balance": { - "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." - }, - "related_object": { - "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "type": { - "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" - } - } - } - } - } - } - }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of this type of transaction." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." - } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the gift card.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" } - }, - "1_obj_loyalty_card_transaction_object_removal": { - "title": "Removal", - "description": "When points are removed from a card.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "source": { - "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", - "enum": [ - "voucherify-web-ui", - "API" - ] - }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred." - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "POINTS_REMOVAL", - "enum": [ - "POINTS_REMOVAL" - ] - }, - "details": { - "type": "object", - "description": "Contains the detailed information about the transaction.", - "properties": { - "balance": { - "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", - "properties": { - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "loyalty_card" - }, - "total": { - "type": "integer", - "description": "The available points after the transaction." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, - "points": { - "type": "integer", - "description": "The amount of points being subtracted in the transaction." - }, - "balance": { - "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." - }, - "related_object": { - "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "type": { - "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" - } - } - } - } - } - } - }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of this type of transaction." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." - } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "type": "object", + "description": "Defines the details of the voucher being redeemed.", + "properties": { + "id": { + "type": "string", + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" } - }, - "1_obj_loyalty_card_transaction_object_expiration": { - "title": "Expiration", - "description": "When points expire.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a points expiration, this value is `null`." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "source": { - "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", - "enum": [ - "Automation" - ] - }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred. In case of a points expiration, this value is `null`." - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "POINTS_EXPIRATION", - "enum": [ - "POINTS_EXPIRATION" - ] - }, - "details": { - "type": "object", - "description": "Contains the detailed information about the transaction.", - "properties": { - "balance": { - "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", - "properties": { - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "loyalty_card" - }, - "total": { - "type": "integer", - "description": "The available points after the transaction." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, - "points": { - "type": "integer", - "description": "The amount of points removed during the transaction." - }, - "balance": { - "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." - }, - "related_object": { - "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "type": { - "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" - } - } - } - } - } + } + }, + "gift": { + "type": "object", + "description": "Contains the amount being subtracted from the gift card for the redemption.", + "properties": { + "amount": { + "type": "integer", + "description": "The amount subtracted from the gift card expressed as the smallest currency unit (that is, 100 cents for $1.00)." + } + } + } + } + }, + "7_obj_redemption_object_voucher_fail": { + "type": "object", + "title": "Failed Voucher Redemption", + "description": "This is an object representing a failed redemption for a voucher.", + "properties": { + "id": { + "type": "string", + "example": "rf_0bbaccc96e0830ff9e", + "description": "Unique failed redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "failure_code": { + "type": "string", + "example": "customer_rules_violated", + "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." + }, + "failure_message": { + "type": "string", + "description": "If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed." + }, + "order": { + "type": "null" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |\n", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "voucher": { + "type": "object", + "description": "Defines the voucher details.", + "properties": { + "id": { + "type": "string", + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + } + } + } + } + }, + "7_obj_redemption_object_promotion_tier_fail": { + "type": "object", + "title": "Failed Promotion Tier Redemption", + "description": "This is an object representing a failed redemption for a promotion tier.", + "properties": { + "id": { + "type": "string", + "example": "rf_0bbaccc96e0830ff9e", + "description": "Unique failed redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the redemption.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "failure_code": { + "type": "string", + "example": "customer_rules_violated", + "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." + }, + "failure_message": { + "type": "string", + "description": "If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed." + }, + "order": { + "type": "null" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the promotion.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n", + "enum": [ + "promotion_tier" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify.", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" + }, + "voucher": { + "type": "null" + }, + "promotion_tier": { + "type": "object", + "description": "Contains details about the promotion tier and it's parent campaign.", + "properties": { + "id": { + "type": "string", + "description": "Unique promotion tier ID assigned by Voucherify.", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" + }, + "campaign": { + "type": "object", + "description": "Promotion tier's parent campaign.", + "properties": { + "id": { + "type": "string", + "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." } - }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of this type of transaction." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." } } - }, - "1_obj_loyalty_card_transaction_object_transfer_out": { - "title": "Transfer Out", - "description": "When points are transferred from one loyalty card to another.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "source": { - "type": "string", - "description": "The channel through which the transaction took place.", - "enum": [ - "API" - ] - }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred." - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "POINTS_TRANSFER_OUT", - "enum": [ - "POINTS_TRANSFER_OUT" - ] - }, - "details": { - "type": "object", - "description": "Contains the detailed information about the transaction.", - "properties": { - "balance": { - "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", - "properties": { - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "loyalty_card" - }, - "total": { - "type": "integer", - "description": "The available points after the transaction." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, - "points": { - "type": "integer", - "description": "The amount of points being subtracted in the transaction." - }, - "balance": { - "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." - }, - "related_object": { - "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "type": { - "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" - } - } - } - } - }, - "destination_voucher": { - "type": "object", - "description": "Contains information on how the balance on the receiving loyalty card was affected by the transaction.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the destination voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "code": { - "type": "string", - "description": "Unique code of the destination voucher.", - "example": "LOYALTY-CARD-A8XVurg" - }, - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "LOYALTY_CARD" - }, - "campaign": { - "type": "string", - "description": "Unqiue campaign name of the voucher's parent campaign." - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "loyalty_card": { - "type": "object", - "description": "Contains information on how the balance on the receiving loyalty card was affected by the transaction.", - "properties": { - "points": { - "type": "integer", - "description": "The total amount of points after the transaction." - }, - "balance": { - "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." - }, - "next_expiration_date": { - "type": "string", - "description": "The date when the next set of points are due to expire, i.e. `YYYY-MM-DD`. This does not mean that the transferred points were added to this bucket. It only shows the next set of points due to expire. The transferred points are added to the last expiring bucket, i.e. to the bucket of points that are to expire the furthest in the future.", - "example": "2023-12-31" - }, - "next_expiration_points": { - "type": "integer", - "description": "The number of points due to expire on the next expiration date." - } - } - }, - "is_referral_code": { - "type": "integer", - "description": "Flag indicating whether this voucher is a referral code." - } - } - } - } - }, - "related_transaction_id": { - "type": "string", - "description": "The related transaction ID on the receiving card.", - "example": "vtx_0c9afe802593b34b81" - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." - } + } + } + } + }, + "7_obj_redemption_object_fail": { + "type": "object", + "title": "Failed Redemption", + "description": "This is an object representing a failed redemption when a resource to be redeemed cannot be found.", + "properties": { + "id": { + "type": "string", + "example": "rf_0c4c7baf58c243af6b", + "description": "Unique failed redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the redemption.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "null", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "null", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "failure_code": { + "type": "string", + "example": "not_found", + "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." + }, + "failure_message": { + "type": "string", + "description": "If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed." + }, + "order": { + "type": "null" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } - }, - "1_obj_loyalty_card_transaction_object_transfer_in": { - "title": "Transfer In", - "description": "When points are transferred in from another loyalty card.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a ponits transfer, this value is `null`." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "source": { - "type": "string", - "description": "The channel through which the transaction took place.", - "enum": [ - "API" - ] - }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred." - }, - "type": { - "type": "string", - "description": "Type of transaction.", - "default": "POINTS_TRANSFER_IN", - "enum": [ - "POINTS_TRANSFER_IN" - ] - }, - "details": { - "type": "object", - "description": "Contains the detailed information about the transaction.", - "properties": { - "balance": { - "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", - "properties": { - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "loyalty_card" - }, - "total": { - "type": "integer", - "description": "The available points after the transaction." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON.", - "default": "balance" - }, - "points": { - "type": "integer", - "description": "The amount of points being added in the transaction." - }, - "balance": { - "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." - }, - "related_object": { - "type": "object", - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "type": { - "type": "string", - "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" - } - } - } - } - }, - "source_voucher": { - "type": "object", - "description": "Contains information on how the balance on the donor loyalty card was affected by the transaction.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the source voucher that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - }, - "code": { - "type": "string", - "description": "Unique code of the source voucher.", - "example": "LOYALTY-CARD-A8XVurg" - }, - "type": { - "type": "string", - "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "LOYALTY_CARD" - }, - "campaign": { - "type": "string", - "description": "Unqiue campaign name of the voucher's parent campaign." - }, - "holder_id": { - "type": "string", - "description": "Unqiue customer ID of the loyalty card holder, this is the ID that was assigned by the Voucherify API.", - "example": "cust_xqA7DGj5eYPHg6PHVKwYRWiA" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, - "loyalty_card": { - "type": "object", - "description": "Contains information on how the balance on the source loyalty card was affected by the transaction.", - "properties": { - "points": { - "type": "integer", - "description": "The total amount of points after the transaction." - }, - "balance": { - "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." - }, - "next_expiration_date": { - "type": "string", - "description": "The date when the next set of points are due to expire, i.e. `YYYY-MM-DD`. The points from the source loyalty card are taken from the expiration bucket(s) that are the first coming up to expire, starting from the first expiration bucket to expire in time. This parameter shows the next expiration date after the points were taken out of the loyalty card.", - "example": "2023-12-31" - }, - "next_expiration_points": { - "type": "integer", - "description": "The number of points due to expire on the expiration date." - } - } - }, - "is_referral_code": { - "type": "integer", - "description": "Flag indicating whether this voucher is a referral code." - } - } - } - } - }, - "related_transaction_id": { - "type": "string", - "description": "The related transaction ID on the source card.", - "example": "vtx_0c9afe802593b34b81" - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." - } + } + }, + "customer": { + "type": "null" + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| redemption | Related redemption. |\n", + "enum": [ + "redemption" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify.", + "example": "rf_0c5bde8dfc0156f0e3" + }, + "voucher": { + "type": "null" + } + } + }, + "7_obj_redemption_rollback_object_voucher_fail": { + "type": "object", + "title": "Failed Voucher Redemption Rollback", + "description": "This is an object representing a failed redemption rollback for a voucher.", + "properties": { + "id": { + "type": "string", + "example": "rrf_0c63990fed133bfb88", + "description": "Unique failed redemption rollback ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", + "default": "redemption_rollback" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "redemption": { + "type": "string", + "description": "The unique redemption ID of the initial redemption.", + "example": "r_0c5d6689b35320059a" + }, + "reason": { + "type": "string", + "description": "The reason for the redemption rollback." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "failure_code": { + "type": "string", + "example": "already_rolled_back", + "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." + }, + "failure_message": { + "type": "string", + "description": "If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed." + }, + "order": { + "type": "null" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption rollback was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } - }, - "8_req_create_loyalty_card_transactions_export": { - "type": "object", - "title": "Create Loyalty Card Transactions Export Request Body", - "description": "Request body schema for **POST** `/loyalties/members/{memberId}/transactions/export`.", - "properties": { - "parameters": { - "$ref": "#/components/schemas/8_obj_export_loyalty_card_transactions", - "description": "Contains the parameters that define the data to be exported." - } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" } - }, - "8_obj_export_loyalty_card_transactions": { - "description": "List of available fields and filters that can be exported with a loyalty card transactions export along with the sorting order of the returned data.", - "title": "Export Transactions", - "type": "object", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "-created_at", - "created_at" - ] - }, - "fields": { - "type": "array", - "enum": [ - [ - "id", - "type", - "source_id", - "reason", - "balance", - "amount", - "created_at", - "voucher_id", - "campaign_id", - "source", - "details", - "related_transaction_id" - ] - ], - "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID assigned by Voucherify. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `POINTS_EXPIRATION`
                  - `POINTS_ADDITION`
                  - `POINTS_REMOVAL`
                  - `POINTS_TRANSFER_OUT`
                  - `POINTS_ACCRUAL`
                  - `POINTS_REFUND`
                  - `POINTS_REDEMPTION` |\n| source_id | Custom source ID of the transaction if one was included originally. | source_id_custom |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The loyalty card balance after the transaction. | |\n| amount | The amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | - `API`
                  - `voucherify-web-ui`
                  - `Automation` |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n| related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |", - "items": { - "type": "string" + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n\n| **Related Object** | **Definition** |\n| :--- | :--- |\n| voucher | Either a discount voucher, gift card, or loyalty card. |\n", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "voucher": { + "type": "object", + "description": "Defines the voucher details.", + "properties": { + "id": { + "type": "string", + "description": "Unique voucher ID assigned by Voucherify.", + "example": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + }, + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "campaign": { + "type": "string", + "description": "Voucher's parent campaign name." + }, + "campaign_id": { + "type": "string", + "description": "Unique campaign ID assigned by Voucherify.", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + } + } + } + } + }, + "7_obj_redemption_rollback_object_promotion_tier_fail": { + "type": "object", + "title": "Failed Promotion Tier Redemption Rollback", + "description": "This is an object representing a failed redemption rollback for a promotion tier.", + "properties": { + "id": { + "type": "string", + "example": "rrf_0c5eb3bd884497ed05", + "description": "Unique failed redemption rollback ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", + "default": "redemption_rollback" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "redemption": { + "type": "string", + "description": "The unique redemption ID of the initial redemption.", + "example": "r_0c5d6689b35320059a" + }, + "reason": { + "type": "string", + "description": "The reason for the redemption rollback." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "failure_code": { + "type": "string", + "example": "customer_rules_violated", + "description": "If the result is `FAILURE`, this parameter will provide a generic reason as to why the redemption failed." + }, + "failure_message": { + "type": "string", + "description": "If the result is `FAILURE`, this parameter will provide a more expanded reason as to why the redemption failed." + }, + "order": { + "type": "null" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption rollback was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the promotion.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.\n", + "enum": [ + "promotion_tier" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify.", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" + }, + "voucher": { + "type": "null" + }, + "promotion_tier": { + "type": "object", + "description": "Contains details about the promotion tier and it's parent campaign.", + "properties": { + "id": { + "type": "string", + "description": "Unique promotion tier ID assigned by Voucherify.", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" + }, + "campaign": { + "type": "object", + "description": "Promotion tier's parent campaign.", + "properties": { + "id": { + "type": "string", + "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." } } } - }, - "8_obj_export_transactions_object": { - "title": "Export Object", - "type": "object", - "description": "This is an object representing an export. \n\n Using this endpoint, you can export [loyalty card transactions](ref:list-loyalty-card-transactions) as a CSV file. This functionality works asynchronously and comes down to the following steps: \n* create an export object and return its `id` so you can track its `status`\n* trigger a CSV file generation, change the status to `SCHEDULED`\n* when the generation is over, store the file in S3 and change the `status` to `DONE`\n* now you can (ref:download-export) it\n\nWith `parameters` you can select which `fields` will be exported. An export request will almost always result in a single file being generated by the system. However, when your volume of data is large, the system may split the results into multiple chunks.", - "properties": { - "id": { - "type": "string", - "description": "Unique export ID.", - "example": "exp_FFfp9o7daWuJqJCKp5xqqli4" - }, - "object": { - "type": "string", - "default": "export", - "description": "The type of object being represented. This object stores information about the `export`." - }, - "created_at": { - "type": "string", - "example": "2022-04-28T11:23:20.922Z", - "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format.", - "format": "date-time" - }, - "status": { - "type": "string", - "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.", - "enum": [ - "SCHEDULED", - "IN_PROGRESS", - "DONE", - "ERROR" - ] - }, - "channel": { - "type": "string", - "description": "The channel through which the export was triggered.", - "default": "API" - }, - "exported_object": { - "type": "string", - "description": "The type of exported object.", - "default": "voucher_transactions" - }, - "parameters": { - "$ref": "#/components/schemas/16_obj_export_loyalty_card_transactions" - }, - "result": { - "type": "object", - "description": "Contains the URL of the CSV file.", - "properties": { - "url": { - "type": "string", - "description": "URL of the CSV file location. It contains the `token` used for authorization in the [Download export](ref:download-export) method." - } + } + } + } + }, + "7_obj_redemption_rollback_object_promotion_tier": { + "type": "object", + "title": "Promotion Tier", + "description": "This is an object representing a promotion tier redemption rollback", + "properties": { + "id": { + "type": "string", + "example": "rr_0bc92f81a6801f9bca", + "description": "Unique redemption rollback ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption_rollback`.", + "default": "redemption_rollback" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption rollback occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of initial redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption rollback result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption rollback.", + "$ref": "#/components/schemas/7_obj_order_object_rollback" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption rollback was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption rollback. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption rollback. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.", + "enum": [ + "promotion_tier" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." + }, + "voucher": { + "type": "null" + }, + "promotion_tier": { + "type": "object", + "description": "Contains details of the promotion tier and the parent campaign.", + "properties": { + "id": { + "type": "string", + "description": "Unique promotion tier ID assigned by Voucherify.", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" + }, + "campaign": { + "type": "object", + "description": "Promotion tier's parent campaign.", + "properties": { + "id": { + "type": "string", + "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." } - }, - "user_id": { - "type": "string", - "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the `channel` value is `WEBSITE`.", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH" } } - }, - "8_obj_loyalty_tier_object": { - "type": "object", - "title": "Loyalty Tier Object", - "description": "This is an object representing a loyalty tier. \n\nLoyalty tiers are used to create a loyalty program with different levels of membership and varied earning rules and rewards based on customer’s tiers.", - "properties": { - "id": { - "type": "string", - "example": "ltr_30KHciA0UG8B71Fo51GZqwgN", - "description": "Unique loyalty tier ID." - }, - "name": { - "type": "string", - "description": "Loyalty Tier name." - }, - "campaign_id": { - "type": "string", - "example": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "description": "Unique parent campaign ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-11-10T12:20:52.755Z", - "description": "Timestamp representing the date and time when the loyalty tier was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-11-25T10:59:43.231Z", - "description": "Timestamp representing the date and time when the loyalty tier was updated in ISO 8601 format." - }, - "earning_rules": { - "type": "object", - "description": "Contains a list of earning rule IDs and their points mapping for the given earning rule.", - "properties": { - "unique_earning_rule_ID": { - "description": "ern_95aq3JaE5A8xzHjoJPYNRqXZ", - "anyOf": [ - { - "$ref": "#/components/schemas/8_obj_mapping_multiply" - }, - { - "$ref": "#/components/schemas/8_obj_mapping_fixed" - } - ] - } - } - }, - "rewards": { - "type": "object", - "description": "Contains a list of reward IDs and their points mapping for the given reward.", - "properties": { - "unique_reward_ID": { - "description": "rewa_t88DnSdNnE0IzQX6gqH3jHGQ", - "anyOf": [ - { - "$ref": "#/components/schemas/8_obj_mapping_multiply" - }, - { - "$ref": "#/components/schemas/8_obj_mapping_fixed" - } - ] - } - } - }, - "config": { - "type": "object", - "description": "Defines loyalty tier range in points.", - "properties": { - "points": { - "type": "object", - "description": "Defines range of loyalty tier in points.", - "properties": { - "from": { - "type": "integer", - "description": "Bottom points threshold value." - }, - "to": { - "type": "integer", - "description": "Top points threshold value." - } - } - } - } - }, - "points": { - "type": "object", - "description": "Defines range of loyalty tier in points.", - "properties": { - "from": { - "type": "integer", - "description": "Bottom points threshold value." - }, - "to": { - "type": "integer", - "description": "Top points threshold value." - } - } - }, - "object": { - "type": "string", - "default": "loyalty_tier", - "description": "The type of object represented by JSON. This object stores information about the loyalty." - } + } + } + } + }, + "7_obj_redemption_object_promotion_tier": { + "type": "object", + "title": "Promotion Tier", + "description": "This is an object representing a promotion tier redemption.", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the parent redemption if this particular redemption was issued through a stacked redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } - }, - "8_obj_loyalty_tier_object_member": { - "type": "object", - "title": "Loyalty Tier Object", - "description": "This is an object representing a loyalty tier. \n\nLoyalty tiers are used to create a loyalty program with different levels of membership and varied earning rules and rewards based on customer’s tiers.", - "properties": { - "id": { - "type": "string", - "example": "ltr_30KHciA0UG8B71Fo51GZqwgN", - "description": "Unique loyalty tier ID." - }, - "name": { - "type": "string", - "description": "Loyalty Tier name." - }, - "campaign_id": { - "type": "string", - "example": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "description": "Unique parent campaign ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-11-10T12:20:52.755Z", - "description": "Timestamp representing the date and time when the loyalty tier was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-11-25T10:59:43.231Z", - "description": "Timestamp representing the date and time when the loyalty tier was updated in ISO 8601 format." - }, - "earning_rules": { - "type": "object", - "description": "Contains a list of earning rule IDs and their points mapping for the given earning rule.", - "properties": { - "unique_earning_rule_ID": { - "description": "ern_95aq3JaE5A8xzHjoJPYNRqXZ", - "anyOf": [ - { - "$ref": "#/components/schemas/8_obj_mapping_multiply" - }, - { - "$ref": "#/components/schemas/8_obj_mapping_fixed" - } - ] - } - } - }, - "rewards": { - "type": "object", - "description": "Contains a list of reward IDs and their points mapping for the given reward.", - "properties": { - "unique_reward_ID": { - "description": "rewa_t88DnSdNnE0IzQX6gqH3jHGQ", - "anyOf": [ - { - "$ref": "#/components/schemas/8_obj_mapping_multiply" - }, - { - "$ref": "#/components/schemas/8_obj_mapping_fixed" - } - ] - } - } - }, - "config": { - "type": "object", - "description": "Defines loyalty tier range in points.", - "properties": { - "points": { - "type": "object", - "description": "Defines range of loyalty tier in points.", - "properties": { - "from": { - "type": "integer", - "description": "Bottom points threshold value." - }, - "to": { - "type": "integer", - "description": "Top points threshold value." - } - } - } - } - }, - "points": { - "type": "object", - "description": "Defines range of loyalty tier in points.", - "properties": { - "from": { - "type": "integer", - "description": "Bottom points threshold value." - }, - "to": { - "type": "integer", - "description": "Top points threshold value." - } - } - }, - "expiration": { - "type": "object", - "description": "Contains information about when the expiration tier will expire.", - "properties": { - "customer_id": { - "type": "string", - "example": "cust_qBwHpagDOFu71Z3F22UzR80X", - "description": "Unique customer ID whose point expiration dates are defined in this object." - }, - "campaign_id": { - "type": "string", - "example": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "description": "Unique parent campaign ID." - }, - "tier_id": { - "type": "string", - "example": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2", - "description": "Unique loyalty tier ID." - }, - "start_date": { - "type": "string", - "example": "2022-11-10", - "description": "Exact start date of the loyalty tier for the given customer." - }, - "expiration_date": { - "type": "string", - "example": "2023-02-28", - "description": "Exact expiration date of the loyalty tier for the given customer." - }, - "created_at": { - "type": "string", - "example": "2022-11-09T11:26:26.719Z", - "format": "date-time", - "description": "Timestamp representing the date and time when the loyalty tier expiration was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "example": "2022-11-10T08:54:47.200Z", - "format": "date-time", - "description": "Timestamp representing the date and time when the loyalty tier expiration was created in ISO 8601 format." - } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.", + "enum": [ + "promotion_tier" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." + }, + "voucher": { + "type": "null" + }, + "promotion_tier": { + "type": "object", + "description": "Contains details of the promotion tier and the parent campaign.", + "properties": { + "id": { + "type": "string", + "description": "Unique promotion tier ID assigned by Voucherify.", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" + }, + "campaign": { + "type": "object", + "description": "Promotion tier's parent campaign.", + "properties": { + "id": { + "type": "string", + "example": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "description": "Unique ID assigned by Voucherify of the promotion tier's parent campaign." } - }, - "object": { - "type": "string", - "default": "loyalty_tier", - "description": "The type of object represented by JSON. This object stores information about the loyalty." } } - }, - "8_obj_mapping_multiply": { - "type": "object", - "title": "Multiply Points", - "description": "Points are multiplied by a multiplier.", - "properties": { - "type": { - "type": "string", - "description": "Type of calculation.", - "enum": [ - "MULTIPLY" - ] - }, - "multiplier": { - "type": "integer", - "description": "Multiplication factor used to multiply the points to obtain the mapped points." - } + } + } + } + }, + "7_obj_redemption_object_promotion_tier_extended": { + "type": "object", + "title": "Promotion Tier", + "description": "This is an object representing a promotion tier redemption.", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } - }, - "8_obj_mapping_fixed": { - "type": "object", - "title": "Fixed Points", - "description": "Points are fixed.", - "properties": { - "type": { - "type": "string", - "description": "Type of calculation.", - "enum": [ - "CUSTOM" - ] - }, - "points": { - "type": "integer", - "description": "Fixed number of points to be applied." - } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" } - }, - "8_obj_earning_rule_object": { - "description": "This is an object representing an earning rule.", - "title": "Earning Rule Object", - "examples": [ - { - "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", - "created_at": "2022-02-07T08:19:41.810Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 2, - "type": "FIXED" - }, - "custom_event": { - "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" - }, - "event": "saw_on_facebook", - "source": { - "banner": "Saw on Facebook Timeframe", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-07T08:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "object": "earning_rule", - "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" - }, - { - "id": "ern_taClaOIiaGNdmdby8xS0lCcy", - "created_at": "2022-02-04T13:27:50.665Z", - "updated_at": "2022-02-07T08:19:44.198Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "event": "order.paid", - "source": { - "banner": "Order paid 1000 points", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 4 - ], - "object": "earning_rule", - "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" - }, - { - "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", - "created_at": "2022-02-04T13:02:52.937Z", - "updated_at": "2022-02-07T08:19:43.291Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "segment": { - "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" - }, - "event": "customer.segment.entered", - "source": { - "banner": "Entered segment 100 points.", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" - }, - { - "id": "ern_gVo6CHBduFPoh1hctASfXHLT", - "created_at": "2022-11-24T17:01:42.809Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 4, - "points": 4, - "property": "customer_life_time_value" - } - } - }, - "event": "customer.loyalty.tier.joined", - "loyalty_tier": { - "id": "ltr_pudTGWasuIqxdiDM0go31OV1" - }, - "source": { - "banner": "Tier joined", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_wdlEo17wmoqYHGfilbayEUj7", - "metadata": { - "Type": "Tier joined - customer metadata - proportional" - } - }, - { - "id": "ern_66OdCyLADv5IGFoQe18vGUwa", - "created_at": "2022-11-24T17:03:59.414Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 2, - "points": 2, - "property": "customer_life_time_value" - } - } - }, - "event": "customer.loyalty.tier.left", - "loyalty_tier": { - "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2" - }, - "source": { - "banner": "Tier left", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_czm5el1Uz1jeGaO97AYoDNAq", - "metadata": { - "Type": "Tier left" - } - }, - { - "id": "ern_YR3fDfCjAmz9a5D68nk0i4dm", - "created_at": "2022-11-25T07:29:38.961Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 3, - "points": 4, - "property": "customer_life_time_value" - } - } - }, - "event": "customer.loyalty.tier.upgraded", - "loyalty_tier": { - "id": "ltr_30KHciA0UG8B71Fo51GZqwgN" - }, - "source": { - "banner": "Tier upgraded", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_M1OdRH8spk6Fs7yTuPLN2LAv", - "metadata": { - "Type": "Upgraded" - } - }, - { - "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", - "created_at": "2022-11-25T07:31:05.866Z", - "updated_at": "2022-11-25T07:31:43.029Z", - "validation_rule_id": "val_kfmWpfXMI9P1", - "loyalty": { - "points": 1, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.downgraded", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Tier Downgraded", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", - "metadata": { - "Type": "Tier" - } - }, - { - "id": "ern_AdlWO2yt6b6llWsibIdiRXVE", - "created_at": "2022-11-25T07:31:42.767Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 5, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.prolonged", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Prolonged", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_4jH1yq9WJS0oJ8suagCrltyb", - "metadata": {} - } - ], - "anyOf": [ - { - "$ref": "#/components/schemas/8_obj_earning_rule_object_order_paid" - }, - { - "$ref": "#/components/schemas/8_obj_earning_rule_object_custom_event" - }, - { - "$ref": "#/components/schemas/8_obj_earning_rule_object_entered_segment" - }, - { - "$ref": "#/components/schemas/8_obj_earning_rule_object_tier" - } - ] - }, - "8_obj_earning_rule_object_no_validation_rule": { - "description": "This is an object representing an earning rule.", - "title": "Earning Rule Object", - "examples": [ - { - "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", - "created_at": "2022-02-07T08:19:41.810Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 2, - "type": "FIXED" - }, - "custom_event": { - "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" - }, - "event": "saw_on_facebook", - "source": { - "banner": "Saw on Facebook Timeframe", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-07T08:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "object": "earning_rule", - "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" - }, - { - "id": "ern_taClaOIiaGNdmdby8xS0lCcy", - "created_at": "2022-02-04T13:27:50.665Z", - "updated_at": "2022-02-07T08:19:44.198Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "event": "order.paid", - "source": { - "banner": "Order paid 1000 points", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 4 - ], - "object": "earning_rule", - "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" - }, - { - "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", - "created_at": "2022-02-04T13:02:52.937Z", - "updated_at": "2022-02-07T08:19:43.291Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "segment": { - "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" - }, - "event": "customer.segment.entered", - "source": { - "banner": "Entered segment 100 points.", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" - }, - { - "id": "ern_gVo6CHBduFPoh1hctASfXHLT", - "created_at": "2022-11-24T17:01:42.809Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 4, - "points": 4, - "property": "customer_life_time_value" - } - } - }, - "event": "customer.loyalty.tier.joined", - "loyalty_tier": { - "id": "ltr_pudTGWasuIqxdiDM0go31OV1" - }, - "source": { - "banner": "Tier joined", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_wdlEo17wmoqYHGfilbayEUj7", - "metadata": { - "Type": "Tier joined - customer metadata - proportional" - } - }, - { - "id": "ern_66OdCyLADv5IGFoQe18vGUwa", - "created_at": "2022-11-24T17:03:59.414Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 2, - "points": 2, - "property": "customer_life_time_value" - } - } - }, - "event": "customer.loyalty.tier.left", - "loyalty_tier": { - "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2" - }, - "source": { - "banner": "Tier left", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_czm5el1Uz1jeGaO97AYoDNAq", - "metadata": { - "Type": "Tier left" - } - }, - { - "id": "ern_YR3fDfCjAmz9a5D68nk0i4dm", - "created_at": "2022-11-25T07:29:38.961Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 3, - "points": 4, - "property": "customer_life_time_value" - } - } - }, - "event": "customer.loyalty.tier.upgraded", - "loyalty_tier": { - "id": "ltr_30KHciA0UG8B71Fo51GZqwgN" - }, - "source": { - "banner": "Tier upgraded", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_M1OdRH8spk6Fs7yTuPLN2LAv", - "metadata": { - "Type": "Upgraded" - } - }, - { - "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", - "created_at": "2022-11-25T07:31:05.866Z", - "updated_at": "2022-11-25T07:31:43.029Z", - "validation_rule_id": "val_kfmWpfXMI9P1", - "loyalty": { - "points": 1, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.downgraded", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Tier Downgraded", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", - "metadata": { - "Type": "Tier" - } - }, - { - "id": "ern_AdlWO2yt6b6llWsibIdiRXVE", - "created_at": "2022-11-25T07:31:42.767Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 5, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.prolonged", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Prolonged", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_4jH1yq9WJS0oJ8suagCrltyb", - "metadata": {} - } - ], - "anyOf": [ - { - "$ref": "#/components/schemas/8_obj_earning_rule_object_order_paid_no_validation_rule" - }, - { - "$ref": "#/components/schemas/8_obj_earning_rule_object_custom_event_no_validation_rule" - }, - { - "$ref": "#/components/schemas/8_obj_earning_rule_object_entered_segment_no_validation_rule" - }, - { - "$ref": "#/components/schemas/8_obj_earning_rule_object_tier_no_validation_rule" - } - ] - }, - "8_obj_earning_rule_object_order_paid": { - "description": "This is an object representing an earning rule for a paid order.", - "type": "object", - "title": "Earning Rule Object for Order Paid", - "examples": [ - { - "id": "ern_taClaOIiaGNdmdby8xS0lCcy", - "created_at": "2022-02-04T13:27:50.665Z", - "updated_at": "2022-02-07T08:19:44.198Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "event": "order.paid", - "source": { - "banner": "Order paid 1000 points", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 4 - ], - "object": "earning_rule", - "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" - } - ], - "properties": { - "id": { - "type": "string", - "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", - "description": "Assigned by the Voucherify API, identifies the earning rule object." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", - "example": "2022-02-02T13:18:32.557Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", - "example": "2022-02-03T13:09:27.206Z", - "format": "date-time" - }, - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_paid" - } - ] - }, - "event": { - "type": "string", - "enum": [ - "order.paid" - ], - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `order.paid` an event defined by the Voucherify API corresponding to an order status `PAID`. " - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - }, - "object_id": { - "type": "string", - "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "description": "A unique campaign identifier assigned by the Voucherify API." - }, - "object_type": { - "type": "string", - "default": "campaign", - "description": "Defines the object associated with the earning rule. Defaults to `campaign`." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "object": { - "type": "string", - "default": "earning_rule", - "description": "The type of object represented by JSON. Default is `earning_rule`." - }, - "automation_id": { - "type": "string", - "description": "For internal use by Voucherify.", - "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.", + "enum": [ + "promotion_tier" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." + }, + "voucher": { + "type": "null" + }, + "promotion_tier": { + "description": "Contains details of the promotion tier and the parent campaign.", + "$ref": "#/components/schemas/3_obj_promotion_tier_object" + } + } + }, + "7_obj_redemption_object_promotion_tier_extended_stacked": { + "type": "object", + "title": "Promotion Tier", + "description": "This is an object representing a promotion tier redemption.", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "redemption": { + "type": "string", + "description": "Unique redemption ID of the parent redemption.", + "example": "r_0c656311b5878a2031" + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] } - }, - "8_req_earning_rule_object_order_paid": { - "description": "This is an object representing an earning rule for a paid order.", - "type": "object", - "title": "Earning Rule Object for Order Paid", - "examples": [ - { - "id": "ern_taClaOIiaGNdmdby8xS0lCcy", - "created_at": "2022-02-04T13:27:50.665Z", - "updated_at": "2022-02-07T08:19:44.198Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "event": "order.paid", - "source": { - "banner": "Order paid 1000 points", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 4 - ], - "object": "earning_rule", - "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" - } - ], - "properties": { - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_paid" - } - ] - }, - "event": { + } + }, + "customer": { + "type": "object", + "description": "Defines the customer that is related to the redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.", + "enum": [ + "promotion_tier" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. promo_NzjTc3ZXTe7md5SziK3uYtei for a promotion tier." + }, + "voucher": { + "type": "null" + }, + "promotion_tier": { + "description": "Contains details of the promotion tier and the parent campaign.", + "$ref": "#/components/schemas/3_obj_promotion_tier_object" + } + } + }, + "7_obj_redemption_object_stackable_discounts": { + "type": "object", + "title": "Stacked Redemption", + "description": "This is an object representing a stacked redemption.", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the `redemption`.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object_stacked_redemptions" + }, + "channel": { + "type": "object", + "description": "Defines the details of the channel through which the redemption was issued.", + "properties": { + "channel_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "description": "Unique channel ID of the user performing the redemption. This is either a user ID from a user using the Voucherify Dashboard or an X-APP-Id of a user using the API." + }, + "channel_type": { + "type": "string", + "description": "The source of the channel for the redemption. A `USER` corresponds to the Voucherify Dashboard and an `API` corresponds to the API.", + "enum": [ + "USER", + "API" + ] + } + } + }, + "customer": { + "type": "object", + "description": "Defines the customer making the stacked redemption.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object.", + "enum": [ + "redemption" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. r_0c5d07222e08a34ace for a redemption." + }, + "voucher": { + "type": "null" + } + } + }, + "7_res_get_redemption": { + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object" + }, + { + "$ref": "#/components/schemas/7_obj_rollback_redemption_object_truncated" + } + ], + "title": "Get Redemption Response Body", + "description": "Response body schema for **GET** `/redemptions/{redemptionId}" + }, + "7_res_list_redemptions": { + "title": "List Redemptions Response Body", + "type": "object", + "description": "Response body schema for **GET** `/redemptions`.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about redemptions in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "redemptions", + "description": "Identifies the name of the attribute that contains the array of redemption objects." + }, + "redemptions": { + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object" + }, + { + "$ref": "#/components/schemas/7_obj_rollback_redemption_object_truncated" + } + ] + }, + "total": { + "type": "integer", + "description": "Total number of redemptions." + } + } + }, + "7_filter_conditions_string": { + "title": "Filter by conditions", + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "$in": { + "type": "array", + "description": "Array of resource values that should be included in the results. (multiple values)", + "items": { + "type": "string" + } + }, + "$not_in": { + "type": "array", + "description": "Array of resource values that should be included in the results. (multiple values)", + "items": { + "type": "string" + } + }, + "$is": { + "type": "string", + "description": "Value is exactly this value. (single value)" + }, + "$is_not": { + "type": "string", + "description": "Results omit this value. (single value)" + }, + "$has_value": { + "type": "string", + "description": "Value is NOT null. The value for this parameter is an empty string." + }, + "$is_unknown": { + "type": "string", + "description": "Value is null. The value for this parameter is an empty string." + }, + "$starts_with": { + "type": "string", + "description": "Value starts with the specified string." + }, + "$ends_with": { + "type": "string", + "description": "Value ends with the specified string." + } + } + }, + "7_res_get_vouchers_redemptions": { + "type": "object", + "title": "Get Voucher's Redemptions Response Body", + "description": "Response body schema for **GET** `/vouchers/{code}/redemption`.", + "properties": { + "quantity": { + "type": "integer", + "description": "The maximum number of times a voucher can be redeemed." + }, + "redeemed_quantity": { + "type": "integer", + "description": "The number of times the voucher was redeemed successfully." + }, + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about redemptions in a dictionary." + }, + "url": { + "type": "string", + "example": "/v1/vouchers/PROMO-CODE2/redemptions?page=1&limit=10", + "description": "URL " + }, + "data_ref": { + "type": "string", + "default": "redemption_entries", + "description": "Identifies the name of the attribute that contains the array of `redemption_entries`." + }, + "total": { + "type": "integer", + "description": "Total number of redemption objects." + }, + "redemption_entries": { + "type": "array", + "description": "Contains the array of successful and failed redemption objects.", + "items": { + "$ref": "#/components/schemas/7_obj_redemption_object_voucher" + } + } + } + }, + "7_req_redeem_voucher": { + "title": "Redeem Voucher Request Body", + "description": "Request body schema for redeeming a voucher using **POST** `/vouchers/{code}/redemption`.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_req_redeem_voucher_discount_code" + }, + { + "$ref": "#/components/schemas/7_req_redeem_voucher_gift_card" + }, + { + "$ref": "#/components/schemas/7_req_redeem_voucher_loyalty_card" + } + ] + }, + "7_res_redeem_voucher": { + "title": "Redeem Voucher Response Body", + "$ref": "#/components/schemas/7_obj_redemption_object_voucher_extended", + "description": "Response body schema for **POST** `/vouchers/{code}/redemption`." + }, + "7_req_redeem_promotion_tier": { + "title": "Redeem Promotion Tier", + "type": "object", + "description": "Redeem a promotion tier.", + "properties": { + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" + } + ], + "description": "Order information." + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against promotion tiers requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the [Create Validation Rules](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + } + } + }, + "7_req_redeem_voucher_discount_code": { + "title": "Discount Code", + "type": "object", + "description": "Redeem a discount code.", + "properties": { + "session": { + "$ref": "#/components/schemas/6_req_session_lock_discount_code" + }, + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" + } + ], + "description": "Order information." + }, + "metadata": { + "type": "object", + "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "options": { + "type": "object", + "description": "Configure parameters returned in the response.", + "properties": { + "expand": { + "type": "array", + "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. Add `category` as a string in the array to include a `categories` object in the response.", + "items": { "type": "string", "enum": [ - "order.paid" + "category" ], - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `order.paid` an event defined by the Voucherify API corresponding to an order status `PAID`. " - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + "example": "category" } } - }, - "8_req_update_earning_rule_object_order_paid": { - "description": "This is an object representing an earning rule for a paid order.", - "type": "object", - "title": "Earning Rule Object for Order Paid", - "examples": [ - { - "id": "ern_taClaOIiaGNdmdby8xS0lCcy", - "created_at": "2022-02-04T13:27:50.665Z", - "updated_at": "2022-02-07T08:19:44.198Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "event": "order.paid", - "source": { - "banner": "Order paid 1000 points", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 4 - ], - "object": "earning_rule", - "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" - } - ], - "properties": { - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_paid" - } - ] - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { + } + } + } + }, + "7_req_redeem_voucher_gift_card": { + "title": "Gift Card", + "type": "object", + "description": "Redeem a gift card.", + "properties": { + "session": { + "$ref": "#/components/schemas/6_req_session_lock_gift_card" + }, + "gift": { + "type": "object", + "description": "Contains information on the number of gift card credits that the customer wants to apply to the order.", + "properties": { + "credits": { + "type": "integer", + "description": "The number of credits that the user wants to use from the gift card to fulfil the order. The value of credits cannot be higher than the current balance on the gift card. If the user gives more points than he has on the gift card, the application will return an error code in response. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + }, + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" + } + ], + "description": "Order information." + }, + "metadata": { + "type": "object", + "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "options": { + "type": "object", + "description": "Configure parameters returned in the response.", + "properties": { + "expand": { + "type": "array", + "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. Add `category` as a string in the array to include a `categories` object in the response.", + "items": { "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + "enum": [ + "category" + ], + "example": "category" } } - }, - "8_obj_earning_rule_object_order_paid_no_validation_rule": { - "description": "This is an object representing an earning rule for a paid order.", - "type": "object", - "title": "Earning Rule Object for Order Paid", - "examples": [ - { - "id": "ern_taClaOIiaGNdmdby8xS0lCcy", - "created_at": "2022-02-04T13:27:50.665Z", - "updated_at": "2022-02-07T08:19:44.198Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "event": "order.paid", - "source": { - "banner": "Order paid 1000 points", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 4 + } + } + } + }, + "7_req_redeem_voucher_loyalty_card": { + "title": "Loyalty Card", + "type": "object", + "description": "Redeem a loyalty card.", + "properties": { + "session": { + "$ref": "#/components/schemas/6_req_session_lock_loyalty_card" + }, + "reward": { + "type": "object", + "description": "Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward." + }, + "points": { + "type": "integer", + "description": "The number of loyalty points that the user wants to spend in order to fulfill the order. The number of points cannot be higher than the current balance on the loyalty card. If the user gives more points than he/she has on the loyalty card, the application will return an error code in response." + } + } + }, + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" + } + ], + "description": "Order information." + }, + "metadata": { + "type": "object", + "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "options": { + "type": "object", + "description": "Configure parameters returned in the response.", + "properties": { + "expand": { + "type": "array", + "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. Add `category` as a string in the array to include a `categories` object in the response.", + "items": { + "type": "string", + "enum": [ + "category" ], - "object": "earning_rule", - "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" - } - ], - "properties": { - "id": { - "type": "string", - "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", - "description": "Assigned by the Voucherify API, identifies the earning rule object." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", - "example": "2022-02-02T13:18:32.557Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", - "example": "2022-02-03T13:09:27.206Z", - "format": "date-time" - }, - "validation_rule_id": { - "type": "null", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_paid" - } - ] - }, - "event": { - "type": "string", - "enum": [ - "order.paid" - ], - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `order.paid` an event defined by the Voucherify API corresponding to an order status `PAID`. " - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - }, - "object_id": { - "type": "string", - "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "description": "A unique campaign identifier assigned by the Voucherify API." - }, - "object_type": { - "type": "string", - "default": "campaign", - "description": "Defines the object associated with the earning rule. Defaults to `campaign`." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "object": { - "type": "string", - "default": "earning_rule", - "description": "The type of object represented by JSON. Default is `earning_rule`." - }, - "automation_id": { - "type": "string", - "description": "For internal use by Voucherify.", - "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + "example": "category" } } - }, - "8_obj_earning_rule_object_entered_segment": { - "description": "This is an object representing an earning rule for entering a customer segment.", - "type": "object", - "title": "Earning Rule Object for Entered Segment", - "examples": [ - { - "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", - "created_at": "2022-02-04T13:02:52.937Z", - "updated_at": "2022-02-07T08:19:43.291Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "segment": { - "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" - }, - "event": "customer.segment.entered", - "source": { - "banner": "Entered segment 100 points.", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" - } - ], - "properties": { - "id": { - "type": "string", - "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", - "description": "Assigned by the Voucherify API, identifies the earning rule object." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", - "example": "2022-02-02T13:18:32.557Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", - "example": "2022-02-03T13:09:27.206Z", - "format": "date-time" - }, - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "segment": { - "type": "object", - "description": "Contains the id of a customer segment. **Required** for the `customer.segment.entered` option in `event`.", - "properties": { - "id": { - "type": "string", - "description": "Contains a unique identifier of a customer segment. Assigned by the Voucherify API." - } - } - }, - "event": { - "type": "string", - "enum": [ - "customer.segment.entered" - ], - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.segment.entered` an event defined by the Voucherify API corresponding to a customer entering a pre-defined customer segment." - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - }, - "object_id": { - "type": "string", - "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "description": "A unique campaign identifier assigned by the Voucherify API." - }, - "object_type": { - "type": "string", - "default": "campaign", - "description": "Defines the object associated with the earning rule. Defaults to `campaign`." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "object": { - "type": "string", - "default": "earning_rule", - "description": "The type of object represented by JSON. Default is `earning_rule`." - }, - "automation_id": { - "type": "string", - "description": "For internal use by Voucherify.", - "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } + } + } + } + }, + "7_req_rollback_redemption": { + "title": "Rollback Redemption Request Body", + "type": "object", + "properties": { + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_rollback_redemption_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_rollback_redemption_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" } - }, - "8_req_earning_rule_object_entered_segment": { - "description": "This is an object representing an earning rule for entering a customer segment.", - "type": "object", - "title": "Earning Rule Object for Entered Segment", - "examples": [ - { - "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", - "created_at": "2022-02-04T13:02:52.937Z", - "updated_at": "2022-02-07T08:19:43.291Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "segment": { - "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" - }, - "event": "customer.segment.entered", - "source": { - "banner": "Entered segment 100 points.", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" - } - ], - "properties": { - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "segment": { - "type": "object", - "description": "Contains the id of a customer segment. **Required** for the `customer.segment.entered` option in `event`.", - "properties": { - "id": { - "type": "string", - "description": "Contains a unique identifier of a customer segment. Assigned by the Voucherify API." - } - } - }, - "event": { - "type": "string", - "enum": [ - "customer.segment.entered" - ], - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.segment.entered` an event defined by the Voucherify API corresponding to a customer entering a pre-defined customer segment." - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_rollback_redemption_order_id" + }, + { + "$ref": "#/components/schemas/6_req_rollback_redemption_order_source_id" } - }, - "8_req_update_earning_rule_object_entered_segment": { - "description": "This is an object representing an earning rule for entering a customer segment.", - "type": "object", - "title": "Earning Rule Object for Entered Segment", - "examples": [ - { - "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", - "created_at": "2022-02-04T13:02:52.937Z", - "updated_at": "2022-02-07T08:19:43.291Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "segment": { - "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" - }, - "event": "customer.segment.entered", - "source": { - "banner": "Entered segment 100 points.", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" - } - ], - "properties": { - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } + ], + "description": "Send order information to ensure the correct order is being undone." + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to update **redemption** metadata." + } + }, + "description": "Request body schema for **POST** `/redemptions/{redemptionId}/rollback`." + }, + "7_res_rollback_redemption": { + "title": "Rollback Redemption Response Body", + "$ref": "#/components/schemas/7_obj_rollback_redemption_object_extended", + "description": "Response body schema for **POST** `/redemptions/{redemptionId}/rollback`." + }, + "8_obj_loyalty_campaign_object": { + "title": "Loyalty Campaign Object", + "description": "This is an object representing a loyalty campaign. \n\nThe loyalty campaign object contains details about the loyalty campaign. You can use dedicated endpoints to list loyalty campaigns, list loyalty card holders, member activities, active rewards, earning rules, loyalty tiers for given loyalty campaign.", + "x-tags": [ + "LOYALTIES API" + ], + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique campaign ID, assigned by Voucherify.", + "example": "camp_f7fBbQxUuTN7dI7tGOo5XMDA" + }, + "name": { + "type": "string", + "description": "Loyalty campaign name." + }, + "campaign_type": { + "type": "string", + "enum": [ + "LOYALTY_PROGRAM" + ], + "description": "Type of campaign." + }, + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria \n- `STATIC`: vouchers need to be manually published", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + }, + "voucher": { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_LOYALTY_CARD" + }, + "auto_join": { + "type": "boolean", + "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "use_voucher_metadata_schema": { + "type": "boolean", + "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." } - }, - "8_obj_earning_rule_object_entered_segment_no_validation_rule": { - "description": "This is an object representing an earning rule for entering a customer segment.", - "type": "object", - "title": "Earning Rule Object for Entered Segment", - "examples": [ - { - "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", - "created_at": "2022-02-04T13:02:52.937Z", - "updated_at": "2022-02-07T08:19:43.291Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "segment": { - "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" - }, - "event": "customer.segment.entered", - "source": { - "banner": "Entered segment 100 points.", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" - } - ], - "properties": { - "id": { - "type": "string", - "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", - "description": "Assigned by the Voucherify API, identifies the earning rule object." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", - "example": "2022-02-02T13:18:32.557Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", - "example": "2022-02-03T13:09:27.206Z", - "format": "date-time" - }, - "validation_rule_id": { - "type": "null", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "segment": { - "type": "object", - "description": "Contains the id of a customer segment. **Required** for the `customer.segment.entered` option in `event`.", - "properties": { - "id": { - "type": "string", - "description": "Contains a unique identifier of a customer segment. Assigned by the Voucherify API." - } - } - }, - "event": { - "type": "string", - "enum": [ - "customer.segment.entered" - ], - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.segment.entered` an event defined by the Voucherify API corresponding to a customer entering a pre-defined customer segment." - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - }, - "object_id": { - "type": "string", - "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "description": "A unique campaign identifier assigned by the Voucherify API." - }, - "object_type": { - "type": "string", - "default": "campaign", - "description": "Defines the object associated with the earning rule. Defaults to `campaign`." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "object": { - "type": "string", - "default": "earning_rule", - "description": "The type of object represented by JSON. Default is `earning_rule`." - }, - "automation_id": { - "type": "string", - "description": "For internal use by Voucherify.", - "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "vouchers_count": { + "type": "integer", + "description": "Total number of unique vouchers in campaign." + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2021-12-01T08:00:50.038Z", + "description": "Timestamp representing the date and time when the campaign was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-09-20T09:18:19.623Z", + "description": "Timestamp representing the date and time when the voucher was updated in ISO 8601 format." + }, + "creation_status": { + "type": "string", + "enum": [ + "DONE", + "IN_PROGRESS", + "FAILED", + "DRAFT", + "MODIFYING" + ], + "description": "Indicates the status of the campaign creation." + }, + "vouchers_generation_status": { + "type": "string", + "description": "Indicates the status of the campaign's vouchers.", + "enum": [ + "DONE", + "IN_PROGRESS", + "FAILED", + "DRAFT" + ] + }, + "protected": { + "type": "boolean", + "description": "Indicates whether the resource can be deleted." + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to.", + "example": "cat_0b688929a2476386a7" + }, + "categories": { + "$ref": "#/components/schemas/20_obj_category_object" + }, + "loyalty_tiers_expiration": { + "type": "object", + "description": "Defines the expiration mechanism for loyalty tiers.", + "anyOf": [ + { + "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance" + }, + { + "$ref": "#/components/schemas/2_loyalty_tiers_expiration_points_in_period" } - }, - "8_obj_earning_rule_object_custom_event": { - "description": "This is an object representing an earning rule triggered by a custom event.", - "type": "object", - "title": "Earning Rule Object for Custom Event", - "examples": [ - { - "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", - "created_at": "2022-02-07T08:19:41.810Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 2, - "type": "FIXED" - }, - "custom_event": { - "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" - }, - "event": "saw_on_facebook", - "source": { - "banner": "Saw on Facebook Timeframe", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-07T08:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "object": "earning_rule", - "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" - } - ], - "properties": { - "id": { - "type": "string", - "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", - "description": "Assigned by the Voucherify API, identifies the earning rule object." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", - "example": "2022-02-02T13:18:32.557Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", - "example": "2022-02-03T13:09:27.206Z", - "format": "date-time" - }, - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_custom_event_metadata" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "custom_event": { - "type": "object", - "description": "Contains the schema id of a custom event. **Required** for the custom event option in `event`.", - "properties": { - "schema_id": { - "type": "string", - "description": "Contains a unique identifier of a custom event schema. Assigned by the Voucherify API.", - "example": "ms_gn4Qe4xsFPf7orCArCiNVY13" - } - } - }, - "event": { - "type": "string", - "enum": [ - "custom_event_defined_in_EVENT_SCHEMA" - ], - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `custom_event_name` the name of a custom event defined in the Dashboard → **Project Settings** → **EVENT SCHEMA** → **Add event definition**. Read more on defining [custom events](https://support.voucherify.io/article/111-custom-events). " - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - }, - "object_id": { - "type": "string", - "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "description": "A unique campaign identifier assigned by the Voucherify API." - }, - "object_type": { - "type": "string", - "default": "campaign", - "description": "Defines the object associated with the earning rule. Defaults to `campaign`." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "object": { - "type": "string", - "default": "earning_rule", - "description": "The type of object represented by JSON. Default is `earning_rule`." - }, - "automation_id": { - "type": "string", - "description": "For internal use by Voucherify.", - "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } + ] + }, + "object": { + "type": "string", + "default": "campaign", + "description": "The type of object represented by JSON. This object stores information about the campaign." + } + } + }, + "8_obj_loyalty_campaign_object_no_extended_categories": { + "title": "Loyalty Campaign Object", + "description": "This is an object representing a loyalty campaign. \n\nThe loyalty campaign object contains details about the loyalty campaign. You can use dedicated endpoints to list loyalty campaigns, list loyalty card holders, member activities, active rewards, earning rules, loyalty tiers for given loyalty campaign.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique campaign ID, assigned by Voucherify.", + "example": "camp_f7fBbQxUuTN7dI7tGOo5XMDA" + }, + "name": { + "type": "string", + "description": "Loyalty campaign name." + }, + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "campaign_type": { + "type": "string", + "enum": [ + "LOYALTY_PROGRAM" + ], + "description": "Type of campaign." + }, + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: the campaign is dynamic, i.e. vouchers will generate based on set criteria \n- `STATIC`: vouchers need to be manually published", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + }, + "voucher": { + "$ref": "#/components/schemas/2_obj_campaign_object_voucher_object_LOYALTY_CARD" + }, + "auto_join": { + "type": "boolean", + "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled." + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "use_voucher_metadata_schema": { + "type": "boolean", + "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "vouchers_count": { + "type": "integer", + "description": "Total number of unique vouchers in campaign." + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the campaign on or off. You can disable a campaign even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* campaign\n- `false` indicates an *inactive* campaign" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2021-12-01T08:00:50.038Z", + "description": "Timestamp representing the date and time when the campaign was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-09-20T09:18:19.623Z", + "description": "Timestamp representing the date and time when the voucher was updated in ISO 8601 format." + }, + "creation_status": { + "type": "string", + "enum": [ + "DONE", + "IN_PROGRESS", + "FAILED", + "DRAFT", + "MODIFYING" + ], + "description": "Indicates the status of the campaign creation." + }, + "vouchers_generation_status": { + "type": "string", + "description": "Indicates the status of the campaign's vouchers.", + "enum": [ + "DONE", + "IN_PROGRESS", + "FAILED", + "DRAFT" + ] + }, + "protected": { + "type": "boolean", + "description": "Indicates whether the resource can be deleted." + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to.", + "example": "cat_0b688929a2476386a7" + }, + "categories": { + "type": "array", + "description": "Contains details about the category.", + "items": { + "$ref": "#/components/schemas/20_obj_category_object" + } + }, + "loyalty_tiers_expiration": { + "type": "object", + "description": "Defines the expiration mechanism for loyalty tiers.", + "anyOf": [ + { + "$ref": "#/components/schemas/2_loyalty_tiers_expiration_balance" + }, + { + "$ref": "#/components/schemas/2_loyalty_tiers_expiration_points_in_period" + } + ] + }, + "object": { + "type": "string", + "default": "campaign", + "description": "The type of object represented by JSON. This object stores information about the campaign." + } + } + }, + "8_obj_loyalty_card_object": { + "title": "Loyalty Card Object", + "type": "object", + "description": "This is an object representing a loyalty card.", + "examples": [ + { + "id": "v_hrMBBeT4sOP9VSGPmj5KAgJwX202UjiY", + "code": "LOYALTY-CARD-xLPbpbXR", + "campaign": "Loyalty Program Fall 2022", + "campaign_id": "camp_f7fBbQxUuTN7dI7tGOo5XMDA", + "category": "First", + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" } + ], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 110, + "balance": 100, + "next_expiration_date": "2023-12-31", + "next_expiration_points": 100 }, - "8_req_earning_rule_object_custom_event": { - "description": "This is an object representing an earning rule triggered by a custom event.", - "type": "object", - "title": "Earning Rule Object for Custom Event", - "examples": [ - { - "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", - "created_at": "2022-02-07T08:19:41.810Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 2, - "type": "FIXED" - }, - "custom_event": { - "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" - }, - "event": "saw_on_facebook", - "source": { - "banner": "Saw on Facebook Timeframe", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-07T08:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "object": "earning_rule", - "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" - } - ], - "properties": { - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_custom_event_metadata" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "custom_event": { - "type": "object", - "description": "Contains the schema id of a custom event. **Required** for the custom event option in `event`.", - "properties": { - "schema_id": { - "type": "string", - "description": "Contains a unique identifier of a custom event schema. Assigned by the Voucherify API.", - "example": "ms_gn4Qe4xsFPf7orCArCiNVY13" - } - } - }, - "event": { - "type": "string", - "enum": [ - "custom_event_defined_in_EVENT_SCHEMA" - ], - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `custom_event_name` the name of a custom event defined in the Dashboard → **Project Settings** → **EVENT SCHEMA** → **Add event definition**. Read more on defining [custom events](https://support.voucherify.io/article/111-custom-events). " - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8/6I6hUEqtz/F6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD/DjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8%2F6I6hUEqtz%2FF6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD%2FDjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/SpYuOrU9wd6/o1wzy6E/04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ/FJtiw69djuzQk1f4HdQo8s5gaZ7fd2U+1zbaeAvi9usyvRHZE4=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FSpYuOrU9wd6%2Fo1wzy6E%2F04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ%2FFJtiw69djuzQk1f4HdQo8s5gaZ7fd2U%2B1zbaeAvi9usyvRHZE4%3D" } }, - "8_req_update_earning_rule_object_custom_event": { - "description": "This is an object representing an earning rule triggered by a custom event.", - "type": "object", - "title": "Earning Rule Object for Custom Event", - "examples": [ - { - "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", - "created_at": "2022-02-07T08:19:41.810Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 2, - "type": "FIXED" - }, - "custom_event": { - "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" - }, - "event": "saw_on_facebook", - "source": { - "banner": "Saw on Facebook Timeframe", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" + "is_referral_code": false, + "created_at": "2022-09-19T07:56:22.355Z", + "updated_at": "2022-09-19T08:04:22.458Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "redeemed_points": 10, + "object": "list", + "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/publications?page=1&limit=10" + }, + "object": "voucher" + } + ], + "properties": { + "id": { + "type": "string", + "example": "v_mkZN9v7vjYUadXnHrMza8W5c34fE5KiV", + "description": "Assigned by the Voucherify API, identifies the voucher." + }, + "code": { + "type": "string", + "example": "WVPblOYX", + "description": "A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters." + }, + "campaign": { + "type": "string", + "example": "Loyalty Card Campaign", + "description": "A unique campaign name, identifies the voucher's parent campaign." + }, + "campaign_id": { + "type": "string", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV", + "description": "Assigned by the Voucherify API, identifies the voucher's parent campaign." + }, + "category": { + "type": "string", + "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint." + }, + "category_id": { + "type": "string", + "description": "Unique category ID assigned by Voucherify.", + "example": "cat_0bb343dee3cdb5ec0c" + }, + "categories": { + "type": "array", + "description": "Contains details about the category.", + "items": { + "$ref": "#/components/schemas/20_obj_category_object" + } + }, + "type": { + "type": "string", + "enum": [ + "LOYALTY_CARD" + ], + "description": "Defines the type of voucher. " + }, + "discount": { + "default": null, + "description": "Object representing discount parameters. Child attributes are present only if `type` is `DISCOUNT_VOUCHER`. Defaults to `null`.", + "type": "null" + }, + "gift": { + "type": "null", + "description": "Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`." + }, + "loyalty_card": { + "type": "object", + "description": "Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`.", + "properties": { + "points": { + "type": "integer", + "example": 7000, + "description": "Total points incurred over lifespan of loyalty card." + }, + "balance": { + "type": "integer", + "example": 6970, + "description": "Points available for reward redemption." + }, + "next_expiration_date": { + "type": "string", + "format": "date", + "example": "2023-05-30", + "description": "The next closest date when the next set of points are due to expire." + }, + "next_expiration_points": { + "type": "integer", + "description": "The amount of points that are set to expire next." + } + } + }, + "start_date": { + "type": "string", + "example": "2021-12-01T00:00:00.000Z", + "format": "date-time", + "description": "Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. " + }, + "expiration_date": { + "type": "string", + "example": "2021-12-31T00:00:00.000Z", + "format": "date-time", + "description": "Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the voucher is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "example": "PT1H", + "description": "Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a `duration` of `PT1H` will be valid for a duration of one hour." + }, + "interval": { + "type": "string", + "example": "P2D", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an `interval` of `P2D` will be active every other day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "enum": [ + [ + 0 + ], + [ + 1 + ], + [ + 2 + ], + [ + 3 + ], + [ + 4 + ], + [ + 5 + ], + [ + 6 + ] + ], + "description": "Integer array corresponding to the particular days of the week in which the voucher is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" + }, + "additional_info": { + "type": "string", + "description": "An optional field to keep any extra textual information about the code such as a code description and details." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + }, + "assets": { + "type": "object", + "description": "Stores links to images of QR and barcode that correspond to an encrypted voucher code.", + "properties": { + "qr": { + "type": "object", + "description": "Stores Quick Response (QR) representation of encrypted code.", + "properties": { + "id": { + "type": "string", + "example": "U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK+t4pp7U7oFzjGJzj9q/bmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg+BaZk5QwXMf8k/OzSlOEVybpwSq+AiqPoNtjeuqtIgkDyvT6Q==", + "description": "Encrypted voucher code ID." }, - "active": true, - "start_date": "2022-02-07T08:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" + "url": { + "type": "string", + "example": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK%2Bt4pp7U7oFzjGJzj9q%2FbmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg%2BBaZk5QwXMf8k%2FOzSlOEVybpwSq%2BAiqPoNtjeuqtIgkDyvT6Q%3D%3D", + "description": "URL to QR code \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" + } + } + }, + "barcode": { + "type": "object", + "description": "Stores barcode representation of encrypted code.", + "properties": { + "id": { + "type": "string", + "example": "U2FsdGVkX19eJhGfWwUrH9+tulBkON+AnMktic+N6CVWzZ9+fHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ+kJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6/pFs61apEn9SJx32ttCF6d3oxKISQQ==", + "description": "Encrypted voucher code ID." }, - "object": "earning_rule", - "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" - } - ], - "properties": { - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_custom_event_metadata" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + "url": { + "type": "string", + "example": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19eJhGfWwUrH9%2BtulBkON%2BAnMktic%2BN6CVWzZ9%2BfHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ%2BkJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6%2FpFs61apEn9SJx32ttCF6d3oxKISQQ%3D%3D", + "description": "URL to barcode \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" + } } } - }, - "8_obj_earning_rule_object_custom_event_no_validation_rule": { - "description": "This is an object representing an earning rule triggered by a custom event.", - "type": "object", - "title": "Earning Rule Object for Custom Event", - "examples": [ - { - "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", - "created_at": "2022-02-07T08:19:41.810Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 2, - "type": "FIXED" - }, - "custom_event": { - "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" - }, - "event": "saw_on_facebook", - "source": { - "banner": "Saw on Facebook Timeframe", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-07T08:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "object": "earning_rule", - "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" - } - ], - "properties": { - "id": { - "type": "string", - "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", - "description": "Assigned by the Voucherify API, identifies the earning rule object." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", - "example": "2022-02-02T13:18:32.557Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", - "example": "2022-02-03T13:09:27.206Z", - "format": "date-time" - }, - "validation_rule_id": { - "type": "null", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_custom_event_metadata" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "custom_event": { - "type": "object", - "description": "Contains the schema id of a custom event. **Required** for the custom event option in `event`.", - "properties": { - "schema_id": { - "type": "string", - "description": "Contains a unique identifier of a custom event schema. Assigned by the Voucherify API.", - "example": "ms_gn4Qe4xsFPf7orCArCiNVY13" - } - } - }, - "event": { - "type": "string", - "enum": [ - "custom_event_defined_in_EVENT_SCHEMA" - ], - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `custom_event_name` the name of a custom event defined in the Dashboard → **Project Settings** → **EVENT SCHEMA** → **Add event definition**. Read more on defining [custom events](https://support.voucherify.io/article/111-custom-events). " - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - }, - "object_id": { - "type": "string", - "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "description": "A unique campaign identifier assigned by the Voucherify API." - }, - "object_type": { - "type": "string", - "default": "campaign", - "description": "Defines the object associated with the earning rule. Defaults to `campaign`." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "object": { - "type": "string", - "default": "earning_rule", - "description": "The type of object represented by JSON. Default is `earning_rule`." - }, - "automation_id": { - "type": "string", - "description": "For internal use by Voucherify.", - "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } + } + }, + "is_referral_code": { + "type": "boolean", + "description": "Flag indicating whether this voucher is a referral code." + }, + "created_at": { + "type": "string", + "example": "2021-12-22T10:13:06.487Z", + "description": "Timestamp representing the date and time when the voucher was created in ISO 8601 format.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2021-12-22T10:14:45.316Z", + "format": "date-time", + "description": "Timestamp representing the date and time when the voucher was last updated in ISO 8601 format." + }, + "holder_id": { + "type": "string", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "description": "Unique customer ID of voucher owner." + }, + "redemption": { + "type": "object", + "description": "Stores a summary of redemptions that have been applied to the voucher.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + }, + "redeemed_quantity": { + "type": "integer", + "example": 1, + "description": "How many times a voucher has already been redeemed." + }, + "redeemed_points": { + "type": "integer", + "example": 100000, + "description": "Total loyalty points redeemed." + }, + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute." + }, + "url": { + "type": "string", + "example": "/v1/vouchers/WVPblOYX/redemptions?page=1&limit=10", + "description": "The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`" } - }, - "8_obj_earning_rule_object_tier": { - "description": "This is an object representing an earning rule for tiers.", - "type": "object", - "title": "Earning Rule Object for Tiers", - "properties": { - "id": { - "type": "string", - "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", - "description": "Assigned by the Voucherify API, identifies the earning rule object." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", - "example": "2022-02-02T13:18:32.557Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", - "example": "2022-02-03T13:09:27.206Z", - "format": "date-time" - }, - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "event": { - "type": "string", - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.loyalty.tier.joined` an event defined by the Voucherify API corresponding to a customer joining a tier \n- `customer.loyalty.tier.left` an event defined by the Voucherify API corresponding to a customer leaving a tier \n- `customer.loyalty.tier.upgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.downgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.prolonged` an event defined by the Voucherify API corresponding to a customer's tier being prolonged", - "enum": [ - "customer.loyalty.tier.joined", - "customer.loyalty.tier.left", - "customer.loyalty.tier.upgraded", - "customer.loyalty.tier.downgraded", - "customer.loyalty.tier.prolonged" - ] - }, - "loyalty_tier": { - "type": "object", - "description": "Defines the tier associated with the earning rule definition.", - "properties": { - "id": { - "type": "string", - "description": "Unique loyalty tier ID associated with the earning rule. \n\n- `__ANY__`: any loyalty tier within the campaign", - "example": "ltr_pudTGWasuIqxdiDM0go31OV1" - } - } - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - }, - "object_id": { - "type": "string", - "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "description": "A unique campaign identifier assigned by the Voucherify API." - }, - "object_type": { - "type": "string", - "default": "campaign", - "description": "Defines the object associated with the earning rule. Defaults to `campaign`." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "object": { - "type": "string", - "default": "earning_rule", - "description": "The type of object represented by JSON. Default is `earning_rule`." - }, - "automation_id": { - "type": "string", - "description": "For internal use by Voucherify.", - "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } + } + }, + "publish": { + "type": "object", + "description": "This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or publish voucher API method. \n\n\n\n| Required | Optional |\n| -------- | :------: |\n| `type`:`LOYALTY_CARD` | `type`:`DISCOUNT_VOUCHER` | \n| `is_referral_code`:`true` | `type`:`GIFT_VOUCHER` |\n", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute." + }, + "count": { + "type": "integer", + "example": 0, + "description": "Publication events counter." + }, + "url": { + "type": "string", + "example": "/v1/vouchers/WVPblOYX/publications?page=1&limit=10", + "description": "The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`" } - }, - "8_req_earning_rule_object_tier": { - "description": "This is an object representing an earning rule for tiers.", - "type": "object", - "title": "Earning Rule Object for Tiers", - "properties": { - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "event": { - "type": "string", - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.loyalty.tier.joined` an event defined by the Voucherify API corresponding to a customer joining a tier \n- `customer.loyalty.tier.left` an event defined by the Voucherify API corresponding to a customer leaving a tier \n- `customer.loyalty.tier.upgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.downgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.prolonged` an event defined by the Voucherify API corresponding to a customer's tier being prolonged", - "enum": [ - "customer.loyalty.tier.joined", - "customer.loyalty.tier.left", - "customer.loyalty.tier.upgraded", - "customer.loyalty.tier.downgraded", - "customer.loyalty.tier.prolonged" - ] - }, - "loyalty_tier": { - "type": "object", - "description": "Defines the tier associated with the earning rule definition.", - "properties": { - "id": { - "type": "string", - "description": "Unique loyalty tier ID associated with the earning rule. \n\n- `__ANY__`: any loyalty tier within the campaign", - "example": "ltr_pudTGWasuIqxdiDM0go31OV1" - } - } - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } + } + }, + "object": { + "type": "string", + "description": "The type of object represented by JSON. Default is `voucher`.", + "default": "voucher" + } + }, + "x-tags": [ + "LOYALTIES API" + ] + }, + "8_obj_loyalty_reward_object": { + "title": "Loyalty Reward Object", + "type": "object", + "description": "This is an object representing a loyalty reward.", + "x-tags": [ + "LOYALTIES API" + ], + "properties": { + "reward": { + "$ref": "#/components/schemas/4_obj_reward_object" + }, + "assignment": { + "$ref": "#/components/schemas/4_obj_reward_assignment_object" + }, + "object": { + "type": "string", + "default": "loyalty_reward", + "description": "The type of object represented by JSON. This object stores information about the loyalty reward object." + } + } + }, + "8_obj_loyalty_points_bucket": { + "type": "object", + "title": "Loyalty Points Bucket Object", + "description": "This is an object representing a loyalty points bucket.", + "properties": { + "id": { + "type": "string", + "example": "lopb_zdeIBq3EsnPnRSDa7Tyyb6X2", + "description": "Unique loyalty points bucket ID." + }, + "voucher_id": { + "type": "string", + "example": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", + "description": "Unique parent loyalty card ID." + }, + "campaign_id": { + "type": "string", + "example": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "description": "Unique parent campaign ID." + }, + "bucket": { + "type": "object", + "description": "Defines the number of points stored in the given loyalty points bucket.", + "properties": { + "total_points": { + "type": "integer", + "description": "Total number of points in the loyalty points bucket." + } + } + }, + "status": { + "type": "string", + "enum": [ + "ACTIVE" + ], + "description": "Loyalty points bucket point status." + }, + "expires_at": { + "type": "string", + "example": "2022-11-30", + "format": "date", + "description": "Date when the number of points defined in the `bucket` object are due to expire." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-11-21T13:49:54.949Z", + "description": "Timestamp representing the date and time when the loyalty points bucket object was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "example": "2022-08-30T08:34:45.989Z", + "format": "date-time", + "description": "Timestamp representing the date and time when the loyalty points bucket object was updated in ISO 8601 format." + }, + "object": { + "type": "string", + "default": "loyalty_points_bucket", + "description": "The type of object represented by JSON. This object stores information about the loyalty points bucket." + } + } + }, + "8_obj_loyalty_tier_reward_object": { + "title": "Loyalty Tier Reward Object", + "type": "object", + "description": "This is an object representing a loyalty tier reward.", + "x-tags": [ + "LOYALTIES API" + ], + "properties": { + "reward": { + "$ref": "#/components/schemas/4_obj_reward_object" + }, + "assignment": { + "$ref": "#/components/schemas/4_obj_reward_assignment_object" + }, + "object": { + "type": "string", + "default": "loyalty_tier_reward", + "description": "The type of object represented by JSON. This object stores information about the loyalty tier reward." + } + } + }, + "8_obj_loyalty_card_object_non_expanded_categories": { + "title": "Loyalty Card Object", + "type": "object", + "description": "This is an object representing a loyalty card.", + "examples": [ + { + "id": "v_hrMBBeT4sOP9VSGPmj5KAgJwX202UjiY", + "code": "LOYALTY-CARD-xLPbpbXR", + "campaign": "Loyalty Program Fall 2022", + "campaign_id": "camp_f7fBbQxUuTN7dI7tGOo5XMDA", + "category": "First", + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" } + ], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 110, + "balance": 100, + "next_expiration_date": "2023-12-31", + "next_expiration_points": 100 }, - "8_req_update_earning_rule_object_tier": { - "description": "This is an object representing an earning rule for tiers.", - "type": "object", - "title": "Earning Rule Object for Tiers", - "properties": { - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "event": { - "type": "string", - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.loyalty.tier.joined` an event defined by the Voucherify API corresponding to a customer joining a tier \n- `customer.loyalty.tier.left` an event defined by the Voucherify API corresponding to a customer leaving a tier \n- `customer.loyalty.tier.upgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.downgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.prolonged` an event defined by the Voucherify API corresponding to a customer's tier being prolonged", - "enum": [ - "customer.loyalty.tier.joined", - "customer.loyalty.tier.left", - "customer.loyalty.tier.upgraded", - "customer.loyalty.tier.downgraded", - "customer.loyalty.tier.prolonged" - ] - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8/6I6hUEqtz/F6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD/DjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8%2F6I6hUEqtz%2FF6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD%2FDjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/SpYuOrU9wd6/o1wzy6E/04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ/FJtiw69djuzQk1f4HdQo8s5gaZ7fd2U+1zbaeAvi9usyvRHZE4=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FSpYuOrU9wd6%2Fo1wzy6E%2F04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ%2FFJtiw69djuzQk1f4HdQo8s5gaZ7fd2U%2B1zbaeAvi9usyvRHZE4%3D" } }, - "8_obj_earning_rule_object_tier_no_validation_rule": { - "description": "This is an object representing an earning rule for tiers.", - "type": "object", - "title": "Earning Rule Object for Tiers", - "properties": { - "id": { - "type": "string", - "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", - "description": "Assigned by the Voucherify API, identifies the earning rule object." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", - "example": "2022-02-02T13:18:32.557Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", - "example": "2022-02-03T13:09:27.206Z", - "format": "date-time" - }, - "validation_rule_id": { - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance.", - "type": "null" - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "$ref": "#/components/schemas/8_obj_fixed_points" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] - }, - "event": { - "type": "string", - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.loyalty.tier.joined` an event defined by the Voucherify API corresponding to a customer joining a tier \n- `customer.loyalty.tier.left` an event defined by the Voucherify API corresponding to a customer leaving a tier \n- `customer.loyalty.tier.upgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.downgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.prolonged` an event defined by the Voucherify API corresponding to a customer's tier being prolonged", - "enum": [ - "customer.loyalty.tier.joined", - "customer.loyalty.tier.left", - "customer.loyalty.tier.upgraded", - "customer.loyalty.tier.downgraded", - "customer.loyalty.tier.prolonged" - ] - }, - "loyalty_tier": { - "type": "object", - "description": "Defines the tier associated with the earning rule definition.", - "properties": { - "id": { - "type": "string", - "description": "Unique loyalty tier ID associated with the earning rule. \n\n- `__ANY__`: any loyalty tier within the campaign", - "example": "ltr_pudTGWasuIqxdiDM0go31OV1" - } - } - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - }, - "object_id": { - "type": "string", - "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "description": "A unique campaign identifier assigned by the Voucherify API." - }, - "object_type": { - "type": "string", - "default": "campaign", - "description": "Defines the object associated with the earning rule. Defaults to `campaign`." - } - } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "object": { - "type": "string", - "default": "earning_rule", - "description": "The type of object represented by JSON. Default is `earning_rule`." - }, - "automation_id": { - "type": "string", - "description": "For internal use by Voucherify.", - "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } - } - }, - "8_obj_fixed_points": { - "title": "Define Fixed Amount of Points", - "type": "object", - "description": "This is an object representing points calculated based on a fixed value.", - "properties": { - "points": { - "type": "integer", - "description": "The number of points to be added to the loyalty card.", - "example": 100 - }, - "type": { - "type": "string", - "description": "Defines how the points will be added to the loyalty card. `FIXED` adds a fixed number of `points`.", - "enum": [ - "FIXED" - ] - } - } + "is_referral_code": false, + "created_at": "2022-09-19T07:56:22.355Z", + "updated_at": "2022-09-19T08:04:22.458Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 }, - "8_obj_calculate_points_proportionally_order_paid": { - "title": "Calculate Points Proportionally", - "description": "This is an object representing points calculated proportionally to another property.", - "anyOf": [ - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_amounts" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_total_amount" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_metadata" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_item_amount" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_items_subtotal_amount" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_items_quantity" - }, - { - "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" - } - ] + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "redeemed_points": 10, + "object": "list", + "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/redemptions?page=1&limit=10" }, - "8_obj_calculate_points_proportionally_order_amounts": { - "title": "Calculate Points Proportionally to Order Amount", - "type": "object", - "description": "This is an object representing points calculated proportionally to another property.", - "properties": { - "type": { - "type": "string", - "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", - "enum": [ - "PROPORTIONAL" - ] - }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_AMOUNT" - ], - "description": "`ORDER_AMOUNT`: Pre-discount order amount (X points for every Y spent excluding discounts)" - }, - "order": { - "type": "object", - "properties": { - "amount": { - "type": "object", - "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every set of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` `calculation_type`, give `points`.", - "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - } - } - } - } - } - } + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/publications?page=1&limit=10" }, - "8_obj_calculate_points_proportionally_order_total_amount": { - "title": "Calculate Points Proportionally to Total Order Amount", - "type": "object", - "description": "This is an object representing points calculated proportionally to another property.", - "properties": { - "type": { - "type": "string", - "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", - "enum": [ - "PROPORTIONAL" - ] - }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_TOTAL_AMOUNT" - ], - "description": "`ORDER_TOTAL_AMOUNT`: Total order amount (X points for every Y spent including discount)" - }, - "order": { - "type": "object", - "properties": { - "total_amount": { - "type": "object", - "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every set of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` `calculation_type`, give `points`.", - "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - } - } - } - } - } + "object": "voucher" + } + ], + "properties": { + "id": { + "type": "string", + "example": "v_mkZN9v7vjYUadXnHrMza8W5c34fE5KiV", + "description": "Assigned by the Voucherify API, identifies the voucher." + }, + "code": { + "type": "string", + "example": "WVPblOYX", + "description": "A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters." + }, + "campaign": { + "type": "string", + "example": "Loyalty Card Campaign", + "description": "A unique campaign name, identifies the voucher's parent campaign." + }, + "campaign_id": { + "type": "string", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV", + "description": "Assigned by the Voucherify API, identifies the voucher's parent campaign." + }, + "category": { + "type": "string", + "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint." + }, + "category_id": { + "type": "string", + "description": "Unique category ID assigned by Voucherify.", + "example": "cat_0bb343dee3cdb5ec0c" + }, + "categories": { + "type": "array", + "description": "Contains details about the category.", + "items": { + "$ref": "#/components/schemas/20_obj_category_object" + } + }, + "type": { + "type": "string", + "enum": [ + "LOYALTY_CARD" + ], + "description": "Defines the type of voucher. " + }, + "discount": { + "default": null, + "description": "Object representing discount parameters. Child attributes are present only if `type` is `DISCOUNT_VOUCHER`. Defaults to `null`.", + "type": "null" + }, + "gift": { + "type": "null", + "description": "Object representing gift parameters. Child attributes are present only if `type` is `GIFT_VOUCHER`. Defaults to `null`." + }, + "loyalty_card": { + "type": "object", + "description": "Object representing loyalty card parameters. Child attributes are present only if `type` is `LOYALTY_CARD`.", + "properties": { + "points": { + "type": "integer", + "example": 7000, + "description": "Total points incurred over lifespan of loyalty card." + }, + "balance": { + "type": "integer", + "example": 6970, + "description": "Points available for reward redemption." + }, + "next_expiration_date": { + "type": "string", + "format": "date", + "example": "2023-05-30", + "description": "The next closest date when the next set of points are due to expire." + }, + "next_expiration_points": { + "type": "integer", + "description": "The amount of points that are set to expire next." } - }, - "8_obj_calculate_points_proportionally_order_metadata": { - "title": "Calculate Points Proportionally To an Order Metadata Property", - "type": "object", - "description": "This is an object representing points calculated proportionally to an order metadata property.", - "properties": { - "type": { - "type": "string", - "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", - "enum": [ - "PROPORTIONAL" - ] - }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_METADATA" - ], - "description": "`ORDER_METADATA`: Order Metadata (X points for every Y in metadata attribute, defined in the `property` key under the `order.metadata` object)" - }, - "order": { - "type": "object", - "description": "Defines the formula for calculating points proportionally.", - "properties": { - "metadata": { - "type": "object", - "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every given increment of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` order metadata property value, give `points`.", - "properties": { - "every": { - "type": "integer", - "description": "For how many increments of the order metadata property to grant points for.", - "example": 100 - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card.", - "example": 10 - }, - "property": { - "type": "string", - "example": "number_of_store_visits", - "description": "Order metadata property." - } - } - } - } - } + } + }, + "start_date": { + "type": "string", + "example": "2021-12-01T00:00:00.000Z", + "format": "date-time", + "description": "Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is *inactive before* this date. " + }, + "expiration_date": { + "type": "string", + "example": "2021-12-31T00:00:00.000Z", + "format": "date-time", + "description": "Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is *inactive after* this date." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the voucher is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "example": "PT1H", + "description": "Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a `duration` of `PT1H` will be valid for a duration of one hour." + }, + "interval": { + "type": "string", + "example": "P2D", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an `interval` of `P2D` will be active every other day." } - }, - "8_obj_calculate_points_proportionally_item_amount": { - "title": "Calculate Points Proportionally to Order Items Amount", - "type": "object", - "description": "This is an object representing points calculated proportionally to another property.", - "properties": { - "type": { - "type": "string", - "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", - "enum": [ - "PROPORTIONAL" - ] - }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_ITEMS_AMOUNT" - ], - "description": "- `ORDER_ITEMS_AMOUNT`; Pre-discount amount spent on items defined in the `order_items.amount.object` & `.id` (X points for every Y spent on items excluding discounts)" - }, - "order_items": { - "type": "object", - "properties": { - "amount": { - "type": "object", - "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every set of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` `calculation_type`, give `points`.", - "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - }, - "object": { - "type": "string", - "description": "Type of object taken under consideration.", - "enum": [ - "products_collection", - "product", - "sku" - ] - }, - "id": { - "type": "string", - "description": "Unique ID of the resource, i.e. `pc_75U0dHlr7u75BJodrW1AE3t6`, `prod_0bae32322150fd0546`, or `sku_0b7d7dfb090be5c619`." - } - } - } + } + }, + "validity_day_of_week": { + "type": "array", + "enum": [ + [ + 0 + ], + [ + 1 + ], + [ + 2 + ], + [ + 3 + ], + [ + 4 + ], + [ + 5 + ], + [ + 6 + ] + ], + "description": "Integer array corresponding to the particular days of the week in which the voucher is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the `start_date` and `expiration_date`. \n\n- `true` indicates an *active* voucher\n- `false` indicates an *inactive* voucher" + }, + "additional_info": { + "type": "string", + "description": "An optional field to keep any extra textual information about the code such as a code description and details." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + }, + "assets": { + "type": "object", + "description": "Stores links to images of QR and barcode that correspond to an encrypted voucher code.", + "properties": { + "qr": { + "type": "object", + "description": "Stores Quick Response (QR) representation of encrypted code.", + "properties": { + "id": { + "type": "string", + "example": "U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK+t4pp7U7oFzjGJzj9q/bmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg+BaZk5QwXMf8k/OzSlOEVybpwSq+AiqPoNtjeuqtIgkDyvT6Q==", + "description": "Encrypted voucher code ID." + }, + "url": { + "type": "string", + "example": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK%2Bt4pp7U7oFzjGJzj9q%2FbmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg%2BBaZk5QwXMf8k%2FOzSlOEVybpwSq%2BAiqPoNtjeuqtIgkDyvT6Q%3D%3D", + "description": "URL to QR code \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" } } - } - }, - "8_obj_calculate_points_proportionally_items_subtotal_amount": { - "title": "Calculate Points Proportionally to Order Items Subtotal Amount", - "type": "object", - "description": "This is an object representing points calculated proportionally to another property.", - "properties": { - "type": { - "type": "string", - "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", - "enum": [ - "PROPORTIONAL" - ] - }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_ITEMS_SUBTOTAL_AMOUNT" - ], - "description": "- `ORDER_ITEMS_SUBTOTAL_AMOUNT`; Amount spent on items defined in the `order_items.subtotal_amount.object` & `.id` (X points for every Y spent on items including discounts)" - }, - "order_items": { - "type": "object", - "properties": { - "subtotal_amount": { - "type": "object", - "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every set of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` `calculation_type`, give `points`.", - "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - }, - "object": { - "type": "string", - "description": "Type of object taken under consideration.", - "enum": [ - "products_collection", - "product", - "sku" - ] - }, - "id": { - "type": "string", - "description": "Unique ID of the resource, i.e. `pc_75U0dHlr7u75BJodrW1AE3t6`, `prod_0bae32322150fd0546`, or `sku_0b7d7dfb090be5c619`." - } - } - } + }, + "barcode": { + "type": "object", + "description": "Stores barcode representation of encrypted code.", + "properties": { + "id": { + "type": "string", + "example": "U2FsdGVkX19eJhGfWwUrH9+tulBkON+AnMktic+N6CVWzZ9+fHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ+kJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6/pFs61apEn9SJx32ttCF6d3oxKISQQ==", + "description": "Encrypted voucher code ID." + }, + "url": { + "type": "string", + "example": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19eJhGfWwUrH9%2BtulBkON%2BAnMktic%2BN6CVWzZ9%2BfHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ%2BkJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6%2FpFs61apEn9SJx32ttCF6d3oxKISQQ%3D%3D", + "description": "URL to barcode \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" } } } - }, - "8_obj_calculate_points_proportionally_items_quantity": { - "title": "Calculate Points Proportionally to Quantity of Items in the Cart", - "type": "object", - "description": "This is an object representing points calculated proportionally to quantity of items in the cart.", - "properties": { - "type": { - "type": "string", - "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", - "enum": [ - "PROPORTIONAL" - ] - }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_ITEMS_QUANTITY" - ], - "description": "`ORDER_ITEMS_QUANTITY`: Quantity of items defined in `order_items.quantity.object` & `.id` (X points for every Y items excluding free items)" - }, - "order_items": { - "type": "object", - "properties": { - "quantity": { - "type": "object", - "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every set of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` `calculation_type`, give `points`.", - "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - }, - "object": { - "type": "string", - "description": "Type of object taken under consideration.", - "enum": [ - "products_collection", - "product", - "sku" - ] - }, - "id": { - "type": "string", - "description": "Unique ID of the resource, i.e. `pc_75U0dHlr7u75BJodrW1AE3t6`, `prod_0bae32322150fd0546`, or `sku_0b7d7dfb090be5c619`." - } - } - } - } - } + } + }, + "is_referral_code": { + "type": "boolean", + "description": "Flag indicating whether this voucher is a referral code." + }, + "created_at": { + "type": "string", + "example": "2021-12-22T10:13:06.487Z", + "description": "Timestamp representing the date and time when the voucher was created in ISO 8601 format.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2021-12-22T10:14:45.316Z", + "format": "date-time", + "description": "Timestamp representing the date and time when the voucher was last updated in ISO 8601 format." + }, + "holder_id": { + "type": "string", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "description": "Unique customer ID of voucher owner." + }, + "redemption": { + "type": "object", + "description": "Stores a summary of redemptions that have been applied to the voucher.", + "properties": { + "quantity": { + "type": "integer", + "description": "How many times a voucher can be redeemed. A `null` value means unlimited." + }, + "redeemed_quantity": { + "type": "integer", + "example": 1, + "description": "How many times a voucher has already been redeemed." + }, + "redeemed_points": { + "type": "integer", + "example": 100000, + "description": "Total loyalty points redeemed." + }, + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the url attribute." + }, + "url": { + "type": "string", + "example": "/v1/vouchers/WVPblOYX/redemptions?page=1&limit=10", + "description": "The endpoint where this list of redemptions can be accessed using a GET method. `/v1/vouchers/{voucher_code}/redemptions`" } - }, - "8_obj_calculate_points_proportionally_customer_metadata": { - "title": "Calculate Points Proportionally To a Customer Metadata Property", - "type": "object", - "description": "This is an object representing points calculated proportionally to a customer metadata property.", - "properties": { - "type": { - "type": "string", - "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", - "enum": [ - "PROPORTIONAL" - ] - }, - "calculation_type": { - "type": "string", - "enum": [ - "CUSTOMER_METADATA" - ], - "description": "`CUSTOMER_METADATA`: Customer Metadata (X points for every Y in metadata attribute, defined in the `property` key under the `customer.metadata` object)" - }, - "customer": { - "type": "object", - "description": "Defines the formula for calculating points proportionally.", - "properties": { - "metadata": { - "type": "object", - "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every given increment of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` order metadata property value, give `points`.", - "properties": { - "every": { - "type": "integer", - "description": "For how many increments of the customer metadata property to grant points for.", - "example": 100 - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card.", - "example": 10 - }, - "property": { - "type": "string", - "example": "customer_life_time_value", - "description": "Customer metadata property." - } - } - } - } - } + } + }, + "publish": { + "type": "object", + "description": "This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or publish voucher API method. \n\n\n\n| Required | Optional |\n| -------- | :------: |\n| `type`:`LOYALTY_CARD` | `type`:`DISCOUNT_VOUCHER` | \n| `is_referral_code`:`true` | `type`:`GIFT_VOUCHER` |\n", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented is by default `list`. To get this list, you need to make a call to the endpoint returned in the `url` attribute." + }, + "count": { + "type": "integer", + "example": 0, + "description": "Publication events counter." + }, + "url": { + "type": "string", + "example": "/v1/vouchers/WVPblOYX/publications?page=1&limit=10", + "description": "The endpoint where this list of publications can be accessed using a GET method. `/v1/vouchers/{voucher_code}/publications`" } - }, - "8_obj_calculate_points_proportionally_custom_event_metadata": { - "title": "Calculate Points Proportionally To a Custom Event Metadata Property", - "type": "object", - "description": "This is an object representing points calculated proportionally to a custom event metadata property.", - "properties": { - "type": { - "type": "string", - "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", - "enum": [ - "PROPORTIONAL" - ] - }, - "calculation_type": { - "type": "string", - "enum": [ - "CUSTOMER_METADATA" - ], - "description": "`CUSTOM_EVENT_METADATA`: Custom Event Metadata (X points for every Y in metadata attribute, defined in the `property` key under the `custom_event.metadata` object)" - }, - "custom_event": { - "type": "object", - "description": "Defines the formula for calculating points proportionally.", - "properties": { - "metadata": { - "type": "object", - "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every given increment of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` order metadata property value, give `points`.", - "properties": { - "every": { - "type": "integer", - "description": "For how many increments of the custom event metadata property to grant points for.", - "example": 100 - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card.", - "example": 10 - }, - "property": { - "type": "string", - "example": "volume_number", - "description": "Custom event metadata property." - } + } + }, + "object": { + "type": "string", + "description": "The type of object represented by JSON. Default is `voucher`.", + "default": "voucher" + } + } + }, + "8_res_get_loyalty_card_transactions": { + "title": "Get Loyalty Card Transactions Response Body", + "type": "object", + "description": "List of loyalty card transactions", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON." + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of transaction objects." + }, + "data": { + "type": "array", + "description": "A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object.", + "items": { + "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object" + } + }, + "has_more": { + "type": "boolean", + "description": "As query results are always limited (by the limit parameter), the `has_more` flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results." + } + } + }, + "1_obj_loyalty_card_transaction_object": { + "title": "Loyalty Card Transaction Object", + "description": "Loyalty card transaction object", + "anyOf": [ + { + "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_redemption" + }, + { + "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_accrual" + }, + { + "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_accrual_custom_event" + }, + { + "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_refund" + }, + { + "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_addition" + }, + { + "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_removal" + }, + { + "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_expiration" + }, + { + "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_transfer_out" + }, + { + "$ref": "#/components/schemas/1_obj_loyalty_card_transaction_object_transfer_in" + } + ] + }, + "1_obj_loyalty_card_transaction_object_redemption": { + "title": "Redemption", + "description": "When loyalty points are used to pay for an order.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique transaction ID.", + "example": "vtx_0c9dccc4d5813e71bd" + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is `null`." + }, + "voucher_id": { + "type": "string", + "description": "Unique voucher ID.", + "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "source": { + "type": "string", + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is `null`." + }, + "reason": { + "type": "string", + "description": "Reason why the transaction occurred. In case of a redemption, this value is `null`." + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "POINTS_REDEMPTION", + "enum": [ + "POINTS_REDEMPTION" + ] + }, + "details": { + "type": "object", + "description": "Contains the detailed information about the transaction.", + "properties": { + "balance": { + "type": "object", + "description": "Contains information on how the balance was affected by the transaction.", + "properties": { + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "loyalty_card" + }, + "total": { + "type": "integer", + "description": "The available points prior to the transaction." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON.", + "default": "balance" + }, + "points": { + "type": "integer", + "description": "The amount of points being used up in the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." + }, + "related_object": { + "type": "object", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "type": { + "type": "string", + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" } } } } - } - }, - "8_res_list_loyalty_campaigns": { - "title": "List Loyalty Campaigns Response Body", - "type": "object", - "description": "Response body schema for listing loyalty campaigns using **GET** `/loyalties`.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about loyalty campaigns in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "campaigns", - "description": "Identifies the name of the attribute that contains the array of loyalty campaign objects." - }, - "campaigns": { - "type": "array", - "description": "Contains an array of loyalty campaign objects.", - "items": { - "$ref": "#/components/schemas/8_obj_loyalty_campaign_object_no_extended_categories" + }, + "order": { + "type": "object", + "description": "Contains information about the original order.", + "properties": { + "id": { + "type": "string", + "description": "Unique order ID.", + "example": "ord_jj5EzDxDOd2xFPsAJJ18IaZK" + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." } - }, - "total": { - "type": "integer", - "description": "Total number of loyalty campaign objects." } - } - }, - "8_req_create_loyalty_cards": { - "type": "object", - "title": "Create Loyalty Campaign Request Body", - "description": "Request body schema for creating a loyalty campaign.", - "properties": { - "name": { - "type": "string", - "description": "Campaign name." - }, - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "auto_join": { - "type": "boolean", - "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. CONTEXT: `LOYALTY_PROGRAM`." - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "use_voucher_metadata_schema": { - "type": "boolean", - "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." - }, - "vouchers_count": { - "type": "integer", - "description": "Total number of unique vouchers in campaign (size of campaign)." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" + }, + "redemption": { + "type": "object", + "description": "Contains information about the original redemption.", + "properties": { + "id": { + "type": "string", + "description": "Unique redemption ID.", + "example": "r_0c94ed583fcafc31c1" } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "loyalty_tiers_expiration": { - "type": "object", - "description": "Defines the expiration mechanism for loyalty tiers.", - "anyOf": [ - { - "$ref": "#/components/schemas/8_loyalty_tiers_expiration_balance" - }, - { - "$ref": "#/components/schemas/8_loyalty_tiers_expiration_points_in_period" - } - ] - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." - }, - "voucher": { - "$ref": "#/components/schemas/2_req_campaign_object_voucher_object_LOYALTY_CARD" } - } - }, - "8_loyalty_tiers_expiration_balance": { - "title": "Balance", - "type": "object", - "description": "Defines the Balance expiration mechanism for loyalty tiers.", - "properties": { - "qualification_type": { - "type": "string", - "enum": [ - "BALANCE" - ], - "description": "Tier qualification. \n\n`BALANCE`: Points balance is based on the customer's current points balance. Customers qualify for the tier if their points balance is in the points range of the tier." - }, - "start_date": { - "type": "object", - "description": "Defines the conditions for the start date of the tier.", - "properties": { - "type": { - "type": "string", - "enum": [ - "IMMEDIATE" - ], - "description": "What triggers the tier to be valid for a customer. \n`IMMEDIATE`: After reaching the minimum required points." - } + }, + "reward": { + "type": "object", + "description": "Contains information about the pay with points reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique reward ID.", + "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1" + }, + "name": { + "type": "string", + "description": "Reward name.", + "example": "100 = $20" } - }, - "expiration_date": { - "description": "Defines the conditions for the expiration date of a tier.", - "anyOf": [ - { - "$ref": "#/components/schemas/8_loyalty_tiers_expiration_balance_expiration_date_balance_drop" - }, - { - "$ref": "#/components/schemas/8_loyalty_tiers_expiration_balance_expiration_date_custom" - } - ] } } - }, - "8_loyalty_tiers_expiration_balance_expiration_date_balance_drop": { - "title": "Balance Drop", - "type": "object", - "description": "Defines the conditions for the expiration date of a tier based on a pure balance drop.", - "properties": { - "type": { - "type": "string", - "enum": [ - "BALANCE_DROP" - ], - "description": "What triggers the tier to expire for a customer. \n`BALANCE_DROP`: Tier expires when the points balance drops below the required range of the tier." - } - } - }, - "8_loyalty_tiers_expiration_balance_expiration_date_custom": { - "title": "Custom", - "type": "object", - "description": "Defines the custom conditions for the expiration date of a tier.", - "properties": { - "type": { - "type": "string", - "enum": [ - "CUSTOM" - ], - "description": "What triggers the tier to expire for a customer. \n`CUSTOM`: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier." - }, - "extend": { - "type": "string", - "description": "Defines the amount of time the tier will remain active in ISO 8601 format. The expiration date counter starts at the moment when the customer reaches the minimum required points that are required to be in the tier. For example, a tier with a duration of P3M will be valid for a duration of 3 months." - }, - "rounding": { - "description": "Defines the rounding mechanism for tier expiration.", - "anyOf": [ - { - "$ref": "#/components/schemas/8_loyalty_tiers_expiration_expiration_date_rounding_default_options" - }, - { - "$ref": "#/components/schemas/8_loyalty_tiers_expiration_expiration_date_rounding_custom" + } + }, + "related_transaction_id": { + "type": "string", + "description": "This field is `null` in the case of this type of transaction." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." + } + } + }, + "1_obj_loyalty_card_transaction_object_accrual": { + "title": "Accrual", + "description": "When points are earned on the card through an earning rule.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique transaction ID.", + "example": "vtx_0c9dccc4d5813e71bd" + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a points accrual, this value is `null`." + }, + "voucher_id": { + "type": "string", + "description": "Unique voucher ID.", + "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "source": { + "type": "string", + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", + "enum": [ + "Automation" + ] + }, + "reason": { + "type": "string", + "description": "Reason why the transaction occurred. In case of a points accrual, this value is `null`." + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "POINTS_ACCRUAL", + "enum": [ + "POINTS_ACCRUAL" + ] + }, + "details": { + "type": "object", + "description": "Contains the detailed information about the transaction.", + "properties": { + "balance": { + "type": "object", + "description": "Contains information on how the balance was affected by the transaction.", + "properties": { + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "loyalty_card" + }, + "total": { + "type": "integer", + "description": "The available points after the transaction." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON.", + "default": "balance" + }, + "points": { + "type": "integer", + "description": "The amount of points being added in the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." + }, + "related_object": { + "type": "object", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "type": { + "type": "string", + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" + } } - ] + } } - } - }, - "8_loyalty_tiers_expiration_expiration_date_rounding_default_options": { - "title": "Calendar Periods", - "type": "object", - "description": "Defines the rounding mechanism for tier expiration based on a list of available time periods.", - "properties": { - "type": { - "type": "string", - "enum": [ - "MONTH", - "QUARTER", - "HALF_YEAR", - "YEAR" - ], - "description": "Period to which the expiration will be rounded to. \n- `MONTH`: The expiration date will be rounded to the end of the month. \n- `QUARTER`: The expiration date will be rounded to the end of the quarter. \n- `HALF_YEAR`: The expiration date will be rounded to the half year. \n- `YEAR`: The expiration date will be rounded to the end of the year." + }, + "order": { + "type": "object", + "description": "Contains information about the original order.", + "properties": { + "id": { + "type": "string", + "description": "Unique order ID.", + "example": "ord_jj5EzDxDOd2xFPsAJJ18IaZK" + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + } } - } - }, - "8_loyalty_tiers_expiration_expiration_date_rounding_custom": { - "title": "Specific Month", - "type": "object", - "description": "Defines the custom rounding mechanism for tier expiration.", - "properties": { - "type": { - "type": "string", - "enum": [ - "CUSTOM" - ], - "description": "This mechanism describes a custom rounding for the expiration date." - }, - "unit": { - "type": "string", - "description": "Defines the type of unit of time in which the rounding period is counted.", - "enum": [ - "MONTH" - ] - }, - "value": { - "type": "integer", - "description": "Value for the unit of time that the rounding applies to. Units for this parameter are defined by the `rounding.unit` parameter. \n- `0`: January\n- `1`: February\n- `2`: March\n- `3`: April\n- `4`: May\n- `5`: June\n- `6`: July\n- `7`: August\n- `8`: September\n- `9`: October\n- `10`: November\n- `11`: December" + }, + "event": { + "type": "object", + "description": "Contains information about the event that triggers the point accrual.", + "properties": { + "id": { + "type": "string", + "description": "Unique event ID.", + "example": "evcus_0c9c21def34e3c05bf" + }, + "type": { + "type": "string", + "description": "Type of event.", + "example": "customer.order.paid" + } } - } - }, - "8_loyalty_tiers_expiration_points_in_period": { - "title": "Points in Period", - "type": "object", - "description": "Defines the Points in Period expiration mechanism for loyalty tiers.", - "properties": { - "qualification_type": { - "type": "string", - "enum": [ - "POINTS_IN_PERIOD" - ], - "description": "Tier qualification. \n\n`POINTS_IN_PERIOD`: A customer qualifies for the tier only if the sum of the accumulated points in a **defined time interval** reaches the tier threshold." - }, - "qualification_period": { - "type": "string", - "description": "Customers can qualify for the tier if they collected enough points in a given time period. So, in addition to the customer having to reach a points range, they also need to have collected the points within a set time period. \n\n| **Period** | **Definition** |\n|:---|:---|\n| **Calendar Month** | Points collected in one calendar month
                  January, February, March, etc. |\n| **Calendar Quarter** | Points collected in the quarter
                  - January - March
                  - April - June
                  - July - September
                  - October - December |\n| **Calendar Half-year** | Points collected in the half-year
                  - January - June
                  - July - December |\n| **Calendar Year** | Points collected in one calendar year
                  January - December |", - "enum": [ - "MONTH", - "QUARTER", - "HALF_YEAR", - "YEAR" - ] - }, - "start_date": { - "type": "object", - "description": "Defines the conditions for the start date of the tier.", - "properties": { - "type": { - "type": "string", - "enum": [ - "IMMEDIATE", - "NEXT_PERIOD" - ], - "description": "What triggers the tier to be valid for a customer. \n`IMMEDIATE`: After reaching the minimum required points. \n`NEXT_PERIOD`: When the next qualification period starts." + }, + "earning_rule": { + "type": "object", + "description": "Contains information about the earning rule.", + "properties": { + "id": { + "type": "string", + "description": "Unique earning rule ID.", + "example": "ern_2WsCIBEx6Lzf5IAV5IOR7a23" + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name.", + "properties": { + "banner": { + "type": "string", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + } } } - }, - "expiration_date": { - "type": "object", - "description": "Defines the conditions for the expiration date of a tier.", - "properties": { - "type": { - "type": "string", - "enum": [ - "END_OF_PERIOD", - "END_OF_NEXT_PERIOD" - ], - "description": "What triggers the tier to expire for a customer. \n`END_OF_PERIOD`: Expire tier at the end of the period. \n`END_OF_NEXT_PERIOD`: Expire tier at the end of the next period." - }, - "extend": { - "type": "string", - "description": "Extend the expiration by adding extra months or days in ISO 8601 format. The tier will remain active even though it reaches its expiration time period. For example, a tier with a duration of `P3M` will be valid for an additional duration of 3 months and a tier with a duration of `P1D` will be valid for an additional duration of 1 day." - } - } - } - } - }, - "8_req_update_loyalty_campaign": { - "type": "object", - "title": "Update Loyalty Campaign Request Body", - "description": "Request body schema for updating a loyalty campaign using **PUT** `/loyalties/{campaignId}`.", - "properties": { - "description": { - "type": "string", - "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." - }, - "type": { - "type": "string", - "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", - "enum": [ - "AUTO_UPDATE", - "STATIC" - ] - }, - "auto_join": { - "type": "boolean", - "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. CONTEXT: `LOYALTY_PROGRAM`." - }, - "join_once": { - "type": "boolean", - "description": "If this value is set to `true`, customers will be able to join the campaign only once." - }, - "start_date": { - "type": "string", - "format": "date-time", - "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", - "example": "2022-09-20T00:00:00.000Z" - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", - "example": "2022-09-30T00:00:00.000Z" - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." - }, - "duration": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." - } - } - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" - } - }, - "activity_duration_after_publishing": { - "type": "string", - "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." - }, - "loyalty_tiers_expiration": { - "type": "object", - "description": "Defines the expiration mechanism for loyalty tiers.", - "anyOf": [ - { - "$ref": "#/components/schemas/8_loyalty_tiers_expiration_balance" - }, - { - "$ref": "#/components/schemas/8_loyalty_tiers_expiration_points_in_period" - } - ] - }, - "category_id": { - "type": "string", - "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", - "example": "cat_0b688929a2476386a7" - }, - "category": { - "type": "string", - "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." - }, - "loyalty_card": { - "description": "Defines the loyalty card details.", - "type": "object", - "properties": { - "points": { - "type": "integer", - "description": "Initial loyalty card income in points to be applied to the loyalty card at voucher generation." - }, - "expiration_rules": { - "type": "object", - "description": "Defines point expiration rules.", - "properties": { - "period_type": { - "type": "string", - "enum": [ - "MONTH" - ], - "description": "The expiration period." - }, - "period_value": { - "type": "integer", - "description": "How many periods should pass before the expiration occurs." - }, - "rounding_type": { - "type": "string", - "enum": [ - "END_OF_MONTH", - "END_OF_QUARTER", - "END_OF_HALF_YEAR", - "END_OF_YEAR", - "PARTICULAR_MONTH" - ], - "description": "Round up expiration till the end of the given period type." - } - } - } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." } } - }, - "8_req_create_earning_rules": { - "description": "This data model represents the request body for the `/loyalties/{campaignId}/earning-rules` endpoint.", - "title": "Create Earning Rule Request Body", - "type": "array", - "items": { - "anyOf": [ - { - "$ref": "#/components/schemas/8_req_earning_rule_object_order_paid" + } + }, + "related_transaction_id": { + "type": "string", + "description": "This field is `null` in the case of this type of transaction." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." + } + } + }, + "1_obj_loyalty_card_transaction_object_accrual_custom_event": { + "title": "Accrual for Custom Event", + "description": "When points are earned on the card through an earning rule based on a custom event.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique transaction ID.", + "example": "vtx_0c9dccc4d5813e71bd" + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a points accrual, this value is `null`." + }, + "voucher_id": { + "type": "string", + "description": "Unique voucher ID.", + "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "source": { + "type": "string", + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", + "enum": [ + "Automation" + ] + }, + "reason": { + "type": "string", + "description": "Reason why the transaction occurred. In case of a points accrual, this value is `null`." + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "POINTS_ACCRUAL", + "enum": [ + "POINTS_ACCRUAL" + ] + }, + "details": { + "type": "object", + "description": "Contains the detailed information about the transaction.", + "properties": { + "balance": { + "type": "object", + "description": "Contains information on how the balance was affected by the transaction.", + "properties": { + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "loyalty_card" }, - { - "$ref": "#/components/schemas/8_req_earning_rule_object_entered_segment" + "total": { + "type": "integer", + "description": "The available points after the transaction." }, - { - "$ref": "#/components/schemas/8_req_earning_rule_object_custom_event" + "object": { + "type": "string", + "description": "The type of object represented by the JSON.", + "default": "balance" }, - { - "$ref": "#/components/schemas/8_req_earning_rule_object_tier" - } - ] - } - }, - "8_req_create_earning_rules_copy": { - "description": "This data model represents the request body for the `/loyalties/{campaignId}/earning-rules` endpoint.", - "type": "object", - "title": "Create Earning Rule Request Body", - "properties": { - "event": { - "type": "string", - "enum": [ - "order.paid", - "customer.segment.entered", - "custom_event_defined_in_EVENT_SCHEMA" - ], - "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `order.paid` an event defined by the Voucherify API corresponding to an order status `PAID`. Read more here. \n- `customer.segment.entered` an event defined by the Voucherify API corresponding to a customer entering a pre-defined customer segment. Read more here. \n- `custom_event_name` the name of a custom event defined in the Dashboard → **Project Settings** → **EVENT SCHEMA** → **Add event definition**. Read more on defining custom events. " - }, - "validation_rule_id": { - "type": "string", - "example": "val_248vs7tUjlIE", - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "loyalty": { - "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", - "oneOf": [ - { - "description": "Fixed. Applicable to events `order.paid`, `customer.segment.entered`, and `custom_event`.", - "properties": { - "points": { - "type": "integer", - "description": "The number of points to be added to the loyalty card.", - "example": 1000 - }, - "type": { - "type": "string", - "description": "Defines how the points will be added to the loyalty card. `FIXED` adds a fixed number of `points`.", - "default": "FIXED" - } - }, - "required": [ - "points", - "type" - ] - }, - { - "description": "Proportional. Applicable to only `order.paid`.", - "properties": { - "type": { - "type": "string", - "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio", - "default": "PROPORTIONAL" - }, - "order": { - "type": "object", - "description": "Defines proportion for calculating how many points to add to a loyalty card. The ratio is based on the order amount. For `every` dollar spent, the customer will get this many `points`. \n", - "required": [ - "amount" - ], - "properties": { - "amount": { - "type": "object", - "description": "Defines the ratio based on the order amount.", - "required": [ - "every", - "points" - ], - "properties": { - "every": { - "type": "integer", - "description": "Order amount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points awarded." - } - } - } - } - } + "points": { + "type": "integer", + "description": "The amount of points being added in the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." + }, + "related_object": { + "type": "object", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" }, - "required": [ - "type", - "order" - ] - } - ], - "type": "object" - }, - "source": { - "type": "object", - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "example": "Order Paid - You will get 100 points", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + "type": { + "type": "string", + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" + } } } - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" - }, - "start_date": { - "type": "string", - "example": "2022-02-02T13:00:00.000Z", - "format": "date-time", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default." - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "example": "2022-03-03T14:30:00.000Z", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." - }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day. `start_date` **required** when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", - "example": "PT1H" - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", - "example": "P2D" - } + } + }, + "event": { + "type": "object", + "description": "Contains information about the customer event that triggers the point accrual.", + "properties": { + "id": { + "type": "string", + "description": "Unique event ID.", + "example": "evcus_0c9c21def34e3c05bf" }, - "required": [ - "duration", - "interval" - ] - }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", - "items": { - "type": "integer" + "type": { + "type": "string", + "description": "Type of event.", + "example": "customer.custom_event" } - }, - "custom_event": { - "type": "object", - "description": "Contains the schema id of a custom event. **Required** for the custom event option in `event`.", - "properties": { - "schema_id": { - "type": "string", - "description": "Contains a unique identifier of a custom event schema. Assigned by the Voucherify API." - } + } + }, + "earning_rule": { + "type": "object", + "description": "Contains information about the earning rule.", + "properties": { + "id": { + "type": "string", + "description": "Unique earning rule ID.", + "example": "ern_2WsCIBEx6Lzf5IAV5IOR7a23" }, - "required": [ - "schema_id" - ] - }, - "segment": { - "type": "object", - "description": "Contains the id of a customer segment. **Required** for the `customer.segment.entered` option in `event`.", - "properties": { - "id": { - "type": "string", - "description": "Contains a unique identifier of a customer segment. Assigned by the Voucherify API." + "source": { + "type": "object", + "description": "Contains the custom earning rule name.", + "properties": { + "banner": { + "type": "string", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + } } - }, - "required": [ - "id" - ] + } } }, - "required": [ - "event", - "loyalty" - ] - }, - "8_req_update_earning_rule": { - "description": "Request body schema for updating earning rules using **PUT** `/loyalties/{campaignId}/earning-rules/{earningRuleId}` endpoint.", - "title": "Update Earning Rule Request Body", - "anyOf": [ - { - "$ref": "#/components/schemas/8_req_update_earning_rule_object_order_paid" - }, - { - "$ref": "#/components/schemas/8_req_update_earning_rule_object_entered_segment" - }, - { - "$ref": "#/components/schemas/8_req_update_earning_rule_object_custom_event" - }, - { - "$ref": "#/components/schemas/8_req_update_earning_rule_object_tier" - } - ] - }, - "8_res_list_earning_rules": { - "description": "Response body schema for listing earning rules using **GET** `/loyalties/{campaignId}/earning-rules` endpoint.", - "type": "object", - "title": "List Earning Rules Response Body", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about earning rules in a dictionary.", - "default": "list" - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of earning rule objects." - }, - "data": { - "type": "array", - "description": "Contains array of earning rule objects.", - "items": { - "$ref": "#/components/schemas/8_obj_earning_rule_object" + "custom_event": { + "type": "object", + "description": "Contains information about the custom event that triggers the point accrual.", + "properties": { + "id": { + "type": "string", + "description": "Unique event ID.", + "example": "event_0cc916d8374bfe8bc2" + }, + "type": { + "type": "string", + "description": "Type of custom event.", + "example": "user_subscribed" } - }, - "total": { - "type": "integer", - "description": "Total number of earning rule objects." - } - } - }, - "8_req_add_remove_points_balance": { - "title": "Add or Remove Points Balance Request Body", - "type": "object", - "description": "Request schema for adding or removing points from a loyalty card.", - "properties": { - "points": { - "type": "integer", - "description": "Incremental balance to be added to/subtracted from the loyalty card. \n\nTo add points: `100` \nTo subtract points, add a minus: `-100`" - }, - "expiration_type": { - "type": "string", - "default": "PROGRAM_RULES", - "enum": [ - "PROGRAM_RULES", - "NON_EXPIRING", - "CUSTOM_DATE" - ], - "description": "Set the type of expiration for added points. \n- `PROGRAM_RULES`: Inherit rules from campaign.\n- `NON_EXPIRING`: Points never expire.\n- `CUSTOM_DATE`: Points expire on a particular date. **Requires** `expiration_date` parameter." - }, - "expiration_date": { - "type": "string", - "description": "Set expiration date for added points, i.e. `YYYY-MM-DD`. This parameter is **required** only when `expiration_type` is set to `CUSTOM_DATE`.", - "example": "2020-05-30" - }, - "reason": { - "type": "string", - "description": "Reason for the transfer." - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." } - } - }, - "8_res_add_remove_points_balance": { - "description": "Response schema for adding or removing points from a loyalty card.", - "type": "object", - "title": "Add or Remove Loyalty Card Balance Response Body", - "properties": { - "points": { - "type": "integer", - "description": "The incremental points removed or added to the current balance on the loyalty card." - }, - "total": { - "type": "integer", - "description": "The total of points accrued over the lifetime of the loyalty card." - }, - "balance": { - "type": "integer", - "description": "The balance after adding/removing points." - }, - "type": { - "type": "string", - "description": "The type of voucher being modified.", - "default": "loyalty_card" - }, - "object": { - "type": "string", - "description": "The type of object represented by JSON. Default is `balance`.", - "default": "balance" - }, - "related_object": { - "type": "object", - "description": "Defines the object that is being modified with the values that are returned in the balance object.", - "properties": { - "type": { - "type": "string", - "description": "The object being modified.", - "default": "voucher" - }, - "id": { - "type": "string", - "description": "Identifies the loyalty card that is being modified, this is the ID that was assigned by the Voucherify API.", - "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" - } + }, + "event_schema": { + "type": "object", + "description": "Contains information about the custom event metadata schema.", + "properties": { + "id": { + "type": "string", + "description": "Unique metadata schema ID.", + "example": "ms_qpRZ3EmRQyszNH6Z52Gkq8au" + }, + "type": { + "type": "string", + "description": "Type of custom event.", + "example": "user_subscribed" } } } - }, - "8_req_transfer_loyalty_points": { - "description": "Request body schema for transferring points from a loyalty card.", - "type": "array", - "title": "Transfer Loyalty Points Request Body", - "items": { + } + }, + "related_transaction_id": { + "type": "string", + "description": "This field is `null` in the case of this type of transaction." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." + } + } + }, + "1_obj_loyalty_card_transaction_object_refund": { + "title": "Refund", + "description": "When points are credited back to a card through a redemption rollback.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique transaction ID.", + "example": "vtx_0c9dccc4d5813e71bd" + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a points refund, this value is `null`." + }, + "voucher_id": { + "type": "string", + "description": "Unique voucher ID.", + "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "source": { + "type": "string", + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a points refund, this value is `null`." + }, + "reason": { + "type": "string", + "description": "Reason why the transaction occurred. In case of a points refund, this value is `null`." + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "POINTS_REFUND", + "enum": [ + "POINTS_REFUND" + ] + }, + "details": { + "type": "object", + "description": "Contains the detailed information about the transaction.", + "properties": { + "balance": { "type": "object", + "description": "Contains information on how the balance was affected by the transaction.", "properties": { - "code": { + "type": { "type": "string", - "description": "Unique loyalty card code from which the user wants to transfer loyalty points (source).", - "example": "L-CARD-02hgnq4" + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "loyalty_card" + }, + "total": { + "type": "integer", + "description": "The available points after the transaction." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON.", + "default": "balance" }, "points": { "type": "integer", - "description": "The number of loyalty points that the user wants to transfer to another loyalty card. The number of points cannot be higher than the current balance on the loyalty card (source).", - "example": 2 + "description": "The amount of points being added in the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." }, - "reason": { + "related_object": { + "type": "object", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "type": { + "type": "string", + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" + } + } + } + } + }, + "order": { + "type": "object", + "description": "Contains information about the original order.", + "properties": { + "id": { "type": "string", - "description": "Reason for the transfer." + "description": "Unique order ID.", + "example": "ord_jj5EzDxDOd2xFPsAJJ18IaZK" }, "source_id": { "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." } } - } - }, - "8_req_redeem_reward": { - "description": "Request body schema for redeeming a reward.", - "type": "object", - "title": "Redeem Reward Request Body", - "properties": { - "reward": { - "type": "object", - "description": "Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward if the reward is a pay with points reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward.", - "example": "rew_eSi4eYJk7o3tOycvweicR2z7" - }, - "points": { - "type": "integer", - "description": "The number of loyalty points that the user wants to spend in order to fulfill the order. The number of points cannot be higher than the current balance on the loyalty card." - } + }, + "redemption": { + "type": "object", + "description": "Contains information about the original redemption.", + "properties": { + "id": { + "type": "string", + "description": "Unique redemption ID.", + "example": "r_0c94ed583fcafc31c1" } - }, - "order": { - "$ref": "#/components/schemas/8_req_order_object_redeem_reward", - "description": "Order object that is **required** when redeeming a pay with points reward." - }, - "metadata": { - "type": "object", - "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." } - } - }, - "8_req_order_object_redeem_reward": { - "type": "object", - "title": "Order object", - "description": "Request body schema for creating an order, **required** when redeeming a pay with points reward.", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of an integration between multiple systems. It can be an order ID from a CRM system, database or 3rd-party service." - }, - "status": { - "type": "string", - "description": "The order status.", - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULLFILLED" - ] - }, - "amount": { - "type": "integer", - "description": "A positive integer in the smallest currency unit (that is, 100 cents for $1.00) representing the total amount of the order; this is the sum of the order items' amounts." - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format." - }, - "referrer": { - "$ref": "#/components/schemas/10_req_orders_referrer_object" - }, - "items": { - "$ref": "#/components/schemas/10_req_orders_items_array" + }, + "rollback": { + "type": "object", + "description": "Contains information about the redemption rollback.", + "properties": { + "id": { + "type": "string", + "description": "Unique redemption rollback ID.", + "example": "rr_0c9b0967244a862a33" + } } - } - }, - "8_res_redeem_reward": { - "description": "Response body schema for redeeming a reward.", - "title": "Redeem Reward Response Body", - "$ref": "#/components/schemas/8_obj_redemption_object_loyalty_card_extended" - }, - "8_obj_redemption_object_loyalty_card_extended": { - "type": "object", - "title": "Loyalty Card Voucher", - "description": "This is an object representing a redemption. \n\nRedemption is the key operation in the voucher lifecycle. A customer can redeem a voucher 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](rollback-redemption).", - "properties": { - "id": { - "type": "string", - "example": "r_0bc92f81a6801f9bca", - "description": "Unique redemption ID." - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the redemption.", - "default": "redemption" - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-10-03T12:24:58.008Z", - "description": "Timestamp in ISO 8601 format indicating when the redemption occured." - }, - "customer_id": { - "type": "string", - "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "description": "Unique customer ID of the redeeming customer." - }, - "tracking_id": { - "type": "string", - "example": "track_fxEMFiLowFHg==", - "description": "Hashed customer source ID." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." - }, - "amount": { - "type": "integer", - "description": "Number of points being redeemed for a reward." - }, - "result": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ], - "description": "Redemption result." - }, - "order": { - "description": "Defines the details of the order that is related to the redemption.", - "$ref": "#/components/schemas/7_obj_order_object" - }, - "customer": { - "type": "object", - "description": "Defines the customer redeeming the reward.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "source_id": { - "type": "string", - "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." - }, - "object": { - "type": "string", - "description": "Type of object represented is `customer`.", - "default": "customer" - } - } - }, - "related_object_type": { - "type": "string", - "description": "Defines the related object. i.e. `voucher`.", - "enum": [ - "voucher" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object", - "description": "Defines the details of the voucher being redeemed." - }, - "reward": { - "description": "Defines the reward being redeemed.", - "anyOf": [ - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" - }, - { - "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" - } - ] - }, - "loyalty_card": { - "type": "object", - "description": "Stores the number of points being subtracted from the loyalty card for the reward redemption.", - "properties": { - "points": { - "type": "integer", - "description": "Number of points being subtracted from the loyalty card for the reward redemption." - } + }, + "reward": { + "type": "object", + "description": "Contains information about the pay with points reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique reward ID.", + "example": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1" + }, + "name": { + "type": "string", + "description": "Reward name.", + "example": "100 = $20" } } } - }, - "8_res_loyalties_campaign_id_tiers_tier_id_earning_rules": { - "type": "object", - "properties": { - "object": { - "type": "string" - }, - "data_ref": { - "type": "string" - }, - "data": { - "type": "array", - "items": { + } + }, + "related_transaction_id": { + "type": "string", + "description": "This field is `null` in the case of this type of transaction." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." + } + } + }, + "1_obj_loyalty_card_transaction_object_addition": { + "title": "Addition", + "description": "When points are added to a card.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique transaction ID.", + "example": "vtx_0c9dccc4d5813e71bd" + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." + }, + "voucher_id": { + "type": "string", + "description": "Unique voucher ID.", + "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "source": { + "type": "string", + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", + "enum": [ + "voucherify-web-ui", + "API" + ] + }, + "reason": { + "type": "string", + "description": "Reason why the transaction occurred." + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "POINTS_ADDITION", + "enum": [ + "POINTS_ADDITION" + ] + }, + "details": { + "type": "object", + "description": "Contains the detailed information about the transaction.", + "properties": { + "balance": { + "type": "object", + "description": "Contains information on how the balance was affected by the transaction.", + "properties": { + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "loyalty_card" + }, + "total": { + "type": "integer", + "description": "The available points after the transaction." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON.", + "default": "balance" + }, + "points": { + "type": "integer", + "description": "The amount of points being added in the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." + }, + "related_object": { "type": "object", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", "properties": { "id": { - "type": "string" - }, - "created_at": { - "type": "string" - }, - "updated_at": { - "type": "null" - }, - "validation_rule_id": { - "type": "null" - }, - "loyalty": { - "type": "object", - "properties": { - "points": { - "type": "integer" - }, - "type": { - "type": "string" - } - } - }, - "event": { - "type": "string" - }, - "source": { - "type": "object", - "properties": { - "banner": { - "type": "string" - }, - "object_id": { - "type": "string" - }, - "object_type": { - "type": "string" - } - } - }, - "active": { - "type": "boolean" - }, - "object": { - "type": "string" - }, - "automation_id": { - "type": "string" + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" }, - "custom_event": { - "type": "object", - "properties": { - "schema_id": { - "type": "string" - } - } + "type": { + "type": "string", + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" } } } - }, - "total": { - "type": "integer" - } - }, - "description": "Response body schema for `/loyalties/{campaignId}/tiers/{tierId}/earning-rules`.", - "title": "List Loyalty Tier Earning Rules" - }, - "8_res_loyalties_campaign_id_tiers_tier_id_rewards": { - "title": "List Loyalty Tier Rewards", - "type": "object", - "properties": { - "id": { - "type": "string" - } - }, - "description": "Response body schema for `/loyalties/{campaignId}/tiers/{tierId}/rewards`." - }, - "8_res_loyalties_campaign_id_reward-assignments_assignment_id": { - "type": "object", - "description": "Response body schema for `/loyalties/{campaignId}/reward-assignments/{assignmentId}`", - "title": "Get Reward Assignment", - "properties": { - "id": { - "type": "string", - "example": "rewa_hzc19a5NLyIr2bVL3UB1w0B3" - }, - "reward_id": { - "type": "string", - "example": "rew_JhjeISE1npQyxRmGV1JYohDP" - }, - "related_object_id": { - "type": "string", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - }, - "related_object_type": { - "type": "string", - "example": "campaign" - }, - "created_at": { - "type": "string", - "example": "2021-12-13T11:58:32.261Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "example": "2022-01-13T11:58:32.261Z", - "format": "date-time" - }, - "object": { - "type": "string", - "default": "reward_assignment" } } - }, - "8_res_loyalties_campaign_id_reward-assignments_assignment_id_reward": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - }, - "type": { - "type": "string" - }, - "parameters": { - "type": "object", - "properties": { - "coin": { - "type": "object", - "properties": { - "exchange_ratio": { - "type": "number" - }, - "points_ratio": { - "type": "integer" - } + } + }, + "related_transaction_id": { + "type": "string", + "description": "This field is `null` in the case of this type of transaction." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." + } + } + }, + "1_obj_loyalty_card_transaction_object_removal": { + "title": "Removal", + "description": "When points are removed from a card.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique transaction ID.", + "example": "vtx_0c9dccc4d5813e71bd" + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." + }, + "voucher_id": { + "type": "string", + "description": "Unique voucher ID.", + "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "source": { + "type": "string", + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", + "enum": [ + "voucherify-web-ui", + "API" + ] + }, + "reason": { + "type": "string", + "description": "Reason why the transaction occurred." + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "POINTS_REMOVAL", + "enum": [ + "POINTS_REMOVAL" + ] + }, + "details": { + "type": "object", + "description": "Contains the detailed information about the transaction.", + "properties": { + "balance": { + "type": "object", + "description": "Contains information on how the balance was affected by the transaction.", + "properties": { + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "loyalty_card" + }, + "total": { + "type": "integer", + "description": "The available points after the transaction." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON.", + "default": "balance" + }, + "points": { + "type": "integer", + "description": "The amount of points being subtracted in the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." + }, + "related_object": { + "type": "object", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "type": { + "type": "string", + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" } } } - }, - "stock": { - "type": "null" - }, - "redeemed": { - "type": "null" - }, - "attributes": { - "type": "object", - "properties": {} - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "null", - "format": "date-time" - }, - "object": { - "type": "string" } - }, - "description": "Response body schema for `/loyalties/{campaignId}/reward-assignments/{assignmentId}/`", - "title": "Get Reward Details" - }, - "8_obj_export_object_points_expiration": { - "title": "Points Expirations Export Object", - "type": "object", - "description": "This is an object representing an export of points expirations. ", - "properties": { - "id": { - "type": "string", - "description": "Unique export ID.", - "example": "exp_FFfp9o7daWuJqJCKp5xqqli4" - }, - "object": { - "type": "string", - "default": "export", - "description": "The type of object being represented. This object stores information about the export." - }, - "created_at": { - "type": "string", - "example": "2022-04-28T11:23:20.922Z", - "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format.", - "format": "date-time" - }, - "status": { - "type": "string", - "description": "Status of the export. Informs you whether the export has already been completed.", - "enum": [ - "SCHEDULED", - "IN_PROGRESS", - "DONE", - "ERROR" - ] - }, - "channel": { - "type": "string", - "description": "The channel through which the export was triggered.", - "enum": [ - "API", - "WEBSITE" - ] - }, - "exported_object": { - "type": "string", - "description": "The type of exported object.", - "enum": [ - "points_expiration" - ] - }, - "parameters": { - "type": "object", - "description": "List of fields and filters that were passed in the request body to create the export.", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "expires_at", - "-expires_at" - ] - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data that was exported. These fields define the headers in the CSV file. \n\n The array can be a combination of any of the following available fields: \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n |\n| campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 |\n| status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` |\n| expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 |\n| points | Number of points. | 1000 |", - "items": { - "type": "string" + } + } + }, + "related_transaction_id": { + "type": "string", + "description": "This field is `null` in the case of this type of transaction." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." + } + } + }, + "1_obj_loyalty_card_transaction_object_expiration": { + "title": "Expiration", + "description": "When points expire.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique transaction ID.", + "example": "vtx_0c9dccc4d5813e71bd" + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a points expiration, this value is `null`." + }, + "voucher_id": { + "type": "string", + "description": "Unique voucher ID.", + "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "source": { + "type": "string", + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", + "enum": [ + "Automation" + ] + }, + "reason": { + "type": "string", + "description": "Reason why the transaction occurred. In case of a points expiration, this value is `null`." + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "POINTS_EXPIRATION", + "enum": [ + "POINTS_EXPIRATION" + ] + }, + "details": { + "type": "object", + "description": "Contains the detailed information about the transaction.", + "properties": { + "balance": { + "type": "object", + "description": "Contains information on how the balance was affected by the transaction.", + "properties": { + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "loyalty_card" + }, + "total": { + "type": "integer", + "description": "The available points after the transaction." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON.", + "default": "balance" + }, + "points": { + "type": "integer", + "description": "The amount of points removed during the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." + }, + "related_object": { + "type": "object", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "type": { + "type": "string", + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" } - }, - "filters": { - "description": "Data filters used to narrow the data records to be returned in the export.", - "anyOf": [ - { - "$ref": "#/components/schemas/8_req_filter_campaign_id" - }, - { - "$ref": "#/components/schemas/8_req_filter_voucher_id" - } - ] - } - } - }, - "result": { - "type": "object", - "description": "Contains the URL of the CSV file.", - "properties": { - "url": { - "type": "string", - "description": "URL of the CSV file location." } } - }, - "user_id": { - "type": "string", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0Fr", - "description": " The user_id identifies the specific user who initiated the export through the Voucherify Dashboard; this `user_id` is returned when the channel value is `WEBSITE`." } } - }, - "8_req_export_points_expirations": { - "title": "Points Expirations Export Request Body", - "type": "object", - "description": "Request body schema for creating points expirations. ", - "properties": { - "parameters": { - "type": "object", - "description": "List of fields and filters that were passed in the request body to create the export.", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "expires_at", - "-expires_at" - ] - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data that was exported. These fields define the headers in the CSV file. \n\n The array can be a combintation of any of the following available fields: \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n |\n| campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 |\n| status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` |\n| expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 |\n| points | Number of points. | 1000 |", - "items": { - "type": "string" + } + }, + "related_transaction_id": { + "type": "string", + "description": "This field is `null` in the case of this type of transaction." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." + } + } + }, + "1_obj_loyalty_card_transaction_object_transfer_out": { + "title": "Transfer Out", + "description": "When points are transferred from one loyalty card to another.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique transaction ID.", + "example": "vtx_0c9dccc4d5813e71bd" + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." + }, + "voucher_id": { + "type": "string", + "description": "Unique voucher ID.", + "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "source": { + "type": "string", + "description": "The channel through which the transaction took place.", + "enum": [ + "API" + ] + }, + "reason": { + "type": "string", + "description": "Reason why the transaction occurred." + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "POINTS_TRANSFER_OUT", + "enum": [ + "POINTS_TRANSFER_OUT" + ] + }, + "details": { + "type": "object", + "description": "Contains the detailed information about the transaction.", + "properties": { + "balance": { + "type": "object", + "description": "Contains information on how the balance was affected by the transaction.", + "properties": { + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "loyalty_card" + }, + "total": { + "type": "integer", + "description": "The available points after the transaction." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON.", + "default": "balance" + }, + "points": { + "type": "integer", + "description": "The amount of points being subtracted in the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." + }, + "related_object": { + "type": "object", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "type": { + "type": "string", + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" } - }, - "filters": { - "description": "Data filters used to narrow the data records to be returned in the export.", - "anyOf": [ - { - "$ref": "#/components/schemas/8_req_filter_campaign_id" - }, - { - "$ref": "#/components/schemas/8_req_filter_voucher_id" - } - ] } } } - } - }, - "8_req_filter_campaign_id": { - "title": "Filter by campaign ID", - "type": "object", - "description": "Filter conditions set on the campaign ID.", - "properties": { - "campaign_id": { - "$ref": "#/components/schemas/8_req_filter_conditions" - }, - "junction": { - "type": "string", - "description": "Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `and` is an all-inclusive logical operator, meaning the `and` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `or` operator displays a record if **ANY** of the conditions separated by OR is TRUE.", - "enum": [ - "AND", - "OR" - ] - } - } - }, - "8_req_filter_voucher_id": { - "title": "Filter by voucher ID", - "type": "object", - "description": "Filter conditions set on the voucher ID.", - "properties": { - "voucher_id": { - "$ref": "#/components/schemas/8_req_filter_conditions" - }, - "junction": { - "type": "string", - "description": "Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `and` is an all-inclusive logical operator, meaning the `and` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `or` operator displays a record if **ANY** of the conditions separated by OR is TRUE.", - "enum": [ - "AND", - "OR" - ] - } - } - }, - "8_req_filter_junction": { - "title": "Filter by campaign ID", - "type": "object", - "description": "Filter conditions by campaign ID.", - "properties": { - "junction": { - "type": "string", - "description": "Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `and` is an all-inclusive logical operator, meaning the `and` operator displays a record if all the conditions separated by AND are TRUE, while an `or` operator displays a record if any of the conditions separated by OR is TRUE." - } - } - }, - "8_req_filter_conditions": { - "title": "Filter by conditions", - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "conditions": { - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "$in": { - "type": "array", - "description": "Array of resource values that should be included in the results.", - "items": { - "type": "string" - } - }, - "$not_in": { - "type": "array", - "description": "Array of resource values that should be included in the results.", - "items": { - "type": "string" + }, + "destination_voucher": { + "type": "object", + "description": "Contains information on how the balance on the receiving loyalty card was affected by the transaction.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the destination voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "code": { + "type": "string", + "description": "Unique code of the destination voucher.", + "example": "LOYALTY-CARD-A8XVurg" + }, + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "LOYALTY_CARD" + }, + "campaign": { + "type": "string", + "description": "Unqiue campaign name of the voucher's parent campaign." + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "loyalty_card": { + "type": "object", + "description": "Contains information on how the balance on the receiving loyalty card was affected by the transaction.", + "properties": { + "points": { + "type": "integer", + "description": "The total amount of points after the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." + }, + "next_expiration_date": { + "type": "string", + "description": "The date when the next set of points are due to expire, i.e. `YYYY-MM-DD`. This does not mean that the transferred points were added to this bucket. It only shows the next set of points due to expire. The transferred points are added to the last expiring bucket, i.e. to the bucket of points that are to expire the furthest in the future.", + "example": "2023-12-31" + }, + "next_expiration_points": { + "type": "integer", + "description": "The number of points due to expire on the next expiration date." } - }, - "$is": { - "type": "string", - "description": "Specify the exact resource value." - }, - "$is_not": { - "type": "string", - "description": "Results should omit this value." } + }, + "is_referral_code": { + "type": "integer", + "description": "Flag indicating whether this voucher is a referral code." } } } - }, - "8_res_list_reward_assignments": { - "title": "List Reward Assignments", - "type": "object", - "description": "Response body schema for **GET** `/loyalties/{campaignId}/rewards`.", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about loyalty reward assignments in a dictionary.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of reward assignment objects.", - "default": "data" - }, - "data": { - "type": "array", - "description": "Contains array of reward assignment objects.", - "items": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of reward assignment objects." - } - } - }, - "8_res_list_loyalty_tiers": { - "title": "List Loyalty Tiers", - "type": "object", - "description": "Response body schema for listing loyalty tiers for a campaign using **GET** `/loyalties/{campaignId}/tiers`.", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of loyalty tier objects.", - "default": "data" - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/8_obj_loyalty_tier_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of loyalty tier objects." - } - } - }, - "8_res_get_member_loyalty_tier": { - "title": "Get Member's Loyalty Tier Response Body", - "type": "object", - "description": "Response body schema for retrieving a member's loyalty tier for a campaign using **GET** `/loyalties/members/{memberId}/tiers`.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of loyalty tier objects." - }, - "data": { - "type": "array", - "description": "Contains array of loyalty tier objects.", - "items": { - "$ref": "#/components/schemas/8_obj_loyalty_tier_object_member" - } - }, - "total": { - "type": "integer", - "description": "Total number of loyalty tiers." - } - } - }, - "8_req_create_reward_assignment": { - "title": "Create Reward Assignment Request Body", - "type": "array", - "description": "Request body schema for **POST** `/loyalties/{campaignId}/rewards`.", - "items": { + } + }, + "related_transaction_id": { + "type": "string", + "description": "The related transaction ID on the receiving card.", + "example": "vtx_0c9afe802593b34b81" + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." + } + } + }, + "1_obj_loyalty_card_transaction_object_transfer_in": { + "title": "Transfer In", + "description": "When points are transferred in from another loyalty card.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique transaction ID.", + "example": "vtx_0c9dccc4d5813e71bd" + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a ponits transfer, this value is `null`." + }, + "voucher_id": { + "type": "string", + "description": "Unique voucher ID.", + "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "source": { + "type": "string", + "description": "The channel through which the transaction took place.", + "enum": [ + "API" + ] + }, + "reason": { + "type": "string", + "description": "Reason why the transaction occurred." + }, + "type": { + "type": "string", + "description": "Type of transaction.", + "default": "POINTS_TRANSFER_IN", + "enum": [ + "POINTS_TRANSFER_IN" + ] + }, + "details": { + "type": "object", + "description": "Contains the detailed information about the transaction.", + "properties": { + "balance": { "type": "object", + "description": "Contains information on how the balance was affected by the transaction.", "properties": { - "reward": { + "type": { "type": "string", - "example": "rew_2yGflHThU2yJwFECEFKrXBI2", - "description": "Unique reward ID." + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "loyalty_card" + }, + "total": { + "type": "integer", + "description": "The available points after the transaction." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON.", + "default": "balance" + }, + "points": { + "type": "integer", + "description": "The amount of points being added in the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are added to the loyalty card." }, - "parameters": { + "related_object": { "type": "object", - "description": "An object that defines the price of the reward in loyalty points.", + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", "properties": { - "loyalty": { - "type": "object", - "description": "Stores the points parameter.", - "properties": { - "points": { - "type": "integer", - "description": "Defines how many points are required to obtain the reward." - } - } + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "type": { + "type": "string", + "description": "The object being modified, i.e. `voucher`.", + "default": "voucher" } } } } - } - }, - "8_res_create_reward_assignment": { - "title": "Create Reward Assignment Response Body", - "type": "array", - "description": "Response body schema for **POST** `/loyalties/{campaignId}/rewards`.", - "items": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" - } - }, - "8_req_update_reward_assignment": { - "title": "Update Reward Assignment Request Body", - "type": "object", - "description": "Request body schema for **PUT** `/loyalties/{campaignId}/rewards/{assignmentId}`.", - "properties": { - "parameters": { - "type": "object", - "description": "An object that defines the price of the reward in loyalty points.", - "properties": { - "loyalty": { - "type": "object", - "description": "Stores the points parameter.", - "properties": { - "points": { - "type": "integer", - "description": "Defines how many points are required to obtain the reward." - } + }, + "source_voucher": { + "type": "object", + "description": "Contains information on how the balance on the donor loyalty card was affected by the transaction.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the source voucher that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + }, + "code": { + "type": "string", + "description": "Unique code of the source voucher.", + "example": "LOYALTY-CARD-A8XVurg" + }, + "type": { + "type": "string", + "description": "The type of voucher whose balance is being adjusted due to the transaction.", + "default": "LOYALTY_CARD" + }, + "campaign": { + "type": "string", + "description": "Unqiue campaign name of the voucher's parent campaign." + }, + "holder_id": { + "type": "string", + "description": "Unqiue customer ID of the loyalty card holder, this is the ID that was assigned by the Voucherify API.", + "example": "cust_xqA7DGj5eYPHg6PHVKwYRWiA" + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign.", + "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" + }, + "loyalty_card": { + "type": "object", + "description": "Contains information on how the balance on the source loyalty card was affected by the transaction.", + "properties": { + "points": { + "type": "integer", + "description": "The total amount of points after the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." + }, + "next_expiration_date": { + "type": "string", + "description": "The date when the next set of points are due to expire, i.e. `YYYY-MM-DD`. The points from the source loyalty card are taken from the expiration bucket(s) that are the first coming up to expire, starting from the first expiration bucket to expire in time. This parameter shows the next expiration date after the points were taken out of the loyalty card.", + "example": "2023-12-31" + }, + "next_expiration_points": { + "type": "integer", + "description": "The number of points due to expire on the expiration date." } } + }, + "is_referral_code": { + "type": "integer", + "description": "Flag indicating whether this voucher is a referral code." } } } - }, - "8_res_list_loyalty_tier_earning_rules": { - "title": "List Loyalty Tier Earning Rules", - "type": "object", - "description": "Response body schema for `/loyalties/{campaignId}/tiers/{tierId}/earning-rules`.", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about loyalty tier earning rules in a dictionary." - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of loyalty tier earning rule objects." - }, - "data": { - "type": "array", - "description": "Contains array of loyalty tier earning rules.", - "items": { - "$ref": "#/components/schemas/8_obj_earning_rule_object" + } + }, + "related_transaction_id": { + "type": "string", + "description": "The related transaction ID on the source card.", + "example": "vtx_0c9afe802593b34b81" + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." + } + } + }, + "8_req_create_loyalty_card_transactions_export": { + "type": "object", + "title": "Create Loyalty Card Transactions Export Request Body", + "description": "Request body schema for **POST** `/loyalties/members/{memberId}/transactions/export`.", + "properties": { + "parameters": { + "$ref": "#/components/schemas/8_obj_export_loyalty_card_transactions", + "description": "Contains the parameters that define the data to be exported." + } + } + }, + "8_obj_export_loyalty_card_transactions": { + "description": "List of available fields and filters that can be exported with a loyalty card transactions export along with the sorting order of the returned data.", + "title": "Export Transactions", + "type": "object", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "-created_at", + "created_at" + ] + }, + "fields": { + "type": "array", + "enum": [ + [ + "id", + "type", + "source_id", + "reason", + "balance", + "amount", + "created_at", + "voucher_id", + "campaign_id", + "source", + "details", + "related_transaction_id" + ] + ], + "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID assigned by Voucherify. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `POINTS_EXPIRATION`
                  - `POINTS_ADDITION`
                  - `POINTS_REMOVAL`
                  - `POINTS_TRANSFER_OUT`
                  - `POINTS_ACCRUAL`
                  - `POINTS_REFUND`
                  - `POINTS_REDEMPTION` |\n| source_id | Custom source ID of the transaction if one was included originally. | source_id_custom |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The loyalty card balance after the transaction. | |\n| amount | The amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | - `API`
                  - `voucherify-web-ui`
                  - `Automation` |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n| related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |", + "items": { + "type": "string" + } + } + } + }, + "8_obj_export_transactions_object": { + "title": "Export Object", + "type": "object", + "description": "This is an object representing an export. \n\n Using this endpoint, you can export [loyalty card transactions](ref:list-loyalty-card-transactions) as a CSV file. This functionality works asynchronously and comes down to the following steps: \n* create an export object and return its `id` so you can track its `status`\n* trigger a CSV file generation, change the status to `SCHEDULED`\n* when the generation is over, store the file in S3 and change the `status` to `DONE`\n* now you can (ref:download-export) it\n\nWith `parameters` you can select which `fields` will be exported. An export request will almost always result in a single file being generated by the system. However, when your volume of data is large, the system may split the results into multiple chunks.", + "properties": { + "id": { + "type": "string", + "description": "Unique export ID.", + "example": "exp_FFfp9o7daWuJqJCKp5xqqli4" + }, + "object": { + "type": "string", + "default": "export", + "description": "The type of object being represented. This object stores information about the `export`." + }, + "created_at": { + "type": "string", + "example": "2022-04-28T11:23:20.922Z", + "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format.", + "format": "date-time" + }, + "status": { + "type": "string", + "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.", + "enum": [ + "SCHEDULED", + "IN_PROGRESS", + "DONE", + "ERROR" + ] + }, + "channel": { + "type": "string", + "description": "The channel through which the export was triggered.", + "default": "API" + }, + "exported_object": { + "type": "string", + "description": "The type of exported object.", + "default": "voucher_transactions" + }, + "parameters": { + "$ref": "#/components/schemas/16_obj_export_loyalty_card_transactions" + }, + "result": { + "type": "object", + "description": "Contains the URL of the CSV file.", + "properties": { + "url": { + "type": "string", + "description": "URL of the CSV file location. It contains the `token` used for authorization in the [Download export](ref:download-export) method." + } + } + }, + "user_id": { + "type": "string", + "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the `channel` value is `WEBSITE`.", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH" + } + } + }, + "8_obj_loyalty_tier_object": { + "type": "object", + "title": "Loyalty Tier Object", + "description": "This is an object representing a loyalty tier. \n\nLoyalty tiers are used to create a loyalty program with different levels of membership and varied earning rules and rewards based on customer’s tiers.", + "properties": { + "id": { + "type": "string", + "example": "ltr_30KHciA0UG8B71Fo51GZqwgN", + "description": "Unique loyalty tier ID." + }, + "name": { + "type": "string", + "description": "Loyalty Tier name." + }, + "campaign_id": { + "type": "string", + "example": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "description": "Unique parent campaign ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-11-10T12:20:52.755Z", + "description": "Timestamp representing the date and time when the loyalty tier was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-11-25T10:59:43.231Z", + "description": "Timestamp representing the date and time when the loyalty tier was updated in ISO 8601 format." + }, + "earning_rules": { + "type": "object", + "description": "Contains a list of earning rule IDs and their points mapping for the given earning rule.", + "properties": { + "unique_earning_rule_ID": { + "description": "ern_95aq3JaE5A8xzHjoJPYNRqXZ", + "anyOf": [ + { + "$ref": "#/components/schemas/8_obj_mapping_multiply" + }, + { + "$ref": "#/components/schemas/8_obj_mapping_fixed" } - }, - "total": { - "type": "integer", - "description": "Total number of earning rule objects." - } + ] } - }, - "8_res_list_loyalty_tier_rewards": { - "title": "List Loyalty Tier Rewards", - "type": "object", - "description": "Response schema for `/loyalties/{campaignId}/tiers/{tierId}/rewards`.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about loyalty tier rewards in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of loyalty tier reward objects." - }, - "data": { - "type": "array", - "description": "Contains array of loyalty tier reward objects.", - "items": { - "$ref": "#/components/schemas/8_obj_loyalty_tier_reward_object" + } + }, + "rewards": { + "type": "object", + "description": "Contains a list of reward IDs and their points mapping for the given reward.", + "properties": { + "unique_reward_ID": { + "description": "rewa_t88DnSdNnE0IzQX6gqH3jHGQ", + "anyOf": [ + { + "$ref": "#/components/schemas/8_obj_mapping_multiply" + }, + { + "$ref": "#/components/schemas/8_obj_mapping_fixed" } - }, - "total": { - "type": "integer", - "description": "Total number of loyalty tier reward objects." - } + ] } - }, - "8_res_list_members": { - "title": "List Members", - "type": "object", - "description": "Response body schema for **GET** `/loyalties/{campaignId}/members`.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about members in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "vouchers", - "description": "Identifies the name of the attribute that contains the array of voucher objects." - }, - "vouchers": { - "type": "array", - "description": "Contains array of voucher objects representing loyalty cards, in other words, loyalty program members.", - "items": { - "$ref": "#/components/schemas/8_obj_loyalty_card_object_non_expanded_categories" + } + }, + "config": { + "type": "object", + "description": "Defines loyalty tier range in points.", + "properties": { + "points": { + "type": "object", + "description": "Defines range of loyalty tier in points.", + "properties": { + "from": { + "type": "integer", + "description": "Bottom points threshold value." + }, + "to": { + "type": "integer", + "description": "Top points threshold value." } - }, - "total": { - "type": "integer", - "description": "Total number of voucher objects." } } - }, - "8_req_add_member": { - "title": "Add Member Request Body", - "type": "object", - "description": "Request body schema for assigning a loyalty card to a customer using **POST** `/loyalties/{campaignId}/members`.", - "properties": { - "voucher": { - "type": "string", - "description": "Specify the loyalty card code that you would like to publish to a customer." - }, - "channel": { - "type": "string", - "description": "Specify the distribution channel." - }, - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/8_req_customer_id_string" - }, - { - "$ref": "#/components/schemas/8_req_customer_id" - }, - { - "$ref": "#/components/schemas/8_req_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." - }, - "metadata": { - "type": "string", - "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." - } + } + }, + "points": { + "type": "object", + "description": "Defines range of loyalty tier in points.", + "properties": { + "from": { + "type": "integer", + "description": "Bottom points threshold value." + }, + "to": { + "type": "integer", + "description": "Top points threshold value." } - }, - "8_req_customer_id": { - "title": "Customer ID", - "description": "You can pass the unique customer ID that was assigned by Voucherify.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of an existing customer." + } + }, + "object": { + "type": "string", + "default": "loyalty_tier", + "description": "The type of object represented by JSON. This object stores information about the loyalty." + } + } + }, + "8_obj_loyalty_tier_object_member": { + "type": "object", + "title": "Loyalty Tier Object", + "description": "This is an object representing a loyalty tier. \n\nLoyalty tiers are used to create a loyalty program with different levels of membership and varied earning rules and rewards based on customer’s tiers.", + "properties": { + "id": { + "type": "string", + "example": "ltr_30KHciA0UG8B71Fo51GZqwgN", + "description": "Unique loyalty tier ID." + }, + "name": { + "type": "string", + "description": "Loyalty Tier name." + }, + "campaign_id": { + "type": "string", + "example": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "description": "Unique parent campaign ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format." + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-11-10T12:20:52.755Z", + "description": "Timestamp representing the date and time when the loyalty tier was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-11-25T10:59:43.231Z", + "description": "Timestamp representing the date and time when the loyalty tier was updated in ISO 8601 format." + }, + "earning_rules": { + "type": "object", + "description": "Contains a list of earning rule IDs and their points mapping for the given earning rule.", + "properties": { + "unique_earning_rule_ID": { + "description": "ern_95aq3JaE5A8xzHjoJPYNRqXZ", + "anyOf": [ + { + "$ref": "#/components/schemas/8_obj_mapping_multiply" + }, + { + "$ref": "#/components/schemas/8_obj_mapping_fixed" + } + ] + } + } + }, + "rewards": { + "type": "object", + "description": "Contains a list of reward IDs and their points mapping for the given reward.", + "properties": { + "unique_reward_ID": { + "description": "rewa_t88DnSdNnE0IzQX6gqH3jHGQ", + "anyOf": [ + { + "$ref": "#/components/schemas/8_obj_mapping_multiply" + }, + { + "$ref": "#/components/schemas/8_obj_mapping_fixed" + } + ] + } + } + }, + "config": { + "type": "object", + "description": "Defines loyalty tier range in points.", + "properties": { + "points": { + "type": "object", + "description": "Defines range of loyalty tier in points.", + "properties": { + "from": { + "type": "integer", + "description": "Bottom points threshold value." + }, + "to": { + "type": "integer", + "description": "Top points threshold value." + } } } + } + }, + "points": { + "type": "object", + "description": "Defines range of loyalty tier in points.", + "properties": { + "from": { + "type": "integer", + "description": "Bottom points threshold value." + }, + "to": { + "type": "integer", + "description": "Top points threshold value." + } + } + }, + "expiration": { + "type": "object", + "description": "Contains information about when the expiration tier will expire.", + "properties": { + "customer_id": { + "type": "string", + "example": "cust_qBwHpagDOFu71Z3F22UzR80X", + "description": "Unique customer ID whose point expiration dates are defined in this object." + }, + "campaign_id": { + "type": "string", + "example": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "description": "Unique parent campaign ID." + }, + "tier_id": { + "type": "string", + "example": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2", + "description": "Unique loyalty tier ID." + }, + "start_date": { + "type": "string", + "example": "2022-11-10", + "description": "Exact start date of the loyalty tier for the given customer." + }, + "expiration_date": { + "type": "string", + "example": "2023-02-28", + "description": "Exact expiration date of the loyalty tier for the given customer." + }, + "created_at": { + "type": "string", + "example": "2022-11-09T11:26:26.719Z", + "format": "date-time", + "description": "Timestamp representing the date and time when the loyalty tier expiration was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "example": "2022-11-10T08:54:47.200Z", + "format": "date-time", + "description": "Timestamp representing the date and time when the loyalty tier expiration was created in ISO 8601 format." + } + } + }, + "object": { + "type": "string", + "default": "loyalty_tier", + "description": "The type of object represented by JSON. This object stores information about the loyalty." + } + } + }, + "8_obj_mapping_multiply": { + "type": "object", + "title": "Multiply Points", + "description": "Points are multiplied by a multiplier.", + "properties": { + "type": { + "type": "string", + "description": "Type of calculation.", + "enum": [ + "MULTIPLY" + ] + }, + "multiplier": { + "type": "integer", + "description": "Multiplication factor used to multiply the points to obtain the mapped points." + } + } + }, + "8_obj_mapping_fixed": { + "type": "object", + "title": "Fixed Points", + "description": "Points are fixed.", + "properties": { + "type": { + "type": "string", + "description": "Type of calculation.", + "enum": [ + "CUSTOM" + ] + }, + "points": { + "type": "integer", + "description": "Fixed number of points to be applied." + } + } + }, + "8_obj_earning_rule_object": { + "description": "This is an object representing an earning rule.", + "title": "Earning Rule Object", + "examples": [ + { + "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", + "created_at": "2022-02-07T08:19:41.810Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 2, + "type": "FIXED" + }, + "custom_event": { + "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" + }, + "event": "saw_on_facebook", + "source": { + "banner": "Saw on Facebook Timeframe", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" }, - "8_req_customer_id_string": { - "title": "Customer ID", - "description": "You can pass the unique customer ID that was assigned by Voucherify or the source ID.", - "type": "string" + "active": true, + "start_date": "2022-02-07T08:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" }, - "8_req_customer_source_id": { - "title": "Customer Source ID", - "description": "You can send the source ID that you used to create the customer in Voucherify.", - "type": "object", - "properties": { - "source_id": { - "type": "string", - "description": "A unique identifier of a customer. It can be a customer ID or email from a CRM system, database or 3rd-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored." + "object": "earning_rule", + "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" + }, + { + "id": "ern_taClaOIiaGNdmdby8xS0lCcy", + "created_at": "2022-02-04T13:27:50.665Z", + "updated_at": "2022-02-07T08:19:44.198Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" + }, + "event": "order.paid", + "source": { + "banner": "Order paid 1000 points", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 4 + ], + "object": "earning_rule", + "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" + }, + { + "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", + "created_at": "2022-02-04T13:02:52.937Z", + "updated_at": "2022-02-07T08:19:43.291Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" + }, + "segment": { + "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" + }, + "event": "customer.segment.entered", + "source": { + "banner": "Entered segment 100 points.", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" + }, + { + "id": "ern_gVo6CHBduFPoh1hctASfXHLT", + "created_at": "2022-11-24T17:01:42.809Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 4, + "points": 4, + "property": "customer_life_time_value" } } }, - "8_res_get_member_activities": { - "title": "Get Member Activities", - "type": "object", - "description": "Response body schema for retrieving member activities.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about member activities in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "activities", - "description": "Identifies the name of the attribute that contains the array of event objects." - }, - "activities": { - "type": "array", - "description": "Contains array of event objects.", - "items": {} - }, - "total": { - "type": "integer", - "description": "Total number of event objects." + "event": "customer.loyalty.tier.joined", + "loyalty_tier": { + "id": "ltr_pudTGWasuIqxdiDM0go31OV1" + }, + "source": { + "banner": "Tier joined", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_wdlEo17wmoqYHGfilbayEUj7", + "metadata": { + "Type": "Tier joined - customer metadata - proportional" + } + }, + { + "id": "ern_66OdCyLADv5IGFoQe18vGUwa", + "created_at": "2022-11-24T17:03:59.414Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 2, + "points": 2, + "property": "customer_life_time_value" } } }, - "8_res_list_member_rewards": { - "title": "List Member Rewards", - "type": "object", - "description": "Response body schema for `/loyalties/members/{memberId}/rewards`.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about member rewards in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of loyalty reward objects." - }, - "data": { - "type": "array", - "description": "Contains array of loyalty reward objects.", - "items": { - "$ref": "#/components/schemas/8_obj_loyalty_reward_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of loyalty reward objects." + "event": "customer.loyalty.tier.left", + "loyalty_tier": { + "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2" + }, + "source": { + "banner": "Tier left", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_czm5el1Uz1jeGaO97AYoDNAq", + "metadata": { + "Type": "Tier left" + } + }, + { + "id": "ern_YR3fDfCjAmz9a5D68nk0i4dm", + "created_at": "2022-11-25T07:29:38.961Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 3, + "points": 4, + "property": "customer_life_time_value" } } }, - "8_res_get_points_expiration": { - "title": "Get Points Expiration Response Body", - "type": "object", - "description": "Response body schema for `/loyalties/{campaignId}/members/{memberId}/points-expiration`.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about loyalty points expiration buckets in a dictionary." - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of loyalty points expiration bucket objects.", - "default": "data" - }, - "data": { - "type": "array", - "description": "Contains array of loyalty points expiration buckets.", - "items": { - "$ref": "#/components/schemas/8_obj_loyalty_points_bucket" - } - }, - "total": { - "type": "integer", - "description": "Total number of point expiration buckets." + "event": "customer.loyalty.tier.upgraded", + "loyalty_tier": { + "id": "ltr_30KHciA0UG8B71Fo51GZqwgN" + }, + "source": { + "banner": "Tier upgraded", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_M1OdRH8spk6Fs7yTuPLN2LAv", + "metadata": { + "Type": "Upgraded" + } + }, + { + "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", + "created_at": "2022-11-25T07:31:05.866Z", + "updated_at": "2022-11-25T07:31:43.029Z", + "validation_rule_id": "val_kfmWpfXMI9P1", + "loyalty": { + "points": 1, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.downgraded", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Tier Downgraded", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", + "metadata": { + "Type": "Tier" + } + }, + { + "id": "ern_AdlWO2yt6b6llWsibIdiRXVE", + "created_at": "2022-11-25T07:31:42.767Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 5, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.prolonged", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Prolonged", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_4jH1yq9WJS0oJ8suagCrltyb", + "metadata": {} + } + ], + "anyOf": [ + { + "$ref": "#/components/schemas/8_obj_earning_rule_object_order_paid" + }, + { + "$ref": "#/components/schemas/8_obj_earning_rule_object_custom_event" + }, + { + "$ref": "#/components/schemas/8_obj_earning_rule_object_entered_segment" + }, + { + "$ref": "#/components/schemas/8_obj_earning_rule_object_tier" + } + ] + }, + "8_obj_earning_rule_object_no_validation_rule": { + "description": "This is an object representing an earning rule.", + "title": "Earning Rule Object", + "examples": [ + { + "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", + "created_at": "2022-02-07T08:19:41.810Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 2, + "type": "FIXED" + }, + "custom_event": { + "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" + }, + "event": "saw_on_facebook", + "source": { + "banner": "Saw on Facebook Timeframe", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-02-07T08:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "object": "earning_rule", + "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" + }, + { + "id": "ern_taClaOIiaGNdmdby8xS0lCcy", + "created_at": "2022-02-04T13:27:50.665Z", + "updated_at": "2022-02-07T08:19:44.198Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" + }, + "event": "order.paid", + "source": { + "banner": "Order paid 1000 points", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 4 + ], + "object": "earning_rule", + "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" + }, + { + "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", + "created_at": "2022-02-04T13:02:52.937Z", + "updated_at": "2022-02-07T08:19:43.291Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" + }, + "segment": { + "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" + }, + "event": "customer.segment.entered", + "source": { + "banner": "Entered segment 100 points.", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" + }, + { + "id": "ern_gVo6CHBduFPoh1hctASfXHLT", + "created_at": "2022-11-24T17:01:42.809Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 4, + "points": 4, + "property": "customer_life_time_value" } } }, - "9_req_create_customer": { - "type": "object", - "title": "Customer", - "description": "This is an object containing information about the customer.", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service. \n\nPlease note that if you would like your data to sync based on the `source_id` of the customer, you need to define the `source_id` upfront. You will not be able to change or update the `source_id` later on." - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a customer object." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "phone": { - "type": "string", - "description": "Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel." - }, - "address": { - "type": "object", - "description": "Customer's address.", - "properties": { - "city": { - "type": "string", - "description": "City" - }, - "state": { - "type": "string", - "description": "State" - }, - "line_1": { - "type": "string", - "description": "First line of address." - }, - "line_2": { - "type": "string", - "description": "Second line of address." - }, - "country": { - "type": "string", - "description": "Country." - }, - "postal_code": { - "type": "string", - "description": "Postal code." - } - } - }, - "birthdate": { - "type": "string", - "description": "Customer's birthdate; format `YYYY-MM-DD`.", - "format": "date" - }, - "birthday": { - "type": "string", - "description": "Customer's birthdate; format `YYYY-MM-DD`.", - "format": "date" - }, + "event": "customer.loyalty.tier.joined", + "loyalty_tier": { + "id": "ltr_pudTGWasuIqxdiDM0go31OV1" + }, + "source": { + "banner": "Tier joined", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_wdlEo17wmoqYHGfilbayEUj7", + "metadata": { + "Type": "Tier joined - customer metadata - proportional" + } + }, + { + "id": "ern_66OdCyLADv5IGFoQe18vGUwa", + "created_at": "2022-11-24T17:03:59.414Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. " + "every": 2, + "points": 2, + "property": "customer_life_time_value" } } }, - "9_req_update_customer": { - "type": "object", - "title": "Customer object", - "description": "This is an object containing information about the customer.", - "properties": { - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a customer object." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "phone": { - "type": "string", - "description": "Customer's phone number." - }, - "address": { - "type": "object", - "description": "Customer's address.", - "properties": { - "city": { - "type": "string", - "description": "City" - }, - "state": { - "type": "string", - "description": "State" - }, - "line_1": { - "type": "string", - "description": "First line of address." - }, - "line_2": { - "type": "string", - "description": "Second line of address." - }, - "country": { - "type": "string", - "description": "Country." - }, - "postal_code": { - "type": "string", - "description": "Postal code." - } - } - }, - "birthdate": { - "type": "string", - "description": "Customer's birthdate; format `YYYY-MM-DD`.", - "format": "date" - }, - "birthday": { - "type": "string", - "description": "Customer's birthdate; format `YYYY-MM-DD`.", - "format": "date" - }, + "event": "customer.loyalty.tier.left", + "loyalty_tier": { + "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2" + }, + "source": { + "banner": "Tier left", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_czm5el1Uz1jeGaO97AYoDNAq", + "metadata": { + "Type": "Tier left" + } + }, + { + "id": "ern_YR3fDfCjAmz9a5D68nk0i4dm", + "created_at": "2022-11-25T07:29:38.961Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. " + "every": 3, + "points": 4, + "property": "customer_life_time_value" } } }, - "9_obj_customer_object": { - "type": "object", - "description": "This is an object representing a customer. \n\nThis entity allows you to:\n* store customer details in Voucherify\n* link [redemptions](ref:list-redemptions) and [validations](ref:validate-voucher) to a particular customer\n* build customer segments and use them in validation rules. ", - "title": "Customer Object", - "examples": [ - { - "id": "cust_4vMj8Twr5nBzvTrNCgipMb6M", - "source_id": "08dd9b5a", - "name": "Bob Smith", - "email": "bob.smith@email.com", - "address": { - "city": "New York", - "state": "NY", - "line_1": "678 Main St", - "line_2": null, - "country": "USA", - "postal_code": "10001" - }, - "summary": { - "redemptions": { - "total_redeemed": 5, - "total_failed": 0, - "total_succeeded": 5, - "total_rolled_back": 0, - "total_rollback_failed": 0, - "total_rollback_succeeded": 0, - "gift": { - "redeemed_amount": 0, - "amount_to_go": 0 - }, - "loyalty_card": { - "redeemed_points": 0, - "points_to_go": 830 - } - }, - "orders": { - "total_amount": 94600, - "total_count": 5, - "average_amount": 18920, - "last_order_amount": 27500, - "last_order_date": "2022-09-15T11:11:36.630Z" - } - }, - "loyalty": { - "points": 830, - "referred_customers": 0, - "campaigns": { - "Loyalty Campaign - Webinar": { - "points": 830, - "referred_customers": 0 - } - } - }, - "referrals": { - "total": 0, - "campaigns": [] - }, - "metadata": { - "age": 24, - "loyalty_customer": "true", - "acquisition_channel": "Facebook" - }, - "system_metadata": { - "consents": { - "cnst_lbgOBhHTuDrB7sjIhFjvIALj": { - "date": "2022-11-22T15:48:50.219Z", - "value": true - } - } - }, - "created_at": "2022-09-15T10:33:46.388Z", - "updated_at": "2022-11-22T15:48:50.220Z", - "assets": { - "cockpit_url": "https://cockpits.voucherify.io/customers?token=U2FsdGVkX186yavyLJyykWa9KfhE1J850qWbQ1B%2BjKBZ0wrIzBNaW1WR6tNZo71Y5oTWG6PYpI9BpXDSnzz7CRfQ3lu7M151btz2vlYVxbd2eHNOjTFEwTbD8wK4moLONgtTlPM8ze42nmutFk5GUBepUEhxHRfbk8zekWqWvo8%2FbnAJsPl2rxYyaggwXQDj" - }, - "object": "customer" - } - ], - "x-tags": [ - "CUSTOMERS API" - ], - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_CSnYd37MXmrbS19XCrghjBsv" - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It is externally defined. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a customer object." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "phone": { - "type": "string", - "description": "Customer's phone number." - }, - "birthdate": { - "type": "string", - "description": "Customer's birthdate." - }, - "birthday": { - "type": "string", - "description": "Customer's birthday." - }, - "address": { - "type": "object", - "description": "Customer's address.", - "properties": { - "city": { - "type": "string", - "description": "City" - }, - "state": { - "type": "string", - "description": "State" - }, - "line_1": { - "type": "string", - "description": "First line of address." - }, - "line_2": { - "type": "string", - "description": "Second line of address." - }, - "country": { - "type": "string", - "description": "Country." - }, - "postal_code": { - "type": "string", - "description": "Postal code." - } - } - }, - "summary": { - "type": "object", - "description": "Contains a summary of customer's redemption and order statistics.", - "properties": { - "redemptions": { - "type": "object", - "description": "Customer's redemptions statistics.", - "properties": { - "total_redeemed": { - "type": "integer", - "description": "Total number of redemptions made by the customer." - }, - "total_failed": { - "type": "integer", - "description": "Total number of redemptions that failed." - }, - "total_succeeded": { - "type": "integer", - "description": "Total number of redemptions that succeeded." - }, - "total_rolled_back": { - "type": "integer", - "description": "Total number of redemptions that were rolled back for the customer." - }, - "total_rollback_failed": { - "type": "integer", - "description": "Total number of redemption rollbacks that failed." - }, - "total_rollback_succeeded": { - "type": "integer", - "description": "Total number of redemption rollbacks that succeeded." - }, - "gift": { - "type": "object", - "description": "Summary of gift card credits.", - "properties": { - "redeemed_amount": { - "type": "integer", - "description": "Total amount of gift card credits redeemed by customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "amount_to_go": { - "type": "integer", - "description": "Remaining gift card balance across all gift cards. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - }, - "loyalty_card": { - "type": "object", - "description": "Summary of loyalty points.", - "properties": { - "redeemed_points": { - "type": "integer", - "description": "Total number of loyalty points redeemed by the customer." - }, - "points_to_go": { - "type": "integer", - "description": "Sum of remaining available point balance across all loyalty cards." - } - } - } - } - }, - "orders": { - "type": "object", - "description": "Customer's order statistics.", - "properties": { - "total_amount": { - "type": "integer", - "description": "The total amount spent by the customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "total_count": { - "type": "integer", - "description": "Total number of orders made by the customer." - }, - "average_amount": { - "type": "integer", - "description": "Average amount spent on orders. `total_amount` ÷ `total_count`. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "last_order_amount": { - "type": "integer", - "description": "Amount spent on last order. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "last_order_date": { - "type": "string", - "format": "date-time", - "example": "2022-08-30T11:51:08.029Z", - "description": "Timestamp representing the date and time of the customer's last order in ISO 8601 format." - } - } - } - } - }, - "loyalty": { - "type": "object", - "description": "Summary of customer's loyalty information.", - "properties": { - "points": { - "type": "integer", - "description": "Sum of remaining available point balance across all loyalty cards." - }, - "referred_customers": { - "type": "integer", - "description": "Total number of customers referred by the customer." - }, - "campaigns": { - "type": "object", - "description": "Contains campaigns with details about point balances and how many customers were referred by the customer.", - "properties": { - "campaign_name": { - "type": "object", - "description": "Contains details about the point balances left on loyalty cards and the number of referred customers in each campaign.", - "properties": { - "points": { - "type": "integer", - "description": "Remaining point balance in campaign." - }, - "loyalty_tier": { - "type": "string", - "example": "ltr_UJ5Q54Q0OvEhua87Qfv2Ki5x", - "description": "Customer's loyalty tier within the campaign." - }, - "referred_customers": { - "type": "integer", - "description": "Number of customers referred by the customer in campaign." - } - } - } - } - } - } - }, - "referrals": { - "type": "object", - "description": "Summary of customer's referrals, in this case, the customer being the referee, i.e. information about the source of referrals and number of times the customer was referred by other customers.", - "properties": { - "total": { - "type": "integer", - "description": "Total number of times this customer received a referral, i.e. was referred by another customer." - }, - "campaigns": { - "type": "array", - "description": "Contains an array of campaigns that served as the source of a referral for the customer.", - "items": { - "type": "object", - "description": "Contains information about the source of the referral.", - "properties": { - "campaign_id": { - "type": "string", - "description": "Unique campaign ID, assigned by Voucherify.", - "example": "camp_rRsfatlwN7unSeUIJDCYedal" - }, - "referrer_id": { - "type": "string", - "example": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", - "description": "Unique referrer ID, assigned by Voucherify. This is the customer ID of a customer that is referring this customer." - }, - "related_object_id": { - "type": "string", - "description": "Related object ID, i.e. `r_0b9d4cc4aa164dd073`." - }, - "related_object_type": { - "type": "string", - "description": "Related object type, i.e. `redemption`." - }, - "date": { - "type": "string", - "format": "date-time", - "example": "2022-08-30T10:19:39.196Z", - "description": "Timestamp representing the date and time when the customer was referred in ISO 8601 format." - } - } - } - } - } - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments." - }, - "system_metadata": { - "type": "object", - "description": "Object used to store system metadata information.", - "properties": { - "consents": { - "type": "object", - "description": "Stores a list of consent ID's along with the timestamp and decision on accepting or rejecting a marketing permission.", - "properties": { - "consentId": { - "type": "object", - "description": "Unique ID of a consent, i.e. `cnst_lbgOBhHTuDrB7sjIhFjvIALj`.", - "properties": { - "date": { - "type": "string", - "description": "Timestamp representing the date and time when a consent was accepted or rejected in ISO 8601 format.", - "example": "2022-05-10T08:50:10.338Z", - "format": "date-time" - }, - "value": { - "type": "boolean", - "description": "Accepted: `true`, Rejected: `false`" - } - } - } - } - }, - "source": { - "type": "string", - "description": "Takes on the name of the source of the integration if the customer was created through an integration, i.e. `Bigcommerce` or `Shopify`." - } - } - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the customer was created in ISO 8601 format.", - "example": "2022-08-30T06:32:07.380Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the customer was updated in ISO 8601 format.", - "example": "2022-08-31T06:32:07.380Z", - "format": "date-time" - }, - "assets": { - "type": "object", - "description": "Contains information about the customer's cockpit.", - "properties": { - "cockpit_url": { - "type": "string", - "description": "Customer's cockpit URL address." - } - } - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the customer.", - "default": "customer" - } - } - }, - "9_obj_customer_object_email_parameter": { - "type": "object", - "description": "This is an object representing a customer.", - "title": "Customer Object", - "examples": [ - { - "id": "cust_4vMj8Twr5nBzvTrNCgipMb6M", - "source_id": "08dd9b5a", - "name": "Bob Smith", - "email": "bob.smith@email.com", - "address": { - "city": "New York", - "state": "NY", - "line_1": "678 Main St", - "line_2": null, - "country": "USA", - "postal_code": "10001" - }, - "summary": { - "redemptions": { - "total_redeemed": 5, - "total_failed": 0, - "total_succeeded": 5, - "total_rolled_back": 0, - "total_rollback_failed": 0, - "total_rollback_succeeded": 0, - "gift": { - "redeemed_amount": 0, - "amount_to_go": 0 - }, - "loyalty_card": { - "redeemed_points": 0, - "points_to_go": 830 - } - }, - "orders": { - "total_amount": 94600, - "total_count": 5, - "average_amount": 18920, - "last_order_amount": 27500, - "last_order_date": "2022-09-15T11:11:36.630Z" - } - }, - "loyalty": { - "points": 830, - "referred_customers": 0, - "campaigns": { - "Loyalty Campaign - Webinar": { - "points": 830, - "referred_customers": 0 - } - } - }, - "referrals": { - "total": 0, - "campaigns": [] - }, - "metadata": { - "age": 24, - "loyalty_customer": "true", - "acquisition_channel": "Facebook" - }, - "system_metadata": { - "consents": { - "cnst_lbgOBhHTuDrB7sjIhFjvIALj": { - "date": "2022-11-22T15:48:50.219Z", - "value": true - } - } - }, - "created_at": "2022-09-15T10:33:46.388Z", - "updated_at": "2022-11-22T15:48:50.220Z", - "assets": { - "cockpit_url": "https://cockpits.voucherify.io/customers?token=U2FsdGVkX186yavyLJyykWa9KfhE1J850qWbQ1B%2BjKBZ0wrIzBNaW1WR6tNZo71Y5oTWG6PYpI9BpXDSnzz7CRfQ3lu7M151btz2vlYVxbd2eHNOjTFEwTbD8wK4moLONgtTlPM8ze42nmutFk5GUBepUEhxHRfbk8zekWqWvo8%2FbnAJsPl2rxYyaggwXQDj" - }, - "object": "customer" - } - ], - "x-tags": [ - "CUSTOMERS API" - ], - "properties": { - "id": { - "type": "string", - "description": "The unique ID of a customer that is assigned by Voucherify.", - "example": "cust_CSnYd37MXmrbS19XCrghjBsv" - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a customer object." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "phone": { - "type": "string", - "description": "Customer's phone number." - }, - "birthdate": { - "type": "string", - "description": "Customer's birthdate." - }, - "birthday": { - "type": "string", - "description": "Customer's birthday." - }, - "address": { - "type": "object", - "description": "Customer's address.", - "properties": { - "city": { - "type": "string", - "description": "City" - }, - "state": { - "type": "string", - "description": "State" - }, - "line_1": { - "type": "string", - "description": "First line of address." - }, - "line_2": { - "type": "string", - "description": "Second line of address." - }, - "country": { - "type": "string", - "description": "Country." - }, - "postal_code": { - "type": "string", - "description": "Postal code." - } - } - }, - "summary": { - "type": "object", - "description": "Contains a summary of customer's redemption and order statistics.", - "properties": { - "redemptions": { - "type": "object", - "description": "Customer's redemptions statistics.", - "properties": { - "total_redeemed": { - "type": "integer", - "description": "Total number of redemptions made by the customer." - }, - "total_failed": { - "type": "integer", - "description": "Total number of redemptions that failed." - }, - "total_succeeded": { - "type": "integer", - "description": "Total number of redemptions that succeeded." - }, - "total_rolled_back": { - "type": "integer", - "description": "Total number of redemptions that were rolled back for the customer." - }, - "total_rollback_failed": { - "type": "integer", - "description": "Total number of redemption rollbacks that failed." - }, - "total_rollback_succeeded": { - "type": "integer", - "description": "Total number of redemption rollbacks that succeeded." - }, - "gift": { - "type": "object", - "description": "Summary of gift card credits.", - "properties": { - "redeemed_amount": { - "type": "integer", - "description": "Total amount of gift card credits redeemed by customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "amount_to_go": { - "type": "integer", - "description": "Remaining gift card balance across all gift cards. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - }, - "loyalty_card": { - "type": "object", - "description": "Summary of loyalty points.", - "properties": { - "redeemed_points": { - "type": "integer", - "description": "Total number of loyalty points redeemed by the customer." - }, - "points_to_go": { - "type": "integer", - "description": "Sum of remaining available point balance accross all loyalty cards." - } - } - } - } - }, - "orders": { - "type": "object", - "description": "Customer's order statistics.", - "properties": { - "total_amount": { - "type": "integer", - "description": "The total amount spent by the customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "total_count": { - "type": "integer", - "description": "Total number of orders made by the customer." - }, - "average_amount": { - "type": "integer", - "description": "Average amount spent on orders. `total_amount` ÷ `total_count`. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "last_order_amount": { - "type": "integer", - "description": "Amount spent on last order. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "last_order_date": { - "type": "string", - "example": "2022-08-30T11:51:08.029Z", - "description": "Timestamp representing the date and time of the customer's last order in ISO 8601 format." - } - } - } - } - }, - "loyalty": { - "type": "object", - "description": "Summary of customer's loyalty information.", - "properties": { - "points": { - "type": "integer" - }, - "referred_customers": { - "type": "integer", - "description": "Total number of customers referred by the customer." - }, - "campaigns": { - "type": "object", - "description": "Contains campaigns with details about point balances and how many customers were referred by the customer.", - "properties": { - "campaign_name": { - "type": "object", - "description": "Contains details about the point balances left on loyalty cards and the number of referred customers in each campaign.", - "properties": { - "points": { - "type": "integer", - "description": "Remaining point balance in campaign." - }, - "loyalty_tier": { - "type": "string", - "example": "ltr_UJ5Q54Q0OvEhua87Qfv2Ki5x", - "description": "Customer's loyalty tier within the campaign." - }, - "referred_customers": { - "type": "integer", - "description": "Number of customers referred by the customer in campaign." - } - } - } - } - } - } - }, - "referrals": { - "type": "object", - "description": "Summary of customer's referrals, in this case, the customer being the referee, i.e. information about the source of referrals and number of times the customer was referred by other customers.", - "properties": { - "total": { - "type": "integer", - "description": "Total number of times this customer received a referral, i.e. was referred by another customer." - }, - "campaigns": { - "type": "array", - "description": "Contains an array of campaigns that served as the source of a referral for the customer.", - "items": { - "type": "object", - "description": "Contains information about the source of the referral.", - "properties": { - "campaign_id": { - "type": "string", - "description": "Unique campaign ID, assigned by Voucherify.", - "example": "camp_rRsfatlwN7unSeUIJDCYedal" - }, - "referrer_id": { - "type": "string", - "example": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", - "description": "Unique referrer ID, assigned by Voucherify. This is the customer ID of a customer that is referring this customer." - }, - "related_object_id": { - "type": "string", - "description": "Related object ID, i.e. `r_0b9d4cc4aa164dd073`." - }, - "related_object_type": { - "type": "string", - "description": "Related object type, i.e. `redemption`." - }, - "date": { - "type": "string", - "example": "2022-08-30T10:19:39.196Z", - "description": "Timestamp representing the date and time when the customer was referred in ISO 8601 format." - } - } - } - } - } - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments." - }, - "system_metadata": { - "type": "object", - "description": "Object used to store system metadata information.", - "properties": { - "consents": { - "type": "object", - "description": "Stores a list of consent ID's along with the timestamp and decision on accepting or rejecting a marketing permission.", - "properties": { - "consentId": { - "type": "object", - "description": "Unique ID of a consent, i.e. `cnst_lbgOBhHTuDrB7sjIhFjvIALj`.", - "properties": { - "date": { - "type": "string", - "description": "Timestamp representing the date and time when a consent was accepted or rejected in ISO 8601 format.", - "example": "2022-05-10T08:50:10.338Z", - "format": "date-time" - }, - "value": { - "type": "boolean", - "description": "Accepted: `true`, Rejected: `false`" - } - } - } - } - }, - "source": { - "type": "string", - "description": "Takes on the name of the source of the integration if the customer was created through an integration, i.e. `Bigcommerce` or `Shopify`." - } - } - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the customer was created in ISO 8601 format.", - "example": "2022-08-30T06:32:07.380Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the customer was updated in ISO 8601 format.", - "example": "2022-08-31T06:32:07.380Z", - "format": "date-time" - }, - "assets": { - "type": "object", - "description": "Contains information about the customer's cockpit.", - "properties": { - "cockpit_url": { - "type": "string", - "description": "Customer's cockpit URL address." - } - } - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the customer.", - "default": "customer" - }, - "email_unsubscribed": { - "type": "boolean" - } - } - }, - "9_res_list_customers": { - "type": "object", - "title": "List Customers Response Body", - "description": "Response body schema for **GET** `/customers`.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about customers in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "customers", - "description": "Identifies the name of the attribute that contains the array of customer objects." - }, - "customers": { - "type": "array", - "description": "Contains array of customer objects.", - "items": { - "$ref": "#/components/schemas/9_obj_customer_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of customers." - } - } - }, - "9_res_list_customer_activities": { - "type": "object", - "title": "List Customer Activities Response Body", - "description": "Request body schema for `/customers/{customerId}/activities`.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about customer activities in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of customer activity objects." - }, - "data": { - "type": "array", - "description": "Array of customer activity objects.", - "items": { - "$ref": "#/components/schemas/9_obj_customer_activity_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of customer activities." - } - } - }, - "22_obj_webhooks": { - "type": "object", - "title": "Webhooks", - "description": "Data object model for a webhook.\n\n\nredemption.succeeded \nredemption.failed \nredemption.rollback.succeeded \nredemption.rollback.failed \npublication.succeeded \nvoucher.published \nvoucher.updated \nvoucher.deleted \nvoucher.created \nVoucher.enabled \nvoucher.disabled \nvoucher.loyalty_card.points_added \nvoucher.gift.balance_added \ncampaign.enabled \ncampaign.deleted \ncampaign.created \ncampaign.updated \ncampaign.disabled \ncampaign.vouchers.generation.completed \nbusiness_validation_rule.assignment.created \nbusiness_validation_rule.assignment.deleted \nbusiness_validation_rule.created \nbusiness_validation_rule.deleted \nbusiness_validation_rule.updated \ncustomer.created \ncustomer.deleted \ncustomer.rewarded \ncustomer.rewarded.loyalty_points \ncustomer.consents.revoked \ncustomer.consents.given ", - "x-tags": [ - "WEBHOOKS" - ], - "properties": { - "id": { - "type": "string", - "example": "event_m7MXf3zPf1n51IoUM8XHpP0w", - "description": "Unique event ID." - }, - "object": { - "type": "string", - "default": "event", - "description": "The type of object represented by JSON. This object stores information about events in a dictionary." - }, - "webhook_id": { - "type": "string", - "example": "wh_K7hpwSVDmKaxmBsDn0EpCvDy", - "description": "Unique webhook ID." - }, - "project_id": { - "type": "string", - "example": "proj_z7id5", - "description": "Unique Voucherify project ID." - }, - "created_at": { - "type": "string", - "example": "2022-11-30T16:53:30.434Z", - "format": "date-time", - "description": "Timestamp representing the date and time when the webhook was created in ISO 8601 format." - }, - "type": { - "type": "string", - "enum": [ - "redemption.succeeded", - "redemption.failed", - "redemption.rollback.succeeded", - "redemption.rollback.failed", - "publication.succeeded", - "voucher.published", - "voucher.updated", - "voucher.deleted", - "voucher.created", - "Voucher.enabled", - "voucher.disabled", - "voucher.loyalty_card.points_added", - "voucher.gift.balance_added", - "campaign.enabled", - "campaign.deleted", - "campaign.created", - "campaign.updated", - "campaign.disabled", - "campaign.vouchers.generation.completed", - "business_validation_rule.assignment.created", - "business_validation_rule.assignment.deleted", - "business_validation_rule.created", - "business_validation_rule.deleted", - "business_validation_rule.updated", - "customer.created", - "customer.deleted", - "customer.rewarded", - "customer.rewarded.loyalty_points", - "customer.consents.revoked", - "customer.consents.given" - ] - }, - "data": { - "$ref": "#/components/schemas/22_obj_webhook_object_data" - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs attached to a webhook. The metadata object stores all custom attributes assigned to the webhook. It can be useful for storing additional information about the webhook in a structured format.", - "properties": { - "source": { - "type": "string", - "description": "The origin of the webhook.", - "enum": [ - "API" - ] - } - } - } - } - }, - "22_obj_webhook_object_data": { - "title": "Webhook Object", - "description": "Webhook event data object schema.", - "anyOf": [ - { - "$ref": "#/components/schemas/22_obj_event_redemption_succeeded" - }, - { - "$ref": "#/components/schemas/22_obj_event_redemption_failed" - }, - { - "$ref": "#/components/schemas/22_obj_event_redemption_rollback_succeeded" - }, - { - "$ref": "#/components/schemas/22_obj_event_redemption_rollback_failed" - }, - { - "$ref": "#/components/schemas/22_obj_event_publication_succeeded" - }, - { - "$ref": "#/components/schemas/22_obj_event_voucher_published" - }, - { - "$ref": "#/components/schemas/22_obj_event_voucher_updated" - }, - { - "$ref": "#/components/schemas/22_obj_event_voucher_deleted" - }, - { - "$ref": "#/components/schemas/22_obj_event_voucher_created" - }, - { - "$ref": "#/components/schemas/22_obj_event_voucher_enabled" - }, - { - "$ref": "#/components/schemas/22_obj_event_voucher_disabled" - }, - { - "$ref": "#/components/schemas/22_obj_event_voucher_loyalty_card_points_added" - }, - { - "$ref": "#/components/schemas/22_obj_event_voucher_gift_balance_added" - }, - { - "$ref": "#/components/schemas/22_obj_event_campaign_enabled" - }, - { - "$ref": "#/components/schemas/22_obj_event_campaign_deleted" - }, - { - "$ref": "#/components/schemas/22_obj_event_campaign_created" - }, - { - "$ref": "#/components/schemas/22_obj_event_campaign_updated" - }, - { - "$ref": "#/components/schemas/22_obj_event_campaign_disabled" - }, - { - "$ref": "#/components/schemas/22_obj_event_campaign_vouchers_generation_completed" - }, - { - "$ref": "#/components/schemas/22_obj_event_business_validation_rule_assignment_created" - }, - { - "$ref": "#/components/schemas/22_obj_event_business_validation_rule_assignment_deleted" - }, - { - "$ref": "#/components/schemas/22_obj_event_business_validation_rule_created" - }, - { - "$ref": "#/components/schemas/22_obj_event_business_validation_rule_deleted" - }, - { - "$ref": "#/components/schemas/22_obj_event_business_validation_rule_updated" - }, - { - "$ref": "#/components/schemas/22_obj_event_customer_created" - }, - { - "$ref": "#/components/schemas/22_obj_event_customer_deleted" - }, - { - "$ref": "#/components/schemas/22_obj_event_customer_rewarded" - }, - { - "$ref": "#/components/schemas/22_obj_event_customer_rewarded_loyalty_points" - }, - { - "$ref": "#/components/schemas/22_obj_event_customer_consents_given" - }, - { - "$ref": "#/components/schemas/22_obj_event_customer_consents_revoked" - } - ] - }, - "22_obj_event_redemption_succeeded": { - "title": "Redemption Succeeded", - "description": "Event data object schema for `redemption.succeeded`.", - "type": "object" - }, - "22_obj_event_redemption_failed": { - "title": "Redemption Failed", - "description": "Event data object schema for `redemption.failed`.", - "type": "object" - }, - "22_obj_event_redemption_rollback_failed": { - "title": "Redemption Rollback Failed", - "description": "Event data object schema for `redemption.rollback.failed`.", - "type": "object" - }, - "22_obj_event_redemption_rollback_succeeded": { - "title": "Redemption Rollback Succeeded", - "description": "Event data object schema for `redemption.rollback.succeeded`.", - "type": "object" + "event": "customer.loyalty.tier.upgraded", + "loyalty_tier": { + "id": "ltr_30KHciA0UG8B71Fo51GZqwgN" }, - "22_obj_event_publication_succeeded": { - "title": "Publication Succeeded", - "description": "Event data object schema for `publication.succeeded`.", - "type": "object" - }, - "22_obj_event_voucher_published": { - "title": "Voucher Published", - "description": "Event data object schema for `voucher.published`.", - "type": "object" - }, - "22_obj_event_voucher_updated": { - "title": "Voucher Updated", - "description": "Event data object schema for `voucher.updated`.", - "type": "object" - }, - "22_obj_event_voucher_deleted": { - "title": "Voucher Deleted", - "description": "Event data object schema for `voucher.deleted`.", - "type": "object" + "source": { + "banner": "Tier upgraded", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" }, - "22_obj_event_voucher_created": { - "title": "Voucher Created", - "description": "Event data object schema for `voucher.created`.", - "type": "object" + "active": true, + "object": "earning_rule", + "automation_id": "auto_M1OdRH8spk6Fs7yTuPLN2LAv", + "metadata": { + "Type": "Upgraded" + } + }, + { + "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", + "created_at": "2022-11-25T07:31:05.866Z", + "updated_at": "2022-11-25T07:31:43.029Z", + "validation_rule_id": "val_kfmWpfXMI9P1", + "loyalty": { + "points": 1, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.downgraded", + "loyalty_tier": { + "id": "__ANY__" }, - "22_obj_event_voucher_enabled": { - "title": "Voucher Enabled", - "description": "Event data object schema for `voucher.enabled`.", - "type": "object" + "source": { + "banner": "Tier Downgraded", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" }, - "22_obj_event_voucher_disabled": { - "title": "Voucher Disabled", - "description": "Event data object schema for `voucher.disabled`.", - "type": "object" + "active": true, + "object": "earning_rule", + "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", + "metadata": { + "Type": "Tier" + } + }, + { + "id": "ern_AdlWO2yt6b6llWsibIdiRXVE", + "created_at": "2022-11-25T07:31:42.767Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 5, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.prolonged", + "loyalty_tier": { + "id": "__ANY__" }, - "22_obj_event_voucher_loyalty_card_points_added": { - "title": "Voucher Loyalty Card Points Added", - "description": "Event data object schema for `voucher.loyalty_card.points_added`.", - "type": "object", - "properties": { - "object": { - "$ref": "#/components/schemas/1_obj_voucher_object" - }, - "related_object": { - "$ref": "#/components/schemas/8_res_add_remove_points_balance" - }, - "voucher": { - "$ref": "#/components/schemas/1_obj_voucher_object" - } - } + "source": { + "banner": "Prolonged", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" }, - "22_obj_event_voucher_gift_balance_added": { - "title": "Voucher Gift Balance Added", - "description": "Event data object schema for `voucher.gift.balance_added`.", - "type": "object" + "active": true, + "object": "earning_rule", + "automation_id": "auto_4jH1yq9WJS0oJ8suagCrltyb", + "metadata": {} + } + ], + "anyOf": [ + { + "$ref": "#/components/schemas/8_obj_earning_rule_object_order_paid_no_validation_rule" + }, + { + "$ref": "#/components/schemas/8_obj_earning_rule_object_custom_event_no_validation_rule" + }, + { + "$ref": "#/components/schemas/8_obj_earning_rule_object_entered_segment_no_validation_rule" + }, + { + "$ref": "#/components/schemas/8_obj_earning_rule_object_tier_no_validation_rule" + } + ] + }, + "8_obj_earning_rule_object_order_paid": { + "description": "This is an object representing an earning rule for a paid order.", + "type": "object", + "title": "Earning Rule Object for Order Paid", + "examples": [ + { + "id": "ern_taClaOIiaGNdmdby8xS0lCcy", + "created_at": "2022-02-04T13:27:50.665Z", + "updated_at": "2022-02-07T08:19:44.198Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" + }, + "event": "order.paid", + "source": { + "banner": "Order paid 1000 points", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" }, - "22_obj_event_campaign_enabled": { - "title": "Campaign Enabled", - "description": "Event data object schema for `campaign.enabled`.", - "type": "object" + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" }, - "22_obj_event_campaign_deleted": { - "title": "Campaign Deleted", - "description": "Event data object schema for `campaign.deleted`.", - "type": "object", - "properties": { - "object": { - "$ref": "#/components/schemas/2_obj_campaign_object" - }, - "campaign": { - "$ref": "#/components/schemas/2_obj_campaign_object" - } + "validity_day_of_week": [ + 4 + ], + "object": "earning_rule", + "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" + } + ], + "properties": { + "id": { + "type": "string", + "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", + "description": "Assigned by the Voucherify API, identifies the earning rule object." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", + "example": "2022-02-02T13:18:32.557Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", + "example": "2022-02-03T13:09:27.206Z", + "format": "date-time" + }, + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_paid" } - }, - "22_obj_event_campaign_created": { - "title": "Campaign Created", - "description": "Event data object schema for `campaign.created`.", - "type": "object" - }, - "22_obj_event_campaign_updated": { - "title": "Campaign Updated", - "description": "Event data object schema for `campaign.updated`.", - "type": "object" - }, - "22_obj_event_campaign_disabled": { - "title": "Campaign Disabled", - "description": "Event data object schema for `campaign.disabled`.", - "type": "object" - }, - "22_obj_event_campaign_vouchers_generation_completed": { - "title": "Campaign Vouchers Generation Completed", - "description": "Event data object schema for `campaign.vouchers.generation.completed`.", - "type": "object" - }, - "22_obj_event_business_validation_rule_assignment_created": { - "title": "Business Validation Rule Assignment Created", - "description": "Event data object schema for `business_validation_rule.assignment.created`.", - "type": "object" - }, - "22_obj_event_business_validation_rule_assignment_deleted": { - "title": "Business Validation Rule Assignment Deleted", - "description": "Event data object schema for `business_validation_rule.assignment.deleted`.", - "type": "object" - }, - "22_obj_event_business_validation_rule_created": { - "title": "Business Validation Rule Created", - "description": "Event data object schema for `business_validation_rule.created`.", - "type": "object" - }, - "22_obj_event_business_validation_rule_deleted": { - "title": "Business Validation Rule Deleted", - "description": "Event data object schema for `business_validation_rule.deleted`.", - "type": "object" - }, - "22_obj_event_business_validation_rule_updated": { - "title": "Business Validation Rule Updated", - "description": "Event data object schema for `business_validation_rule.updated`.", - "type": "object" - }, - "22_obj_event_customer_created": { - "title": "Customer Created", - "description": "Event data object schema for `customer.created`.", - "type": "object" - }, - "22_obj_event_customer_deleted": { - "title": "Customer Deleted", - "description": "Event data object schema for `customer.deleted`.", - "type": "object" - }, - "22_obj_event_customer_rewarded": { - "title": "Customer Rewarded", - "description": "Event data object schema for `customer.rewarded`.", - "type": "object" - }, - "22_obj_event_customer_rewarded_loyalty_points": { - "title": "Customer Rewarded Loyalty Points", - "description": "Event data object schema for `customer.rewarded.loyalty_points`.", - "type": "object", - "properties": { - "object": { - "$ref": "#/components/schemas/9_obj_customer_object" - }, - "related_object": { - "$ref": "#/components/schemas/8_res_add_remove_points_balance" - }, - "customer": { - "$ref": "#/components/schemas/9_obj_customer_object" - }, - "voucher": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "code": { - "type": "string" - }, - "loyalty_card": { - "type": "object", - "properties": { - "points": { - "type": "integer" - }, - "balance": { - "type": "integer" - } - } - }, - "type": { - "type": "string", - "default": "LOYALTY_CARD" - }, - "campaign": { - "type": "string" - }, - "campaign_id": { - "type": "string" - }, - "is_referral_code": { - "type": "boolean" - }, - "holder_id": { - "type": "string", - "example": "cust_o3ffuQSwM0vlxeJJoMqiOLMI" - } - } - }, - "campaign": { - "type": "string" - }, - "earning_rule": { - "$ref": "#/components/schemas/8_obj_earning_rule_object" - } + ] + }, + "event": { + "type": "string", + "enum": [ + "order.paid" + ], + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `order.paid` an event defined by the Voucherify API corresponding to an order status `PAID`. " + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + }, + "object_id": { + "type": "string", + "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "description": "A unique campaign identifier assigned by the Voucherify API." + }, + "object_type": { + "type": "string", + "default": "campaign", + "description": "Defines the object associated with the earning rule. Defaults to `campaign`." } - }, - "22_obj_event_customer_consents_revoked": { - "title": "Customer Consents Revoked", - "description": "Event data object schema for `customer.consents.revoked`.", - "type": "object" - }, - "22_obj_event_customer_consents_given": { - "title": "Customer Consents Given", - "description": "Event data object schema for `customer.consents.given`.", - "type": "object" - }, - "9_obj_customer_activity_object": { - "type": "object", - "title": "Customer Activity Object", - "description": "This is an object representing customer activity. \n\nThis is a general object which presents moments from customers' activity. There are all types of different events that customers perform during their journey once they participate in Promotions. Events describe moments when customers redeem coupons and earn points or rewards. The list of all types of activities is listed below.\n\nThe details describing the activity are collected in a property named `data`. In this object, software integrators will find all further information explaining the event context. \n\nCustomer Activity Object is a type of [Event](ref:track-custom-event) which is our way of letting you know when something interesting happens in your project. When an interesting event concerning an individual customer occurs, we create a new Customer Activity object. For example, when a code is published to a customer, we create a `customer.publication.succeeded` event.\n\n| **Event types (definition in progress)** |\n|:---|\n| customer.confirmed |\n| customer.created |\n| customer.updated |\n| customer.deleted |\n| customer.referred |\n| customer.custom_event |\n| customer.segment.entered |\n| customer.segment.left |\n| customer.sms.sent |\n| customer.sms.failed |\n| customer.email.sent |\n| customer.email.failed |\n| customer.activecampaign.sent |\n| customer.activecampaign.failed |\n| customer.braze.sent |\n| customer.braze.failed |\n| customer.mailchimp.sent |\n| customer.mailchimp.failed |\n| customer.intercom.sent |\n| customer.intercom.failed |\n| customer.rewarded |\n| customer.rewarded.loyalty_points |\n| customer.voucher.gift.balance_added |\n| customer.voucher.loyalty_card.points_added |\n| customer.voucher.loyalty_card.points_transferred |\n| customer.publication.succeeded |\n| customer.publication.failed |\n| customer.redemption.succeeded |\n| customer.redemption.failed |\n| customer.redemption.rollback.succeeded |\n| customer.redemption.rollback.failed |\n| customer.consents.given |\n| customer.consents.revoked |", - "x-tags": [ - "CUSTOMERS API" - ], - "properties": { - "id": { - "type": "string", - "description": "Unique event ID, assigned by Voucherify.", - "example": "evcus_0c150c51730c6b60b1" - }, - "type": { - "type": "string", - "description": "Event type.", - "enum": [ - "customer.confirmed", - "customer.created", - "customer.updated", - "customer.deleted", - "customer.referred", - "customer.custom_event", - "customer.segment_entered", - "customer.segment.left", - "customer.sms.sent", - "customer.sms.failed", - "customer.email.sent", - "customer.email.failed", - "customer.activecampaign.sent", - "customer.braze.sent", - "customer.mailchimp.sent", - "customer.intercom.sent", - "customer.intercom.failed", - "customer.rewarded", - "customer.rewarded.loyalty_points", - "customer.voucher.gift.balance_added", - "customer.voucher.loyalty_card.points_added", - "customer.voucher.loyalty_card.points_transferred", - "customer.publication.succeeded", - "customer.publication.failed", - "customer.redemption.succeeded", - "customer.redemption.failed", - "customer.redemption.rollback.succeeded", - "customer.redemption.rollback.failed", - "customer.consents.given", - "customer.consents.revoked" - ] - }, - "data": { - "type": "array", - "description": "Contains details about the event. The objects that are returned in the data attribute differ based on the context of the event type.", - "items": { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data" - } - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the customer activity occurred in ISO 8601 format.", - "example": "2022-08-30T09:14:07.660Z", - "format": "date-time" - } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "object": { + "type": "string", + "default": "earning_rule", + "description": "The type of object represented by JSON. Default is `earning_rule`." + }, + "automation_id": { + "type": "string", + "description": "For internal use by Voucherify.", + "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + } + } + }, + "8_req_earning_rule_object_order_paid": { + "description": "This is an object representing an earning rule for a paid order.", + "type": "object", + "title": "Earning Rule Object for Order Paid", + "examples": [ + { + "id": "ern_taClaOIiaGNdmdby8xS0lCcy", + "created_at": "2022-02-04T13:27:50.665Z", + "updated_at": "2022-02-07T08:19:44.198Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" + }, + "event": "order.paid", + "source": { + "banner": "Order paid 1000 points", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" }, - "9_obj_customer_activity_object_data": { - "title": "Customer Activity Data Object", - "description": "Event data object schema.", - "anyOf": [ - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_confirmed" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_created" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_updated" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_deleted" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_referred" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_custom_event" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_segment_entered" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_segment_left" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_sms_sent" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_sms_failed" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_email_sent" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_email_failed" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_activecampaign_sent" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_activecampaign_failed" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_braze_sent" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_braze_failed" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_mailchimp_sent" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_mailchimp_failed" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_intercom_sent" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_intercom_failed" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_rewarded" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_rewarded_loyalty_points" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_voucher_gift_voucher_balance_added" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_voucher_loyalty_card_points_added" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_voucher_loyalty_card_points_transferred" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_publication_succeeded" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_publication_failed" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_redemption_succeeded" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_redemption_failed" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_redemption_rollback_succeeded" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_redemption_rollback_failed" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_consents_given" - }, - { - "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_consents_revoked" - } - ] + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" }, - "9_obj_customer_activity_object_data_customer_email_unsubscribed": { - "title": "Email Unsubscribed", - "description": "Email unsubscribed", - "type": "object", - "properties": { - "email_unsubscribed": { - "type": "boolean" - } + "validity_day_of_week": [ + 4 + ], + "object": "earning_rule", + "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" + } + ], + "properties": { + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_paid" } - }, - "9_obj_customer_activity_object_data_customer_confirmed": { - "title": "Customer Confirmed", - "description": "Event data object schema for `customer.confirmed`.", - "type": "object", - "properties": { - "customer": { - "$ref": "#/components/schemas/9_obj_customer_object_email_parameter" - }, - "unconfirmed_customer": { - "type": "string", - "example": "ucust_1qa70mVfYkl11Ab0ZxDPdWNa" - } + ] + }, + "event": { + "type": "string", + "enum": [ + "order.paid" + ], + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `order.paid` an event defined by the Voucherify API corresponding to an order status `PAID`. " + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." } - }, - "9_obj_customer_activity_object_data_customer_created": { - "title": "Customer Created", - "description": "Event data object schema for `customer.created`.", - "type": "object", - "properties": { - "customer": { - "$ref": "#/components/schemas/9_obj_customer_object_email_parameter" - } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + } + } + }, + "8_req_update_earning_rule_object_order_paid": { + "description": "This is an object representing an earning rule for a paid order.", + "type": "object", + "title": "Earning Rule Object for Order Paid", + "examples": [ + { + "id": "ern_taClaOIiaGNdmdby8xS0lCcy", + "created_at": "2022-02-04T13:27:50.665Z", + "updated_at": "2022-02-07T08:19:44.198Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" + }, + "event": "order.paid", + "source": { + "banner": "Order paid 1000 points", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" }, - "9_obj_customer_activity_object_data_customer_updated": { - "title": "Customer Updated", - "description": "Event data object schema for `customer.updated`.", - "type": "object", - "properties": { - "customer": { - "$ref": "#/components/schemas/9_obj_customer_object_email_parameter" - } - } + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" }, - "9_obj_customer_activity_object_data_customer_deleted": { - "title": "Customer Deleted", - "description": "Event data object schema for `customer.deleted`.", - "type": "object", - "properties": { - "customer": { - "$ref": "#/components/schemas/9_obj_customer_object_email_parameter" - } + "validity_day_of_week": [ + 4 + ], + "object": "earning_rule", + "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" + } + ], + "properties": { + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_paid" } - }, - "9_obj_customer_activity_object_data_customer_referred": { - "title": "Customer Referred", - "description": "Event data object schema for `customer.referred`.", - "type": "object", - "properties": { - "voucher": { - "type": "object" - }, - "campaign": { - "type": "object" - }, - "customer": { - "type": "object" - }, - "referrer": { - "type": "object" - }, - "redemption": { - "type": "object" - }, - "custom_event": { - "type": "object" - } + ] + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." } - }, - "9_obj_customer_activity_object_data_customer_custom_event": { - "title": "Custom Event", - "description": "Event data object schema for `customer.custom_event`.", - "type": "object", - "properties": { - "event": { - "type": "object" - }, - "loyalty": { - "type": "object" - }, - "customer": { - "type": "object" - }, - "referral": { - "type": "object" - }, - "event_schema": { - "type": "object" - } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + } + } + }, + "8_obj_earning_rule_object_order_paid_no_validation_rule": { + "description": "This is an object representing an earning rule for a paid order.", + "type": "object", + "title": "Earning Rule Object for Order Paid", + "examples": [ + { + "id": "ern_taClaOIiaGNdmdby8xS0lCcy", + "created_at": "2022-02-04T13:27:50.665Z", + "updated_at": "2022-02-07T08:19:44.198Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" + }, + "event": "order.paid", + "source": { + "banner": "Order paid 1000 points", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" }, - "9_obj_customer_activity_object_data_customer_segment_entered": { - "title": "Segment Entered", - "description": "Event data object schema for `customer.segment.entered`.", - "type": "object", - "properties": { - "segment": { - "type": "object" - }, - "customer": { - "type": "object" - } - } + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" }, - "9_obj_customer_activity_object_data_customer_segment_left": { - "title": "Segment Left", - "description": "Event data object schema for `customer.segment.left`.", - "type": "object", - "properties": { - "segment": { - "type": "object" - }, - "customer": { - "type": "object" - } + "validity_day_of_week": [ + 4 + ], + "object": "earning_rule", + "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" + } + ], + "properties": { + "id": { + "type": "string", + "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", + "description": "Assigned by the Voucherify API, identifies the earning rule object." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", + "example": "2022-02-02T13:18:32.557Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", + "example": "2022-02-03T13:09:27.206Z", + "format": "date-time" + }, + "validation_rule_id": { + "type": "null", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_paid" } + ] + }, + "event": { + "type": "string", + "enum": [ + "order.paid" + ], + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `order.paid` an event defined by the Voucherify API corresponding to an order status `PAID`. " + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + }, + "object_id": { + "type": "string", + "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "description": "A unique campaign identifier assigned by the Voucherify API." + }, + "object_type": { + "type": "string", + "default": "campaign", + "description": "Defines the object associated with the earning rule. Defaults to `campaign`." + } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "object": { + "type": "string", + "default": "earning_rule", + "description": "The type of object represented by JSON. Default is `earning_rule`." + }, + "automation_id": { + "type": "string", + "description": "For internal use by Voucherify.", + "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + } + } + }, + "8_obj_earning_rule_object_entered_segment": { + "description": "This is an object representing an earning rule for entering a customer segment.", + "type": "object", + "title": "Earning Rule Object for Entered Segment", + "examples": [ + { + "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", + "created_at": "2022-02-04T13:02:52.937Z", + "updated_at": "2022-02-07T08:19:43.291Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" + }, + "segment": { + "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" + }, + "event": "customer.segment.entered", + "source": { + "banner": "Entered segment 100 points.", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" }, - "9_obj_customer_activity_object_data_customer_sms_sent": { - "title": "SMS Sent", - "description": "Event data object schema for `customer.sms.sent`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_sms_failed": { - "title": "SMS Failed", - "description": "Event data object schema for `customer.sms.failed`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_email_sent": { - "title": "Email Sent", - "description": "Event data object schema for `customer.email.sent`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_email_failed": { - "title": "Email Failed", - "description": "Event data object schema for `customer.email.failed`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_activecampaign_sent": { - "title": "ActiveCampaign Sent", - "description": "Event data object schema for `customer.activecampaign.sent`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_activecampaign_failed": { - "title": "ActiveCampaign Failed", - "description": "Event data object schema for `customer.activecampaign.failed`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_braze_sent": { - "title": "Braze Sent", - "description": "Event data object schema for `customer.braze.sent`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_braze_failed": { - "title": "Braze Failed", - "description": "Event data object schema for `customer.braze.failed`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_mailchimp_sent": { - "title": "Mailchimp Sent", - "description": "Event data object schema for `customer.mailchimp.sent`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_mailchimp_failed": { - "title": "Mailchimp Failed", - "description": "Event data object schema for `customer.mailchimp.failed`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_intercom_sent": { - "title": "Intercom Sent", - "description": "Event data object schema for `customer.intercom.sent`.", - "type": "object" - }, - "9_obj_customer_activity_object_data_customer_intercom_failed": { - "title": "Intercom Failed", - "description": "Event data object schema for `customer.intercom.failed`.", - "type": "object" + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" }, - "9_obj_customer_activity_object_data_customer_rewarded": { - "title": "Customer Rewarded", - "description": "Event data object schema for `customer.rewarded`.", - "type": "object", - "properties": { - "holder": { - "type": "object" - }, - "reward": { - "type": "object" - }, - "balance": { - "type": "object" - }, - "voucher": { - "type": "object" - }, - "campaign": { - "type": "object" - }, - "customer": { - "type": "object" - }, - "redemption": { - "type": "object" - }, - "custom_event": { - "type": "object" - }, - "referral_tier": { - "type": "object" - }, - "customer_event": { - "type": "object" - } + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" + } + ], + "properties": { + "id": { + "type": "string", + "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", + "description": "Assigned by the Voucherify API, identifies the earning rule object." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", + "example": "2022-02-02T13:18:32.557Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", + "example": "2022-02-03T13:09:27.206Z", + "format": "date-time" + }, + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" } - }, - "9_obj_customer_activity_object_data_customer_rewarded_loyalty_points": { - "title": "Customer Rewarded Loyalty Points", - "description": "Event data object schema for `customer.rewarded.loyalty_points`.", - "type": "object", - "properties": { - "order": { - "type": "object" - }, - "holder": { - "type": "object" - }, - "balance": { - "type": "object" - }, - "voucher": { - "type": "object" - }, - "campaign": { - "type": "object" - }, - "customer": { - "type": "object" - }, - "earning_rule": { - "type": "object" - }, - "loyalty_tier": { - "type": "object" - } + ] + }, + "segment": { + "type": "object", + "description": "Contains the id of a customer segment. **Required** for the `customer.segment.entered` option in `event`.", + "properties": { + "id": { + "type": "string", + "description": "Contains a unique identifier of a customer segment. Assigned by the Voucherify API." } - }, - "9_obj_customer_activity_object_data_customer_voucher_gift_voucher_balance_added": { - "title": "Gift Voucher Balance Added", - "description": "Event data object schema for `customer.voucher.gift.balance_added`.", - "type": "object", - "properties": { - "balance": { - "type": "object" - }, - "voucher": { - "type": "object" - }, - "campaign": { - "type": "object" - }, - "customer": { - "type": "object" - } + } + }, + "event": { + "type": "string", + "enum": [ + "customer.segment.entered" + ], + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.segment.entered` an event defined by the Voucherify API corresponding to a customer entering a pre-defined customer segment." + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + }, + "object_id": { + "type": "string", + "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "description": "A unique campaign identifier assigned by the Voucherify API." + }, + "object_type": { + "type": "string", + "default": "campaign", + "description": "Defines the object associated with the earning rule. Defaults to `campaign`." } - }, - "9_obj_customer_activity_object_data_customer_voucher_loyalty_card_points_added": { - "title": "Loyalty Card Points Added", - "description": "Event data object schema for `customer.voucher.loyalty_card.points_added`.", - "type": "object", - "properties": { - "balance": { - "type": "object" - }, - "voucher": { - "type": "object" - }, - "campaign": { - "type": "object" - }, - "customer": { - "type": "object" - } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "object": { + "type": "string", + "default": "earning_rule", + "description": "The type of object represented by JSON. Default is `earning_rule`." + }, + "automation_id": { + "type": "string", + "description": "For internal use by Voucherify.", + "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + } + } + }, + "8_req_earning_rule_object_entered_segment": { + "description": "This is an object representing an earning rule for entering a customer segment.", + "type": "object", + "title": "Earning Rule Object for Entered Segment", + "examples": [ + { + "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", + "created_at": "2022-02-04T13:02:52.937Z", + "updated_at": "2022-02-07T08:19:43.291Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" + }, + "segment": { + "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" + }, + "event": "customer.segment.entered", + "source": { + "banner": "Entered segment 100 points.", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" }, - "9_obj_customer_activity_object_data_customer_voucher_loyalty_card_points_transferred": { - "title": "Loyalty Card Points Transferred", - "description": "Event data object schema for `customer.voucher.loyalty_card.points_transferred`.", - "type": "object" + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" }, - "9_obj_customer_activity_object_data_customer_publication_succeeded": { - "title": "Publication Succeeded", - "description": "Event data object schema for `customer.publication.succeeded`.", - "type": "object", - "properties": { - "campaign": { - "type": "object" - }, - "customer": { - "type": "object" - }, - "publication": { - "type": "object" - } + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" + } + ], + "properties": { + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" } - }, - "9_obj_customer_activity_object_data_customer_publication_failed": { - "title": "Publication Failed", - "description": "Event data object schema for `customer.publication.failed`.", - "type": "object", - "properties": { - "campaign": { - "type": "object" - }, - "customer": { - "type": "object" - }, - "publication": { - "type": "object" - } + ] + }, + "segment": { + "type": "object", + "description": "Contains the id of a customer segment. **Required** for the `customer.segment.entered` option in `event`.", + "properties": { + "id": { + "type": "string", + "description": "Contains a unique identifier of a customer segment. Assigned by the Voucherify API." } - }, - "9_obj_customer_activity_object_data_customer_redemption_succeeded": { - "title": "Redemption Succeeded", - "description": "Event data object schema for `customer.redemption.succeeded`.", - "type": "object", - "properties": { - "order": { - "type": "object" - }, - "holder": { - "type": "object" - }, - "voucher": { - "type": "object" - }, - "campaign": { - "type": "object" - }, - "customer": { - "type": "object" - }, - "redemption": { - "type": "object" - }, - "promotion_tier": { - "type": "object" - } + } + }, + "event": { + "type": "string", + "enum": [ + "customer.segment.entered" + ], + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.segment.entered` an event defined by the Voucherify API corresponding to a customer entering a pre-defined customer segment." + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." } - }, - "9_obj_customer_activity_object_data_customer_redemption_failed": { - "title": "Redemption Succeeded", - "description": "Event data object schema for `customer.redemption.failed`.", - "type": "object", - "properties": { - "order": { - "type": "object" - }, - "holder": { - "type": "object" - }, - "voucher": { - "type": "object" - }, - "campaign": { - "type": "object" - }, - "customer": { - "type": "object" - }, - "redemption": { - "type": "object" - }, - "promotion_tier": { - "type": "object" - } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + } + } + }, + "8_req_update_earning_rule_object_entered_segment": { + "description": "This is an object representing an earning rule for entering a customer segment.", + "type": "object", + "title": "Earning Rule Object for Entered Segment", + "examples": [ + { + "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", + "created_at": "2022-02-04T13:02:52.937Z", + "updated_at": "2022-02-07T08:19:43.291Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" + }, + "segment": { + "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" + }, + "event": "customer.segment.entered", + "source": { + "banner": "Entered segment 100 points.", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" }, - "9_obj_customer_activity_object_data_customer_redemption_rollback_succeeded": { - "title": "Redemption Rollback Succeeded", - "description": "Event data object schema for `customer.redemption.rollback.succeeded`.", - "type": "object", - "properties": { - "order": { - "type": "object" - }, - "holder": { - "type": "object" - }, - "voucher": { - "type": "object" - }, - "campaign": { - "type": "object" - }, - "customer": { - "type": "object" - }, - "redemption": { - "type": "object" - }, - "promotion_tier": { - "type": "object" - }, - "redemption_rollback": { - "type": "object" - } - } + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" }, - "9_obj_customer_activity_object_data_customer_redemption_rollback_failed": { - "title": "Redemption Rollback Failed", - "description": "Event data object schema for `customer.redemption.rollback.failed`.", - "type": "object", - "properties": { - "order": { - "type": "object" - }, - "holder": { - "type": "object" - }, - "campaign": { - "type": "object" - }, - "customer": { - "type": "object" - }, - "redemption": { - "type": "object" - }, - "promotion_tier": { - "type": "object" - }, - "redemption_rollback": { - "type": "object" - } + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" + } + ], + "properties": { + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" } - }, - "9_obj_customer_activity_object_data_customer_consents_given": { - "title": "Consents Given", - "description": "Event data object schema for `customer.consents.given`.", - "type": "object", - "properties": { - "consents": { - "type": "object" - }, - "customer": { - "type": "object" - } + ] + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." } - }, - "9_obj_customer_activity_object_data_customer_consents_revoked": { - "title": "Consents Given", - "description": "Event data object schema for `customer.consents.revoked`.", - "type": "object", - "properties": { - "consents": { - "type": "object" - }, - "customer": { - "type": "object" - } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + } + } + }, + "8_obj_earning_rule_object_entered_segment_no_validation_rule": { + "description": "This is an object representing an earning rule for entering a customer segment.", + "type": "object", + "title": "Earning Rule Object for Entered Segment", + "examples": [ + { + "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", + "created_at": "2022-02-04T13:02:52.937Z", + "updated_at": "2022-02-07T08:19:43.291Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" + }, + "segment": { + "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" + }, + "event": "customer.segment.entered", + "source": { + "banner": "Entered segment 100 points.", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" }, - "customers_permanent_deletion_response_body": { - "type": "object", - "title": "Customer Permanent Deletion Response Body", - "description": "Response body schema for `/customers/{customerId}/permanent-deletion`.", - "properties": { - "id": { - "type": "string", - "description": "Unique permanent deletion object ID.", - "example": "del_mgzqZNwUnwnt1Ddw6phEG90Q" - }, - "created_at": { - "type": "string", - "example": "2022-09-02T17:55:47.865Z", - "description": "Timestamp representing the date and time when the customer was requested to be deleted in ISO 8601 format.", - "format": "date-time" - }, - "related_object_id": { - "type": "string", - "example": "cust_m557pDDl4IGXexkU6KOQ2Dwi", - "description": "Unique customer ID that is being deleted." - }, - "related_object": { - "type": "string", - "description": "Object being deleted.", - "default": "customer" - }, - "status": { - "type": "string", - "description": "Deletion status.", - "default": "DONE" - }, - "data_json": { - "type": "object", - "description": "Statistics summarizing the number of related information that was deleted.", - "required": [ - "events", - "customer_events", - "daily_events", - "segments", - "orders", - "order_events", - "customer" - ], - "properties": { - "events": { - "type": "integer", - "description": "Number of events deleted." - }, - "customer_events": { - "type": "integer", - "description": "Number of customer events deleted." - }, - "daily_events": { - "type": "integer", - "description": "Number of daily events deleted." - }, - "segments": { - "type": "integer", - "description": "Number of segments deleted." - }, - "orders": { - "type": "integer", - "description": "Number of orders deleted." - }, - "order_events": { - "type": "integer", - "description": "Number of order events deleted." - }, - "customer": { - "type": "integer", - "description": "Number of customers deleted.", - "default": 1 - } - } - }, - "object": { - "type": "string", - "description": "The type of object represented by JSON.", - "default": "pernament_deletion" - } - }, - "required": [ - "id", - "created_at", - "related_object_id", - "related_object", - "status", - "data_json", - "object" - ] + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" }, - "customers_update_metadata_in_bulk_request_body": { - "type": "object", - "title": "Update Customers' Metadata in bulk Request Body", - "description": "Request body schema for `/customers/metadata/async`.", - "properties": { - "source_ids": { - "type": "array", - "description": "An array of customer `source_id`'s.", - "items": { - "type": "string" - } - }, - "metadata": { - "type": "object", - "description": "Metadata key value pairs to be updated. A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments." - } + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" + } + ], + "properties": { + "id": { + "type": "string", + "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", + "description": "Assigned by the Voucherify API, identifies the earning rule object." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", + "example": "2022-02-02T13:18:32.557Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", + "example": "2022-02-03T13:09:27.206Z", + "format": "date-time" + }, + "validation_rule_id": { + "type": "null", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" }, - "required": [ - "source_ids", - "metadata" - ] - }, - "customers_update_in_bulk_request_body": { - "type": "array", - "title": "Update Customers in bulk Request Body", - "description": "Request body schema for `/customers/bulk/async`.", - "items": { - "$ref": "#/components/schemas/customers_update_in_bulk_item_request_body" + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" } - }, - "customers_update_in_bulk_item_request_body": { - "title": "Update Customers in bulk Request Body", - "description": "Request body schema for `/customers/bulk/async`.", - "properties": { - "source_id": { - "type": "string", - "description": "Unique customer source ID." - }, - "name": { - "type": [ - "string", - "null" - ], - "description": "Customer's first and last name." - }, - "description": { - "type": [ - "string", - "null" - ], - "description": "An arbitrary string that you can attach to a customer object." - }, - "email": { - "type": [ - "string", - "null" - ], - "description": "Customer's email address." - }, - "phone": { - "type": [ - "string", - "null" - ], - "description": "Customer's phone number." - }, - "address": { - "type": "object", - "description": "Customer's address.", - "properties": { - "city": { - "type": [ - "string", - "null" - ], - "description": "City" - }, - "state": { - "type": [ - "string", - "null" - ], - "description": "State" - }, - "line_1": { - "type": [ - "string", - "null" - ], - "description": "First line of address." - }, - "line_2": { - "type": [ - "string", - "null" - ], - "description": "Second line of address." - }, - "country": { - "type": [ - "string", - "null" - ], - "description": "Country." - }, - "postal_code": { - "type": [ - "string", - "null" - ], - "description": "Postal code." - } - } - }, - "birthdate": { - "type": [ - "string", - "null" - ], - "description": "Customer's birthdate; format `YYYY-MM-DD`." - }, - "metadata": { - "type": [ - "object", - "null" - ], - "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. " - } - }, - "required": [ - "source_id" - ] - }, - "9_req_update_customers_consents": { - "type": "object", - "title": "Update Customer Consents Request Body", - "description": "Request body schema for **PUT** `/customers/{customerId}/consents`.", - "properties": { - "consent_id": { - "type": "boolean", - "description": "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." - }, - "unsubscribed": { - "type": "boolean", - "description": "To deny all consents, use `unsubscribed` as a consent identifier and `true` as a value." - } + ] + }, + "segment": { + "type": "object", + "description": "Contains the id of a customer segment. **Required** for the `customer.segment.entered` option in `event`.", + "properties": { + "id": { + "type": "string", + "description": "Contains a unique identifier of a customer segment. Assigned by the Voucherify API." } - }, - "10_obj_order_object": { - "type": "object", - "title": "Order object", - "description": "This is an object representing an order. \n\nThe purchase transactions can be tracked in Voucherify by the creation of an order object. You can create, retrieve, and pay individual orders, as well as list and export all of them in a CSV format. Orders are identified by a unique ID.\n\nOrders are automatically created during the [redeem voucher](ref:redeem-voucher) and [redeem promotion](redeem-promotion) call.\n\n\n> #### order.id and order session\n>\n> If you use the same order.id in more than one redemption request, all valid discounts provided in the redemption payload will be applied to the given order.\n> \n> Each time you use particular order in your requests, the API will automatically trigger a new session linked to the order.id. The session is active during the request and ends asynchronously after the request is completed. The session mechanism ensures that the particular order.id can be used in one API request at once.", - "x-tags": [ - "ORDERS API" - ], - "properties": { - "id": { - "type": "string", - "description": "Unique order ID, assigned by Voucherify.", - "example": "ord_GFDbbv2I0wnO0sFUBOOOXPj2" - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the order was created in ISO 8601 format.", - "example": "2022-03-09T11:19:04.819Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "example": "2022-08-12T13:34:10.681Z", - "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format.", - "format": "date-time" - }, - "status": { - "type": "string", - "description": "Order status.", - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULFILLED" - ] - }, - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "discount_amount": { - "type": "integer", - "description": "Sum of all order-level discounts applied to the order." - }, - "items_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" - }, - "total_discount_amount": { - "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`\t" - }, - "total_amount": { - "type": "integer", - "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", - "items": { - "type": "object", - "properties": { - "object": { - "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." - }, - "product_id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "sku_id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." - }, - "discount_amount": { - "type": "integer", - "description": "The item-level discount applied to the item." - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" - }, - "product": { - "type": "object", - "description": "This object stores more information about the related product.", - "properties": { - "id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" - }, - "name": { - "type": "string", - "example": "Brewing System", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - }, - "sku": { - "type": "object", - "description": "This object stores more information about the related SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." - }, - "sku": { - "type": "string", - "description": "SKU name." - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - } - } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are attached to an order object. Stores additional information about the order in a structured format." - }, - "customer": { - "type": "object", - "description": "Object containing information about the customer that is making the purchase.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique customer ID of the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `customer` object." - } - } - }, - "referrer": { - "type": "object", - "description": "Object containing information about the referrer.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique referrer ID, who referred the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the referrer object." - } - } - }, - "customer_id": { - "type": "string", - "description": "Unique customer ID of the customer making the purchase.", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" - }, - "referrer_id": { - "type": "string", - "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "description": "Unique referrer ID." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - }, - "redemptions": { - "oneOf": [ - { - "$ref": "#/components/schemas/10_obj_order_object_unstacked_redemptions" - }, - { - "$ref": "#/components/schemas/10_obj_order_object_stacked_redemptions" - } - ] - } + } + }, + "event": { + "type": "string", + "enum": [ + "customer.segment.entered" + ], + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.segment.entered` an event defined by the Voucherify API corresponding to a customer entering a pre-defined customer segment." + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + }, + "object_id": { + "type": "string", + "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "description": "A unique campaign identifier assigned by the Voucherify API." + }, + "object_type": { + "type": "string", + "default": "campaign", + "description": "Defines the object associated with the earning rule. Defaults to `campaign`." } - }, - "10_obj_order_object_no_discount_calculations": { - "type": "object", - "title": "Order object", - "description": "This is an object representing an order.", - "properties": { - "id": { - "type": "string", - "description": "Unique order ID, assigned by Voucherify.", - "example": "ord_GFDbbv2I0wnO0sFUBOOOXPj2" - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the order was created in ISO 8601 format.", - "example": "2022-03-09T11:19:04.819Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "example": "2022-08-12T13:34:10.681Z", - "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format.", - "format": "date-time" - }, - "status": { - "type": "string", - "description": "Order status.", - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULFILLED" - ] - }, - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "total_amount": { - "type": "integer", - "description": "Order amount after applying all the discounts." - }, - "items": { - "type": "array", - "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", - "items": { - "type": "object", - "properties": { - "object": { - "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." - }, - "product_id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "sku_id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique identifier that represents the product or SKU from your inventory system." - }, - "related_object": { - "type": "string", - "description": "Reference to the object containing details of the related product. This can either be a `product` or `sku`.", - "enum": [ - "product", - "sku" - ] - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`." - }, - "product": { - "type": "object", - "description": "This object stores more information about the related product.", - "properties": { - "id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" - }, - "name": { - "type": "string", - "example": "Brewing System", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - }, - "sku": { - "type": "object", - "description": "This object stores more information about the related SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." - }, - "sku": { - "type": "string", - "description": "SKU name." - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - } - } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are attached to an order object. Stores additional information about the order in a structured format." - }, - "customer": { - "type": "object", - "description": "Object containing information about the customer that is making the purchase.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique customer ID of the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the `customer` object." - } - } - }, - "referrer": { - "type": "object", - "description": "Object containing information about the referrer.", - "properties": { - "id": { - "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique referrer ID, who referred the customer making the purchase." - }, - "object": { - "type": "string", - "default": "customer", - "description": "Type of object represented by the referrer object." - } - } - }, - "customer_id": { - "type": "string", - "description": "Unique customer ID of the customer making the purchase.", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" - }, - "referrer_id": { - "type": "string", - "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "description": "Unique referrer ID." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "object": { + "type": "string", + "default": "earning_rule", + "description": "The type of object represented by JSON. Default is `earning_rule`." + }, + "automation_id": { + "type": "string", + "description": "For internal use by Voucherify.", + "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + } + } + }, + "8_obj_earning_rule_object_custom_event": { + "description": "This is an object representing an earning rule triggered by a custom event.", + "type": "object", + "title": "Earning Rule Object for Custom Event", + "examples": [ + { + "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", + "created_at": "2022-02-07T08:19:41.810Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 2, + "type": "FIXED" + }, + "custom_event": { + "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" + }, + "event": "saw_on_facebook", + "source": { + "banner": "Saw on Facebook Timeframe", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" }, - "10_obj_order_object_unstacked_redemptions": { - "type": "object", - "title": "Unstacked Redemption", - "description": "Redemption object representing a single redemption.", - "properties": { - "redemption_ID": { - "type": "object", - "description": "The property name is the unique redemption ID; i.e. `r_0ba186c4824e4881e1`. This object contains information about the redemption of an incentive.", - "properties": { - "date": { - "type": "string", - "description": "Timestamp representing the date and time when the redemption was created in ISO 8601 format.", - "example": "2022-09-02T17:06:56.649Z", - "format": "date-time" - }, - "related_object_type": { - "type": "string", - "description": "The source of the incentive.", - "enum": [ - "voucher", - "promotion_tier" - ] - }, - "related_object_id": { - "type": "string", - "description": "Unique ID of the related object that defines the incentive." - }, - "related_object_parent_id": { - "type": "string", - "description": "Represent's the campaign ID of the voucher if the redemption was based on a voucher that was part of bulk codes generated within a campaign. In case of a promotion tier, this represents the campaign ID of the promotion tier's parent campaign." - } - } - } - } + "active": true, + "start_date": "2022-02-07T08:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" }, - "10_obj_order_object_stacked_redemptions": { - "type": "object", - "title": "Stacked Redemption", - "description": "Redemption object representing a stacked redemption.", - "properties": { - "redemption_ID": { - "type": "object", - "description": "The property name is the unique parent redemption ID; i.e. `r_0ba186c4824e4881e1`. This object contains information about the redemption of multiple incentives.", - "properties": { - "date": { - "type": "string", - "description": "Timestamp representing the date and time when the redemption was created in ISO 8601 format.", - "example": "2022-09-02T17:06:56.649Z", - "format": "date-time" - }, - "related_object_type": { - "type": "string", - "description": "The source of the incentive.", - "default": "redemption" - }, - "related_object_id": { - "type": "string", - "description": "Unique ID of the parent redemption.", - "example": "r_0ba186c4824e4881e1" - }, - "stacked": { - "type": "array", - "description": "Contains a list of unique IDs of child redemptions, which belong to the stacked incentives.", - "items": { - "type": "string" - } - } - } - } + "object": "earning_rule", + "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" + } + ], + "properties": { + "id": { + "type": "string", + "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", + "description": "Assigned by the Voucherify API, identifies the earning rule object." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", + "example": "2022-02-02T13:18:32.557Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", + "example": "2022-02-03T13:09:27.206Z", + "format": "date-time" + }, + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_custom_event_metadata" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" } - }, - "10_res_list_orders": { - "type": "object", - "title": "List Orders Response Body", - "description": "Response body schema representing **GET** `/orders`.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about orders in a dictionary." - }, - "data_ref": { - "type": "string", - "default": "orders", - "description": "Identifies the name of the attribute that contains the array of order objects." - }, - "orders": { - "type": "array", - "description": "Contains array of order objects.", - "items": { - "$ref": "#/components/schemas/10_obj_order_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of orders." - } + ] + }, + "custom_event": { + "type": "object", + "description": "Contains the schema id of a custom event. **Required** for the custom event option in `event`.", + "properties": { + "schema_id": { + "type": "string", + "description": "Contains a unique identifier of a custom event schema. Assigned by the Voucherify API.", + "example": "ms_gn4Qe4xsFPf7orCArCiNVY13" } - }, - "10_req_create_order": { - "type": "object", - "title": "Order", - "description": "Request body schema for creating an order.", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of an integration between multiple systems. It can be an order ID from a CRM system, database or 3rd-party service." - }, - "status": { - "type": "string", - "description": "The order status.", - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULLFILLED" - ] - }, - "amount": { - "type": "integer", - "description": "A positive integer in the smallest currency unit (that is, 100 cents for $1.00) representing the total amount of the order; this is the sum of the order items' amounts." - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format." - }, - "customer": { - "$ref": "#/components/schemas/10_req_orders_customer_object" - }, - "referrer": { - "$ref": "#/components/schemas/10_req_orders_referrer_object" - }, - "items": { - "$ref": "#/components/schemas/10_req_orders_items_array" - } + } + }, + "event": { + "type": "string", + "enum": [ + "custom_event_defined_in_EVENT_SCHEMA" + ], + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `custom_event_name` the name of a custom event defined in the Dashboard → **Project Settings** → **EVENT SCHEMA** → **Add event definition**. Read more on defining [custom events](https://support.voucherify.io/article/111-custom-events). " + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + }, + "object_id": { + "type": "string", + "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "description": "A unique campaign identifier assigned by the Voucherify API." + }, + "object_type": { + "type": "string", + "default": "campaign", + "description": "Defines the object associated with the earning rule. Defaults to `campaign`." } - }, - "10_req_update_order": { - "type": "object", - "title": "Update Order Request Body", - "description": "Request body schema for **PUT** `/orders/{orderId}`.", - "properties": { - "status": { - "type": "string", - "description": "The order status.", - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULLFILLED" - ] - }, - "amount": { - "type": "integer", - "description": "A positive integer in the smallest currency unit (that is, 100 cents for $1.00) representing the total amount of the order; this is the sum of the order items' amounts." - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format." - }, - "customer": { - "$ref": "#/components/schemas/10_req_orders_customer_object" - }, - "referrer": { - "$ref": "#/components/schemas/10_req_orders_referrer_object" - }, - "items": { - "$ref": "#/components/schemas/10_req_orders_items_array" - }, - "customer_id": { - "type": "string", - "example": "cust_T849EgzNVVmn5icJ2FAkT2rO", - "description": "Unique customer ID of the customer making the purchase." - }, - "referrer_id": { - "type": "string", - "example": "cust_T849EgzNVVmn5icJ2FAkT2rO", - "description": "Unique referrer ID." - } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "object": { + "type": "string", + "default": "earning_rule", + "description": "The type of object represented by JSON. Default is `earning_rule`." + }, + "automation_id": { + "type": "string", + "description": "For internal use by Voucherify.", + "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + } + } + }, + "8_req_earning_rule_object_custom_event": { + "description": "This is an object representing an earning rule triggered by a custom event.", + "type": "object", + "title": "Earning Rule Object for Custom Event", + "examples": [ + { + "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", + "created_at": "2022-02-07T08:19:41.810Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 2, + "type": "FIXED" + }, + "custom_event": { + "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" + }, + "event": "saw_on_facebook", + "source": { + "banner": "Saw on Facebook Timeframe", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" }, - "10_req_create_order_export": { - "type": "object", - "title": "Create Order Export Request Body", - "description": "Request body schema for **POST** `/orders/export`.", - "properties": { - "parameters": { - "$ref": "#/components/schemas/16_obj_export_order", - "description": "Contains the parameters that define the data to be exported." - } - } + "active": true, + "start_date": "2022-02-07T08:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" }, - "10_req_orders_import": { - "type": "array", - "title": "Import Orders Request Body", - "description": "Request body schema for POST `/orders/import`.", - "items": { - "type": "object", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of an integration between multiple systems. It can be an order ID from a CRM system, database or 3rd-party service." - }, - "status": { - "type": "string", - "description": "The order status. One of `CREATED`, `PAID`, `CANCELED`, `FULFILLED`." - }, - "amount": { - "type": "integer", - "description": "A positive integer in the smallest currency unit (that is, 100 cents for $1.00) representing the total amount of the order; this is the sum of the order items' amounts." - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format." - }, - "customer": { - "$ref": "#/components/schemas/10_req_orders_customer_object" - }, - "referrer": { - "$ref": "#/components/schemas/10_req_orders_referrer_object" - }, - "items": { - "$ref": "#/components/schemas/10_req_orders_items_array" - } - } + "object": "earning_rule", + "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" + } + ], + "properties": { + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_custom_event_metadata" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" } - }, - "10_req_orders_customer_object": { - "type": "object", - "title": "Customer", - "description": "This is an object containing information about the customer.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of an existing customer that will be linked to the order; this is an ID that has been assigned to the customer by Voucherify, i.e. `cust_LMY4ZylSdUYB1J4tzqNcl5VV`." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "name": { - "type": "string", - "description": "Customer's first and last name." - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a customer object." - }, - "email": { - "type": "string", - "description": "Customer's email address." - }, - "phone": { - "type": "string", - "description": "Customer's phone number." - }, - "address": { - "type": "object", - "description": "Customer's address.", - "properties": { - "city": { - "type": "string", - "description": "City" - }, - "state": { - "type": "string", - "description": "State" - }, - "line_1": { - "type": "string", - "description": "First line of address" - }, - "line_2": { - "type": "string", - "description": "Second line of address" - }, - "country": { - "type": "string", - "description": "Country" - }, - "postal_code": { - "type": "string", - "description": "Postal code" - } - } - }, - "birthdate": { - "type": "string", - "description": "Customer's birthdate; format `YYYY-MM-DD`.", - "format": "date" - }, - "birthday": { - "type": "string", - "description": "Customer's birthdate; format `YYYY-MM-DD`.", - "format": "date" - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to a customer." - } + ] + }, + "custom_event": { + "type": "object", + "description": "Contains the schema id of a custom event. **Required** for the custom event option in `event`.", + "properties": { + "schema_id": { + "type": "string", + "description": "Contains a unique identifier of a custom event schema. Assigned by the Voucherify API.", + "example": "ms_gn4Qe4xsFPf7orCArCiNVY13" } - }, - "10_req_orders_referrer_object": { - "type": "object", - "title": "Referrer", - "description": "This is an ojbect containing information about the referrer.", - "properties": { - "id": { - "type": "string", - "description": "The unique ID of an existing customer that will be linked to the order as the referrer; this is an ID that has been assigned to the customer by Voucherify, i.e. `cust_LMY4ZylSdUYB1J4tzqNcl5VV`." - }, - "source_id": { - "type": "string", - "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." - }, - "name": { - "type": "string", - "description": "Referrer's first and last name." - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a referrer object." - }, - "email": { - "type": "string", - "description": "Referrer's email address." - }, - "phone": { - "type": "string", - "description": "Referrer's phone number." - }, - "address": { - "type": "object", - "description": "Referrer's address.", - "properties": { - "city": { - "type": "string", - "description": "City" - }, - "state": { - "type": "string", - "description": "State" - }, - "line_1": { - "type": "string", - "description": "First line of address" - }, - "line_2": { - "type": "string", - "description": "Second line of address" - }, - "country": { - "type": "string", - "description": "Country" - }, - "postal_code": { - "type": "string", - "description": "Postal code" - } - } - }, - "birthdate": { - "type": "string", - "description": "Referrer's birthdate; format `YYYY-MM-DD`.", - "format": "date" - }, - "birthday": { - "type": "string", - "description": "Referrer's birthdate; format `YYYY-MM-DD`.", - "format": "date" - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to a referrer." - } + } + }, + "event": { + "type": "string", + "enum": [ + "custom_event_defined_in_EVENT_SCHEMA" + ], + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `custom_event_name` the name of a custom event defined in the Dashboard → **Project Settings** → **EVENT SCHEMA** → **Add event definition**. Read more on defining [custom events](https://support.voucherify.io/article/111-custom-events). " + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." } - }, - "10_req_orders_items_array": { - "type": "array", - "title": "Items Array", - "description": "Array of items applied to the order.", - "items": { - "$ref": "#/components/schemas/10_req_orders_order_item" + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + } + } + }, + "8_req_update_earning_rule_object_custom_event": { + "description": "This is an object representing an earning rule triggered by a custom event.", + "type": "object", + "title": "Earning Rule Object for Custom Event", + "examples": [ + { + "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", + "created_at": "2022-02-07T08:19:41.810Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 2, + "type": "FIXED" + }, + "custom_event": { + "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" + }, + "event": "saw_on_facebook", + "source": { + "banner": "Saw on Facebook Timeframe", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" }, - "10_req_orders_order_item": { - "type": "object", - "title": "Order Item", - "description": "This object represents an order line item.", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s product/SKU ID (if it is different from the Voucherify product/SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service." - }, - "related_object": { - "type": "string", - "description": "Used along with the `source_id` property, can be set to either `sku` or `product`." - }, - "product_id": { - "type": "string", - "description": "A unique product ID assigned by Voucherify.", - "example": "prod_0a7e62db1fca8322a2" - }, - "sku_id": { - "type": "string", - "description": "A unique SKU ID assigned by Voucherify.", - "example": "sku_0a41e31c7b41c28358" - }, - "quantity": { - "type": "integer", - "description": "The quantity of the particular item in the cart." - }, - "price": { - "type": "integer", - "description": "The unit price of the item." - }, - "amount": { - "type": "integer", - "description": "The total amount of the order item (`price` * `quantity`)." - }, - "product": { - "$ref": "#/components/schemas/10_req_orders_order_item_product" - }, - "sku": { - "$ref": "#/components/schemas/10_req_orders_order_item_sku" - } - } + "active": true, + "start_date": "2022-02-07T08:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" }, - "10_req_orders_order_item_product": { - "type": "object", - "title": "Product", - "description": "An object containing details of the related product.", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s product ID (if it is different than Voucherify's product ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service." - }, - "name": { - "type": "string", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Product price. A positive integer in the smallest currency unit (that is, 100 cents for $1.00)." - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to a product. It can be useful for storing additional information about the product in a structured format." - }, - "override": { - "type": "boolean", - "description": "The override set to true is used to store the product information in the system. If product does not exist, it will be created with the use of `source_id`; if it does exist, the provided values for the `name`, `price`, and `metadata` will replace those already stored in the system." - } + "object": "earning_rule", + "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" + } + ], + "properties": { + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_custom_event_metadata" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" } - }, - "10_req_orders_order_item_sku": { - "type": "object", - "title": "SKU", - "description": "An object containing details of the related SKU.", - "properties": { - "source_id": { - "type": "string", - "description": "The merchant’s SKU ID (if it is different than Voucherify's SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service." - }, - "sku": { - "type": "string", - "description": "The SKU name." - }, - "price": { - "type": "integer", - "description": "SKU price. A positive integer in the smallest currency unit (that is, 100 cents for $1.00)." - }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to an SKU. It can be useful for storing additional information about the SKU in a structured format." - }, - "override": { - "type": "boolean", - "description": "The override is used to store the SKU in the system. If the SKU does not exist, it will be created with the use of `source_id`. Additionally, if the SKU does not exist, you are required to set the parent `product_id` that it belongs to. Set the parent `product_id` one level above, i.e. at the item level. If the parent product does not exist in Voucherify, i.e. does not have a unique `product_id`, then define the product object one level above, i.e. at the item level and make sure to also include the override as `true` for the product." - } + ] + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." } - }, - "10_obj_order_item_object": { - "title": "Order Item Object", - "type": "object", - "properties": { - "object": { - "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." - }, - "product_id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "sku_id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." - }, - "discount_amount": { - "type": "integer", - "description": "The item-level discount applied to the item." - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" - }, - "product": { - "type": "object", - "description": "This object stores more information about the related product.", - "properties": { - "id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" - }, - "name": { - "type": "string", - "example": "Brewing System", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - }, - "sku": { - "type": "object", - "description": "This object stores more information about the related SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." - }, - "sku": { - "type": "string", - "description": "SKU name." - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" }, - "description": "This is an object representing an order item. \n\nOrder Items are always specified within the [order object](ref:get-order). They can be related either to [products](list-products) or [SKUs](ref:list-skus-in-product). \n\nProduct/SKU details sent within an order item will be used on top of Product/SKU already stored in the system during the [Redeem Voucher](ref:redeem-voucher), [Validate Voucher](ref:validate-voucher), [Validate Promotions](ref:validate-promotions) and [Redeem Promotion](ref:redeem-promotion) requests.", - "x-tags": [ - "ORDERS API" - ] - }, - "11_obj_product_object": { - "type": "object", - "description": "This is an object representing a product. \n\nThis entity should be used to map product items from your inventory management system. The aim of products is to build validation rules which reflect product-specific campaigns.", - "title": "Product Object", - "x-tags": [ - "PRODUCTS API" - ], - "properties": { - "id": { - "type": "string", - "description": "Unique product ID assigned by Voucherify.", - "example": "prod_0b1da8105693710357" - }, - "source_id": { - "type": "string", - "example": "productSourceID16", - "description": "Unique product source ID from your inventory system." - }, - "name": { - "type": "string", - "description": "Unique user-defined product name.", - "example": "T-shirt" - }, - "price": { - "type": "integer", - "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "attributes": { - "type": "array", - "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", - "items": { - "type": "string" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." - }, - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", - "example": "https://images.com/original.jpg" - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the product was created in ISO 8601 format.", - "example": "2022-05-23T06:52:55.008Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the product was updated in ISO 8601 format.", - "example": "2022-05-23T09:24:07.405Z", - "format": "date-time" - }, - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about the `product`.", - "default": "product" - }, - "skus": { - "$ref": "#/components/schemas/11_res_get_product_skus_object" - } + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + } + } + }, + "8_obj_earning_rule_object_custom_event_no_validation_rule": { + "description": "This is an object representing an earning rule triggered by a custom event.", + "type": "object", + "title": "Earning Rule Object for Custom Event", + "examples": [ + { + "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", + "created_at": "2022-02-07T08:19:41.810Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 2, + "type": "FIXED" + }, + "custom_event": { + "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" + }, + "event": "saw_on_facebook", + "source": { + "banner": "Saw on Facebook Timeframe", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" }, - "11_req_create_product": { - "type": "object", - "description": "Request schema for **POST** `/products`.", - "title": "Create Product Request Body", - "properties": { - "source_id": { - "type": "string", - "example": "productSourceID16", - "description": "Unique product source ID." - }, - "name": { - "type": "string", - "description": "Unique user-defined product name.", - "example": "T-shirt" - }, - "price": { - "type": "integer", - "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "attributes": { - "type": "array", - "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", - "items": { - "type": "string" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." - }, - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", - "example": "https://images.com/original.jpg" - } - } + "active": true, + "start_date": "2022-02-07T08:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" }, - "11_req_update_products_metadata_in_bulk": { - "type": "object", - "description": "Request schema for **POST** `/products/metadata/async`.", - "title": "Update Products' Metadata in Bulk Request Body", - "properties": { - "source_ids": { - "type": "array", - "description": "Array of unique product source IDs.", - "items": { - "type": "string" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." - } + "object": "earning_rule", + "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" + } + ], + "properties": { + "id": { + "type": "string", + "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", + "description": "Assigned by the Voucherify API, identifies the earning rule object." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", + "example": "2022-02-02T13:18:32.557Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", + "example": "2022-02-03T13:09:27.206Z", + "format": "date-time" + }, + "validation_rule_id": { + "type": "null", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" }, - "required": [ - "source_ids", - "metadata" - ] - }, - "11_req_update_product": { - "type": "object", - "description": "Request schema for **PUT** `/products/{productId}`.", - "title": "Update Product Request Body", - "properties": { - "name": { - "type": "string", - "description": "Unique user-defined product name.", - "example": "T-shirt" - }, - "price": { - "type": "integer", - "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "attributes": { - "type": "array", - "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", - "items": { - "type": "string" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." - }, - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", - "example": "https://images.com/original.jpg" - } - } - }, - "11_req_update_product_bulk": { - "type": "object", - "description": "Request schema for **POST** `/products/bulk/async`.", - "title": "Update Product Request Body", - "properties": { - "source_id": { - "type": "string", - "description": "Unique product source ID from your inventory system.", - "example": "test_prod_id_1" - }, - "name": { - "type": "string", - "description": "Unique user-defined product name.", - "example": "T-shirt" - }, - "price": { - "type": "integer", - "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "attributes": { - "type": "array", - "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", - "items": { - "type": "string" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." - }, - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", - "example": "https://images.com/original.jpg" - } - } - }, - "11_res_list_products": { - "type": "object", - "description": "Response body schema representing **GET** `/products`.", - "title": "Product Object", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about products in a dictionary.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of product objects.", - "default": "products" - }, - "products": { - "type": "array", - "description": "Contains array of product objects.", - "items": { - "$ref": "#/components/schemas/11_obj_list_products_product_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of product objects." - } + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_custom_event_metadata" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" } - }, - "11_obj_list_products_product_object": { - "type": "object", - "description": "This is an object representing a product. \n\nThis entity should be used to map product items from your inventory management system. The aim of products is to build which reflect product-specific campaigns.", - "title": "Product Object", - "properties": { - "id": { - "type": "string", - "description": "Unique product ID assigned by Voucherify.", - "example": "prod_0b1da8105693710357" - }, - "source_id": { - "type": "string", - "example": "productSourceID16", - "description": "Unique product source ID." - }, - "name": { - "type": "string", - "description": "Unique user-defined product name.", - "example": "T-shirt" - }, - "price": { - "type": "integer", - "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "attributes": { - "type": "array", - "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", - "items": { - "type": "string" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." - }, - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", - "example": "https://images.com/original.jpg" - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the product was created in ISO 8601 format.", - "example": "2022-05-23T06:52:55.008Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the product was updated in ISO 8601 format.", - "example": "2022-05-23T09:24:07.405Z", - "format": "date-time" - }, - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about the product.", - "default": "product" - }, - "skus": { - "type": "object", - "description": "Contains a list of related child SKUs.", - "properties": { - "data": { - "type": "array", - "description": "Contains a list of SKU objects.", - "items": { - "$ref": "#/components/schemas/11_obj_sku_object" - } - }, - "total": { - "type": "number", - "description": "Total number of SKUs." - } - } - } + ] + }, + "custom_event": { + "type": "object", + "description": "Contains the schema id of a custom event. **Required** for the custom event option in `event`.", + "properties": { + "schema_id": { + "type": "string", + "description": "Contains a unique identifier of a custom event schema. Assigned by the Voucherify API.", + "example": "ms_gn4Qe4xsFPf7orCArCiNVY13" } - }, - "11_res_get_product_skus_object": { - "type": "object", - "description": "Contains information about child SKUs.", - "title": "SKUs object", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about SKUs.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the JSON property that contains the array of SKUs.", - "default": "data" - }, - "data": { - "type": "array", - "description": "A dictionary that contains an array of SKUs.", - "items": { - "$ref": "#/components/schemas/11_obj_sku_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of SKUs in the product." - } + } + }, + "event": { + "type": "string", + "enum": [ + "custom_event_defined_in_EVENT_SCHEMA" + ], + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `custom_event_name` the name of a custom event defined in the Dashboard → **Project Settings** → **EVENT SCHEMA** → **Add event definition**. Read more on defining [custom events](https://support.voucherify.io/article/111-custom-events). " + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + }, + "object_id": { + "type": "string", + "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "description": "A unique campaign identifier assigned by the Voucherify API." + }, + "object_type": { + "type": "string", + "default": "campaign", + "description": "Defines the object associated with the earning rule. Defaults to `campaign`." } - }, - "product_collections_product_in_collection": { - "type": "object", - "description": "This is an object representing a product in product collection.", - "title": "Product in Collection", - "properties": { - "id": { - "type": "string", - "description": "Unique product ID.", - "example": "prod_f1r5Tpr0DuC7" - }, - "source_id": { - "type": [ - "string", - "null" - ], - "example": "productSourceID16", - "description": "Unique product source ID." - }, - "name": { - "type": [ - "string", - "null" - ], - "description": "Unique user-defined product name.", - "example": "T-shirt" - }, - "price": { - "type": [ - "integer", - "null" - ], - "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "attributes": { - "type": "array", - "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", - "items": { - "type": "string" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." - }, - "image_url": { - "type": [ - "string", - "null" - ], - "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", - "example": "https://images.com/original.jpg" - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the product was created in ISO 8601 format.", - "example": "2022-05-23T06:52:55.008Z", - "format": "date-time" - }, - "updated_at": { - "type": [ - "string", - "null" - ], - "description": "Timestamp representing the date and time when the product was updated in ISO 8601 format.", - "example": "2022-05-23T09:24:07.405Z" - }, - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about the `product`.", - "default": "product" - } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" }, - "required": [ - "id", - "source_id", - "name", - "price", - "attributes", - "metadata", - "image_url", - "created_at", - "updated_at", - "object" - ] - }, - "11_obj_product_object_truncated": { - "type": "object", - "description": "This is an object representing a product.", - "title": "Product Object", - "properties": { - "id": { - "type": "string", - "description": "Unique product ID.", - "example": "prod_f1r5Tpr0DuC7" - }, - "source_id": { - "type": "string", - "example": "productSourceID16", - "description": "Unique product source ID." - }, - "name": { - "type": "string", - "description": "Unique user-defined product name.", - "example": "T-shirt" - }, - "price": { - "type": "integer", - "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "attributes": { - "type": "array", - "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", - "items": { - "type": "string" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." - }, - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", - "example": "https://images.com/original.jpg" - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the product was created in ISO 8601 format.", - "example": "2022-05-23T06:52:55.008Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the product was updated in ISO 8601 format.", - "example": "2022-05-23T09:24:07.405Z", - "format": "date-time" - }, - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about the `product`.", - "default": "product" - } + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" } - }, - "11_obj_sku_object": { - "title": "SKU Object", - "type": "object", - "description": "This is an object representing a product SKU. \n\nThe SKU (acronym from Stock Keeping Unit) is tightly related to the [product object](ref:get-product). It reflects its different variants. One product can have many SKUs which are characterized and differentiated by varying values of the parent product `attributes`.", - "x-tags": [ - "PRODUCTS API" - ], - "examples": [ - { - "id": "sku_0b1621b2f25248b79c", - "source_id": "sku_source_id_1", - "product_id": "prod_0b15f6b9f650c16990", - "sku": "Extra Small Blue Shirt", - "price": 1300, - "currency": "USD", - "attributes": { - "size": "XS", - "color": "blue", - "ranking": 1 - }, - "image_url": "", - "metadata": {}, - "created_at": "2022-05-17T10:36:30.057Z", - "updated_at": "2022-07-01T05:34:16.822Z", - "object": "sku" - } - ], - "properties": { - "id": { - "type": "string", - "example": "sku_0b1621b319d248b79f", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "sku_source_id_4", - "description": "A unique SKU identifier from your inventory system." - }, - "product_id": { - "type": "string", - "example": "prod_0b15f6b9f650c16990", - "description": "The parent product's unique ID." - }, - "sku": { - "type": "string", - "example": "Large Pink Shirt", - "description": "Unique user-defined SKU name." - }, - "price": { - "type": "integer", - "description": "SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "currency": { - "type": "string", - "description": "SKU price currency.", - "example": "USD" - }, - "attributes": { - "type": "object", - "description": "The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family." - }, - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format." - }, - "created_at": { - "type": "string", - "example": "2022-05-17T10:36:30.187Z", - "description": "Timestamp representing the date and time when the SKU was created in ISO 8601 format.", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "example": "2022-05-17T10:55:09.137Z", - "description": "Timestamp representing the date and time when the SKU was updated in ISO 8601 format.", - "format": "date-time" - }, - "object": { - "type": "string", - "default": "sku", - "description": "The type of object represented by JSON. This object stores information about the `SKU`." - } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "object": { + "type": "string", + "default": "earning_rule", + "description": "The type of object represented by JSON. Default is `earning_rule`." + }, + "automation_id": { + "type": "string", + "description": "For internal use by Voucherify.", + "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + } + } + }, + "8_obj_earning_rule_object_tier": { + "description": "This is an object representing an earning rule for tiers.", + "type": "object", + "title": "Earning Rule Object for Tiers", + "properties": { + "id": { + "type": "string", + "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", + "description": "Assigned by the Voucherify API, identifies the earning rule object." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", + "example": "2022-02-02T13:18:32.557Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", + "example": "2022-02-03T13:09:27.206Z", + "format": "date-time" + }, + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" } - }, - "11_req_create_sku": { - "title": "SKU Object", - "type": "object", - "description": "Request body schema for **POST** `/products/{productId}/skus", - "properties": { - "source_id": { - "type": "string", - "example": "sku_source_id_4", - "description": "A unique SKU identifier from your inventory system." - }, - "sku": { - "type": "string", - "example": "Large Pink Shirt", - "description": "Unique user-defined SKU name." - }, - "price": { - "type": "integer", - "description": "SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "currency": { - "type": "string", - "description": "SKU price currency.", - "example": "USD" - }, - "attributes": { - "type": "object", - "description": "The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family." - }, - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format." - } + ] + }, + "event": { + "type": "string", + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.loyalty.tier.joined` an event defined by the Voucherify API corresponding to a customer joining a tier \n- `customer.loyalty.tier.left` an event defined by the Voucherify API corresponding to a customer leaving a tier \n- `customer.loyalty.tier.upgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.downgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.prolonged` an event defined by the Voucherify API corresponding to a customer's tier being prolonged", + "enum": [ + "customer.loyalty.tier.joined", + "customer.loyalty.tier.left", + "customer.loyalty.tier.upgraded", + "customer.loyalty.tier.downgraded", + "customer.loyalty.tier.prolonged" + ] + }, + "loyalty_tier": { + "type": "object", + "description": "Defines the tier associated with the earning rule definition.", + "properties": { + "id": { + "type": "string", + "description": "Unique loyalty tier ID associated with the earning rule. \n\n- `__ANY__`: any loyalty tier within the campaign", + "example": "ltr_pudTGWasuIqxdiDM0go31OV1" } - }, - "product_collections_sku_in_collection": { - "title": "SKU in Collection", - "type": "object", - "description": "This is an object representing a SKU in product collection.", - "properties": { - "id": { - "type": "string", - "example": "sku_0b1621b319d248b79f", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": [ - "string", - "null" - ], - "example": "sku_source_id_4", - "description": "A unique SKU identifier from your inventory system." - }, - "product_id": { - "type": "string", - "example": "prod_0b15f6b9f650c16990", - "description": "The parent product's unique ID." - }, - "sku": { - "type": [ - "string", - "null" - ], - "example": "Large Pink Shirt", - "description": "Unique user-defined SKU name." - }, - "price": { - "type": [ - "integer", - "null" - ], - "description": "SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "attributes": { - "type": "object", - "description": "The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family." - }, - "image_url": { - "type": [ - "string", - "null" - ], - "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format." - }, - "created_at": { - "type": "string", - "example": "2022-05-17T10:36:30.187Z", - "description": "Timestamp representing the date and time when the SKU was created in ISO 8601 format.", - "format": "date-time" - }, - "updated_at": { - "type": [ - "string", - "null" - ], - "example": "2022-05-17T10:55:09.137Z", - "description": "Timestamp representing the date and time when the SKU was updated in ISO 8601 format.", - "format": "date-time" - }, - "object": { - "type": "string", - "default": "sku", - "description": "The type of object represented by JSON. This object stores information about the `SKU`." - }, - "product": { - "type": "object", - "description": "Stores information about the parent product.", - "required": [ - "id", - "source_id", - "name", - "price", - "attributes", - "metadata", - "object" - ], - "properties": { - "id": { - "type": "string", - "example": "prod_f15Tpr0DuC7", - "description": "Unique product ID." - }, - "source_id": { - "type": [ - "string", - "null" - ], - "example": "productSourceID11", - "description": "A unique product ID from your inventory system." - }, - "name": { - "type": [ - "string", - "null" - ], - "example": "Shirts", - "description": "Unique user-defined product name." - }, - "price": { - "type": [ - "integer", - "null" - ], - "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "attributes": { - "type": "array", - "description": "A list of product attributes whose values you can customize for given SKUs: `[\"'color\", \"size\", \"ranking\"]` . Each child SKL can have a unique value for a given attribute.", - "items": { - "type": "string" - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." - }, - "object": { - "type": "string", - "default": "product", - "description": "The type of object represented by the object. This object stores information about the parent `product`." - } - } - } + } + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." }, - "required": [ - "id", - "source_id", - "product_id", - "sku", - "price", - "attributes", - "image_url", - "metadata", - "created_at", - "updated_at", - "object", - "product" - ] - }, - "11_req_update_sku": { - "title": "Update SKU Request Body", - "type": "object", - "description": "Request body schema for **PUT** `/products/{productId}/skus/{skuId}`.", - "properties": { - "sku": { - "type": "string", - "example": "Large Pink Shirt", - "description": "Unique user-defined SKU name." - }, - "price": { - "type": "integer", - "description": "SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "currency": { - "type": "string", - "description": "SKU price currency." - }, - "attributes": { - "type": "object", - "description": "The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family." - }, - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format." - } + "object_id": { + "type": "string", + "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "description": "A unique campaign identifier assigned by the Voucherify API." + }, + "object_type": { + "type": "string", + "default": "campaign", + "description": "Defines the object associated with the earning rule. Defaults to `campaign`." } - }, - "product_collections_list_products_response_body": { - "type": "object", - "description": "Response body schema for **GET** `/product-collections/{productCollectionID}/products`.", - "title": "List Products in Collection Response Body", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about products and SKUs.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the JSON property that contains the array of products and SKUs.", - "default": "data" - }, - "data": { - "type": "array", - "description": "A dictionary that contains an array of products and SKUs.", - "items": { - "oneOf": [ - { - "$ref": "#/components/schemas/product_collections_product_in_collection" - }, - { - "$ref": "#/components/schemas/product_collections_sku_in_collection" - } - ] + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "object": { + "type": "string", + "default": "earning_rule", + "description": "The type of object represented by JSON. Default is `earning_rule`." + }, + "automation_id": { + "type": "string", + "description": "For internal use by Voucherify.", + "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + } + } + }, + "8_req_earning_rule_object_tier": { + "description": "This is an object representing an earning rule for tiers.", + "type": "object", + "title": "Earning Rule Object for Tiers", + "properties": { + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" + } + ] + }, + "event": { + "type": "string", + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.loyalty.tier.joined` an event defined by the Voucherify API corresponding to a customer joining a tier \n- `customer.loyalty.tier.left` an event defined by the Voucherify API corresponding to a customer leaving a tier \n- `customer.loyalty.tier.upgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.downgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.prolonged` an event defined by the Voucherify API corresponding to a customer's tier being prolonged", + "enum": [ + "customer.loyalty.tier.joined", + "customer.loyalty.tier.left", + "customer.loyalty.tier.upgraded", + "customer.loyalty.tier.downgraded", + "customer.loyalty.tier.prolonged" + ] + }, + "loyalty_tier": { + "type": "object", + "description": "Defines the tier associated with the earning rule definition.", + "properties": { + "id": { + "type": "string", + "description": "Unique loyalty tier ID associated with the earning rule. \n\n- `__ANY__`: any loyalty tier within the campaign", + "example": "ltr_pudTGWasuIqxdiDM0go31OV1" + } + } + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + } + } + }, + "8_req_update_earning_rule_object_tier": { + "description": "This is an object representing an earning rule for tiers.", + "type": "object", + "title": "Earning Rule Object for Tiers", + "properties": { + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" + } + ] + }, + "event": { + "type": "string", + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.loyalty.tier.joined` an event defined by the Voucherify API corresponding to a customer joining a tier \n- `customer.loyalty.tier.left` an event defined by the Voucherify API corresponding to a customer leaving a tier \n- `customer.loyalty.tier.upgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.downgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.prolonged` an event defined by the Voucherify API corresponding to a customer's tier being prolonged", + "enum": [ + "customer.loyalty.tier.joined", + "customer.loyalty.tier.left", + "customer.loyalty.tier.upgraded", + "customer.loyalty.tier.downgraded", + "customer.loyalty.tier.prolonged" + ] + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + } + } + }, + "8_obj_earning_rule_object_tier_no_validation_rule": { + "description": "This is an object representing an earning rule for tiers.", + "type": "object", + "title": "Earning Rule Object for Tiers", + "properties": { + "id": { + "type": "string", + "example": "ern_P6MWOFGsv63sbTaTZBp0IHGK", + "description": "Assigned by the Voucherify API, identifies the earning rule object." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format.", + "example": "2022-02-02T13:18:32.557Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format.", + "example": "2022-02-03T13:09:27.206Z", + "format": "date-time" + }, + "validation_rule_id": { + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance.", + "type": "null" + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "$ref": "#/components/schemas/8_obj_fixed_points" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" + } + ] + }, + "event": { + "type": "string", + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `customer.loyalty.tier.joined` an event defined by the Voucherify API corresponding to a customer joining a tier \n- `customer.loyalty.tier.left` an event defined by the Voucherify API corresponding to a customer leaving a tier \n- `customer.loyalty.tier.upgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.downgraded` an event defined by the Voucherify API corresponding to a customer's tier being upgraded \n- `customer.loyalty.tier.prolonged` an event defined by the Voucherify API corresponding to a customer's tier being prolonged", + "enum": [ + "customer.loyalty.tier.joined", + "customer.loyalty.tier.left", + "customer.loyalty.tier.upgraded", + "customer.loyalty.tier.downgraded", + "customer.loyalty.tier.prolonged" + ] + }, + "loyalty_tier": { + "type": "object", + "description": "Defines the tier associated with the earning rule definition.", + "properties": { + "id": { + "type": "string", + "description": "Unique loyalty tier ID associated with the earning rule. \n\n- `__ANY__`: any loyalty tier within the campaign", + "example": "ltr_pudTGWasuIqxdiDM0go31OV1" + } + } + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + }, + "object_id": { + "type": "string", + "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "description": "A unique campaign identifier assigned by the Voucherify API." + }, + "object_type": { + "type": "string", + "default": "campaign", + "description": "Defines the object associated with the earning rule. Defaults to `campaign`." + } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default. " + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "object": { + "type": "string", + "default": "earning_rule", + "description": "The type of object represented by JSON. Default is `earning_rule`." + }, + "automation_id": { + "type": "string", + "description": "For internal use by Voucherify.", + "example": "auto_4jH1yq9WJS0oJ8suagCrltyb" + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + } + } + }, + "8_obj_fixed_points": { + "title": "Define Fixed Amount of Points", + "type": "object", + "description": "This is an object representing points calculated based on a fixed value.", + "properties": { + "points": { + "type": "integer", + "description": "The number of points to be added to the loyalty card.", + "example": 100 + }, + "type": { + "type": "string", + "description": "Defines how the points will be added to the loyalty card. `FIXED` adds a fixed number of `points`.", + "enum": [ + "FIXED" + ] + } + } + }, + "8_obj_calculate_points_proportionally_order_paid": { + "title": "Calculate Points Proportionally", + "description": "This is an object representing points calculated proportionally to another property.", + "anyOf": [ + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_amounts" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_total_amount" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_order_metadata" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_item_amount" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_items_subtotal_amount" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_items_quantity" + }, + { + "$ref": "#/components/schemas/8_obj_calculate_points_proportionally_customer_metadata" + } + ] + }, + "8_obj_calculate_points_proportionally_order_amounts": { + "title": "Calculate Points Proportionally to Order Amount", + "type": "object", + "description": "This is an object representing points calculated proportionally to another property.", + "properties": { + "type": { + "type": "string", + "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", + "enum": [ + "PROPORTIONAL" + ] + }, + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_AMOUNT" + ], + "description": "`ORDER_AMOUNT`: Pre-discount order amount (X points for every Y spent excluding discounts)" + }, + "order": { + "type": "object", + "properties": { + "amount": { + "type": "object", + "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every set of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` `calculation_type`, give `points`.", + "properties": { + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." } - }, - "total": { - "type": "integer", - "description": "Total number of products & SKUs in the product collection." } - }, - "required": [ - "object", - "data_ref", - "data", - "total" - ] - }, - "11_res_products_productId_skus": { - "type": "object", - "description": "Response body schema for **GET** `/products/{productID}/skus`.", - "title": "List SKUs in Product Response Body", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about SKUs.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the JSON property that contains the array of SKUs.", - "default": "skus" - }, - "skus": { - "type": "array", - "description": "A dictionary that contains an array of SKUs.", - "items": { - "$ref": "#/components/schemas/11_obj_sku_object" + } + } + } + } + }, + "8_obj_calculate_points_proportionally_order_total_amount": { + "title": "Calculate Points Proportionally to Total Order Amount", + "type": "object", + "description": "This is an object representing points calculated proportionally to another property.", + "properties": { + "type": { + "type": "string", + "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", + "enum": [ + "PROPORTIONAL" + ] + }, + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_TOTAL_AMOUNT" + ], + "description": "`ORDER_TOTAL_AMOUNT`: Total order amount (X points for every Y spent including discount)" + }, + "order": { + "type": "object", + "properties": { + "total_amount": { + "type": "object", + "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every set of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` `calculation_type`, give `points`.", + "properties": { + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." } - }, - "total": { - "type": "integer", - "description": "Total number of SKUs in the product." } } - }, - "product_collections_static_collection": { - "type": "object", - "title": "Static Product Collection", - "description": "Schema model for a `STATIC` product collection.", - "properties": { - "type": { - "description": "Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products).", - "enum": [ - "STATIC" - ] - }, - "products": { - "description": "Defines a set of products for a `STATIC` product collection type.", - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string", - "example": "prod_0a41bcf807c5fcaaf6", - "description": "The product ID." - }, - "product_id": { - "type": "string", - "description": "Product ID for SKUs." - }, - "object": { - "enum": [ - "sku", - "product" - ], - "description": "Denotes the type of object represented by the ID." - } - }, - "required": [ - "id", - "object" - ] + } + } + } + }, + "8_obj_calculate_points_proportionally_order_metadata": { + "title": "Calculate Points Proportionally To an Order Metadata Property", + "type": "object", + "description": "This is an object representing points calculated proportionally to an order metadata property.", + "properties": { + "type": { + "type": "string", + "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", + "enum": [ + "PROPORTIONAL" + ] + }, + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_METADATA" + ], + "description": "`ORDER_METADATA`: Order Metadata (X points for every Y in metadata attribute, defined in the `property` key under the `order.metadata` object)" + }, + "order": { + "type": "object", + "description": "Defines the formula for calculating points proportionally.", + "properties": { + "metadata": { + "type": "object", + "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every given increment of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` order metadata property value, give `points`.", + "properties": { + "every": { + "type": "integer", + "description": "For how many increments of the order metadata property to grant points for.", + "example": 100 + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card.", + "example": 10 + }, + "property": { + "type": "string", + "example": "number_of_store_visits", + "description": "Order metadata property." } } - }, - "required": [ - "type", - "products" - ] - }, - "product_collections_dynamic_collection": { - "type": "object", - "title": "Dynamic Product Collection", - "description": "Schema model for an `AUTO_UPDATE` product collection.", - "properties": { - "type": { - "description": "Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products).", - "enum": [ - "AUTO_UPDATE" - ] - }, - "filter": { - "type": "object", - "description": "Defines a set of criteria and boundary conditions for an `AUTO_UPDATE` product collection type.", - "additionalProperties": false, - "required": [ - "junction" - ], - "properties": { - "junction": { - "$ref": "#/components/schemas/Junction" - }, - "id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "product_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "source_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "name": { - "$ref": "#/components/schemas/FieldConditions" - }, - "price": { - "$ref": "#/components/schemas/FieldConditions" - }, - "object": { - "$ref": "#/components/schemas/FieldConditions" - }, - "attributes": { - "$ref": "#/components/schemas/FieldConditions" - }, - "metadata": { - "$ref": "#/components/schemas/FieldConditions" - }, - "image_url": { - "$ref": "#/components/schemas/FieldConditions" - }, - "skus": { - "$ref": "#/components/schemas/FieldConditions" - }, - "created_at": { - "$ref": "#/components/schemas/FieldConditions" - }, - "updated_at": { - "$ref": "#/components/schemas/FieldConditions" - } + } + } + } + } + }, + "8_obj_calculate_points_proportionally_item_amount": { + "title": "Calculate Points Proportionally to Order Items Amount", + "type": "object", + "description": "This is an object representing points calculated proportionally to another property.", + "properties": { + "type": { + "type": "string", + "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", + "enum": [ + "PROPORTIONAL" + ] + }, + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_ITEMS_AMOUNT" + ], + "description": "- `ORDER_ITEMS_AMOUNT`; Pre-discount amount spent on items defined in the `order_items.amount.object` & `.id` (X points for every Y spent on items excluding discounts)" + }, + "order_items": { + "type": "object", + "properties": { + "amount": { + "type": "object", + "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every set of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` `calculation_type`, give `points`.", + "properties": { + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + }, + "object": { + "type": "string", + "description": "Type of object taken under consideration.", + "enum": [ + "products_collection", + "product", + "sku" + ] + }, + "id": { + "type": "string", + "description": "Unique ID of the resource, i.e. `pc_75U0dHlr7u75BJodrW1AE3t6`, `prod_0bae32322150fd0546`, or `sku_0b7d7dfb090be5c619`." } } - }, - "required": [ - "type", - "filter" - ] - }, - "product_collections_list_response_body": { - "type": "object", - "title": "List Product Collections Response Body", - "description": "Response body schema for **GET** `/product-collections`.", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about product collections.", - "default": "list" - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the JSON property that contains the array of product collections." - }, - "data": { - "description": "A dictionary that contains an array of product collections and their details.", - "type": "array", - "items": { - "$ref": "#/components/schemas/product_collections_collection_item" + } + } + } + } + }, + "8_obj_calculate_points_proportionally_items_subtotal_amount": { + "title": "Calculate Points Proportionally to Order Items Subtotal Amount", + "type": "object", + "description": "This is an object representing points calculated proportionally to another property.", + "properties": { + "type": { + "type": "string", + "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", + "enum": [ + "PROPORTIONAL" + ] + }, + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_ITEMS_SUBTOTAL_AMOUNT" + ], + "description": "- `ORDER_ITEMS_SUBTOTAL_AMOUNT`; Amount spent on items defined in the `order_items.subtotal_amount.object` & `.id` (X points for every Y spent on items including discounts)" + }, + "order_items": { + "type": "object", + "properties": { + "subtotal_amount": { + "type": "object", + "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every set of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` `calculation_type`, give `points`.", + "properties": { + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + }, + "object": { + "type": "string", + "description": "Type of object taken under consideration.", + "enum": [ + "products_collection", + "product", + "sku" + ] + }, + "id": { + "type": "string", + "description": "Unique ID of the resource, i.e. `pc_75U0dHlr7u75BJodrW1AE3t6`, `prod_0bae32322150fd0546`, or `sku_0b7d7dfb090be5c619`." } - }, - "total": { - "type": "integer", - "description": "Total number of product collections." } + } + } + } + } + }, + "8_obj_calculate_points_proportionally_items_quantity": { + "title": "Calculate Points Proportionally to Quantity of Items in the Cart", + "type": "object", + "description": "This is an object representing points calculated proportionally to quantity of items in the cart.", + "properties": { + "type": { + "type": "string", + "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", + "enum": [ + "PROPORTIONAL" + ] + }, + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_ITEMS_QUANTITY" + ], + "description": "`ORDER_ITEMS_QUANTITY`: Quantity of items defined in `order_items.quantity.object` & `.id` (X points for every Y items excluding free items)" + }, + "order_items": { + "type": "object", + "properties": { + "quantity": { + "type": "object", + "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every set of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` `calculation_type`, give `points`.", + "properties": { + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + }, + "object": { + "type": "string", + "description": "Type of object taken under consideration.", + "enum": [ + "products_collection", + "product", + "sku" + ] + }, + "id": { + "type": "string", + "description": "Unique ID of the resource, i.e. `pc_75U0dHlr7u75BJodrW1AE3t6`, `prod_0bae32322150fd0546`, or `sku_0b7d7dfb090be5c619`." + } + } + } + } + } + } + }, + "8_obj_calculate_points_proportionally_customer_metadata": { + "title": "Calculate Points Proportionally To a Customer Metadata Property", + "type": "object", + "description": "This is an object representing points calculated proportionally to a customer metadata property.", + "properties": { + "type": { + "type": "string", + "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", + "enum": [ + "PROPORTIONAL" + ] + }, + "calculation_type": { + "type": "string", + "enum": [ + "CUSTOMER_METADATA" + ], + "description": "`CUSTOMER_METADATA`: Customer Metadata (X points for every Y in metadata attribute, defined in the `property` key under the `customer.metadata` object)" + }, + "customer": { + "type": "object", + "description": "Defines the formula for calculating points proportionally.", + "properties": { + "metadata": { + "type": "object", + "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every given increment of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` order metadata property value, give `points`.", + "properties": { + "every": { + "type": "integer", + "description": "For how many increments of the customer metadata property to grant points for.", + "example": 100 + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card.", + "example": 10 + }, + "property": { + "type": "string", + "example": "customer_life_time_value", + "description": "Customer metadata property." + } + } + } + } + } + } + }, + "8_obj_calculate_points_proportionally_custom_event_metadata": { + "title": "Calculate Points Proportionally To a Custom Event Metadata Property", + "type": "object", + "description": "This is an object representing points calculated proportionally to a custom event metadata property.", + "properties": { + "type": { + "type": "string", + "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio.", + "enum": [ + "PROPORTIONAL" + ] + }, + "calculation_type": { + "type": "string", + "enum": [ + "CUSTOMER_METADATA" + ], + "description": "`CUSTOM_EVENT_METADATA`: Custom Event Metadata (X points for every Y in metadata attribute, defined in the `property` key under the `custom_event.metadata` object)" + }, + "custom_event": { + "type": "object", + "description": "Defines the formula for calculating points proportionally.", + "properties": { + "metadata": { + "type": "object", + "description": "Defines the ratio based on the property defined in the `calculation_type` parameter. For every given increment of value (1, 10, etc) defined in the `every` parameter for the property defined in `calculation_type`, give the customer the number of points defined in the `points` parameter. In other words, for `every` order metadata property value, give `points`.", + "properties": { + "every": { + "type": "integer", + "description": "For how many increments of the custom event metadata property to grant points for.", + "example": 100 + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card.", + "example": 10 + }, + "property": { + "type": "string", + "example": "volume_number", + "description": "Custom event metadata property." + } + } + } + } + } + } + }, + "8_res_list_loyalty_campaigns": { + "title": "List Loyalty Campaigns Response Body", + "type": "object", + "description": "Response body schema for listing loyalty campaigns using **GET** `/loyalties`.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about loyalty campaigns in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "campaigns", + "description": "Identifies the name of the attribute that contains the array of loyalty campaign objects." + }, + "campaigns": { + "type": "array", + "description": "Contains an array of loyalty campaign objects.", + "items": { + "$ref": "#/components/schemas/8_obj_loyalty_campaign_object_no_extended_categories" + } + }, + "total": { + "type": "integer", + "description": "Total number of loyalty campaign objects." + } + } + }, + "8_req_create_loyalty_cards": { + "type": "object", + "title": "Create Loyalty Campaign Request Body", + "description": "Request body schema for creating a loyalty campaign.", + "properties": { + "name": { + "type": "string", + "description": "Campaign name." + }, + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + }, + "auto_join": { + "type": "boolean", + "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. CONTEXT: `LOYALTY_PROGRAM`." + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "use_voucher_metadata_schema": { + "type": "boolean", + "description": "Flag indicating whether the campaign is to use the voucher's metadata schema instead of the campaign metadata schema." + }, + "vouchers_count": { + "type": "integer", + "description": "Total number of unique vouchers in campaign (size of campaign)." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." }, - "required": [ - "object", - "data_ref", - "data", - "total" - ] + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "loyalty_tiers_expiration": { + "type": "object", + "description": "Defines the expiration mechanism for loyalty tiers.", + "anyOf": [ + { + "$ref": "#/components/schemas/8_loyalty_tiers_expiration_balance" + }, + { + "$ref": "#/components/schemas/8_loyalty_tiers_expiration_points_in_period" + } + ] + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", + "example": "cat_0b688929a2476386a7" + }, + "category": { + "type": "string", + "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + }, + "voucher": { + "$ref": "#/components/schemas/2_req_campaign_object_voucher_object_LOYALTY_CARD" + } + } + }, + "8_loyalty_tiers_expiration_balance": { + "title": "Balance", + "type": "object", + "description": "Defines the Balance expiration mechanism for loyalty tiers.", + "properties": { + "qualification_type": { + "type": "string", + "enum": [ + "BALANCE" + ], + "description": "Tier qualification. \n\n`BALANCE`: Points balance is based on the customer's current points balance. Customers qualify for the tier if their points balance is in the points range of the tier." + }, + "start_date": { + "type": "object", + "description": "Defines the conditions for the start date of the tier.", + "properties": { + "type": { + "type": "string", + "enum": [ + "IMMEDIATE" + ], + "description": "What triggers the tier to be valid for a customer. \n`IMMEDIATE`: After reaching the minimum required points." + } + } + }, + "expiration_date": { + "description": "Defines the conditions for the expiration date of a tier.", + "anyOf": [ + { + "$ref": "#/components/schemas/8_loyalty_tiers_expiration_balance_expiration_date_balance_drop" + }, + { + "$ref": "#/components/schemas/8_loyalty_tiers_expiration_balance_expiration_date_custom" + } + ] + } + } + }, + "8_loyalty_tiers_expiration_balance_expiration_date_balance_drop": { + "title": "Balance Drop", + "type": "object", + "description": "Defines the conditions for the expiration date of a tier based on a pure balance drop.", + "properties": { + "type": { + "type": "string", + "enum": [ + "BALANCE_DROP" + ], + "description": "What triggers the tier to expire for a customer. \n`BALANCE_DROP`: Tier expires when the points balance drops below the required range of the tier." + } + } + }, + "8_loyalty_tiers_expiration_balance_expiration_date_custom": { + "title": "Custom", + "type": "object", + "description": "Defines the custom conditions for the expiration date of a tier.", + "properties": { + "type": { + "type": "string", + "enum": [ + "CUSTOM" + ], + "description": "What triggers the tier to expire for a customer. \n`CUSTOM`: Tier expires after a certain time period passes following the instance the points balance drops below the required range of the tier." + }, + "extend": { + "type": "string", + "description": "Defines the amount of time the tier will remain active in ISO 8601 format. The expiration date counter starts at the moment when the customer reaches the minimum required points that are required to be in the tier. For example, a tier with a duration of P3M will be valid for a duration of 3 months." + }, + "rounding": { + "description": "Defines the rounding mechanism for tier expiration.", + "anyOf": [ + { + "$ref": "#/components/schemas/8_loyalty_tiers_expiration_expiration_date_rounding_default_options" + }, + { + "$ref": "#/components/schemas/8_loyalty_tiers_expiration_expiration_date_rounding_custom" + } + ] + } + } + }, + "8_loyalty_tiers_expiration_expiration_date_rounding_default_options": { + "title": "Calendar Periods", + "type": "object", + "description": "Defines the rounding mechanism for tier expiration based on a list of available time periods.", + "properties": { + "type": { + "type": "string", + "enum": [ + "MONTH", + "QUARTER", + "HALF_YEAR", + "YEAR" + ], + "description": "Period to which the expiration will be rounded to. \n- `MONTH`: The expiration date will be rounded to the end of the month. \n- `QUARTER`: The expiration date will be rounded to the end of the quarter. \n- `HALF_YEAR`: The expiration date will be rounded to the half year. \n- `YEAR`: The expiration date will be rounded to the end of the year." + } + } + }, + "8_loyalty_tiers_expiration_expiration_date_rounding_custom": { + "title": "Specific Month", + "type": "object", + "description": "Defines the custom rounding mechanism for tier expiration.", + "properties": { + "type": { + "type": "string", + "enum": [ + "CUSTOM" + ], + "description": "This mechanism describes a custom rounding for the expiration date." + }, + "unit": { + "type": "string", + "description": "Defines the type of unit of time in which the rounding period is counted.", + "enum": [ + "MONTH" + ] + }, + "value": { + "type": "integer", + "description": "Value for the unit of time that the rounding applies to. Units for this parameter are defined by the `rounding.unit` parameter. \n- `0`: January\n- `1`: February\n- `2`: March\n- `3`: April\n- `4`: May\n- `5`: June\n- `6`: July\n- `7`: August\n- `8`: September\n- `9`: October\n- `10`: November\n- `11`: December" + } + } + }, + "8_loyalty_tiers_expiration_points_in_period": { + "title": "Points in Period", + "type": "object", + "description": "Defines the Points in Period expiration mechanism for loyalty tiers.", + "properties": { + "qualification_type": { + "type": "string", + "enum": [ + "POINTS_IN_PERIOD" + ], + "description": "Tier qualification. \n\n`POINTS_IN_PERIOD`: A customer qualifies for the tier only if the sum of the accumulated points in a **defined time interval** reaches the tier threshold." + }, + "qualification_period": { + "type": "string", + "description": "Customers can qualify for the tier if they collected enough points in a given time period. So, in addition to the customer having to reach a points range, they also need to have collected the points within a set time period. \n\n| **Period** | **Definition** |\n|:---|:---|\n| **Calendar Month** | Points collected in one calendar month
                  January, February, March, etc. |\n| **Calendar Quarter** | Points collected in the quarter
                  - January - March
                  - April - June
                  - July - September
                  - October - December |\n| **Calendar Half-year** | Points collected in the half-year
                  - January - June
                  - July - December |\n| **Calendar Year** | Points collected in one calendar year
                  January - December |", + "enum": [ + "MONTH", + "QUARTER", + "HALF_YEAR", + "YEAR" + ] + }, + "start_date": { + "type": "object", + "description": "Defines the conditions for the start date of the tier.", + "properties": { + "type": { + "type": "string", + "enum": [ + "IMMEDIATE", + "NEXT_PERIOD" + ], + "description": "What triggers the tier to be valid for a customer. \n`IMMEDIATE`: After reaching the minimum required points. \n`NEXT_PERIOD`: When the next qualification period starts." + } + } + }, + "expiration_date": { + "type": "object", + "description": "Defines the conditions for the expiration date of a tier.", + "properties": { + "type": { + "type": "string", + "enum": [ + "END_OF_PERIOD", + "END_OF_NEXT_PERIOD" + ], + "description": "What triggers the tier to expire for a customer. \n`END_OF_PERIOD`: Expire tier at the end of the period. \n`END_OF_NEXT_PERIOD`: Expire tier at the end of the next period." + }, + "extend": { + "type": "string", + "description": "Extend the expiration by adding extra months or days in ISO 8601 format. The tier will remain active even though it reaches its expiration time period. For example, a tier with a duration of `P3M` will be valid for an additional duration of 3 months and a tier with a duration of `P1D` will be valid for an additional duration of 1 day." + } + } + } + } + }, + "8_req_update_loyalty_campaign": { + "type": "object", + "title": "Update Loyalty Campaign Request Body", + "description": "Request body schema for updating a loyalty campaign using **PUT** `/loyalties/{campaignId}`.", + "properties": { + "description": { + "type": "string", + "description": "An optional field to keep any extra textual information about the campaign such as a campaign description and details." + }, + "type": { + "type": "string", + "description": "Defines whether the campaign can be updated with new vouchers after campaign creation. \n\n- `AUTO_UPDATE`: By choosing the auto update option you will create a campaign that can be enhanced by new vouchers after the time of creation (e.g. by publish vouchers method). \n- `STATIC`: vouchers need to be manually published.", + "enum": [ + "AUTO_UPDATE", + "STATIC" + ] + }, + "auto_join": { + "type": "boolean", + "description": "Indicates whether customers will be able to auto-join a loyalty campaign if any earning rule is fulfilled. CONTEXT: `LOYALTY_PROGRAM`." + }, + "join_once": { + "type": "boolean", + "description": "If this value is set to `true`, customers will be able to join the campaign only once." + }, + "start_date": { + "type": "string", + "format": "date-time", + "description": "Activation timestamp defines when the campaign starts to be active in ISO 8601 format. Campaign is *inactive before* this date. ", + "example": "2022-09-20T00:00:00.000Z" + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Expiration timestamp defines when the campaign expires in ISO 8601 format. Campaign is *inactive after* this date.", + "example": "2022-09-30T00:00:00.000Z" + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the campaign is valid. For example, valid for 1 hour every other day.`start_date` **required** when including the `validity_timeframe`.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a campaign with an `interval` of `P2D` will be active every other day." + }, + "duration": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format. For example, a campaign with a `duration` of `P1D` will be valid for a duration of one day." + } + } + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the campaign is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "activity_duration_after_publishing": { + "type": "string", + "description": "Defines the amount of time the campaign will be active in ISO 8601 format after publishing. For example, a campaign with a `duration` of `P24D` will be valid for a duration of 24 days." + }, + "loyalty_tiers_expiration": { + "type": "object", + "description": "Defines the expiration mechanism for loyalty tiers.", + "anyOf": [ + { + "$ref": "#/components/schemas/8_loyalty_tiers_expiration_balance" + }, + { + "$ref": "#/components/schemas/8_loyalty_tiers_expiration_points_in_period" + } + ] + }, + "category_id": { + "type": "string", + "description": "Unique category ID that this campaign belongs to. Either pass this parameter OR the `category`.", + "example": "cat_0b688929a2476386a7" + }, + "category": { + "type": "string", + "description": "The category assigned to the campaign. Either pass this parameter OR the `category_id`." + }, + "loyalty_card": { + "description": "Defines the loyalty card details.", + "type": "object", + "properties": { + "points": { + "type": "integer", + "description": "Initial loyalty card income in points to be applied to the loyalty card at voucher generation." + }, + "expiration_rules": { + "type": "object", + "description": "Defines point expiration rules.", + "properties": { + "period_type": { + "type": "string", + "enum": [ + "MONTH" + ], + "description": "The expiration period." + }, + "period_value": { + "type": "integer", + "description": "How many periods should pass before the expiration occurs." + }, + "rounding_type": { + "type": "string", + "enum": [ + "END_OF_MONTH", + "END_OF_QUARTER", + "END_OF_HALF_YEAR", + "END_OF_YEAR", + "PARTICULAR_MONTH" + ], + "description": "Round up expiration till the end of the given period type." + } + } + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the campaign. A set of key/value pairs that you can attach to a campaign object. It can be useful for storing additional information about the campaign in a structured format." + } + } + }, + "8_req_create_earning_rules": { + "description": "This data model represents the request body for the `/loyalties/{campaignId}/earning-rules` endpoint.", + "title": "Create Earning Rule Request Body", + "type": "array", + "items": { + "anyOf": [ + { + "$ref": "#/components/schemas/8_req_earning_rule_object_order_paid" }, - "13_obj_validation_rule_object": { - "title": "Validation Rule Object", - "type": "object", - "description": "This is an object representing a validation rule. \n\nThis entity stores the rules used to limit resources in Voucherify. The validation rule can be assigned to resources such as a: \n- [voucher](ref:get-voucher)\n- [campaign](ref:get-campaign)\n- [earning rule](ref:get-earning-rule)\n- [reward assignment](ref:get-reward-assignment)\n- [promotion tier](ref:list-promotion-tiers)\n- [publication](ref:list-publications)\n\nYou can configure the Validation Rule to include your own custom error messages which are going to be returned from the API upon a validation / redemption failure. You can read more [here](ref:errors#custom-error-messages-with-validation-rules).", - "x-tags": [ - "VALIDATION RULES API" - ], - "properties": { - "id": { - "type": "string", - "example": "val_eR1c41hu0vUU", - "description": "Unique validation rule ID." - }, - "name": { - "type": "string", - "description": "Custom, unique name for set of validation rules.", - "example": "Business Validation Rule" + { + "$ref": "#/components/schemas/8_req_earning_rule_object_entered_segment" + }, + { + "$ref": "#/components/schemas/8_req_earning_rule_object_custom_event" + }, + { + "$ref": "#/components/schemas/8_req_earning_rule_object_tier" + } + ] + } + }, + "8_req_create_earning_rules_copy": { + "description": "This data model represents the request body for the `/loyalties/{campaignId}/earning-rules` endpoint.", + "type": "object", + "title": "Create Earning Rule Request Body", + "properties": { + "event": { + "type": "string", + "enum": [ + "order.paid", + "customer.segment.entered", + "custom_event_defined_in_EVENT_SCHEMA" + ], + "description": "Defines the event which triggers the earning rule to add points to a loyalty card. \n\n- `order.paid` an event defined by the Voucherify API corresponding to an order status `PAID`. Read more here. \n- `customer.segment.entered` an event defined by the Voucherify API corresponding to a customer entering a pre-defined customer segment. Read more here. \n- `custom_event_name` the name of a custom event defined in the Dashboard → **Project Settings** → **EVENT SCHEMA** → **Add event definition**. Read more on defining custom events. " + }, + "validation_rule_id": { + "type": "string", + "example": "val_248vs7tUjlIE", + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." + }, + "loyalty": { + "description": "An object that defines the number of points that will be added to a loyalty card and how the points will be added.\n\n- `FIXED` adds a fixed number of `points`\n- `PROPORTIONAL` adds points proportionally based on a pre-defined ratio", + "oneOf": [ + { + "description": "Fixed. Applicable to events `order.paid`, `customer.segment.entered`, and `custom_event`.", + "properties": { + "points": { + "type": "integer", + "description": "The number of points to be added to the loyalty card.", + "example": 1000 + }, + "type": { + "type": "string", + "description": "Defines how the points will be added to the loyalty card. `FIXED` adds a fixed number of `points`.", + "default": "FIXED" + } }, - "rules": { - "type": "object", - "description": "Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", - "properties": { - "1": { - "type": "object", - "description": "Defines the rule.", - "properties": { - "name": { - "type": "string", - "description": "Voucherify specific rule name. The list of available names is provided below. \n\n**Name** |\n---- | -----------\n**Customer** | customer.segment
                  customer.metadata* \n**Order** |order.amount
                  order.items.count
                  order.items.price_any
                  order.items.price_each
                  order.items.metadata_any
                  order.items.metadata_each
                  order.metadata* |\n| **Campaign** | campaign.orders.amount_discounted
                  campaign.orders.amount
                  campaign.redemptions.count
                  campaign.redemptions.count.daily
                  campaign.redemptions.count.monthly
                  campaign.redemptions.customers_count
                  campaign.redemptions.customers_count.daily
                  campaign.redemptions.customers_count.monthly |\n| **Redemption** |redemption.gift.amount
                  redemption.count.daily
                  redemption.count.monthly
                  redemption.count.per_customer
                  redemption.count.per_customer.daily
                  redemption.count.per_customer.monthly
                  redemption.api_key
                  redemption.count.per_api_key
                  redemption.user.login
                  redemption.count.per_user
                  redemption.metadata*
                  redemption.reward.pay_with_points.points_used |\n| **Product** | product.id
                  product.price
                  product.quantity
                  product.discount_applicable
                  product.metadata*
                  product.metadata.aggregated_quantity
                  product.metadata.aggregated_amount
                  product.metadata.discount_applicable
                  product.metadata.match_all |\n| **SKU** | sku.id
                  sku.price
                  sku.quantity
                  sku.discount_applicable |\n| **Publication** | publication.redeemable_by_linked_customer |\n| **Custom Event** | custom_event.metadata* |\n| **Order items** | order.items.every
                  order.items.any
                  order.items.none
                  order.items.cheapest
                  order.items.most_expensive | order.items.quantity
                  order.items.aggregated_quantity
                  order.items.price
                  order.items.aggregated_amount
                  order.items.metadata* | \n\n\n\n*Requires the `property` field to be defined." - }, - "property": { - "type": [ - "string", - "null" - ], - "description": "Custom name for a metadata property associated with the condition to be satisfied. **Required** if the property `name` is any of the following: \n customer_metadata
                  custom_event_metadata
                  order_items_metadata
                  order_metadata
                  product_metadata
                  redemption_metadata" - }, - "conditions": { - "type": "object", - "description": "A set of key value pairs representing the condition name and value. The list of available conditions is provided below: \n**Condition (key)** | **Definition** | **Does not support Types** \n--- | --- | ---\n $is | A property is a predefined value. | \n $is_not | A property is not a predefined value. | \n $in | A property either one value in a predefined list of values. | \n $less_than | A property is less than a predefined value. | boolean \n $less_than_or_equal | A property is less than or equal to a predefined value. | boolean \n $more_than | A property is more than a predefined value. | boolean \n $more_than_or_equal | A property is more than or equal to a predefined value. | boolean \n $starts_with | A property starts with the predefined sequence of characters. | boolean, number \n $ends_with | A property ends with the predefined sequence of characters. | boolean, number \n $contains | A property contains the predefined sequence of characters. | boolean, number \n $timeframe | | boolean, number \n $dow | | boolean, string \n $count | | boolean, string \n $count_more | | boolean, string \n $count_less | | boolean, string ", - "properties": { - "$one_of_voucherify_conditions": { - "type": "array", - "description": "Contains a set of conditions for the rule.", - "items": { - "type": [ - "string", - "integer", - "boolean" - ] - } - } - } - }, - "rules": { - "type": "object", - "description": "Contains all the nested rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", - "properties": { - "1": { - "type": "object", - "description": "Defines the nested rule.", - "properties": { - "name": { - "type": "string" - }, - "property": { - "type": "string" - }, - "conditions": { - "type": "object" - }, - "rules": { - "type": "object" - } - } - }, - "logic": { - "type": "string" - } - } - }, - "error": { - "type": "object", - "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rule.", - "properties": { - "message": { - "type": "string", - "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rule." - } + "required": [ + "points", + "type" + ] + }, + { + "description": "Proportional. Applicable to only `order.paid`.", + "properties": { + "type": { + "type": "string", + "description": "Defines how the points will be added to the loyalty card.`PROPORTIONAL` adds points based on a pre-defined ratio", + "default": "PROPORTIONAL" + }, + "order": { + "type": "object", + "description": "Defines proportion for calculating how many points to add to a loyalty card. The ratio is based on the order amount. For `every` dollar spent, the customer will get this many `points`. \n", + "required": [ + "amount" + ], + "properties": { + "amount": { + "type": "object", + "description": "Defines the ratio based on the order amount.", + "required": [ + "every", + "points" + ], + "properties": { + "every": { + "type": "integer", + "description": "Order amount. Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." + }, + "points": { + "type": "integer", + "description": "Number of points awarded." } } } - }, - "logic": { - "type": "string", - "example": "(1 and 2) and (3)", - "description": "Defines the logic between the rules." - } - } - }, - "error": { - "type": "object", - "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules.", - "properties": { - "message": { - "type": "string", - "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rules." } } }, - "applicable_to": { - "type": "object", - "properties": { - "excluded": { - "type": "array", - "description": "Defines which items are excluded from a discount.", - "items": { - "type": "object", - "description": "Defines the excluded item.", - "properties": { - "object": { - "type": "string", - "enum": [ - "product", - "sku", - "products_collection" - ], - "description": "The type of object being excluded from the rule." - }, - "id": { - "type": "string", - "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." - }, - "source_id": { - "type": "string" - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY" - ], - "description": "Discount effect for an excluded resource." - } - } - } - }, - "included": { - "type": "array", - "description": "Defines which items are included in a discount.", - "items": { - "type": "object", - "description": "Defines the included item.", - "properties": { - "object": { - "type": "string", - "enum": [ - "product", - "sku", - "products_collection" - ], - "description": "The type of object being included in the rule." - }, - "id": { - "type": "string", - "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." - }, - "source_id": { - "type": "string" - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Discount effect for an included resource." - }, - "quantity_limit": { - "type": "integer", - "description": "A limit on the number of units that at maximum can qualify for a discount. This property is present for an AMOUNT type discount when the effect is applied to ITEMS and each unit of matched products has the same discount value." - } - } - } - }, - "included_all": { - "type": "boolean", - "description": "Indicates whether all items are included in the discount." - } - } + "required": [ + "type", + "order" + ] + } + ], + "type": "object" + }, + "source": { + "type": "object", + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "example": "Order Paid - You will get 100 points", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + } + } + }, + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the `start_date` and `expiration_date` of the campaign or the earning rule's own `start_date` and `expiration_date`. \n\n- `true` indicates an *active* earning rule\n- `false` indicates an *inactive* earning rule" + }, + "start_date": { + "type": "string", + "example": "2022-02-02T13:00:00.000Z", + "format": "date-time", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is *inactive before* this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default." + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "example": "2022-03-03T14:30:00.000Z", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is *inactive after* this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day. `start_date` **required** when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a `duration` of `PT1H` will be valid for a duration of one hour.", + "example": "PT1H" + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an `interval` of `P2D` will be valid every other day.", + "example": "P2D" + } + }, + "required": [ + "duration", + "interval" + ] + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday \n- `1` Monday \n- `2` Tuesday \n- `3` Wednesday \n- `4` Thursday \n- `5` Friday \n- `6` Saturday ", + "items": { + "type": "integer" + } + }, + "custom_event": { + "type": "object", + "description": "Contains the schema id of a custom event. **Required** for the custom event option in `event`.", + "properties": { + "schema_id": { + "type": "string", + "description": "Contains a unique identifier of a custom event schema. Assigned by the Voucherify API." + } + }, + "required": [ + "schema_id" + ] + }, + "segment": { + "type": "object", + "description": "Contains the id of a customer segment. **Required** for the `customer.segment.entered` option in `event`.", + "properties": { + "id": { + "type": "string", + "description": "Contains a unique identifier of a customer segment. Assigned by the Voucherify API." + } + }, + "required": [ + "id" + ] + } + }, + "required": [ + "event", + "loyalty" + ] + }, + "8_req_update_earning_rule": { + "description": "Request body schema for updating earning rules using **PUT** `/loyalties/{campaignId}/earning-rules/{earningRuleId}` endpoint.", + "title": "Update Earning Rule Request Body", + "anyOf": [ + { + "$ref": "#/components/schemas/8_req_update_earning_rule_object_order_paid" + }, + { + "$ref": "#/components/schemas/8_req_update_earning_rule_object_entered_segment" + }, + { + "$ref": "#/components/schemas/8_req_update_earning_rule_object_custom_event" + }, + { + "$ref": "#/components/schemas/8_req_update_earning_rule_object_tier" + } + ] + }, + "8_res_list_earning_rules": { + "description": "Response body schema for listing earning rules using **GET** `/loyalties/{campaignId}/earning-rules` endpoint.", + "type": "object", + "title": "List Earning Rules Response Body", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about earning rules in a dictionary.", + "default": "list" + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of earning rule objects." + }, + "data": { + "type": "array", + "description": "Contains array of earning rule objects.", + "items": { + "$ref": "#/components/schemas/8_obj_earning_rule_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of earning rule objects." + } + } + }, + "8_req_add_remove_points_balance": { + "title": "Add or Remove Points Balance Request Body", + "type": "object", + "description": "Request schema for adding or removing points from a loyalty card.", + "properties": { + "points": { + "type": "integer", + "description": "Incremental balance to be added to/subtracted from the loyalty card. \n\nTo add points: `100` \nTo subtract points, add a minus: `-100`" + }, + "expiration_type": { + "type": "string", + "default": "PROGRAM_RULES", + "enum": [ + "PROGRAM_RULES", + "NON_EXPIRING", + "CUSTOM_DATE" + ], + "description": "Set the type of expiration for added points. \n- `PROGRAM_RULES`: Inherit rules from campaign.\n- `NON_EXPIRING`: Points never expire.\n- `CUSTOM_DATE`: Points expire on a particular date. **Requires** `expiration_date` parameter." + }, + "expiration_date": { + "type": "string", + "description": "Set expiration date for added points, i.e. `YYYY-MM-DD`. This parameter is **required** only when `expiration_type` is set to `CUSTOM_DATE`.", + "example": "2020-05-30" + }, + "reason": { + "type": "string", + "description": "Reason for the transfer." + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." + } + } + }, + "8_res_add_remove_points_balance": { + "description": "Response schema for adding or removing points from a loyalty card.", + "type": "object", + "title": "Add or Remove Loyalty Card Balance Response Body", + "properties": { + "points": { + "type": "integer", + "description": "The incremental points removed or added to the current balance on the loyalty card." + }, + "total": { + "type": "integer", + "description": "The total of points accrued over the lifetime of the loyalty card." + }, + "balance": { + "type": "integer", + "description": "The balance after adding/removing points." + }, + "type": { + "type": "string", + "description": "The type of voucher being modified.", + "default": "loyalty_card" + }, + "object": { + "type": "string", + "description": "The type of object represented by JSON. Default is `balance`.", + "default": "balance" + }, + "related_object": { + "type": "object", + "description": "Defines the object that is being modified with the values that are returned in the balance object.", + "properties": { + "type": { + "type": "string", + "description": "The object being modified.", + "default": "voucher" + }, + "id": { + "type": "string", + "description": "Identifies the loyalty card that is being modified, this is the ID that was assigned by the Voucherify API.", + "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + } + } + } + } + }, + "8_req_transfer_loyalty_points": { + "description": "Request body schema for transferring points from a loyalty card.", + "type": "array", + "title": "Transfer Loyalty Points Request Body", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Unique loyalty card code from which the user wants to transfer loyalty points (source).", + "example": "L-CARD-02hgnq4" + }, + "points": { + "type": "integer", + "description": "The number of loyalty points that the user wants to transfer to another loyalty card. The number of points cannot be higher than the current balance on the loyalty card (source).", + "example": 2 + }, + "reason": { + "type": "string", + "description": "Reason for the transfer." + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." + } + } + } + }, + "8_req_redeem_reward": { + "description": "Request body schema for redeeming a reward.", + "type": "object", + "title": "Redeem Reward Request Body", + "properties": { + "reward": { + "type": "object", + "description": "Contains information about the reward that the customer wants to redeem and the number of points the customer is choosing to use for the reward if the reward is a pay with points reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique reward ID assigned by Voucherify. The reward must be assigned to the campaign in order for the user to be able to use the reward.", + "example": "rew_eSi4eYJk7o3tOycvweicR2z7" + }, + "points": { + "type": "integer", + "description": "The number of loyalty points that the user wants to spend in order to fulfill the order. The number of points cannot be higher than the current balance on the loyalty card." + } + } + }, + "order": { + "$ref": "#/components/schemas/8_req_order_object_redeem_reward", + "description": "Order object that is **required** when redeeming a pay with points reward." + }, + "metadata": { + "type": "object", + "description": "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](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + } + } + }, + "8_req_order_object_redeem_reward": { + "type": "object", + "title": "Order object", + "description": "Request body schema for creating an order, **required** when redeeming a pay with points reward.", + "properties": { + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of an integration between multiple systems. It can be an order ID from a CRM system, database or 3rd-party service." + }, + "status": { + "type": "string", + "description": "The order status.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULLFILLED" + ] + }, + "amount": { + "type": "integer", + "description": "A positive integer in the smallest currency unit (that is, 100 cents for $1.00) representing the total amount of the order; this is the sum of the order items' amounts." + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format." + }, + "referrer": { + "$ref": "#/components/schemas/10_req_orders_referrer_object" + }, + "items": { + "$ref": "#/components/schemas/10_req_orders_items_array" + } + } + }, + "8_res_redeem_reward": { + "description": "Response body schema for redeeming a reward.", + "title": "Redeem Reward Response Body", + "$ref": "#/components/schemas/8_obj_redemption_object_loyalty_card_extended" + }, + "8_obj_redemption_object_loyalty_card_extended": { + "type": "object", + "title": "Loyalty Card Voucher", + "description": "This is an object representing a redemption. \n\nRedemption is the key operation in the voucher lifecycle. A customer can redeem a voucher 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](rollback-redemption).", + "properties": { + "id": { + "type": "string", + "example": "r_0bc92f81a6801f9bca", + "description": "Unique redemption ID." + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the redemption.", + "default": "redemption" + }, + "date": { + "type": "string", + "format": "date-time", + "example": "2022-10-03T12:24:58.008Z", + "description": "Timestamp in ISO 8601 format indicating when the redemption occured." + }, + "customer_id": { + "type": "string", + "example": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "description": "Unique customer ID of the redeeming customer." + }, + "tracking_id": { + "type": "string", + "example": "track_fxEMFiLowFHg==", + "description": "Hashed customer source ID." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes in the form of key/value pairs assigned to the redemption." + }, + "amount": { + "type": "integer", + "description": "Number of points being redeemed for a reward." + }, + "result": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ], + "description": "Redemption result." + }, + "order": { + "description": "Defines the details of the order that is related to the redemption.", + "$ref": "#/components/schemas/7_obj_order_object" + }, + "customer": { + "type": "object", + "description": "Defines the customer redeeming the reward.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "source_id": { + "type": "string", + "description": "The merchant's customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the customer. A set of key/value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format." + }, + "object": { + "type": "string", + "description": "Type of object represented is `customer`.", + "default": "customer" + } + } + }, + "related_object_type": { + "type": "string", + "description": "Defines the related object. i.e. `voucher`.", + "enum": [ + "voucher" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique related object ID assigned by Voucherify, i.e. v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno for a voucher." + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object", + "description": "Defines the details of the voucher being redeemed." + }, + "reward": { + "description": "Defines the reward being redeemed.", + "anyOf": [ + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_pay_with_points" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_product" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_material_sku" + }, + { + "$ref": "#/components/schemas/7_obj_redemption_object_loyalty_card_digital" + } + ] + }, + "loyalty_card": { + "type": "object", + "description": "Stores the number of points being subtracted from the loyalty card for the reward redemption.", + "properties": { + "points": { + "type": "integer", + "description": "Number of points being subtracted from the loyalty card for the reward redemption." + } + } + } + } + }, + "8_res_loyalties_campaign_id_tiers_tier_id_earning_rules": { + "type": "object", + "properties": { + "object": { + "type": "string" + }, + "data_ref": { + "type": "string" + }, + "data": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" }, "created_at": { - "type": "string", - "example": "2022-03-23T07:44:00.444Z", - "description": "Timestamp representing the date and time when the validation rule was created in ISO 8601 format.", - "format": "date-time" + "type": "string" }, "updated_at": { - "type": "string", - "example": "2022-04-26T08:35:54.960Z", - "description": "Timestamp representing the date and time when the validation rule was updated in ISO 8601 format.", - "format": "date-time" - }, - "type": { - "type": "string", - "enum": [ - "basic", - "advanced", - "complex" - ], - "description": "Type of validation rule." - }, - "context_type": { - "type": "string", - "enum": [ - "earning_rule.order.paid", - "earning_rule.custom_event", - "earning_rule.customer.segment.entered", - "campaign.discount_coupons", - "campaign.discount_coupons.discount.apply_to_order", - "campaign.discount_coupons.discount.apply_to_items", - "campaign.discount_coupons.discount.apply_to_items_proportionally", - "campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity", - "campaign.discount_coupons.discount.fixed.apply_to_items", - "campaign.gift_vouchers", - "campaign.gift_vouchers.gift.apply_to_order", - "campaign.gift_vouchers.gift.apply_to_items", - "campaign.referral_program", - "campaign.referral_program.discount.apply_to_order", - "campaign.referral_program.discount.apply_to_items", - "campaign.referral_program.discount.apply_to_items_proportionally", - "campaign.referral_program.discount.apply_to_items_proportionally_by_quantity", - "campaign.referral_program.discount.fixed.apply_to_items", - "campaign.promotion", - "campaign.promotion.discount.apply_to_order", - "campaign.promotion.discount.apply_to_items", - "campaign.promotion.discount.apply_to_items_proportionally", - "campaign.promotion.discount.apply_to_items_proportionally_by_quantity", - "campaign.promotion.discount.fixed.apply_to_items", - "campaign.loyalty_program", - "campaign.lucky_draw", - "voucher.discount_voucher", - "voucher.discount_voucher.discount.apply_to_order", - "voucher.discount_voucher.discount.apply_to_items", - "voucher.discount_voucher.discount.apply_to_items_proportionally", - "voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity", - "voucher.discount_voucher.discount.fixed.apply_to_items", - "voucher.gift_voucher", - "voucher.gift_voucher.gift.apply_to_order", - "voucher.gift_voucher.gift.apply_to_items", - "voucher.loyalty_card", - "voucher.lucky_draw_code", - "distribution.custom_event", - "reward_assignment.pay_with_points", - "global" - ], - "description": "Validation rule context type. \n\n| **Context Type** | **Definition** |\n|:---|:---|\n| earning_rule.order.paid | |\n| earning_rule.custom_event | |\n| earning_rule.customer.segment.entered | |\n| campaign.discount_coupons | |\n| campaign.discount_coupons.discount.apply_to_order | |\n| campaign.discount_coupons.discount.apply_to_items | |\n| campaign.discount_coupons.discount.apply_to_items_proportionally | |\n| campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.discount_coupons.discount.fixed.apply_to_items | |\n| campaign.gift_vouchers | |\n| campaign.gift_vouchers.gift.apply_to_order | |\n| campaign.gift_vouchers.gift.apply_to_items | |\n| campaign.referral_program | |\n| campaign.referral_program.discount.apply_to_order | |\n| campaign.referral_program.discount.apply_to_items | |\n| campaign.referral_program.discount.apply_to_items_proportionally | |\n| campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.referral_program.discount.fixed.apply_to_items | |\n| campaign.promotion | |\n| campaign.promotion.discount.apply_to_order | |\n| campaign.promotion.discount.apply_to_items | |\n| campaign.promotion.discount.apply_to_items_proportionally | |\n| campaign.promotion.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.promotion.discount.fixed.apply_to_items | |\n| campaign.loyalty_program | |\n| campaign.lucky_draw | |\n| voucher.discount_voucher | |\n| voucher.discount_voucher.discount.apply_to_order | |\n| voucher.discount_voucher.discount.apply_to_items | |\n| voucher.discount_voucher.discount.apply_to_items_proportionally | |\n| voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | |\n| voucher.discount_voucher.discount.fixed.apply_to_items | |\n| voucher.gift_voucher | |\n| voucher.gift_voucher.gift.apply_to_order | |\n| voucher.gift_voucher.gift.apply_to_items | |\n| voucher.loyalty_card | |\n| voucher.lucky_draw_code | |\n| distribution.custom_event | |\n| reward_assignment.pay_with_points | |\n| global | |" + "type": "null" }, - "object": { - "type": "string", - "default": "validation_rules", - "description": "The type of object represented by JSON. This object stores information about the validation rule." - } - } - }, - "13_req_create_validation_rule": { - "title": "Create Validation Rule Request Body", - "type": "object", - "description": "Request body schema for **POST** `/validation-rules`.", - "properties": { - "name": { - "type": "string", - "description": "Custom, unique name for the set of validation rules.", - "example": "Business Validation Rule" + "validation_rule_id": { + "type": "null" }, - "rules": { + "loyalty": { "type": "object", - "description": "Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", "properties": { - "1": { - "type": "object", - "description": "Defines the rule.", - "properties": { - "name": { - "type": "string", - "description": "Voucherify specific rule name. The list of available names is provided below. \n| **Name** |\n|:---|\n| **Customer** |\n| customer.segment
                  customer.metadata* |\n| **Order** |\n| order.amount
                  order.items.count
                  order.items.price_any
                  order.items.price_each
                  order.items.metadata_any
                  order.items.metadata_each
                  order.metadata* |\n| **Campaign** |\n| campaign.orders.amount_discounted
                  campaign.orders.amount
                  campaign.redemptions.count
                  campaign.redemptions.count.daily
                  campaign.redemptions.count.monthly
                  campaign.redemptions.customers_count
                  campaign.redemptions.customers_count.daily
                  campaign.redemptions.customers_count.monthly |\n| **Redemption** |\n| redemption.gift.amount
                  redemption.count.daily
                  redemption.count.monthly
                  redemption.count.per_customer
                  redemption.count.per_customer.daily
                  redemption.count.per_customer.monthly
                  redemption.api_key
                  redemption.count.per_api_key
                  redemption.user.login
                  redemption.count.per_user
                  redemption.metadata*
                  redemption.reward.pay_with_points.points_used |\n| **Product** |\n| product.id
                  product.price
                  product.quantity
                  product.discount_applicable
                  product.metadata*
                  product.metadata.aggregated_quantity
                  product.metadata.aggregated_amount
                  product.metadata.discount_applicable
                  product.metadata.match_all |\n| **SKU** |\n| sku.id
                  sku.price
                  sku.quantity
                  sku.discount_applicable |\n| **Publication** |\n| publication.redeemable_by_linked_customer |\n| **Custom Event** |\n| custom_event.metadata* |\n| **Order items** |\n| order.items.every
                  order.items.any
                  order.items.none
                  order.items.cheapest
                  order.items.most_expensive |\n| order.items.quantity
                  order.items.aggregated_quantity
                  order.items.price
                  order.items.aggregated_amount
                  order.items.metadata* | \n\n\n*Requires the `property` field to be defined." - }, - "property": { - "type": [ - "string", - "null" - ], - "description": "Custom name for a metadata property associated with the condition to be satisfied. **Required** if the property `name` is any of the following: \n| **Name** |\n|:---|\n| customer_metadata |\n| custom_event_metadata |\n| order_items_metadata |\n| order_metadata |\n| product_metadata |\n| redemption_metadata |" - }, - "conditions": { - "type": "object", - "description": "A set of key value pairs representing the condition name and value. The list of available conditions is provided below: \n| **Condition (key)** | **Definition** | **Does not support Types** |\n|:---|:---|:---|\n| $is | A property is a predefined value. | |\n| $is_not | A property is not a predefined value. | |\n| $in | A property either one value in a predefined list of values. | |\n| $less_than | A property is less than a predefined value. | boolean |\n| $less_than_or_equal | A property is less than or equal to a predefined value. | boolean |\n| $more_than | A property is more than a predefined value. | boolean |\n| $more_than_or_equal | A property is more than or equal to a predefined value. | boolean |\n| $starts_with | A property starts with the predefined sequence of characters. | boolean, number |\n| $ends_with | A property ends with the predefined sequence of characters. | boolean, number |\n| $contains | A property contains the predefined sequence of characters. | boolean, number |\n| $timeframe | | boolean, number |\n| $dow | | boolean, string |\n| $count | | boolean, string |\n| $count_more | | boolean, string |\n| $count_less | | boolean, string |", - "properties": { - "$one_of_voucherify_conditions": { - "type": "array", - "description": "Contains a set of conditions for the rule.", - "items": { - "type": [ - "string", - "integer", - "boolean" - ] - } - } - } - }, - "rules": { - "type": "object", - "description": "Contains all the nested rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", - "properties": { - "1": { - "type": "object", - "description": "Defines the nested rule.", - "properties": { - "name": { - "type": "string" - }, - "property": { - "type": "string" - }, - "conditions": { - "type": "object" - }, - "rules": { - "type": "object" - } - } - }, - "logic": { - "type": "string" - } - } - }, - "error": { - "type": "object", - "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rule.", - "properties": { - "message": { - "type": "string", - "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rule." - } - } - } - } + "points": { + "type": "integer" }, - "logic": { - "type": "string", - "example": "(1 and 2) and (3)", - "description": "Defines the logic between the rules." + "type": { + "type": "string" } } }, - "error": { + "event": { + "type": "string" + }, + "source": { "type": "object", - "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules.", "properties": { - "message": { - "type": "string", - "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rules." + "banner": { + "type": "string" + }, + "object_id": { + "type": "string" + }, + "object_type": { + "type": "string" } } }, - "applicable_to": { + "active": { + "type": "boolean" + }, + "object": { + "type": "string" + }, + "automation_id": { + "type": "string" + }, + "custom_event": { "type": "object", "properties": { - "excluded": { - "type": "array", - "description": "Defines which items are excluded from a discount.", - "items": { - "type": "object", - "description": "Defines the excluded item.", - "properties": { - "object": { - "type": "string", - "enum": [ - "product", - "sku", - "products_collection" - ], - "description": "The type of object being excluded from the rule." - }, - "id": { - "type": "string", - "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." - }, - "source_id": { - "type": "string" - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY" - ], - "description": "Discount effect for an excluded resource." - } - } - } - }, - "included": { - "type": "array", - "description": "Defines which items are included in a discount.", - "items": { - "type": "object", - "description": "Defines the included item.", - "properties": { - "object": { - "type": "string", - "enum": [ - "product", - "sku", - "products_collection" - ], - "description": "The type of object being included in the rule." - }, - "id": { - "type": "string", - "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." - }, - "source_id": { - "type": "string" - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Discount effect for an included resource." - }, - "quantity_limit": { - "type": "integer", - "description": "A limit on the number of units that at maximum can qualify for a discount. This property is present for an AMOUNT type discount when the effect is applied to ITEMS and each unit of matched products has the same discount value." - } - } - } - }, - "included_all": { - "type": "boolean", - "description": "Indicates whether all items are included in the discount." + "schema_id": { + "type": "string" } } } } - }, - "13_res_list_validation_rules": { - "description": "Response body schema for listing validation rules. \n\nThis entity stores the [validation rules](ref:get-validation-rule) used to limit your resources.", - "type": "object", - "title": "List Validation Rules Response Body", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about validation rules.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of validation rules.", - "default": "data" - }, - "data": { - "type": "array", - "uniqueItems": true, - "description": "An array of validation rules.", - "items": { - "type": "object", - "description": "Stores information about the validation rule.", - "properties": { - "id": { - "type": "string", - "description": "Unique validation rule ID.", - "example": "val_F4Artfc4HQIq" - }, - "name": { - "type": "string", - "description": "Custom, unique name for the set of validation rules." - }, - "rules": { - "type": "object", - "description": "A set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", - "properties": { - "1": { - "type": "object", - "description": "Defines the rule.", - "properties": { - "name": { - "type": "string", - "description": "Voucherify specific rule name. The list of available names is provided below. \n\n**Name** |\n---- | -----------\n**Customer** | customer.segment
                  customer.metadata* \n**Order** |order.amount
                  order.items.count
                  order.items.price_any
                  order.items.price_each
                  order.items.metadata_any
                  order.items.metadata_each
                  order.metadata* |\n| **Campaign** | campaign.orders.amount_discounted
                  campaign.orders.amount
                  campaign.redemptions.count
                  campaign.redemptions.count.daily
                  campaign.redemptions.count.monthly
                  campaign.redemptions.customers_count
                  campaign.redemptions.customers_count.daily
                  campaign.redemptions.customers_count.monthly |\n| **Redemption** |redemption.gift.amount
                  redemption.count.daily
                  redemption.count.monthly
                  redemption.count.per_customer
                  redemption.count.per_customer.daily
                  redemption.count.per_customer.monthly
                  redemption.api_key
                  redemption.count.per_api_key
                  redemption.user.login
                  redemption.count.per_user
                  redemption.metadata*
                  redemption.reward.pay_with_points.points_used |\n| **Product** | product.id
                  product.price
                  product.quantity
                  product.discount_applicable
                  product.metadata*
                  product.metadata.aggregated_quantity
                  product.metadata.aggregated_amount
                  product.metadata.discount_applicable
                  product.metadata.match_all |\n| **SKU** | sku.id
                  sku.price
                  sku.quantity
                  sku.discount_applicable |\n| **Publication** | publication.redeemable_by_linked_customer |\n| **Custom Event** | custom_event.metadata* |\n| **Order items** | order.items.every
                  order.items.any
                  order.items.none
                  order.items.cheapest
                  order.items.most_expensive | order.items.quantity
                  order.items.aggregated_quantity
                  order.items.price
                  order.items.aggregated_amount
                  order.items.metadata* | \n\n\n*Requires the `property` field to be defined." - }, - "rules": { - "type": "object", - "description": "Contains all the nested rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", - "properties": { - "1": { - "type": "object", - "description": "Defines the nested rule.", - "properties": { - "name": { - "type": "string" - }, - "property": { - "type": "string" - }, - "conditions": { - "type": "object" - }, - "rules": { - "type": "object" - } - } - }, - "logic": { - "type": "string" - } - } - }, - "property": { - "type": "string", - "description": "Custom name for a metadata property associated with the condition to be satisfied. **Required** if the property `name` is any of the following: \n| **Name** |\n|:---|\n| customer_metadata |\n| custom_event_metadata |\n| order_items_metadata |\n| order_metadata |\n| product_metadata |\n| redemption_metadata |" - }, - "conditions": { - "type": "array", - "description": "A set of key value pairs representing the condition name and value. The list of available conditions is provided below: \n| **Condition (key)** | **Definition** | **Does not support Types** |\n|:---|:---|:---|\n| $is | A property is a predefined value. | |\n| $is_not | A property is not a predefined value. | |\n| $in | A property either one value in a predefined list of values. | |\n| $less_than | A property is less than a predefined value. | boolean |\n| $less_than_or_equal | A property is less than or equal to a predefined value. | boolean |\n| $more_than | A property is more than a predefined value. | boolean |\n| $more_than_or_equal | A property is more than or equal to a predefined value. | boolean |\n| $starts_with | A property starts with the predefined sequence of characters. | boolean, number |\n| $ends_with | A property ends with the predefined sequence of characters. | boolean, number |\n| $contains | A property contains the predefined sequence of characters. | boolean, number |\n| $timeframe | | boolean, number |\n| $dow | | boolean, string |\n| $count | | boolean, string |\n| $count_more | | boolean, string |\n| $count_less | | boolean, string |", - "items": { - "type": [ - "string", - "integer", - "boolean" - ] - } - }, - "error": { - "type": "object", - "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rule.", - "properties": { - "message": { - "type": "string", - "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rule." - } - } - } - } - }, - "logic": { - "type": "string", - "description": "Defines the logic between the rules.", - "example": "(1 and 2) and (3)" - } - } - }, - "error": { - "type": "object", - "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules.", - "properties": { - "message": { - "type": "string", - "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rules." - } - } - }, - "applicable_to": { - "type": "object", - "properties": { - "excluded": { - "type": "array", - "description": "Defines which items are excluded from a discount.", - "items": { - "type": "object", - "description": "Defines the excluded item.", - "properties": { - "object": { - "type": "string", - "enum": [ - "product", - "sku", - "products_collection" - ], - "description": "The type of object being excluded from the rule." - }, - "id": { - "type": "string", - "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." - }, - "source_id": { - "type": "string" - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY" - ], - "description": "Discount effect for an excluded resource." - } - } - } - }, - "included": { - "type": "array", - "description": "Defines which items are included in a discount.", - "items": { - "type": "object", - "description": "Defines the included item.", - "properties": { - "object": { - "type": "string", - "enum": [ - "product", - "sku", - "products_collection" - ], - "description": "The type of object being included in the rule." - }, - "id": { - "type": "string", - "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." - }, - "source_id": { - "type": "string" - }, - "strict": { - "type": "boolean" - }, - "effect": { - "type": "string", - "enum": [ - "APPLY_TO_EVERY", - "APPLY_TO_CHEAPEST", - "APPLY_TO_MOST_EXPENSIVE" - ], - "description": "Discount effect for an included resource." - }, - "quantity_limit": { - "type": "integer", - "description": "A limit on the number of units that at maximum can qualify for a discount. This property is present for an AMOUNT type discount when the effect is applied to ITEMS and each unit of matched products has the same discount value." - } - } - } - }, - "included_all": { - "type": "boolean", - "description": "Indicates whether all items are included in the discount." - } - } - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the validation rule was created in ISO 8601 format.", - "example": "2022-04-07T07:42:44.442Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "example": "2022-05-09T07:42:44.442Z", - "description": "Timestamp representing the date and time when the validation rule was updated in ISO 8601 format.", - "format": "date-time" - }, - "type": { - "type": "string", - "enum": [ - "basic", - "advanced", - "complex" - ], - "description": "Type of validation rule." - }, - "context_type": { - "type": "string", - "enum": [ - "earning_rule.order.paid", - "earning_rule.custom_event", - "earning_rule.customer.segment.entered", - "campaign.discount_coupons", - "campaign.discount_coupons.discount.apply_to_order", - "campaign.discount_coupons.discount.apply_to_items", - "campaign.discount_coupons.discount.apply_to_items_proportionally", - "campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity", - "campaign.discount_coupons.discount.fixed.apply_to_items", - "campaign.gift_vouchers", - "campaign.gift_vouchers.gift.apply_to_order", - "campaign.gift_vouchers.gift.apply_to_items", - "campaign.referral_program", - "campaign.referral_program.discount.apply_to_order", - "campaign.referral_program.discount.apply_to_items", - "campaign.referral_program.discount.apply_to_items_proportionally", - "campaign.referral_program.discount.apply_to_items_proportionally_by_quantity", - "campaign.referral_program.discount.fixed.apply_to_items", - "campaign.promotion", - "campaign.promotion.discount.apply_to_order", - "campaign.promotion.discount.apply_to_items", - "campaign.promotion.discount.apply_to_items_proportionally", - "campaign.promotion.discount.apply_to_items_proportionally_by_quantity", - "campaign.promotion.discount.fixed.apply_to_items", - "campaign.loyalty_program", - "campaign.lucky_draw", - "voucher.discount_voucher", - "voucher.discount_voucher.discount.apply_to_order", - "voucher.discount_voucher.discount.apply_to_items", - "voucher.discount_voucher.discount.apply_to_items_proportionally", - "voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity", - "voucher.discount_voucher.discount.fixed.apply_to_items", - "voucher.gift_voucher", - "voucher.gift_voucher.gift.apply_to_order", - "voucher.gift_voucher.gift.apply_to_items", - "voucher.loyalty_card", - "voucher.lucky_draw_code", - "distribution.custom_event", - "reward_assignment.pay_with_points", - "global" - ], - "description": "Validation rule context type. \n\n| **Context Type** | **Definition** |\n|:---|:---|\n| earning_rule.order.paid | |\n| earning_rule.custom_event | |\n| earning_rule.customer.segment.entered | |\n| campaign.discount_coupons | |\n| campaign.discount_coupons.discount.apply_to_order | |\n| campaign.discount_coupons.discount.apply_to_items | |\n| campaign.discount_coupons.discount.apply_to_items_proportionally | |\n| campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.discount_coupons.discount.fixed.apply_to_items | |\n| campaign.gift_vouchers | |\n| campaign.gift_vouchers.gift.apply_to_order | |\n| campaign.gift_vouchers.gift.apply_to_items | |\n| campaign.referral_program | |\n| campaign.referral_program.discount.apply_to_order | |\n| campaign.referral_program.discount.apply_to_items | |\n| campaign.referral_program.discount.apply_to_items_proportionally | |\n| campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.referral_program.discount.fixed.apply_to_items | |\n| campaign.promotion | |\n| campaign.promotion.discount.apply_to_order | |\n| campaign.promotion.discount.apply_to_items | |\n| campaign.promotion.discount.apply_to_items_proportionally | |\n| campaign.promotion.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.promotion.discount.fixed.apply_to_items | |\n| campaign.loyalty_program | |\n| campaign.lucky_draw | |\n| voucher.discount_voucher | |\n| voucher.discount_voucher.discount.apply_to_order | |\n| voucher.discount_voucher.discount.apply_to_items | |\n| voucher.discount_voucher.discount.apply_to_items_proportionally | |\n| voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | |\n| voucher.discount_voucher.discount.fixed.apply_to_items | |\n| voucher.gift_voucher | |\n| voucher.gift_voucher.gift.apply_to_order | |\n| voucher.gift_voucher.gift.apply_to_items | |\n| voucher.loyalty_card | |\n| voucher.lucky_draw_code | |\n| distribution.custom_event | |\n| reward_assignment.pay_with_points | |\n| global | |" - }, - "assignments_count": { - "description": "The number of instances the validation rule has been assigned to different types of redeemables.", - "type": "integer" - }, - "object": { - "type": "string", - "default": "validation_rules", - "description": "The type of object represented by each nested object in the JSON `data` array. This object stores information about the validation rules." - } - } + } + }, + "total": { + "type": "integer" + } + }, + "description": "Response body schema for `/loyalties/{campaignId}/tiers/{tierId}/earning-rules`.", + "title": "List Loyalty Tier Earning Rules" + }, + "8_res_loyalties_campaign_id_tiers_tier_id_rewards": { + "title": "List Loyalty Tier Rewards", + "type": "object", + "properties": { + "id": { + "type": "string" + } + }, + "description": "Response body schema for `/loyalties/{campaignId}/tiers/{tierId}/rewards`." + }, + "8_res_loyalties_campaign_id_reward-assignments_assignment_id": { + "type": "object", + "description": "Response body schema for `/loyalties/{campaignId}/reward-assignments/{assignmentId}`", + "title": "Get Reward Assignment", + "properties": { + "id": { + "type": "string", + "example": "rewa_hzc19a5NLyIr2bVL3UB1w0B3" + }, + "reward_id": { + "type": "string", + "example": "rew_JhjeISE1npQyxRmGV1JYohDP" + }, + "related_object_id": { + "type": "string", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + }, + "related_object_type": { + "type": "string", + "example": "campaign" + }, + "created_at": { + "type": "string", + "example": "2021-12-13T11:58:32.261Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2022-01-13T11:58:32.261Z", + "format": "date-time" + }, + "object": { + "type": "string", + "default": "reward_assignment" + } + } + }, + "8_res_loyalties_campaign_id_reward-assignments_assignment_id_reward": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + }, + "parameters": { + "type": "object", + "properties": { + "coin": { + "type": "object", + "properties": { + "exchange_ratio": { + "type": "number" + }, + "points_ratio": { + "type": "integer" } - }, - "total": { - "type": "integer", - "description": "Total number of validation rules in the project." } } - }, - "13_obj_validation_rule_assignment_object": { - "title": "Validation Rule Assignment Object", - "type": "object", - "description": "This is an object representing a validation rule assignment. \n\nThis object stores an assignment of a: \n- [voucher](ref:get-voucher)\n- [campaign](ref:get-campaign)\n- [earning rule](ref:get-earning-rule)\n- [reward assignment](ref:get-reward-assignment)\n- [promotion tier](ref:list-promotion-tiers)\n- [publication](ref:list-publications)", - "x-tags": [ - "VALIDATION RULES API" - ], - "properties": { - "id": { - "type": "string", - "example": "asgm_74F7QZoYbUoljwQO", - "description": "Validation rule assignment ID." - }, - "rule_id": { - "type": "string", - "example": "val_4j7DCRm2IS59", - "description": "Validation rule ID." - }, - "related_object_id": { - "type": "string", - "example": "v_JtWunK6jUo7X2qOFj0SyRHq4p9tgENlT", - "description": "The resource ID to which the validation rule was assigned." - }, - "related_object_type": { - "type": "string", - "description": "The type of resource to which the validation rule was assigned.", - "enum": [ - "voucher", - "campaign", - "earning_rule", - "reward_assignment", - "promotion_tier", - "distribution" - ] - }, - "created_at": { - "type": "string", - "example": "2022-02-17T08:18:15.085Z", - "description": "Timestamp representing the date and time when the validation rule assignment was created in ISO 8601 format.", - "format": "date-time" - }, - "object": { - "type": "string", - "default": "validation_rules_assignment", - "description": "The type of object represented by the ID." + } + }, + "stock": { + "type": "null" + }, + "redeemed": { + "type": "null" + }, + "attributes": { + "type": "object", + "properties": {} + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "null", + "format": "date-time" + }, + "object": { + "type": "string" + } + }, + "description": "Response body schema for `/loyalties/{campaignId}/reward-assignments/{assignmentId}/`", + "title": "Get Reward Details" + }, + "8_obj_export_object_points_expiration": { + "title": "Points Expirations Export Object", + "type": "object", + "description": "This is an object representing an export of points expirations. ", + "properties": { + "id": { + "type": "string", + "description": "Unique export ID.", + "example": "exp_FFfp9o7daWuJqJCKp5xqqli4" + }, + "object": { + "type": "string", + "default": "export", + "description": "The type of object being represented. This object stores information about the export." + }, + "created_at": { + "type": "string", + "example": "2022-04-28T11:23:20.922Z", + "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format.", + "format": "date-time" + }, + "status": { + "type": "string", + "description": "Status of the export. Informs you whether the export has already been completed.", + "enum": [ + "SCHEDULED", + "IN_PROGRESS", + "DONE", + "ERROR" + ] + }, + "channel": { + "type": "string", + "description": "The channel through which the export was triggered.", + "enum": [ + "API", + "WEBSITE" + ] + }, + "exported_object": { + "type": "string", + "description": "The type of exported object.", + "enum": [ + "points_expiration" + ] + }, + "parameters": { + "type": "object", + "description": "List of fields and filters that were passed in the request body to create the export.", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "expires_at", + "-expires_at" + ] + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data that was exported. These fields define the headers in the CSV file. \n\n The array can be a combination of any of the following available fields: \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n |\n| campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 |\n| status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` |\n| expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 |\n| points | Number of points. | 1000 |", + "items": { + "type": "string" } - } - }, - "13_res_validation-rules_validationRuleId_assignments": { - "type": "object", - "description": "Validation Rule Assignments", - "title": "Validation Rule Assignments", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about validation rule assignments.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the JSON property that contains the array of validation rule assignments.", - "default": "data" - }, - "data": { - "type": "array", - "description": "A dictionary that contains an array of validation rule assignments.", - "items": { - "$ref": "#/components/schemas/13_obj_validation_rule_assignment_object" + }, + "filters": { + "description": "Data filters used to narrow the data records to be returned in the export.", + "anyOf": [ + { + "$ref": "#/components/schemas/8_req_filter_campaign_id" + }, + { + "$ref": "#/components/schemas/8_req_filter_voucher_id" } - }, - "total": { - "type": "integer", - "description": "Total number of validation rule assignments." + ] + } + } + }, + "result": { + "type": "object", + "description": "Contains the URL of the CSV file.", + "properties": { + "url": { + "type": "string", + "description": "URL of the CSV file location." + } + } + }, + "user_id": { + "type": "string", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0Fr", + "description": " The user_id identifies the specific user who initiated the export through the Voucherify Dashboard; this `user_id` is returned when the channel value is `WEBSITE`." + } + } + }, + "8_req_export_points_expirations": { + "title": "Points Expirations Export Request Body", + "type": "object", + "description": "Request body schema for creating points expirations. ", + "properties": { + "parameters": { + "type": "object", + "description": "List of fields and filters that were passed in the request body to create the export.", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "expires_at", + "-expires_at" + ] + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data that was exported. These fields define the headers in the CSV file. \n\n The array can be a combintation of any of the following available fields: \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n |\n| campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 |\n| status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` |\n| expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 |\n| points | Number of points. | 1000 |", + "items": { + "type": "string" } + }, + "filters": { + "description": "Data filters used to narrow the data records to be returned in the export.", + "anyOf": [ + { + "$ref": "#/components/schemas/8_req_filter_campaign_id" + }, + { + "$ref": "#/components/schemas/8_req_filter_voucher_id" + } + ] } - }, - "13_req_create_validation_rule_assignments": { - "description": "Respone body schema for **POST** `/validation-rules/{validationRuleId}/assignments`.", - "title": "Create Validation Rule Assignments Request Body", - "oneOf": [ - { - "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_voucher" - }, - { - "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_campaign" - }, - { - "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_promotion_tier" - }, - { - "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_earning_rule" - }, - { - "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_reward" - }, - { - "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_distribution" + } + } + } + }, + "8_req_filter_campaign_id": { + "title": "Filter by campaign ID", + "type": "object", + "description": "Filter conditions set on the campaign ID.", + "properties": { + "campaign_id": { + "$ref": "#/components/schemas/8_req_filter_conditions" + }, + "junction": { + "type": "string", + "description": "Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `and` is an all-inclusive logical operator, meaning the `and` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `or` operator displays a record if **ANY** of the conditions separated by OR is TRUE.", + "enum": [ + "AND", + "OR" + ] + } + } + }, + "8_req_filter_voucher_id": { + "title": "Filter by voucher ID", + "type": "object", + "description": "Filter conditions set on the voucher ID.", + "properties": { + "voucher_id": { + "$ref": "#/components/schemas/8_req_filter_conditions" + }, + "junction": { + "type": "string", + "description": "Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `and` is an all-inclusive logical operator, meaning the `and` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `or` operator displays a record if **ANY** of the conditions separated by OR is TRUE.", + "enum": [ + "AND", + "OR" + ] + } + } + }, + "8_req_filter_junction": { + "title": "Filter by campaign ID", + "type": "object", + "description": "Filter conditions by campaign ID.", + "properties": { + "junction": { + "type": "string", + "description": "Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `and` is an all-inclusive logical operator, meaning the `and` operator displays a record if all the conditions separated by AND are TRUE, while an `or` operator displays a record if any of the conditions separated by OR is TRUE." + } + } + }, + "8_req_filter_conditions": { + "title": "Filter by conditions", + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "conditions": { + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "$in": { + "type": "array", + "description": "Array of resource values that should be included in the results.", + "items": { + "type": "string" } - ] - }, - "13_req_create_validation_rule_assignments_voucher": { - "type": "object", - "description": "Assign a validation rule to a voucher.", - "title": "Voucher", - "properties": { - "voucher": { - "type": "string", - "description": "Unique voucher ID or code to which you would like to assign the validation rule to.", - "example": "v_ssR6vhswwh5odSloN2Vc3O60w7aea018" + }, + "$not_in": { + "type": "array", + "description": "Array of resource values that should be included in the results.", + "items": { + "type": "string" } + }, + "$is": { + "type": "string", + "description": "Specify the exact resource value." + }, + "$is_not": { + "type": "string", + "description": "Results should omit this value." } + } + } + } + }, + "8_res_list_reward_assignments": { + "title": "List Reward Assignments", + "type": "object", + "description": "Response body schema for **GET** `/loyalties/{campaignId}/rewards`.", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about loyalty reward assignments in a dictionary.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of reward assignment objects.", + "default": "data" + }, + "data": { + "type": "array", + "description": "Contains array of reward assignment objects.", + "items": { + "$ref": "#/components/schemas/4_obj_reward_assignment_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of reward assignment objects." + } + } + }, + "8_res_list_loyalty_tiers": { + "title": "List Loyalty Tiers", + "type": "object", + "description": "Response body schema for listing loyalty tiers for a campaign using **GET** `/loyalties/{campaignId}/tiers`.", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of loyalty tier objects.", + "default": "data" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/8_obj_loyalty_tier_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of loyalty tier objects." + } + } + }, + "8_res_get_member_loyalty_tier": { + "title": "Get Member's Loyalty Tier Response Body", + "type": "object", + "description": "Response body schema for retrieving a member's loyalty tier for a campaign using **GET** `/loyalties/members/{memberId}/tiers`.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of loyalty tier objects." + }, + "data": { + "type": "array", + "description": "Contains array of loyalty tier objects.", + "items": { + "$ref": "#/components/schemas/8_obj_loyalty_tier_object_member" + } + }, + "total": { + "type": "integer", + "description": "Total number of loyalty tiers." + } + } + }, + "8_req_create_reward_assignment": { + "title": "Create Reward Assignment Request Body", + "type": "array", + "description": "Request body schema for **POST** `/loyalties/{campaignId}/rewards`.", + "items": { + "type": "object", + "properties": { + "reward": { + "type": "string", + "example": "rew_2yGflHThU2yJwFECEFKrXBI2", + "description": "Unique reward ID." }, - "13_req_create_validation_rule_assignments_campaign": { + "parameters": { "type": "object", - "description": "Assign a validation rule to a campaign.", - "title": "Campaign", + "description": "An object that defines the price of the reward in loyalty points.", "properties": { - "campaign": { - "type": "string", - "description": "Unique campaign ID or name to which you would like to assign the validation rule to.", - "example": "camp_HXsR22VUMC4hN4DR7eAhCalp" + "loyalty": { + "type": "object", + "description": "Stores the points parameter.", + "properties": { + "points": { + "type": "integer", + "description": "Defines how many points are required to obtain the reward." + } + } } } - }, - "13_req_create_validation_rule_assignments_promotion_tier": { - "type": "object", - "description": "Assign a validation rule to a promotion tier.", - "title": "Promotion Tier", - "properties": { - "promotion_tier": { - "type": "string", - "description": "Unique promotion tier ID to which you would like to assign the validation rule to.", - "example": "promo_Vet0vCNyyo5pOddHfu2X3FCB" + } + } + } + }, + "8_res_create_reward_assignment": { + "title": "Create Reward Assignment Response Body", + "type": "array", + "description": "Response body schema for **POST** `/loyalties/{campaignId}/rewards`.", + "items": { + "$ref": "#/components/schemas/4_obj_reward_assignment_object" + } + }, + "8_req_update_reward_assignment": { + "title": "Update Reward Assignment Request Body", + "type": "object", + "description": "Request body schema for **PUT** `/loyalties/{campaignId}/rewards/{assignmentId}`.", + "properties": { + "parameters": { + "type": "object", + "description": "An object that defines the price of the reward in loyalty points.", + "properties": { + "loyalty": { + "type": "object", + "description": "Stores the points parameter.", + "properties": { + "points": { + "type": "integer", + "description": "Defines how many points are required to obtain the reward." + } } } - }, - "13_req_create_validation_rule_assignments_earning_rule": { - "type": "object", - "description": "Assign a validation rule to an earning rule.", - "title": "Earning Rule", - "properties": { - "earning_rule": { - "type": "string", - "description": "Unique earning rule ID to which you would like to assign the validation rule to.", - "example": "ern_CfvQ4vWEKD4kHTxghdY8YJGs" - } + } + } + } + }, + "8_res_list_loyalty_tier_earning_rules": { + "title": "List Loyalty Tier Earning Rules", + "type": "object", + "description": "Response body schema for `/loyalties/{campaignId}/tiers/{tierId}/earning-rules`.", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about loyalty tier earning rules in a dictionary." + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of loyalty tier earning rule objects." + }, + "data": { + "type": "array", + "description": "Contains array of loyalty tier earning rules.", + "items": { + "$ref": "#/components/schemas/8_obj_earning_rule_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of earning rule objects." + } + } + }, + "8_res_list_loyalty_tier_rewards": { + "title": "List Loyalty Tier Rewards", + "type": "object", + "description": "Response schema for `/loyalties/{campaignId}/tiers/{tierId}/rewards`.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about loyalty tier rewards in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of loyalty tier reward objects." + }, + "data": { + "type": "array", + "description": "Contains array of loyalty tier reward objects.", + "items": { + "$ref": "#/components/schemas/8_obj_loyalty_tier_reward_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of loyalty tier reward objects." + } + } + }, + "8_res_list_members": { + "title": "List Members", + "type": "object", + "description": "Response body schema for **GET** `/loyalties/{campaignId}/members`.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about members in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "vouchers", + "description": "Identifies the name of the attribute that contains the array of voucher objects." + }, + "vouchers": { + "type": "array", + "description": "Contains array of voucher objects representing loyalty cards, in other words, loyalty program members.", + "items": { + "$ref": "#/components/schemas/8_obj_loyalty_card_object_non_expanded_categories" + } + }, + "total": { + "type": "integer", + "description": "Total number of voucher objects." + } + } + }, + "8_req_add_member": { + "title": "Add Member Request Body", + "type": "object", + "description": "Request body schema for assigning a loyalty card to a customer using **POST** `/loyalties/{campaignId}/members`.", + "properties": { + "voucher": { + "type": "string", + "description": "Specify the loyalty card code that you would like to publish to a customer." + }, + "channel": { + "type": "string", + "description": "Specify the distribution channel." + }, + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/8_req_customer_id_string" + }, + { + "$ref": "#/components/schemas/8_req_customer_id" + }, + { + "$ref": "#/components/schemas/8_req_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" } - }, - "13_req_create_validation_rule_assignments_reward": { - "type": "object", - "description": "Assign a validation rule to a reward.", - "title": "Reward", - "properties": { - "related_object_id": { - "type": "string", - "description": "Unique reward assignment ID, i.e. rewa_6VSWcXjfm5PuZlfeuZxl5JZT. This is the first parameter to be sent for a validation rule assignment to be assigned to a reward assignment. The prerequisites for assigning a validation rule to a reward assignment are: \n1. Define a loyalty campaign. \n2. Connect a reward with the campaign. \n3. Retrieve a reward assignment ID for the reward assigned to the loyalty campaign. \n4. And finally you can use this endpoint to assign a validation rule to the particular reward assignment.", - "example": "rewa_6VSWcXjfm5PuZlfeuZxl5JZT" + ], + "description": "Customer's information." + }, + "metadata": { + "type": "string", + "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format." + } + } + }, + "8_req_customer_id": { + "title": "Customer ID", + "description": "You can pass the unique customer ID that was assigned by Voucherify.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of an existing customer." + } + } + }, + "8_req_customer_id_string": { + "title": "Customer ID", + "description": "You can pass the unique customer ID that was assigned by Voucherify or the source ID.", + "type": "string" + }, + "8_req_customer_source_id": { + "title": "Customer Source ID", + "description": "You can send the source ID that you used to create the customer in Voucherify.", + "type": "object", + "properties": { + "source_id": { + "type": "string", + "description": "A unique identifier of a customer. It can be a customer ID or email from a CRM system, database or 3rd-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored." + } + } + }, + "8_res_get_member_activities": { + "title": "Get Member Activities", + "type": "object", + "description": "Response body schema for retrieving member activities.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about member activities in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "activities", + "description": "Identifies the name of the attribute that contains the array of event objects." + }, + "activities": { + "type": "array", + "description": "Contains array of event objects.", + "items": {} + }, + "total": { + "type": "integer", + "description": "Total number of event objects." + } + } + }, + "8_res_list_member_rewards": { + "title": "List Member Rewards", + "type": "object", + "description": "Response body schema for `/loyalties/members/{memberId}/rewards`.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about member rewards in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of loyalty reward objects." + }, + "data": { + "type": "array", + "description": "Contains array of loyalty reward objects.", + "items": { + "$ref": "#/components/schemas/8_obj_loyalty_reward_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of loyalty reward objects." + } + } + }, + "8_res_get_points_expiration": { + "title": "Get Points Expiration Response Body", + "type": "object", + "description": "Response body schema for `/loyalties/{campaignId}/members/{memberId}/points-expiration`.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about loyalty points expiration buckets in a dictionary." + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of loyalty points expiration bucket objects.", + "default": "data" + }, + "data": { + "type": "array", + "description": "Contains array of loyalty points expiration buckets.", + "items": { + "$ref": "#/components/schemas/8_obj_loyalty_points_bucket" + } + }, + "total": { + "type": "integer", + "description": "Total number of point expiration buckets." + } + } + }, + "9_req_create_customer": { + "type": "object", + "title": "Customer", + "description": "This is an object containing information about the customer.", + "properties": { + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service. \n\nPlease note that if you would like your data to sync based on the `source_id` of the customer, you need to define the `source_id` upfront. You will not be able to change or update the `source_id` later on." + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a customer object." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "phone": { + "type": "string", + "description": "Customer's phone number. This parameter is mandatory when you try to send out codes to customers via an SMS channel." + }, + "address": { + "type": "object", + "description": "Customer's address.", + "properties": { + "city": { + "type": "string", + "description": "City" + }, + "state": { + "type": "string", + "description": "State" + }, + "line_1": { + "type": "string", + "description": "First line of address." + }, + "line_2": { + "type": "string", + "description": "Second line of address." + }, + "country": { + "type": "string", + "description": "Country." + }, + "postal_code": { + "type": "string", + "description": "Postal code." + } + } + }, + "birthdate": { + "type": "string", + "description": "Customer's birthdate; format `YYYY-MM-DD`.", + "format": "date" + }, + "birthday": { + "type": "string", + "description": "Customer's birthdate; format `YYYY-MM-DD`.", + "format": "date" + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. " + } + } + }, + "9_req_update_customer": { + "type": "object", + "title": "Customer object", + "description": "This is an object containing information about the customer.", + "properties": { + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a customer object." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "phone": { + "type": "string", + "description": "Customer's phone number." + }, + "address": { + "type": "object", + "description": "Customer's address.", + "properties": { + "city": { + "type": "string", + "description": "City" + }, + "state": { + "type": "string", + "description": "State" + }, + "line_1": { + "type": "string", + "description": "First line of address." + }, + "line_2": { + "type": "string", + "description": "Second line of address." + }, + "country": { + "type": "string", + "description": "Country." + }, + "postal_code": { + "type": "string", + "description": "Postal code." + } + } + }, + "birthdate": { + "type": "string", + "description": "Customer's birthdate; format `YYYY-MM-DD`.", + "format": "date" + }, + "birthday": { + "type": "string", + "description": "Customer's birthdate; format `YYYY-MM-DD`.", + "format": "date" + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. " + } + } + }, + "9_obj_customer_object": { + "type": "object", + "description": "This is an object representing a customer. \n\nThis entity allows you to:\n* store customer details in Voucherify\n* link [redemptions](ref:list-redemptions) and [validations](ref:validate-voucher) to a particular customer\n* build customer segments and use them in validation rules. ", + "title": "Customer Object", + "examples": [ + { + "id": "cust_4vMj8Twr5nBzvTrNCgipMb6M", + "source_id": "08dd9b5a", + "name": "Bob Smith", + "email": "bob.smith@email.com", + "address": { + "city": "New York", + "state": "NY", + "line_1": "678 Main St", + "line_2": null, + "country": "USA", + "postal_code": "10001" + }, + "summary": { + "redemptions": { + "total_redeemed": 5, + "total_failed": 0, + "total_succeeded": 5, + "total_rolled_back": 0, + "total_rollback_failed": 0, + "total_rollback_succeeded": 0, + "gift": { + "redeemed_amount": 0, + "amount_to_go": 0 }, - "related_object_type": { - "type": "string", - "description": "This is the second parameter that needs to be sent in order to properly assign a validation rule to a reward assignment.", - "example": "reward_assignment", - "default": "reward_assignment", - "enum": [ - "reward_assignment" - ] + "loyalty_card": { + "redeemed_points": 0, + "points_to_go": 830 } + }, + "orders": { + "total_amount": 94600, + "total_count": 5, + "average_amount": 18920, + "last_order_amount": 27500, + "last_order_date": "2022-09-15T11:11:36.630Z" } }, - "13_req_create_validation_rule_assignments_distribution": { - "type": "object", - "description": "Assign a validation rule to a distribution.", - "title": "Distribution", - "properties": { - "distribution": { - "type": "string", - "description": "Unique distribution ID to which you would like to assign the validation rule to.", - "example": "distr_2nUIekYnS9L1Vm1I55vmC7kSvd" + "loyalty": { + "points": 830, + "referred_customers": 0, + "campaigns": { + "Loyalty Campaign - Webinar": { + "points": 830, + "referred_customers": 0 } } }, - "14_obj_segment_object": { - "title": "Customer Segment Object", - "type": "object", - "properties": { - "id": { - "type": "string", - "example": "seg_1wc52c5z6r1kQ81brO8j9Hk2", - "description": "Unique segment ID." - }, - "name": { - "type": "string", - "description": "Segment name." - }, - "created_at": { - "type": "string", - "example": "2022-05-12T13:01:56.896Z", - "description": "Timestamp representing the date and time when the segment was created in ISO 8601 format.", - "format": "date-time" - }, - "type": { - "type": "string", - "enum": [ - "auto-update", - "static" - ], - "description": "Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers)." - }, - "filter": { - "type": [ - "object", - "null" - ], - "description": "Defines a set of criteria for an `auto-update` segment type. " - }, - "initial_sync_status": { - "type": "string", - "enum": [ - "IN_PROGRESS", - "DONE" - ] - }, - "object": { - "type": "string", - "default": "segment", - "description": "The type of object represented by JSON. This object stores information about the customer segment." - } - }, - "description": "This is an object representing a customer segment.", - "x-tags": [ - "SEGMENTS API" - ] + "referrals": { + "total": 0, + "campaigns": [] }, - "14_req_create_segment": { - "title": "Create Customer Segment Request Body", - "description": "Request body schema for **POST** `/segments`.", - "oneOf": [ - { - "$ref": "#/components/schemas/14_req_create_segment_static" - }, - { - "$ref": "#/components/schemas/14_req_create_segment_dynamic" - } - ] + "metadata": { + "age": 24, + "loyalty_customer": "true", + "acquisition_channel": "Facebook" }, - "14_req_create_segment_static": { - "title": "Static Customer Segment", - "type": "object", - "description": "Request body schema for creating a static customer segment in **POST** `/segments`.", - "properties": { - "name": { - "type": "string", - "description": "Segment name." - }, - "type": { - "type": "string", - "description": "Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers).", - "default": "static" - }, - "customers": { - "type": "array", - "description": "Array of customer IDs.", - "items": {} + "system_metadata": { + "consents": { + "cnst_lbgOBhHTuDrB7sjIhFjvIALj": { + "date": "2022-11-22T15:48:50.219Z", + "value": true } } }, - "14_req_create_segment_dynamic": { - "title": "Dynamic Customer Segment", - "type": "object", - "description": "Request body schema for creating a dynamic customer segment in **POST** `/segments`.", - "properties": { - "name": { - "type": "string", - "description": "Segment name." - }, - "type": { - "type": "string", - "description": "Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers).", - "default": "auto-update" - }, - "filter": { - "type": "object", - "description": "Defines a set of criteria for an `auto-update` segment type." + "created_at": "2022-09-15T10:33:46.388Z", + "updated_at": "2022-11-22T15:48:50.220Z", + "assets": { + "cockpit_url": "https://cockpits.voucherify.io/customers?token=U2FsdGVkX186yavyLJyykWa9KfhE1J850qWbQ1B%2BjKBZ0wrIzBNaW1WR6tNZo71Y5oTWG6PYpI9BpXDSnzz7CRfQ3lu7M151btz2vlYVxbd2eHNOjTFEwTbD8wK4moLONgtTlPM8ze42nmutFk5GUBepUEhxHRfbk8zekWqWvo8%2FbnAJsPl2rxYyaggwXQDj" + }, + "object": "customer" + } + ], + "x-tags": [ + "CUSTOMERS API" + ], + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_CSnYd37MXmrbS19XCrghjBsv" + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It is externally defined. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a customer object." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "phone": { + "type": "string", + "description": "Customer's phone number." + }, + "birthdate": { + "type": "string", + "description": "Customer's birthdate." + }, + "birthday": { + "type": "string", + "description": "Customer's birthday." + }, + "address": { + "type": "object", + "description": "Customer's address.", + "properties": { + "city": { + "type": "string", + "description": "City" + }, + "state": { + "type": "string", + "description": "State" + }, + "line_1": { + "type": "string", + "description": "First line of address." + }, + "line_2": { + "type": "string", + "description": "Second line of address." + }, + "country": { + "type": "string", + "description": "Country." + }, + "postal_code": { + "type": "string", + "description": "Postal code." + } + } + }, + "summary": { + "type": "object", + "description": "Contains a summary of customer's redemption and order statistics.", + "properties": { + "redemptions": { + "type": "object", + "description": "Customer's redemptions statistics.", + "properties": { + "total_redeemed": { + "type": "integer", + "description": "Total number of redemptions made by the customer." + }, + "total_failed": { + "type": "integer", + "description": "Total number of redemptions that failed." + }, + "total_succeeded": { + "type": "integer", + "description": "Total number of redemptions that succeeded." + }, + "total_rolled_back": { + "type": "integer", + "description": "Total number of redemptions that were rolled back for the customer." + }, + "total_rollback_failed": { + "type": "integer", + "description": "Total number of redemption rollbacks that failed." + }, + "total_rollback_succeeded": { + "type": "integer", + "description": "Total number of redemption rollbacks that succeeded." + }, + "gift": { + "type": "object", + "description": "Summary of gift card credits.", + "properties": { + "redeemed_amount": { + "type": "integer", + "description": "Total amount of gift card credits redeemed by customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "amount_to_go": { + "type": "integer", + "description": "Remaining gift card balance across all gift cards. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + }, + "loyalty_card": { + "type": "object", + "description": "Summary of loyalty points.", + "properties": { + "redeemed_points": { + "type": "integer", + "description": "Total number of loyalty points redeemed by the customer." + }, + "points_to_go": { + "type": "integer", + "description": "Sum of remaining available point balance across all loyalty cards." + } + } + } + } + }, + "orders": { + "type": "object", + "description": "Customer's order statistics.", + "properties": { + "total_amount": { + "type": "integer", + "description": "The total amount spent by the customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "total_count": { + "type": "integer", + "description": "Total number of orders made by the customer." + }, + "average_amount": { + "type": "integer", + "description": "Average amount spent on orders. `total_amount` ÷ `total_count`. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "last_order_amount": { + "type": "integer", + "description": "Amount spent on last order. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "last_order_date": { + "type": "string", + "format": "date-time", + "example": "2022-08-30T11:51:08.029Z", + "description": "Timestamp representing the date and time of the customer's last order in ISO 8601 format." + } } } - }, - "14_res_customers_customerId_segments": { - "type": "object", - "title": "List Segments for Customer Response Body", - "description": "Response body schema for `/customers/{customerId}/segments`.", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about customer segments.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the JSON property that contains the array of segment IDs.", - "default": "data" - }, - "data": { - "type": "array", - "description": "A dictionary that contains an array of segment IDs and names.", - "items": { + } + }, + "loyalty": { + "type": "object", + "description": "Summary of customer's loyalty information.", + "properties": { + "points": { + "type": "integer", + "description": "Sum of remaining available point balance across all loyalty cards." + }, + "referred_customers": { + "type": "integer", + "description": "Total number of customers referred by the customer." + }, + "campaigns": { + "type": "object", + "description": "Contains campaigns with details about point balances and how many customers were referred by the customer.", + "properties": { + "campaign_name": { "type": "object", + "description": "Contains details about the point balances left on loyalty cards and the number of referred customers in each campaign.", "properties": { - "id": { - "type": "string", - "description": "Unique segment ID.", - "example": "seg_DNAOhUtJffvX0f57ajLMFBYR" + "points": { + "type": "integer", + "description": "Remaining point balance in campaign." }, - "name": { + "loyalty_tier": { "type": "string", - "description": "Segment name." + "example": "ltr_UJ5Q54Q0OvEhua87Qfv2Ki5x", + "description": "Customer's loyalty tier within the campaign." }, - "object": { - "type": "string", - "description": "The type of object represented by the ID.", - "default": "segment" + "referred_customers": { + "type": "integer", + "description": "Number of customers referred by the customer in campaign." } } } - }, - "total": { - "type": "integer", - "description": "Total number of segments the customer belongs to." } } - }, - "15_obj_event_object": { - "title": "Event Object", - "type": "object", - "description": "This is an object representing an event. \n\nVoucherify distinguishes two types of events - custom and internal. Both are presented in the same Event structure. \n\n## Custom Events\n\nCustom Events are actions taken by your customers. They’re best suited for tracking high-value customer interactions with your application. Logging a custom event can trigger any number of distributions, and enables the segmentation filters around the recency and frequency of that event.\n\nWith Custom Event metadata field, Voucherify allows you to set properties on custom events. These properties can then be used for further qualifying trigger conditions, increasing personalization in messaging, and generating more sophisticated analytics through raw data export.\n\nThe Custom Events are directly linked to the customers' resources from Voucherify. It means that each event gets a connection to a customer. \n\n\n> #### An example \n>\n> If an e-commerce application wanted to send a message to a user when he/she abandons their cart, the custom event could additionally improve its target audience and allow for increased distribution personalization by adding a Custom Event of the `value` of customers’ order.\n\n## Internal Voucherify Events \n\nMoreover, Events are our way of letting you know when something interesting happens in your project. When an interesting event occurs, we create a new Event object. For example, when a redemption succeeds, we create a `redemption.succeeded` event.\n\nNote that many API requests may cause multiple events to be created. For example, if you create a new redemption for a new customer not existing yet in Voucherify, you will receive both a `customer.created` event and a `redemption.succeeded` event.\n\nThe events occur when the state of another API resource changes and the state of that resource at the time of the change is embedded in the data field of the event. \n\n| **Types of internal events** |\n|:---|\n| **Campaign** |\n| campaign.validation_rules.created
                  campaign.created
                  campaign.disabled
                  campaign.export_mailchimp_scheduled
                  campaign.export_mailchimp_done
                  campaign.validation_rules.deleted
                  campaign.validation_rules.updated
                  campaign.updated
                  campaign.deleted
                  campaign.export_mailchimp_failed
                  campaign.enabled |\n| **Voucher** |\n| voucher.validation.succeeded
                  voucher.updated
                  voucher.enabled
                  voucher.gift.balance_added
                  voucher.validation_rules.updated
                  voucher.published
                  voucher.validation_rules.deleted
                  voucher.disabled
                  voucher.validation.failed
                  voucher.validation_rules.created
                  voucher.deleted
                  voucher.created |\n| **Redemption** |\n| redemption.succeeded
                  redemption.failed
                  redemption.rollback.failed
                  redemption.rollback.succeeded |\n| **Customer** |\n| customer.rewarded
                  customer.rewarded.loyalty_points
                  customer.sms.sent
                  customer.email.failed
                  customer.deleted
                  customer.created
                  customer.updated
                  customer.segment.left
                  customer.sms.failed
                  customer.segment.entered
                  customer.email.sent |\n| **Order** |\n| order.canceled
                  order.created
                  order.updated
                  order.paid |\n| **Product** |\n| product.updated
                  product.created
                  product.deleted |\n| **SKU** |\n| sku.updated
                  sku.created
                  sku.deleted |\n| **Distribution** |\n| distribution.sms.failed
                  distribution.sms.sent
                  distribution.email.sent
                  distribution.email.failed |\n| **Export** |\n| export.done
                  export.scheduled
                  export.failed
                  export.deleted | \n\n## Webhooks \n\nVoucherify also has a separate system for sending the event objects directly to an endpoint at your end (server). We called that mechanism webhooks. They are managed in your project settings. \n\n| **Attribute** | **Description** | **Example** |\n|:---|:---|:---|\n| `id`
                  string | | event_xjGas2mI2PduFFPL2NAcFeHkHfLn3H |\n| `object`
                  string | Type of the object represented by JSON. Value is `event`. | |\n| `created_at`
                  string, ISO 8601 date format | Time at which the object was created. | 2016-11-16T14:14:31Z |\n| `type`
                  string | Description of the event | view_pricing_page
                  redemption.succeeded |\n| `data.object`
                  object | The object containing data associated with the event. It can be a `customer`, `redemption` or any other type of object which is a source of the event. In this object structure, you can also find a property `related_object` which contains values presenting any other resource connected to the event.

                  For Custom Event the structure of child attributes is constant:

                  - customer (`object`) - The object presenting a profile of the related customer who performed an action.

                  - metadata (`object`) - A set of key/value pairs that you can attach to a custom event object. It can be useful for storing additional information about the event in a structured format. | \"data\": { \"object\": { \"customer\": { \"id\": \"cust_OtHDKrv5sJrjd8aYBYZ6AOIF\", \"name\": \"Gustav Purpleson\", \"object\": \"customer\", \"source_id\": \"gustav@purpleson.com\", \"created_at\": 1510834859417, \"updated_at\": 1510835106559 }, \"metadata\": { \"lang\": \"en\", \"test\": true, \"page\": \"http://main.io\" } } } |\n| `metadata`
                  object | A set of key/value pairs that Voucherify attaches to a custom event object. It is a set of additional system information about the event in a structured format. | |\n\n\n```json\n{\n \"id\": \"event_ehkvgZFgSePlb95SH3JJulkApy9Kg9\",\n \"object\": \"event\",\n \"created_at\": \"2017-11-16T14:45:34.181Z\",\n \"type\": \"redemption.succeeded\",\n \"data\": {\n \"object\": {\n \"id\": \"r_mist0IpebikTaRdxiOGI2IhL\",\n \"date\": \"2017-11-16T14:45:32.733Z\",\n \"order\": {\n \"id\": \"ord_AhDlR13vQE5ino95P2NIABBN\",\n \"items\": [\n {\n \"object\": \"order_item\",\n \"sku_id\": null,\n \"quantity\": 1,\n \"source_id\": null,\n \"product_id\": \"iphone8\"\n }\n ],\n \"amount\": 50000,\n \"object\": \"order\",\n \"status\": \"CREATED\",\n \"customer\": {\n \"id\": \"cust_fJPsoub5ITJnIEVO3v9whrP9\",\n \"object\": \"customer\"\n },\n \"metadata\": null,\n \"referrer\": null,\n \"source_id\": null,\n \"created_at\": \"2017-11-16T14:45:32.023Z\",\n \"updated_at\": null,\n \"discount_amount\": 2000\n },\n \"object\": \"redemption\",\n \"result\": \"SUCCESS\",\n \"voucher\": {\n \"code\": \"2017-goX-aH\",\n \"gift\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"object\": \"voucher\",\n \"campaign\": \"SteffenTest\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"amount_off\": 2000\n },\n \"is_referral_code\": false\n },\n \"customer\": {\n \"id\": \"cust_fJPsoub5ITJnIEVO3v9whrP9\",\n \"object\": \"customer\"\n },\n \"metadata\": {\n \"city\": \"London1\"\n },\n \"customer_id\": \"cust_fJPsoub5ITJnIEVO3v9whrP9\",\n \"tracking_id\": \"track_3tM7KR57bbeIRtMcvpKYr2aAOrCpYBDZ\",\n \"related_object_type\": \"voucher\"\n },\n \"previous_attributes\": {}\n },\n \"metadata\": {\n \"source\": \"API\"\n }\n}\n```\n\n## Customisable Campaign Events \n\nAs part of campaign creation, users can configure webhooks triggered when specific activities appear within a campaign's lifetime. Those webhooks get configurable names and the users implement them in Voucherify Dashboard as part of the campaign creation process.\n\nThis type of webhooks can be configured for the following actions: \n\n| **Action** |\n|:---|\n| **Referral Program** |\n| Referrer rewarded
                  Referral code assigned
                  Customer referred |\n| **Loyalty Campaign** |\n| Loyalty card assigned
                  Points earned
                  Points redeemed | \n\nPayloads of customizable webhooks:\n\n### Referral Program\n\n\n```json\n{\n \"id\": \"evcus_0a26b1a5acd3437894\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-01-24T11:09:57.765Z\",\n \"type\": \"referral_code_assigned\",\n \"data\": {\n \"object\": {\n \"voucher\": {\n \"id\": \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\",\n \"code\": \"xYwEheRh\",\n \"campaign\": \"Referral Webhooks\",\n \"campaign_id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"category\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"amount_off\": 1000,\n \"effect\": \"APPLY_TO_ORDER\"\n },\n \"gift\": null,\n \"loyalty_card\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX19wsHlNj5GT/2Kkf/MnPKlL4WjU55GyTsmpXgw+KQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy/OHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va+MFPSHRy5tesDQ==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19wsHlNj5GT%2F2Kkf%2FMnPKlL4WjU55GyTsmpXgw%2BKQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy%2FOHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va%2BMFPSHRy5tesDQ%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19ZgrgURtgcjD1cvt/L6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i/UVUbmXTxDvNXsceP+nzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19ZgrgURtgcjD1cvt%2FL6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i%2FUVUbmXTxDvNXsceP%2BnzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w%3D%3D\"\n }\n },\n \"is_referral_code\": true,\n \"created_at\": \"2021-11-12T11:09:57.772Z\",\n \"updated_at\": null,\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"referrer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/xYwEheRh/redemptions?page=1&limit=10\"\n },\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/xYwEheRh/publications?page=1&limit=10\"\n },\n \"object\": \"voucher\"\n },\n \"campaign\": {\n \"id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"name\": \"Referral Webhooks\",\n \"campaign_type\": \"REFERRAL_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"voucher\": {\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"amount_off\": 1000,\n \"effect\": \"APPLY_TO_ORDER\"\n },\n \"gift\": null,\n \"loyalty_card\": null,\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"prefix\": \"\",\n \"postfix\": \"\"\n },\n \"is_referral_code\": true\n },\n \"referral_program\": {\n \"conversion_event_type\": \"redemption\"\n },\n \"join_once\": false,\n \"use_voucher_metadata_schema\": true,\n \"vouchers_count\": 1,\n \"active\": true,\n \"metadata\": {},\n \"created_at\": \"2021-11-12T11:00:08.306Z\",\n \"updated_at\": \"2021-11-12T11:09:40.671Z\",\n \"creation_status\": \"DONE\",\n \"vouchers_generation_status\": \"DONE\",\n \"object\": \"campaign\"\n },\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"source_id\": \"test_referrer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0\n },\n \"orders\": {\n \"total_amount\": 0,\n \"total_count\": 0,\n \"average_amount\": null,\n \"last_order_amount\": null,\n \"last_order_date\": null\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 0,\n \"campaigns\": {}\n },\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-11-12T11:09:57.749Z\",\n \"updated_at\": \"2021-11-12T11:09:58.620Z\",\n \"object\": \"customer\"\n },\n \"publication\": {\n \"id\": \"pub_gSpZUNX0hcDfEeRx3qIMMFrtfsZjeJO8\",\n \"object\": \"publication\",\n \"result\": \"SUCCESS\",\n \"channel\": \"API\",\n \"voucher\": {\n \"id\": \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\",\n \"code\": \"xYwEheRh\",\n \"gift\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"active\": true,\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX19wsHlNj5GT/2Kkf/MnPKlL4WjU55GyTsmpXgw+KQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy/OHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va+MFPSHRy5tesDQ==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19wsHlNj5GT%2F2Kkf%2FMnPKlL4WjU55GyTsmpXgw%2BKQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy%2FOHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va%2BMFPSHRy5tesDQ%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19ZgrgURtgcjD1cvt/L6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i/UVUbmXTxDvNXsceP+nzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19ZgrgURtgcjD1cvt%2FL6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i%2FUVUbmXTxDvNXsceP%2BnzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w%3D%3D\"\n }\n },\n \"object\": \"voucher\",\n \"publish\": {\n \"url\": \"/v1/vouchers/xYwEheRh/publications?page=1&limit=10\",\n \"count\": 1,\n \"object\": \"list\"\n },\n \"campaign\": \"Referral Webhooks\",\n \"category\": null,\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"metadata\": {},\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"created_at\": \"2021-11-12T11:09:57.772Z\",\n \"redemption\": {\n \"url\": \"/v1/vouchers/xYwEheRh/redemptions?page=1&limit=10\",\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"start_date\": null,\n \"updated_at\": null,\n \"campaign_id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"referrer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"loyalty_card\": null,\n \"distributions\": null,\n \"additional_info\": null,\n \"expiration_date\": null,\n \"is_referral_code\": true,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"referred_customers_count\": null,\n \"value\": \"$10.00\"\n },\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"object\": \"customer\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"source_id\": \"test_referrer__01\"\n },\n \"metadata\": {},\n \"source_id\": null,\n \"created_at\": \"2021-11-12T11:09:57.765Z\",\n \"customer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"tracking_id\": \"test_referrer__01\",\n \"vouchers_id\": [\n \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\"\n ]\n }\n },\n \"related_object\": {\n \"id\": \"evcus_0a26b1a5acd3437894\",\n \"type\": \"customer.publication.succeeded\",\n \"data\": {\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"test_referrer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"campaign\": {\n \"id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"name\": \"Referral Webhooks\",\n \"campaign_type\": \"REFERRAL_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"is_referral_code\": true,\n \"voucher\": {\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n }\n },\n \"referral_program\": {\n \"conversion_event_type\": \"redemption\"\n },\n \"auto_join\": null,\n \"join_once\": false,\n \"active\": true\n },\n \"publication\": {\n \"id\": \"pub_gSpZUNX0hcDfEeRx3qIMMFrtfsZjeJO8\",\n \"object\": \"publication\",\n \"result\": \"SUCCESS\",\n \"channel\": \"API\",\n \"voucher\": {\n \"id\": \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\",\n \"code\": \"xYwEheRh\",\n \"gift\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"active\": true,\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX19wsHlNj5GT/2Kkf/MnPKlL4WjU55GyTsmpXgw+KQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy/OHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va+MFPSHRy5tesDQ==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19wsHlNj5GT%2F2Kkf%2FMnPKlL4WjU55GyTsmpXgw%2BKQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy%2FOHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va%2BMFPSHRy5tesDQ%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19ZgrgURtgcjD1cvt/L6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i/UVUbmXTxDvNXsceP+nzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19ZgrgURtgcjD1cvt%2FL6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i%2FUVUbmXTxDvNXsceP%2BnzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w%3D%3D\"\n }\n },\n \"object\": \"voucher\",\n \"publish\": {\n \"url\": \"/v1/vouchers/xYwEheRh/publications?page=1&limit=10\",\n \"count\": 1,\n \"object\": \"list\"\n },\n \"campaign\": \"Referral Webhooks\",\n \"category\": null,\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"metadata\": {},\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"created_at\": \"2021-11-12T11:09:57.772Z\",\n \"redemption\": {\n \"url\": \"/v1/vouchers/xYwEheRh/redemptions?page=1&limit=10\",\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"start_date\": null,\n \"updated_at\": null,\n \"campaign_id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"referrer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"loyalty_card\": null,\n \"distributions\": null,\n \"additional_info\": null,\n \"expiration_date\": null,\n \"is_referral_code\": true,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"referred_customers_count\": null\n },\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"object\": \"customer\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"source_id\": \"test_referrer__01\"\n },\n \"metadata\": {},\n \"source_id\": null,\n \"created_at\": \"2021-11-12T11:09:57.765Z\",\n \"customer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"tracking_id\": \"test_referrer__01\",\n \"vouchers_id\": [\n \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\"\n ]\n }\n },\n \"created_at\": \"2021-11-12T11:09:57.765Z\"\n }\n },\n \"metadata\": {}\n}\n```\n\n```json\n{\n \"id\": \"evcus_0a26b3e7b718c480ca\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-01-24T11:19:49.723Z\",\n \"type\": \"referrer_rewarded_webhook\",\n \"data\": {\n \"object\": {\n \"voucher\": {\n \"id\": \"v_2teI9HcRvdvK1RsWD6gyNztHr4SMkMDy\",\n \"code\": \"dOzJ84Ky\",\n \"campaign\": \"Bonus Cards\",\n \"campaign_id\": \"camp_yheSCBQGrgeBwGMkQqjsUW24\",\n \"category\": null,\n \"type\": \"GIFT_VOUCHER\",\n \"discount\": null,\n \"gift\": {\n \"amount\": 500,\n \"balance\": 500\n },\n \"loyalty_card\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX1+tdyBGQeM+ZONM/k\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1+tdyBGQeM+ZONM/k\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1+WOEBHpX4y\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BWOEBHpX4y\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-01-24T11:19:40.409Z\",\n \"updated_at\": \"2021-01-24T11:19:41.518Z\",\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"redemption\": {\n \"quantity\": 1,\n \"redeemed_quantity\": 0,\n \"redeemed_amount\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/dOzJ84Ky/redemptions?page=1&limit=10\"\n },\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/dOzJ84Ky/publications?page=1&limit=10\"\n },\n \"object\": \"voucher\"\n },\n \"campaign\": {\n \"id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"name\": \"Referral Webhooks\",\n \"campaign_type\": \"REFERRAL_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"voucher\": {\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n },\n \"is_referral_code\": true\n },\n \"referral_program\": {\n \"conversion_event_type\": \"redemption\"\n },\n \"join_once\": false,\n \"vouchers_count\": 0,\n \"active\": true,\n \"object\": \"campaign\"\n },\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"source_id\": \"test_referrer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0\n },\n \"orders\": {\n \"total_amount\": 0,\n \"total_count\": 0,\n \"average_amount\": null,\n \"last_order_amount\": null\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 1,\n \"campaigns\": {\n \"Referral Webhooks\": {\n \"points\": 0,\n \"referred_customers\": 1\n }\n }\n },\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-01-24T11:09:57.749Z\",\n \"updated_at\": \"2021-01-24T11:19:41.513Z\",\n \"object\": \"customer\"\n },\n \"publication\": {\n \"id\": \"pub_9Y7nwUx3BaU3cHqBVbd0TEtS2ENiFZhJ\",\n \"created_at\": \"2021-01-24T11:19:40.317Z\",\n \"customer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"test_referrer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"tracking_id\": \"test_referrer__01\",\n \"metadata\": {},\n \"channel\": \"Automation\",\n \"source_id\": null,\n \"result\": \"SUCCESS\",\n \"voucher_code\": \"dOzJ84Ky\",\n \"vouchers\": [\n {\n \"id\": \"v_2teI9HcRvdvK1RsWD6gyNztHr4SMkMDy\",\n \"code\": \"dOzJ84Ky\",\n \"campaign\": \"Bonus Cards\",\n \"campaign_id\": \"camp_yheSCBQGrgeBwGMkQqjsUW24\",\n \"category\": null,\n \"type\": \"GIFT_VOUCHER\",\n \"discount\": null,\n \"gift\": {\n \"amount\": 500,\n \"balance\": 500\n },\n \"loyalty_card\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX1+tdyBGQeM+ZONM/kBdZ\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BtdyBGQeM%2BZONM%2FkBdZ\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1+WOEBHpX4y\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BWOEBHpX4y\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-01-24T11:19:40.409Z\",\n \"updated_at\": \"2021-01-24T11:19:41.518Z\",\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"object\": \"voucher\",\n \"distributions\": null,\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/dOzJ84Ky/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"quantity\": 1,\n \"redeemed_quantity\": 0,\n \"redeemed_amount\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/dOzJ84Ky/redemptions?page=1&limit=10\"\n }\n }\n ],\n \"vouchers_id\": [\n \"v_2teI9HcRvdvK1RsWD6gyNztHr4SMkMDy\"\n ],\n \"campaign_name\": \"Bonus Cards\",\n \"gift\": {\n \"amount\": 0,\n \"balance\": 0\n },\n \"loyalty_card\": null,\n \"discount\": null,\n \"is_referral_code\": false,\n \"failure_code\": null,\n \"failure_message\": null,\n \"voucher\": null\n }\n },\n \"related_object\": {\n \"id\": \"evcus_0a26b3e7b718c480ca\",\n \"type\": \"customer.reward_redemptions.completed\",\n \"data\": {\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"test_referrer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"holder\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"test_referrer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"voucher\": {\n \"id\": \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\",\n \"code\": \"xYwEheRh\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"amount_off\": 1000,\n \"effect\": \"APPLY_TO_ORDER\"\n },\n \"type\": \"DISCOUNT_VOUCHER\",\n \"campaign\": \"Referral Webhooks\",\n \"campaign_id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"is_referral_code\": true,\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"referrer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\"\n },\n \"campaign\": {\n \"id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"name\": \"Referral Webhooks\",\n \"campaign_type\": \"REFERRAL_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"is_referral_code\": true,\n \"voucher\": {\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n }\n },\n \"referral_program\": {\n \"conversion_event_type\": \"redemption\"\n },\n \"auto_join\": null,\n \"join_once\": false,\n \"active\": true\n },\n \"reward_redemption\": {\n \"id\": \"rewr_Fuzc1rngCCuKRDfBXBjUwl5j\",\n \"state\": \"COMPLETED\",\n \"created_at\": \"2021-01-24T11:19:43.883Z\",\n \"updated_at\": null,\n \"voucher_id\": \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\",\n \"campaign_id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"customer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"reward_assignment_id\": \"rewa_9FxFsy0M5UYc8jWjNrlSBWtG\",\n \"source_id\": \"event_0a26b3d269013fc79e\",\n \"source_type\": \"redemption_event\"\n },\n \"reward\": {\n \"assignment_id\": \"rewa_9FxFsy0M5UYc8jWjNrlSBWtG\",\n \"voucher\": {\n \"id\": \"v_2teI9HcRvdvK1RsWD6gyNztHr4SMkMDy\",\n \"code\": \"dOzJ84Ky\",\n \"gift\": {\n \"amount\": 500,\n \"balance\": 500\n },\n \"type\": \"GIFT_VOUCHER\",\n \"campaign\": \"Bonus Cards\",\n \"campaign_id\": \"camp_yheSCBQGrgeBwGMkQqjsUW24\",\n \"is_referral_code\": false,\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\"\n },\n \"id\": \"rew_e5taIjbo05k2vODIJtZ7mGED\",\n \"object\": \"reward\",\n \"name\": \"Credits - 5$\",\n \"type\": \"CAMPAIGN\"\n },\n \"reward_assignment\": {\n \"id\": \"rewa_9FxFsy0M5UYc8jWjNrlSBWtG\",\n \"reward_id\": \"rew_e5taIjbo05k2vODIJtZ7mGED\",\n \"related_object_id\": \"rrt_NWk1WYi1sZs3Epjvvd5a9JZx\",\n \"related_object_type\": \"referral_tier\",\n \"created_at\": \"2021-01-24T11:00:08.471Z\",\n \"updated_at\": null,\n \"object\": \"reward_assignment\"\n },\n \"source\": {\n \"id\": \"event_0a26b3d269013fc79e\",\n \"type\": \"redemption_event\"\n },\n \"balance\": {\n \"amount\": 500\n }\n },\n \"created_at\": \"2021-01-24T11:19:49.723Z\"\n }\n },\n \"metadata\": {}\n}\n```\n\n```json\n{\n \"id\": \"event_0a26b3d893cc3ac160\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-01-24T11:19:41.101Z\",\n \"type\": \"referee_invited\",\n \"data\": {\n \"object\": {\n \"order\": {},\n \"campaign\": {\n \"object\": \"campaign\",\n \"id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"name\": \"Referral Webhooks\",\n \"campaign_type\": \"REFERRAL_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"description\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"activity_duration_after_publishing\": null,\n \"vouchers_count\": 0,\n \"updated_at\": \"2021-01-24T11:09:40.671Z\",\n \"created_at\": \"2021-01-24T11:00:08.306Z\",\n \"active\": true,\n \"metadata\": {},\n \"vouchers_generation_status\": \"DONE\",\n \"category\": null,\n \"voucher\": {\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"gift\": null,\n \"loyalty_card\": null,\n \"redemption\": {\n \"quantity\": null\n },\n \"code_config\": {\n \"length\": 8,\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\"\n }\n },\n \"referral_program\": {\n \"conversion_event_type\": \"redemption\"\n },\n \"lucky_draw\": null\n },\n \"customer\": {\n \"id\": \"cust_BfTxUsoofap6Sb6oxG1BLCi5\",\n \"source_id\": \"referred_001\",\n \"name\": null,\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0,\n \"gift\": {\n \"redeemed_amount\": 0,\n \"amount_to_go\": 0\n },\n \"loyalty_card\": {\n \"redeemed_points\": 0,\n \"points_to_go\": 0\n }\n },\n \"orders\": {\n \"total_amount\": 25000,\n \"total_count\": 1,\n \"average_amount\": 25000,\n \"last_order_amount\": 25000,\n \"last_order_date\": \"2021-01-24T11:19:28.598Z\"\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 0,\n \"campaigns\": {}\n },\n \"metadata\": {\n \"vip\": true\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-01-24T11:19:27.844Z\",\n \"updated_at\": \"2021-01-24T11:19:28.926Z\",\n \"email_unsubscribed\": false,\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"object\": \"customer\"\n }\n },\n \"related_object\": {\n \"id\": \"event_0a26b3d893cc3ac160\",\n \"type\": \"customer.referred\",\n \"created_at\": \"2021-01-24T11:19:34.223Z\",\n \"data_json\": {\n \"object\": {\n \"id\": \"cust_BfTxUsoofap6Sb6oxG1BLCi5\",\n \"source_id\": \"referred_001\",\n \"name\": null,\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0,\n \"gift\": {\n \"redeemed_amount\": 0,\n \"amount_to_go\": 0\n },\n \"loyalty_card\": {\n \"redeemed_points\": 0,\n \"points_to_go\": 0\n }\n },\n \"orders\": {\n \"total_amount\": 25000,\n \"total_count\": 1,\n \"average_amount\": 25000,\n \"last_order_amount\": 25000,\n \"last_order_date\": \"2021-01-24T11:19:28.598Z\"\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 0,\n \"campaigns\": {}\n },\n \"metadata\": {\n \"vip\": true\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-01-24T11:19:27.844Z\",\n \"updated_at\": \"2021-01-24T11:19:28.926Z\",\n \"email_unsubscribed\": false,\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"object\": \"customer\"\n },\n \"previous_attributes\": {},\n \"related_object\": {}\n },\n \"metadata_json\": {\n \"is_rewarded\": true,\n \"source\": null\n },\n \"automation_id\": null,\n \"group_id\": \"v-0a26b3d24b032c4871\"\n }\n },\n \"metadata\": {}\n}\n```\n\n### Loyalty Campaign \n\n\n```json\n{\n \"id\": \"evcus_0a26b89763051ed721\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-11-12T11:40:18.125Z\",\n \"type\": \"loyalty_code_assigned\",\n \"data\": {\n \"object\": {\n \"voucher\": {\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"code\": \"qjvEslzU\",\n \"campaign\": \"Loyalty Webhooks\",\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"category\": null,\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf/oALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf%2FoALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1/ICHe/XvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU+S0A4SpuuDsMXXotf/AOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FICHe%2FXvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU%2BS0A4SpuuDsMXXotf%2FAOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-11-12T11:40:18.138Z\",\n \"updated_at\": null,\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0,\n \"redeemed_points\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/qjvEslzU/redemptions?page=1&limit=10\"\n },\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/qjvEslzU/publications?page=1&limit=10\"\n },\n \"object\": \"voucher\"\n },\n \"campaign\": {\n \"id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"name\": \"Loyalty Webhooks\",\n \"campaign_type\": \"LOYALTY_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"voucher\": {\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"prefix\": \"\",\n \"postfix\": \"\"\n },\n \"is_referral_code\": false\n },\n \"auto_join\": false,\n \"join_once\": false,\n \"use_voucher_metadata_schema\": true,\n \"vouchers_count\": 0,\n \"active\": true,\n \"metadata\": {},\n \"created_at\": \"2021-11-12T11:39:05.254Z\",\n \"creation_status\": \"DONE\",\n \"vouchers_generation_status\": \"DONE\",\n \"object\": \"campaign\"\n },\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"source_id\": \"Loyal_customer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0\n },\n \"orders\": {\n \"total_amount\": 0,\n \"total_count\": 0,\n \"average_amount\": null,\n \"last_order_amount\": null\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 0,\n \"campaigns\": {}\n },\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-11-12T11:40:18.077Z\",\n \"updated_at\": \"2021-11-12T11:40:19.724Z\",\n \"object\": \"customer\"\n },\n \"publication\": {\n \"id\": \"pub_ZAS0kZMqzF8LG5y55nx6dHMx2GkVPmxP\",\n \"object\": \"publication\",\n \"result\": \"SUCCESS\",\n \"channel\": \"API\",\n \"voucher\": {\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"code\": \"qjvEslzU\",\n \"gift\": null,\n \"type\": \"LOYALTY_CARD\",\n \"active\": true,\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf/oALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf%2FoALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1/ICHe/XvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU+S0A4SpuuDsMXXotf/AOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FICHe%2FXvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU%2BS0A4SpuuDsMXXotf%2FAOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA%3D%3D\"\n }\n },\n \"object\": \"voucher\",\n \"publish\": {\n \"url\": \"/v1/vouchers/qjvEslzU/publications?page=1&limit=10\",\n \"count\": 1,\n \"object\": \"list\"\n },\n \"campaign\": \"Loyalty Webhooks\",\n \"category\": null,\n \"discount\": null,\n \"metadata\": {},\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"created_at\": \"2021-11-12T11:40:18.138Z\",\n \"redemption\": {\n \"url\": \"/v1/vouchers/qjvEslzU/redemptions?page=1&limit=10\",\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_points\": 0,\n \"redeemed_quantity\": 0\n },\n \"start_date\": null,\n \"updated_at\": null,\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"distributions\": null,\n \"additional_info\": null,\n \"expiration_date\": null,\n \"is_referral_code\": false,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"value\": 0\n },\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"object\": \"customer\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"source_id\": \"Loyal_customer__01\"\n },\n \"metadata\": {},\n \"source_id\": null,\n \"created_at\": \"2021-11-12T11:40:18.125Z\",\n \"customer_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"tracking_id\": \"Loyal_customer__01\",\n \"vouchers_id\": [\n \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\"\n ]\n }\n },\n \"related_object\": {\n \"id\": \"evcus_0a26b89763051ed721\",\n \"type\": \"customer.publication.succeeded\",\n \"data\": {\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"Loyal_customer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"campaign\": {\n \"id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"name\": \"Loyalty Webhooks\",\n \"campaign_type\": \"LOYALTY_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"is_referral_code\": false,\n \"voucher\": {\n \"type\": \"LOYALTY_CARD\",\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n }\n },\n \"auto_join\": false,\n \"join_once\": false,\n \"active\": true\n },\n \"publication\": {\n \"id\": \"pub_ZAS0kZMqzF8LG5y55nx6dHMx2GkVPmxP\",\n \"object\": \"publication\",\n \"result\": \"SUCCESS\",\n \"channel\": \"API\",\n \"voucher\": {\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"code\": \"qjvEslzU\",\n \"gift\": null,\n \"type\": \"LOYALTY_CARD\",\n \"active\": true,\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf/oALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf%2FoALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1/ICHe/XvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU+S0A4SpuuDsMXXotf/AOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FICHe%2FXvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU%2BS0A4SpuuDsMXXotf%2FAOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA%3D%3D\"\n }\n },\n \"object\": \"voucher\",\n \"publish\": {\n \"url\": \"/v1/vouchers/qjvEslzU/publications?page=1&limit=10\",\n \"count\": 1,\n \"object\": \"list\"\n },\n \"campaign\": \"Loyalty Webhooks\",\n \"category\": null,\n \"discount\": null,\n \"metadata\": {},\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"created_at\": \"2021-11-12T11:40:18.138Z\",\n \"redemption\": {\n \"url\": \"/v1/vouchers/qjvEslzU/redemptions?page=1&limit=10\",\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_points\": 0,\n \"redeemed_quantity\": 0\n },\n \"start_date\": null,\n \"updated_at\": null,\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"distributions\": null,\n \"additional_info\": null,\n \"expiration_date\": null,\n \"is_referral_code\": false,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null\n },\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"object\": \"customer\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"source_id\": \"Loyal_customer__01\"\n },\n \"metadata\": {},\n \"source_id\": null,\n \"created_at\": \"2021-11-12T11:40:18.125Z\",\n \"customer_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"tracking_id\": \"Loyal_customer__01\",\n \"vouchers_id\": [\n \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\"\n ]\n }\n },\n \"created_at\": \"2021-11-12T11:40:18.125Z\"\n }\n },\n \"metadata\": {}\n}\n```\n\n```json\n{\n \"id\": \"event_0a26b9290fc4891587\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-11-12T11:42:51.380Z\",\n \"type\": \"points_earned\",\n \"data\": {\n \"object\": {\n \"order\": {},\n \"voucher\": {\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"code\": \"qjvEslzU\",\n \"campaign\": \"Loyalty Webhooks\",\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"category\": null,\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 220,\n \"balance\": 220\n },\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf/oALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf%2FoALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1/ICHe/XvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU+S0A4SpuuDsMXXotf/AOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FICHe%2FXvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU%2BS0A4SpuuDsMXXotf%2FAOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-11-12T11:40:18.138Z\",\n \"updated_at\": \"2021-11-12T11:42:50.332Z\",\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"object\": \"voucher\",\n \"distributions\": {\n \"distr_naR4rx0AgM1baWZkFm1kfHn7A9\": {\n \"date\": \"2021-11-12T11:40:21.957Z\"\n },\n \"distr_pnfPKLDAxUpiPi3ZsuMrygtYNN\": {\n \"date\": \"2021-11-12T11:42:50.332Z\"\n }\n },\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/qjvEslzU/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0,\n \"redeemed_points\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/qjvEslzU/redemptions?page=1&limit=10\"\n }\n },\n \"campaign\": {\n \"object\": \"campaign\",\n \"id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"name\": \"Loyalty Webhooks\",\n \"campaign_type\": \"LOYALTY_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"description\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"activity_duration_after_publishing\": null,\n \"vouchers_count\": 0,\n \"updated_at\": null,\n \"created_at\": \"2021-11-12T11:39:05.254Z\",\n \"active\": true,\n \"metadata\": {},\n \"vouchers_generation_status\": \"DONE\",\n \"category\": null,\n \"voucher\": {\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"redemption\": {\n \"quantity\": null\n },\n \"code_config\": {\n \"length\": 8,\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\"\n }\n },\n \"referral_program\": null,\n \"lucky_draw\": null\n },\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"source_id\": \"Loyal_customer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0,\n \"gift\": {\n \"redeemed_amount\": 0,\n \"amount_to_go\": 0\n },\n \"loyalty_card\": {\n \"redeemed_points\": 0,\n \"points_to_go\": 220\n }\n },\n \"orders\": {\n \"total_amount\": 22000,\n \"total_count\": 1,\n \"average_amount\": 22000,\n \"last_order_amount\": 22000,\n \"last_order_date\": \"2021-11-12T11:42:39.633Z\"\n }\n },\n \"loyalty\": {\n \"points\": 220,\n \"referred_customers\": 0,\n \"campaigns\": {\n \"Loyalty Webhooks\": {\n \"points\": 220,\n \"referred_customers\": 0\n }\n }\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-11-12T11:40:18.077Z\",\n \"updated_at\": \"2021-11-12T11:42:47.393Z\",\n \"email_unsubscribed\": false,\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"object\": \"customer\"\n }\n },\n \"related_object\": {\n \"id\": \"event_0a26b9290fc4891587\",\n \"type\": \"customer.rewarded.loyalty_points\",\n \"created_at\": \"2021-11-12T11:42:47.359Z\",\n \"data_json\": {\n \"object\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"source_id\": \"Loyal_customer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0,\n \"gift\": {\n \"redeemed_amount\": 0,\n \"amount_to_go\": 0\n },\n \"loyalty_card\": {\n \"redeemed_points\": 0,\n \"points_to_go\": 0\n }\n },\n \"orders\": {\n \"total_amount\": 22000,\n \"total_count\": 1,\n \"average_amount\": 22000,\n \"last_order_amount\": 22000,\n \"last_order_date\": \"2021-11-12T11:42:39.633Z\"\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 0,\n \"campaigns\": {\n \"Loyalty Webhooks\": {\n \"points\": 0,\n \"referred_customers\": 0\n }\n }\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-11-12T11:40:18.077Z\",\n \"updated_at\": \"2021-11-12T11:42:40.635Z\",\n \"email_unsubscribed\": false,\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"object\": \"customer\"\n },\n \"previous_attributes\": {},\n \"related_object\": {\n \"points\": 220,\n \"total\": 220,\n \"balance\": 220,\n \"type\": \"loyalty_card\",\n \"object\": \"balance\",\n \"related_object\": {\n \"type\": \"voucher\",\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\"\n }\n },\n \"balance\": {\n \"points\": 220,\n \"total\": 220,\n \"balance\": 220,\n \"type\": \"loyalty_card\",\n \"object\": \"balance\",\n \"related_object\": {\n \"type\": \"voucher\",\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\"\n }\n }\n },\n \"metadata_json\": {\n \"source\": \"Automation\"\n },\n \"automation_id\": \"auto_McXM3rjWcPwaNU5ndIIP13jX\",\n \"group_id\": \"v-0a26b921779d7eebcb\"\n }\n },\n \"metadata\": {}\n}\n```\n\n```json \n{\n \"id\": \"evcus_0a26bb89060c3ad8bc\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-11-12T11:53:09.910Z\",\n \"type\": \"points_redeemed\",\n \"data\": {\n \"object\": {\n \"voucher\": {\n \"id\": \"v_ix6p7zxM8m7AdlgObubjP2ibDTCsnEkq\",\n \"code\": \"xUgBLQck\",\n \"campaign\": \"20% discount\",\n \"campaign_id\": \"camp_o9vZ7yIqtj5B9CbhJlKRXIZ5\",\n \"category\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"PERCENT\",\n \"amount_limit\": 5000,\n \"percent_off\": 20\n },\n \"gift\": null,\n \"loyalty_card\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX19pNCYXQ8ztNEb+OaYwP13ZoOfOMBJwzgz2RNchFxoMDPIHS47i8tY+oc3HzEpFr2SqITQ/IdD6V7RuYxsyrcfz53Je6+me6VBl9Pze3p8lTSJWwjp79tKEZHygNMggPsfIEi4Ei3Wt1A==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19pNCYXQ8ztNEb%2BOaYwP13ZoOfOMBJwzgz2RNchFxoMDPIHS47i8tY%2Boc3HzEpFr2SqITQ%2FIdD6V7RuYxsyrcfz53Je6%2Bme6VBl9Pze3p8lTSJWwjp79tKEZHygNMggPsfIEi4Ei3Wt1A%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19a0CQqRE3y6dRDn0Jyr74H85dLNo9MQrXRZFBj9fcDUlaV3Q0uG2xa4l4Ch4WVfPGQ3iEEPpYTMQGwm8xN9cynpCv/upu9ZD9iWat6+nlw+PsKH5CcyNemhfI273GhBOvh5ysRMpFUZQ==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19a0CQqRE3y6dRDn0Jyr74H85dLNo9MQrXRZFBj9fcDUlaV3Q0uG2xa4l4Ch4WVfPGQ3iEEPpYTMQGwm8xN9cynpCv%2Fupu9ZD9iWat6%2Bnlw%2BPsKH5CcyNemhfI273GhBOvh5ysRMpFUZQ%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-11-12T11:53:03.194Z\",\n \"updated_at\": null,\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"redemption\": {\n \"quantity\": 1,\n \"redeemed_quantity\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/xUgBLQck/redemptions?page=1&limit=10\"\n },\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/xUgBLQck/publications?page=1&limit=10\"\n },\n \"object\": \"voucher\"\n },\n \"campaign\": {\n \"id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"name\": \"Loyalty Webhooks\",\n \"campaign_type\": \"LOYALTY_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"voucher\": {\n \"type\": \"LOYALTY_CARD\",\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n },\n \"is_referral_code\": false\n },\n \"auto_join\": false,\n \"join_once\": false,\n \"vouchers_count\": 0,\n \"active\": true,\n \"object\": \"campaign\"\n },\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"source_id\": \"Loyal_customer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 1,\n \"total_failed\": 0,\n \"total_succeeded\": 1,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0\n },\n \"orders\": {\n \"total_amount\": 22000,\n \"total_count\": 1,\n \"average_amount\": 22000,\n \"last_order_amount\": 22000,\n \"last_order_date\": \"2021-11-12T11:42:39.633Z\"\n }\n },\n \"loyalty\": {\n \"points\": 218,\n \"referred_customers\": 0,\n \"campaigns\": {\n \"Loyalty Webhooks\": {\n \"points\": 218,\n \"referred_customers\": 0\n }\n }\n },\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-11-12T11:40:18.077Z\",\n \"updated_at\": \"2021-11-12T11:53:07.582Z\",\n \"object\": \"customer\"\n },\n \"publication\": {\n \"id\": \"pub_aFszQ4kOtT1Hori8Wl1i0az1sFQN3CRv\",\n \"created_at\": \"2021-11-12T11:53:03.172Z\",\n \"customer_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"Loyal_customer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"tracking_id\": \"Loyal_customer__01\",\n \"metadata\": {},\n \"channel\": \"API\",\n \"source_id\": null,\n \"result\": \"SUCCESS\",\n \"voucher_code\": \"xUgBLQck\",\n \"vouchers\": [\n {\n \"id\": \"v_ix6p7zxM8m7AdlgObubjP2ibDTCsnEkq\",\n \"code\": \"xUgBLQck\",\n \"campaign\": \"20% discount\",\n \"campaign_id\": \"camp_o9vZ7yIqtj5B9CbhJlKRXIZ5\",\n \"category\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"PERCENT\",\n \"percent_off\": 20,\n \"amount_limit\": 5000\n },\n \"gift\": null,\n \"loyalty_card\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX19pNCYXQ8ztNEb+OaYwP13ZoOfOMBJwzgz2RNchFxoMDPIHS47i8tY+oc3HzEpFr2SqITQ/IdD6V7RuYxsyrcfz53Je6+me6VBl9Pze3p8lTSJWwjp79tKEZHygNMggPsfIEi4Ei3Wt1A==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19pNCYXQ8ztNEb%2BOaYwP13ZoOfOMBJwzgz2RNchFxoMDPIHS47i8tY%2Boc3HzEpFr2SqITQ%2FIdD6V7RuYxsyrcfz53Je6%2Bme6VBl9Pze3p8lTSJWwjp79tKEZHygNMggPsfIEi4Ei3Wt1A%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19a0CQqRE3y6dRDn0Jyr74H85dLNo9MQrXRZFBj9fcDUlaV3Q0uG2xa4l4Ch4WVfPGQ3iEEPpYTMQGwm8xN9cynpCv/upu9ZD9iWat6+nlw+PsKH5CcyNemhfI273GhBOvh5ysRMpFUZQ==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19a0CQqRE3y6dRDn0Jyr74H85dLNo9MQrXRZFBj9fcDUlaV3Q0uG2xa4l4Ch4WVfPGQ3iEEPpYTMQGwm8xN9cynpCv%2Fupu9ZD9iWat6%2Bnlw%2BPsKH5CcyNemhfI273GhBOvh5ysRMpFUZQ%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-11-12T11:53:03.194Z\",\n \"updated_at\": null,\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"object\": \"voucher\",\n \"distributions\": null,\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/xUgBLQck/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"quantity\": 1,\n \"redeemed_quantity\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/xUgBLQck/redemptions?page=1&limit=10\"\n }\n }\n ],\n \"vouchers_id\": [\n \"v_ix6p7zxM8m7AdlgObubjP2ibDTCsnEkq\"\n ],\n \"campaign_name\": \"20% discount\",\n \"gift\": null,\n \"loyalty_card\": null,\n \"discount\": {\n \"type\": \"PERCENT\",\n \"percent_off\": 20,\n \"amount_limit\": 5000\n },\n \"is_referral_code\": false,\n \"failure_code\": null,\n \"failure_message\": null,\n \"voucher\": null\n }\n },\n \"related_object\": {\n \"id\": \"evcus_0a26bb89060c3ad8bc\",\n \"type\": \"customer.reward_redemptions.completed\",\n \"data\": {\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"Loyal_customer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"holder\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"Loyal_customer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"voucher\": {\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"code\": \"qjvEslzU\",\n \"loyalty_card\": {\n \"points\": 220,\n \"balance\": 218\n },\n \"type\": \"LOYALTY_CARD\",\n \"campaign\": \"Loyalty Webhooks\",\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"is_referral_code\": false,\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\"\n },\n \"campaign\": {\n \"id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"name\": \"Loyalty Webhooks\",\n \"campaign_type\": \"LOYALTY_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"is_referral_code\": false,\n \"voucher\": {\n \"type\": \"LOYALTY_CARD\",\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n }\n },\n \"auto_join\": false,\n \"join_once\": false,\n \"active\": true\n },\n \"reward_redemption\": {\n \"id\": \"rewr_uATcoUjIp3VJNgT5TZT5NMaT\",\n \"state\": \"COMPLETED\",\n \"created_at\": \"2021-11-12T11:53:06.025Z\",\n \"updated_at\": null,\n \"voucher_id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"customer_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"reward_assignment_id\": \"rewa_bRTNrtAqXmdHNDe4cNg7y3JC\",\n \"source_id\": \"r_Lbxqqjv59hCRLG3Nkl8E4yYk\",\n \"source_type\": \"redemption\"\n },\n \"reward\": {\n \"assignment_id\": \"rewa_bRTNrtAqXmdHNDe4cNg7y3JC\",\n \"voucher\": {\n \"id\": \"v_ix6p7zxM8m7AdlgObubjP2ibDTCsnEkq\",\n \"code\": \"xUgBLQck\",\n \"discount\": {\n \"type\": \"PERCENT\",\n \"amount_limit\": 5000,\n \"percent_off\": 20\n },\n \"type\": \"DISCOUNT_VOUCHER\",\n \"campaign\": \"20% discount\",\n \"campaign_id\": \"camp_o9vZ7yIqtj5B9CbhJlKRXIZ5\",\n \"is_referral_code\": false,\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\"\n },\n \"id\": \"rew_l7z9yeLGZHJgCsxwNX5tDXqs\",\n \"object\": \"reward\",\n \"name\": \"20% discount\",\n \"type\": \"CAMPAIGN\"\n },\n \"reward_assignment\": {\n \"id\": \"rewa_bRTNrtAqXmdHNDe4cNg7y3JC\",\n \"reward_id\": \"rew_l7z9yeLGZHJgCsxwNX5tDXqs\",\n \"related_object_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"related_object_type\": \"campaign\",\n \"parameters\": {\n \"loyalty\": {\n \"points\": 2\n }\n },\n \"created_at\": \"2021-11-12T11:39:05.504Z\",\n \"updated_at\": null,\n \"object\": \"reward_assignment\"\n },\n \"source\": {\n \"id\": \"r_Lbxqqjv59hCRLG3Nkl8E4yYk\",\n \"type\": \"redemption\"\n },\n \"balance\": null\n },\n \"created_at\": \"2021-11-12T11:53:09.910Z\"\n }\n },\n \"metadata\": {}\n}\n```", - "x-tags": [ - "EVENTS API" - ] - }, - "15_req_track_custom_event": { - "title": "Track Custom Event Request Body", - "type": "object", - "description": "Request schema for tracking a custom event.", - "properties": { - "event": { - "type": "string", - "description": "Event name. This is the same name that you used to define a custom event in the **Dashboard** > **Project Settings** > **Event Schema**." - }, - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" - }, - { - "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "type": "object" - }, - "referral": { + } + }, + "referrals": { + "type": "object", + "description": "Summary of customer's referrals, in this case, the customer being the referee, i.e. information about the source of referrals and number of times the customer was referred by other customers.", + "properties": { + "total": { + "type": "integer", + "description": "Total number of times this customer received a referral, i.e. was referred by another customer." + }, + "campaigns": { + "type": "array", + "description": "Contains an array of campaigns that served as the source of a referral for the customer.", + "items": { "type": "object", - "description": "If a **conversion event** for a referral program is set to a custom event, then you need to send the referral code in the payload to make a record of the conversion event. ", + "description": "Contains information about the source of the referral.", "properties": { - "code": { + "campaign_id": { "type": "string", - "description": "A code through which a new visitor has been referred to a service." + "description": "Unique campaign ID, assigned by Voucherify.", + "example": "camp_rRsfatlwN7unSeUIJDCYedal" }, "referrer_id": { "type": "string", - "description": "Unique ID of the referring person - it is optional and not required if the referral **code** is provided.", - "example": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" - } - } - }, - "loyalty": { - "type": "object", - "description": "If an earning rule in a loyalty program is based on a custom event. This objects let's you specify the loyalty card to which the custom event should be attributed to.", - "properties": { - "code": { + "example": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", + "description": "Unique referrer ID, assigned by Voucherify. This is the customer ID of a customer that is referring this customer." + }, + "related_object_id": { + "type": "string", + "description": "Related object ID, i.e. `r_0b9d4cc4aa164dd073`." + }, + "related_object_type": { + "type": "string", + "description": "Related object type, i.e. `redemption`." + }, + "date": { "type": "string", - "description": "Code of the loyalty card to receive points based on the calculation method defined in the related earning rule. An earning rule is triggered for the loyalty card when the event passed in the `event` parameter of the request payload gets sent along with this loyalty card code." + "format": "date-time", + "example": "2022-08-30T10:19:39.196Z", + "description": "Timestamp representing the date and time when the customer was referred in ISO 8601 format." } } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the event. A set of key/value pairs that you can attach to an event object. It can be useful for storing additional information about the event in a structured format. Event metadata schema is defined in the **Dashboard** > **Project Settings** > **Event Schema** > **Edit particular event** > **Metadata property definition**." - } - } - }, - "15_res_track_custom_event": { - "title": "Track Custom Event Request Body", - "type": "object", - "description": "Request schema for tracking a custom event.", - "properties": { - "object": { - "type": "string", - "default": "event", - "description": "The object represented is an `event`." - }, - "type": { - "type": "string", - "description": "The event name." - }, - "customer": { - "type": "object", - "description": "An empty customer object." - }, - "referral": { - "type": "null", - "description": "A `null` referral object." - }, - "loyalty": { - "type": "null", - "description": "A `null` loyalty object." } } - }, - "16_obj_export_object": { - "title": "Export Object", - "type": "object", - "description": "This is an object representing an export. \n\nThe `/exports` endpoint allows you to retrieve Voucherify objects such as [vouchers](ref:get-voucher), [redemptions](ref:list-redemptions), [publications](ref:list-publications), [customers](ref:get-customer), and [orders](ref:get-order) as a CSV file. This functionality works asynchronously and comes down to the following steps: \n* create an export object and return its `id` so you can track its `status`\n* trigger a CSV file generation, change the status to `SCHEDULED`\n* when the generation is over, store the file in S3 and change the `status` to `DONE`\n* now you can [get](ref:download-export) it\n\nWith `parameters` you can select which `fields` will be exported and `filter` out the relevant data\n\n\n```json\n{\n \"fields\": [\n \"code\",\n \"voucher_type\"\n ],\n \"filters\": {\n \"categories\": {\n \"conditions\": {\n \"$in\": [\n \"postman\"\n ]\n }\n }\n }\n}\n```\n\n\n## Fields values\nHere is a list of the fields you can export for particular objects. \n| **Object** | **Fields** |\n|:---|:---|\n| voucher | code
                  voucher_type
                  value
                  discount_type
                  campaign
                  category
                  start_date
                  expiration_date
                  gift_balance
                  loyalty_balance
                  redemption_quantity
                  redemption_count
                  active
                  qr_code
                  bar_code
                  id
                  is_referral_code
                  created_at
                  updated_at
                  validity_timeframe_interval
                  validity_timeframe_duration
                  validity_day_of_week
                  discount_amount_limit
                  campaign_id
                  additional_info
                  customer_id
                  discount_unit_type
                  discount_unit_effect
                  customer_source_id
                  metadata
                  metadata.X *where X is the name of a particular metadata property* |\n| redemption | object
                  date
                  voucher_code
                  campaign
                  promotion_tier_id
                  customer_id
                  customer_source_id
                  customer_name
                  tracking_id
                  order_amount
                  gift_amount
                  loyalty_points
                  result
                  failure_code
                  failure_message
                  metadata
                  metadata.X *where X is the name of a particular metadata property* |\n| publication | voucher_code
                  customer_id
                  customer_source_id
                  date
                  channel
                  campaign
                  is_winner
                  metadata
                  metadata.X *where X is the name of a particular metadata property* |\n| customer | name
                  id
                  description
                  email
                  source_id
                  created_at
                  address_city
                  address_state
                  address_line_1
                  address_line_2
                  address_country
                  address_postal_code
                  redemptions_total_redeemed
                  redemptions_total_failed
                  redemptions_total_succeeded
                  redemptions_total_rolled_back
                  redemptions_total_rollback_failed
                  redemptions_total_rollback_succeeded
                  orders_total_amount
                  orders_total_count
                  orders_average_amount
                  orders_last_order_amount
                  orders_last_order_date
                  loyalty_points
                  loyalty_referred_customers
                  updated_at
                  phone
                  birthdate
                  birthday
                  metadata
                  metadata.X *where X is the name of a particular metadata property* |\n| order | id
                  source_id
                  status
                  created_at
                  updated_at
                  amount
                  discount_amount
                  items_discount_amount
                  total_discount_amount
                  total_amount
                  customer_id
                  referrer_id
                  metadata
                  metadata.X *where X is the name of a particular metadata property* |\n| points expiration | id
                  campaign_id
                  voucher_id
                  expires_at
                  status
                  points |\n\n\n## Pagination and example request\nVoucherify allows you to specify the timeframe for the records you want to retrieve. Thanks to this mechanism it should be easy to implement a pagination mechanism. See the example of request body: \n\n\n```json Export Redemption Example\n{\n \"exported_object\": \"redemption\",\n \"parameters\": {\n \"order\": \"-created_at\",\n \"fields\": [\n \"id\",\n \"object\",\n \"date\",\n \"voucher_code\",\n \"customer_id\",\n \"result\"\n ],\n \"filters\": {\n \"junction\": \"and\",\n \"created_at\": {\n \"conditions\": {\n \"$after\": [\n \"2018-05-30T22:00:00.000Z\"\n ],\n \"$before\": [\n \"2018-06-29T22:00:00.000Z\"\n ]\n }\n }\n }\n }\n}\n```\n\nAn export request will almost always result in a single file being generated by the system. However, when your volume of data is large, the system may split the results into multiple chunks.", - "x-tags": [ - "EXPORTS API" - ], - "properties": { - "id": { - "type": "string", - "description": "Unique export ID.", - "example": "exp_FFfp9o7daWuJqJCKp5xqqli4" - }, - "object": { - "type": "string", - "default": "export", - "description": "The type of object being represented. This object stores information about the `export`." - }, - "created_at": { - "type": "string", - "example": "2022-04-28T11:23:20.922Z", - "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format.", - "format": "date-time" - }, - "status": { - "type": "string", - "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.", - "enum": [ - "SCHEDULED", - "IN_PROGRESS", - "DONE", - "ERROR" - ] - }, - "channel": { - "type": "string", - "description": "The channel through which the export was triggered.", - "enum": [ - "API", - "WEBSITE" - ] - }, - "exported_object": { - "type": "string", - "description": "The type of exported object.", - "enum": [ - "order", - "voucher", - "publication", - "redemption", - "customer", - "points_expiration", - "voucher_transactions" - ] - }, - "parameters": { - "anyOf": [ - { - "$ref": "#/components/schemas/16_obj_export_order" - }, - { - "$ref": "#/components/schemas/16_obj_export_voucher" - }, - { - "$ref": "#/components/schemas/16_obj_export_publication" - }, - { - "$ref": "#/components/schemas/16_obj_export_redemption" - }, - { - "$ref": "#/components/schemas/16_obj_export_customer" - }, - { - "$ref": "#/components/schemas/16_obj_export_points_expiration" - }, - { - "$ref": "#/components/schemas/16_obj_export_gift_card_transactions" - }, - { - "$ref": "#/components/schemas/16_obj_export_loyalty_card_transactions" - } - ] - }, - "result": { - "type": "object", - "description": "Contains the URL of the CSV file.", - "properties": { - "url": { - "type": "string", - "description": "URL of the CSV file location. It contains the `token` used for authorization in the [Download export](ref:download-export) method." + } + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments." + }, + "system_metadata": { + "type": "object", + "description": "Object used to store system metadata information.", + "properties": { + "consents": { + "type": "object", + "description": "Stores a list of consent ID's along with the timestamp and decision on accepting or rejecting a marketing permission.", + "properties": { + "consentId": { + "type": "object", + "description": "Unique ID of a consent, i.e. `cnst_lbgOBhHTuDrB7sjIhFjvIALj`.", + "properties": { + "date": { + "type": "string", + "description": "Timestamp representing the date and time when a consent was accepted or rejected in ISO 8601 format.", + "example": "2022-05-10T08:50:10.338Z", + "format": "date-time" + }, + "value": { + "type": "boolean", + "description": "Accepted: `true`, Rejected: `false`" + } } } - }, - "user_id": { - "type": "string", - "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the `channel` value is `WEBSITE`.", - "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH" } + }, + "source": { + "type": "string", + "description": "Takes on the name of the source of the integration if the customer was created through an integration, i.e. `Bigcommerce` or `Shopify`." } - }, - "16_res_list_exports": { - "description": "Response schema for listing exports.", - "type": "object", - "title": "List Exports Response Body", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about exports.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of exports.", - "default": "exports" - }, - "exports": { - "type": "array", - "uniqueItems": true, - "description": "An array of export objects.", - "items": { - "$ref": "#/components/schemas/16_obj_export_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of exports." - } + } + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the customer was created in ISO 8601 format.", + "example": "2022-08-30T06:32:07.380Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the customer was updated in ISO 8601 format.", + "example": "2022-08-31T06:32:07.380Z", + "format": "date-time" + }, + "assets": { + "type": "object", + "description": "Contains information about the customer's cockpit.", + "properties": { + "cockpit_url": { + "type": "string", + "description": "Customer's cockpit URL address." } - }, - "16_req_create_export_POST": { - "description": "Request schema for creating an export.", - "type": "object", - "title": "Create Export Request Body", - "properties": { - "exported_object": { - "type": "string", - "description": "The type of object to be exported.", - "enum": [ - "order", - "voucher", - "publication", - "redemption", - "customer", - "points_expiration", - "voucher_transactions" - ] + } + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the customer.", + "default": "customer" + } + } + }, + "9_obj_customer_object_email_parameter": { + "type": "object", + "description": "This is an object representing a customer.", + "title": "Customer Object", + "examples": [ + { + "id": "cust_4vMj8Twr5nBzvTrNCgipMb6M", + "source_id": "08dd9b5a", + "name": "Bob Smith", + "email": "bob.smith@email.com", + "address": { + "city": "New York", + "state": "NY", + "line_1": "678 Main St", + "line_2": null, + "country": "USA", + "postal_code": "10001" + }, + "summary": { + "redemptions": { + "total_redeemed": 5, + "total_failed": 0, + "total_succeeded": 5, + "total_rolled_back": 0, + "total_rollback_failed": 0, + "total_rollback_succeeded": 0, + "gift": { + "redeemed_amount": 0, + "amount_to_go": 0 }, - "parameters": { - "anyOf": [ - { - "$ref": "#/components/schemas/16_obj_export_order" - }, - { - "$ref": "#/components/schemas/16_obj_export_voucher" - }, - { - "$ref": "#/components/schemas/16_obj_export_publication" - }, - { - "$ref": "#/components/schemas/16_obj_export_redemption" - }, - { - "$ref": "#/components/schemas/16_obj_export_customer" - }, - { - "$ref": "#/components/schemas/16_obj_export_points_expiration" - }, - { - "$ref": "#/components/schemas/16_obj_export_gift_card_transactions" - }, - { - "$ref": "#/components/schemas/16_obj_export_loyalty_card_transactions" - } - ] + "loyalty_card": { + "redeemed_points": 0, + "points_to_go": 830 } + }, + "orders": { + "total_amount": 94600, + "total_count": 5, + "average_amount": 18920, + "last_order_amount": 27500, + "last_order_date": "2022-09-15T11:11:36.630Z" } }, - "16_obj_export_order": { - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data.", - "title": "order", - "type": "object", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "-created_at", - "created_at", - "updated_at", - "-updated_at", - "status", - "-status" - ] - }, - "fields": { - "type": "array", - "enum": [ - [ - "id", - "source_id", - "created_at", - "updated_at", - "status", - "amount", - "discount_amount", - "items_discount_amount", - "total_discount_amount", - "total_amount", - "customer_id", - "referrer_id", - "metadata" - ] - ], - "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique order ID. | ord_A69RIxEdRsPuC6i8gFGVHUft |\n| source_id | Unique order source ID. | 8638 |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the order was created. | 2022-03-09T09:16:32.521Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the order was last updated. | 2022-03-09T09:16:33.331Z |\n| status | Order status. | `PAID`, `CREATED`, `FULFILLED`, `CANCELED` |\n| amount | Total amount of order items. | 7700 |\n| discount_amount | Represents total amount of the discount applied to whole cart. | 500 |\n| items_discount_amount | Represents total amount of the discount applied to order line items. | 100 |\n| total_discount_amount | All discounts applied to the order including discounts applied to particular order line items and discounts applied to the whole cart. | 600 |\n| total_amount | Total order amount after applying all discounts. | 7100 |\n| customer_id | Customer unique ID. | cust_2G4fUQdCXUqp35nXNleav7bO |\n| referrer_id | Referrer unique ID. | cust_IkrTR674vvQvr9a4rDMiqglY |\n| metadata | Returns all order metadata. | Response will include all order metadata. |\n| metadata.X | Where X is the name of a particular order metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Order. [Read more here](https://support.voucherify.io/article/99-schema-validation-metadata). |", - "items": { - "type": "string" - } - }, - "filters": { - "anyOf": [ - { - "$ref": "#/components/schemas/16_obj_filter_order_status" - }, - { - "$ref": "#/components/schemas/16_obj_filter_order_source_id" - }, - { - "$ref": "#/components/schemas/16_obj_filter_order_amount" - }, - { - "$ref": "#/components/schemas/16_obj_filter_order_total_amount" - }, - { - "$ref": "#/components/schemas/16_obj_filter_order_discount_amount" - }, - { - "$ref": "#/components/schemas/16_obj_filter_order_total_discount_amount" - }, - { - "$ref": "#/components/schemas/16_obj_filter_order_items_discount_amount" - } - ] + "loyalty": { + "points": 830, + "referred_customers": 0, + "campaigns": { + "Loyalty Campaign - Webinar": { + "points": 830, + "referred_customers": 0 } } }, - "16_obj_export_voucher": { - "description": "List of available fields and filters that can be exported with a voucher along with the sorting order of the returned data.", - "title": "voucher", - "type": "object", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at", - "code", - "-code" - ] - }, - "fields": { - "type": "array", - "enum": [ - [ - "code", - "voucher_type", - "value", - "discount_type", - "campaign", - "category", - "start_date", - "expiration_date", - "gift_balance", - "loyalty_balance", - "redemption_quantity", - "redemption_count", - "active", - "qr_code", - "bar_code", - "id", - "is_referral_code", - "created_at", - "updated_at", - "validity_timeframe_interval", - "validity_timeframe_duration", - "validity_day_of_week", - "discount_amount_limit", - "campaign_id", - "additional_info", - "customer_id", - "discount_unit_type", - "discount_unit_effect", - "customer_source_id", - "metadata" - ] - ], - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique voucher ID. | v_HSnGD2vNIHYighTQxwcB4dtVAv8VOmZD |\n| code | Unique voucher code. | WELCOME100 |\n| voucher_type | Type of voucher. | `DISCOUNT_VOUCHER`, `GIFT_VOUCHER`, `LOYALTY_CARD` |\n| value | Value of voucher. | `DISCOUNT_VOUCHER` : amount, percent, unit
                  `GIFT_VOUCHER`: amount left to spend
                  `LOYALTY_CARD`: available usable points |\n| discount_type | The type of discount for a `DISCOUNT_VOUCHER`. | `AMOUNT`, `PERCENT`, `UNIT`, `FIXED` |\n| campaign | Unique campaign name. | Summer Discounts 20% off |\n| category | Tag defining the category that this voucher belongs to. | |\n| start_date | Start date defines when the code starts to be active. Activation timestamp in ISO 8601 format. Voucher is _inactive_ before this date. | 2020-12-10T23:00:00.000Z |\n| expiration_date | Expiration date defines when the code expires. Expiration timestamp in ISO 8601 format. Voucher is _inactive_ after this date. | 2023-12-31T23:00:00.000Z |\n| gift_balance | Amount left to spend. | 1000 |\n| loyalty_balance | Available usable points. | 2000 |\n| redemption_quantity | Maximum number of times a voucher can be redeemed. | 2 |\n| redemption_count | Total redemptions. | 59 |\n| active | Boolean indicating whether the voucher is available for use. | `true`, `false` |\n| qr_code | URL to QR representation of encrypted code. | |\n| bar_code | URL to barcode representation of encrypted code. | |\n| is_referral_code | Boolean indicating whether the voucher is a referral code. | `true`, `false` |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the voucher was created. | 2022-04-14T09:55:46.814Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the voucher was last updated. | 2022-04-14T10:02:18.036Z |\n| validity_timeframe_interval | Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an interval of `P2D` will be active every other day. | P2D |\n| validity_timeframe_duration | Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a duration of `PT1H` will be valid for a duration of one hour. | PT1H |\n| validity_day_of_week | Array corresponding to the particular days of the week in which the voucher is valid. | \"1,2,3,4,5\" |\n| discount_amount_limit | For `PERCENT` discount type, this is the maximum threshold allowed to be deducted. | 50 |\n| campaign_id | Parent campaign ID. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| additional_info | An optional field to keep any extra textual information about the code such as a code description and details. | |\n| customer_id | Unique customer ID of the assigned owner to whom the voucher was published. | cust_7iUa6ICKyU6gH40dBU25kQU1 |\n| discount_unit_type | For `UNIT` discount type, either a shipping or product ID for a `UNIT` discount with one product. | prod_5h1pp1ng, prod_0a9f9aeddb019a42db |\n| discount_unit_effect | `UNIT` discount effect. | `ADD_MANY_ITEMS`, `ADD_MISSING_ITEMS`,`ADD_NEW_ITEMS` |\n| customer_source_id | Unique customer source id of the assigned owner to whom the voucher was published. | name.lastname@email.com |\n| metadata | Returns all voucher metadata. | Response will include all voucher metadata. |\n| metadata.X | Where X is the name of a particular voucher metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Voucher. [Read more here](https://support.voucherify.io/article/99-schema-validation-metadata). |\n", - "items": { - "type": "string" - } - }, - "filters": { - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the export. You can filter the following parameters: \n\n - `categories`\n\n - `vouchers`\n\n - `type`\n\n - `holder_id`\n\n - `is_referral_code`\n\n - `published_for_customer_id`\n\n - `validity_timeframe`\n\n - `category_ids`" + "referrals": { + "total": 0, + "campaigns": [] + }, + "metadata": { + "age": 24, + "loyalty_customer": "true", + "acquisition_channel": "Facebook" + }, + "system_metadata": { + "consents": { + "cnst_lbgOBhHTuDrB7sjIhFjvIALj": { + "date": "2022-11-22T15:48:50.219Z", + "value": true } } }, - "16_obj_export_publication": { - "description": "List of available fields and filters that can be exported with a publication along with the sorting order of the returned data.", - "title": "publication", - "type": "object", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "id", - "-id", - "voucher_code", - "-voucher_code", - "tracking_id", - "-tracking_id", - "customer_id", - "-customer_id", - "created_at", - "-created_at", - "channel", - "-channel" - ] - }, - "fields": { - "type": "array", - "enum": [ - [ - "voucher_code", - "customer_id", - "customer_source_id", - "date", - "channel", - "campaign", - "is_winner", - "metadata" - ] - ], - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| voucher_code | Unique voucher code. | WELCOME100 |\n| customer_id | Customer unique ID. | cust_7iUa6ICKyU6gH40dBU25kQU1 |\n| customer_source_id | Unique customer source id of the assigned owner to whom the voucher was published. | name.lastname@email.com |\n| date | Timestamp in ISO 8601 format representing the date and time when the voucher was published. | 2022-04-28T10:19:30.792Z |\n| channel | Publication channel. | voucherify-website |\n| campaign | Unique campaign name. | Summer Discounts 20% off |\n| is_winner | | |\n| metadata | Returns all publication metadata. | Response will include all publication metadata. |\n| metadata.X | Where X is the name of a particular publication metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Publication. [Read more here](https://support.voucherify.io/article/99-schema-validation-metadata) |", - "items": { - "type": "string" - } - }, - "filters": { - "description": "Data filters used to narrow the data records to be returned in the export. You can filter the following parameters: \n\n - `failure_code`\n\n - `result`\n\n - `customer_id`\n\n - `campaign_name`\n\n - `voucher_type`\n\n - `is_referral_code`\n\n - `parent_object_id`\n\n - `related_object_id`\n\n - `source_id`", - "anyOf": [ - { - "$ref": "#/components/schemas/16_obj_filter_publication_failure_code" - }, - { - "$ref": "#/components/schemas/16_obj_filter_publication_result" - }, - { - "$ref": "#/components/schemas/16_obj_filter_publication_customer_id" - }, - { - "$ref": "#/components/schemas/16_obj_filter_publication_campaign_name" - }, - { - "$ref": "#/components/schemas/16_obj_filter_publication_voucher_type" - }, - { - "$ref": "#/components/schemas/16_obj_filter_publication_is_referral_code" - }, - { - "$ref": "#/components/schemas/16_obj_filter_publication_parent_object_id" - }, - { - "$ref": "#/components/schemas/16_obj_filter_publication_related_object_id" - }, - { - "$ref": "#/components/schemas/16_obj_filter_publication_source_id" + "created_at": "2022-09-15T10:33:46.388Z", + "updated_at": "2022-11-22T15:48:50.220Z", + "assets": { + "cockpit_url": "https://cockpits.voucherify.io/customers?token=U2FsdGVkX186yavyLJyykWa9KfhE1J850qWbQ1B%2BjKBZ0wrIzBNaW1WR6tNZo71Y5oTWG6PYpI9BpXDSnzz7CRfQ3lu7M151btz2vlYVxbd2eHNOjTFEwTbD8wK4moLONgtTlPM8ze42nmutFk5GUBepUEhxHRfbk8zekWqWvo8%2FbnAJsPl2rxYyaggwXQDj" + }, + "object": "customer" + } + ], + "x-tags": [ + "CUSTOMERS API" + ], + "properties": { + "id": { + "type": "string", + "description": "The unique ID of a customer that is assigned by Voucherify.", + "example": "cust_CSnYd37MXmrbS19XCrghjBsv" + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a customer object." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "phone": { + "type": "string", + "description": "Customer's phone number." + }, + "birthdate": { + "type": "string", + "description": "Customer's birthdate." + }, + "birthday": { + "type": "string", + "description": "Customer's birthday." + }, + "address": { + "type": "object", + "description": "Customer's address.", + "properties": { + "city": { + "type": "string", + "description": "City" + }, + "state": { + "type": "string", + "description": "State" + }, + "line_1": { + "type": "string", + "description": "First line of address." + }, + "line_2": { + "type": "string", + "description": "Second line of address." + }, + "country": { + "type": "string", + "description": "Country." + }, + "postal_code": { + "type": "string", + "description": "Postal code." + } + } + }, + "summary": { + "type": "object", + "description": "Contains a summary of customer's redemption and order statistics.", + "properties": { + "redemptions": { + "type": "object", + "description": "Customer's redemptions statistics.", + "properties": { + "total_redeemed": { + "type": "integer", + "description": "Total number of redemptions made by the customer." + }, + "total_failed": { + "type": "integer", + "description": "Total number of redemptions that failed." + }, + "total_succeeded": { + "type": "integer", + "description": "Total number of redemptions that succeeded." + }, + "total_rolled_back": { + "type": "integer", + "description": "Total number of redemptions that were rolled back for the customer." + }, + "total_rollback_failed": { + "type": "integer", + "description": "Total number of redemption rollbacks that failed." + }, + "total_rollback_succeeded": { + "type": "integer", + "description": "Total number of redemption rollbacks that succeeded." + }, + "gift": { + "type": "object", + "description": "Summary of gift card credits.", + "properties": { + "redeemed_amount": { + "type": "integer", + "description": "Total amount of gift card credits redeemed by customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "amount_to_go": { + "type": "integer", + "description": "Remaining gift card balance across all gift cards. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } } - ] + }, + "loyalty_card": { + "type": "object", + "description": "Summary of loyalty points.", + "properties": { + "redeemed_points": { + "type": "integer", + "description": "Total number of loyalty points redeemed by the customer." + }, + "points_to_go": { + "type": "integer", + "description": "Sum of remaining available point balance accross all loyalty cards." + } + } + } } - } - }, - "16_obj_export_redemption": { - "description": "List of available fields and filters that can be exported with a redemption along with the sorting order of the returned data.", - "title": "redemption", - "type": "object", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "id", - "-id", - "voucher_code", - "-voucher_code", - "tracking_id", - "-tracking_id", - "customer_id", - "-customer_id", - "created_at", - "-created_at" - ] - }, - "fields": { - "type": "array", - "enum": [ - [ - "id", - "object", - "date", - "voucher_code", - "campaign", - "promotion_tier_id", - "customer_id", - "customer_source_id", - "customer_name", - "tracking_id", - "order_amount", - "gift_amount", - "loyalty_points", - "result", - "failure_code", - "failure_message", - "metadata" - ] - ], - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique redemption ID. | r_0acf3a6dae00e679c8, rf_0acf3a495740e679b8 |\n| object | Object being exported; by default `redemption`. | redemption |\n| date | Timestamp in ISO 8601 format representing the date and time when the voucher was redeemed. | 2022-03-23T08:52:24.867Z |\n| voucher_code | Unique voucher code redeemed. | WELCOME100 |\n| campaign | Parent campaign name of voucher if applicable. | Summer Discounts 20% off |\n| promotion_tier_id | | promo_Mwy9XpA0TLctSGriM5kum0qp |\n| customer_id | Unique customer ID of redeeming customer. | cust_nk0N1uNQ1YnupAoJGOgvsODC |\n| customer_source_id | Unique source ID of redeeming customer. | name.lastname@email.com |\n| customer_name | Customer name. | John Smith |\n| tracking_id | | track_Pw6r3ejnml43kIwNS4Zj09KZ67xOfLUy |\n| order_amount | Total order amount before applying all discounts. | 1000 |\n| gift_amount | Gift credits used for redemption. | 10 |\n| loyalty_points | | 12 |\n| result | Tells you whether the redemption succeeded. | `SUCCESS`, `FAILURE` |\n| failure_code | Internal Voucherify code for reason why redemption failed. | invalid_customer |\n| failure_message | A human-readable message providing a short description explaining why the redemption failed. | Customer must be a holder of a loyalty card. |\n| metadata | Returns all redemption metadata. | Response will include all redemption metadata. |\n| metadata.X | Where X is the name of a particular redemption metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Redemption. [Read more here](https://support.voucherify.io/article/99-schema-validation-metadata) |", - "items": { - "type": "string" + }, + "orders": { + "type": "object", + "description": "Customer's order statistics.", + "properties": { + "total_amount": { + "type": "integer", + "description": "The total amount spent by the customer. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "total_count": { + "type": "integer", + "description": "Total number of orders made by the customer." + }, + "average_amount": { + "type": "integer", + "description": "Average amount spent on orders. `total_amount` ÷ `total_count`. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "last_order_amount": { + "type": "integer", + "description": "Amount spent on last order. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "last_order_date": { + "type": "string", + "example": "2022-08-30T11:51:08.029Z", + "description": "Timestamp representing the date and time of the customer's last order in ISO 8601 format." } - }, - "filters": { - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the export. You can filter the following parameters: \n\n - `voucher_code`\n\n - `related_object_id`\n\n - `related_object_parent_id`\n\n - `parent_redemption_id`\n\n - `failure_code`\n\n - `result`\n\n - `object`\n\n - `customer_id`\n\n - `campaign_name`\n\n - `user_login`" } } - }, - "16_obj_export_customer": { - "description": "List of available fields and filters that can be exported with a customer along with the sorting order of the returned data.", - "title": "customer", - "type": "object", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "name", - "-name", - "id", - "-id", - "email", - "-email", - "source_id", - "-source_id", - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ] - }, - "fields": { - "type": "array", - "enum": [ - [ - "name", - "id", - "description", - "email", - "source_id", - "created_at", - "address_city", - "address_state", - "address_line_1", - "address_line_2", - "address_country", - "address_postal_code", - "redemptions_total_redeemed", - "redemptions_total_failed", - "redemptions_total_succeeded", - "redemptions_total_rolled_back", - "redemptions_total_rollback_failed", - "redemptions_total_rollback_succeeded", - "orders_total_amount", - "orders_total_count", - "orders_average_amount", - "orders_last_order_amount", - "orders_last_order_date", - "loyalty_points", - "loyalty_referred_customers", - "updated_at", - "phone", - "birthday", - "metadata", - "birthdate" - ] - ], - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| name | Customer name. | John Smith |\n| id | Unique customer ID. | cust_J1CDUdbqn5Exva8ASWk1Fq0j |\n| description | An arbitrary string that you can attach to a customer object. | Customer requesting to be added to VIP tier. |\n| email | Customer's email. | name.lastname@email.com |\n| source_id | Unique custom customer identifier. | name.lastname@email.com |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the customer was created. | 2022-02-03T13:10:11.928Z |\n| address_city | City | Houston |\n| address_state | State | TX |\n| address_line_1 | First line of customer's address. | 72738 Main St |\n| address_line_2 | Second line of customer's address. | Bld 2, Apt 4 |\n| address_country | Country | United States of America |\n| address_postal_code | Postal code (ZIP code) | 77042-4143 |\n| redemptions_total_redeemed | Total customer redemptions. | 5 |\n| redemptions_total_failed | Total customer failed redemptions. | 2 |\n| redemptions_total_succeeded | Total customer succeeded redemptions. | 3 |\n| redemptions_total_rolled_back | Total customer redemptions that were rolled back. | 3 |\n| redemptions_total_rollback_failed | Total customer redemptions that were unsuccessfully rolled back. | 2 |\n| redemptions_total_rollback_succeeded | Total customer redemptions that were successfully rolled back. | 1 |\n| orders_total_amount | Total sum of order amounts over customer lifetime. Value is multiplied by 100 to precisely represent 2 decimal places. | 10000 (represents $100) |\n| orders_total_count | Total number of customer orders. Value is multiplied by 100 to precisely represent 2 decimal places. | 2 |\n| orders_average_amount | Average amount spent on orders. Value is multiplied by 100 to precisely represent 2 decimal places. | 50 |\n| orders_last_order_amount | How much did the customer spend on their last order. Value is multiplied by 100 to precisely represent 2 decimal places. | 50 |\n| orders_last_order_date | When was the last customer order; timestamp in ISO 8601 format representing the date and time. | 2022-02-03T13:17:30.630Z |\n| loyalty_points | Sum of customer's loyalty points to go across all loyalty cards. | |\n| loyalty_referred_customers | How many customers were referred by this customer. | |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the customer was updated. | 2022-02-14T14:10:14.305Z |\n| phone | Customer's phone number. | +1 (294) 752-1846 |\n| birthday | Customer's birthday. | 2022-01-01 |\n| birthdate | Customer's birthdate. | 2022-04-29 |\n| metadata | Returns all customer metadata. | Response will include all customer metadata. |\n| metadata.X | Where X is the name of a particular customer metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Customer. [Read more here](https://support.voucherify.io/article/99-schema-validation-metadata) |", - "items": { - "type": "string" + } + }, + "loyalty": { + "type": "object", + "description": "Summary of customer's loyalty information.", + "properties": { + "points": { + "type": "integer" + }, + "referred_customers": { + "type": "integer", + "description": "Total number of customers referred by the customer." + }, + "campaigns": { + "type": "object", + "description": "Contains campaigns with details about point balances and how many customers were referred by the customer.", + "properties": { + "campaign_name": { + "type": "object", + "description": "Contains details about the point balances left on loyalty cards and the number of referred customers in each campaign.", + "properties": { + "points": { + "type": "integer", + "description": "Remaining point balance in campaign." + }, + "loyalty_tier": { + "type": "string", + "example": "ltr_UJ5Q54Q0OvEhua87Qfv2Ki5x", + "description": "Customer's loyalty tier within the campaign." + }, + "referred_customers": { + "type": "integer", + "description": "Number of customers referred by the customer in campaign." + } + } } - }, - "filters": { - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the export. You can filter the following parameters: \n\n - `name` (string)\n\n - `email` (string)\n\n - `phone` (string)\n\n - `metadata` (json)\n\n - `metadata.X` (?)\n\n - `address` (json)\n\n - `address.state` (string)\n\n - `address.country` (string)\n\n - `address.postal_code` (string)\n\n - `birthday` (string - date-time)\n\n - `birthdate` (string date-time)\n\n - `created_at` (date)\n\n - `source_id` (string)\n\n - `system.metadata` (json)\n\n - `system.metadata.source` (string)\n\n - `system.metadata.consents.unsubscribed` (boolean)\n\n - `loyalty_points` (json)\n\n - `loyalty` (json)\n\n - `summary.orders.total_amount` (json)\n\n - `summary.orders.last_order_date` (date)\n\n - `summary.orders.last_order_amount` (json)\n\n - `summary.redemptions.gift.redeemed_amount` (integer)\n\n - `summary.redemptions.total_succeeded` (integer)\n\n - `events.cart_abandoned.last_occurred` (integer)\n\n - `events.newsletter_subscribed.count` (integer)\n\n - `events.sign_up.last_occurred` (integer)" } } - }, - "16_obj_export_points_expiration": { - "description": "List of available fields and filters that can be exported with points expirations along with the sorting order of the returned data.", - "title": "points expiration", - "type": "object", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "expires_at", - "-expires_at" - ] - }, - "fields": { - "type": "array", - "enum": [ - [ - "id", - "campaign_id", - "voucher_id", - "status", - "expires_at", - "points" - ] - ], - "description": "Array of strings containing the data that was exported. These fields define the headers in the CSV file. \n\n The array can be a combintation of any of the following available fields: \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n |\n| campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 |\n| status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` |\n| expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 |\n| points | Number of points. | 1000 |", - "items": { - "type": "string" - } - }, - "filters": { - "description": "Data filters used to narrow the data records to be returned in the export. You can filter the following parameters: \n\n - `campaign_id`\n\n - `voucher_id`", - "anyOf": [ - { - "$ref": "#/components/schemas/16_obj_filter_points_expiration_campaign_id" + } + }, + "referrals": { + "type": "object", + "description": "Summary of customer's referrals, in this case, the customer being the referee, i.e. information about the source of referrals and number of times the customer was referred by other customers.", + "properties": { + "total": { + "type": "integer", + "description": "Total number of times this customer received a referral, i.e. was referred by another customer." + }, + "campaigns": { + "type": "array", + "description": "Contains an array of campaigns that served as the source of a referral for the customer.", + "items": { + "type": "object", + "description": "Contains information about the source of the referral.", + "properties": { + "campaign_id": { + "type": "string", + "description": "Unique campaign ID, assigned by Voucherify.", + "example": "camp_rRsfatlwN7unSeUIJDCYedal" }, - { - "$ref": "#/components/schemas/16_obj_filter_points_expiration_voucher_id" + "referrer_id": { + "type": "string", + "example": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", + "description": "Unique referrer ID, assigned by Voucherify. This is the customer ID of a customer that is referring this customer." + }, + "related_object_id": { + "type": "string", + "description": "Related object ID, i.e. `r_0b9d4cc4aa164dd073`." + }, + "related_object_type": { + "type": "string", + "description": "Related object type, i.e. `redemption`." + }, + "date": { + "type": "string", + "example": "2022-08-30T10:19:39.196Z", + "description": "Timestamp representing the date and time when the customer was referred in ISO 8601 format." } - ] - } - } - }, - "16_obj_export_gift_card_transactions": { - "description": "List of available fields and filters that can be exported with gift card transactions along with the sorting order of the returned data.", - "title": "gift card transactions", - "type": "object", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "-created_at", - "created_at" - ] - }, - "fields": { - "type": "array", - "enum": [ - [ - "id", - "type", - "source_id", - "reason", - "balance", - "amount", - "created_at", - "voucher_id", - "campaign_id", - "source", - "details" - ] - ], - "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
                  - `CREDITS_ADDITION`
                  - `CREDITS_REFUND`
                  - `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |", - "items": { - "type": "string" } - }, - "filters": { - "$ref": "#/components/schemas/16_obj_filter_gift_card_transactions_voucher_id" } } - }, - "16_obj_export_loyalty_card_transactions": { - "description": "List of available fields and filters that can be exported with loyalty card transactions along with the sorting order of the returned data.", - "title": "loyalty card transactions", - "type": "object", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "-created_at", - "created_at" - ] - }, - "fields": { - "type": "array", - "enum": [ - [ - "id", - "type", - "source_id", - "reason", - "balance", - "amount", - "created_at", - "voucher_id", - "campaign_id", - "details", - "related_transaction_id" - ] - ], - "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID assigned by Voucherify. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `POINTS_EXPIRATION`
                  - `POINTS_ADDITION`
                  - `POINTS_REMOVAL`
                  - `POINTS_TRANSFER_OUT`
                  - `POINTS_ACCRUAL`
                  - `POINTS_REFUND`
                  - `POINTS_REDEMPTION` |\n| source_id | Custom source ID of the transaction if one was included originally. | source_id_custom |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The loyalty card balance after the transaction. | |\n| amount | The amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | - `API`
                  - `voucherify-web-ui`
                  - `Automation` |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n| related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |", - "items": { - "type": "string" + } + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments." + }, + "system_metadata": { + "type": "object", + "description": "Object used to store system metadata information.", + "properties": { + "consents": { + "type": "object", + "description": "Stores a list of consent ID's along with the timestamp and decision on accepting or rejecting a marketing permission.", + "properties": { + "consentId": { + "type": "object", + "description": "Unique ID of a consent, i.e. `cnst_lbgOBhHTuDrB7sjIhFjvIALj`.", + "properties": { + "date": { + "type": "string", + "description": "Timestamp representing the date and time when a consent was accepted or rejected in ISO 8601 format.", + "example": "2022-05-10T08:50:10.338Z", + "format": "date-time" + }, + "value": { + "type": "boolean", + "description": "Accepted: `true`, Rejected: `false`" + } + } } - }, - "filters": { - "$ref": "#/components/schemas/16_obj_filter_loyalty_card_transactions_voucher_id" - } - } - }, - "16_obj_filter_publication_failure_code": { - "description": "Filter conditions set on the publication `failure_code`. Available options are:\n\n - `not_found`,\n\n - `no_voucher_suitable_for_publication`\n\n - `voucher_already_published`\n\n - `duplicate_source_id`\n\n - `too_many_vouchers_requested`", - "title": "Filter by failure code", - "type": "object", - "properties": { - "failure_code": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_publication_result": { - "description": "Filter conditions set on the publication `result`. Available options are:\n\n - `SUCCESS`\n\n - `FAILURE`", - "title": "Filter by result", - "type": "object", - "properties": { - "result": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_publication_customer_id": { - "description": "Filter conditions set on the publication `customer_id`.", - "title": "Filter by customer ID", - "type": "object", - "properties": { - "customer_id": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_publication_campaign_name": { - "description": "Filter conditions set on the publication `campaign_name`.", - "title": "Filter by campaign name", - "type": "object", - "properties": { - "campaign_name": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_publication_voucher_type": { - "description": "Filter conditions set on the publication `voucher_type`.", - "title": "Filter by voucher type", - "type": "object", - "properties": { - "voucher_type": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" } + }, + "source": { + "type": "string", + "description": "Takes on the name of the source of the integration if the customer was created through an integration, i.e. `Bigcommerce` or `Shopify`." } - }, - "16_obj_filter_publication_is_referral_code": { - "description": "Filter conditions set on the publication `is_referral_code`.", - "title": "Filter if the code is a referral code", - "type": "object", - "properties": { - "is_referral_code": { - "$ref": "#/components/schemas/16_filter_conditions_boolean" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } + } + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the customer was created in ISO 8601 format.", + "example": "2022-08-30T06:32:07.380Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the customer was updated in ISO 8601 format.", + "example": "2022-08-31T06:32:07.380Z", + "format": "date-time" + }, + "assets": { + "type": "object", + "description": "Contains information about the customer's cockpit.", + "properties": { + "cockpit_url": { + "type": "string", + "description": "Customer's cockpit URL address." } - }, - "16_obj_filter_publication_parent_object_id": { - "description": "Filter conditions set on the publication `parent_object_id`, which is the parent campaigns unique ID assigned by Voucherify.", - "title": "Filter by parent object ID", - "type": "object", - "properties": { - "parent_object_id": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_publication_related_object_id": { - "description": "Filter conditions set on the publication `related_object_id`.", - "title": "Filter by related object ID", - "type": "object", - "properties": { - "related_object_id": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_publication_source_id": { - "description": "Filter conditions set on the publication `source_id`.", - "title": "Filter by publication source ID", - "type": "object", - "properties": { - "source_id": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_order_status": { - "description": "Filter conditions set on the order `status`.", - "title": "Filter by status", - "type": "object", - "properties": { - "status": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_order_source_id": { - "description": "Filter conditions set on the order `source_id`.", - "title": "Filter by order source ID", - "type": "object", - "properties": { - "source_id": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_order_amount": { - "description": "Filter conditions set on the order `amount`.", - "title": "Filter by order amount", - "type": "object", - "properties": { - "amount": { - "$ref": "#/components/schemas/16_filter_conditions_number" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_order_total_amount": { - "description": "Filter conditions set on the order `total_amount`.", - "title": "Filter by order total amount", - "type": "object", - "properties": { - "total_amount": { - "$ref": "#/components/schemas/16_filter_conditions_number" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_order_discount_amount": { - "description": "Filter conditions set on the order `discount_amount`.", - "title": "Filter by order discount amount", - "type": "object", - "properties": { - "discount_amount": { - "$ref": "#/components/schemas/16_filter_conditions_number" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_order_total_discount_amount": { - "description": "Filter conditions set on the order `total_discount_amount`.", - "title": "Filter by order total discount amount", - "type": "object", - "properties": { - "total_discount_amount": { - "$ref": "#/components/schemas/16_filter_conditions_number" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_order_items_discount_amount": { - "description": "Filter conditions set on the order `items_discount_amount`.", - "title": "Filter by order items discount amount", - "type": "object", - "properties": { - "items_discount_amount": { - "$ref": "#/components/schemas/16_filter_conditions_number" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_points_expiration_campaign_id": { - "description": "Filter conditions set on`the `campaign_id`.", - "title": "Filter by campaign ID", - "type": "object", - "properties": { - "campaign_id": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_points_expiration_voucher_id": { - "description": "Filter conditions set on`the `voucher_id`.", - "title": "Filter by voucher ID", - "type": "object", - "properties": { - "voucher_id": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_gift_card_transactions_voucher_id": { - "description": "Filter conditions set on`the `voucher_id`.", - "title": "Filter by voucher ID", - "type": "object", - "properties": { - "voucher_id": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_obj_filter_loyalty_card_transactions_voucher_id": { - "description": "Filter conditions set on`the `voucher_id`.", - "title": "Filter by voucher ID", - "type": "object", - "properties": { - "voucher_id": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "16_filter_junction": { - "description": "Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE.", - "title": "Logical Operator Between Filters", - "type": "string", - "enum": [ - "AND", - "OR" - ] - }, - "16_filter_conditions_string": { - "title": "Filter by conditions", - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "conditions": { - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "$in": { - "type": "array", - "description": "Array of resource values that should be included in the results. (multiple values)", - "items": { - "type": "string" - } - }, - "$not_in": { - "type": "array", - "description": "Array of resource values that should be included in the results. (multiple values)", - "items": { - "type": "string" - } - }, - "$is": { - "type": "string", - "description": "Value is exactly this value. (single value)" - }, - "$is_not": { - "type": "string", - "description": "Results omit this value. (single value)" - }, - "$has_value": { - "type": "string", - "description": "Value is NOT null. The value for this parameter is an empty string." - }, - "$is_unknown": { - "type": "string", - "description": "Value is null. The value for this parameter is an empty string." - }, - "$starts_with": { - "type": "string", - "description": "Value starts with the specified string." - }, - "$ends_with": { - "type": "string", - "description": "Value ends with the specified string." - } - } - } - } - }, - "16_filter_conditions_number": { - "title": "Filter by conditions", - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "conditions": { - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "$in": { - "type": "array", - "description": "Array of resource values that should be included in the results. (multiple values)", - "items": { - "type": "integer" - } - }, - "$not_in": { - "type": "array", - "description": "Array of resource values that should be included in the results. (multiple values)", - "items": { - "type": "integer" - } - }, - "$is": { - "type": "integer", - "description": "Value is exactly this value. (single value)" - }, - "$is_not": { - "type": "integer", - "description": "Results omit this value. (single value)" - }, - "$has_value": { - "type": "string", - "description": "Value is NOT null. The value for this parameter is an empty string." - }, - "$is_unknown": { - "type": "string", - "description": "Value is null. The value for this parameter is an empty string." - }, - "$more_than": { - "type": "integer", - "description": "Value is more than the specified number." - }, - "$more_than_equal": { - "type": "integer", - "description": "Value is more than or equal to the specified number." - }, - "$less_than": { - "type": "integer", - "description": "Value is less than the specified number." - }, - "$less_than_equal": { - "type": "integer", - "description": "Value is less than or equal to the specified number." - } - } - } - } - }, - "16_filter_conditions_array": { - "title": "Filter by conditions", - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "conditions": { - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "$in": { - "type": "array", - "description": "Array of resource values that should be included in the results. (multiple values)", - "items": { - "type": "string" - } - }, - "$not_in": { - "type": "array", - "description": "Array of resource values that should be included in the results. (multiple values)", - "items": { - "type": "string" - } - }, - "$is": { - "type": "string", - "description": "Value is exactly this value. (single value)" - }, - "$is_not": { - "type": "string", - "description": "Results omit this value. (single value)" - }, - "$has_value": { - "type": "string", - "description": "Value is NOT null. The value for this parameter is an empty string." - }, - "$is_unknown": { - "type": "string", - "description": "Value is null. The value for this parameter is an empty string." - }, - "$starts_with": { - "type": "string", - "description": "Value starts with the specified string." - }, - "$ends_with": { - "type": "string", - "description": "Value ends with the specified string." - }, - "$count": { - "type": "integer", - "description": "Value has exactly this number of elements." - }, - "$count_less": { - "type": "integer", - "description": "Value has less than this number of elements." - }, - "$count_more": { - "type": "integer", - "description": "Value has more than this number of elements." - }, - "$contains": { - "type": "string", - "description": "Array contains this element." - } - } - } - } - }, - "16_filter_conditions_boolean": { - "title": "Filter by conditions", - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "conditions": { - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "$is": { - "type": "string", - "description": "Value is exactly this value. (single value)" - }, - "$is_not": { - "type": "string", - "description": "Results omit this value. (single value)" - }, - "$has_value": { - "type": "string", - "description": "Value is NOT null. The value for this parameter is an empty string." - }, - "$is_unknown": { - "type": "string", - "description": "Value is null. The value for this parameter is an empty string." - } - } - } - } - }, - "16_filter_conditions_date": { - "title": "Filter by conditions", - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "conditions": { - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "$after": { - "type": "string", - "description": "Value is after this date. Value for this parameter is in ISO 8601 format." - }, - "$before": { - "type": "string", - "description": "Value is before this date. Value for this parameter is in ISO 8601 format." - }, - "$has_value": { - "type": "string", - "description": "Value is NOT null. The value for this parameter is an empty string." - }, - "$is_unknown": { - "type": "string", - "description": "Value is null. The value for this parameter is an empty string." - } - } - } + } + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the customer.", + "default": "customer" + }, + "email_unsubscribed": { + "type": "boolean" + } + } + }, + "9_res_list_customers": { + "type": "object", + "title": "List Customers Response Body", + "description": "Response body schema for **GET** `/customers`.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about customers in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "customers", + "description": "Identifies the name of the attribute that contains the array of customer objects." + }, + "customers": { + "type": "array", + "description": "Contains array of customer objects.", + "items": { + "$ref": "#/components/schemas/9_obj_customer_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of customers." + } + } + }, + "9_res_list_customer_activities": { + "type": "object", + "title": "List Customer Activities Response Body", + "description": "Request body schema for `/customers/{customerId}/activities`.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about customer activities in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of customer activity objects." + }, + "data": { + "type": "array", + "description": "Array of customer activity objects.", + "items": { + "$ref": "#/components/schemas/9_obj_customer_activity_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of customer activities." + } + } + }, + "22_obj_webhooks": { + "type": "object", + "title": "Webhooks", + "description": "Data object model for a webhook.\n\n\nredemption.succeeded \nredemption.failed \nredemption.rollback.succeeded \nredemption.rollback.failed \npublication.succeeded \nvoucher.published \nvoucher.updated \nvoucher.deleted \nvoucher.created \nVoucher.enabled \nvoucher.disabled \nvoucher.loyalty_card.points_added \nvoucher.gift.balance_added \ncampaign.enabled \ncampaign.deleted \ncampaign.created \ncampaign.updated \ncampaign.disabled \ncampaign.vouchers.generation.completed \nbusiness_validation_rule.assignment.created \nbusiness_validation_rule.assignment.deleted \nbusiness_validation_rule.created \nbusiness_validation_rule.deleted \nbusiness_validation_rule.updated \ncustomer.created \ncustomer.deleted \ncustomer.rewarded \ncustomer.rewarded.loyalty_points \ncustomer.consents.revoked \ncustomer.consents.given ", + "x-tags": [ + "WEBHOOKS" + ], + "properties": { + "id": { + "type": "string", + "example": "event_m7MXf3zPf1n51IoUM8XHpP0w", + "description": "Unique event ID." + }, + "object": { + "type": "string", + "default": "event", + "description": "The type of object represented by JSON. This object stores information about events in a dictionary." + }, + "webhook_id": { + "type": "string", + "example": "wh_K7hpwSVDmKaxmBsDn0EpCvDy", + "description": "Unique webhook ID." + }, + "project_id": { + "type": "string", + "example": "proj_z7id5", + "description": "Unique Voucherify project ID." + }, + "created_at": { + "type": "string", + "example": "2022-11-30T16:53:30.434Z", + "format": "date-time", + "description": "Timestamp representing the date and time when the webhook was created in ISO 8601 format." + }, + "type": { + "type": "string", + "enum": [ + "redemption.succeeded", + "redemption.failed", + "redemption.rollback.succeeded", + "redemption.rollback.failed", + "publication.succeeded", + "voucher.published", + "voucher.updated", + "voucher.deleted", + "voucher.created", + "Voucher.enabled", + "voucher.disabled", + "voucher.loyalty_card.points_added", + "voucher.gift.balance_added", + "campaign.enabled", + "campaign.deleted", + "campaign.created", + "campaign.updated", + "campaign.disabled", + "campaign.vouchers.generation.completed", + "business_validation_rule.assignment.created", + "business_validation_rule.assignment.deleted", + "business_validation_rule.created", + "business_validation_rule.deleted", + "business_validation_rule.updated", + "customer.created", + "customer.deleted", + "customer.rewarded", + "customer.rewarded.loyalty_points", + "customer.consents.revoked", + "customer.consents.given" + ] + }, + "data": { + "$ref": "#/components/schemas/22_obj_webhook_object_data" + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs attached to a webhook. The metadata object stores all custom attributes assigned to the webhook. It can be useful for storing additional information about the webhook in a structured format.", + "properties": { + "source": { + "type": "string", + "description": "The origin of the webhook.", + "enum": [ + "API" + ] } - }, - "16_filter_conditions_date_time": { - "title": "Filter by conditions", - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "conditions": { - "type": "object", - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "$after": { - "type": "string", - "description": "Value is after this date. Value for this parameter is in ISO 8601 format.", - "format": "date-time" - }, - "$before": { - "type": "string", - "description": "Value is before this date. Value for this parameter is in ISO 8601 format.", - "format": "date-time" - }, - "$has_value": { - "type": "string", - "description": "Value is NOT null. The value for this parameter is an empty string." - }, - "$is_unknown": { - "type": "string", - "description": "Value is null. The value for this parameter is an empty string." - } + } + } + } + }, + "22_obj_webhook_object_data": { + "title": "Webhook Object", + "description": "Webhook event data object schema.", + "anyOf": [ + { + "$ref": "#/components/schemas/22_obj_event_redemption_succeeded" + }, + { + "$ref": "#/components/schemas/22_obj_event_redemption_failed" + }, + { + "$ref": "#/components/schemas/22_obj_event_redemption_rollback_succeeded" + }, + { + "$ref": "#/components/schemas/22_obj_event_redemption_rollback_failed" + }, + { + "$ref": "#/components/schemas/22_obj_event_publication_succeeded" + }, + { + "$ref": "#/components/schemas/22_obj_event_voucher_published" + }, + { + "$ref": "#/components/schemas/22_obj_event_voucher_updated" + }, + { + "$ref": "#/components/schemas/22_obj_event_voucher_deleted" + }, + { + "$ref": "#/components/schemas/22_obj_event_voucher_created" + }, + { + "$ref": "#/components/schemas/22_obj_event_voucher_enabled" + }, + { + "$ref": "#/components/schemas/22_obj_event_voucher_disabled" + }, + { + "$ref": "#/components/schemas/22_obj_event_voucher_loyalty_card_points_added" + }, + { + "$ref": "#/components/schemas/22_obj_event_voucher_gift_balance_added" + }, + { + "$ref": "#/components/schemas/22_obj_event_campaign_enabled" + }, + { + "$ref": "#/components/schemas/22_obj_event_campaign_deleted" + }, + { + "$ref": "#/components/schemas/22_obj_event_campaign_created" + }, + { + "$ref": "#/components/schemas/22_obj_event_campaign_updated" + }, + { + "$ref": "#/components/schemas/22_obj_event_campaign_disabled" + }, + { + "$ref": "#/components/schemas/22_obj_event_campaign_vouchers_generation_completed" + }, + { + "$ref": "#/components/schemas/22_obj_event_business_validation_rule_assignment_created" + }, + { + "$ref": "#/components/schemas/22_obj_event_business_validation_rule_assignment_deleted" + }, + { + "$ref": "#/components/schemas/22_obj_event_business_validation_rule_created" + }, + { + "$ref": "#/components/schemas/22_obj_event_business_validation_rule_deleted" + }, + { + "$ref": "#/components/schemas/22_obj_event_business_validation_rule_updated" + }, + { + "$ref": "#/components/schemas/22_obj_event_customer_created" + }, + { + "$ref": "#/components/schemas/22_obj_event_customer_deleted" + }, + { + "$ref": "#/components/schemas/22_obj_event_customer_rewarded" + }, + { + "$ref": "#/components/schemas/22_obj_event_customer_rewarded_loyalty_points" + }, + { + "$ref": "#/components/schemas/22_obj_event_customer_consents_given" + }, + { + "$ref": "#/components/schemas/22_obj_event_customer_consents_revoked" + } + ] + }, + "22_obj_event_redemption_succeeded": { + "title": "Redemption Succeeded", + "description": "Event data object schema for `redemption.succeeded`.", + "type": "object" + }, + "22_obj_event_redemption_failed": { + "title": "Redemption Failed", + "description": "Event data object schema for `redemption.failed`.", + "type": "object" + }, + "22_obj_event_redemption_rollback_failed": { + "title": "Redemption Rollback Failed", + "description": "Event data object schema for `redemption.rollback.failed`.", + "type": "object" + }, + "22_obj_event_redemption_rollback_succeeded": { + "title": "Redemption Rollback Succeeded", + "description": "Event data object schema for `redemption.rollback.succeeded`.", + "type": "object" + }, + "22_obj_event_publication_succeeded": { + "title": "Publication Succeeded", + "description": "Event data object schema for `publication.succeeded`.", + "type": "object" + }, + "22_obj_event_voucher_published": { + "title": "Voucher Published", + "description": "Event data object schema for `voucher.published`.", + "type": "object" + }, + "22_obj_event_voucher_updated": { + "title": "Voucher Updated", + "description": "Event data object schema for `voucher.updated`.", + "type": "object" + }, + "22_obj_event_voucher_deleted": { + "title": "Voucher Deleted", + "description": "Event data object schema for `voucher.deleted`.", + "type": "object" + }, + "22_obj_event_voucher_created": { + "title": "Voucher Created", + "description": "Event data object schema for `voucher.created`.", + "type": "object" + }, + "22_obj_event_voucher_enabled": { + "title": "Voucher Enabled", + "description": "Event data object schema for `voucher.enabled`.", + "type": "object" + }, + "22_obj_event_voucher_disabled": { + "title": "Voucher Disabled", + "description": "Event data object schema for `voucher.disabled`.", + "type": "object" + }, + "22_obj_event_voucher_loyalty_card_points_added": { + "title": "Voucher Loyalty Card Points Added", + "description": "Event data object schema for `voucher.loyalty_card.points_added`.", + "type": "object", + "properties": { + "object": { + "$ref": "#/components/schemas/1_obj_voucher_object" + }, + "related_object": { + "$ref": "#/components/schemas/8_res_add_remove_points_balance" + }, + "voucher": { + "$ref": "#/components/schemas/1_obj_voucher_object" + } + } + }, + "22_obj_event_voucher_gift_balance_added": { + "title": "Voucher Gift Balance Added", + "description": "Event data object schema for `voucher.gift.balance_added`.", + "type": "object" + }, + "22_obj_event_campaign_enabled": { + "title": "Campaign Enabled", + "description": "Event data object schema for `campaign.enabled`.", + "type": "object" + }, + "22_obj_event_campaign_deleted": { + "title": "Campaign Deleted", + "description": "Event data object schema for `campaign.deleted`.", + "type": "object", + "properties": { + "object": { + "$ref": "#/components/schemas/2_obj_campaign_object" + }, + "campaign": { + "$ref": "#/components/schemas/2_obj_campaign_object" + } + } + }, + "22_obj_event_campaign_created": { + "title": "Campaign Created", + "description": "Event data object schema for `campaign.created`.", + "type": "object" + }, + "22_obj_event_campaign_updated": { + "title": "Campaign Updated", + "description": "Event data object schema for `campaign.updated`.", + "type": "object" + }, + "22_obj_event_campaign_disabled": { + "title": "Campaign Disabled", + "description": "Event data object schema for `campaign.disabled`.", + "type": "object" + }, + "22_obj_event_campaign_vouchers_generation_completed": { + "title": "Campaign Vouchers Generation Completed", + "description": "Event data object schema for `campaign.vouchers.generation.completed`.", + "type": "object" + }, + "22_obj_event_business_validation_rule_assignment_created": { + "title": "Business Validation Rule Assignment Created", + "description": "Event data object schema for `business_validation_rule.assignment.created`.", + "type": "object" + }, + "22_obj_event_business_validation_rule_assignment_deleted": { + "title": "Business Validation Rule Assignment Deleted", + "description": "Event data object schema for `business_validation_rule.assignment.deleted`.", + "type": "object" + }, + "22_obj_event_business_validation_rule_created": { + "title": "Business Validation Rule Created", + "description": "Event data object schema for `business_validation_rule.created`.", + "type": "object" + }, + "22_obj_event_business_validation_rule_deleted": { + "title": "Business Validation Rule Deleted", + "description": "Event data object schema for `business_validation_rule.deleted`.", + "type": "object" + }, + "22_obj_event_business_validation_rule_updated": { + "title": "Business Validation Rule Updated", + "description": "Event data object schema for `business_validation_rule.updated`.", + "type": "object" + }, + "22_obj_event_customer_created": { + "title": "Customer Created", + "description": "Event data object schema for `customer.created`.", + "type": "object" + }, + "22_obj_event_customer_deleted": { + "title": "Customer Deleted", + "description": "Event data object schema for `customer.deleted`.", + "type": "object" + }, + "22_obj_event_customer_rewarded": { + "title": "Customer Rewarded", + "description": "Event data object schema for `customer.rewarded`.", + "type": "object" + }, + "22_obj_event_customer_rewarded_loyalty_points": { + "title": "Customer Rewarded Loyalty Points", + "description": "Event data object schema for `customer.rewarded.loyalty_points`.", + "type": "object", + "properties": { + "object": { + "$ref": "#/components/schemas/9_obj_customer_object" + }, + "related_object": { + "$ref": "#/components/schemas/8_res_add_remove_points_balance" + }, + "customer": { + "$ref": "#/components/schemas/9_obj_customer_object" + }, + "voucher": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "loyalty_card": { + "type": "object", + "properties": { + "points": { + "type": "integer" + }, + "balance": { + "type": "integer" } } + }, + "type": { + "type": "string", + "default": "LOYALTY_CARD" + }, + "campaign": { + "type": "string" + }, + "campaign_id": { + "type": "string" + }, + "is_referral_code": { + "type": "boolean" + }, + "holder_id": { + "type": "string", + "example": "cust_o3ffuQSwM0vlxeJJoMqiOLMI" } - }, - "17_obj_async_action_object": { - "title": "Async Action Object", - "type": "object", - "description": "This is an object representing an asynchronous action.", - "x-tags": [ - "ASYNC ACTIONS API" - ], - "properties": { - "id": { - "type": "string", - "example": "aa_0adad13d6f057f088e", - "description": "Async action unique ID." - }, - "type": { - "type": "string", - "description": "Type of async action.", - "enum": [ - "CAMPAIGN.VOUCHERS_IMPORT", - "CAMPAIGN.VOUCHERS_IMPORT_CSV", - "CAMPAIGN.VOUCHERS_UPDATE", - "CAMPAIGN.VOUCHERS_DELETE", - "CAMPAIGN.VOUCHERS_GENERATE", - "CAMPAIGNS.METADATA_KEY_PURGE", - "CUSTOMERS.IMPORT_CSV", - "CUSTOMERS.BULK_UPDATE", - "CUSTOMERS.METADATA_UPDATE", - "CUSTOMERS.METADATA_KEY_PURGE", - "PRODUCTS.BULK_UPDATE", - "PRODUCTS.METADATA_UPDATE", - "PRODUCTS.METADATA_KEY_PURGE", - "PRODUCTS.IMPORT_CSV", - "SKUS.IMPORT_CSV", - "VOUCHERS.IMPORT", - "VOUCHERS.IMPORT_CSV", - "VOUCHERS.BULK_UPDATE", - "VOUCHERS.METADATA_UPDATE", - "VOUCHERS.METADATA_KEY_PURGE", - "ORDERS.IMPORT", - "ORDERS.METADATA_KEY_PURGE" - ] + } + }, + "campaign": { + "type": "string" + }, + "earning_rule": { + "$ref": "#/components/schemas/8_obj_earning_rule_object" + } + } + }, + "22_obj_event_customer_consents_revoked": { + "title": "Customer Consents Revoked", + "description": "Event data object schema for `customer.consents.revoked`.", + "type": "object" + }, + "22_obj_event_customer_consents_given": { + "title": "Customer Consents Given", + "description": "Event data object schema for `customer.consents.given`.", + "type": "object" + }, + "9_obj_customer_activity_object": { + "type": "object", + "title": "Customer Activity Object", + "description": "This is an object representing customer activity. \n\nThis is a general object which presents moments from customers' activity. There are all types of different events that customers perform during their journey once they participate in Promotions. Events describe moments when customers redeem coupons and earn points or rewards. The list of all types of activities is listed below.\n\nThe details describing the activity are collected in a property named `data`. In this object, software integrators will find all further information explaining the event context. \n\nCustomer Activity Object is a type of [Event](ref:track-custom-event) which is our way of letting you know when something interesting happens in your project. When an interesting event concerning an individual customer occurs, we create a new Customer Activity object. For example, when a code is published to a customer, we create a `customer.publication.succeeded` event.\n\n| **Event types (definition in progress)** |\n|:---|\n| customer.confirmed |\n| customer.created |\n| customer.updated |\n| customer.deleted |\n| customer.referred |\n| customer.custom_event |\n| customer.segment.entered |\n| customer.segment.left |\n| customer.sms.sent |\n| customer.sms.failed |\n| customer.email.sent |\n| customer.email.failed |\n| customer.activecampaign.sent |\n| customer.activecampaign.failed |\n| customer.braze.sent |\n| customer.braze.failed |\n| customer.mailchimp.sent |\n| customer.mailchimp.failed |\n| customer.intercom.sent |\n| customer.intercom.failed |\n| customer.rewarded |\n| customer.rewarded.loyalty_points |\n| customer.voucher.gift.balance_added |\n| customer.voucher.loyalty_card.points_added |\n| customer.voucher.loyalty_card.points_transferred |\n| customer.publication.succeeded |\n| customer.publication.failed |\n| customer.redemption.succeeded |\n| customer.redemption.failed |\n| customer.redemption.rollback.succeeded |\n| customer.redemption.rollback.failed |\n| customer.consents.given |\n| customer.consents.revoked |", + "x-tags": [ + "CUSTOMERS API" + ], + "properties": { + "id": { + "type": "string", + "description": "Unique event ID, assigned by Voucherify.", + "example": "evcus_0c150c51730c6b60b1" + }, + "type": { + "type": "string", + "description": "Event type.", + "enum": [ + "customer.confirmed", + "customer.created", + "customer.updated", + "customer.deleted", + "customer.referred", + "customer.custom_event", + "customer.segment_entered", + "customer.segment.left", + "customer.sms.sent", + "customer.sms.failed", + "customer.email.sent", + "customer.email.failed", + "customer.activecampaign.sent", + "customer.braze.sent", + "customer.mailchimp.sent", + "customer.intercom.sent", + "customer.intercom.failed", + "customer.rewarded", + "customer.rewarded.loyalty_points", + "customer.voucher.gift.balance_added", + "customer.voucher.loyalty_card.points_added", + "customer.voucher.loyalty_card.points_transferred", + "customer.publication.succeeded", + "customer.publication.failed", + "customer.redemption.succeeded", + "customer.redemption.failed", + "customer.redemption.rollback.succeeded", + "customer.redemption.rollback.failed", + "customer.consents.given", + "customer.consents.revoked" + ] + }, + "data": { + "type": "array", + "description": "Contains details about the event. The objects that are returned in the data attribute differ based on the context of the event type.", + "items": { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data" + } + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the customer activity occurred in ISO 8601 format.", + "example": "2022-08-30T09:14:07.660Z", + "format": "date-time" + } + } + }, + "9_obj_customer_activity_object_data": { + "title": "Customer Activity Data Object", + "description": "Event data object schema.", + "anyOf": [ + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_confirmed" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_created" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_updated" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_deleted" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_referred" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_custom_event" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_segment_entered" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_segment_left" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_sms_sent" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_sms_failed" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_email_sent" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_email_failed" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_activecampaign_sent" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_activecampaign_failed" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_braze_sent" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_braze_failed" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_mailchimp_sent" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_mailchimp_failed" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_intercom_sent" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_intercom_failed" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_rewarded" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_rewarded_loyalty_points" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_voucher_gift_voucher_balance_added" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_voucher_loyalty_card_points_added" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_voucher_loyalty_card_points_transferred" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_publication_succeeded" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_publication_failed" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_redemption_succeeded" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_redemption_failed" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_redemption_rollback_succeeded" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_redemption_rollback_failed" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_consents_given" + }, + { + "$ref": "#/components/schemas/9_obj_customer_activity_object_data_customer_consents_revoked" + } + ] + }, + "9_obj_customer_activity_object_data_customer_email_unsubscribed": { + "title": "Email Unsubscribed", + "description": "Email unsubscribed", + "type": "object", + "properties": { + "email_unsubscribed": { + "type": "boolean" + } + } + }, + "9_obj_customer_activity_object_data_customer_confirmed": { + "title": "Customer Confirmed", + "description": "Event data object schema for `customer.confirmed`.", + "type": "object", + "properties": { + "customer": { + "$ref": "#/components/schemas/9_obj_customer_object_email_parameter" + }, + "unconfirmed_customer": { + "type": "string", + "example": "ucust_1qa70mVfYkl11Ab0ZxDPdWNa" + } + } + }, + "9_obj_customer_activity_object_data_customer_created": { + "title": "Customer Created", + "description": "Event data object schema for `customer.created`.", + "type": "object", + "properties": { + "customer": { + "$ref": "#/components/schemas/9_obj_customer_object_email_parameter" + } + } + }, + "9_obj_customer_activity_object_data_customer_updated": { + "title": "Customer Updated", + "description": "Event data object schema for `customer.updated`.", + "type": "object", + "properties": { + "customer": { + "$ref": "#/components/schemas/9_obj_customer_object_email_parameter" + } + } + }, + "9_obj_customer_activity_object_data_customer_deleted": { + "title": "Customer Deleted", + "description": "Event data object schema for `customer.deleted`.", + "type": "object", + "properties": { + "customer": { + "$ref": "#/components/schemas/9_obj_customer_object_email_parameter" + } + } + }, + "9_obj_customer_activity_object_data_customer_referred": { + "title": "Customer Referred", + "description": "Event data object schema for `customer.referred`.", + "type": "object", + "properties": { + "voucher": { + "type": "object" + }, + "campaign": { + "type": "object" + }, + "customer": { + "type": "object" + }, + "referrer": { + "type": "object" + }, + "redemption": { + "type": "object" + }, + "custom_event": { + "type": "object" + } + } + }, + "9_obj_customer_activity_object_data_customer_custom_event": { + "title": "Custom Event", + "description": "Event data object schema for `customer.custom_event`.", + "type": "object", + "properties": { + "event": { + "type": "object" + }, + "loyalty": { + "type": "object" + }, + "customer": { + "type": "object" + }, + "referral": { + "type": "object" + }, + "event_schema": { + "type": "object" + } + } + }, + "9_obj_customer_activity_object_data_customer_segment_entered": { + "title": "Segment Entered", + "description": "Event data object schema for `customer.segment.entered`.", + "type": "object", + "properties": { + "segment": { + "type": "object" + }, + "customer": { + "type": "object" + } + } + }, + "9_obj_customer_activity_object_data_customer_segment_left": { + "title": "Segment Left", + "description": "Event data object schema for `customer.segment.left`.", + "type": "object", + "properties": { + "segment": { + "type": "object" + }, + "customer": { + "type": "object" + } + } + }, + "9_obj_customer_activity_object_data_customer_sms_sent": { + "title": "SMS Sent", + "description": "Event data object schema for `customer.sms.sent`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_sms_failed": { + "title": "SMS Failed", + "description": "Event data object schema for `customer.sms.failed`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_email_sent": { + "title": "Email Sent", + "description": "Event data object schema for `customer.email.sent`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_email_failed": { + "title": "Email Failed", + "description": "Event data object schema for `customer.email.failed`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_activecampaign_sent": { + "title": "ActiveCampaign Sent", + "description": "Event data object schema for `customer.activecampaign.sent`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_activecampaign_failed": { + "title": "ActiveCampaign Failed", + "description": "Event data object schema for `customer.activecampaign.failed`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_braze_sent": { + "title": "Braze Sent", + "description": "Event data object schema for `customer.braze.sent`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_braze_failed": { + "title": "Braze Failed", + "description": "Event data object schema for `customer.braze.failed`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_mailchimp_sent": { + "title": "Mailchimp Sent", + "description": "Event data object schema for `customer.mailchimp.sent`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_mailchimp_failed": { + "title": "Mailchimp Failed", + "description": "Event data object schema for `customer.mailchimp.failed`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_intercom_sent": { + "title": "Intercom Sent", + "description": "Event data object schema for `customer.intercom.sent`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_intercom_failed": { + "title": "Intercom Failed", + "description": "Event data object schema for `customer.intercom.failed`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_rewarded": { + "title": "Customer Rewarded", + "description": "Event data object schema for `customer.rewarded`.", + "type": "object", + "properties": { + "holder": { + "type": "object" + }, + "reward": { + "type": "object" + }, + "balance": { + "type": "object" + }, + "voucher": { + "type": "object" + }, + "campaign": { + "type": "object" + }, + "customer": { + "type": "object" + }, + "redemption": { + "type": "object" + }, + "custom_event": { + "type": "object" + }, + "referral_tier": { + "type": "object" + }, + "customer_event": { + "type": "object" + } + } + }, + "9_obj_customer_activity_object_data_customer_rewarded_loyalty_points": { + "title": "Customer Rewarded Loyalty Points", + "description": "Event data object schema for `customer.rewarded.loyalty_points`.", + "type": "object", + "properties": { + "order": { + "type": "object" + }, + "holder": { + "type": "object" + }, + "balance": { + "type": "object" + }, + "voucher": { + "type": "object" + }, + "campaign": { + "type": "object" + }, + "customer": { + "type": "object" + }, + "earning_rule": { + "type": "object" + }, + "loyalty_tier": { + "type": "object" + } + } + }, + "9_obj_customer_activity_object_data_customer_voucher_gift_voucher_balance_added": { + "title": "Gift Voucher Balance Added", + "description": "Event data object schema for `customer.voucher.gift.balance_added`.", + "type": "object", + "properties": { + "balance": { + "type": "object" + }, + "voucher": { + "type": "object" + }, + "campaign": { + "type": "object" + }, + "customer": { + "type": "object" + } + } + }, + "9_obj_customer_activity_object_data_customer_voucher_loyalty_card_points_added": { + "title": "Loyalty Card Points Added", + "description": "Event data object schema for `customer.voucher.loyalty_card.points_added`.", + "type": "object", + "properties": { + "balance": { + "type": "object" + }, + "voucher": { + "type": "object" + }, + "campaign": { + "type": "object" + }, + "customer": { + "type": "object" + } + } + }, + "9_obj_customer_activity_object_data_customer_voucher_loyalty_card_points_transferred": { + "title": "Loyalty Card Points Transferred", + "description": "Event data object schema for `customer.voucher.loyalty_card.points_transferred`.", + "type": "object" + }, + "9_obj_customer_activity_object_data_customer_publication_succeeded": { + "title": "Publication Succeeded", + "description": "Event data object schema for `customer.publication.succeeded`.", + "type": "object", + "properties": { + "campaign": { + "type": "object" + }, + "customer": { + "type": "object" + }, + "publication": { + "type": "object" + } + } + }, + "9_obj_customer_activity_object_data_customer_publication_failed": { + "title": "Publication Failed", + "description": "Event data object schema for `customer.publication.failed`.", + "type": "object", + "properties": { + "campaign": { + "type": "object" + }, + "customer": { + "type": "object" + }, + "publication": { + "type": "object" + } + } + }, + "9_obj_customer_activity_object_data_customer_redemption_succeeded": { + "title": "Redemption Succeeded", + "description": "Event data object schema for `customer.redemption.succeeded`.", + "type": "object", + "properties": { + "order": { + "type": "object" + }, + "holder": { + "type": "object" + }, + "voucher": { + "type": "object" + }, + "campaign": { + "type": "object" + }, + "customer": { + "type": "object" + }, + "redemption": { + "type": "object" + }, + "promotion_tier": { + "type": "object" + } + } + }, + "9_obj_customer_activity_object_data_customer_redemption_failed": { + "title": "Redemption Succeeded", + "description": "Event data object schema for `customer.redemption.failed`.", + "type": "object", + "properties": { + "order": { + "type": "object" + }, + "holder": { + "type": "object" + }, + "voucher": { + "type": "object" + }, + "campaign": { + "type": "object" + }, + "customer": { + "type": "object" + }, + "redemption": { + "type": "object" + }, + "promotion_tier": { + "type": "object" + } + } + }, + "9_obj_customer_activity_object_data_customer_redemption_rollback_succeeded": { + "title": "Redemption Rollback Succeeded", + "description": "Event data object schema for `customer.redemption.rollback.succeeded`.", + "type": "object", + "properties": { + "order": { + "type": "object" + }, + "holder": { + "type": "object" + }, + "voucher": { + "type": "object" + }, + "campaign": { + "type": "object" + }, + "customer": { + "type": "object" + }, + "redemption": { + "type": "object" + }, + "promotion_tier": { + "type": "object" + }, + "redemption_rollback": { + "type": "object" + } + } + }, + "9_obj_customer_activity_object_data_customer_redemption_rollback_failed": { + "title": "Redemption Rollback Failed", + "description": "Event data object schema for `customer.redemption.rollback.failed`.", + "type": "object", + "properties": { + "order": { + "type": "object" + }, + "holder": { + "type": "object" + }, + "campaign": { + "type": "object" + }, + "customer": { + "type": "object" + }, + "redemption": { + "type": "object" + }, + "promotion_tier": { + "type": "object" + }, + "redemption_rollback": { + "type": "object" + } + } + }, + "9_obj_customer_activity_object_data_customer_consents_given": { + "title": "Consents Given", + "description": "Event data object schema for `customer.consents.given`.", + "type": "object", + "properties": { + "consents": { + "type": "object" + }, + "customer": { + "type": "object" + } + } + }, + "9_obj_customer_activity_object_data_customer_consents_revoked": { + "title": "Consents Given", + "description": "Event data object schema for `customer.consents.revoked`.", + "type": "object", + "properties": { + "consents": { + "type": "object" + }, + "customer": { + "type": "object" + } + } + }, + "customers_permanent_deletion_response_body": { + "type": "object", + "title": "Customer Permanent Deletion Response Body", + "description": "Response body schema for `/customers/{customerId}/permanent-deletion`.", + "properties": { + "id": { + "type": "string", + "description": "Unique permanent deletion object ID.", + "example": "del_mgzqZNwUnwnt1Ddw6phEG90Q" + }, + "created_at": { + "type": "string", + "example": "2022-09-02T17:55:47.865Z", + "description": "Timestamp representing the date and time when the customer was requested to be deleted in ISO 8601 format.", + "format": "date-time" + }, + "related_object_id": { + "type": "string", + "example": "cust_m557pDDl4IGXexkU6KOQ2Dwi", + "description": "Unique customer ID that is being deleted." + }, + "related_object": { + "type": "string", + "description": "Object being deleted.", + "default": "customer" + }, + "status": { + "type": "string", + "description": "Deletion status.", + "default": "DONE" + }, + "data_json": { + "type": "object", + "description": "Statistics summarizing the number of related information that was deleted.", + "required": [ + "events", + "customer_events", + "daily_events", + "segments", + "orders", + "order_events", + "customer" + ], + "properties": { + "events": { + "type": "integer", + "description": "Number of events deleted." + }, + "customer_events": { + "type": "integer", + "description": "Number of customer events deleted." + }, + "daily_events": { + "type": "integer", + "description": "Number of daily events deleted." + }, + "segments": { + "type": "integer", + "description": "Number of segments deleted." + }, + "orders": { + "type": "integer", + "description": "Number of orders deleted." + }, + "order_events": { + "type": "integer", + "description": "Number of order events deleted." + }, + "customer": { + "type": "integer", + "description": "Number of customers deleted.", + "default": 1 + } + } + }, + "object": { + "type": "string", + "description": "The type of object represented by JSON.", + "default": "pernament_deletion" + } + }, + "required": [ + "id", + "created_at", + "related_object_id", + "related_object", + "status", + "data_json", + "object" + ] + }, + "customers_update_metadata_in_bulk_request_body": { + "type": "object", + "title": "Update Customers' Metadata in bulk Request Body", + "description": "Request body schema for `/customers/metadata/async`.", + "properties": { + "source_ids": { + "type": "array", + "description": "An array of customer `source_id`'s.", + "items": { + "type": "string" + } + }, + "metadata": { + "type": "object", + "description": "Metadata key value pairs to be updated. A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments." + } + }, + "required": [ + "source_ids", + "metadata" + ] + }, + "customers_update_in_bulk_request_body": { + "type": "array", + "title": "Update Customers in bulk Request Body", + "description": "Request body schema for `/customers/bulk/async`.", + "items": { + "$ref": "#/components/schemas/customers_update_in_bulk_item_request_body" + } + }, + "customers_update_in_bulk_item_request_body": { + "title": "Update Customers in bulk Request Body", + "description": "Request body schema for `/customers/bulk/async`.", + "properties": { + "source_id": { + "type": "string", + "description": "Unique customer source ID." + }, + "name": { + "type": [ + "string", + "null" + ], + "description": "Customer's first and last name." + }, + "description": { + "type": [ + "string", + "null" + ], + "description": "An arbitrary string that you can attach to a customer object." + }, + "email": { + "type": [ + "string", + "null" + ], + "description": "Customer's email address." + }, + "phone": { + "type": [ + "string", + "null" + ], + "description": "Customer's phone number." + }, + "address": { + "type": "object", + "description": "Customer's address.", + "properties": { + "city": { + "type": [ + "string", + "null" + ], + "description": "City" + }, + "state": { + "type": [ + "string", + "null" + ], + "description": "State" + }, + "line_1": { + "type": [ + "string", + "null" + ], + "description": "First line of address." + }, + "line_2": { + "type": [ + "string", + "null" + ], + "description": "Second line of address." + }, + "country": { + "type": [ + "string", + "null" + ], + "description": "Country." + }, + "postal_code": { + "type": [ + "string", + "null" + ], + "description": "Postal code." + } + } + }, + "birthdate": { + "type": [ + "string", + "null" + ], + "description": "Customer's birthdate; format `YYYY-MM-DD`." + }, + "metadata": { + "type": [ + "object", + "null" + ], + "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments. " + } + }, + "required": [ + "source_id" + ] + }, + "9_req_update_customers_consents": { + "type": "object", + "title": "Update Customer Consents Request Body", + "description": "Request body schema for **PUT** `/customers/{customerId}/consents`.", + "properties": { + "consent_id": { + "type": "boolean", + "description": "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." + }, + "unsubscribed": { + "type": "boolean", + "description": "To deny all consents, use `unsubscribed` as a consent identifier and `true` as a value." + } + } + }, + "10_obj_order_object": { + "type": "object", + "title": "Order object", + "description": "This is an object representing an order. \n\nThe purchase transactions can be tracked in Voucherify by the creation of an order object. You can create, retrieve, and pay individual orders, as well as list and export all of them in a CSV format. Orders are identified by a unique ID.\n\nOrders are automatically created during the [redeem voucher](ref:redeem-voucher) and [redeem promotion](redeem-promotion) call.\n\n\n> #### order.id and order session\n>\n> If you use the same order.id in more than one redemption request, all valid discounts provided in the redemption payload will be applied to the given order.\n> \n> Each time you use particular order in your requests, the API will automatically trigger a new session linked to the order.id. The session is active during the request and ends asynchronously after the request is completed. The session mechanism ensures that the particular order.id can be used in one API request at once.", + "x-tags": [ + "ORDERS API" + ], + "properties": { + "id": { + "type": "string", + "description": "Unique order ID, assigned by Voucherify.", + "example": "ord_GFDbbv2I0wnO0sFUBOOOXPj2" + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the order was created in ISO 8601 format.", + "example": "2022-03-09T11:19:04.819Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2022-08-12T13:34:10.681Z", + "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format.", + "format": "date-time" + }, + "status": { + "type": "string", + "description": "Order status.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULFILLED" + ] + }, + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "discount_amount": { + "type": "integer", + "description": "Sum of all order-level discounts applied to the order." + }, + "items_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" + }, + "total_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`\t" + }, + "total_amount": { + "type": "integer", + "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", + "items": { + "type": "object", + "properties": { + "object": { + "type": "string", + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." }, - "status": { + "product_id": { "type": "string", - "description": "Status of async action. Informs you whether the async action has already been completed.", - "enum": [ - "ENQUEUED", - "IN_PROGRESS", - "DONE", - "FAILED" - ] + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, - "result": { - "anyOf": [ - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_vouchers_import" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_vouchers_import_csv" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_vouchers_update" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_vouchers_delete" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_vouchers_generate" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_metadata_key_purge" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_customers_import_csv" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_customers_bulk_update" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_customers_metadata_update" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_customers_metadata_key_purge" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_products_bulk_update" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_products_metadata_update" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_products_import_csv" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_skus_import_csv" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_products_metadata_key_purge" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_vouchers_import" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_vouchers_import_csv" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_vouchers_bulk_update" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_vouchers_metadata_update" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_vouchers_metadata_key_purge" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_orders_import" - }, - { - "$ref": "#/components/schemas/17_res_obj_get_async_action_result_orders_metadata_key_purge" - } - ] - }, - "created_at": { + "sku_id": { "type": "string", - "description": "Timestamp representing the date and time when the async action was scheduled in ISO 8601 format.", - "example": "2022-06-23T11:21:45.578Z", - "format": "date-time" + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." }, - "updated_at": { - "type": "string", - "example": "2022-06-23T11:21:46.795Z", - "description": "Timestamp representing the date and time when the async action was updated in ISO 8601 format.", - "format": "date-time" + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." }, - "request_id": { - "type": "string", - "example": "v-0b45cee140c3c9b5ca", - "description": "Unique request ID." + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." }, - "processing_time": { + "discount_amount": { "type": "integer", - "example": 1217, - "description": "The length of time it took to process the request in milliseconds." + "description": "The item-level discount applied to the item." }, - "progress": { + "price": { "type": "integer", - "description": "% progress to completion of the asynchronous action.", - "minimum": 0, - "maximum": 100 + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." }, - "object": { - "type": "string", - "default": "async_action", - "description": "The type of object represented by JSON. This object stores information about the `async_action`." - } - } - }, - "17_res_list_async_actions_GET": { - "description": "Response body schema for listing asynchronous actions. \n\nThe table below lists the possible types of async actions. The types are different for each endpoint generating the async action.\n\n| **Types by Context** |\n|:---|\n| **CAMPAIGN** |\n| CAMPAIGN.VOUCHERS_IMPORT
                  CAMPAIGN.VOUCHERS_IMPORT_CSV
                  CAMPAIGN.VOUCHERS_UPDATE
                  CAMPAIGN.VOUCHERS_DELETE
                  CAMPAIGN.VOUCHERS_GENERATE |\n| **CUSTOMERS** |\n| CUSTOMERS.IMPORT_CSV
                  CUSTOMERS.BULK_UPDATE
                  CUSTOMERS.METADATA_UPDATE
                  CUSTOMERS.METADATA_KEY_PURGE |\n| **PRODUCTS** |\n| PRODUCTS.BULK_UPDATE
                  PRODUCTS.METADATA_UPDATE
                  PRODUCTS.METADATA_KEY_PURGE
                  PRODUCTS.IMPORT_CSV
                  SKUS.IMPORT_CSV |\n| **VOUCHERS** |\n| VOUCHERS.IMPORT
                  VOUCHERS.IMPORT_CSV
                  VOUCHERS.BULK_UPDATE
                  VOUCHERS.METADATA_UPDATE
                  VOUCHERS.METADATA_KEY_PURGE |", - "type": "object", - "examples": [ - { - "object": "list", - "data_ref": "async_actions", - "async_actions": [ - { - "id": "aa_0ae2af6a38161f8c79", - "type": "CAMPAIGN.VOUCHERS_DELETE", - "status": "DONE", - "created_at": "2022-04-07T11:34:39.072Z", - "object": "async_action" + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" + }, + "product": { + "type": "object", + "description": "This object stores more information about the related product.", + "properties": { + "id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, - { - "id": "aa_0ae27a55b696a4e0f0", - "type": "CUSTOMERS.BULK_UPDATE", - "status": "DONE", - "created_at": "2022-04-07T07:42:44.442Z", - "object": "async_action" + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" }, - { - "id": "aa_0adad13d6f057f088e", - "type": "CAMPAIGN.VOUCHERS_IMPORT", - "status": "DONE", - "created_at": "2022-04-01T08:54:35.196Z", - "object": "async_action" + "name": { + "type": "string", + "example": "Brewing System", + "description": "Product name." }, - { - "id": "aa_0adacc81de057f084c", - "type": "CAMPAIGN.VOUCHERS_IMPORT", - "status": "DONE", - "created_at": "2022-04-01T08:33:54.552Z", - "object": "async_action" - } - ] - } - ], - "title": "List Async Actions Response Body", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about asynchronous actions.", - "default": "list" - }, - "data_ref": { - "type": "string", - "default": "async_actions", - "description": "Identifies the name of the JSON property that contains the array of asynchronous actions." - }, - "async_actions": { - "type": "array", - "description": "An array of async actions.", - "items": { - "type": "object", - "additionalProperties": false, - "description": "Contains an async action definition.", - "properties": { - "id": { - "type": "string", - "description": "Async action unique ID.", - "example": "aa_0ae2af6a38161f8c79" - }, - "type": { - "type": "string", - "description": "Type of async action.", - "enum": [ - "CAMPAIGN.VOUCHERS_IMPORT", - "CAMPAIGN.VOUCHERS_IMPORT_CSV", - "CAMPAIGN.VOUCHERS_UPDATE", - "CAMPAIGN.VOUCHERS_DELETE", - "CAMPAIGN.VOUCHERS_GENERATE", - "CUSTOMERS.IMPORT_CSV", - "CUSTOMERS.BULK_UPDATE", - "CUSTOMERS.METADATA_UPDATE", - "CUSTOMERS.METADATA_KEY_PURGE", - "PRODUCTS.BULK_UPDATE", - "PRODUCTS.METADATA_UPDATE", - "PRODUCTS.METADATA_KEY_PURGE", - "PRODUCTS.IMPORT_CSV", - "SKUS.IMPORT_CSV", - "VOUCHERS.IMPORT", - "VOUCHERS.IMPORT_CSV", - "VOUCHERS.BULK_UPDATE", - "VOUCHERS.METADATA_UPDATE", - "VOUCHERS.METADATA_KEY_PURGE" - ] - }, - "status": { - "type": "string", - "description": "Status of async action. Informs you whether the async action has already been completed.", - "enum": [ - "ENQUEUED", - "IN_PROGRESS", - "DONE", - "FAILED" - ] - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the async action was scheduled in ISO 8601 format.", - "example": "2022-04-07T07:42:44.442Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the async action was updated in ISO 8601 format.", - "example": "2022-06-22T07:58:21.703Z", - "format": "date-time" - }, - "request_id": { - "type": "string", - "example": "v-0ba50a7feb4998490", - "description": "Unique request ID." - }, - "progress": { - "type": "integer", - "minimum": 0, - "maximum": 100, - "description": "% progress to completion of the asynchronous action." - }, - "object": { - "type": "string", - "default": "async_action", - "description": "The type of object represented by each nested object in the JSON async_actions array. This object stores information about the `async_action`." - } + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." } } - } - } - }, - "17_res_obj_get_async_action_result_message": { - "title": "Message", - "type": "object", - "description": "Result schema with message.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - } - } - }, - "17_res_obj_get_async_action_result_message_failed": { - "title": "Message with Failed Array", - "type": "object", - "description": "Result schema with message and failed array.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." }, - "failed": { - "type": "array", - "description": "If any records failed during the process, this array shows the failure details.", - "items": {} - } - } - }, - "17_res_obj_get_async_action_result_code_updated_found": { - "title": "Code Updated and Found", - "type": "object", - "description": "Result schema with an array of code, updated, and found parameters.", - "properties": { - "results": { - "type": "array", - "description": "An array of statuses for each record.", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "updated": { - "type": "boolean", - "description": "Indicates whether the record was updated." - }, - "found": { - "type": "boolean", - "description": "Indicates whether the record was found." - } + "sku": { + "type": "object", + "description": "This object stores more information about the related SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." + }, + "sku": { + "type": "string", + "description": "SKU name." + }, + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." } } } } - }, - "17_res_obj_get_async_action_result_campaign_vouchers_import": { - "title": "CAMPAIGN.VOUCHERS_IMPORT", - "type": "object", - "description": "Result schema for a CAMPAIGN.VOUCHERS_IMPORT async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "failed": { - "type": "array", - "description": "If any records failed during the process, this array shows the failure details.", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "reason": { - "type": "string", - "description": "Detailed failure cause for the voucher code import." - } - } - } - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - }, - "failed_count": { - "type": "integer", - "description": "Number of resources failed to process." - } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are attached to an order object. Stores additional information about the order in a structured format." + }, + "customer": { + "type": "object", + "description": "Object containing information about the customer that is making the purchase.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique customer ID of the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `customer` object." } - }, - "17_res_obj_get_async_action_result_campaign_vouchers_import_csv": { - "title": "CAMPAIGN.VOUCHERS_IMPORT_CSV", - "type": "object", - "description": "Result schema for a CAMPAIGN.VOUCHERS_IMPORT_CSV async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "failed": { - "type": "array", - "description": "If any records failed during the process, this array shows the failure details.", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "row": { - "type": "integer", - "description": "The CSV file row number where the code definition is recorded. The row counter excludes the file headers row." - }, - "reason": { - "type": "string", - "description": "Detailed failure cause for the voucher code import." - } - } - } - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - }, - "failed_count": { - "type": "integer", - "description": "Number of resources failed to process." - } + } + }, + "referrer": { + "type": "object", + "description": "Object containing information about the referrer.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique referrer ID, who referred the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the referrer object." } - }, - "17_res_obj_get_async_action_result_campaign_vouchers_update": { - "title": "CAMPAIGN.VOUCHERS_UPDATE", - "type": "object", - "description": "Result schema for a CAMPAIGN.VOUCHERS_UPDATE async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - } + } + }, + "customer_id": { + "type": "string", + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" + }, + "referrer_id": { + "type": "string", + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + }, + "redemptions": { + "oneOf": [ + { + "$ref": "#/components/schemas/10_obj_order_object_unstacked_redemptions" + }, + { + "$ref": "#/components/schemas/10_obj_order_object_stacked_redemptions" } - }, - "17_res_obj_get_async_action_result_campaign_vouchers_delete": { - "title": "CAMPAIGN.VOUCHERS_DELETE", + ] + } + } + }, + "10_obj_order_object_no_discount_calculations": { + "type": "object", + "title": "Order object", + "description": "This is an object representing an order.", + "properties": { + "id": { + "type": "string", + "description": "Unique order ID, assigned by Voucherify.", + "example": "ord_GFDbbv2I0wnO0sFUBOOOXPj2" + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the order was created in ISO 8601 format.", + "example": "2022-03-09T11:19:04.819Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2022-08-12T13:34:10.681Z", + "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format.", + "format": "date-time" + }, + "status": { + "type": "string", + "description": "Order status.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULFILLED" + ] + }, + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "total_amount": { + "type": "integer", + "description": "Order amount after applying all the discounts." + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", + "items": { "type": "object", - "description": "Result schema for a CAMPAIGN.VOUCHERS_DELETE async action type.", "properties": { - "message": { + "object": { "type": "string", - "description": "A human-readable message providing a short description about the result." + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - } - } - }, - "17_res_obj_get_async_action_result_campaign_vouchers_generate": { - "title": "CAMPAIGN.VOUCHERS_GENERATE", - "type": "object", - "description": "Result schema for a CAMPAIGN.VOUCHERS_GENERATE async action type.", - "properties": { - "message": { + "product_id": { "type": "string", - "description": "A human-readable message providing a short description about the result." + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - } - } - }, - "17_res_obj_get_async_action_result_campaign_metadata_key_purge": { - "title": "CAMPAIGNS.METADATA_KEY_PURGE", - "type": "object", - "description": "Result schema for a CAMPAIGNS.METADATA_KEY_PURGE async action type.", - "properties": { - "message": { + "sku_id": { "type": "string", - "description": "A human-readable message providing a short description about the result." + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - } - } - }, - "17_res_obj_get_async_action_result_customers_import_csv": { - "title": "CUSTOMERS.IMPORT_CSV", - "type": "object", - "description": "Result schema for a CUSTOMERS.IMPORT_CSV async action type.", - "properties": { - "message": { + "source_id": { "type": "string", - "description": "A human-readable message providing a short description about the result." + "description": "A unique identifier that represents the product or SKU from your inventory system." }, - "failed": { - "type": "array", - "description": "If any records failed during the process, this array shows the failure details.", - "items": { - "type": "object", - "properties": { - "source_id": { - "type": "string", - "description": "Unique customer ID from your inventory system as indicated in the CSV file." - }, - "row": { - "type": "integer", - "description": "The CSV file row number where the customer is recorded. The row counter excludes the file headers row." - }, - "reason": { - "type": "string", - "description": "Detailed failure cause for the customer import." - } - } - } + "related_object": { + "type": "string", + "description": "Reference to the object containing details of the related product. This can either be a `product` or `sku`.", + "enum": [ + "product", + "sku" + ] }, - "done_count": { + "quantity": { "type": "integer", - "description": "Number of resources processed successfully." + "description": "Quantity of the item in the cart." }, - "failed_count": { + "amount": { "type": "integer", - "description": "Number of resources failed to process." - } - } - }, - "17_res_obj_get_async_action_result_customers_bulk_update": { - "title": "CUSTOMERS.BULK_UPDATE", - "type": "object", - "description": "Result schema for a CUSTOMERS.BULK_UPDATE async action type.", - "properties": { - "results": { - "type": "array", - "description": "An array of statuses for each record.", - "items": { - "type": "object", - "properties": { - "source_id": { - "type": "string", - "description": "Unique customer `source_id`." - }, - "updated": { - "type": "boolean", - "description": "Indicates whether the record was updated." - }, - "found": { - "type": "boolean", - "description": "Indicates whether the record was found." - } - } - } + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." }, - "done_count": { + "price": { "type": "integer", - "description": "Number or resources processed successfully." - } - } - }, - "17_res_obj_get_async_action_result_customers_metadata_update": { - "title": "CUSTOMERS.METADATA_UPDATE", - "type": "object", - "description": "Result schema for a CUSTOMERS.METADATA_UPDATE async action type.", - "properties": { - "results": { - "type": "array", - "description": "An array of statuses for each record.", - "items": { - "type": "object", - "properties": { - "source_id": { - "type": "string", - "description": "Unique customer `source_id`." - }, - "updated": { - "type": "boolean", - "description": "Indicates whether the record was updated." - }, - "found": { - "type": "boolean", - "description": "Indicates whether the record was found." - } - } - } + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." }, - "done_count": { + "subtotal_amount": { "type": "integer", - "description": "Number of resources processed successfully." - } - } - }, - "17_res_obj_get_async_action_result_customers_metadata_key_purge": { - "title": "CUSTOMERS.METADATA_KEY_PURGE", - "type": "object", - "description": "Result schema for a CUSTOMERS.METADATA_KEY_PURGE async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." + "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`." }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - } - } - }, - "17_res_obj_get_async_action_result_products_bulk_update": { - "title": "PRODUCTS.BULK_UPDATE", - "type": "object", - "description": "Result schema for a PRODUCTS.BULK_UPDATE async action type.", - "properties": { - "results": { - "type": "array", - "description": "An array of statuses for each record.", - "items": { - "type": "object", - "properties": { - "source_id": { - "type": "string", - "description": "Unique product `source_id`." - }, - "updated": { - "type": "boolean", - "description": "Indicates whether the record was updated." - }, - "found": { - "type": "boolean", - "description": "Indicates whether the record was found." - } + "product": { + "type": "object", + "description": "This object stores more information about the related product.", + "properties": { + "id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" + }, + "name": { + "type": "string", + "example": "Brewing System", + "description": "Product name." + }, + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." } } }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - } - } - }, - "17_res_obj_get_async_action_result_products_metadata_update": { - "title": "PRODUCTS.METADATA_UPDATE", - "type": "object", - "description": "Result schema for a PRODUCTS.METADATA_UPDATE async action type.", - "properties": { - "results": { - "type": "array", - "description": "An array of statuses for each record.", - "items": { - "type": "object", - "properties": { - "source_id": { - "type": "string", - "description": "Unique product `source_id`." - }, - "updated": { - "type": "boolean", - "description": "Indicates whether the record was updated." - }, - "found": { - "type": "boolean", - "description": "Indicates whether the record was found." - } + "sku": { + "type": "object", + "description": "This object stores more information about the related SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." + }, + "sku": { + "type": "string", + "description": "SKU name." + }, + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." } } - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." } } - }, - "17_res_obj_get_async_action_result_products_metadata_key_purge": { - "title": "PRODUCTS.METADATA_KEY_PURGE", - "type": "object", - "description": "Result schema for a PRODUCTS.METADATA_KEY_PURGE async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "done_count": { - "type": "integer", - "description": "Number of resources updated successfully." - } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are attached to an order object. Stores additional information about the order in a structured format." + }, + "customer": { + "type": "object", + "description": "Object containing information about the customer that is making the purchase.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique customer ID of the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `customer` object." } - }, - "17_res_obj_get_async_action_result_products_import_csv": { - "title": "PRODUCTS.IMPORT_CSV", - "type": "object", - "description": "Result schema for a PRODUCTS.IMPORT_CSV async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "failed": { - "type": "array", - "description": "If any records failed during the process, this array shows the failure details.", - "items": { - "type": "object", - "description": "Contains the details regarding a CSV file line item failed import.", - "properties": { - "row": { - "type": "integer", - "description": "The CSV file row number where the product definition is recorded. The row counter excludes the file headers row." - }, - "reason": { - "type": "string", - "description": "Detailed failure cause for the product import." - } - } - } - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - }, - "failed_count": { - "type": "integer", - "description": "Number of resources failed to process." - } - } - }, - "17_res_obj_get_async_action_result_skus_import_csv": { - "title": "SKUS.IMPORT_CSV", - "type": "object", - "description": "Result schema for a SKUS.IMPORT_CSV async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result.", - "example": "2 sku(s) imported successfully, 6 failed." - }, - "failed": { - "type": "array", - "description": "If any records failed during the process, this array shows the failure details.", - "items": { - "type": "object", - "description": "Contains the details regarding a CSV file line item failed import.", - "properties": { - "row": { - "type": "integer", - "description": "The CSV file row number where the SKU definition is recorded. The row counter excludes the file headers row.", - "example": 2 - }, - "reason": { - "type": "string", - "description": "Detailed failure cause for the SKU import.", - "example": "Resource sku with id size-small is in use by products with ids [prod_0b0e3441c2462eff2c]" - } - } - } - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - }, - "failed_count": { - "type": "integer", - "description": "Number of resources failed to process." - } - } - }, - "17_res_obj_get_async_action_result_vouchers_import": { - "title": "VOUCHERS.IMPORT", - "type": "object", - "description": "Result schema for a VOUCHERS.IMPORT async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "failed": { - "description": "If any records failed during the process, this array shows the failure details.", - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "reason": { - "type": "string", - "description": "Detailed failure cause for the voucher code import." - } - } - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - }, - "failed_count": { - "type": "integer", - "description": "Number of resources failed to process." - } - } - }, - "17_res_obj_get_async_action_result_vouchers_import_csv": { - "title": "VOUCHERS.IMPORT_CSV", - "type": "object", - "description": "Result schema for a VOUCHERS.IMPORT_CSV async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "failed": { - "type": "array", - "description": "If any records failed during the process, this array shows the failure details.", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "row": { - "type": "integer", - "description": "The CSV file row number where the code definition is recorded. The row counter excludes the file headers row." - }, - "reason": { - "type": "string", - "description": "Detailed failure cause for the voucher code import." - } - } - } - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - }, - "failed_count": { - "type": "integer", - "description": "Number of resources failed to process." - } + } + }, + "referrer": { + "type": "object", + "description": "Object containing information about the referrer.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique referrer ID, who referred the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the referrer object." } - }, - "17_res_obj_get_async_action_result_vouchers_bulk_update": { - "title": "VOUCHERS.BULK_UPDATE", - "type": "object", - "description": "Result schema for a VOUCHERS.BULK_UPDATE async action type.", - "properties": { - "results": { - "type": "array", - "description": "An array of statuses for each record.", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "updated": { - "type": "boolean", - "description": "Indicates whether the record was updated." - }, - "found": { - "type": "boolean", - "description": "Indicates whether the record was found." - } - } - } - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - } + } + }, + "customer_id": { + "type": "string", + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" + }, + "referrer_id": { + "type": "string", + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + } + } + }, + "10_obj_order_object_unstacked_redemptions": { + "type": "object", + "title": "Unstacked Redemption", + "description": "Redemption object representing a single redemption.", + "properties": { + "redemption_ID": { + "type": "object", + "description": "The property name is the unique redemption ID; i.e. `r_0ba186c4824e4881e1`. This object contains information about the redemption of an incentive.", + "properties": { + "date": { + "type": "string", + "description": "Timestamp representing the date and time when the redemption was created in ISO 8601 format.", + "example": "2022-09-02T17:06:56.649Z", + "format": "date-time" + }, + "related_object_type": { + "type": "string", + "description": "The source of the incentive.", + "enum": [ + "voucher", + "promotion_tier" + ] + }, + "related_object_id": { + "type": "string", + "description": "Unique ID of the related object that defines the incentive." + }, + "related_object_parent_id": { + "type": "string", + "description": "Represent's the campaign ID of the voucher if the redemption was based on a voucher that was part of bulk codes generated within a campaign. In case of a promotion tier, this represents the campaign ID of the promotion tier's parent campaign." } - }, - "17_res_obj_get_async_action_result_vouchers_metadata_update": { - "title": "VOUCHERS.METADATA_UPDATE", - "type": "object", - "description": "Result schema for a VOUCHERS.METADATA_UPDATE async action type.", - "properties": { - "results": { - "type": "array", - "description": "An array of statuses for each record.", - "items": { - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "Unique voucher code." - }, - "updated": { - "type": "boolean", - "description": "Indicates whether the record was updated." - }, - "found": { - "type": "boolean", - "description": "Indicates whether the record was found." - } - } - } - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." + } + } + } + }, + "10_obj_order_object_stacked_redemptions": { + "type": "object", + "title": "Stacked Redemption", + "description": "Redemption object representing a stacked redemption.", + "properties": { + "redemption_ID": { + "type": "object", + "description": "The property name is the unique parent redemption ID; i.e. `r_0ba186c4824e4881e1`. This object contains information about the redemption of multiple incentives.", + "properties": { + "date": { + "type": "string", + "description": "Timestamp representing the date and time when the redemption was created in ISO 8601 format.", + "example": "2022-09-02T17:06:56.649Z", + "format": "date-time" + }, + "related_object_type": { + "type": "string", + "description": "The source of the incentive.", + "default": "redemption" + }, + "related_object_id": { + "type": "string", + "description": "Unique ID of the parent redemption.", + "example": "r_0ba186c4824e4881e1" + }, + "stacked": { + "type": "array", + "description": "Contains a list of unique IDs of child redemptions, which belong to the stacked incentives.", + "items": { + "type": "string" } } + } + } + } + }, + "10_res_list_orders": { + "type": "object", + "title": "List Orders Response Body", + "description": "Response body schema representing **GET** `/orders`.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about orders in a dictionary." + }, + "data_ref": { + "type": "string", + "default": "orders", + "description": "Identifies the name of the attribute that contains the array of order objects." + }, + "orders": { + "type": "array", + "description": "Contains array of order objects.", + "items": { + "$ref": "#/components/schemas/10_obj_order_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of orders." + } + } + }, + "10_req_create_order": { + "type": "object", + "title": "Order", + "description": "Request body schema for creating an order.", + "properties": { + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of an integration between multiple systems. It can be an order ID from a CRM system, database or 3rd-party service." + }, + "status": { + "type": "string", + "description": "The order status.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULLFILLED" + ] + }, + "amount": { + "type": "integer", + "description": "A positive integer in the smallest currency unit (that is, 100 cents for $1.00) representing the total amount of the order; this is the sum of the order items' amounts." + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format." + }, + "customer": { + "$ref": "#/components/schemas/10_req_orders_customer_object" + }, + "referrer": { + "$ref": "#/components/schemas/10_req_orders_referrer_object" + }, + "items": { + "$ref": "#/components/schemas/10_req_orders_items_array" + } + } + }, + "10_req_update_order": { + "type": "object", + "title": "Update Order Request Body", + "description": "Request body schema for **PUT** `/orders/{orderId}`.", + "properties": { + "status": { + "type": "string", + "description": "The order status.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULLFILLED" + ] + }, + "amount": { + "type": "integer", + "description": "A positive integer in the smallest currency unit (that is, 100 cents for $1.00) representing the total amount of the order; this is the sum of the order items' amounts." + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format." + }, + "customer": { + "$ref": "#/components/schemas/10_req_orders_customer_object" + }, + "referrer": { + "$ref": "#/components/schemas/10_req_orders_referrer_object" + }, + "items": { + "$ref": "#/components/schemas/10_req_orders_items_array" + }, + "customer_id": { + "type": "string", + "example": "cust_T849EgzNVVmn5icJ2FAkT2rO", + "description": "Unique customer ID of the customer making the purchase." + }, + "referrer_id": { + "type": "string", + "example": "cust_T849EgzNVVmn5icJ2FAkT2rO", + "description": "Unique referrer ID." + } + } + }, + "10_req_create_order_export": { + "type": "object", + "title": "Create Order Export Request Body", + "description": "Request body schema for **POST** `/orders/export`.", + "properties": { + "parameters": { + "$ref": "#/components/schemas/16_obj_export_order", + "description": "Contains the parameters that define the data to be exported." + } + } + }, + "10_req_orders_import": { + "type": "array", + "title": "Import Orders Request Body", + "description": "Request body schema for POST `/orders/import`.", + "items": { + "type": "object", + "properties": { + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of an integration between multiple systems. It can be an order ID from a CRM system, database or 3rd-party service." }, - "17_res_obj_get_async_action_result_vouchers_metadata_key_purge": { - "title": "VOUCHERS.METADATA_KEY_PURGE", - "type": "object", - "description": "Result schema for a VOUCHERS.METADATA_KEY_PURGE async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - } - } + "status": { + "type": "string", + "description": "The order status. One of `CREATED`, `PAID`, `CANCELED`, `FULFILLED`." }, - "17_res_obj_get_async_action_result_orders_import": { - "title": "ORDERS.IMPORT", - "type": "object", - "description": "Result schema for a ORDERS.IMPORT async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "failed": { - "description": "If any records failed during the process, this array shows the failure details.", - "type": "object", - "properties": { - "source_id": { - "type": "string", - "description": "Unique order source ID." - }, - "reason": { - "type": "string", - "description": "Detailed failure cause for the voucher code import." - } - } - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - }, - "failed_count": { - "type": "integer", - "description": "Number of resources failed to process." - } - } + "amount": { + "type": "integer", + "description": "A positive integer in the smallest currency unit (that is, 100 cents for $1.00) representing the total amount of the order; this is the sum of the order items' amounts." }, - "17_res_obj_get_async_action_result_orders_metadata_key_purge": { - "title": "ORDERS.METADATA_KEY_PURGE", + "metadata": { "type": "object", - "description": "Result schema for a ORDERS.METADATA_KEY_PURGE async action type.", - "properties": { - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the result." - }, - "done_count": { - "type": "integer", - "description": "Number of resources processed successfully." - } - } + "description": "A set of custom key/value pairs that you can attach to an order. It can be useful for storing additional information about the order in a structured format." }, - "18_res_list_consents_GET": { - "description": "Response body schema for listing consents.", - "type": "object", - "examples": [ - { - "groups": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "cnstgr_3c7Z3rcOLv51bsXlRtTZPYj8", - "name": "Consent group", - "description": "Consent group", - "consents": [ - "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", - "cnst_VCmucIvAsmDYw2PPAok6bcYy" - ], - "created_at": "2022-04-13T09:12:47.743Z", - "updated_at": "2022-04-13T09:45:46.616Z", - "object": "consent_group" - }, - { - "id": "cnstgr_EAIakTj5lNG2ZpiQEauGqBlY", - "name": "Consent group 2", - "description": "Consent group 2", - "consents": [ - "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", - "cnst_VCmucIvAsmDYw2PPAok6bcYy" - ], - "created_at": "2022-04-13T10:03:46.564Z", - "updated_at": null, - "object": "consent_group" - } - ], - "total": 2 - }, - "consents": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", - "name": "Consent", - "description": "Consent for marketing", - "category": "New", - "created_at": "2022-04-13T09:11:27.037Z", - "updated_at": null, - "object": "consent" - }, - { - "id": "cnst_VCmucIvAsmDYw2PPAok6bcYy", - "name": "Consent 2", - "description": "Consent 2", - "category": "Trial", - "created_at": "2022-04-13T09:45:37.597Z", - "updated_at": null, - "object": "consent" - } - ], - "total": 2 - } - } - ], - "title": "List Consents Response Body", - "properties": { - "groups": { - "type": "object", - "description": "Contains marketing permission groups' definitions.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "Stores information about marketing permission groups." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of marketing permission groups." - }, - "data": { - "type": "array", - "description": "An array of marketing permission groups.", - "items": { - "type": "object", - "additionalProperties": false, - "description": "Contains a marketing permission group's definition.", - "properties": { - "id": { - "type": "string", - "example": "cnstgr_3c7Z3rcOLv51bsXlRtTZPYj8", - "description": "Unique group ID." - }, - "name": { - "type": "string", - "description": "Marketing permission group name." - }, - "description": { - "type": "string", - "description": "Marketing permission group category." - }, - "consents": { - "type": "array", - "description": "List of consents that are assigned to the group.", - "items": { - "type": "string" - } - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-04-13T09:12:47.743Z", - "description": "Timestamp representing the date and time when the group was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-05-14T09:11:27.037Z", - "description": "Timestamp representing the date and time when the group was updated in ISO 8601 format." - }, - "object": { - "type": "string", - "default": "consent_group", - "description": "Stores information about a marketing permission group." - } - } - } - }, - "total": { - "type": "integer", - "description": "Total number of groups." - } - } - }, - "consents": { - "type": "object", - "description": "Contains opt-in consents' definitions.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "Stores information about opt-in consents." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of opt-in consents." - }, - "data": { - "type": "array", - "description": "An array of consents.", - "items": { - "type": "object", - "additionalProperties": false, - "description": "Contains an opt-in consent definition.", - "properties": { - "id": { - "type": "string", - "example": "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", - "description": "Unique consent ID." - }, - "name": { - "type": "string", - "description": "Consent name." - }, - "description": { - "type": "string", - "description": "Consent description." - }, - "category": { - "type": "string", - "description": "Consent category." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-04-13T09:11:27.037Z", - "description": "Timestamp representing the date and time when the consent was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "example": "2022-05-14T09:11:27.037Z", - "description": "Timestamp representing the date and time when the consent was updated in ISO 8601 format." - }, - "object": { - "type": "string", - "default": "consent", - "description": "Stores information about an opt-in consent." - } - } - } - }, - "total": { - "type": "integer", - "description": "Total number of consents." - } - } - } - } + "customer": { + "$ref": "#/components/schemas/10_req_orders_customer_object" }, - "20_res_list_categories": { - "type": "object", - "title": "List Categories Response Body", - "description": "Response schema for **GET** `/categories`.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. This object stores information about categories in a dictionary." - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of category objects.", - "default": "data" - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/20_obj_category_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of categories." - } - } + "referrer": { + "$ref": "#/components/schemas/10_req_orders_referrer_object" }, - "20_obj_category_object": { - "type": "object", - "title": "Category Object", - "description": "This is an object representing a category.", - "x-tags": [ - "CATEGORIES API" - ], - "properties": { - "id": { - "type": "string", - "description": "Unique category ID assigned by Voucherify." - }, - "name": { - "type": "string", - "description": "Category name." - }, - "hierarchy": { - "type": "integer", - "description": "Category hierarchy." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the category was created in ISO 8601 format.", - "example": "2022-07-14T10:45:13.156Z", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "example": "2022-08-16T10:52:08.094Z", - "description": "Timestamp representing the date and time when the category was updated in ISO 8601 format.", - "format": "date-time" - }, - "object": { - "type": "string", - "default": "category", - "description": "The type of object represented by the JSON. This object stores information about the category." - } + "items": { + "$ref": "#/components/schemas/10_req_orders_items_array" + } + } + } + }, + "10_req_orders_customer_object": { + "type": "object", + "title": "Customer", + "description": "This is an object containing information about the customer.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of an existing customer that will be linked to the order; this is an ID that has been assigned to the customer by Voucherify, i.e. `cust_LMY4ZylSdUYB1J4tzqNcl5VV`." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "name": { + "type": "string", + "description": "Customer's first and last name." + }, + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a customer object." + }, + "email": { + "type": "string", + "description": "Customer's email address." + }, + "phone": { + "type": "string", + "description": "Customer's phone number." + }, + "address": { + "type": "object", + "description": "Customer's address.", + "properties": { + "city": { + "type": "string", + "description": "City" }, - "examples": [ - { - "id": "cat_0b60cfe7d0d7ddbb55", - "name": "Update", - "hierarchy": 1, - "created_at": "2022-07-14T10:45:13.156Z", - "updated_at": "2022-08-16T11:03:54.727Z", - "object": "category" - } - ] - }, - "20_req_update_categories_categoryId": { - "type": "object", - "title": "Update Category Request Body", - "description": "Request schema for updating a category using **PUT** `/categories/{categoryId}`.", - "properties": { - "name": { - "type": "string", - "description": "Category name." - }, - "hierarchy": { - "type": "integer", - "description": "Category hierarchy." - } + "state": { + "type": "string", + "description": "State" }, - "required": [ - "name", - "hierarchy" - ] - }, - "20_req_create_category": { - "type": "object", - "title": "Create Category Request Body", - "description": "Request schema for creating a category using **POST** `/categories`.", - "properties": { - "name": { - "type": "string", - "description": "Category name." - }, - "hierarchy": { - "type": "integer", - "description": "Category hierarchy." - } + "line_1": { + "type": "string", + "description": "First line of address" }, - "required": [ - "name", - "hierarchy" - ] - }, - "20_res_create_category": { - "type": "object", - "title": "Category Object", - "description": "This is an object representing a newly created category.", - "properties": { - "id": { - "type": "string", - "description": "Unique category ID assigned by Voucherify." - }, - "name": { - "type": "string", - "description": "Category name." - }, - "hierarchy": { - "type": "integer", - "description": "Category hierarchy." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the category was created in ISO 8601 format.", - "example": "2022-07-14T10:45:13.156Z", - "format": "date-time" - }, - "object": { - "type": "string", - "default": "category", - "description": "The type of object represented by the JSON. This object stores information about the category." - } + "line_2": { + "type": "string", + "description": "Second line of address" + }, + "country": { + "type": "string", + "description": "Country" + }, + "postal_code": { + "type": "string", + "description": "Postal code" } - }, - "21_obj_metadata_schema_object": { - "type": "object", - "title": "Metadata Schema Object", - "description": "This is an object representing a metadata schema.", - "properties": { - "id": { - "type": "string", - "description": "Unique metadata schema ID.", - "example": "ms_OF36L2rk4EqhdxvZs56IW9iE" - }, - "related_object": { - "type": "string", - "description": "The resource type. There is an infinite number of possibilities for the resource type because you can define custom metadata schemas. Some examples are included here to show you the standard metadata schema resource types.", - "enum": [ - "campaign", - "customer", - "earning_rule", - "loyalty_tier", - "order", - "order_item", - "product", - "promotion_tier", - "publication", - "redemption", - "reward", - "voucher" - ] - }, - "properties": { - "description": "Contains the metadata definitions. There can be many properties within this object.", - "anyOf": [ - { - "properties": { - "custom_property_name": { - "type": "object", - "description": "Custom property name. This is defined in **Project Settings** > **Metadata Schema** in the Dashboard.", - "properties": { - "type": { - "type": "string", - "enum": [ - "string", - "number", - "object", - "date", - "datetime", - "geopoint", - "boolean", - "image_url" - ] - }, - "array": { - "type": "boolean", - "description": "Indicates whether the definition is an array." - }, - "optional": { - "type": "boolean", - "description": "Indicates whether this definition is optional or not optional for the resource." - }, - "objectType": { - "type": [ - "string", - "null" - ], - "description": "Returns the name of the custom resource if the resource was previously defined in the Dashboard as a custom (non-standard) Nested object." - }, - "eq": { - "type": "array", - "description": "Array of possible values when the setting for `is equal to any of` in the Dashboard is defined explicitly.", - "items": {} - }, - "ne": { - "type": "array", - "description": "Array of values that are not allowed when the setting for `is not equal to any of` in the Dashboard is defined explicitly.", - "items": {} - }, - "lt": { - "type": "integer", - "description": "A property of `number` type must have `less than` this value." - }, - "lte": { - "type": "integer", - "description": "A property of `number` type must be `less than or equal` to this value." - }, - "gt": { - "type": "integer", - "description": "A property of `number` type must be `greater than` this value." - }, - "gte": { - "type": "integer", - "description": "A property of `number` type must be `greater than or equal` to this value." - }, - "deleted": { - "type": "boolean", - "description": "Indicates whether the definition was deleted from the schema." - }, - "maxLength": { - "type": "integer", - "description": "Value for maximum length when the setting for `has maximum length of` in the Dashboard is defined explicitly." - }, - "minLength": { - "type": "integer", - "description": "Value indicating minimum length when the setting for `has minimum length of` in the Dashboard is defined explicitly." - }, - "exactLength": { - "type": "integer", - "description": "Value indicating exact length when the setting for `has exact length of` in the Dashboard is defined explicitly." - } - } - } - } - } - ], - "type": "object" - }, - "allow_defined_only": { - "type": "boolean", - "description": "Restricts the creation of metadata fields when set to `true`. In other words, it indicates whether or not you are allowed to create new metadata definitions; for example, in the campaign manager or publication manager. If it is set to true, then only the defined fields will be available for assigning values.\t" - }, - "created_at": { - "type": "string", - "example": "2021-12-03T13:33:44.556Z", - "description": "Timestamp representing the date and time when the metadata schema was created in ISO 8601 format.\t", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "example": "2022-08-11T08:05:30.695Z", - "description": "Timestamp representing the date and time when the metadata schema was updated in ISO 8601 format.\t", - "format": "date-time" - }, - "object": { - "type": "string", - "default": "metadata_schema", - "description": "The type of object represented by the JSON. This object stores information about the metadata schema." - } + } + }, + "birthdate": { + "type": "string", + "description": "Customer's birthdate; format `YYYY-MM-DD`.", + "format": "date" + }, + "birthday": { + "type": "string", + "description": "Customer's birthdate; format `YYYY-MM-DD`.", + "format": "date" + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to a customer." + } + } + }, + "10_req_orders_referrer_object": { + "type": "object", + "title": "Referrer", + "description": "This is an ojbect containing information about the referrer.", + "properties": { + "id": { + "type": "string", + "description": "The unique ID of an existing customer that will be linked to the order as the referrer; this is an ID that has been assigned to the customer by Voucherify, i.e. `cust_LMY4ZylSdUYB1J4tzqNcl5VV`." + }, + "source_id": { + "type": "string", + "description": "The merchant’s customer ID if it is different from the Voucherify customer ID. It is really useful in case of an integration between multiple systems. It can be a customer ID from a CRM system, database or 3rd-party service." + }, + "name": { + "type": "string", + "description": "Referrer's first and last name." + }, + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a referrer object." + }, + "email": { + "type": "string", + "description": "Referrer's email address." + }, + "phone": { + "type": "string", + "description": "Referrer's phone number." + }, + "address": { + "type": "object", + "description": "Referrer's address.", + "properties": { + "city": { + "type": "string", + "description": "City" }, - "x-tags": [ - "METADATA SCHEMAS API" - ], - "examples": [ - { - "id": "ms_27vMXZqBAkkqBoOuw8EYTRLn", - "related_object": "earning_rule", - "properties": { - "channel_id": { - "type": "string", - "array": true, - "optional": true, - "objectType": null, - "exactLength": 5 - }, - "channel_name": { - "eq": [ - "instagram", - "facebook", - "google", - "twitter", - "linkedin", - "website" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-08-25T13:09:59.970Z", - "updated_at": "2022-08-25T13:11:15.704Z", - "object": "metadata_schema" - }, - { - "id": "ms_psGSDpVl6JcPilPA7toZ83Kj", - "related_object": "campaign", - "properties": { - "region": { - "eq": [ - "EMEA", - "AMER", - "APAC" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-08-25T13:12:58.447Z", - "updated_at": null, - "object": "metadata_schema" - }, - { - "id": "ms_f0r4hm3ta6a4a5ch3ma", - "related_object": "customer", - "properties": { - "age": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "city_id": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "location": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "favorite_brands": { - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "acquisition_channel": { - "eq": [ - "Facebook", - "Twitter", - "Website" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "customer_life_time_value": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2021-12-01T08:00:48.889Z", - "updated_at": "2022-09-12T07:34:49.163Z", - "object": "metadata_schema" - }, - { - "id": "ms_jHUoFlgepKVEftxK1pKPGZlO", - "related_object": "loyalty_tier", - "properties": { - "level_name": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "audience_restricted": { - "type": "boolean", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-08-25T13:14:54.954Z", - "updated_at": "2022-08-25T13:15:24.436Z", - "object": "metadata_schema" - }, - { - "id": "ms_f1r5Tm3ta6a4a5ch3ma", - "related_object": "order", - "properties": { - "card": { - "eq": [ - "Visa", - "MasterCard", - "Other" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "currency": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "location": { - "ne": [ - 1, - 2, - 18, - 22 - ], - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "store_city": { - "eq": [ - "Hampden", - "San Francisco", - "Warsaw" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "location_id": { - "eq": [ - "L1", - "L2", - "L3" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "payment_mean": { - "eq": [ - "credit-card", - "wire-transfer", - "paypal" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "booking_end_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - }, - "booking_start_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2021-12-01T08:00:47.575Z", - "updated_at": "2022-10-25T10:05:18.978Z", - "object": "metadata_schema" - }, - { - "id": "ms_7ux44AEnt82bqo8ww5V1SXzV", - "related_object": "order_item", - "properties": { - "manufacturer_id": { - "gte": 15, - "type": "number", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-08-25T13:16:03.167Z", - "updated_at": null, - "object": "metadata_schema" - }, - { - "id": "ms_s3c0N6m3ta6a4a5ch3ma", - "related_object": "product", - "properties": { - "vendor": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "category": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "location": { - "type": "geopoint", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2021-12-01T08:00:48.298Z", - "updated_at": "2022-07-14T15:53:29.226Z", - "object": "metadata_schema" - }, - { - "id": "ms_dNb5aLMzU0VBCiRuxLOeMNwn", - "related_object": "promotion_tier", - "properties": { - "level": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-01-24T10:42:04.937Z", - "updated_at": "2022-09-23T08:51:46.266Z", - "object": "metadata_schema" - }, - { - "id": "ms_fzvWNh7sU4LeykEQ2Abpg6jG", - "related_object": "publication", - "properties": { - "file_uploaded": { - "type": "image_url", - "array": false, - "optional": true, - "objectType": null - }, - "publication_method": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-08-25T13:16:35.534Z", - "updated_at": "2022-09-12T10:26:31.135Z", - "object": "metadata_schema" - }, - { - "id": "ms_t4ir0Dm3ta6a4a5ch3ma", - "related_object": "redemption", - "properties": { - "location_id": { - "eq": [ - "L1", - "L2", - "L3" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "redemption_location": { - "type": "object", - "array": false, - "optional": true, - "objectType": "Location" - } - }, - "allow_defined_only": false, - "created_at": "2021-12-01T08:00:48.794Z", - "updated_at": "2022-08-25T13:19:50.497Z", - "object": "metadata_schema" - }, - { - "id": "ms_PwrAtwqCFXeH4Qix22gEkqhl", - "related_object": "reward", - "properties": { - "reward_type": { - "eq": [ - "MATERIAL", - "PAY-WITH-POINTS", - "DISCOUNT-COUPON", - "GIFT-CARD-CREDITS", - "LOYALTY POINTS" - ], - "type": "string", - "array": false, - "optional": false, - "objectType": null - } - }, - "allow_defined_only": true, - "created_at": "2022-08-25T13:07:13.689Z", - "updated_at": "2022-08-25T13:08:26.696Z", - "object": "metadata_schema" - }, - { - "id": "ms_9uE6eP17Jvoxl46mCqL6Q3Ut", - "related_object": "voucher", - "properties": { - "lang": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "Season": { - "eq": [ - "Spring", - "Summer", - "Fall", - "Winter" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "marketing_text": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "ProductionVoucherCodeMetaData": { - "type": "string", - "array": false, - "deleted": true, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-01-24T10:42:23.994Z", - "updated_at": "2022-09-19T14:13:30.590Z", - "object": "metadata_schema" - } - ] - }, - "21_res_list_metadata_shemas": { - "title": "List Metadata Schemas Response Body", - "type": "object", - "description": "Response schema for listing metadata schemas using **GET** `/metadata-schemas`.", - "properties": { - "object": { - "type": "string", - "description": "The type of object represented by JSON. This object stores information about metadata schemas in a dictionary.", - "default": "list" - }, - "data_ref": { - "type": "string", - "description": "Identifies the name of the attribute that contains the array of metadata schema objects.", - "default": "schemas" - }, - "schemas": { - "type": "array", - "description": "Array of metadata schema objects.", - "items": { - "$ref": "#/components/schemas/21_obj_metadata_schema_object" - } - }, - "total": { - "type": "integer", - "description": "Total number of metadata schemas." + "state": { + "type": "string", + "description": "State" + }, + "line_1": { + "type": "string", + "description": "First line of address" + }, + "line_2": { + "type": "string", + "description": "Second line of address" + }, + "country": { + "type": "string", + "description": "Country" + }, + "postal_code": { + "type": "string", + "description": "Postal code" + } + } + }, + "birthdate": { + "type": "string", + "description": "Referrer's birthdate; format `YYYY-MM-DD`.", + "format": "date" + }, + "birthday": { + "type": "string", + "description": "Referrer's birthdate; format `YYYY-MM-DD`.", + "format": "date" + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to a referrer." + } + } + }, + "10_req_orders_items_array": { + "type": "array", + "title": "Items Array", + "description": "Array of items applied to the order.", + "items": { + "$ref": "#/components/schemas/10_req_orders_order_item" + } + }, + "10_req_orders_order_item": { + "type": "object", + "title": "Order Item", + "description": "This object represents an order line item.", + "properties": { + "source_id": { + "type": "string", + "description": "The merchant’s product/SKU ID (if it is different from the Voucherify product/SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service." + }, + "related_object": { + "type": "string", + "description": "Used along with the `source_id` property, can be set to either `sku` or `product`." + }, + "product_id": { + "type": "string", + "description": "A unique product ID assigned by Voucherify.", + "example": "prod_0a7e62db1fca8322a2" + }, + "sku_id": { + "type": "string", + "description": "A unique SKU ID assigned by Voucherify.", + "example": "sku_0a41e31c7b41c28358" + }, + "quantity": { + "type": "integer", + "description": "The quantity of the particular item in the cart." + }, + "price": { + "type": "integer", + "description": "The unit price of the item." + }, + "amount": { + "type": "integer", + "description": "The total amount of the order item (`price` * `quantity`)." + }, + "product": { + "$ref": "#/components/schemas/10_req_orders_order_item_product" + }, + "sku": { + "$ref": "#/components/schemas/10_req_orders_order_item_sku" + } + } + }, + "10_req_orders_order_item_product": { + "type": "object", + "title": "Product", + "description": "An object containing details of the related product.", + "properties": { + "source_id": { + "type": "string", + "description": "The merchant’s product ID (if it is different than Voucherify's product ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service." + }, + "name": { + "type": "string", + "description": "Product name." + }, + "price": { + "type": "integer", + "description": "Product price. A positive integer in the smallest currency unit (that is, 100 cents for $1.00)." + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to a product. It can be useful for storing additional information about the product in a structured format." + }, + "override": { + "type": "boolean", + "description": "The override set to true is used to store the product information in the system. If product does not exist, it will be created with the use of `source_id`; if it does exist, the provided values for the `name`, `price`, and `metadata` will replace those already stored in the system." + } + } + }, + "10_req_orders_order_item_sku": { + "type": "object", + "title": "SKU", + "description": "An object containing details of the related SKU.", + "properties": { + "source_id": { + "type": "string", + "description": "The merchant’s SKU ID (if it is different than Voucherify's SKU ID). It is really useful in case of integration between multiple systems. It can be an ID from an eCommerce site, a database or a 3rd party service." + }, + "sku": { + "type": "string", + "description": "The SKU name." + }, + "price": { + "type": "integer", + "description": "SKU price. A positive integer in the smallest currency unit (that is, 100 cents for $1.00)." + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to an SKU. It can be useful for storing additional information about the SKU in a structured format." + }, + "override": { + "type": "boolean", + "description": "The override is used to store the SKU in the system. If the SKU does not exist, it will be created with the use of `source_id`. Additionally, if the SKU does not exist, you are required to set the parent `product_id` that it belongs to. Set the parent `product_id` one level above, i.e. at the item level. If the parent product does not exist in Voucherify, i.e. does not have a unique `product_id`, then define the product object one level above, i.e. at the item level and make sure to also include the override as `true` for the product." + } + } + }, + "10_obj_order_item_object": { + "title": "Order Item Object", + "type": "object", + "properties": { + "object": { + "type": "string", + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." + }, + "product_id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "sku_id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." + }, + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." + }, + "discount_amount": { + "type": "integer", + "description": "The item-level discount applied to the item." + }, + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" + }, + "product": { + "type": "object", + "description": "This object stores more information about the related product.", + "properties": { + "id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" + }, + "name": { + "type": "string", + "example": "Brewing System", + "description": "Product name." + }, + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + }, + "sku": { + "type": "object", + "description": "This object stores more information about the related SKU.", + "properties": { + "id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." + }, + "sku": { + "type": "string", + "description": "SKU name." + }, + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + } + } + } + }, + "description": "This is an object representing an order item. \n\nOrder Items are always specified within the [order object](ref:get-order). They can be related either to [products](list-products) or [SKUs](ref:list-skus-in-product). \n\nProduct/SKU details sent within an order item will be used on top of Product/SKU already stored in the system during the [Redeem Voucher](ref:redeem-voucher), [Validate Voucher](ref:validate-voucher), [Validate Promotions](ref:validate-promotions) and [Redeem Promotion](ref:redeem-promotion) requests.", + "x-tags": [ + "ORDERS API" + ] + }, + "11_obj_product_object": { + "type": "object", + "description": "This is an object representing a product. \n\nThis entity should be used to map product items from your inventory management system. The aim of products is to build validation rules which reflect product-specific campaigns.", + "title": "Product Object", + "x-tags": [ + "PRODUCTS API" + ], + "properties": { + "id": { + "type": "string", + "description": "Unique product ID assigned by Voucherify.", + "example": "prod_0b1da8105693710357" + }, + "source_id": { + "type": "string", + "example": "productSourceID16", + "description": "Unique product source ID from your inventory system." + }, + "name": { + "type": "string", + "description": "Unique user-defined product name.", + "example": "T-shirt" + }, + "price": { + "type": "integer", + "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "attributes": { + "type": "array", + "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", + "items": { + "type": "string" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." + }, + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", + "example": "https://images.com/original.jpg" + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the product was created in ISO 8601 format.", + "example": "2022-05-23T06:52:55.008Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the product was updated in ISO 8601 format.", + "example": "2022-05-23T09:24:07.405Z", + "format": "date-time" + }, + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about the `product`.", + "default": "product" + }, + "skus": { + "$ref": "#/components/schemas/11_res_get_product_skus_object" + } + } + }, + "11_req_create_product": { + "type": "object", + "description": "Request schema for **POST** `/products`.", + "title": "Create Product Request Body", + "properties": { + "source_id": { + "type": "string", + "example": "productSourceID16", + "description": "Unique product source ID." + }, + "name": { + "type": "string", + "description": "Unique user-defined product name.", + "example": "T-shirt" + }, + "price": { + "type": "integer", + "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "attributes": { + "type": "array", + "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", + "items": { + "type": "string" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." + }, + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", + "example": "https://images.com/original.jpg" + } + } + }, + "11_req_update_products_metadata_in_bulk": { + "type": "object", + "description": "Request schema for **POST** `/products/metadata/async`.", + "title": "Update Products' Metadata in Bulk Request Body", + "properties": { + "source_ids": { + "type": "array", + "description": "Array of unique product source IDs.", + "items": { + "type": "string" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." + } + }, + "required": [ + "source_ids", + "metadata" + ] + }, + "11_req_update_product": { + "type": "object", + "description": "Request schema for **PUT** `/products/{productId}`.", + "title": "Update Product Request Body", + "properties": { + "name": { + "type": "string", + "description": "Unique user-defined product name.", + "example": "T-shirt" + }, + "price": { + "type": "integer", + "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "attributes": { + "type": "array", + "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", + "items": { + "type": "string" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." + }, + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", + "example": "https://images.com/original.jpg" + } + } + }, + "11_req_update_product_bulk": { + "type": "object", + "description": "Request schema for **POST** `/products/bulk/async`.", + "title": "Update Product Request Body", + "properties": { + "source_id": { + "type": "string", + "description": "Unique product source ID from your inventory system.", + "example": "test_prod_id_1" + }, + "name": { + "type": "string", + "description": "Unique user-defined product name.", + "example": "T-shirt" + }, + "price": { + "type": "integer", + "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "attributes": { + "type": "array", + "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", + "items": { + "type": "string" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." + }, + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", + "example": "https://images.com/original.jpg" + } + } + }, + "11_res_list_products": { + "type": "object", + "description": "Response body schema representing **GET** `/products`.", + "title": "Product Object", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about products in a dictionary.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of product objects.", + "default": "products" + }, + "products": { + "type": "array", + "description": "Contains array of product objects.", + "items": { + "$ref": "#/components/schemas/11_obj_list_products_product_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of product objects." + } + } + }, + "11_obj_list_products_product_object": { + "type": "object", + "description": "This is an object representing a product. \n\nThis entity should be used to map product items from your inventory management system. The aim of products is to build which reflect product-specific campaigns.", + "title": "Product Object", + "properties": { + "id": { + "type": "string", + "description": "Unique product ID assigned by Voucherify.", + "example": "prod_0b1da8105693710357" + }, + "source_id": { + "type": "string", + "example": "productSourceID16", + "description": "Unique product source ID." + }, + "name": { + "type": "string", + "description": "Unique user-defined product name.", + "example": "T-shirt" + }, + "price": { + "type": "integer", + "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "attributes": { + "type": "array", + "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", + "items": { + "type": "string" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." + }, + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", + "example": "https://images.com/original.jpg" + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the product was created in ISO 8601 format.", + "example": "2022-05-23T06:52:55.008Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the product was updated in ISO 8601 format.", + "example": "2022-05-23T09:24:07.405Z", + "format": "date-time" + }, + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about the product.", + "default": "product" + }, + "skus": { + "type": "object", + "description": "Contains a list of related child SKUs.", + "properties": { + "data": { + "type": "array", + "description": "Contains a list of SKU objects.", + "items": { + "$ref": "#/components/schemas/11_obj_sku_object" } }, - "examples": [ - { - "object": "list", - "data_ref": "schemas", - "schemas": [ - { - "id": "ms_yqMHRHH6S1KYIHPmQHealNf4", - "related_object": "Payment", - "properties": { - "payment_tax": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "payment_method": { - "type": "string", - "array": false, - "optional": true, - "objectType": null + "total": { + "type": "number", + "description": "Total number of SKUs." + } + } + } + } + }, + "11_res_get_product_skus_object": { + "type": "object", + "description": "Contains information about child SKUs.", + "title": "SKUs object", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about SKUs.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the JSON property that contains the array of SKUs.", + "default": "data" + }, + "data": { + "type": "array", + "description": "A dictionary that contains an array of SKUs.", + "items": { + "$ref": "#/components/schemas/11_obj_sku_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of SKUs in the product." + } + } + }, + "product_collections_product_in_collection": { + "type": "object", + "description": "This is an object representing a product in product collection.", + "title": "Product in Collection", + "properties": { + "id": { + "type": "string", + "description": "Unique product ID.", + "example": "prod_f1r5Tpr0DuC7" + }, + "source_id": { + "type": [ + "string", + "null" + ], + "example": "productSourceID16", + "description": "Unique product source ID." + }, + "name": { + "type": [ + "string", + "null" + ], + "description": "Unique user-defined product name.", + "example": "T-shirt" + }, + "price": { + "type": [ + "integer", + "null" + ], + "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "attributes": { + "type": "array", + "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", + "items": { + "type": "string" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." + }, + "image_url": { + "type": [ + "string", + "null" + ], + "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", + "example": "https://images.com/original.jpg" + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the product was created in ISO 8601 format.", + "example": "2022-05-23T06:52:55.008Z", + "format": "date-time" + }, + "updated_at": { + "type": [ + "string", + "null" + ], + "description": "Timestamp representing the date and time when the product was updated in ISO 8601 format.", + "example": "2022-05-23T09:24:07.405Z" + }, + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about the `product`.", + "default": "product" + } + }, + "required": [ + "id", + "source_id", + "name", + "price", + "attributes", + "metadata", + "image_url", + "created_at", + "updated_at", + "object" + ] + }, + "11_obj_product_object_truncated": { + "type": "object", + "description": "This is an object representing a product.", + "title": "Product Object", + "properties": { + "id": { + "type": "string", + "description": "Unique product ID.", + "example": "prod_f1r5Tpr0DuC7" + }, + "source_id": { + "type": "string", + "example": "productSourceID16", + "description": "Unique product source ID." + }, + "name": { + "type": "string", + "description": "Unique user-defined product name.", + "example": "T-shirt" + }, + "price": { + "type": "integer", + "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "attributes": { + "type": "array", + "description": "A list of product attributes whose values you can customize for given SKUs: `[\"color\",\"size\",\"ranking\"]`. Each child SKU can have a unique value for a given attribute.", + "items": { + "type": "string" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." + }, + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the product image.", + "example": "https://images.com/original.jpg" + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the product was created in ISO 8601 format.", + "example": "2022-05-23T06:52:55.008Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the product was updated in ISO 8601 format.", + "example": "2022-05-23T09:24:07.405Z", + "format": "date-time" + }, + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about the `product`.", + "default": "product" + } + } + }, + "11_obj_sku_object": { + "title": "SKU Object", + "type": "object", + "description": "This is an object representing a product SKU. \n\nThe SKU (acronym from Stock Keeping Unit) is tightly related to the [product object](ref:get-product). It reflects its different variants. One product can have many SKUs which are characterized and differentiated by varying values of the parent product `attributes`.", + "x-tags": [ + "PRODUCTS API" + ], + "examples": [ + { + "id": "sku_0b1621b2f25248b79c", + "source_id": "sku_source_id_1", + "product_id": "prod_0b15f6b9f650c16990", + "sku": "Extra Small Blue Shirt", + "price": 1300, + "currency": "USD", + "attributes": { + "size": "XS", + "color": "blue", + "ranking": 1 + }, + "image_url": "", + "metadata": {}, + "created_at": "2022-05-17T10:36:30.057Z", + "updated_at": "2022-07-01T05:34:16.822Z", + "object": "sku" + } + ], + "properties": { + "id": { + "type": "string", + "example": "sku_0b1621b319d248b79f", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "example": "sku_source_id_4", + "description": "A unique SKU identifier from your inventory system." + }, + "product_id": { + "type": "string", + "example": "prod_0b15f6b9f650c16990", + "description": "The parent product's unique ID." + }, + "sku": { + "type": "string", + "example": "Large Pink Shirt", + "description": "Unique user-defined SKU name." + }, + "price": { + "type": "integer", + "description": "SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "currency": { + "type": "string", + "description": "SKU price currency.", + "example": "USD" + }, + "attributes": { + "type": "object", + "description": "The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family." + }, + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format." + }, + "created_at": { + "type": "string", + "example": "2022-05-17T10:36:30.187Z", + "description": "Timestamp representing the date and time when the SKU was created in ISO 8601 format.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2022-05-17T10:55:09.137Z", + "description": "Timestamp representing the date and time when the SKU was updated in ISO 8601 format.", + "format": "date-time" + }, + "object": { + "type": "string", + "default": "sku", + "description": "The type of object represented by JSON. This object stores information about the `SKU`." + } + } + }, + "11_req_create_sku": { + "title": "SKU Object", + "type": "object", + "description": "Request body schema for **POST** `/products/{productId}/skus", + "properties": { + "source_id": { + "type": "string", + "example": "sku_source_id_4", + "description": "A unique SKU identifier from your inventory system." + }, + "sku": { + "type": "string", + "example": "Large Pink Shirt", + "description": "Unique user-defined SKU name." + }, + "price": { + "type": "integer", + "description": "SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "currency": { + "type": "string", + "description": "SKU price currency.", + "example": "USD" + }, + "attributes": { + "type": "object", + "description": "The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family." + }, + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format." + } + } + }, + "product_collections_sku_in_collection": { + "title": "SKU in Collection", + "type": "object", + "description": "This is an object representing a SKU in product collection.", + "properties": { + "id": { + "type": "string", + "example": "sku_0b1621b319d248b79f", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": [ + "string", + "null" + ], + "example": "sku_source_id_4", + "description": "A unique SKU identifier from your inventory system." + }, + "product_id": { + "type": "string", + "example": "prod_0b15f6b9f650c16990", + "description": "The parent product's unique ID." + }, + "sku": { + "type": [ + "string", + "null" + ], + "example": "Large Pink Shirt", + "description": "Unique user-defined SKU name." + }, + "price": { + "type": [ + "integer", + "null" + ], + "description": "SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "attributes": { + "type": "object", + "description": "The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family." + }, + "image_url": { + "type": [ + "string", + "null" + ], + "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format." + }, + "created_at": { + "type": "string", + "example": "2022-05-17T10:36:30.187Z", + "description": "Timestamp representing the date and time when the SKU was created in ISO 8601 format.", + "format": "date-time" + }, + "updated_at": { + "type": [ + "string", + "null" + ], + "example": "2022-05-17T10:55:09.137Z", + "description": "Timestamp representing the date and time when the SKU was updated in ISO 8601 format.", + "format": "date-time" + }, + "object": { + "type": "string", + "default": "sku", + "description": "The type of object represented by JSON. This object stores information about the `SKU`." + }, + "product": { + "type": "object", + "description": "Stores information about the parent product.", + "required": [ + "id", + "source_id", + "name", + "price", + "attributes", + "metadata", + "object" + ], + "properties": { + "id": { + "type": "string", + "example": "prod_f15Tpr0DuC7", + "description": "Unique product ID." + }, + "source_id": { + "type": [ + "string", + "null" + ], + "example": "productSourceID11", + "description": "A unique product ID from your inventory system." + }, + "name": { + "type": [ + "string", + "null" + ], + "example": "Shirts", + "description": "Unique user-defined product name." + }, + "price": { + "type": [ + "integer", + "null" + ], + "description": "Product unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "attributes": { + "type": "array", + "description": "A list of product attributes whose values you can customize for given SKUs: `[\"'color\", \"size\", \"ranking\"]` . Each child SKL can have a unique value for a given attribute.", + "items": { + "type": "string" + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the product. A set of key/value pairs that you can attach to a product object. It can be useful for storing additional information about the product in a structured format." + }, + "object": { + "type": "string", + "default": "product", + "description": "The type of object represented by the object. This object stores information about the parent `product`." + } + } + } + }, + "required": [ + "id", + "source_id", + "product_id", + "sku", + "price", + "attributes", + "image_url", + "metadata", + "created_at", + "updated_at", + "object", + "product" + ] + }, + "11_req_update_sku": { + "title": "Update SKU Request Body", + "type": "object", + "description": "Request body schema for **PUT** `/products/{productId}/skus/{skuId}`.", + "properties": { + "sku": { + "type": "string", + "example": "Large Pink Shirt", + "description": "Unique user-defined SKU name." + }, + "price": { + "type": "integer", + "description": "SKU unit price. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." + }, + "currency": { + "type": "string", + "description": "SKU price currency." + }, + "attributes": { + "type": "object", + "description": "The attributes object stores values for all custom attributes inherited by the SKU from the parent product. A set of key/value pairs that are attached to a SKU object and are unique to each SKU within a product family." + }, + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file that will be used to render the SKU image." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the SKU. A set of key/value pairs that you can attach to a SKU object. It can be useful for storing additional information about the SKU in a structured format." + } + } + }, + "product_collections_list_products_response_body": { + "type": "object", + "description": "Response body schema for **GET** `/product-collections/{productCollectionID}/products`.", + "title": "List Products in Collection Response Body", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about products and SKUs.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the JSON property that contains the array of products and SKUs.", + "default": "data" + }, + "data": { + "type": "array", + "description": "A dictionary that contains an array of products and SKUs.", + "items": { + "oneOf": [ + { + "$ref": "#/components/schemas/product_collections_product_in_collection" + }, + { + "$ref": "#/components/schemas/product_collections_sku_in_collection" + } + ] + } + }, + "total": { + "type": "integer", + "description": "Total number of products & SKUs in the product collection." + } + }, + "required": [ + "object", + "data_ref", + "data", + "total" + ] + }, + "11_res_products_productId_skus": { + "type": "object", + "description": "Response body schema for **GET** `/products/{productID}/skus`.", + "title": "List SKUs in Product Response Body", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about SKUs.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the JSON property that contains the array of SKUs.", + "default": "skus" + }, + "skus": { + "type": "array", + "description": "A dictionary that contains an array of SKUs.", + "items": { + "$ref": "#/components/schemas/11_obj_sku_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of SKUs in the product." + } + } + }, + "product_collections_static_collection": { + "type": "object", + "title": "Static Product Collection", + "description": "Schema model for a `STATIC` product collection.", + "properties": { + "type": { + "description": "Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products).", + "enum": [ + "STATIC" + ] + }, + "products": { + "description": "Defines a set of products for a `STATIC` product collection type.", + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "prod_0a41bcf807c5fcaaf6", + "description": "The product ID." + }, + "product_id": { + "type": "string", + "description": "Product ID for SKUs." + }, + "object": { + "enum": [ + "sku", + "product" + ], + "description": "Denotes the type of object represented by the ID." + } + }, + "required": [ + "id", + "object" + ] + } + } + }, + "required": [ + "type", + "products" + ] + }, + "product_collections_dynamic_collection": { + "type": "object", + "title": "Dynamic Product Collection", + "description": "Schema model for an `AUTO_UPDATE` product collection.", + "properties": { + "type": { + "description": "Describes whether the product collection is dynamic (products come in and leave based on set criteria) or static (manually selected products).", + "enum": [ + "AUTO_UPDATE" + ] + }, + "filter": { + "type": "object", + "description": "Defines a set of criteria and boundary conditions for an `AUTO_UPDATE` product collection type.", + "additionalProperties": false, + "required": [ + "junction" + ], + "properties": { + "junction": { + "$ref": "#/components/schemas/Junction" + }, + "id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "product_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "source_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "name": { + "$ref": "#/components/schemas/FieldConditions" + }, + "price": { + "$ref": "#/components/schemas/FieldConditions" + }, + "object": { + "$ref": "#/components/schemas/FieldConditions" + }, + "attributes": { + "$ref": "#/components/schemas/FieldConditions" + }, + "metadata": { + "$ref": "#/components/schemas/FieldConditions" + }, + "image_url": { + "$ref": "#/components/schemas/FieldConditions" + }, + "skus": { + "$ref": "#/components/schemas/FieldConditions" + }, + "created_at": { + "$ref": "#/components/schemas/FieldConditions" + }, + "updated_at": { + "$ref": "#/components/schemas/FieldConditions" + } + } + } + }, + "required": [ + "type", + "filter" + ] + }, + "product_collections_list_response_body": { + "type": "object", + "title": "List Product Collections Response Body", + "description": "Response body schema for **GET** `/product-collections`.", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about product collections.", + "default": "list" + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the JSON property that contains the array of product collections." + }, + "data": { + "description": "A dictionary that contains an array of product collections and their details.", + "type": "array", + "items": { + "$ref": "#/components/schemas/product_collections_collection_item" + } + }, + "total": { + "type": "integer", + "description": "Total number of product collections." + } + }, + "required": [ + "object", + "data_ref", + "data", + "total" + ] + }, + "13_obj_validation_rule_object": { + "title": "Validation Rule Object", + "type": "object", + "description": "This is an object representing a validation rule. \n\nThis entity stores the rules used to limit resources in Voucherify. The validation rule can be assigned to resources such as a: \n- [voucher](ref:get-voucher)\n- [campaign](ref:get-campaign)\n- [earning rule](ref:get-earning-rule)\n- [reward assignment](ref:get-reward-assignment)\n- [promotion tier](ref:list-promotion-tiers)\n- [publication](ref:list-publications)\n\nYou can configure the Validation Rule to include your own custom error messages which are going to be returned from the API upon a validation / redemption failure. You can read more [here](ref:errors#custom-error-messages-with-validation-rules).", + "x-tags": [ + "VALIDATION RULES API" + ], + "properties": { + "id": { + "type": "string", + "example": "val_eR1c41hu0vUU", + "description": "Unique validation rule ID." + }, + "name": { + "type": "string", + "description": "Custom, unique name for set of validation rules.", + "example": "Business Validation Rule" + }, + "rules": { + "type": "object", + "description": "Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", + "properties": { + "1": { + "type": "object", + "description": "Defines the rule.", + "properties": { + "name": { + "type": "string", + "description": "Voucherify specific rule name. The list of available names is provided below. \n\n**Name** |\n---- | -----------\n**Customer** | customer.segment
                  customer.metadata* \n**Order** |order.amount
                  order.items.count
                  order.items.price_any
                  order.items.price_each
                  order.items.metadata_any
                  order.items.metadata_each
                  order.metadata* |\n| **Campaign** | campaign.orders.amount_discounted
                  campaign.orders.amount
                  campaign.redemptions.count
                  campaign.redemptions.count.daily
                  campaign.redemptions.count.monthly
                  campaign.redemptions.customers_count
                  campaign.redemptions.customers_count.daily
                  campaign.redemptions.customers_count.monthly |\n| **Redemption** |redemption.gift.amount
                  redemption.count.daily
                  redemption.count.monthly
                  redemption.count.per_customer
                  redemption.count.per_customer.daily
                  redemption.count.per_customer.monthly
                  redemption.api_key
                  redemption.count.per_api_key
                  redemption.user.login
                  redemption.count.per_user
                  redemption.metadata*
                  redemption.reward.pay_with_points.points_used |\n| **Product** | product.id
                  product.price
                  product.quantity
                  product.discount_applicable
                  product.metadata*
                  product.metadata.aggregated_quantity
                  product.metadata.aggregated_amount
                  product.metadata.discount_applicable
                  product.metadata.match_all |\n| **SKU** | sku.id
                  sku.price
                  sku.quantity
                  sku.discount_applicable |\n| **Publication** | publication.redeemable_by_linked_customer |\n| **Custom Event** | custom_event.metadata* |\n| **Order items** | order.items.every
                  order.items.any
                  order.items.none
                  order.items.cheapest
                  order.items.most_expensive | order.items.quantity
                  order.items.aggregated_quantity
                  order.items.price
                  order.items.aggregated_amount
                  order.items.metadata* | \n\n\n\n*Requires the `property` field to be defined." + }, + "property": { + "type": [ + "string", + "null" + ], + "description": "Custom name for a metadata property associated with the condition to be satisfied. **Required** if the property `name` is any of the following: \n customer_metadata
                  custom_event_metadata
                  order_items_metadata
                  order_metadata
                  product_metadata
                  redemption_metadata" + }, + "conditions": { + "type": "object", + "description": "A set of key value pairs representing the condition name and value. The list of available conditions is provided below: \n**Condition (key)** | **Definition** | **Does not support Types** \n--- | --- | ---\n $is | A property is a predefined value. | \n $is_not | A property is not a predefined value. | \n $in | A property either one value in a predefined list of values. | \n $less_than | A property is less than a predefined value. | boolean \n $less_than_or_equal | A property is less than or equal to a predefined value. | boolean \n $more_than | A property is more than a predefined value. | boolean \n $more_than_or_equal | A property is more than or equal to a predefined value. | boolean \n $starts_with | A property starts with the predefined sequence of characters. | boolean, number \n $ends_with | A property ends with the predefined sequence of characters. | boolean, number \n $contains | A property contains the predefined sequence of characters. | boolean, number \n $timeframe | | boolean, number \n $dow | | boolean, string \n $count | | boolean, string \n $count_more | | boolean, string \n $count_less | | boolean, string ", + "properties": { + "$one_of_voucherify_conditions": { + "type": "array", + "description": "Contains a set of conditions for the rule.", + "items": { + "type": [ + "string", + "integer", + "boolean" + ] } - }, - "allow_defined_only": true, - "created_at": "2022-03-07T11:01:01.747Z", - "updated_at": "2022-03-07T11:01:44.785Z", - "object": "metadata_schema" - }, - { - "id": "ms_DwUjpX32sY3fJEoQELpS7bN3", - "related_object": "campaign", - "properties": { - "Store": { - "type": "string", - "array": false, - "deleted": true, - "optional": true, - "objectType": null - }, - "locale": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "date_tag": { - "type": "date", - "array": false, - "optional": true, - "objectType": null - }, - "store_names": { - "eq": [ - "Store 1 - New York - Broadway", - "Store 2 - Florida - Miami", - "Store 3 - London - Heathrow", - "Store 4 - Berlin - Alexanderplatz" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "date_time_tag": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - }, - "favorite_brands": { - "type": "string", - "array": true, - "deleted": true, - "optional": true, - "objectType": null - }, - "height_customer_number": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "location_country_string": { - "type": "string", - "array": false, - "optional": true, - "objectType": null + } + } + }, + "rules": { + "type": "object", + "description": "Contains all the nested rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", + "properties": { + "1": { + "type": "object", + "description": "Defines the nested rule.", + "properties": { + "name": { + "type": "string" + }, + "property": { + "type": "string" + }, + "conditions": { + "type": "object" + }, + "rules": { + "type": "object" + } } }, - "allow_defined_only": false, - "created_at": "2021-12-03T13:33:44.556Z", - "updated_at": "2022-07-26T13:57:42.288Z", - "object": "metadata_schema" - }, - { - "id": "ms_f0r4hm3ta6a4a5ch3ma", - "related_object": "customer", - "properties": { - "birth_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - }, - "CRM_created_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - }, - "customer_location": { - "type": "geopoint", - "array": false, - "optional": true, - "objectType": null - }, - "acquisition_channel": { - "eq": [ - "Facebook", - "Twitter", - "Website" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "customer_life_time_value": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2021-12-03T06:33:45.894Z", - "updated_at": "2022-07-14T15:15:34.928Z", - "object": "metadata_schema" + "logic": { + "type": "string" + } + } + }, + "error": { + "type": "object", + "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rule.", + "properties": { + "message": { + "type": "string", + "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rule." + } + } + } + } + }, + "logic": { + "type": "string", + "example": "(1 and 2) and (3)", + "description": "Defines the logic between the rules." + } + } + }, + "error": { + "type": "object", + "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules.", + "properties": { + "message": { + "type": "string", + "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rules." + } + } + }, + "applicable_to": { + "type": "object", + "properties": { + "excluded": { + "type": "array", + "description": "Defines which items are excluded from a discount.", + "items": { + "type": "object", + "description": "Defines the excluded item.", + "properties": { + "object": { + "type": "string", + "enum": [ + "product", + "sku", + "products_collection" + ], + "description": "The type of object being excluded from the rule." }, - { - "id": "ms_7X7krsG84H6MeNuIaKkb4LXN", - "related_object": "earning_rule", - "properties": { - "Type": { - "type": "string", - "array": false, - "optional": true, - "minLength": 6, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-07-27T08:54:07.980Z", - "updated_at": null, - "object": "metadata_schema" + "id": { + "type": "string", + "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." }, - { - "id": "ms_OF36L2rk4EqhdxvZs56IW9iE", - "related_object": "loyalty_tier", - "properties": { - "has_funds": { - "type": "boolean", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-03-30T06:22:16.685Z", - "updated_at": "2022-07-27T08:55:01.628Z", - "object": "metadata_schema" + "source_id": { + "type": "string" }, - { - "id": "ms_f1r5Tm3ta6a4a5ch3ma", - "related_object": "order", - "properties": { - "Payment": { - "type": "object", - "array": false, - "deleted": true, - "optional": true, - "objectType": "Payment" - }, - "day_of_week": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "location_id": { - "eq": [ - "L1", - "L2", - "L3" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "payment_mean": { - "eq": [ - "credit-card", - "wire-transfer", - "paypal" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "booking_end_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - }, - "booking_start_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - }, - "number_of_store_visits": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2021-12-03T06:33:45.798Z", - "updated_at": "2022-04-20T06:47:10.350Z", - "object": "metadata_schema" + "strict": { + "type": "boolean" }, - { - "id": "ms_0qgIlxP7bYb8H59DqpnWBCUN", - "related_object": "order_item", - "properties": { - "Size": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "Color": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "Thickness": { - "eq": [ - "Thin", - "Medium", - "Thick" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-03-11T13:32:55.029Z", - "updated_at": "2022-05-23T13:46:01.463Z", - "object": "metadata_schema" + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY" + ], + "description": "Discount effect for an excluded resource." + } + } + } + }, + "included": { + "type": "array", + "description": "Defines which items are included in a discount.", + "items": { + "type": "object", + "description": "Defines the included item.", + "properties": { + "object": { + "type": "string", + "enum": [ + "product", + "sku", + "products_collection" + ], + "description": "The type of object being included in the rule." }, - { - "id": "ms_s3c0N6m3ta6a4a5ch3ma", - "related_object": "product", - "properties": { - "color": { - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "origin": { - "type": "string", - "array": false, - "optional": true, - "minLength": 1, - "objectType": null - }, - "product_location": { - "type": "geopoint", - "array": false, - "optional": true, - "objectType": null - }, - "metadata_attribute_name_with_date_property": { - "type": "date", - "array": false, - "optional": true, - "objectType": null - }, - "metadata_attribute_name_with_number_property": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "metadata_attribute_name_with_boolean_property": { - "type": "boolean", - "array": false, - "optional": true, - "objectType": null - }, - "metadata_attribute_name_with_datetime_property": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2021-12-03T06:33:45.880Z", - "updated_at": "2022-07-14T15:46:47.994Z", - "object": "metadata_schema" + "id": { + "type": "string", + "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." }, - { - "id": "ms_th8YHt9yFYY1yAA99XOasT5W", - "related_object": "promotion_tier", - "properties": { - "has_budget": { - "type": "boolean", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-01-24T07:22:21.523Z", - "updated_at": "2022-07-27T08:54:42.909Z", - "object": "metadata_schema" + "source_id": { + "type": "string" }, - { - "id": "ms_Z7niydc0OpGjDRL4yB40niXn", - "related_object": "publication", - "properties": { - "year": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-03-30T06:23:49.715Z", - "updated_at": "2022-04-19T10:28:24.568Z", - "object": "metadata_schema" + "strict": { + "type": "boolean" }, - { - "id": "ms_t4ir0Dm3ta6a4a5ch3ma", - "related_object": "redemption", - "properties": { - "location_id": { - "eq": [ - "L1", - "L2", - "L3" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "store_names": { - "eq": [ - "Store 1 - New York - Broadway", - "Store 2 - Florida - Miami", - "Store 3 - London - Heathrow", - "Store 4 - Berlin - Alexanderplatz" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2021-12-03T06:33:45.890Z", - "updated_at": "2022-07-26T14:58:24.546Z", - "object": "metadata_schema" + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Discount effect for an included resource." }, - { - "id": "ms_EnSASZVEIDsZAYa8Z0nG8Rlg", - "related_object": "reward", - "properties": { - "Type": { - "type": "string", - "array": false, - "optional": true, - "objectType": null, - "exactLength": 4 + "quantity_limit": { + "type": "integer", + "description": "A limit on the number of units that at maximum can qualify for a discount. This property is present for an AMOUNT type discount when the effect is applied to ITEMS and each unit of matched products has the same discount value." + } + } + } + }, + "included_all": { + "type": "boolean", + "description": "Indicates whether all items are included in the discount." + } + } + }, + "created_at": { + "type": "string", + "example": "2022-03-23T07:44:00.444Z", + "description": "Timestamp representing the date and time when the validation rule was created in ISO 8601 format.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2022-04-26T08:35:54.960Z", + "description": "Timestamp representing the date and time when the validation rule was updated in ISO 8601 format.", + "format": "date-time" + }, + "type": { + "type": "string", + "enum": [ + "basic", + "advanced", + "complex" + ], + "description": "Type of validation rule." + }, + "context_type": { + "type": "string", + "enum": [ + "earning_rule.order.paid", + "earning_rule.custom_event", + "earning_rule.customer.segment.entered", + "campaign.discount_coupons", + "campaign.discount_coupons.discount.apply_to_order", + "campaign.discount_coupons.discount.apply_to_items", + "campaign.discount_coupons.discount.apply_to_items_proportionally", + "campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity", + "campaign.discount_coupons.discount.fixed.apply_to_items", + "campaign.gift_vouchers", + "campaign.gift_vouchers.gift.apply_to_order", + "campaign.gift_vouchers.gift.apply_to_items", + "campaign.referral_program", + "campaign.referral_program.discount.apply_to_order", + "campaign.referral_program.discount.apply_to_items", + "campaign.referral_program.discount.apply_to_items_proportionally", + "campaign.referral_program.discount.apply_to_items_proportionally_by_quantity", + "campaign.referral_program.discount.fixed.apply_to_items", + "campaign.promotion", + "campaign.promotion.discount.apply_to_order", + "campaign.promotion.discount.apply_to_items", + "campaign.promotion.discount.apply_to_items_proportionally", + "campaign.promotion.discount.apply_to_items_proportionally_by_quantity", + "campaign.promotion.discount.fixed.apply_to_items", + "campaign.loyalty_program", + "campaign.lucky_draw", + "voucher.discount_voucher", + "voucher.discount_voucher.discount.apply_to_order", + "voucher.discount_voucher.discount.apply_to_items", + "voucher.discount_voucher.discount.apply_to_items_proportionally", + "voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity", + "voucher.discount_voucher.discount.fixed.apply_to_items", + "voucher.gift_voucher", + "voucher.gift_voucher.gift.apply_to_order", + "voucher.gift_voucher.gift.apply_to_items", + "voucher.loyalty_card", + "voucher.lucky_draw_code", + "distribution.custom_event", + "reward_assignment.pay_with_points", + "global" + ], + "description": "Validation rule context type. \n\n| **Context Type** | **Definition** |\n|:---|:---|\n| earning_rule.order.paid | |\n| earning_rule.custom_event | |\n| earning_rule.customer.segment.entered | |\n| campaign.discount_coupons | |\n| campaign.discount_coupons.discount.apply_to_order | |\n| campaign.discount_coupons.discount.apply_to_items | |\n| campaign.discount_coupons.discount.apply_to_items_proportionally | |\n| campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.discount_coupons.discount.fixed.apply_to_items | |\n| campaign.gift_vouchers | |\n| campaign.gift_vouchers.gift.apply_to_order | |\n| campaign.gift_vouchers.gift.apply_to_items | |\n| campaign.referral_program | |\n| campaign.referral_program.discount.apply_to_order | |\n| campaign.referral_program.discount.apply_to_items | |\n| campaign.referral_program.discount.apply_to_items_proportionally | |\n| campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.referral_program.discount.fixed.apply_to_items | |\n| campaign.promotion | |\n| campaign.promotion.discount.apply_to_order | |\n| campaign.promotion.discount.apply_to_items | |\n| campaign.promotion.discount.apply_to_items_proportionally | |\n| campaign.promotion.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.promotion.discount.fixed.apply_to_items | |\n| campaign.loyalty_program | |\n| campaign.lucky_draw | |\n| voucher.discount_voucher | |\n| voucher.discount_voucher.discount.apply_to_order | |\n| voucher.discount_voucher.discount.apply_to_items | |\n| voucher.discount_voucher.discount.apply_to_items_proportionally | |\n| voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | |\n| voucher.discount_voucher.discount.fixed.apply_to_items | |\n| voucher.gift_voucher | |\n| voucher.gift_voucher.gift.apply_to_order | |\n| voucher.gift_voucher.gift.apply_to_items | |\n| voucher.loyalty_card | |\n| voucher.lucky_draw_code | |\n| distribution.custom_event | |\n| reward_assignment.pay_with_points | |\n| global | |" + }, + "object": { + "type": "string", + "default": "validation_rules", + "description": "The type of object represented by JSON. This object stores information about the validation rule." + } + } + }, + "13_req_create_validation_rule": { + "title": "Create Validation Rule Request Body", + "type": "object", + "description": "Request body schema for **POST** `/validation-rules`.", + "properties": { + "name": { + "type": "string", + "description": "Custom, unique name for the set of validation rules.", + "example": "Business Validation Rule" + }, + "rules": { + "type": "object", + "description": "Contains all the rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", + "properties": { + "1": { + "type": "object", + "description": "Defines the rule.", + "properties": { + "name": { + "type": "string", + "description": "Voucherify specific rule name. The list of available names is provided below. \n| **Name** |\n|:---|\n| **Customer** |\n| customer.segment
                  customer.metadata* |\n| **Order** |\n| order.amount
                  order.items.count
                  order.items.price_any
                  order.items.price_each
                  order.items.metadata_any
                  order.items.metadata_each
                  order.metadata* |\n| **Campaign** |\n| campaign.orders.amount_discounted
                  campaign.orders.amount
                  campaign.redemptions.count
                  campaign.redemptions.count.daily
                  campaign.redemptions.count.monthly
                  campaign.redemptions.customers_count
                  campaign.redemptions.customers_count.daily
                  campaign.redemptions.customers_count.monthly |\n| **Redemption** |\n| redemption.gift.amount
                  redemption.count.daily
                  redemption.count.monthly
                  redemption.count.per_customer
                  redemption.count.per_customer.daily
                  redemption.count.per_customer.monthly
                  redemption.api_key
                  redemption.count.per_api_key
                  redemption.user.login
                  redemption.count.per_user
                  redemption.metadata*
                  redemption.reward.pay_with_points.points_used |\n| **Product** |\n| product.id
                  product.price
                  product.quantity
                  product.discount_applicable
                  product.metadata*
                  product.metadata.aggregated_quantity
                  product.metadata.aggregated_amount
                  product.metadata.discount_applicable
                  product.metadata.match_all |\n| **SKU** |\n| sku.id
                  sku.price
                  sku.quantity
                  sku.discount_applicable |\n| **Publication** |\n| publication.redeemable_by_linked_customer |\n| **Custom Event** |\n| custom_event.metadata* |\n| **Order items** |\n| order.items.every
                  order.items.any
                  order.items.none
                  order.items.cheapest
                  order.items.most_expensive |\n| order.items.quantity
                  order.items.aggregated_quantity
                  order.items.price
                  order.items.aggregated_amount
                  order.items.metadata* | \n\n\n*Requires the `property` field to be defined." + }, + "property": { + "type": [ + "string", + "null" + ], + "description": "Custom name for a metadata property associated with the condition to be satisfied. **Required** if the property `name` is any of the following: \n| **Name** |\n|:---|\n| customer_metadata |\n| custom_event_metadata |\n| order_items_metadata |\n| order_metadata |\n| product_metadata |\n| redemption_metadata |" + }, + "conditions": { + "type": "object", + "description": "A set of key value pairs representing the condition name and value. The list of available conditions is provided below: \n| **Condition (key)** | **Definition** | **Does not support Types** |\n|:---|:---|:---|\n| $is | A property is a predefined value. | |\n| $is_not | A property is not a predefined value. | |\n| $in | A property either one value in a predefined list of values. | |\n| $less_than | A property is less than a predefined value. | boolean |\n| $less_than_or_equal | A property is less than or equal to a predefined value. | boolean |\n| $more_than | A property is more than a predefined value. | boolean |\n| $more_than_or_equal | A property is more than or equal to a predefined value. | boolean |\n| $starts_with | A property starts with the predefined sequence of characters. | boolean, number |\n| $ends_with | A property ends with the predefined sequence of characters. | boolean, number |\n| $contains | A property contains the predefined sequence of characters. | boolean, number |\n| $timeframe | | boolean, number |\n| $dow | | boolean, string |\n| $count | | boolean, string |\n| $count_more | | boolean, string |\n| $count_less | | boolean, string |", + "properties": { + "$one_of_voucherify_conditions": { + "type": "array", + "description": "Contains a set of conditions for the rule.", + "items": { + "type": [ + "string", + "integer", + "boolean" + ] + } + } + } + }, + "rules": { + "type": "object", + "description": "Contains all the nested rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", + "properties": { + "1": { + "type": "object", + "description": "Defines the nested rule.", + "properties": { + "name": { + "type": "string" + }, + "property": { + "type": "string" + }, + "conditions": { + "type": "object" + }, + "rules": { + "type": "object" + } } }, - "allow_defined_only": false, - "created_at": "2022-07-27T08:53:32.257Z", - "updated_at": "2022-07-27T08:53:48.542Z", - "object": "metadata_schema" + "logic": { + "type": "string" + } + } + }, + "error": { + "type": "object", + "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rule.", + "properties": { + "message": { + "type": "string", + "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rule." + } + } + } + } + }, + "logic": { + "type": "string", + "example": "(1 and 2) and (3)", + "description": "Defines the logic between the rules." + } + } + }, + "error": { + "type": "object", + "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules.", + "properties": { + "message": { + "type": "string", + "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rules." + } + } + }, + "applicable_to": { + "type": "object", + "properties": { + "excluded": { + "type": "array", + "description": "Defines which items are excluded from a discount.", + "items": { + "type": "object", + "description": "Defines the excluded item.", + "properties": { + "object": { + "type": "string", + "enum": [ + "product", + "sku", + "products_collection" + ], + "description": "The type of object being excluded from the rule." }, - { - "id": "ms_xUHvkRBPvVJAlWcTkVzufKx4", - "related_object": "voucher", + "id": { + "type": "string", + "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." + }, + "source_id": { + "type": "string" + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY" + ], + "description": "Discount effect for an excluded resource." + } + } + } + }, + "included": { + "type": "array", + "description": "Defines which items are included in a discount.", + "items": { + "type": "object", + "description": "Defines the included item.", + "properties": { + "object": { + "type": "string", + "enum": [ + "product", + "sku", + "products_collection" + ], + "description": "The type of object being included in the rule." + }, + "id": { + "type": "string", + "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." + }, + "source_id": { + "type": "string" + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Discount effect for an included resource." + }, + "quantity_limit": { + "type": "integer", + "description": "A limit on the number of units that at maximum can qualify for a discount. This property is present for an AMOUNT type discount when the effect is applied to ITEMS and each unit of matched products has the same discount value." + } + } + } + }, + "included_all": { + "type": "boolean", + "description": "Indicates whether all items are included in the discount." + } + } + } + } + }, + "13_res_list_validation_rules": { + "description": "Response body schema for listing validation rules. \n\nThis entity stores the [validation rules](ref:get-validation-rule) used to limit your resources.", + "type": "object", + "title": "List Validation Rules Response Body", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about validation rules.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of validation rules.", + "default": "data" + }, + "data": { + "type": "array", + "uniqueItems": true, + "description": "An array of validation rules.", + "items": { + "type": "object", + "description": "Stores information about the validation rule.", + "properties": { + "id": { + "type": "string", + "description": "Unique validation rule ID.", + "example": "val_F4Artfc4HQIq" + }, + "name": { + "type": "string", + "description": "Custom, unique name for the set of validation rules." + }, + "rules": { + "type": "object", + "description": "A set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", + "properties": { + "1": { + "type": "object", + "description": "Defines the rule.", "properties": { - "unit": { - "type": "number", - "array": false, - "optional": true, - "objectType": null + "name": { + "type": "string", + "description": "Voucherify specific rule name. The list of available names is provided below. \n\n**Name** |\n---- | -----------\n**Customer** | customer.segment
                  customer.metadata* \n**Order** |order.amount
                  order.items.count
                  order.items.price_any
                  order.items.price_each
                  order.items.metadata_any
                  order.items.metadata_each
                  order.metadata* |\n| **Campaign** | campaign.orders.amount_discounted
                  campaign.orders.amount
                  campaign.redemptions.count
                  campaign.redemptions.count.daily
                  campaign.redemptions.count.monthly
                  campaign.redemptions.customers_count
                  campaign.redemptions.customers_count.daily
                  campaign.redemptions.customers_count.monthly |\n| **Redemption** |redemption.gift.amount
                  redemption.count.daily
                  redemption.count.monthly
                  redemption.count.per_customer
                  redemption.count.per_customer.daily
                  redemption.count.per_customer.monthly
                  redemption.api_key
                  redemption.count.per_api_key
                  redemption.user.login
                  redemption.count.per_user
                  redemption.metadata*
                  redemption.reward.pay_with_points.points_used |\n| **Product** | product.id
                  product.price
                  product.quantity
                  product.discount_applicable
                  product.metadata*
                  product.metadata.aggregated_quantity
                  product.metadata.aggregated_amount
                  product.metadata.discount_applicable
                  product.metadata.match_all |\n| **SKU** | sku.id
                  sku.price
                  sku.quantity
                  sku.discount_applicable |\n| **Publication** | publication.redeemable_by_linked_customer |\n| **Custom Event** | custom_event.metadata* |\n| **Order items** | order.items.every
                  order.items.any
                  order.items.none
                  order.items.cheapest
                  order.items.most_expensive | order.items.quantity
                  order.items.aggregated_quantity
                  order.items.price
                  order.items.aggregated_amount
                  order.items.metadata* | \n\n\n*Requires the `property` field to be defined." + }, + "rules": { + "type": "object", + "description": "Contains all the nested rule definitions for the validation rule. It is a set of key value pairs representing the rules and logic between the rules. The keys are numbered consequtively beginning from `1`. The values are objects containing the rule conditions.", + "properties": { + "1": { + "type": "object", + "description": "Defines the nested rule.", + "properties": { + "name": { + "type": "string" + }, + "property": { + "type": "string" + }, + "conditions": { + "type": "object" + }, + "rules": { + "type": "object" + } + } + }, + "logic": { + "type": "string" + } + } }, - "Region": { + "property": { "type": "string", - "array": false, - "optional": true, - "objectType": null + "description": "Custom name for a metadata property associated with the condition to be satisfied. **Required** if the property `name` is any of the following: \n| **Name** |\n|:---|\n| customer_metadata |\n| custom_event_metadata |\n| order_items_metadata |\n| order_metadata |\n| product_metadata |\n| redemption_metadata |" }, - "Season": { - "eq": [ - "Spring", - "Summer", - "Fall", - "Winter" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "CATEGORY": { - "type": "string", - "array": false, - "optional": true, - "objectType": null + "conditions": { + "type": "array", + "description": "A set of key value pairs representing the condition name and value. The list of available conditions is provided below: \n| **Condition (key)** | **Definition** | **Does not support Types** |\n|:---|:---|:---|\n| $is | A property is a predefined value. | |\n| $is_not | A property is not a predefined value. | |\n| $in | A property either one value in a predefined list of values. | |\n| $less_than | A property is less than a predefined value. | boolean |\n| $less_than_or_equal | A property is less than or equal to a predefined value. | boolean |\n| $more_than | A property is more than a predefined value. | boolean |\n| $more_than_or_equal | A property is more than or equal to a predefined value. | boolean |\n| $starts_with | A property starts with the predefined sequence of characters. | boolean, number |\n| $ends_with | A property ends with the predefined sequence of characters. | boolean, number |\n| $contains | A property contains the predefined sequence of characters. | boolean, number |\n| $timeframe | | boolean, number |\n| $dow | | boolean, string |\n| $count | | boolean, string |\n| $count_more | | boolean, string |\n| $count_less | | boolean, string |", + "items": { + "type": [ + "string", + "integer", + "boolean" + ] + } }, - "active_on_calendar_month": { - "eq": [ - 1, - 2, - 3, - 5, - 7, - 9, - 10, - 11, - 12 - ], - "type": "number", - "array": false, - "optional": true, - "objectType": null + "error": { + "type": "object", + "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rule.", + "properties": { + "message": { + "type": "string", + "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rule." + } + } } - }, - "allow_defined_only": false, - "created_at": "2022-01-24T07:22:01.281Z", - "updated_at": "2022-06-22T07:22:09.577Z", - "object": "metadata_schema" + } + }, + "logic": { + "type": "string", + "description": "Defines the logic between the rules.", + "example": "(1 and 2) and (3)" } + } + }, + "error": { + "type": "object", + "description": "Contains the error message returned from API when validation / redemption fails to meet requirements of defined rules.", + "properties": { + "message": { + "type": "string", + "description": "The error message returned from API when validation / redemption fails to meet requirements of defined rules." + } + } + }, + "applicable_to": { + "type": "object", + "properties": { + "excluded": { + "type": "array", + "description": "Defines which items are excluded from a discount.", + "items": { + "type": "object", + "description": "Defines the excluded item.", + "properties": { + "object": { + "type": "string", + "enum": [ + "product", + "sku", + "products_collection" + ], + "description": "The type of object being excluded from the rule." + }, + "id": { + "type": "string", + "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." + }, + "source_id": { + "type": "string" + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY" + ], + "description": "Discount effect for an excluded resource." + } + } + } + }, + "included": { + "type": "array", + "description": "Defines which items are included in a discount.", + "items": { + "type": "object", + "description": "Defines the included item.", + "properties": { + "object": { + "type": "string", + "enum": [ + "product", + "sku", + "products_collection" + ], + "description": "The type of object being included in the rule." + }, + "id": { + "type": "string", + "description": "Unique product ID, SKU ID, product collection ID i.e. `prod_0b72b00ffed198e344z`, `sku_0b7d7dfb090be5c619`, `pc_4ndRXAsTOzwSdHcQcxf489uU`." + }, + "source_id": { + "type": "string" + }, + "strict": { + "type": "boolean" + }, + "effect": { + "type": "string", + "enum": [ + "APPLY_TO_EVERY", + "APPLY_TO_CHEAPEST", + "APPLY_TO_MOST_EXPENSIVE" + ], + "description": "Discount effect for an included resource." + }, + "quantity_limit": { + "type": "integer", + "description": "A limit on the number of units that at maximum can qualify for a discount. This property is present for an AMOUNT type discount when the effect is applied to ITEMS and each unit of matched products has the same discount value." + } + } + } + }, + "included_all": { + "type": "boolean", + "description": "Indicates whether all items are included in the discount." + } + } + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the validation rule was created in ISO 8601 format.", + "example": "2022-04-07T07:42:44.442Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2022-05-09T07:42:44.442Z", + "description": "Timestamp representing the date and time when the validation rule was updated in ISO 8601 format.", + "format": "date-time" + }, + "type": { + "type": "string", + "enum": [ + "basic", + "advanced", + "complex" ], - "total": 13 + "description": "Type of validation rule." + }, + "context_type": { + "type": "string", + "enum": [ + "earning_rule.order.paid", + "earning_rule.custom_event", + "earning_rule.customer.segment.entered", + "campaign.discount_coupons", + "campaign.discount_coupons.discount.apply_to_order", + "campaign.discount_coupons.discount.apply_to_items", + "campaign.discount_coupons.discount.apply_to_items_proportionally", + "campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity", + "campaign.discount_coupons.discount.fixed.apply_to_items", + "campaign.gift_vouchers", + "campaign.gift_vouchers.gift.apply_to_order", + "campaign.gift_vouchers.gift.apply_to_items", + "campaign.referral_program", + "campaign.referral_program.discount.apply_to_order", + "campaign.referral_program.discount.apply_to_items", + "campaign.referral_program.discount.apply_to_items_proportionally", + "campaign.referral_program.discount.apply_to_items_proportionally_by_quantity", + "campaign.referral_program.discount.fixed.apply_to_items", + "campaign.promotion", + "campaign.promotion.discount.apply_to_order", + "campaign.promotion.discount.apply_to_items", + "campaign.promotion.discount.apply_to_items_proportionally", + "campaign.promotion.discount.apply_to_items_proportionally_by_quantity", + "campaign.promotion.discount.fixed.apply_to_items", + "campaign.loyalty_program", + "campaign.lucky_draw", + "voucher.discount_voucher", + "voucher.discount_voucher.discount.apply_to_order", + "voucher.discount_voucher.discount.apply_to_items", + "voucher.discount_voucher.discount.apply_to_items_proportionally", + "voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity", + "voucher.discount_voucher.discount.fixed.apply_to_items", + "voucher.gift_voucher", + "voucher.gift_voucher.gift.apply_to_order", + "voucher.gift_voucher.gift.apply_to_items", + "voucher.loyalty_card", + "voucher.lucky_draw_code", + "distribution.custom_event", + "reward_assignment.pay_with_points", + "global" + ], + "description": "Validation rule context type. \n\n| **Context Type** | **Definition** |\n|:---|:---|\n| earning_rule.order.paid | |\n| earning_rule.custom_event | |\n| earning_rule.customer.segment.entered | |\n| campaign.discount_coupons | |\n| campaign.discount_coupons.discount.apply_to_order | |\n| campaign.discount_coupons.discount.apply_to_items | |\n| campaign.discount_coupons.discount.apply_to_items_proportionally | |\n| campaign.discount_coupons.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.discount_coupons.discount.fixed.apply_to_items | |\n| campaign.gift_vouchers | |\n| campaign.gift_vouchers.gift.apply_to_order | |\n| campaign.gift_vouchers.gift.apply_to_items | |\n| campaign.referral_program | |\n| campaign.referral_program.discount.apply_to_order | |\n| campaign.referral_program.discount.apply_to_items | |\n| campaign.referral_program.discount.apply_to_items_proportionally | |\n| campaign.referral_program.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.referral_program.discount.fixed.apply_to_items | |\n| campaign.promotion | |\n| campaign.promotion.discount.apply_to_order | |\n| campaign.promotion.discount.apply_to_items | |\n| campaign.promotion.discount.apply_to_items_proportionally | |\n| campaign.promotion.discount.apply_to_items_proportionally_by_quantity | |\n| campaign.promotion.discount.fixed.apply_to_items | |\n| campaign.loyalty_program | |\n| campaign.lucky_draw | |\n| voucher.discount_voucher | |\n| voucher.discount_voucher.discount.apply_to_order | |\n| voucher.discount_voucher.discount.apply_to_items | |\n| voucher.discount_voucher.discount.apply_to_items_proportionally | |\n| voucher.discount_voucher.discount.apply_to_items_proportionally_by_quantity | |\n| voucher.discount_voucher.discount.fixed.apply_to_items | |\n| voucher.gift_voucher | |\n| voucher.gift_voucher.gift.apply_to_order | |\n| voucher.gift_voucher.gift.apply_to_items | |\n| voucher.loyalty_card | |\n| voucher.lucky_draw_code | |\n| distribution.custom_event | |\n| reward_assignment.pay_with_points | |\n| global | |" + }, + "assignments_count": { + "description": "The number of instances the validation rule has been assigned to different types of redeemables.", + "type": "integer" + }, + "object": { + "type": "string", + "default": "validation_rules", + "description": "The type of object represented by each nested object in the JSON `data` array. This object stores information about the validation rules." + } + } + } + }, + "total": { + "type": "integer", + "description": "Total number of validation rules in the project." + } + } + }, + "13_obj_validation_rule_assignment_object": { + "title": "Validation Rule Assignment Object", + "type": "object", + "description": "This is an object representing a validation rule assignment. \n\nThis object stores an assignment of a: \n- [voucher](ref:get-voucher)\n- [campaign](ref:get-campaign)\n- [earning rule](ref:get-earning-rule)\n- [reward assignment](ref:get-reward-assignment)\n- [promotion tier](ref:list-promotion-tiers)\n- [publication](ref:list-publications)", + "x-tags": [ + "VALIDATION RULES API" + ], + "properties": { + "id": { + "type": "string", + "example": "asgm_74F7QZoYbUoljwQO", + "description": "Validation rule assignment ID." + }, + "rule_id": { + "type": "string", + "example": "val_4j7DCRm2IS59", + "description": "Validation rule ID." + }, + "related_object_id": { + "type": "string", + "example": "v_JtWunK6jUo7X2qOFj0SyRHq4p9tgENlT", + "description": "The resource ID to which the validation rule was assigned." + }, + "related_object_type": { + "type": "string", + "description": "The type of resource to which the validation rule was assigned.", + "enum": [ + "voucher", + "campaign", + "earning_rule", + "reward_assignment", + "promotion_tier", + "distribution" + ] + }, + "created_at": { + "type": "string", + "example": "2022-02-17T08:18:15.085Z", + "description": "Timestamp representing the date and time when the validation rule assignment was created in ISO 8601 format.", + "format": "date-time" + }, + "object": { + "type": "string", + "default": "validation_rules_assignment", + "description": "The type of object represented by the ID." + } + } + }, + "13_res_validation-rules_validationRuleId_assignments": { + "type": "object", + "description": "Validation Rule Assignments", + "title": "Validation Rule Assignments", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about validation rule assignments.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the JSON property that contains the array of validation rule assignments.", + "default": "data" + }, + "data": { + "type": "array", + "description": "A dictionary that contains an array of validation rule assignments.", + "items": { + "$ref": "#/components/schemas/13_obj_validation_rule_assignment_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of validation rule assignments." + } + } + }, + "13_req_create_validation_rule_assignments": { + "description": "Respone body schema for **POST** `/validation-rules/{validationRuleId}/assignments`.", + "title": "Create Validation Rule Assignments Request Body", + "oneOf": [ + { + "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_voucher" + }, + { + "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_campaign" + }, + { + "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_promotion_tier" + }, + { + "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_earning_rule" + }, + { + "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_reward" + }, + { + "$ref": "#/components/schemas/13_req_create_validation_rule_assignments_distribution" + } + ] + }, + "13_req_create_validation_rule_assignments_voucher": { + "type": "object", + "description": "Assign a validation rule to a voucher.", + "title": "Voucher", + "properties": { + "voucher": { + "type": "string", + "description": "Unique voucher ID or code to which you would like to assign the validation rule to.", + "example": "v_ssR6vhswwh5odSloN2Vc3O60w7aea018" + } + } + }, + "13_req_create_validation_rule_assignments_campaign": { + "type": "object", + "description": "Assign a validation rule to a campaign.", + "title": "Campaign", + "properties": { + "campaign": { + "type": "string", + "description": "Unique campaign ID or name to which you would like to assign the validation rule to.", + "example": "camp_HXsR22VUMC4hN4DR7eAhCalp" + } + } + }, + "13_req_create_validation_rule_assignments_promotion_tier": { + "type": "object", + "description": "Assign a validation rule to a promotion tier.", + "title": "Promotion Tier", + "properties": { + "promotion_tier": { + "type": "string", + "description": "Unique promotion tier ID to which you would like to assign the validation rule to.", + "example": "promo_Vet0vCNyyo5pOddHfu2X3FCB" + } + } + }, + "13_req_create_validation_rule_assignments_earning_rule": { + "type": "object", + "description": "Assign a validation rule to an earning rule.", + "title": "Earning Rule", + "properties": { + "earning_rule": { + "type": "string", + "description": "Unique earning rule ID to which you would like to assign the validation rule to.", + "example": "ern_CfvQ4vWEKD4kHTxghdY8YJGs" + } + } + }, + "13_req_create_validation_rule_assignments_reward": { + "type": "object", + "description": "Assign a validation rule to a reward.", + "title": "Reward", + "properties": { + "related_object_id": { + "type": "string", + "description": "Unique reward assignment ID, i.e. rewa_6VSWcXjfm5PuZlfeuZxl5JZT. This is the first parameter to be sent for a validation rule assignment to be assigned to a reward assignment. The prerequisites for assigning a validation rule to a reward assignment are: \n1. Define a loyalty campaign. \n2. Connect a reward with the campaign. \n3. Retrieve a reward assignment ID for the reward assigned to the loyalty campaign. \n4. And finally you can use this endpoint to assign a validation rule to the particular reward assignment.", + "example": "rewa_6VSWcXjfm5PuZlfeuZxl5JZT" + }, + "related_object_type": { + "type": "string", + "description": "This is the second parameter that needs to be sent in order to properly assign a validation rule to a reward assignment.", + "example": "reward_assignment", + "default": "reward_assignment", + "enum": [ + "reward_assignment" + ] + } + } + }, + "13_req_create_validation_rule_assignments_distribution": { + "type": "object", + "description": "Assign a validation rule to a distribution.", + "title": "Distribution", + "properties": { + "distribution": { + "type": "string", + "description": "Unique distribution ID to which you would like to assign the validation rule to.", + "example": "distr_2nUIekYnS9L1Vm1I55vmC7kSvd" + } + } + }, + "14_obj_segment_object": { + "title": "Customer Segment Object", + "type": "object", + "properties": { + "id": { + "type": "string", + "example": "seg_1wc52c5z6r1kQ81brO8j9Hk2", + "description": "Unique segment ID." + }, + "name": { + "type": "string", + "description": "Segment name." + }, + "created_at": { + "type": "string", + "example": "2022-05-12T13:01:56.896Z", + "description": "Timestamp representing the date and time when the segment was created in ISO 8601 format.", + "format": "date-time" + }, + "type": { + "type": "string", + "enum": [ + "auto-update", + "static" + ], + "description": "Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers)." + }, + "filter": { + "type": [ + "object", + "null" + ], + "description": "Defines a set of criteria for an `auto-update` segment type. " + }, + "initial_sync_status": { + "type": "string", + "enum": [ + "IN_PROGRESS", + "DONE" + ] + }, + "object": { + "type": "string", + "default": "segment", + "description": "The type of object represented by JSON. This object stores information about the customer segment." + } + }, + "description": "This is an object representing a customer segment.", + "x-tags": [ + "SEGMENTS API" + ] + }, + "14_req_create_segment": { + "title": "Create Customer Segment Request Body", + "description": "Request body schema for **POST** `/segments`.", + "oneOf": [ + { + "$ref": "#/components/schemas/14_req_create_segment_static" + }, + { + "$ref": "#/components/schemas/14_req_create_segment_dynamic" + } + ] + }, + "14_req_create_segment_static": { + "title": "Static Customer Segment", + "type": "object", + "description": "Request body schema for creating a static customer segment in **POST** `/segments`.", + "properties": { + "name": { + "type": "string", + "description": "Segment name." + }, + "type": { + "type": "string", + "description": "Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers).", + "default": "static" + }, + "customers": { + "type": "array", + "description": "Array of customer IDs.", + "items": {} + } + } + }, + "14_req_create_segment_dynamic": { + "title": "Dynamic Customer Segment", + "type": "object", + "description": "Request body schema for creating a dynamic customer segment in **POST** `/segments`.", + "properties": { + "name": { + "type": "string", + "description": "Segment name." + }, + "type": { + "type": "string", + "description": "Describes whether the segment is dynamic (customers come in and leave based on set criteria) or static (manually selected customers).", + "default": "auto-update" + }, + "filter": { + "type": "object", + "description": "Defines a set of criteria for an `auto-update` segment type." + } + } + }, + "14_res_customers_customerId_segments": { + "type": "object", + "title": "List Segments for Customer Response Body", + "description": "Response body schema for `/customers/{customerId}/segments`.", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about customer segments.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the JSON property that contains the array of segment IDs.", + "default": "data" + }, + "data": { + "type": "array", + "description": "A dictionary that contains an array of segment IDs and names.", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique segment ID.", + "example": "seg_DNAOhUtJffvX0f57ajLMFBYR" + }, + "name": { + "type": "string", + "description": "Segment name." + }, + "object": { + "type": "string", + "description": "The type of object represented by the ID.", + "default": "segment" + } + } + } + }, + "total": { + "type": "integer", + "description": "Total number of segments the customer belongs to." + } + } + }, + "15_obj_event_object": { + "title": "Event Object", + "type": "object", + "description": "This is an object representing an event. \n\nVoucherify distinguishes two types of events - custom and internal. Both are presented in the same Event structure. \n\n## Custom Events\n\nCustom Events are actions taken by your customers. They’re best suited for tracking high-value customer interactions with your application. Logging a custom event can trigger any number of distributions, and enables the segmentation filters around the recency and frequency of that event.\n\nWith Custom Event metadata field, Voucherify allows you to set properties on custom events. These properties can then be used for further qualifying trigger conditions, increasing personalization in messaging, and generating more sophisticated analytics through raw data export.\n\nThe Custom Events are directly linked to the customers' resources from Voucherify. It means that each event gets a connection to a customer. \n\n\n> #### An example \n>\n> If an e-commerce application wanted to send a message to a user when he/she abandons their cart, the custom event could additionally improve its target audience and allow for increased distribution personalization by adding a Custom Event of the `value` of customers’ order.\n\n## Internal Voucherify Events \n\nMoreover, Events are our way of letting you know when something interesting happens in your project. When an interesting event occurs, we create a new Event object. For example, when a redemption succeeds, we create a `redemption.succeeded` event.\n\nNote that many API requests may cause multiple events to be created. For example, if you create a new redemption for a new customer not existing yet in Voucherify, you will receive both a `customer.created` event and a `redemption.succeeded` event.\n\nThe events occur when the state of another API resource changes and the state of that resource at the time of the change is embedded in the data field of the event. \n\n| **Types of internal events** |\n|:---|\n| **Campaign** |\n| campaign.validation_rules.created
                  campaign.created
                  campaign.disabled
                  campaign.export_mailchimp_scheduled
                  campaign.export_mailchimp_done
                  campaign.validation_rules.deleted
                  campaign.validation_rules.updated
                  campaign.updated
                  campaign.deleted
                  campaign.export_mailchimp_failed
                  campaign.enabled |\n| **Voucher** |\n| voucher.validation.succeeded
                  voucher.updated
                  voucher.enabled
                  voucher.gift.balance_added
                  voucher.validation_rules.updated
                  voucher.published
                  voucher.validation_rules.deleted
                  voucher.disabled
                  voucher.validation.failed
                  voucher.validation_rules.created
                  voucher.deleted
                  voucher.created |\n| **Redemption** |\n| redemption.succeeded
                  redemption.failed
                  redemption.rollback.failed
                  redemption.rollback.succeeded |\n| **Customer** |\n| customer.rewarded
                  customer.rewarded.loyalty_points
                  customer.sms.sent
                  customer.email.failed
                  customer.deleted
                  customer.created
                  customer.updated
                  customer.segment.left
                  customer.sms.failed
                  customer.segment.entered
                  customer.email.sent |\n| **Order** |\n| order.canceled
                  order.created
                  order.updated
                  order.paid |\n| **Product** |\n| product.updated
                  product.created
                  product.deleted |\n| **SKU** |\n| sku.updated
                  sku.created
                  sku.deleted |\n| **Distribution** |\n| distribution.sms.failed
                  distribution.sms.sent
                  distribution.email.sent
                  distribution.email.failed |\n| **Export** |\n| export.done
                  export.scheduled
                  export.failed
                  export.deleted | \n\n## Webhooks \n\nVoucherify also has a separate system for sending the event objects directly to an endpoint at your end (server). We called that mechanism webhooks. They are managed in your project settings. \n\n| **Attribute** | **Description** | **Example** |\n|:---|:---|:---|\n| `id`
                  string | | event_xjGas2mI2PduFFPL2NAcFeHkHfLn3H |\n| `object`
                  string | Type of the object represented by JSON. Value is `event`. | |\n| `created_at`
                  string, ISO 8601 date format | Time at which the object was created. | 2016-11-16T14:14:31Z |\n| `type`
                  string | Description of the event | view_pricing_page
                  redemption.succeeded |\n| `data.object`
                  object | The object containing data associated with the event. It can be a `customer`, `redemption` or any other type of object which is a source of the event. In this object structure, you can also find a property `related_object` which contains values presenting any other resource connected to the event.

                  For Custom Event the structure of child attributes is constant:

                  - customer (`object`) - The object presenting a profile of the related customer who performed an action.

                  - metadata (`object`) - A set of key/value pairs that you can attach to a custom event object. It can be useful for storing additional information about the event in a structured format. | \"data\": { \"object\": { \"customer\": { \"id\": \"cust_OtHDKrv5sJrjd8aYBYZ6AOIF\", \"name\": \"Gustav Purpleson\", \"object\": \"customer\", \"source_id\": \"gustav@purpleson.com\", \"created_at\": 1510834859417, \"updated_at\": 1510835106559 }, \"metadata\": { \"lang\": \"en\", \"test\": true, \"page\": \"http://main.io\" } } } |\n| `metadata`
                  object | A set of key/value pairs that Voucherify attaches to a custom event object. It is a set of additional system information about the event in a structured format. | |\n\n\n```json\n{\n \"id\": \"event_ehkvgZFgSePlb95SH3JJulkApy9Kg9\",\n \"object\": \"event\",\n \"created_at\": \"2017-11-16T14:45:34.181Z\",\n \"type\": \"redemption.succeeded\",\n \"data\": {\n \"object\": {\n \"id\": \"r_mist0IpebikTaRdxiOGI2IhL\",\n \"date\": \"2017-11-16T14:45:32.733Z\",\n \"order\": {\n \"id\": \"ord_AhDlR13vQE5ino95P2NIABBN\",\n \"items\": [\n {\n \"object\": \"order_item\",\n \"sku_id\": null,\n \"quantity\": 1,\n \"source_id\": null,\n \"product_id\": \"iphone8\"\n }\n ],\n \"amount\": 50000,\n \"object\": \"order\",\n \"status\": \"CREATED\",\n \"customer\": {\n \"id\": \"cust_fJPsoub5ITJnIEVO3v9whrP9\",\n \"object\": \"customer\"\n },\n \"metadata\": null,\n \"referrer\": null,\n \"source_id\": null,\n \"created_at\": \"2017-11-16T14:45:32.023Z\",\n \"updated_at\": null,\n \"discount_amount\": 2000\n },\n \"object\": \"redemption\",\n \"result\": \"SUCCESS\",\n \"voucher\": {\n \"code\": \"2017-goX-aH\",\n \"gift\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"object\": \"voucher\",\n \"campaign\": \"SteffenTest\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"amount_off\": 2000\n },\n \"is_referral_code\": false\n },\n \"customer\": {\n \"id\": \"cust_fJPsoub5ITJnIEVO3v9whrP9\",\n \"object\": \"customer\"\n },\n \"metadata\": {\n \"city\": \"London1\"\n },\n \"customer_id\": \"cust_fJPsoub5ITJnIEVO3v9whrP9\",\n \"tracking_id\": \"track_3tM7KR57bbeIRtMcvpKYr2aAOrCpYBDZ\",\n \"related_object_type\": \"voucher\"\n },\n \"previous_attributes\": {}\n },\n \"metadata\": {\n \"source\": \"API\"\n }\n}\n```\n\n## Customisable Campaign Events \n\nAs part of campaign creation, users can configure webhooks triggered when specific activities appear within a campaign's lifetime. Those webhooks get configurable names and the users implement them in Voucherify Dashboard as part of the campaign creation process.\n\nThis type of webhooks can be configured for the following actions: \n\n| **Action** |\n|:---|\n| **Referral Program** |\n| Referrer rewarded
                  Referral code assigned
                  Customer referred |\n| **Loyalty Campaign** |\n| Loyalty card assigned
                  Points earned
                  Points redeemed | \n\nPayloads of customizable webhooks:\n\n### Referral Program\n\n\n```json\n{\n \"id\": \"evcus_0a26b1a5acd3437894\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-01-24T11:09:57.765Z\",\n \"type\": \"referral_code_assigned\",\n \"data\": {\n \"object\": {\n \"voucher\": {\n \"id\": \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\",\n \"code\": \"xYwEheRh\",\n \"campaign\": \"Referral Webhooks\",\n \"campaign_id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"category\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"amount_off\": 1000,\n \"effect\": \"APPLY_TO_ORDER\"\n },\n \"gift\": null,\n \"loyalty_card\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX19wsHlNj5GT/2Kkf/MnPKlL4WjU55GyTsmpXgw+KQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy/OHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va+MFPSHRy5tesDQ==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19wsHlNj5GT%2F2Kkf%2FMnPKlL4WjU55GyTsmpXgw%2BKQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy%2FOHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va%2BMFPSHRy5tesDQ%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19ZgrgURtgcjD1cvt/L6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i/UVUbmXTxDvNXsceP+nzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19ZgrgURtgcjD1cvt%2FL6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i%2FUVUbmXTxDvNXsceP%2BnzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w%3D%3D\"\n }\n },\n \"is_referral_code\": true,\n \"created_at\": \"2021-11-12T11:09:57.772Z\",\n \"updated_at\": null,\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"referrer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/xYwEheRh/redemptions?page=1&limit=10\"\n },\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/xYwEheRh/publications?page=1&limit=10\"\n },\n \"object\": \"voucher\"\n },\n \"campaign\": {\n \"id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"name\": \"Referral Webhooks\",\n \"campaign_type\": \"REFERRAL_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"voucher\": {\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"amount_off\": 1000,\n \"effect\": \"APPLY_TO_ORDER\"\n },\n \"gift\": null,\n \"loyalty_card\": null,\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"prefix\": \"\",\n \"postfix\": \"\"\n },\n \"is_referral_code\": true\n },\n \"referral_program\": {\n \"conversion_event_type\": \"redemption\"\n },\n \"join_once\": false,\n \"use_voucher_metadata_schema\": true,\n \"vouchers_count\": 1,\n \"active\": true,\n \"metadata\": {},\n \"created_at\": \"2021-11-12T11:00:08.306Z\",\n \"updated_at\": \"2021-11-12T11:09:40.671Z\",\n \"creation_status\": \"DONE\",\n \"vouchers_generation_status\": \"DONE\",\n \"object\": \"campaign\"\n },\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"source_id\": \"test_referrer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0\n },\n \"orders\": {\n \"total_amount\": 0,\n \"total_count\": 0,\n \"average_amount\": null,\n \"last_order_amount\": null,\n \"last_order_date\": null\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 0,\n \"campaigns\": {}\n },\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-11-12T11:09:57.749Z\",\n \"updated_at\": \"2021-11-12T11:09:58.620Z\",\n \"object\": \"customer\"\n },\n \"publication\": {\n \"id\": \"pub_gSpZUNX0hcDfEeRx3qIMMFrtfsZjeJO8\",\n \"object\": \"publication\",\n \"result\": \"SUCCESS\",\n \"channel\": \"API\",\n \"voucher\": {\n \"id\": \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\",\n \"code\": \"xYwEheRh\",\n \"gift\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"active\": true,\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX19wsHlNj5GT/2Kkf/MnPKlL4WjU55GyTsmpXgw+KQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy/OHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va+MFPSHRy5tesDQ==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19wsHlNj5GT%2F2Kkf%2FMnPKlL4WjU55GyTsmpXgw%2BKQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy%2FOHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va%2BMFPSHRy5tesDQ%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19ZgrgURtgcjD1cvt/L6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i/UVUbmXTxDvNXsceP+nzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19ZgrgURtgcjD1cvt%2FL6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i%2FUVUbmXTxDvNXsceP%2BnzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w%3D%3D\"\n }\n },\n \"object\": \"voucher\",\n \"publish\": {\n \"url\": \"/v1/vouchers/xYwEheRh/publications?page=1&limit=10\",\n \"count\": 1,\n \"object\": \"list\"\n },\n \"campaign\": \"Referral Webhooks\",\n \"category\": null,\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"metadata\": {},\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"created_at\": \"2021-11-12T11:09:57.772Z\",\n \"redemption\": {\n \"url\": \"/v1/vouchers/xYwEheRh/redemptions?page=1&limit=10\",\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"start_date\": null,\n \"updated_at\": null,\n \"campaign_id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"referrer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"loyalty_card\": null,\n \"distributions\": null,\n \"additional_info\": null,\n \"expiration_date\": null,\n \"is_referral_code\": true,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"referred_customers_count\": null,\n \"value\": \"$10.00\"\n },\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"object\": \"customer\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"source_id\": \"test_referrer__01\"\n },\n \"metadata\": {},\n \"source_id\": null,\n \"created_at\": \"2021-11-12T11:09:57.765Z\",\n \"customer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"tracking_id\": \"test_referrer__01\",\n \"vouchers_id\": [\n \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\"\n ]\n }\n },\n \"related_object\": {\n \"id\": \"evcus_0a26b1a5acd3437894\",\n \"type\": \"customer.publication.succeeded\",\n \"data\": {\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"test_referrer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"campaign\": {\n \"id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"name\": \"Referral Webhooks\",\n \"campaign_type\": \"REFERRAL_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"is_referral_code\": true,\n \"voucher\": {\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n }\n },\n \"referral_program\": {\n \"conversion_event_type\": \"redemption\"\n },\n \"auto_join\": null,\n \"join_once\": false,\n \"active\": true\n },\n \"publication\": {\n \"id\": \"pub_gSpZUNX0hcDfEeRx3qIMMFrtfsZjeJO8\",\n \"object\": \"publication\",\n \"result\": \"SUCCESS\",\n \"channel\": \"API\",\n \"voucher\": {\n \"id\": \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\",\n \"code\": \"xYwEheRh\",\n \"gift\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"active\": true,\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX19wsHlNj5GT/2Kkf/MnPKlL4WjU55GyTsmpXgw+KQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy/OHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va+MFPSHRy5tesDQ==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19wsHlNj5GT%2F2Kkf%2FMnPKlL4WjU55GyTsmpXgw%2BKQOwp3ux0XzUAgsTcujC49hkjk7ony8mPL429zzWHGy%2FOHpvDwuY0Z6AECrqzRea81MCjkqI0gKlVEhqYWoCm7Va%2BMFPSHRy5tesDQ%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19ZgrgURtgcjD1cvt/L6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i/UVUbmXTxDvNXsceP+nzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19ZgrgURtgcjD1cvt%2FL6wMNDySfG6AOT4NHpVJgceyuHAqJWYN3UgCn9jv8TIPtSfkNuHzI4i%2FUVUbmXTxDvNXsceP%2BnzHjmWp6fS3e7dR3SVEL3VHdSLZ1O7W9xPjRadOCGNZXPddd3w%3D%3D\"\n }\n },\n \"object\": \"voucher\",\n \"publish\": {\n \"url\": \"/v1/vouchers/xYwEheRh/publications?page=1&limit=10\",\n \"count\": 1,\n \"object\": \"list\"\n },\n \"campaign\": \"Referral Webhooks\",\n \"category\": null,\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"metadata\": {},\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"created_at\": \"2021-11-12T11:09:57.772Z\",\n \"redemption\": {\n \"url\": \"/v1/vouchers/xYwEheRh/redemptions?page=1&limit=10\",\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"start_date\": null,\n \"updated_at\": null,\n \"campaign_id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"referrer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"loyalty_card\": null,\n \"distributions\": null,\n \"additional_info\": null,\n \"expiration_date\": null,\n \"is_referral_code\": true,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"referred_customers_count\": null\n },\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"object\": \"customer\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"source_id\": \"test_referrer__01\"\n },\n \"metadata\": {},\n \"source_id\": null,\n \"created_at\": \"2021-11-12T11:09:57.765Z\",\n \"customer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"tracking_id\": \"test_referrer__01\",\n \"vouchers_id\": [\n \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\"\n ]\n }\n },\n \"created_at\": \"2021-11-12T11:09:57.765Z\"\n }\n },\n \"metadata\": {}\n}\n```\n\n```json\n{\n \"id\": \"evcus_0a26b3e7b718c480ca\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-01-24T11:19:49.723Z\",\n \"type\": \"referrer_rewarded_webhook\",\n \"data\": {\n \"object\": {\n \"voucher\": {\n \"id\": \"v_2teI9HcRvdvK1RsWD6gyNztHr4SMkMDy\",\n \"code\": \"dOzJ84Ky\",\n \"campaign\": \"Bonus Cards\",\n \"campaign_id\": \"camp_yheSCBQGrgeBwGMkQqjsUW24\",\n \"category\": null,\n \"type\": \"GIFT_VOUCHER\",\n \"discount\": null,\n \"gift\": {\n \"amount\": 500,\n \"balance\": 500\n },\n \"loyalty_card\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX1+tdyBGQeM+ZONM/k\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1+tdyBGQeM+ZONM/k\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1+WOEBHpX4y\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BWOEBHpX4y\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-01-24T11:19:40.409Z\",\n \"updated_at\": \"2021-01-24T11:19:41.518Z\",\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"redemption\": {\n \"quantity\": 1,\n \"redeemed_quantity\": 0,\n \"redeemed_amount\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/dOzJ84Ky/redemptions?page=1&limit=10\"\n },\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/dOzJ84Ky/publications?page=1&limit=10\"\n },\n \"object\": \"voucher\"\n },\n \"campaign\": {\n \"id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"name\": \"Referral Webhooks\",\n \"campaign_type\": \"REFERRAL_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"voucher\": {\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n },\n \"is_referral_code\": true\n },\n \"referral_program\": {\n \"conversion_event_type\": \"redemption\"\n },\n \"join_once\": false,\n \"vouchers_count\": 0,\n \"active\": true,\n \"object\": \"campaign\"\n },\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"source_id\": \"test_referrer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0\n },\n \"orders\": {\n \"total_amount\": 0,\n \"total_count\": 0,\n \"average_amount\": null,\n \"last_order_amount\": null\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 1,\n \"campaigns\": {\n \"Referral Webhooks\": {\n \"points\": 0,\n \"referred_customers\": 1\n }\n }\n },\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-01-24T11:09:57.749Z\",\n \"updated_at\": \"2021-01-24T11:19:41.513Z\",\n \"object\": \"customer\"\n },\n \"publication\": {\n \"id\": \"pub_9Y7nwUx3BaU3cHqBVbd0TEtS2ENiFZhJ\",\n \"created_at\": \"2021-01-24T11:19:40.317Z\",\n \"customer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"test_referrer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"tracking_id\": \"test_referrer__01\",\n \"metadata\": {},\n \"channel\": \"Automation\",\n \"source_id\": null,\n \"result\": \"SUCCESS\",\n \"voucher_code\": \"dOzJ84Ky\",\n \"vouchers\": [\n {\n \"id\": \"v_2teI9HcRvdvK1RsWD6gyNztHr4SMkMDy\",\n \"code\": \"dOzJ84Ky\",\n \"campaign\": \"Bonus Cards\",\n \"campaign_id\": \"camp_yheSCBQGrgeBwGMkQqjsUW24\",\n \"category\": null,\n \"type\": \"GIFT_VOUCHER\",\n \"discount\": null,\n \"gift\": {\n \"amount\": 500,\n \"balance\": 500\n },\n \"loyalty_card\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX1+tdyBGQeM+ZONM/kBdZ\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BtdyBGQeM%2BZONM%2FkBdZ\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1+WOEBHpX4y\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BWOEBHpX4y\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-01-24T11:19:40.409Z\",\n \"updated_at\": \"2021-01-24T11:19:41.518Z\",\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"object\": \"voucher\",\n \"distributions\": null,\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/dOzJ84Ky/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"quantity\": 1,\n \"redeemed_quantity\": 0,\n \"redeemed_amount\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/dOzJ84Ky/redemptions?page=1&limit=10\"\n }\n }\n ],\n \"vouchers_id\": [\n \"v_2teI9HcRvdvK1RsWD6gyNztHr4SMkMDy\"\n ],\n \"campaign_name\": \"Bonus Cards\",\n \"gift\": {\n \"amount\": 0,\n \"balance\": 0\n },\n \"loyalty_card\": null,\n \"discount\": null,\n \"is_referral_code\": false,\n \"failure_code\": null,\n \"failure_message\": null,\n \"voucher\": null\n }\n },\n \"related_object\": {\n \"id\": \"evcus_0a26b3e7b718c480ca\",\n \"type\": \"customer.reward_redemptions.completed\",\n \"data\": {\n \"customer\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"test_referrer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"holder\": {\n \"id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"test_referrer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"voucher\": {\n \"id\": \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\",\n \"code\": \"xYwEheRh\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"amount_off\": 1000,\n \"effect\": \"APPLY_TO_ORDER\"\n },\n \"type\": \"DISCOUNT_VOUCHER\",\n \"campaign\": \"Referral Webhooks\",\n \"campaign_id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"is_referral_code\": true,\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"referrer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\"\n },\n \"campaign\": {\n \"id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"name\": \"Referral Webhooks\",\n \"campaign_type\": \"REFERRAL_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"is_referral_code\": true,\n \"voucher\": {\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n }\n },\n \"referral_program\": {\n \"conversion_event_type\": \"redemption\"\n },\n \"auto_join\": null,\n \"join_once\": false,\n \"active\": true\n },\n \"reward_redemption\": {\n \"id\": \"rewr_Fuzc1rngCCuKRDfBXBjUwl5j\",\n \"state\": \"COMPLETED\",\n \"created_at\": \"2021-01-24T11:19:43.883Z\",\n \"updated_at\": null,\n \"voucher_id\": \"v_ZlNAlSHNgK57ErFgOxAz7swPBPfMBlMp\",\n \"campaign_id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"customer_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\",\n \"reward_assignment_id\": \"rewa_9FxFsy0M5UYc8jWjNrlSBWtG\",\n \"source_id\": \"event_0a26b3d269013fc79e\",\n \"source_type\": \"redemption_event\"\n },\n \"reward\": {\n \"assignment_id\": \"rewa_9FxFsy0M5UYc8jWjNrlSBWtG\",\n \"voucher\": {\n \"id\": \"v_2teI9HcRvdvK1RsWD6gyNztHr4SMkMDy\",\n \"code\": \"dOzJ84Ky\",\n \"gift\": {\n \"amount\": 500,\n \"balance\": 500\n },\n \"type\": \"GIFT_VOUCHER\",\n \"campaign\": \"Bonus Cards\",\n \"campaign_id\": \"camp_yheSCBQGrgeBwGMkQqjsUW24\",\n \"is_referral_code\": false,\n \"holder_id\": \"cust_laSm5Bbd6fzSgVtyKYfGot4L\"\n },\n \"id\": \"rew_e5taIjbo05k2vODIJtZ7mGED\",\n \"object\": \"reward\",\n \"name\": \"Credits - 5$\",\n \"type\": \"CAMPAIGN\"\n },\n \"reward_assignment\": {\n \"id\": \"rewa_9FxFsy0M5UYc8jWjNrlSBWtG\",\n \"reward_id\": \"rew_e5taIjbo05k2vODIJtZ7mGED\",\n \"related_object_id\": \"rrt_NWk1WYi1sZs3Epjvvd5a9JZx\",\n \"related_object_type\": \"referral_tier\",\n \"created_at\": \"2021-01-24T11:00:08.471Z\",\n \"updated_at\": null,\n \"object\": \"reward_assignment\"\n },\n \"source\": {\n \"id\": \"event_0a26b3d269013fc79e\",\n \"type\": \"redemption_event\"\n },\n \"balance\": {\n \"amount\": 500\n }\n },\n \"created_at\": \"2021-01-24T11:19:49.723Z\"\n }\n },\n \"metadata\": {}\n}\n```\n\n```json\n{\n \"id\": \"event_0a26b3d893cc3ac160\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-01-24T11:19:41.101Z\",\n \"type\": \"referee_invited\",\n \"data\": {\n \"object\": {\n \"order\": {},\n \"campaign\": {\n \"object\": \"campaign\",\n \"id\": \"camp_UaT2wwkN9zQs3RiIk7H0PcBc\",\n \"name\": \"Referral Webhooks\",\n \"campaign_type\": \"REFERRAL_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"description\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"activity_duration_after_publishing\": null,\n \"vouchers_count\": 0,\n \"updated_at\": \"2021-01-24T11:09:40.671Z\",\n \"created_at\": \"2021-01-24T11:00:08.306Z\",\n \"active\": true,\n \"metadata\": {},\n \"vouchers_generation_status\": \"DONE\",\n \"category\": null,\n \"voucher\": {\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"AMOUNT\",\n \"effect\": \"APPLY_TO_ORDER\",\n \"amount_off\": 1000\n },\n \"gift\": null,\n \"loyalty_card\": null,\n \"redemption\": {\n \"quantity\": null\n },\n \"code_config\": {\n \"length\": 8,\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\"\n }\n },\n \"referral_program\": {\n \"conversion_event_type\": \"redemption\"\n },\n \"lucky_draw\": null\n },\n \"customer\": {\n \"id\": \"cust_BfTxUsoofap6Sb6oxG1BLCi5\",\n \"source_id\": \"referred_001\",\n \"name\": null,\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0,\n \"gift\": {\n \"redeemed_amount\": 0,\n \"amount_to_go\": 0\n },\n \"loyalty_card\": {\n \"redeemed_points\": 0,\n \"points_to_go\": 0\n }\n },\n \"orders\": {\n \"total_amount\": 25000,\n \"total_count\": 1,\n \"average_amount\": 25000,\n \"last_order_amount\": 25000,\n \"last_order_date\": \"2021-01-24T11:19:28.598Z\"\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 0,\n \"campaigns\": {}\n },\n \"metadata\": {\n \"vip\": true\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-01-24T11:19:27.844Z\",\n \"updated_at\": \"2021-01-24T11:19:28.926Z\",\n \"email_unsubscribed\": false,\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"object\": \"customer\"\n }\n },\n \"related_object\": {\n \"id\": \"event_0a26b3d893cc3ac160\",\n \"type\": \"customer.referred\",\n \"created_at\": \"2021-01-24T11:19:34.223Z\",\n \"data_json\": {\n \"object\": {\n \"id\": \"cust_BfTxUsoofap6Sb6oxG1BLCi5\",\n \"source_id\": \"referred_001\",\n \"name\": null,\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0,\n \"gift\": {\n \"redeemed_amount\": 0,\n \"amount_to_go\": 0\n },\n \"loyalty_card\": {\n \"redeemed_points\": 0,\n \"points_to_go\": 0\n }\n },\n \"orders\": {\n \"total_amount\": 25000,\n \"total_count\": 1,\n \"average_amount\": 25000,\n \"last_order_amount\": 25000,\n \"last_order_date\": \"2021-01-24T11:19:28.598Z\"\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 0,\n \"campaigns\": {}\n },\n \"metadata\": {\n \"vip\": true\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-01-24T11:19:27.844Z\",\n \"updated_at\": \"2021-01-24T11:19:28.926Z\",\n \"email_unsubscribed\": false,\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"object\": \"customer\"\n },\n \"previous_attributes\": {},\n \"related_object\": {}\n },\n \"metadata_json\": {\n \"is_rewarded\": true,\n \"source\": null\n },\n \"automation_id\": null,\n \"group_id\": \"v-0a26b3d24b032c4871\"\n }\n },\n \"metadata\": {}\n}\n```\n\n### Loyalty Campaign \n\n\n```json\n{\n \"id\": \"evcus_0a26b89763051ed721\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-11-12T11:40:18.125Z\",\n \"type\": \"loyalty_code_assigned\",\n \"data\": {\n \"object\": {\n \"voucher\": {\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"code\": \"qjvEslzU\",\n \"campaign\": \"Loyalty Webhooks\",\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"category\": null,\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf/oALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf%2FoALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1/ICHe/XvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU+S0A4SpuuDsMXXotf/AOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FICHe%2FXvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU%2BS0A4SpuuDsMXXotf%2FAOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-11-12T11:40:18.138Z\",\n \"updated_at\": null,\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0,\n \"redeemed_points\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/qjvEslzU/redemptions?page=1&limit=10\"\n },\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/qjvEslzU/publications?page=1&limit=10\"\n },\n \"object\": \"voucher\"\n },\n \"campaign\": {\n \"id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"name\": \"Loyalty Webhooks\",\n \"campaign_type\": \"LOYALTY_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"voucher\": {\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"prefix\": \"\",\n \"postfix\": \"\"\n },\n \"is_referral_code\": false\n },\n \"auto_join\": false,\n \"join_once\": false,\n \"use_voucher_metadata_schema\": true,\n \"vouchers_count\": 0,\n \"active\": true,\n \"metadata\": {},\n \"created_at\": \"2021-11-12T11:39:05.254Z\",\n \"creation_status\": \"DONE\",\n \"vouchers_generation_status\": \"DONE\",\n \"object\": \"campaign\"\n },\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"source_id\": \"Loyal_customer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0\n },\n \"orders\": {\n \"total_amount\": 0,\n \"total_count\": 0,\n \"average_amount\": null,\n \"last_order_amount\": null\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 0,\n \"campaigns\": {}\n },\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-11-12T11:40:18.077Z\",\n \"updated_at\": \"2021-11-12T11:40:19.724Z\",\n \"object\": \"customer\"\n },\n \"publication\": {\n \"id\": \"pub_ZAS0kZMqzF8LG5y55nx6dHMx2GkVPmxP\",\n \"object\": \"publication\",\n \"result\": \"SUCCESS\",\n \"channel\": \"API\",\n \"voucher\": {\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"code\": \"qjvEslzU\",\n \"gift\": null,\n \"type\": \"LOYALTY_CARD\",\n \"active\": true,\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf/oALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf%2FoALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1/ICHe/XvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU+S0A4SpuuDsMXXotf/AOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FICHe%2FXvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU%2BS0A4SpuuDsMXXotf%2FAOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA%3D%3D\"\n }\n },\n \"object\": \"voucher\",\n \"publish\": {\n \"url\": \"/v1/vouchers/qjvEslzU/publications?page=1&limit=10\",\n \"count\": 1,\n \"object\": \"list\"\n },\n \"campaign\": \"Loyalty Webhooks\",\n \"category\": null,\n \"discount\": null,\n \"metadata\": {},\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"created_at\": \"2021-11-12T11:40:18.138Z\",\n \"redemption\": {\n \"url\": \"/v1/vouchers/qjvEslzU/redemptions?page=1&limit=10\",\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_points\": 0,\n \"redeemed_quantity\": 0\n },\n \"start_date\": null,\n \"updated_at\": null,\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"distributions\": null,\n \"additional_info\": null,\n \"expiration_date\": null,\n \"is_referral_code\": false,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"value\": 0\n },\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"object\": \"customer\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"source_id\": \"Loyal_customer__01\"\n },\n \"metadata\": {},\n \"source_id\": null,\n \"created_at\": \"2021-11-12T11:40:18.125Z\",\n \"customer_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"tracking_id\": \"Loyal_customer__01\",\n \"vouchers_id\": [\n \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\"\n ]\n }\n },\n \"related_object\": {\n \"id\": \"evcus_0a26b89763051ed721\",\n \"type\": \"customer.publication.succeeded\",\n \"data\": {\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"Loyal_customer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"campaign\": {\n \"id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"name\": \"Loyalty Webhooks\",\n \"campaign_type\": \"LOYALTY_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"is_referral_code\": false,\n \"voucher\": {\n \"type\": \"LOYALTY_CARD\",\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n }\n },\n \"auto_join\": false,\n \"join_once\": false,\n \"active\": true\n },\n \"publication\": {\n \"id\": \"pub_ZAS0kZMqzF8LG5y55nx6dHMx2GkVPmxP\",\n \"object\": \"publication\",\n \"result\": \"SUCCESS\",\n \"channel\": \"API\",\n \"voucher\": {\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"code\": \"qjvEslzU\",\n \"gift\": null,\n \"type\": \"LOYALTY_CARD\",\n \"active\": true,\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf/oALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf%2FoALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1/ICHe/XvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU+S0A4SpuuDsMXXotf/AOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FICHe%2FXvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU%2BS0A4SpuuDsMXXotf%2FAOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA%3D%3D\"\n }\n },\n \"object\": \"voucher\",\n \"publish\": {\n \"url\": \"/v1/vouchers/qjvEslzU/publications?page=1&limit=10\",\n \"count\": 1,\n \"object\": \"list\"\n },\n \"campaign\": \"Loyalty Webhooks\",\n \"category\": null,\n \"discount\": null,\n \"metadata\": {},\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"created_at\": \"2021-11-12T11:40:18.138Z\",\n \"redemption\": {\n \"url\": \"/v1/vouchers/qjvEslzU/redemptions?page=1&limit=10\",\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_points\": 0,\n \"redeemed_quantity\": 0\n },\n \"start_date\": null,\n \"updated_at\": null,\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"distributions\": null,\n \"additional_info\": null,\n \"expiration_date\": null,\n \"is_referral_code\": false,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null\n },\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"object\": \"customer\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"source_id\": \"Loyal_customer__01\"\n },\n \"metadata\": {},\n \"source_id\": null,\n \"created_at\": \"2021-11-12T11:40:18.125Z\",\n \"customer_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"tracking_id\": \"Loyal_customer__01\",\n \"vouchers_id\": [\n \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\"\n ]\n }\n },\n \"created_at\": \"2021-11-12T11:40:18.125Z\"\n }\n },\n \"metadata\": {}\n}\n```\n\n```json\n{\n \"id\": \"event_0a26b9290fc4891587\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-11-12T11:42:51.380Z\",\n \"type\": \"points_earned\",\n \"data\": {\n \"object\": {\n \"order\": {},\n \"voucher\": {\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"code\": \"qjvEslzU\",\n \"campaign\": \"Loyalty Webhooks\",\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"category\": null,\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 220,\n \"balance\": 220\n },\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf/oALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186jVQjLtmZYQOPrfFKy9deofCfaFP8VhVe0TTOFxTfEp2zjF3mnS3cvUuB3MkpJDNAvMKNJotHJMUla555NQ8ZBFXSW2fAXBiP997Zf%2FoALLiIGjqo5LTFtedHUTNq5IQ9XgvwgPJBLg%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX1/ICHe/XvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU+S0A4SpuuDsMXXotf/AOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FICHe%2FXvFeZfl2koGimwFH3D4ha4nTSbCzoIdbmxzXYKESU%2BS0A4SpuuDsMXXotf%2FAOO1kdii3o99cHExXipCGBlHaduIu64ogx4oyA9w4P3nmkZ2Nv6aLukBaVd969i5Gylp0GW71sA%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-11-12T11:40:18.138Z\",\n \"updated_at\": \"2021-11-12T11:42:50.332Z\",\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"object\": \"voucher\",\n \"distributions\": {\n \"distr_naR4rx0AgM1baWZkFm1kfHn7A9\": {\n \"date\": \"2021-11-12T11:40:21.957Z\"\n },\n \"distr_pnfPKLDAxUpiPi3ZsuMrygtYNN\": {\n \"date\": \"2021-11-12T11:42:50.332Z\"\n }\n },\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/qjvEslzU/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0,\n \"redeemed_points\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/qjvEslzU/redemptions?page=1&limit=10\"\n }\n },\n \"campaign\": {\n \"object\": \"campaign\",\n \"id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"name\": \"Loyalty Webhooks\",\n \"campaign_type\": \"LOYALTY_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"description\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"activity_duration_after_publishing\": null,\n \"vouchers_count\": 0,\n \"updated_at\": null,\n \"created_at\": \"2021-11-12T11:39:05.254Z\",\n \"active\": true,\n \"metadata\": {},\n \"vouchers_generation_status\": \"DONE\",\n \"category\": null,\n \"voucher\": {\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"redemption\": {\n \"quantity\": null\n },\n \"code_config\": {\n \"length\": 8,\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\"\n }\n },\n \"referral_program\": null,\n \"lucky_draw\": null\n },\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"source_id\": \"Loyal_customer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0,\n \"gift\": {\n \"redeemed_amount\": 0,\n \"amount_to_go\": 0\n },\n \"loyalty_card\": {\n \"redeemed_points\": 0,\n \"points_to_go\": 220\n }\n },\n \"orders\": {\n \"total_amount\": 22000,\n \"total_count\": 1,\n \"average_amount\": 22000,\n \"last_order_amount\": 22000,\n \"last_order_date\": \"2021-11-12T11:42:39.633Z\"\n }\n },\n \"loyalty\": {\n \"points\": 220,\n \"referred_customers\": 0,\n \"campaigns\": {\n \"Loyalty Webhooks\": {\n \"points\": 220,\n \"referred_customers\": 0\n }\n }\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-11-12T11:40:18.077Z\",\n \"updated_at\": \"2021-11-12T11:42:47.393Z\",\n \"email_unsubscribed\": false,\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"object\": \"customer\"\n }\n },\n \"related_object\": {\n \"id\": \"event_0a26b9290fc4891587\",\n \"type\": \"customer.rewarded.loyalty_points\",\n \"created_at\": \"2021-11-12T11:42:47.359Z\",\n \"data_json\": {\n \"object\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"source_id\": \"Loyal_customer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 0,\n \"total_failed\": 0,\n \"total_succeeded\": 0,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0,\n \"gift\": {\n \"redeemed_amount\": 0,\n \"amount_to_go\": 0\n },\n \"loyalty_card\": {\n \"redeemed_points\": 0,\n \"points_to_go\": 0\n }\n },\n \"orders\": {\n \"total_amount\": 22000,\n \"total_count\": 1,\n \"average_amount\": 22000,\n \"last_order_amount\": 22000,\n \"last_order_date\": \"2021-11-12T11:42:39.633Z\"\n }\n },\n \"loyalty\": {\n \"points\": 0,\n \"referred_customers\": 0,\n \"campaigns\": {\n \"Loyalty Webhooks\": {\n \"points\": 0,\n \"referred_customers\": 0\n }\n }\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-11-12T11:40:18.077Z\",\n \"updated_at\": \"2021-11-12T11:42:40.635Z\",\n \"email_unsubscribed\": false,\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"object\": \"customer\"\n },\n \"previous_attributes\": {},\n \"related_object\": {\n \"points\": 220,\n \"total\": 220,\n \"balance\": 220,\n \"type\": \"loyalty_card\",\n \"object\": \"balance\",\n \"related_object\": {\n \"type\": \"voucher\",\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\"\n }\n },\n \"balance\": {\n \"points\": 220,\n \"total\": 220,\n \"balance\": 220,\n \"type\": \"loyalty_card\",\n \"object\": \"balance\",\n \"related_object\": {\n \"type\": \"voucher\",\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\"\n }\n }\n },\n \"metadata_json\": {\n \"source\": \"Automation\"\n },\n \"automation_id\": \"auto_McXM3rjWcPwaNU5ndIIP13jX\",\n \"group_id\": \"v-0a26b921779d7eebcb\"\n }\n },\n \"metadata\": {}\n}\n```\n\n```json \n{\n \"id\": \"evcus_0a26bb89060c3ad8bc\",\n \"object\": \"event\",\n \"webhook_id\": null,\n \"project_id\": \"proj_nXIkFGNmrFSf\",\n \"created_at\": \"2021-11-12T11:53:09.910Z\",\n \"type\": \"points_redeemed\",\n \"data\": {\n \"object\": {\n \"voucher\": {\n \"id\": \"v_ix6p7zxM8m7AdlgObubjP2ibDTCsnEkq\",\n \"code\": \"xUgBLQck\",\n \"campaign\": \"20% discount\",\n \"campaign_id\": \"camp_o9vZ7yIqtj5B9CbhJlKRXIZ5\",\n \"category\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"PERCENT\",\n \"amount_limit\": 5000,\n \"percent_off\": 20\n },\n \"gift\": null,\n \"loyalty_card\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX19pNCYXQ8ztNEb+OaYwP13ZoOfOMBJwzgz2RNchFxoMDPIHS47i8tY+oc3HzEpFr2SqITQ/IdD6V7RuYxsyrcfz53Je6+me6VBl9Pze3p8lTSJWwjp79tKEZHygNMggPsfIEi4Ei3Wt1A==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19pNCYXQ8ztNEb%2BOaYwP13ZoOfOMBJwzgz2RNchFxoMDPIHS47i8tY%2Boc3HzEpFr2SqITQ%2FIdD6V7RuYxsyrcfz53Je6%2Bme6VBl9Pze3p8lTSJWwjp79tKEZHygNMggPsfIEi4Ei3Wt1A%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19a0CQqRE3y6dRDn0Jyr74H85dLNo9MQrXRZFBj9fcDUlaV3Q0uG2xa4l4Ch4WVfPGQ3iEEPpYTMQGwm8xN9cynpCv/upu9ZD9iWat6+nlw+PsKH5CcyNemhfI273GhBOvh5ysRMpFUZQ==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19a0CQqRE3y6dRDn0Jyr74H85dLNo9MQrXRZFBj9fcDUlaV3Q0uG2xa4l4Ch4WVfPGQ3iEEPpYTMQGwm8xN9cynpCv%2Fupu9ZD9iWat6%2Bnlw%2BPsKH5CcyNemhfI273GhBOvh5ysRMpFUZQ%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-11-12T11:53:03.194Z\",\n \"updated_at\": null,\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"redemption\": {\n \"quantity\": 1,\n \"redeemed_quantity\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/xUgBLQck/redemptions?page=1&limit=10\"\n },\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/xUgBLQck/publications?page=1&limit=10\"\n },\n \"object\": \"voucher\"\n },\n \"campaign\": {\n \"id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"name\": \"Loyalty Webhooks\",\n \"campaign_type\": \"LOYALTY_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"voucher\": {\n \"type\": \"LOYALTY_CARD\",\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n },\n \"is_referral_code\": false\n },\n \"auto_join\": false,\n \"join_once\": false,\n \"vouchers_count\": 0,\n \"active\": true,\n \"object\": \"campaign\"\n },\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"source_id\": \"Loyal_customer__01\",\n \"name\": \"John Doe\",\n \"description\": null,\n \"email\": null,\n \"phone\": null,\n \"birthday\": null,\n \"birthdate\": null,\n \"address\": null,\n \"summary\": {\n \"redemptions\": {\n \"total_redeemed\": 1,\n \"total_failed\": 0,\n \"total_succeeded\": 1,\n \"total_rolled_back\": 0,\n \"total_rollback_failed\": 0,\n \"total_rollback_succeeded\": 0\n },\n \"orders\": {\n \"total_amount\": 22000,\n \"total_count\": 1,\n \"average_amount\": 22000,\n \"last_order_amount\": 22000,\n \"last_order_date\": \"2021-11-12T11:42:39.633Z\"\n }\n },\n \"loyalty\": {\n \"points\": 218,\n \"referred_customers\": 0,\n \"campaigns\": {\n \"Loyalty Webhooks\": {\n \"points\": 218,\n \"referred_customers\": 0\n }\n }\n },\n \"referrals\": {\n \"total\": 0,\n \"campaigns\": []\n },\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"system_metadata\": {},\n \"created_at\": \"2021-11-12T11:40:18.077Z\",\n \"updated_at\": \"2021-11-12T11:53:07.582Z\",\n \"object\": \"customer\"\n },\n \"publication\": {\n \"id\": \"pub_aFszQ4kOtT1Hori8Wl1i0az1sFQN3CRv\",\n \"created_at\": \"2021-11-12T11:53:03.172Z\",\n \"customer_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"Loyal_customer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"tracking_id\": \"Loyal_customer__01\",\n \"metadata\": {},\n \"channel\": \"API\",\n \"source_id\": null,\n \"result\": \"SUCCESS\",\n \"voucher_code\": \"xUgBLQck\",\n \"vouchers\": [\n {\n \"id\": \"v_ix6p7zxM8m7AdlgObubjP2ibDTCsnEkq\",\n \"code\": \"xUgBLQck\",\n \"campaign\": \"20% discount\",\n \"campaign_id\": \"camp_o9vZ7yIqtj5B9CbhJlKRXIZ5\",\n \"category\": null,\n \"type\": \"DISCOUNT_VOUCHER\",\n \"discount\": {\n \"type\": \"PERCENT\",\n \"percent_off\": 20,\n \"amount_limit\": 5000\n },\n \"gift\": null,\n \"loyalty_card\": null,\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX19pNCYXQ8ztNEb+OaYwP13ZoOfOMBJwzgz2RNchFxoMDPIHS47i8tY+oc3HzEpFr2SqITQ/IdD6V7RuYxsyrcfz53Je6+me6VBl9Pze3p8lTSJWwjp79tKEZHygNMggPsfIEi4Ei3Wt1A==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19pNCYXQ8ztNEb%2BOaYwP13ZoOfOMBJwzgz2RNchFxoMDPIHS47i8tY%2Boc3HzEpFr2SqITQ%2FIdD6V7RuYxsyrcfz53Je6%2Bme6VBl9Pze3p8lTSJWwjp79tKEZHygNMggPsfIEi4Ei3Wt1A%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19a0CQqRE3y6dRDn0Jyr74H85dLNo9MQrXRZFBj9fcDUlaV3Q0uG2xa4l4Ch4WVfPGQ3iEEPpYTMQGwm8xN9cynpCv/upu9ZD9iWat6+nlw+PsKH5CcyNemhfI273GhBOvh5ysRMpFUZQ==\",\n \"url\": \"https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19a0CQqRE3y6dRDn0Jyr74H85dLNo9MQrXRZFBj9fcDUlaV3Q0uG2xa4l4Ch4WVfPGQ3iEEPpYTMQGwm8xN9cynpCv%2Fupu9ZD9iWat6%2Bnlw%2BPsKH5CcyNemhfI273GhBOvh5ysRMpFUZQ%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"created_at\": \"2021-11-12T11:53:03.194Z\",\n \"updated_at\": null,\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"object\": \"voucher\",\n \"distributions\": null,\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/xUgBLQck/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"quantity\": 1,\n \"redeemed_quantity\": 0,\n \"object\": \"list\",\n \"url\": \"/v1/vouchers/xUgBLQck/redemptions?page=1&limit=10\"\n }\n }\n ],\n \"vouchers_id\": [\n \"v_ix6p7zxM8m7AdlgObubjP2ibDTCsnEkq\"\n ],\n \"campaign_name\": \"20% discount\",\n \"gift\": null,\n \"loyalty_card\": null,\n \"discount\": {\n \"type\": \"PERCENT\",\n \"percent_off\": 20,\n \"amount_limit\": 5000\n },\n \"is_referral_code\": false,\n \"failure_code\": null,\n \"failure_message\": null,\n \"voucher\": null\n }\n },\n \"related_object\": {\n \"id\": \"evcus_0a26bb89060c3ad8bc\",\n \"type\": \"customer.reward_redemptions.completed\",\n \"data\": {\n \"customer\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"Loyal_customer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"holder\": {\n \"id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"name\": \"John Doe\",\n \"email\": null,\n \"source_id\": \"Loyal_customer__01\",\n \"metadata\": {\n \"test\": true,\n \"acq_channel\": \"Twitter\"\n },\n \"object\": \"customer\"\n },\n \"voucher\": {\n \"id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"code\": \"qjvEslzU\",\n \"loyalty_card\": {\n \"points\": 220,\n \"balance\": 218\n },\n \"type\": \"LOYALTY_CARD\",\n \"campaign\": \"Loyalty Webhooks\",\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"is_referral_code\": false,\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\"\n },\n \"campaign\": {\n \"id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"name\": \"Loyalty Webhooks\",\n \"campaign_type\": \"LOYALTY_PROGRAM\",\n \"type\": \"AUTO_UPDATE\",\n \"is_referral_code\": false,\n \"voucher\": {\n \"type\": \"LOYALTY_CARD\",\n \"loyalty_card\": {\n \"points\": 0,\n \"balance\": 0\n },\n \"redemption\": {\n \"quantity\": null,\n \"redeemed_quantity\": 0\n },\n \"code_config\": {\n \"length\": 8,\n \"prefix\": \"\",\n \"charset\": \"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\",\n \"pattern\": \"########\",\n \"postfix\": \"\"\n }\n },\n \"auto_join\": false,\n \"join_once\": false,\n \"active\": true\n },\n \"reward_redemption\": {\n \"id\": \"rewr_uATcoUjIp3VJNgT5TZT5NMaT\",\n \"state\": \"COMPLETED\",\n \"created_at\": \"2021-11-12T11:53:06.025Z\",\n \"updated_at\": null,\n \"voucher_id\": \"v_CGrEQ778F6kLkgktg9xCyzvoMjzTcwbU\",\n \"campaign_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"customer_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\",\n \"reward_assignment_id\": \"rewa_bRTNrtAqXmdHNDe4cNg7y3JC\",\n \"source_id\": \"r_Lbxqqjv59hCRLG3Nkl8E4yYk\",\n \"source_type\": \"redemption\"\n },\n \"reward\": {\n \"assignment_id\": \"rewa_bRTNrtAqXmdHNDe4cNg7y3JC\",\n \"voucher\": {\n \"id\": \"v_ix6p7zxM8m7AdlgObubjP2ibDTCsnEkq\",\n \"code\": \"xUgBLQck\",\n \"discount\": {\n \"type\": \"PERCENT\",\n \"amount_limit\": 5000,\n \"percent_off\": 20\n },\n \"type\": \"DISCOUNT_VOUCHER\",\n \"campaign\": \"20% discount\",\n \"campaign_id\": \"camp_o9vZ7yIqtj5B9CbhJlKRXIZ5\",\n \"is_referral_code\": false,\n \"holder_id\": \"cust_vfkFOr6pMg3MZAHcd7J8Hch7\"\n },\n \"id\": \"rew_l7z9yeLGZHJgCsxwNX5tDXqs\",\n \"object\": \"reward\",\n \"name\": \"20% discount\",\n \"type\": \"CAMPAIGN\"\n },\n \"reward_assignment\": {\n \"id\": \"rewa_bRTNrtAqXmdHNDe4cNg7y3JC\",\n \"reward_id\": \"rew_l7z9yeLGZHJgCsxwNX5tDXqs\",\n \"related_object_id\": \"camp_iQgR6PmpF3D5H22OcNcRUU0f\",\n \"related_object_type\": \"campaign\",\n \"parameters\": {\n \"loyalty\": {\n \"points\": 2\n }\n },\n \"created_at\": \"2021-11-12T11:39:05.504Z\",\n \"updated_at\": null,\n \"object\": \"reward_assignment\"\n },\n \"source\": {\n \"id\": \"r_Lbxqqjv59hCRLG3Nkl8E4yYk\",\n \"type\": \"redemption\"\n },\n \"balance\": null\n },\n \"created_at\": \"2021-11-12T11:53:09.910Z\"\n }\n },\n \"metadata\": {}\n}\n```", + "x-tags": [ + "EVENTS API" + ] + }, + "15_req_track_custom_event": { + "title": "Track Custom Event Request Body", + "type": "object", + "description": "Request schema for tracking a custom event.", + "properties": { + "event": { + "type": "string", + "description": "Event name. This is the same name that you used to define a custom event in the **Dashboard** > **Project Settings** > **Event Schema**." + }, + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_id" + }, + { + "$ref": "#/components/schemas/6_req_validate_voucher_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" + } + ], + "type": "object" + }, + "referral": { + "type": "object", + "description": "If a **conversion event** for a referral program is set to a custom event, then you need to send the referral code in the payload to make a record of the conversion event. ", + "properties": { + "code": { + "type": "string", + "description": "A code through which a new visitor has been referred to a service." + }, + "referrer_id": { + "type": "string", + "description": "Unique ID of the referring person - it is optional and not required if the referral **code** is provided.", + "example": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" + } + } + }, + "loyalty": { + "type": "object", + "description": "If an earning rule in a loyalty program is based on a custom event. This objects let's you specify the loyalty card to which the custom event should be attributed to.", + "properties": { + "code": { + "type": "string", + "description": "Code of the loyalty card to receive points based on the calculation method defined in the related earning rule. An earning rule is triggered for the loyalty card when the event passed in the `event` parameter of the request payload gets sent along with this loyalty card code." + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the event. A set of key/value pairs that you can attach to an event object. It can be useful for storing additional information about the event in a structured format. Event metadata schema is defined in the **Dashboard** > **Project Settings** > **Event Schema** > **Edit particular event** > **Metadata property definition**." + } + } + }, + "15_res_track_custom_event": { + "title": "Track Custom Event Request Body", + "type": "object", + "description": "Request schema for tracking a custom event.", + "properties": { + "object": { + "type": "string", + "default": "event", + "description": "The object represented is an `event`." + }, + "type": { + "type": "string", + "description": "The event name." + }, + "customer": { + "type": "object", + "description": "An empty customer object." + }, + "referral": { + "type": "null", + "description": "A `null` referral object." + }, + "loyalty": { + "type": "null", + "description": "A `null` loyalty object." + } + } + }, + "16_obj_export_object": { + "title": "Export Object", + "type": "object", + "description": "This is an object representing an export. \n\nThe `/exports` endpoint allows you to retrieve Voucherify objects such as [vouchers](ref:get-voucher), [redemptions](ref:list-redemptions), [publications](ref:list-publications), [customers](ref:get-customer), and [orders](ref:get-order) as a CSV file. This functionality works asynchronously and comes down to the following steps: \n* create an export object and return its `id` so you can track its `status`\n* trigger a CSV file generation, change the status to `SCHEDULED`\n* when the generation is over, store the file in S3 and change the `status` to `DONE`\n* now you can [get](ref:download-export) it\n\nWith `parameters` you can select which `fields` will be exported and `filter` out the relevant data\n\n\n```json\n{\n \"fields\": [\n \"code\",\n \"voucher_type\"\n ],\n \"filters\": {\n \"categories\": {\n \"conditions\": {\n \"$in\": [\n \"postman\"\n ]\n }\n }\n }\n}\n```\n\n\n## Fields values\nHere is a list of the fields you can export for particular objects. \n| **Object** | **Fields** |\n|:---|:---|\n| voucher | code
                  voucher_type
                  value
                  discount_type
                  campaign
                  category
                  start_date
                  expiration_date
                  gift_balance
                  loyalty_balance
                  redemption_quantity
                  redemption_count
                  active
                  qr_code
                  bar_code
                  id
                  is_referral_code
                  created_at
                  updated_at
                  validity_timeframe_interval
                  validity_timeframe_duration
                  validity_day_of_week
                  discount_amount_limit
                  campaign_id
                  additional_info
                  customer_id
                  discount_unit_type
                  discount_unit_effect
                  customer_source_id
                  metadata
                  metadata.X *where X is the name of a particular metadata property* |\n| redemption | object
                  date
                  voucher_code
                  campaign
                  promotion_tier_id
                  customer_id
                  customer_source_id
                  customer_name
                  tracking_id
                  order_amount
                  gift_amount
                  loyalty_points
                  result
                  failure_code
                  failure_message
                  metadata
                  metadata.X *where X is the name of a particular metadata property* |\n| publication | voucher_code
                  customer_id
                  customer_source_id
                  date
                  channel
                  campaign
                  is_winner
                  metadata
                  metadata.X *where X is the name of a particular metadata property* |\n| customer | name
                  id
                  description
                  email
                  source_id
                  created_at
                  address_city
                  address_state
                  address_line_1
                  address_line_2
                  address_country
                  address_postal_code
                  redemptions_total_redeemed
                  redemptions_total_failed
                  redemptions_total_succeeded
                  redemptions_total_rolled_back
                  redemptions_total_rollback_failed
                  redemptions_total_rollback_succeeded
                  orders_total_amount
                  orders_total_count
                  orders_average_amount
                  orders_last_order_amount
                  orders_last_order_date
                  loyalty_points
                  loyalty_referred_customers
                  updated_at
                  phone
                  birthdate
                  birthday
                  metadata
                  metadata.X *where X is the name of a particular metadata property* |\n| order | id
                  source_id
                  status
                  created_at
                  updated_at
                  amount
                  discount_amount
                  items_discount_amount
                  total_discount_amount
                  total_amount
                  customer_id
                  referrer_id
                  metadata
                  metadata.X *where X is the name of a particular metadata property* |\n| points expiration | id
                  campaign_id
                  voucher_id
                  expires_at
                  status
                  points |\n\n\n## Pagination and example request\nVoucherify allows you to specify the timeframe for the records you want to retrieve. Thanks to this mechanism it should be easy to implement a pagination mechanism. See the example of request body: \n\n\n```json Export Redemption Example\n{\n \"exported_object\": \"redemption\",\n \"parameters\": {\n \"order\": \"-created_at\",\n \"fields\": [\n \"id\",\n \"object\",\n \"date\",\n \"voucher_code\",\n \"customer_id\",\n \"result\"\n ],\n \"filters\": {\n \"junction\": \"and\",\n \"created_at\": {\n \"conditions\": {\n \"$after\": [\n \"2018-05-30T22:00:00.000Z\"\n ],\n \"$before\": [\n \"2018-06-29T22:00:00.000Z\"\n ]\n }\n }\n }\n }\n}\n```\n\nAn export request will almost always result in a single file being generated by the system. However, when your volume of data is large, the system may split the results into multiple chunks.", + "x-tags": [ + "EXPORTS API" + ], + "properties": { + "id": { + "type": "string", + "description": "Unique export ID.", + "example": "exp_FFfp9o7daWuJqJCKp5xqqli4" + }, + "object": { + "type": "string", + "default": "export", + "description": "The type of object being represented. This object stores information about the `export`." + }, + "created_at": { + "type": "string", + "example": "2022-04-28T11:23:20.922Z", + "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format.", + "format": "date-time" + }, + "status": { + "type": "string", + "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.", + "enum": [ + "SCHEDULED", + "IN_PROGRESS", + "DONE", + "ERROR" + ] + }, + "channel": { + "type": "string", + "description": "The channel through which the export was triggered.", + "enum": [ + "API", + "WEBSITE" + ] + }, + "exported_object": { + "type": "string", + "description": "The type of exported object.", + "enum": [ + "order", + "voucher", + "publication", + "redemption", + "customer", + "points_expiration", + "voucher_transactions" + ] + }, + "parameters": { + "anyOf": [ + { + "$ref": "#/components/schemas/16_obj_export_order" + }, + { + "$ref": "#/components/schemas/16_obj_export_voucher" + }, + { + "$ref": "#/components/schemas/16_obj_export_publication" + }, + { + "$ref": "#/components/schemas/16_obj_export_redemption" + }, + { + "$ref": "#/components/schemas/16_obj_export_customer" + }, + { + "$ref": "#/components/schemas/16_obj_export_points_expiration" + }, + { + "$ref": "#/components/schemas/16_obj_export_gift_card_transactions" + }, + { + "$ref": "#/components/schemas/16_obj_export_loyalty_card_transactions" + } + ] + }, + "result": { + "type": "object", + "description": "Contains the URL of the CSV file.", + "properties": { + "url": { + "type": "string", + "description": "URL of the CSV file location. It contains the `token` used for authorization in the [Download export](ref:download-export) method." + } + } + }, + "user_id": { + "type": "string", + "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the `channel` value is `WEBSITE`.", + "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH" + } + } + }, + "16_res_list_exports": { + "description": "Response schema for listing exports.", + "type": "object", + "title": "List Exports Response Body", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about exports.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of exports.", + "default": "exports" + }, + "exports": { + "type": "array", + "uniqueItems": true, + "description": "An array of export objects.", + "items": { + "$ref": "#/components/schemas/16_obj_export_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of exports." + } + } + }, + "16_req_create_export_POST": { + "description": "Request schema for creating an export.", + "type": "object", + "title": "Create Export Request Body", + "properties": { + "exported_object": { + "type": "string", + "description": "The type of object to be exported.", + "enum": [ + "order", + "voucher", + "publication", + "redemption", + "customer", + "points_expiration", + "voucher_transactions" + ] + }, + "parameters": { + "anyOf": [ + { + "$ref": "#/components/schemas/16_obj_export_order" + }, + { + "$ref": "#/components/schemas/16_obj_export_voucher" + }, + { + "$ref": "#/components/schemas/16_obj_export_publication" + }, + { + "$ref": "#/components/schemas/16_obj_export_redemption" + }, + { + "$ref": "#/components/schemas/16_obj_export_customer" + }, + { + "$ref": "#/components/schemas/16_obj_export_points_expiration" + }, + { + "$ref": "#/components/schemas/16_obj_export_gift_card_transactions" + }, + { + "$ref": "#/components/schemas/16_obj_export_loyalty_card_transactions" + } + ] + } + } + }, + "16_obj_export_order": { + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data.", + "title": "order", + "type": "object", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "-created_at", + "created_at", + "updated_at", + "-updated_at", + "status", + "-status" + ] + }, + "fields": { + "type": "array", + "enum": [ + [ + "id", + "source_id", + "created_at", + "updated_at", + "status", + "amount", + "discount_amount", + "items_discount_amount", + "total_discount_amount", + "total_amount", + "customer_id", + "referrer_id", + "metadata" + ] + ], + "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique order ID. | ord_A69RIxEdRsPuC6i8gFGVHUft |\n| source_id | Unique order source ID. | 8638 |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the order was created. | 2022-03-09T09:16:32.521Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the order was last updated. | 2022-03-09T09:16:33.331Z |\n| status | Order status. | `PAID`, `CREATED`, `FULFILLED`, `CANCELED` |\n| amount | Total amount of order items. | 7700 |\n| discount_amount | Represents total amount of the discount applied to whole cart. | 500 |\n| items_discount_amount | Represents total amount of the discount applied to order line items. | 100 |\n| total_discount_amount | All discounts applied to the order including discounts applied to particular order line items and discounts applied to the whole cart. | 600 |\n| total_amount | Total order amount after applying all discounts. | 7100 |\n| customer_id | Customer unique ID. | cust_2G4fUQdCXUqp35nXNleav7bO |\n| referrer_id | Referrer unique ID. | cust_IkrTR674vvQvr9a4rDMiqglY |\n| metadata | Returns all order metadata. | Response will include all order metadata. |\n| metadata.X | Where X is the name of a particular order metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Order. [Read more here](https://support.voucherify.io/article/99-schema-validation-metadata). |", + "items": { + "type": "string" + } + }, + "filters": { + "anyOf": [ + { + "$ref": "#/components/schemas/16_obj_filter_order_status" + }, + { + "$ref": "#/components/schemas/16_obj_filter_order_source_id" + }, + { + "$ref": "#/components/schemas/16_obj_filter_order_amount" + }, + { + "$ref": "#/components/schemas/16_obj_filter_order_total_amount" + }, + { + "$ref": "#/components/schemas/16_obj_filter_order_discount_amount" + }, + { + "$ref": "#/components/schemas/16_obj_filter_order_total_discount_amount" + }, + { + "$ref": "#/components/schemas/16_obj_filter_order_items_discount_amount" + } + ] + } + } + }, + "16_obj_export_voucher": { + "description": "List of available fields and filters that can be exported with a voucher along with the sorting order of the returned data.", + "title": "voucher", + "type": "object", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at", + "code", + "-code" + ] + }, + "fields": { + "type": "array", + "enum": [ + [ + "code", + "voucher_type", + "value", + "discount_type", + "campaign", + "category", + "start_date", + "expiration_date", + "gift_balance", + "loyalty_balance", + "redemption_quantity", + "redemption_count", + "active", + "qr_code", + "bar_code", + "id", + "is_referral_code", + "created_at", + "updated_at", + "validity_timeframe_interval", + "validity_timeframe_duration", + "validity_day_of_week", + "discount_amount_limit", + "campaign_id", + "additional_info", + "customer_id", + "discount_unit_type", + "discount_unit_effect", + "customer_source_id", + "metadata" + ] + ], + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique voucher ID. | v_HSnGD2vNIHYighTQxwcB4dtVAv8VOmZD |\n| code | Unique voucher code. | WELCOME100 |\n| voucher_type | Type of voucher. | `DISCOUNT_VOUCHER`, `GIFT_VOUCHER`, `LOYALTY_CARD` |\n| value | Value of voucher. | `DISCOUNT_VOUCHER` : amount, percent, unit
                  `GIFT_VOUCHER`: amount left to spend
                  `LOYALTY_CARD`: available usable points |\n| discount_type | The type of discount for a `DISCOUNT_VOUCHER`. | `AMOUNT`, `PERCENT`, `UNIT`, `FIXED` |\n| campaign | Unique campaign name. | Summer Discounts 20% off |\n| category | Tag defining the category that this voucher belongs to. | |\n| start_date | Start date defines when the code starts to be active. Activation timestamp in ISO 8601 format. Voucher is _inactive_ before this date. | 2020-12-10T23:00:00.000Z |\n| expiration_date | Expiration date defines when the code expires. Expiration timestamp in ISO 8601 format. Voucher is _inactive_ after this date. | 2023-12-31T23:00:00.000Z |\n| gift_balance | Amount left to spend. | 1000 |\n| loyalty_balance | Available usable points. | 2000 |\n| redemption_quantity | Maximum number of times a voucher can be redeemed. | 2 |\n| redemption_count | Total redemptions. | 59 |\n| active | Boolean indicating whether the voucher is available for use. | `true`, `false` |\n| qr_code | URL to QR representation of encrypted code. | |\n| bar_code | URL to barcode representation of encrypted code. | |\n| is_referral_code | Boolean indicating whether the voucher is a referral code. | `true`, `false` |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the voucher was created. | 2022-04-14T09:55:46.814Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the voucher was last updated. | 2022-04-14T10:02:18.036Z |\n| validity_timeframe_interval | Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an interval of `P2D` will be active every other day. | P2D |\n| validity_timeframe_duration | Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a duration of `PT1H` will be valid for a duration of one hour. | PT1H |\n| validity_day_of_week | Array corresponding to the particular days of the week in which the voucher is valid. | \"1,2,3,4,5\" |\n| discount_amount_limit | For `PERCENT` discount type, this is the maximum threshold allowed to be deducted. | 50 |\n| campaign_id | Parent campaign ID. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| additional_info | An optional field to keep any extra textual information about the code such as a code description and details. | |\n| customer_id | Unique customer ID of the assigned owner to whom the voucher was published. | cust_7iUa6ICKyU6gH40dBU25kQU1 |\n| discount_unit_type | For `UNIT` discount type, either a shipping or product ID for a `UNIT` discount with one product. | prod_5h1pp1ng, prod_0a9f9aeddb019a42db |\n| discount_unit_effect | `UNIT` discount effect. | `ADD_MANY_ITEMS`, `ADD_MISSING_ITEMS`,`ADD_NEW_ITEMS` |\n| customer_source_id | Unique customer source id of the assigned owner to whom the voucher was published. | name.lastname@email.com |\n| metadata | Returns all voucher metadata. | Response will include all voucher metadata. |\n| metadata.X | Where X is the name of a particular voucher metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Voucher. [Read more here](https://support.voucherify.io/article/99-schema-validation-metadata). |\n", + "items": { + "type": "string" + } + }, + "filters": { + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the export. You can filter the following parameters: \n\n - `categories`\n\n - `vouchers`\n\n - `type`\n\n - `holder_id`\n\n - `is_referral_code`\n\n - `published_for_customer_id`\n\n - `validity_timeframe`\n\n - `category_ids`" + } + } + }, + "16_obj_export_publication": { + "description": "List of available fields and filters that can be exported with a publication along with the sorting order of the returned data.", + "title": "publication", + "type": "object", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "id", + "-id", + "voucher_code", + "-voucher_code", + "tracking_id", + "-tracking_id", + "customer_id", + "-customer_id", + "created_at", + "-created_at", + "channel", + "-channel" + ] + }, + "fields": { + "type": "array", + "enum": [ + [ + "voucher_code", + "customer_id", + "customer_source_id", + "date", + "channel", + "campaign", + "is_winner", + "metadata" + ] + ], + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| voucher_code | Unique voucher code. | WELCOME100 |\n| customer_id | Customer unique ID. | cust_7iUa6ICKyU6gH40dBU25kQU1 |\n| customer_source_id | Unique customer source id of the assigned owner to whom the voucher was published. | name.lastname@email.com |\n| date | Timestamp in ISO 8601 format representing the date and time when the voucher was published. | 2022-04-28T10:19:30.792Z |\n| channel | Publication channel. | voucherify-website |\n| campaign | Unique campaign name. | Summer Discounts 20% off |\n| is_winner | | |\n| metadata | Returns all publication metadata. | Response will include all publication metadata. |\n| metadata.X | Where X is the name of a particular publication metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Publication. [Read more here](https://support.voucherify.io/article/99-schema-validation-metadata) |", + "items": { + "type": "string" + } + }, + "filters": { + "description": "Data filters used to narrow the data records to be returned in the export. You can filter the following parameters: \n\n - `failure_code`\n\n - `result`\n\n - `customer_id`\n\n - `campaign_name`\n\n - `voucher_type`\n\n - `is_referral_code`\n\n - `parent_object_id`\n\n - `related_object_id`\n\n - `source_id`", + "anyOf": [ + { + "$ref": "#/components/schemas/16_obj_filter_publication_failure_code" + }, + { + "$ref": "#/components/schemas/16_obj_filter_publication_result" + }, + { + "$ref": "#/components/schemas/16_obj_filter_publication_customer_id" + }, + { + "$ref": "#/components/schemas/16_obj_filter_publication_campaign_name" + }, + { + "$ref": "#/components/schemas/16_obj_filter_publication_voucher_type" + }, + { + "$ref": "#/components/schemas/16_obj_filter_publication_is_referral_code" + }, + { + "$ref": "#/components/schemas/16_obj_filter_publication_parent_object_id" + }, + { + "$ref": "#/components/schemas/16_obj_filter_publication_related_object_id" + }, + { + "$ref": "#/components/schemas/16_obj_filter_publication_source_id" + } + ] + } + } + }, + "16_obj_export_redemption": { + "description": "List of available fields and filters that can be exported with a redemption along with the sorting order of the returned data.", + "title": "redemption", + "type": "object", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "id", + "-id", + "voucher_code", + "-voucher_code", + "tracking_id", + "-tracking_id", + "customer_id", + "-customer_id", + "created_at", + "-created_at" + ] + }, + "fields": { + "type": "array", + "enum": [ + [ + "id", + "object", + "date", + "voucher_code", + "campaign", + "promotion_tier_id", + "customer_id", + "customer_source_id", + "customer_name", + "tracking_id", + "order_amount", + "gift_amount", + "loyalty_points", + "result", + "failure_code", + "failure_message", + "metadata" + ] + ], + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique redemption ID. | r_0acf3a6dae00e679c8, rf_0acf3a495740e679b8 |\n| object | Object being exported; by default `redemption`. | redemption |\n| date | Timestamp in ISO 8601 format representing the date and time when the voucher was redeemed. | 2022-03-23T08:52:24.867Z |\n| voucher_code | Unique voucher code redeemed. | WELCOME100 |\n| campaign | Parent campaign name of voucher if applicable. | Summer Discounts 20% off |\n| promotion_tier_id | | promo_Mwy9XpA0TLctSGriM5kum0qp |\n| customer_id | Unique customer ID of redeeming customer. | cust_nk0N1uNQ1YnupAoJGOgvsODC |\n| customer_source_id | Unique source ID of redeeming customer. | name.lastname@email.com |\n| customer_name | Customer name. | John Smith |\n| tracking_id | | track_Pw6r3ejnml43kIwNS4Zj09KZ67xOfLUy |\n| order_amount | Total order amount before applying all discounts. | 1000 |\n| gift_amount | Gift credits used for redemption. | 10 |\n| loyalty_points | | 12 |\n| result | Tells you whether the redemption succeeded. | `SUCCESS`, `FAILURE` |\n| failure_code | Internal Voucherify code for reason why redemption failed. | invalid_customer |\n| failure_message | A human-readable message providing a short description explaining why the redemption failed. | Customer must be a holder of a loyalty card. |\n| metadata | Returns all redemption metadata. | Response will include all redemption metadata. |\n| metadata.X | Where X is the name of a particular redemption metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Redemption. [Read more here](https://support.voucherify.io/article/99-schema-validation-metadata) |", + "items": { + "type": "string" + } + }, + "filters": { + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the export. You can filter the following parameters: \n\n - `voucher_code`\n\n - `related_object_id`\n\n - `related_object_parent_id`\n\n - `parent_redemption_id`\n\n - `failure_code`\n\n - `result`\n\n - `object`\n\n - `customer_id`\n\n - `campaign_name`\n\n - `user_login`" + } + } + }, + "16_obj_export_customer": { + "description": "List of available fields and filters that can be exported with a customer along with the sorting order of the returned data.", + "title": "customer", + "type": "object", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "name", + "-name", + "id", + "-id", + "email", + "-email", + "source_id", + "-source_id", + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + }, + "fields": { + "type": "array", + "enum": [ + [ + "name", + "id", + "description", + "email", + "source_id", + "created_at", + "address_city", + "address_state", + "address_line_1", + "address_line_2", + "address_country", + "address_postal_code", + "redemptions_total_redeemed", + "redemptions_total_failed", + "redemptions_total_succeeded", + "redemptions_total_rolled_back", + "redemptions_total_rollback_failed", + "redemptions_total_rollback_succeeded", + "orders_total_amount", + "orders_total_count", + "orders_average_amount", + "orders_last_order_amount", + "orders_last_order_date", + "loyalty_points", + "loyalty_referred_customers", + "updated_at", + "phone", + "birthday", + "metadata", + "birthdate" + ] + ], + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| name | Customer name. | John Smith |\n| id | Unique customer ID. | cust_J1CDUdbqn5Exva8ASWk1Fq0j |\n| description | An arbitrary string that you can attach to a customer object. | Customer requesting to be added to VIP tier. |\n| email | Customer's email. | name.lastname@email.com |\n| source_id | Unique custom customer identifier. | name.lastname@email.com |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the customer was created. | 2022-02-03T13:10:11.928Z |\n| address_city | City | Houston |\n| address_state | State | TX |\n| address_line_1 | First line of customer's address. | 72738 Main St |\n| address_line_2 | Second line of customer's address. | Bld 2, Apt 4 |\n| address_country | Country | United States of America |\n| address_postal_code | Postal code (ZIP code) | 77042-4143 |\n| redemptions_total_redeemed | Total customer redemptions. | 5 |\n| redemptions_total_failed | Total customer failed redemptions. | 2 |\n| redemptions_total_succeeded | Total customer succeeded redemptions. | 3 |\n| redemptions_total_rolled_back | Total customer redemptions that were rolled back. | 3 |\n| redemptions_total_rollback_failed | Total customer redemptions that were unsuccessfully rolled back. | 2 |\n| redemptions_total_rollback_succeeded | Total customer redemptions that were successfully rolled back. | 1 |\n| orders_total_amount | Total sum of order amounts over customer lifetime. Value is multiplied by 100 to precisely represent 2 decimal places. | 10000 (represents $100) |\n| orders_total_count | Total number of customer orders. Value is multiplied by 100 to precisely represent 2 decimal places. | 2 |\n| orders_average_amount | Average amount spent on orders. Value is multiplied by 100 to precisely represent 2 decimal places. | 50 |\n| orders_last_order_amount | How much did the customer spend on their last order. Value is multiplied by 100 to precisely represent 2 decimal places. | 50 |\n| orders_last_order_date | When was the last customer order; timestamp in ISO 8601 format representing the date and time. | 2022-02-03T13:17:30.630Z |\n| loyalty_points | Sum of customer's loyalty points to go across all loyalty cards. | |\n| loyalty_referred_customers | How many customers were referred by this customer. | |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the customer was updated. | 2022-02-14T14:10:14.305Z |\n| phone | Customer's phone number. | +1 (294) 752-1846 |\n| birthday | Customer's birthday. | 2022-01-01 |\n| birthdate | Customer's birthdate. | 2022-04-29 |\n| metadata | Returns all customer metadata. | Response will include all customer metadata. |\n| metadata.X | Where X is the name of a particular customer metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Customer. [Read more here](https://support.voucherify.io/article/99-schema-validation-metadata) |", + "items": { + "type": "string" + } + }, + "filters": { + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the export. You can filter the following parameters: \n\n - `name` (string)\n\n - `email` (string)\n\n - `phone` (string)\n\n - `metadata` (json)\n\n - `metadata.X` (?)\n\n - `address` (json)\n\n - `address.state` (string)\n\n - `address.country` (string)\n\n - `address.postal_code` (string)\n\n - `birthday` (string - date-time)\n\n - `birthdate` (string date-time)\n\n - `created_at` (date)\n\n - `source_id` (string)\n\n - `system.metadata` (json)\n\n - `system.metadata.source` (string)\n\n - `system.metadata.consents.unsubscribed` (boolean)\n\n - `loyalty_points` (json)\n\n - `loyalty` (json)\n\n - `summary.orders.total_amount` (json)\n\n - `summary.orders.last_order_date` (date)\n\n - `summary.orders.last_order_amount` (json)\n\n - `summary.redemptions.gift.redeemed_amount` (integer)\n\n - `summary.redemptions.total_succeeded` (integer)\n\n - `events.cart_abandoned.last_occurred` (integer)\n\n - `events.newsletter_subscribed.count` (integer)\n\n - `events.sign_up.last_occurred` (integer)" + } + } + }, + "16_obj_export_points_expiration": { + "description": "List of available fields and filters that can be exported with points expirations along with the sorting order of the returned data.", + "title": "points expiration", + "type": "object", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "expires_at", + "-expires_at" + ] + }, + "fields": { + "type": "array", + "enum": [ + [ + "id", + "campaign_id", + "voucher_id", + "status", + "expires_at", + "points" + ] + ], + "description": "Array of strings containing the data that was exported. These fields define the headers in the CSV file. \n\n The array can be a combintation of any of the following available fields: \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n |\n| campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 |\n| status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` |\n| expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 |\n| points | Number of points. | 1000 |", + "items": { + "type": "string" + } + }, + "filters": { + "description": "Data filters used to narrow the data records to be returned in the export. You can filter the following parameters: \n\n - `campaign_id`\n\n - `voucher_id`", + "anyOf": [ + { + "$ref": "#/components/schemas/16_obj_filter_points_expiration_campaign_id" + }, + { + "$ref": "#/components/schemas/16_obj_filter_points_expiration_voucher_id" + } + ] + } + } + }, + "16_obj_export_gift_card_transactions": { + "description": "List of available fields and filters that can be exported with gift card transactions along with the sorting order of the returned data.", + "title": "gift card transactions", + "type": "object", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "-created_at", + "created_at" + ] + }, + "fields": { + "type": "array", + "enum": [ + [ + "id", + "type", + "source_id", + "reason", + "balance", + "amount", + "created_at", + "voucher_id", + "campaign_id", + "source", + "details" + ] + ], + "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
                  - `CREDITS_ADDITION`
                  - `CREDITS_REFUND`
                  - `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |", + "items": { + "type": "string" + } + }, + "filters": { + "$ref": "#/components/schemas/16_obj_filter_gift_card_transactions_voucher_id" + } + } + }, + "16_obj_export_loyalty_card_transactions": { + "description": "List of available fields and filters that can be exported with loyalty card transactions along with the sorting order of the returned data.", + "title": "loyalty card transactions", + "type": "object", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", + "enum": [ + "-created_at", + "created_at" + ] + }, + "fields": { + "type": "array", + "enum": [ + [ + "id", + "type", + "source_id", + "reason", + "balance", + "amount", + "created_at", + "voucher_id", + "campaign_id", + "details", + "related_transaction_id" + ] + ], + "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID assigned by Voucherify. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `POINTS_EXPIRATION`
                  - `POINTS_ADDITION`
                  - `POINTS_REMOVAL`
                  - `POINTS_TRANSFER_OUT`
                  - `POINTS_ACCRUAL`
                  - `POINTS_REFUND`
                  - `POINTS_REDEMPTION` |\n| source_id | Custom source ID of the transaction if one was included originally. | source_id_custom |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The loyalty card balance after the transaction. | |\n| amount | The amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | - `API`
                  - `voucherify-web-ui`
                  - `Automation` |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n| related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |", + "items": { + "type": "string" + } + }, + "filters": { + "$ref": "#/components/schemas/16_obj_filter_loyalty_card_transactions_voucher_id" + } + } + }, + "16_obj_filter_publication_failure_code": { + "description": "Filter conditions set on the publication `failure_code`. Available options are:\n\n - `not_found`,\n\n - `no_voucher_suitable_for_publication`\n\n - `voucher_already_published`\n\n - `duplicate_source_id`\n\n - `too_many_vouchers_requested`", + "title": "Filter by failure code", + "type": "object", + "properties": { + "failure_code": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_publication_result": { + "description": "Filter conditions set on the publication `result`. Available options are:\n\n - `SUCCESS`\n\n - `FAILURE`", + "title": "Filter by result", + "type": "object", + "properties": { + "result": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_publication_customer_id": { + "description": "Filter conditions set on the publication `customer_id`.", + "title": "Filter by customer ID", + "type": "object", + "properties": { + "customer_id": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_publication_campaign_name": { + "description": "Filter conditions set on the publication `campaign_name`.", + "title": "Filter by campaign name", + "type": "object", + "properties": { + "campaign_name": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_publication_voucher_type": { + "description": "Filter conditions set on the publication `voucher_type`.", + "title": "Filter by voucher type", + "type": "object", + "properties": { + "voucher_type": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_publication_is_referral_code": { + "description": "Filter conditions set on the publication `is_referral_code`.", + "title": "Filter if the code is a referral code", + "type": "object", + "properties": { + "is_referral_code": { + "$ref": "#/components/schemas/16_filter_conditions_boolean" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_publication_parent_object_id": { + "description": "Filter conditions set on the publication `parent_object_id`, which is the parent campaigns unique ID assigned by Voucherify.", + "title": "Filter by parent object ID", + "type": "object", + "properties": { + "parent_object_id": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_publication_related_object_id": { + "description": "Filter conditions set on the publication `related_object_id`.", + "title": "Filter by related object ID", + "type": "object", + "properties": { + "related_object_id": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_publication_source_id": { + "description": "Filter conditions set on the publication `source_id`.", + "title": "Filter by publication source ID", + "type": "object", + "properties": { + "source_id": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_order_status": { + "description": "Filter conditions set on the order `status`.", + "title": "Filter by status", + "type": "object", + "properties": { + "status": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_order_source_id": { + "description": "Filter conditions set on the order `source_id`.", + "title": "Filter by order source ID", + "type": "object", + "properties": { + "source_id": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_order_amount": { + "description": "Filter conditions set on the order `amount`.", + "title": "Filter by order amount", + "type": "object", + "properties": { + "amount": { + "$ref": "#/components/schemas/16_filter_conditions_number" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_order_total_amount": { + "description": "Filter conditions set on the order `total_amount`.", + "title": "Filter by order total amount", + "type": "object", + "properties": { + "total_amount": { + "$ref": "#/components/schemas/16_filter_conditions_number" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_order_discount_amount": { + "description": "Filter conditions set on the order `discount_amount`.", + "title": "Filter by order discount amount", + "type": "object", + "properties": { + "discount_amount": { + "$ref": "#/components/schemas/16_filter_conditions_number" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_order_total_discount_amount": { + "description": "Filter conditions set on the order `total_discount_amount`.", + "title": "Filter by order total discount amount", + "type": "object", + "properties": { + "total_discount_amount": { + "$ref": "#/components/schemas/16_filter_conditions_number" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_order_items_discount_amount": { + "description": "Filter conditions set on the order `items_discount_amount`.", + "title": "Filter by order items discount amount", + "type": "object", + "properties": { + "items_discount_amount": { + "$ref": "#/components/schemas/16_filter_conditions_number" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_points_expiration_campaign_id": { + "description": "Filter conditions set on`the `campaign_id`.", + "title": "Filter by campaign ID", + "type": "object", + "properties": { + "campaign_id": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_points_expiration_voucher_id": { + "description": "Filter conditions set on`the `voucher_id`.", + "title": "Filter by voucher ID", + "type": "object", + "properties": { + "voucher_id": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_gift_card_transactions_voucher_id": { + "description": "Filter conditions set on`the `voucher_id`.", + "title": "Filter by voucher ID", + "type": "object", + "properties": { + "voucher_id": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_obj_filter_loyalty_card_transactions_voucher_id": { + "description": "Filter conditions set on`the `voucher_id`.", + "title": "Filter by voucher ID", + "type": "object", + "properties": { + "voucher_id": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "16_filter_junction": { + "description": "Filter by conditions set on the `junction` parameter indicating how the `conditions` should be accounted for in the query. An `AND` is an all-inclusive logical operator, meaning the `AND` operator displays a record if **ALL** the conditions separated by AND are TRUE, while an `OR` operator displays a record if **ANY** of the conditions separated by OR is TRUE.", + "title": "Logical Operator Between Filters", + "type": "string", + "enum": [ + "AND", + "OR" + ] + }, + "16_filter_conditions_string": { + "title": "Filter by conditions", + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "conditions": { + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "$in": { + "type": "array", + "description": "Array of resource values that should be included in the results. (multiple values)", + "items": { + "type": "string" } - ] - }, - "22_res_list_locations": { - "title": "List Locations Response Body", + }, + "$not_in": { + "type": "array", + "description": "Array of resource values that should be included in the results. (multiple values)", + "items": { + "type": "string" + } + }, + "$is": { + "type": "string", + "description": "Value is exactly this value. (single value)" + }, + "$is_not": { + "type": "string", + "description": "Results omit this value. (single value)" + }, + "$has_value": { + "type": "string", + "description": "Value is NOT null. The value for this parameter is an empty string." + }, + "$is_unknown": { + "type": "string", + "description": "Value is null. The value for this parameter is an empty string." + }, + "$starts_with": { + "type": "string", + "description": "Value starts with the specified string." + }, + "$ends_with": { + "type": "string", + "description": "Value ends with the specified string." + } + } + } + } + }, + "16_filter_conditions_number": { + "title": "Filter by conditions", + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "conditions": { + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "$in": { + "type": "array", + "description": "Array of resource values that should be included in the results. (multiple values)", + "items": { + "type": "integer" + } + }, + "$not_in": { + "type": "array", + "description": "Array of resource values that should be included in the results. (multiple values)", + "items": { + "type": "integer" + } + }, + "$is": { + "type": "integer", + "description": "Value is exactly this value. (single value)" + }, + "$is_not": { + "type": "integer", + "description": "Results omit this value. (single value)" + }, + "$has_value": { + "type": "string", + "description": "Value is NOT null. The value for this parameter is an empty string." + }, + "$is_unknown": { + "type": "string", + "description": "Value is null. The value for this parameter is an empty string." + }, + "$more_than": { + "type": "integer", + "description": "Value is more than the specified number." + }, + "$more_than_equal": { + "type": "integer", + "description": "Value is more than or equal to the specified number." + }, + "$less_than": { + "type": "integer", + "description": "Value is less than the specified number." + }, + "$less_than_equal": { + "type": "integer", + "description": "Value is less than or equal to the specified number." + } + } + } + } + }, + "16_filter_conditions_array": { + "title": "Filter by conditions", + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "conditions": { + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "$in": { + "type": "array", + "description": "Array of resource values that should be included in the results. (multiple values)", + "items": { + "type": "string" + } + }, + "$not_in": { + "type": "array", + "description": "Array of resource values that should be included in the results. (multiple values)", + "items": { + "type": "string" + } + }, + "$is": { + "type": "string", + "description": "Value is exactly this value. (single value)" + }, + "$is_not": { + "type": "string", + "description": "Results omit this value. (single value)" + }, + "$has_value": { + "type": "string", + "description": "Value is NOT null. The value for this parameter is an empty string." + }, + "$is_unknown": { + "type": "string", + "description": "Value is null. The value for this parameter is an empty string." + }, + "$starts_with": { + "type": "string", + "description": "Value starts with the specified string." + }, + "$ends_with": { + "type": "string", + "description": "Value ends with the specified string." + }, + "$count": { + "type": "integer", + "description": "Value has exactly this number of elements." + }, + "$count_less": { + "type": "integer", + "description": "Value has less than this number of elements." + }, + "$count_more": { + "type": "integer", + "description": "Value has more than this number of elements." + }, + "$contains": { + "type": "string", + "description": "Array contains this element." + } + } + } + } + }, + "16_filter_conditions_boolean": { + "title": "Filter by conditions", + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "conditions": { + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "$is": { + "type": "string", + "description": "Value is exactly this value. (single value)" + }, + "$is_not": { + "type": "string", + "description": "Results omit this value. (single value)" + }, + "$has_value": { + "type": "string", + "description": "Value is NOT null. The value for this parameter is an empty string." + }, + "$is_unknown": { + "type": "string", + "description": "Value is null. The value for this parameter is an empty string." + } + } + } + } + }, + "16_filter_conditions_date": { + "title": "Filter by conditions", + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "conditions": { + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "$after": { + "type": "string", + "description": "Value is after this date. Value for this parameter is in ISO 8601 format." + }, + "$before": { + "type": "string", + "description": "Value is before this date. Value for this parameter is in ISO 8601 format." + }, + "$has_value": { + "type": "string", + "description": "Value is NOT null. The value for this parameter is an empty string." + }, + "$is_unknown": { + "type": "string", + "description": "Value is null. The value for this parameter is an empty string." + } + } + } + } + }, + "16_filter_conditions_date_time": { + "title": "Filter by conditions", + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "conditions": { + "type": "object", + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "$after": { + "type": "string", + "description": "Value is after this date. Value for this parameter is in ISO 8601 format.", + "format": "date-time" + }, + "$before": { + "type": "string", + "description": "Value is before this date. Value for this parameter is in ISO 8601 format.", + "format": "date-time" + }, + "$has_value": { + "type": "string", + "description": "Value is NOT null. The value for this parameter is an empty string." + }, + "$is_unknown": { + "type": "string", + "description": "Value is null. The value for this parameter is an empty string." + } + } + } + } + }, + "17_obj_async_action_object": { + "title": "Async Action Object", + "type": "object", + "description": "This is an object representing an asynchronous action.", + "x-tags": [ + "ASYNC ACTIONS API" + ], + "properties": { + "id": { + "type": "string", + "example": "aa_0adad13d6f057f088e", + "description": "Async action unique ID." + }, + "type": { + "type": "string", + "description": "Type of async action.", + "enum": [ + "CAMPAIGN.VOUCHERS_IMPORT", + "CAMPAIGN.VOUCHERS_IMPORT_CSV", + "CAMPAIGN.VOUCHERS_UPDATE", + "CAMPAIGN.VOUCHERS_DELETE", + "CAMPAIGN.VOUCHERS_GENERATE", + "CAMPAIGNS.METADATA_KEY_PURGE", + "CUSTOMERS.IMPORT_CSV", + "CUSTOMERS.BULK_UPDATE", + "CUSTOMERS.METADATA_UPDATE", + "CUSTOMERS.METADATA_KEY_PURGE", + "PRODUCTS.BULK_UPDATE", + "PRODUCTS.METADATA_UPDATE", + "PRODUCTS.METADATA_KEY_PURGE", + "PRODUCTS.IMPORT_CSV", + "SKUS.IMPORT_CSV", + "VOUCHERS.IMPORT", + "VOUCHERS.IMPORT_CSV", + "VOUCHERS.BULK_UPDATE", + "VOUCHERS.METADATA_UPDATE", + "VOUCHERS.METADATA_KEY_PURGE", + "ORDERS.IMPORT", + "ORDERS.METADATA_KEY_PURGE" + ] + }, + "status": { + "type": "string", + "description": "Status of async action. Informs you whether the async action has already been completed.", + "enum": [ + "ENQUEUED", + "IN_PROGRESS", + "DONE", + "FAILED" + ] + }, + "result": { + "anyOf": [ + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_vouchers_import" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_vouchers_import_csv" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_vouchers_update" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_vouchers_delete" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_vouchers_generate" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_campaign_metadata_key_purge" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_customers_import_csv" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_customers_bulk_update" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_customers_metadata_update" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_customers_metadata_key_purge" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_products_bulk_update" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_products_metadata_update" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_products_import_csv" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_skus_import_csv" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_products_metadata_key_purge" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_vouchers_import" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_vouchers_import_csv" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_vouchers_bulk_update" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_vouchers_metadata_update" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_vouchers_metadata_key_purge" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_orders_import" + }, + { + "$ref": "#/components/schemas/17_res_obj_get_async_action_result_orders_metadata_key_purge" + } + ] + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the async action was scheduled in ISO 8601 format.", + "example": "2022-06-23T11:21:45.578Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2022-06-23T11:21:46.795Z", + "description": "Timestamp representing the date and time when the async action was updated in ISO 8601 format.", + "format": "date-time" + }, + "request_id": { + "type": "string", + "example": "v-0b45cee140c3c9b5ca", + "description": "Unique request ID." + }, + "processing_time": { + "type": "integer", + "example": 1217, + "description": "The length of time it took to process the request in milliseconds." + }, + "progress": { + "type": "integer", + "description": "% progress to completion of the asynchronous action.", + "minimum": 0, + "maximum": 100 + }, + "object": { + "type": "string", + "default": "async_action", + "description": "The type of object represented by JSON. This object stores information about the `async_action`." + } + } + }, + "17_res_list_async_actions_GET": { + "description": "Response body schema for listing asynchronous actions. \n\nThe table below lists the possible types of async actions. The types are different for each endpoint generating the async action.\n\n| **Types by Context** |\n|:---|\n| **CAMPAIGN** |\n| CAMPAIGN.VOUCHERS_IMPORT
                  CAMPAIGN.VOUCHERS_IMPORT_CSV
                  CAMPAIGN.VOUCHERS_UPDATE
                  CAMPAIGN.VOUCHERS_DELETE
                  CAMPAIGN.VOUCHERS_GENERATE |\n| **CUSTOMERS** |\n| CUSTOMERS.IMPORT_CSV
                  CUSTOMERS.BULK_UPDATE
                  CUSTOMERS.METADATA_UPDATE
                  CUSTOMERS.METADATA_KEY_PURGE |\n| **PRODUCTS** |\n| PRODUCTS.BULK_UPDATE
                  PRODUCTS.METADATA_UPDATE
                  PRODUCTS.METADATA_KEY_PURGE
                  PRODUCTS.IMPORT_CSV
                  SKUS.IMPORT_CSV |\n| **VOUCHERS** |\n| VOUCHERS.IMPORT
                  VOUCHERS.IMPORT_CSV
                  VOUCHERS.BULK_UPDATE
                  VOUCHERS.METADATA_UPDATE
                  VOUCHERS.METADATA_KEY_PURGE |", + "type": "object", + "examples": [ + { + "object": "list", + "data_ref": "async_actions", + "async_actions": [ + { + "id": "aa_0ae2af6a38161f8c79", + "type": "CAMPAIGN.VOUCHERS_DELETE", + "status": "DONE", + "created_at": "2022-04-07T11:34:39.072Z", + "object": "async_action" + }, + { + "id": "aa_0ae27a55b696a4e0f0", + "type": "CUSTOMERS.BULK_UPDATE", + "status": "DONE", + "created_at": "2022-04-07T07:42:44.442Z", + "object": "async_action" + }, + { + "id": "aa_0adad13d6f057f088e", + "type": "CAMPAIGN.VOUCHERS_IMPORT", + "status": "DONE", + "created_at": "2022-04-01T08:54:35.196Z", + "object": "async_action" + }, + { + "id": "aa_0adacc81de057f084c", + "type": "CAMPAIGN.VOUCHERS_IMPORT", + "status": "DONE", + "created_at": "2022-04-01T08:33:54.552Z", + "object": "async_action" + } + ] + } + ], + "title": "List Async Actions Response Body", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about asynchronous actions.", + "default": "list" + }, + "data_ref": { + "type": "string", + "default": "async_actions", + "description": "Identifies the name of the JSON property that contains the array of asynchronous actions." + }, + "async_actions": { + "type": "array", + "description": "An array of async actions.", + "items": { "type": "object", - "description": "Response schema for listing locations using **GET** `/locations`.", + "additionalProperties": false, + "description": "Contains an async action definition.", "properties": { - "object": { + "id": { + "type": "string", + "description": "Async action unique ID.", + "example": "aa_0ae2af6a38161f8c79" + }, + "type": { + "type": "string", + "description": "Type of async action.", + "enum": [ + "CAMPAIGN.VOUCHERS_IMPORT", + "CAMPAIGN.VOUCHERS_IMPORT_CSV", + "CAMPAIGN.VOUCHERS_UPDATE", + "CAMPAIGN.VOUCHERS_DELETE", + "CAMPAIGN.VOUCHERS_GENERATE", + "CUSTOMERS.IMPORT_CSV", + "CUSTOMERS.BULK_UPDATE", + "CUSTOMERS.METADATA_UPDATE", + "CUSTOMERS.METADATA_KEY_PURGE", + "PRODUCTS.BULK_UPDATE", + "PRODUCTS.METADATA_UPDATE", + "PRODUCTS.METADATA_KEY_PURGE", + "PRODUCTS.IMPORT_CSV", + "SKUS.IMPORT_CSV", + "VOUCHERS.IMPORT", + "VOUCHERS.IMPORT_CSV", + "VOUCHERS.BULK_UPDATE", + "VOUCHERS.METADATA_UPDATE", + "VOUCHERS.METADATA_KEY_PURGE" + ] + }, + "status": { + "type": "string", + "description": "Status of async action. Informs you whether the async action has already been completed.", + "enum": [ + "ENQUEUED", + "IN_PROGRESS", + "DONE", + "FAILED" + ] + }, + "created_at": { "type": "string", - "description": "The type of object represented by JSON. This object stores information about locations in a dictionary.", - "default": "list" + "description": "Timestamp representing the date and time when the async action was scheduled in ISO 8601 format.", + "example": "2022-04-07T07:42:44.442Z", + "format": "date-time" }, - "data_ref": { + "updated_at": { "type": "string", - "description": "Identifies the name of the attribute that contains the array of metadata schema objects.", - "default": "data" + "description": "Timestamp representing the date and time when the async action was updated in ISO 8601 format.", + "example": "2022-06-22T07:58:21.703Z", + "format": "date-time" }, - "data": { - "type": "array", - "description": "Array of location objects.", - "items": { - "$ref": "#/components/schemas/22_obj_location_object" - } + "request_id": { + "type": "string", + "example": "v-0ba50a7feb4998490", + "description": "Unique request ID." }, - "total": { + "progress": { "type": "integer", - "description": "Total number of locations." + "minimum": 0, + "maximum": 100, + "description": "% progress to completion of the asynchronous action." }, - "has_more": { - "type": "boolean", - "description": "As query results are always limited (by the limit parameter), the `has_more` flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different end date filter) to get more records returned in the results." + "object": { + "type": "string", + "default": "async_action", + "description": "The type of object represented by each nested object in the JSON async_actions array. This object stores information about the `async_action`." } - }, - "examples": [ - { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "loc_NoMGXmHO9OUs7iz9mGWpamma", - "object": "location", - "name": "Belleville", - "shape": { - "type": "circle", - "format": "distance", - "distance": { - "center": "geo:40.79372699823857,-74.15092132694554", - "radius": "1.54 km" - } - }, - "created_at": "2022-07-15T06:04:36.924Z", - "updated_at": null - }, - { - "id": "loc_ae2gKWpAFMsuRhyMqGx2FZFF", - "object": "location", - "name": "New York", - "shape": { - "type": "polygon", - "format": "geojson", - "geojson": { - "type": "Polygon", - "coordinates": [ - [ - [ - -74.016167, - 40.703186 - ], - [ - -74.008687, - 40.750656 - ], - [ - -73.943597, - 40.851838 - ], - [ - -73.928559, - 40.845285 - ], - [ - -73.936152, - 40.8356 - ], - [ - -73.934298, - 40.810015 - ], - [ - -73.92711, - 40.795145 - ], - [ - -73.978623, - 40.710432 - ], - [ - -74.013201, - 40.701619 - ], - [ - -74.016167, - 40.703186 - ] - ] - ] - } - }, - "created_at": "2022-07-15T05:37:45.299Z", - "updated_at": null - }, - { - "id": "loc_f5HqjVaiq7g9ISlmivpytxSf", - "object": "location", - "name": "Germany", - "shape": { - "type": "circle", - "format": "distance", - "distance": { - "center": "geo:51.303908897065064,10.222253628401518", - "radius": "192.37 km" - } - }, - "created_at": "2022-07-14T15:51:39.265Z", - "updated_at": null - }, - { - "id": "loc_RcYz537sV07e1t5aG5tIH9FD", - "object": "location", - "name": "Poland", - "shape": { - "type": "polygon", - "format": "geojson", - "geojson": { - "type": "Polygon", - "coordinates": [ - [ - [ - 18.553923, - 50.559107 - ], - [ - 18.528805, - 51.087437 - ], - [ - 19.591667, - 50.832424 - ], - [ - 19.425109, - 50.497984 - ], - [ - 19.375814, - 50.330652 - ], - [ - 19.398107, - 50.111652 - ], - [ - 18.73906, - 49.981498 - ], - [ - 18.272477, - 50.088707 - ], - [ - 18.553923, - 50.559107 - ] - ] - ] - } - }, - "created_at": "2022-07-14T15:21:55.085Z", - "updated_at": null - } - ], - "total": 4, - "has_more": false + } + } + } + } + }, + "17_res_obj_get_async_action_result_message": { + "title": "Message", + "type": "object", + "description": "Result schema with message.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + } + } + }, + "17_res_obj_get_async_action_result_message_failed": { + "title": "Message with Failed Array", + "type": "object", + "description": "Result schema with message and failed array.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "failed": { + "type": "array", + "description": "If any records failed during the process, this array shows the failure details.", + "items": {} + } + } + }, + "17_res_obj_get_async_action_result_code_updated_found": { + "title": "Code Updated and Found", + "type": "object", + "description": "Result schema with an array of code, updated, and found parameters.", + "properties": { + "results": { + "type": "array", + "description": "An array of statuses for each record.", + "items": { + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Unique voucher code." + }, + "updated": { + "type": "boolean", + "description": "Indicates whether the record was updated." + }, + "found": { + "type": "boolean", + "description": "Indicates whether the record was found." } - ] - }, - "22_obj_location_object": { - "title": "Location object", + } + } + } + } + }, + "17_res_obj_get_async_action_result_campaign_vouchers_import": { + "title": "CAMPAIGN.VOUCHERS_IMPORT", + "type": "object", + "description": "Result schema for a CAMPAIGN.VOUCHERS_IMPORT async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "failed": { + "type": "array", + "description": "If any records failed during the process, this array shows the failure details.", + "items": { "type": "object", - "description": "This is an object representing a location.", - "x-tags": [ - "LOCATIONS API" - ], "properties": { - "id": { + "code": { "type": "string", - "description": "Unique location ID, assigned by the Voucherify API.", - "example": "loc_NoMGXmHO9OUs7iz9mGWpamma" + "description": "Unique voucher code." }, - "object": { + "reason": { "type": "string", - "description": "The type of object represented by JSON. This object stores information about a `location`.", - "default": "location" - }, - "name": { + "description": "Detailed failure cause for the voucher code import." + } + } + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + }, + "failed_count": { + "type": "integer", + "description": "Number of resources failed to process." + } + } + }, + "17_res_obj_get_async_action_result_campaign_vouchers_import_csv": { + "title": "CAMPAIGN.VOUCHERS_IMPORT_CSV", + "type": "object", + "description": "Result schema for a CAMPAIGN.VOUCHERS_IMPORT_CSV async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "failed": { + "type": "array", + "description": "If any records failed during the process, this array shows the failure details.", + "items": { + "type": "object", + "properties": { + "code": { "type": "string", - "description": "Location name." + "description": "Unique voucher code." }, - "shape": { - "type": "object", - "description": "Defines the shape and boundaries of the location.", - "anyOf": [ - { - "$ref": "#/components/schemas/22_obj_location_object_shape_circle" - }, - { - "$ref": "#/components/schemas/22_obj_location_object_shape_polygon" - } - ] + "row": { + "type": "integer", + "description": "The CSV file row number where the code definition is recorded. The row counter excludes the file headers row." }, - "created_at": { + "reason": { "type": "string", - "example": "2022-02-14T15:12:06.817Z", - "description": "Timestamp representing the date and time when the location was created in ISO 8601 format.", - "format": "date-time" + "description": "Detailed failure cause for the voucher code import." + } + } + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + }, + "failed_count": { + "type": "integer", + "description": "Number of resources failed to process." + } + } + }, + "17_res_obj_get_async_action_result_campaign_vouchers_update": { + "title": "CAMPAIGN.VOUCHERS_UPDATE", + "type": "object", + "description": "Result schema for a CAMPAIGN.VOUCHERS_UPDATE async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_campaign_vouchers_delete": { + "title": "CAMPAIGN.VOUCHERS_DELETE", + "type": "object", + "description": "Result schema for a CAMPAIGN.VOUCHERS_DELETE async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_campaign_vouchers_generate": { + "title": "CAMPAIGN.VOUCHERS_GENERATE", + "type": "object", + "description": "Result schema for a CAMPAIGN.VOUCHERS_GENERATE async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_campaign_metadata_key_purge": { + "title": "CAMPAIGNS.METADATA_KEY_PURGE", + "type": "object", + "description": "Result schema for a CAMPAIGNS.METADATA_KEY_PURGE async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_customers_import_csv": { + "title": "CUSTOMERS.IMPORT_CSV", + "type": "object", + "description": "Result schema for a CUSTOMERS.IMPORT_CSV async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "failed": { + "type": "array", + "description": "If any records failed during the process, this array shows the failure details.", + "items": { + "type": "object", + "properties": { + "source_id": { + "type": "string", + "description": "Unique customer ID from your inventory system as indicated in the CSV file." }, - "updated_at": { + "row": { + "type": "integer", + "description": "The CSV file row number where the customer is recorded. The row counter excludes the file headers row." + }, + "reason": { "type": "string", - "example": "2022-03-14T15:12:06.817Z", - "description": "Timestamp representing the date and time when the location was updated in ISO 8601 format.", - "format": "date-time" + "description": "Detailed failure cause for the customer import." } } - }, - "22_obj_location_object_shape_circle": { - "title": "Circle", + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + }, + "failed_count": { + "type": "integer", + "description": "Number of resources failed to process." + } + } + }, + "17_res_obj_get_async_action_result_customers_bulk_update": { + "title": "CUSTOMERS.BULK_UPDATE", + "type": "object", + "description": "Result schema for a CUSTOMERS.BULK_UPDATE async action type.", + "properties": { + "results": { + "type": "array", + "description": "An array of statuses for each record.", + "items": { "type": "object", - "description": "This is an object representing a circular shape.", "properties": { - "type": { + "source_id": { "type": "string", - "description": "The type of shape being defined is a `circle`.", - "default": "circle" + "description": "Unique customer `source_id`." }, - "format": { - "type": "string", - "description": "The location is defined in terms of a `distance` object.", - "default": "distance" + "updated": { + "type": "boolean", + "description": "Indicates whether the record was updated." }, - "distance": { - "type": "object", - "title": "Distance", - "description": "Defines the parameters for the circle.", - "properties": { - "center": { - "type": "string", - "description": "Center of the circle identified by GPS coordinates in decimal degrees.", - "example": "geo:40.79372699823857,-74.15092132694554" - }, - "radius": { - "type": "string", - "description": "Defines the radius of the circle." - } - } + "found": { + "type": "boolean", + "description": "Indicates whether the record was found." } } - }, - "22_obj_location_object_shape_polygon": { - "title": "Polygon", + } + }, + "done_count": { + "type": "integer", + "description": "Number or resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_customers_metadata_update": { + "title": "CUSTOMERS.METADATA_UPDATE", + "type": "object", + "description": "Result schema for a CUSTOMERS.METADATA_UPDATE async action type.", + "properties": { + "results": { + "type": "array", + "description": "An array of statuses for each record.", + "items": { "type": "object", - "description": "This is an object representing a polygon.", "properties": { - "type": { + "source_id": { "type": "string", - "description": "The type of shape being defined is a `polygon`.", - "default": "polygon" + "description": "Unique customer `source_id`." }, - "format": { - "type": "string", - "description": "The location is defined in terms of a `geojson` object.", - "default": "geojson" + "updated": { + "type": "boolean", + "description": "Indicates whether the record was updated." }, - "distance": { - "type": "object", - "title": "Geojson", - "description": "Defines the parameters for the polygon.", - "properties": { - "type": { - "type": "string", - "description": "Type of geojson coordinates, i.e. `Polygon`.", - "default": "Polygon" - }, - "coordinates": { - "type": "array", - "description": "Contains array of GeoJSON coordinate arrays.", - "items": { - "$ref": "#/components/schemas/22_geojson_array" - } - } - } + "found": { + "type": "boolean", + "description": "Indicates whether the record was found." } } - }, - "22_geojson_array": { - "title": "GeoJSON coordinate array.", - "type": "array", - "description": "GeoJSON coordinate array.", - "items": { - "$ref": "#/components/schemas/22_geojson_coordinates" - } - }, - "22_geojson_coordinates": { - "title": "GeoJSON coordinate.", - "type": "array", - "description": "GeoJSON coordinate.", - "items": { - "type": "integer" - } - }, - "22_filter_updated_at": { + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_customers_metadata_key_purge": { + "title": "CUSTOMERS.METADATA_KEY_PURGE", + "type": "object", + "description": "Result schema for a CUSTOMERS.METADATA_KEY_PURGE async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_products_bulk_update": { + "title": "PRODUCTS.BULK_UPDATE", + "type": "object", + "description": "Result schema for a PRODUCTS.BULK_UPDATE async action type.", + "properties": { + "results": { + "type": "array", + "description": "An array of statuses for each record.", + "items": { "type": "object", - "title": "Updated at", "properties": { - "updated_at": { - "$ref": "#/components/schemas/16_filter_conditions_date_time" + "source_id": { + "type": "string", + "description": "Unique product `source_id`." + }, + "updated": { + "type": "boolean", + "description": "Indicates whether the record was updated." + }, + "found": { + "type": "boolean", + "description": "Indicates whether the record was found." } - }, - "description": "A filter on the list based on the object `updated_at` field. The value is a dictionary with the following options: `before`, `after`. A date value must be presented in ISO 8601 format (`2016-11-16T14:14:31Z` or `2016-11-16`). An example: `[updated_at][before]=2017-09-08T13:52:18.227Z`" - }, - "22_filter_created_at": { + } + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_products_metadata_update": { + "title": "PRODUCTS.METADATA_UPDATE", + "type": "object", + "description": "Result schema for a PRODUCTS.METADATA_UPDATE async action type.", + "properties": { + "results": { + "type": "array", + "description": "An array of statuses for each record.", + "items": { "type": "object", - "title": "Created at", "properties": { - "created_at": { - "$ref": "#/components/schemas/16_filter_conditions_date_time" + "source_id": { + "type": "string", + "description": "Unique product `source_id`." + }, + "updated": { + "type": "boolean", + "description": "Indicates whether the record was updated." + }, + "found": { + "type": "boolean", + "description": "Indicates whether the record was found." } - }, - "description": "A filter on the list based on the object `created_at` field. The value is a dictionary with the following options: `before`, `after`. A date value must be presented in ISO 8601 format (`2016-11-16T14:14:31Z` or `2016-11-16`). An example: `[created_at][before]=2017-09-08T13:52:18.227Z`" - }, - "22_filter_name": { + } + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_products_metadata_key_purge": { + "title": "PRODUCTS.METADATA_KEY_PURGE", + "type": "object", + "description": "Result schema for a PRODUCTS.METADATA_KEY_PURGE async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "done_count": { + "type": "integer", + "description": "Number of resources updated successfully." + } + } + }, + "17_res_obj_get_async_action_result_products_import_csv": { + "title": "PRODUCTS.IMPORT_CSV", + "type": "object", + "description": "Result schema for a PRODUCTS.IMPORT_CSV async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "failed": { + "type": "array", + "description": "If any records failed during the process, this array shows the failure details.", + "items": { "type": "object", - "title": "Name", + "description": "Contains the details regarding a CSV file line item failed import.", "properties": { - "name": { - "$ref": "#/components/schemas/16_filter_conditions_string" + "row": { + "type": "integer", + "description": "The CSV file row number where the product definition is recorded. The row counter excludes the file headers row." + }, + "reason": { + "type": "string", + "description": "Detailed failure cause for the product import." } - }, - "description": "A filter on the list based on the name field." - }, - "22_filter_id": { + } + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + }, + "failed_count": { + "type": "integer", + "description": "Number of resources failed to process." + } + } + }, + "17_res_obj_get_async_action_result_skus_import_csv": { + "title": "SKUS.IMPORT_CSV", + "type": "object", + "description": "Result schema for a SKUS.IMPORT_CSV async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result.", + "example": "2 sku(s) imported successfully, 6 failed." + }, + "failed": { + "type": "array", + "description": "If any records failed during the process, this array shows the failure details.", + "items": { "type": "object", - "title": "ID", + "description": "Contains the details regarding a CSV file line item failed import.", "properties": { - "id": { - "$ref": "#/components/schemas/16_filter_conditions_string" + "row": { + "type": "integer", + "description": "The CSV file row number where the SKU definition is recorded. The row counter excludes the file headers row.", + "example": 2 + }, + "reason": { + "type": "string", + "description": "Detailed failure cause for the SKU import.", + "example": "Resource sku with id size-small is in use by products with ids [prod_0b0e3441c2462eff2c]" } + } + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + }, + "failed_count": { + "type": "integer", + "description": "Number of resources failed to process." + } + } + }, + "17_res_obj_get_async_action_result_vouchers_import": { + "title": "VOUCHERS.IMPORT", + "type": "object", + "description": "Result schema for a VOUCHERS.IMPORT async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "failed": { + "description": "If any records failed during the process, this array shows the failure details.", + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Unique voucher code." }, - "description": "A filter on the list based on the id of the location." - }, - "23_obj_qualification_object": { - "title": "Qualification object", + "reason": { + "type": "string", + "description": "Detailed failure cause for the voucher code import." + } + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + }, + "failed_count": { + "type": "integer", + "description": "Number of resources failed to process." + } + } + }, + "17_res_obj_get_async_action_result_vouchers_import_csv": { + "title": "VOUCHERS.IMPORT_CSV", + "type": "object", + "description": "Result schema for a VOUCHERS.IMPORT_CSV async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "failed": { + "type": "array", + "description": "If any records failed during the process, this array shows the failure details.", + "items": { "type": "object", - "description": "This is an object representing a qualification.", - "x-tags": [ - "QUALIFICATIONS API" - ], "properties": { - "redeemables": { - "$ref": "#/components/schemas/23_obj_qualification_redeemables" - }, - "tracking_id": { + "code": { "type": "string", - "description": "This identifier is generated during voucher qualification based on your internal id (e.g., email, database ID). This is a hashed customer source ID." + "description": "Unique voucher code." }, - "order": { - "type": "object", - "description": "The order object sent in the request.", - "$ref": "#/components/schemas/23_obj_order_object" + "row": { + "type": "integer", + "description": "The CSV file row number where the code definition is recorded. The row counter excludes the file headers row." }, - "stacking_rules": { - "$ref": "#/components/schemas/23_obj_qualification_object_stacking_rules" + "reason": { + "type": "string", + "description": "Detailed failure cause for the voucher code import." } } - }, - "23_obj_order_object": { + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + }, + "failed_count": { + "type": "integer", + "description": "Number of resources failed to process." + } + } + }, + "17_res_obj_get_async_action_result_vouchers_bulk_update": { + "title": "VOUCHERS.BULK_UPDATE", + "type": "object", + "description": "Result schema for a VOUCHERS.BULK_UPDATE async action type.", + "properties": { + "results": { + "type": "array", + "description": "An array of statuses for each record.", + "items": { "type": "object", - "title": "Order object", - "description": "This is an object representing an order. \n\nThe purchase transactions can be tracked in Voucherify by the creation of an order object. You can create, retrieve, and pay individual orders, as well as list and export all of them in a CSV format. Orders are identified by a unique ID.\n\nOrders are automatically created during the [redeem voucher](ref:redeem-voucher) and [redeem promotion](redeem-promotion) call.\n\n\n> #### order.id and order session\n>\n> If you use the same order.id in more than one redemption request, all valid discounts provided in the redemption payload will be applied to the given order.\n> \n> Each time you use particular order in your requests, the API will automatically trigger a new session linked to the order.id. The session is active during the request and ends asynchronously after the request is completed. The session mechanism ensures that the particular order.id can be used in one API request at once.", - "x-tags": [ - "ORDERS API" - ], "properties": { - "id": { - "type": "string", - "description": "Unique order ID, assigned by Voucherify.", - "example": "ord_GFDbbv2I0wnO0sFUBOOOXPj2" - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - }, - "created_at": { + "code": { "type": "string", - "description": "Timestamp representing the date and time when the order was created in ISO 8601 format.", - "example": "2022-03-09T11:19:04.819Z", - "format": "date-time" + "description": "Unique voucher code." }, - "updated_at": { - "type": "string", - "example": "2022-08-12T13:34:10.681Z", - "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format.", - "format": "date-time" + "updated": { + "type": "boolean", + "description": "Indicates whether the record was updated." }, - "status": { + "found": { + "type": "boolean", + "description": "Indicates whether the record was found." + } + } + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_vouchers_metadata_update": { + "title": "VOUCHERS.METADATA_UPDATE", + "type": "object", + "description": "Result schema for a VOUCHERS.METADATA_UPDATE async action type.", + "properties": { + "results": { + "type": "array", + "description": "An array of statuses for each record.", + "items": { + "type": "object", + "properties": { + "code": { "type": "string", - "description": "Order status.", - "enum": [ - "CREATED", - "PAID", - "CANCELED", - "FULFILLED" - ] - }, - "amount": { - "type": "integer", - "description": "Order amount before applying any discount." - }, - "discount_amount": { - "type": "integer", - "description": "Sum of all order-level discounts applied to the order." + "description": "Unique voucher code." }, - "items_discount_amount": { - "type": "integer", - "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" + "updated": { + "type": "boolean", + "description": "Indicates whether the record was updated." }, - "total_discount_amount": { - "type": "integer", - "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`\t" + "found": { + "type": "boolean", + "description": "Indicates whether the record was found." + } + } + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_vouchers_metadata_key_purge": { + "title": "VOUCHERS.METADATA_KEY_PURGE", + "type": "object", + "description": "Result schema for a VOUCHERS.METADATA_KEY_PURGE async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "17_res_obj_get_async_action_result_orders_import": { + "title": "ORDERS.IMPORT", + "type": "object", + "description": "Result schema for a ORDERS.IMPORT async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "failed": { + "description": "If any records failed during the process, this array shows the failure details.", + "type": "object", + "properties": { + "source_id": { + "type": "string", + "description": "Unique order source ID." + }, + "reason": { + "type": "string", + "description": "Detailed failure cause for the voucher code import." + } + } + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + }, + "failed_count": { + "type": "integer", + "description": "Number of resources failed to process." + } + } + }, + "17_res_obj_get_async_action_result_orders_metadata_key_purge": { + "title": "ORDERS.METADATA_KEY_PURGE", + "type": "object", + "description": "Result schema for a ORDERS.METADATA_KEY_PURGE async action type.", + "properties": { + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the result." + }, + "done_count": { + "type": "integer", + "description": "Number of resources processed successfully." + } + } + }, + "18_res_list_consents_GET": { + "description": "Response body schema for listing consents.", + "type": "object", + "examples": [ + { + "groups": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "cnstgr_3c7Z3rcOLv51bsXlRtTZPYj8", + "name": "Consent group", + "description": "Consent group", + "consents": [ + "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", + "cnst_VCmucIvAsmDYw2PPAok6bcYy" + ], + "created_at": "2022-04-13T09:12:47.743Z", + "updated_at": "2022-04-13T09:45:46.616Z", + "object": "consent_group" }, - "total_amount": { - "type": "integer", - "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" + { + "id": "cnstgr_EAIakTj5lNG2ZpiQEauGqBlY", + "name": "Consent group 2", + "description": "Consent group 2", + "consents": [ + "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", + "cnst_VCmucIvAsmDYw2PPAok6bcYy" + ], + "created_at": "2022-04-13T10:03:46.564Z", + "updated_at": null, + "object": "consent_group" + } + ], + "total": 2 + }, + "consents": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", + "name": "Consent", + "description": "Consent for marketing", + "category": "New", + "created_at": "2022-04-13T09:11:27.037Z", + "updated_at": null, + "object": "consent" }, + { + "id": "cnst_VCmucIvAsmDYw2PPAok6bcYy", + "name": "Consent 2", + "description": "Consent 2", + "category": "Trial", + "created_at": "2022-04-13T09:45:37.597Z", + "updated_at": null, + "object": "consent" + } + ], + "total": 2 + } + } + ], + "title": "List Consents Response Body", + "properties": { + "groups": { + "type": "object", + "description": "Contains marketing permission groups' definitions.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "Stores information about marketing permission groups." + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of marketing permission groups." + }, + "data": { + "type": "array", + "description": "An array of marketing permission groups.", "items": { - "type": "array", - "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", - "items": { - "type": "object", - "properties": { - "object": { - "type": "string", - "default": "order_item", - "description": "The type of object represented by JSON. This object stores information about the `order_item`." - }, - "product_id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "sku_id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "quantity": { - "type": "integer", - "description": "Quantity of the item in the cart." - }, - "amount": { - "type": "integer", - "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." - }, - "discount_amount": { - "type": "integer", - "description": "The item-level discount applied to the item." - }, - "price": { - "type": "integer", - "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - }, - "subtotal_amount": { - "type": "integer", - "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" - }, - "product": { - "type": "object", - "description": "This object stores more information about the related product.", - "properties": { - "id": { - "type": "string", - "example": "prod_5h0wc453_1", - "description": "A unique identifier that represents the product and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "description": "A unique product identifier from your inventory system.", - "example": "illy-arabica" - }, - "name": { - "type": "string", - "example": "Brewing System", - "description": "Product name." - }, - "price": { - "type": "integer", - "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - }, - "sku": { - "type": "object", - "description": "This object stores more information about the related SKU.", - "properties": { - "id": { - "type": "string", - "example": "sku_prod_5h0wc453_1_1", - "description": "A unique identifier that represents the SKU and is assigned by Voucherify." - }, - "source_id": { - "type": "string", - "example": "illy-arabica-250g", - "description": "A unique SKU identifier from your inventory system." - }, - "sku": { - "type": "string", - "description": "SKU name." - }, - "price": { - "type": "integer", - "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." - } - } - } - } - } - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are attached to an order object. Stores additional information about the order in a structured format." - }, - "customer": { "type": "object", - "description": "Object containing information about the customer that is making the purchase.", + "additionalProperties": false, + "description": "Contains a marketing permission group's definition.", "properties": { "id": { "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique customer ID of the customer making the purchase." + "example": "cnstgr_3c7Z3rcOLv51bsXlRtTZPYj8", + "description": "Unique group ID." + }, + "name": { + "type": "string", + "description": "Marketing permission group name." + }, + "description": { + "type": "string", + "description": "Marketing permission group category." + }, + "consents": { + "type": "array", + "description": "List of consents that are assigned to the group.", + "items": { + "type": "string" + } + }, + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-04-13T09:12:47.743Z", + "description": "Timestamp representing the date and time when the group was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-05-14T09:11:27.037Z", + "description": "Timestamp representing the date and time when the group was updated in ISO 8601 format." }, "object": { "type": "string", - "default": "customer", - "description": "Type of object represented by the `customer` object." + "default": "consent_group", + "description": "Stores information about a marketing permission group." } } - }, - "referrer": { + } + }, + "total": { + "type": "integer", + "description": "Total number of groups." + } + } + }, + "consents": { + "type": "object", + "description": "Contains opt-in consents' definitions.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "Stores information about opt-in consents." + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of opt-in consents." + }, + "data": { + "type": "array", + "description": "An array of consents.", + "items": { "type": "object", - "description": "Object containing information about the referrer.", + "additionalProperties": false, + "description": "Contains an opt-in consent definition.", "properties": { "id": { "type": "string", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", - "description": "Unique referrer ID, who referred the customer making the purchase." + "example": "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", + "description": "Unique consent ID." }, - "object": { + "name": { "type": "string", - "default": "customer", - "description": "Type of object represented by the referrer object." - } - } - }, - "customer_id": { - "type": "string", - "description": "Unique customer ID of the customer making the purchase.", - "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" - }, - "referrer_id": { - "type": "string", - "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "description": "Unique referrer ID." - }, - "object": { - "type": "string", - "default": "order", - "description": "The type of object represented by JSON. This object stores information about the `order`." - } - } - }, - "23_obj_qualification_object_stacking_rules": { - "type": "object", - "title": "Examine Qualification Stacking Rules", - "description": "Defines stacking rules for the redeemables.", - "properties": { - "redeemables_limit": { - "type": "integer", - "description": "Defines how many redeemables can be sent with one stacking request. We have extended the maximum value from 5 to 30 (comment: but more redeemables means more processing time!). Default limit is `30`.", - "default": 30 - }, - "applicable_redeemables_limit": { - "type": "integer", - "description": "Defines how many of sent redeemables will be actually applied to the order (e.g. user can select 30 discounts but only 5 will be applied to the order, the remaining will be marked as SKIPPED). Default limit is `5`.", - "default": 5 - } - } - }, - "23_req_create_qualification": { - "type": "object", - "title": "Examine Qualification Request Body", - "description": "Request body schema for examining a qualification`.", - "properties": { - "customer": { - "anyOf": [ - { - "$ref": "#/components/schemas/23_req_create_qualification_customer_id" + "description": "Consent name." }, - { - "$ref": "#/components/schemas/23_req_create_qualification_customer_source_id" + "description": { + "type": "string", + "description": "Consent description." }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ], - "description": "Customer's information." - }, - "order": { - "anyOf": [ - { - "$ref": "#/components/schemas/23_req_create_qualification_order_id" + "category": { + "type": "string", + "description": "Consent category." }, - { - "$ref": "#/components/schemas/23_req_create_qualification_order_source_id" + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-04-13T09:11:27.037Z", + "description": "Timestamp representing the date and time when the consent was created in ISO 8601 format." }, - { - "$ref": "#/components/schemas/10_req_create_order" + "updated_at": { + "type": "string", + "format": "date-time", + "example": "2022-05-14T09:11:27.037Z", + "description": "Timestamp representing the date and time when the consent was updated in ISO 8601 format." + }, + "object": { + "type": "string", + "default": "consent", + "description": "Stores information about an opt-in consent." } - ], - "description": "Order information. This object enables you to pass purchase transaction data. Read what properties you can use in the [Order object](ref:get-order)." - }, - "options": { - "type": "object", - "description": "Configure parameters returned in the response.", - "properties": { - "expand": { - "type": "array", - "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. \n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"redeemable\"] | - Returns the redeemables' metadata. |\n| [\"category\"] | - Returns an expanded `categories` object, showing details about the category. |", - "items": { + } + } + }, + "total": { + "type": "integer", + "description": "Total number of consents." + } + } + } + } + }, + "20_res_list_categories": { + "type": "object", + "title": "List Categories Response Body", + "description": "Response schema for **GET** `/categories`.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. This object stores information about categories in a dictionary." + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of category objects.", + "default": "data" + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/20_obj_category_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of categories." + } + } + }, + "20_obj_category_object": { + "type": "object", + "title": "Category Object", + "description": "This is an object representing a category.", + "x-tags": [ + "CATEGORIES API" + ], + "properties": { + "id": { + "type": "string", + "description": "Unique category ID assigned by Voucherify." + }, + "name": { + "type": "string", + "description": "Category name." + }, + "hierarchy": { + "type": "integer", + "description": "Category hierarchy." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the category was created in ISO 8601 format.", + "example": "2022-07-14T10:45:13.156Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2022-08-16T10:52:08.094Z", + "description": "Timestamp representing the date and time when the category was updated in ISO 8601 format.", + "format": "date-time" + }, + "object": { + "type": "string", + "default": "category", + "description": "The type of object represented by the JSON. This object stores information about the category." + } + }, + "examples": [ + { + "id": "cat_0b60cfe7d0d7ddbb55", + "name": "Update", + "hierarchy": 1, + "created_at": "2022-07-14T10:45:13.156Z", + "updated_at": "2022-08-16T11:03:54.727Z", + "object": "category" + } + ] + }, + "20_req_update_categories_categoryId": { + "type": "object", + "title": "Update Category Request Body", + "description": "Request schema for updating a category using **PUT** `/categories/{categoryId}`.", + "properties": { + "name": { + "type": "string", + "description": "Category name." + }, + "hierarchy": { + "type": "integer", + "description": "Category hierarchy." + } + }, + "required": [ + "name", + "hierarchy" + ] + }, + "20_req_create_category": { + "type": "object", + "title": "Create Category Request Body", + "description": "Request schema for creating a category using **POST** `/categories`.", + "properties": { + "name": { + "type": "string", + "description": "Category name." + }, + "hierarchy": { + "type": "integer", + "description": "Category hierarchy." + } + }, + "required": [ + "name", + "hierarchy" + ] + }, + "20_res_create_category": { + "type": "object", + "title": "Category Object", + "description": "This is an object representing a newly created category.", + "properties": { + "id": { + "type": "string", + "description": "Unique category ID assigned by Voucherify." + }, + "name": { + "type": "string", + "description": "Category name." + }, + "hierarchy": { + "type": "integer", + "description": "Category hierarchy." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the category was created in ISO 8601 format.", + "example": "2022-07-14T10:45:13.156Z", + "format": "date-time" + }, + "object": { + "type": "string", + "default": "category", + "description": "The type of object represented by the JSON. This object stores information about the category." + } + } + }, + "21_obj_metadata_schema_object": { + "type": "object", + "title": "Metadata Schema Object", + "description": "This is an object representing a metadata schema.", + "properties": { + "id": { + "type": "string", + "description": "Unique metadata schema ID.", + "example": "ms_OF36L2rk4EqhdxvZs56IW9iE" + }, + "related_object": { + "type": "string", + "description": "The resource type. There is an infinite number of possibilities for the resource type because you can define custom metadata schemas. Some examples are included here to show you the standard metadata schema resource types.", + "enum": [ + "campaign", + "customer", + "earning_rule", + "loyalty_tier", + "order", + "order_item", + "product", + "promotion_tier", + "publication", + "redemption", + "reward", + "voucher" + ] + }, + "properties": { + "description": "Contains the metadata definitions. There can be many properties within this object.", + "anyOf": [ + { + "properties": { + "custom_property_name": { + "type": "object", + "description": "Custom property name. This is defined in **Project Settings** > **Metadata Schema** in the Dashboard.", + "properties": { + "type": { "type": "string", "enum": [ - "redeemable", - "category" + "string", + "number", + "object", + "date", + "datetime", + "geopoint", + "boolean", + "image_url" ] + }, + "array": { + "type": "boolean", + "description": "Indicates whether the definition is an array." + }, + "optional": { + "type": "boolean", + "description": "Indicates whether this definition is optional or not optional for the resource." + }, + "objectType": { + "type": [ + "string", + "null" + ], + "description": "Returns the name of the custom resource if the resource was previously defined in the Dashboard as a custom (non-standard) Nested object." + }, + "eq": { + "type": "array", + "description": "Array of possible values when the setting for `is equal to any of` in the Dashboard is defined explicitly.", + "items": {} + }, + "ne": { + "type": "array", + "description": "Array of values that are not allowed when the setting for `is not equal to any of` in the Dashboard is defined explicitly.", + "items": {} + }, + "lt": { + "type": "integer", + "description": "A property of `number` type must have `less than` this value." + }, + "lte": { + "type": "integer", + "description": "A property of `number` type must be `less than or equal` to this value." + }, + "gt": { + "type": "integer", + "description": "A property of `number` type must be `greater than` this value." + }, + "gte": { + "type": "integer", + "description": "A property of `number` type must be `greater than or equal` to this value." + }, + "deleted": { + "type": "boolean", + "description": "Indicates whether the definition was deleted from the schema." + }, + "maxLength": { + "type": "integer", + "description": "Value for maximum length when the setting for `has maximum length of` in the Dashboard is defined explicitly." + }, + "minLength": { + "type": "integer", + "description": "Value indicating minimum length when the setting for `has minimum length of` in the Dashboard is defined explicitly." + }, + "exactLength": { + "type": "integer", + "description": "Value indicating exact length when the setting for `has exact length of` in the Dashboard is defined explicitly." } - }, - "limit": { - "type": "integer", - "description": "The maximum number of redeemables to be returned in the API request. The actual number of returned redeemables will be determined by the API. The default value is set to 5, and the maximum value is 50.", - "maximum": 50 - }, - "starting_after": { - "type": "string", - "example": "2021-09-08T13:52:18.227Z", - "format": "date-time", - "description": "Curser used for paging." - }, - "filters": { - "description": "A set of fiters to return only a specific category or type of redeemable.", - "anyOf": [ - { - "$ref": "#/components/schemas/23_obj_filter_resource_type" - }, - { - "$ref": "#/components/schemas/23_obj_filter_category_id" - } - ] } } - }, - "metadata": { - "type": "object", - "description": "A set of key/value pairs that you can send in the request body to check against redeemables requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the [Create Validation Rules](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." - }, - "mode": { - "type": "string", - "description": "Defines which resources Voucherify will use. Currently, `BASIC` is supported." - }, - "scenario": { - "type": "string", - "description": "Defines the scenario Voucherify should consider during the qualification process.\n\n- `ALL` - Scenario that returns all redeemables available for the customer in one API request.\n- `CUSTOMER_WALLET` - returns vouchers applicable to the customer’s cart based on the vouchers assigned to the customer’s profile.\n- `AUDIENCE_ONLY` - returns all vouchers, promotion tiers, and campaigns available to the customer. Voucherify validates the rules based on the customer profile only.\n- `PRODUCTS` - returns all promotions available for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule).\n- `PRODUCTS_DISCOUNT` - returns all promotions available for products when a discount is defined as applicable to specific item(s).\n- `PROMOTION_STACKS` - returns the applicable promotion stacks.\n- `PRODUCTS_BY_CUSTOMER` - returns all promotions available for a customer for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule).\n- `PRODUCTS_DISCOUNT_BY_CUSTOMER` - returns all promotions available for a customer for products when a discount is defined as applicable to specific item(s).", - "enum": [ - "ALL", - "CUSTOMER_WALLET", - "AUDIENCE_ONLY", - "PRODUCTS", - "PRODUCTS_DISCOUNT", - "PROMOTION_STACKS", - "PRODUCTS_BY_CUSTOMER", - "PRODUCTS_DISCOUNT_BY_CUSTOMER" - ] } } + ], + "type": "object" + }, + "allow_defined_only": { + "type": "boolean", + "description": "Restricts the creation of metadata fields when set to `true`. In other words, it indicates whether or not you are allowed to create new metadata definitions; for example, in the campaign manager or publication manager. If it is set to true, then only the defined fields will be available for assigning values.\t" + }, + "created_at": { + "type": "string", + "example": "2021-12-03T13:33:44.556Z", + "description": "Timestamp representing the date and time when the metadata schema was created in ISO 8601 format.\t", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2022-08-11T08:05:30.695Z", + "description": "Timestamp representing the date and time when the metadata schema was updated in ISO 8601 format.\t", + "format": "date-time" + }, + "object": { + "type": "string", + "default": "metadata_schema", + "description": "The type of object represented by the JSON. This object stores information about the metadata schema." + } + }, + "x-tags": [ + "METADATA SCHEMAS API" + ], + "examples": [ + { + "id": "ms_27vMXZqBAkkqBoOuw8EYTRLn", + "related_object": "earning_rule", + "properties": { + "channel_id": { + "type": "string", + "array": true, + "optional": true, + "objectType": null, + "exactLength": 5 + }, + "channel_name": { + "eq": [ + "instagram", + "facebook", + "google", + "twitter", + "linkedin", + "website" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + } }, - "23_req_create_qualification_customer_id": { - "title": "Customer ID", - "description": "You can pass the unique customer ID that was assigned by Voucherify.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The ID of an existing customer that will be linked to redemption in this request.", - "example": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" - } + "allow_defined_only": false, + "created_at": "2022-08-25T13:09:59.970Z", + "updated_at": "2022-08-25T13:11:15.704Z", + "object": "metadata_schema" + }, + { + "id": "ms_psGSDpVl6JcPilPA7toZ83Kj", + "related_object": "campaign", + "properties": { + "region": { + "eq": [ + "EMEA", + "AMER", + "APAC" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null } }, - "23_req_create_qualification_customer_source_id": { - "title": "Customer Source ID", - "description": "You can send the source ID that you used to create the customer in Voucherify.", - "type": "object", - "properties": { - "source_id": { - "type": "string", - "description": "A unique identifier of a customer. It can be a customer ID or email from a CRM system, database or 3rd-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored." - } + "allow_defined_only": false, + "created_at": "2022-08-25T13:12:58.447Z", + "updated_at": null, + "object": "metadata_schema" + }, + { + "id": "ms_f0r4hm3ta6a4a5ch3ma", + "related_object": "customer", + "properties": { + "age": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "city_id": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "location": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "favorite_brands": { + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "acquisition_channel": { + "eq": [ + "Facebook", + "Twitter", + "Website" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "customer_life_time_value": { + "type": "number", + "array": false, + "optional": true, + "objectType": null } }, - "23_req_create_qualification_order_id": { - "title": "Order ID", - "description": "You can pass the unique order ID that was assigned by Voucherify.", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request." - } + "allow_defined_only": false, + "created_at": "2021-12-01T08:00:48.889Z", + "updated_at": "2022-09-12T07:34:49.163Z", + "object": "metadata_schema" + }, + { + "id": "ms_jHUoFlgepKVEftxK1pKPGZlO", + "related_object": "loyalty_tier", + "properties": { + "level_name": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "audience_restricted": { + "type": "boolean", + "array": false, + "optional": true, + "objectType": null } }, - "23_req_create_qualification_order_source_id": { - "title": "Order Source ID", - "description": "You can send the source ID that you used to create the order in Voucherify.", - "type": "object", - "properties": { - "source_id": { - "type": "string", - "description": "Unique source ID of an existing order that will be linked to the redemption of this request." - } + "allow_defined_only": false, + "created_at": "2022-08-25T13:14:54.954Z", + "updated_at": "2022-08-25T13:15:24.436Z", + "object": "metadata_schema" + }, + { + "id": "ms_f1r5Tm3ta6a4a5ch3ma", + "related_object": "order", + "properties": { + "card": { + "eq": [ + "Visa", + "MasterCard", + "Other" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "currency": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "location": { + "ne": [ + 1, + 2, + 18, + 22 + ], + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "store_city": { + "eq": [ + "Hampden", + "San Francisco", + "Warsaw" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "location_id": { + "eq": [ + "L1", + "L2", + "L3" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "payment_mean": { + "eq": [ + "credit-card", + "wire-transfer", + "paypal" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "booking_end_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + }, + "booking_start_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null } }, - "23_obj_filter_resource_type": { - "description": "Filter conditions set on the resource `type`. The resource types include: `voucher`, `promotion_tier`, `campaign`.", - "title": "Filter by type", - "type": "object", - "properties": { - "resource_type": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } + "allow_defined_only": false, + "created_at": "2021-12-01T08:00:47.575Z", + "updated_at": "2022-10-25T10:05:18.978Z", + "object": "metadata_schema" + }, + { + "id": "ms_7ux44AEnt82bqo8ww5V1SXzV", + "related_object": "order_item", + "properties": { + "manufacturer_id": { + "gte": 15, + "type": "number", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-08-25T13:16:03.167Z", + "updated_at": null, + "object": "metadata_schema" + }, + { + "id": "ms_s3c0N6m3ta6a4a5ch3ma", + "related_object": "product", + "properties": { + "vendor": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "category": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "location": { + "type": "geopoint", + "array": false, + "optional": true, + "objectType": null } }, - "23_obj_filter_category_id": { - "description": "Filter conditions set on the resource `category_id`.", - "title": "Filter by category ID", - "type": "object", - "properties": { - "category_id": { - "$ref": "#/components/schemas/16_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } + "allow_defined_only": false, + "created_at": "2021-12-01T08:00:48.298Z", + "updated_at": "2022-07-14T15:53:29.226Z", + "object": "metadata_schema" + }, + { + "id": "ms_dNb5aLMzU0VBCiRuxLOeMNwn", + "related_object": "promotion_tier", + "properties": { + "level": { + "type": "string", + "array": false, + "optional": true, + "objectType": null } }, - "23_obj_qualification_redeemables": { - "title": "Redeemables", - "type": "object", - "description": "List or redeemables for examine qualification.", - "properties": { - "object": { - "type": "string", - "default": "list", - "description": "The type of object represented by JSON. Default is `list`." - }, - "data_ref": { - "type": "string", - "default": "data", - "description": "Identifies the name of the attribute that contains the array of qualified redeemables." - }, - "data": { - "type": "array", - "description": "Array of qualified redeemables.", - "items": { - "allOf": [] - } - }, - "total": { - "type": "integer", - "example": 5, - "description": "The number of redeemables returned in the API request." - }, - "has_more": { - "type": "boolean", - "description": "As results are always limited, the `has_more` flag indicates whether there are more records for given parameters. This let's you know if you are able to run another request (with different options) to get more records returned in the results." - } + "allow_defined_only": false, + "created_at": "2022-01-24T10:42:04.937Z", + "updated_at": "2022-09-23T08:51:46.266Z", + "object": "metadata_schema" + }, + { + "id": "ms_fzvWNh7sU4LeykEQ2Abpg6jG", + "related_object": "publication", + "properties": { + "file_uploaded": { + "type": "image_url", + "array": false, + "optional": true, + "objectType": null + }, + "publication_method": { + "type": "string", + "array": false, + "optional": true, + "objectType": null } }, - "LoyaltiesGetPointsExpirationResponseBody": { - "title": "Loyalties Get Points Expiration Response Body", - "type": "object", - "properties": { - "object": { - "type": "string", - "pattern": "list", - "enum": [ - "list" - ], - "description": "The type of object represented by JSON. This object stores information about loyalty points expiration buckets in a dictionary." - }, - "data_ref": { - "type": "string", - "pattern": "data", - "enum": [ - "data" - ], - "description": "Identifies the name of the attribute that contains the array of loyalty points expiration bucket objects." - }, - "data": { - "type": "array", - "description": "Contains array of loyalty points expiration buckets.", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique loyalty points bucket ID." - }, - "voucher_id": { - "type": "string", - "description": "Unique parent loyalty card ID." - }, - "campaign_id": { - "type": "string", - "description": "\nUnique parent campaign ID." - }, - "bucket": { - "type": "object", - "required": [ - "total_points" - ], - "description": "Defines the number of points stored in the given loyalty points bucket.", - "properties": { - "total_points": { - "type": "integer", - "description": "Total number of points in the loyalty points bucket." - } - } - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the loyalty points bucket object was created in ISO 8601 format.", - "format": "date-time" - }, - "status": { - "type": "string", - "description": "Loyalty points bucket point status." - }, - "expires_at": { - "type": "string", - "format": "date-time", - "description": "Date when the number of points defined in the bucket object are due to expire." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the loyalty points bucket object was updated in ISO 8601 format." - }, - "object": { - "type": "string", - "pattern": "loyalty_points_bucket", - "enum": [ - "loyalty_points_bucket" - ], - "description": "The type of object represented by JSON. This object stores information about the loyalty points bucket." - } - }, - "required": [ - "id", - "voucher_id", - "campaign_id", - "bucket", - "created_at", - "status", - "expires_at", - "object" - ] - } - }, - "total": { - "type": "integer", - "description": "Total number of point expiration buckets." - } + "allow_defined_only": false, + "created_at": "2022-08-25T13:16:35.534Z", + "updated_at": "2022-09-12T10:26:31.135Z", + "object": "metadata_schema" + }, + { + "id": "ms_t4ir0Dm3ta6a4a5ch3ma", + "related_object": "redemption", + "properties": { + "location_id": { + "eq": [ + "L1", + "L2", + "L3" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null }, - "required": [ - "object", - "data_ref", - "data", - "total" - ] + "redemption_location": { + "type": "object", + "array": false, + "optional": true, + "objectType": "Location" + } }, - "LoyaltiesGetEarningRuleResponseBody": { - "$ref": "#/components/schemas/EarningRule" + "allow_defined_only": false, + "created_at": "2021-12-01T08:00:48.794Z", + "updated_at": "2022-08-25T13:19:50.497Z", + "object": "metadata_schema" + }, + { + "id": "ms_PwrAtwqCFXeH4Qix22gEkqhl", + "related_object": "reward", + "properties": { + "reward_type": { + "eq": [ + "MATERIAL", + "PAY-WITH-POINTS", + "DISCOUNT-COUPON", + "GIFT-CARD-CREDITS", + "LOYALTY POINTS" + ], + "type": "string", + "array": false, + "optional": false, + "objectType": null + } }, - "LoyaltiesEnableEarningRulesResponseBody": { - "allOf": [ - { - "$ref": "#/components/schemas/EarningRuleBase" + "allow_defined_only": true, + "created_at": "2022-08-25T13:07:13.689Z", + "updated_at": "2022-08-25T13:08:26.696Z", + "object": "metadata_schema" + }, + { + "id": "ms_9uE6eP17Jvoxl46mCqL6Q3Ut", + "related_object": "voucher", + "properties": { + "lang": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "Season": { + "eq": [ + "Spring", + "Summer", + "Fall", + "Winter" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "marketing_text": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "ProductionVoucherCodeMetaData": { + "type": "string", + "array": false, + "deleted": true, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-01-24T10:42:23.994Z", + "updated_at": "2022-09-19T14:13:30.590Z", + "object": "metadata_schema" + } + ] + }, + "21_res_list_metadata_shemas": { + "title": "List Metadata Schemas Response Body", + "type": "object", + "description": "Response schema for listing metadata schemas using **GET** `/metadata-schemas`.", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about metadata schemas in a dictionary.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of metadata schema objects.", + "default": "schemas" + }, + "schemas": { + "type": "array", + "description": "Array of metadata schema objects.", + "items": { + "$ref": "#/components/schemas/21_obj_metadata_schema_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of metadata schemas." + } + }, + "examples": [ + { + "object": "list", + "data_ref": "schemas", + "schemas": [ + { + "id": "ms_yqMHRHH6S1KYIHPmQHealNf4", + "related_object": "Payment", + "properties": { + "payment_tax": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "payment_method": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + } }, - { - "type": "object", - "properties": { - "updated_at": { - "type": [ - "string", - "null" - ], - "format": "date-time", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format." - }, - "active": { - "type": "boolean", - "default": true, - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date." - } + "allow_defined_only": true, + "created_at": "2022-03-07T11:01:01.747Z", + "updated_at": "2022-03-07T11:01:44.785Z", + "object": "metadata_schema" + }, + { + "id": "ms_DwUjpX32sY3fJEoQELpS7bN3", + "related_object": "campaign", + "properties": { + "Store": { + "type": "string", + "array": false, + "deleted": true, + "optional": true, + "objectType": null + }, + "locale": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "date_tag": { + "type": "date", + "array": false, + "optional": true, + "objectType": null + }, + "store_names": { + "eq": [ + "Store 1 - New York - Broadway", + "Store 2 - Florida - Miami", + "Store 3 - London - Heathrow", + "Store 4 - Berlin - Alexanderplatz" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "date_time_tag": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + }, + "favorite_brands": { + "type": "string", + "array": true, + "deleted": true, + "optional": true, + "objectType": null + }, + "height_customer_number": { + "type": "number", + "array": false, + "optional": true, + "objectType": null }, - "required": [ - "updated_at", - "active" - ] - } - ] - }, - "LoyaltiesDisableEarningRulesResponseBody": { - "allOf": [ - { - "$ref": "#/components/schemas/EarningRuleBase" + "location_country_string": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + } }, - { - "type": "object", - "properties": { - "updated_at": { - "type": [ - "string", - "null" - ], - "format": "date-time", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format." - }, - "active": { - "type": "boolean", - "default": false, - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date." - } + "allow_defined_only": false, + "created_at": "2021-12-03T13:33:44.556Z", + "updated_at": "2022-07-26T13:57:42.288Z", + "object": "metadata_schema" + }, + { + "id": "ms_f0r4hm3ta6a4a5ch3ma", + "related_object": "customer", + "properties": { + "birth_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null }, - "required": [ - "updated_at", - "active" - ] - } - ] - }, - "EarningRuleBase": { - "title": "EarningRuleBase", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Assigned by the Voucherify API, identifies the earning rule object." - }, - "created_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format." + "CRM_created_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + }, + "customer_location": { + "type": "geopoint", + "array": false, + "optional": true, + "objectType": null + }, + "acquisition_channel": { + "eq": [ + "Facebook", + "Twitter", + "Website" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "customer_life_time_value": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + } }, - "loyalty": { - "anyOf": [ - { - "$ref": "#/components/schemas/EarningRuleFixed" - }, - { - "$ref": "#/components/schemas/EarningRuleProportional" - } - ] + "allow_defined_only": false, + "created_at": "2021-12-03T06:33:45.894Z", + "updated_at": "2022-07-14T15:15:34.928Z", + "object": "metadata_schema" + }, + { + "id": "ms_7X7krsG84H6MeNuIaKkb4LXN", + "related_object": "earning_rule", + "properties": { + "Type": { + "type": "string", + "array": false, + "optional": true, + "minLength": 6, + "objectType": null + } }, - "event": { - "$ref": "#/components/schemas/EarningRuleEvent", - "description": "Defines the event which triggers the earning rule to add points to a loyalty card." + "allow_defined_only": false, + "created_at": "2022-07-27T08:54:07.980Z", + "updated_at": null, + "object": "metadata_schema" + }, + { + "id": "ms_OF36L2rk4EqhdxvZs56IW9iE", + "related_object": "loyalty_tier", + "properties": { + "has_funds": { + "type": "boolean", + "array": false, + "optional": true, + "objectType": null + } }, - "custom_event": { - "type": "object", - "properties": { - "schema_id": { - "type": "string" - } + "allow_defined_only": false, + "created_at": "2022-03-30T06:22:16.685Z", + "updated_at": "2022-07-27T08:55:01.628Z", + "object": "metadata_schema" + }, + { + "id": "ms_f1r5Tm3ta6a4a5ch3ma", + "related_object": "order", + "properties": { + "Payment": { + "type": "object", + "array": false, + "deleted": true, + "optional": true, + "objectType": "Payment" }, - "required": [ - "schema_id" - ] - }, - "segment": { - "type": "object", - "description": "Contains the id of a customer segment. Required for the customer.segment.entered option in event.", - "properties": { - "id": { - "type": "string", - "description": "Contains a unique identifier of a customer segment. Assigned by the Voucherify API." - } + "day_of_week": { + "type": "number", + "array": false, + "optional": true, + "objectType": null }, - "required": [ - "id" - ] - }, - "source": { - "type": "object", - "required": [ - "object_id", - "object_type" - ], - "description": "Contains the custom earning rule name and parent campaign.", - "properties": { - "banner": { - "type": "string", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - }, - "object_id": { - "type": "string", - "description": "A unique campaign identifier assigned by the Voucherify API." - }, - "object_type": { - "type": "string", - "description": "Defines the object associated with the earning rule. Defaults to `campaign`.", - "enum": [ - "campaign" - ] - } + "location_id": { + "eq": [ + "L1", + "L2", + "L3" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "payment_mean": { + "eq": [ + "credit-card", + "wire-transfer", + "paypal" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "booking_end_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + }, + "booking_start_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + }, + "number_of_store_visits": { + "type": "number", + "array": false, + "optional": true, + "objectType": null } }, - "object": { - "type": "string", - "enum": [ - "earning_rule" - ], - "description": "The type of object represented by JSON. Default is earning_rule." + "allow_defined_only": false, + "created_at": "2021-12-03T06:33:45.798Z", + "updated_at": "2022-04-20T06:47:10.350Z", + "object": "metadata_schema" + }, + { + "id": "ms_0qgIlxP7bYb8H59DqpnWBCUN", + "related_object": "order_item", + "properties": { + "Size": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "Color": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "Thickness": { + "eq": [ + "Thin", + "Medium", + "Thick" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + } }, - "automation_id": { - "type": "string", - "description": "For internal use by Voucherify." + "allow_defined_only": false, + "created_at": "2022-03-11T13:32:55.029Z", + "updated_at": "2022-05-23T13:46:01.463Z", + "object": "metadata_schema" + }, + { + "id": "ms_s3c0N6m3ta6a4a5ch3ma", + "related_object": "product", + "properties": { + "color": { + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "origin": { + "type": "string", + "array": false, + "optional": true, + "minLength": 1, + "objectType": null + }, + "product_location": { + "type": "geopoint", + "array": false, + "optional": true, + "objectType": null + }, + "metadata_attribute_name_with_date_property": { + "type": "date", + "array": false, + "optional": true, + "objectType": null + }, + "metadata_attribute_name_with_number_property": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "metadata_attribute_name_with_boolean_property": { + "type": "boolean", + "array": false, + "optional": true, + "objectType": null + }, + "metadata_attribute_name_with_datetime_property": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + } }, - "start_date": { - "type": "string", - "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is inactive before this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default." + "allow_defined_only": false, + "created_at": "2021-12-03T06:33:45.880Z", + "updated_at": "2022-07-14T15:46:47.994Z", + "object": "metadata_schema" + }, + { + "id": "ms_th8YHt9yFYY1yAA99XOasT5W", + "related_object": "promotion_tier", + "properties": { + "has_budget": { + "type": "boolean", + "array": false, + "optional": true, + "objectType": null + } }, - "expiration_date": { - "type": "string", - "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is inactive after this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + "allow_defined_only": false, + "created_at": "2022-01-24T07:22:21.523Z", + "updated_at": "2022-07-27T08:54:42.909Z", + "object": "metadata_schema" + }, + { + "id": "ms_Z7niydc0OpGjDRL4yB40niXn", + "related_object": "publication", + "properties": { + "year": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + } }, - "validity_timeframe": { - "type": "object", - "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.start_date required when including the `validity_timeframe`.", - "properties": { - "duration": { - "type": "string", - "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a duration of PT1H will be valid for a duration of one hour." - }, - "interval": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an interval of P2D will be valid every other day." - } + "allow_defined_only": false, + "created_at": "2022-03-30T06:23:49.715Z", + "updated_at": "2022-04-19T10:28:24.568Z", + "object": "metadata_schema" + }, + { + "id": "ms_t4ir0Dm3ta6a4a5ch3ma", + "related_object": "redemption", + "properties": { + "location_id": { + "eq": [ + "L1", + "L2", + "L3" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null }, - "required": [ - "duration", - "interval" - ] + "store_names": { + "eq": [ + "Store 1 - New York - Broadway", + "Store 2 - Florida - Miami", + "Store 3 - London - Heathrow", + "Store 4 - Berlin - Alexanderplatz" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + } }, - "validity_day_of_week": { - "type": "array", - "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday\n- `1` Monday\n- `2` Tuesday\n- `3` Wednesday\n- `4` Thursday\n- `5` Friday\n- `6` Saturday", - "items": { - "type": "integer", - "minimum": 0, - "maximum": 6 + "allow_defined_only": false, + "created_at": "2021-12-03T06:33:45.890Z", + "updated_at": "2022-07-26T14:58:24.546Z", + "object": "metadata_schema" + }, + { + "id": "ms_EnSASZVEIDsZAYa8Z0nG8Rlg", + "related_object": "reward", + "properties": { + "Type": { + "type": "string", + "array": false, + "optional": true, + "objectType": null, + "exactLength": 4 } }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." - } + "allow_defined_only": false, + "created_at": "2022-07-27T08:53:32.257Z", + "updated_at": "2022-07-27T08:53:48.542Z", + "object": "metadata_schema" }, - "required": [ - "id", - "created_at", - "loyalty", - "source", - "object", - "automation_id", - "metadata" - ] - }, - "EarningRuleEvent": { - "title": "EarningRuleEvent", - "type": "string", - "enum": [ - "order.paid", - "customer.segment.entered", - "custom_event", - "customer.loyalty.tier.upgraded", - "customer.loyalty.tier.downgraded", - "customer.loyalty.tier.prolonged", - "customer.loyalty.tier.joined", - "customer.loyalty.tier.left" - ] - }, - "EarningRuleFixed": { - "title": "Define fixed amount of points", - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "FIXED" - ], - "description": "The number of points to be added to the loyalty card." + { + "id": "ms_xUHvkRBPvVJAlWcTkVzufKx4", + "related_object": "voucher", + "properties": { + "unit": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "Region": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "Season": { + "eq": [ + "Spring", + "Summer", + "Fall", + "Winter" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "CATEGORY": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "active_on_calendar_month": { + "eq": [ + 1, + 2, + 3, + 5, + 7, + 9, + 10, + 11, + 12 + ], + "type": "number", + "array": false, + "optional": true, + "objectType": null + } }, - "points": { - "type": "integer", - "description": "Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points." - } + "allow_defined_only": false, + "created_at": "2022-01-24T07:22:01.281Z", + "updated_at": "2022-06-22T07:22:09.577Z", + "object": "metadata_schema" } - }, - "EarningRuleProportionalOrder": { - "anyOf": [ - { - "$ref": "#/components/schemas/EarningRuleProportionalOrderAmount" - }, - { - "$ref": "#/components/schemas/EarningRuleProportionalOrderTotalAmount" - }, - { - "$ref": "#/components/schemas/EarningRuleProportionalOrderMetadata" - } - ], - "title": "Order" - }, - "EarningRuleProportionalOrderAmount": { - "title": "Order Amount", - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "PROPORTIONAL" - ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." - }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_AMOUNT" - ], - "description": "`ORDER_AMOUNT`: Pre-discount order amount (X points for every Y spent excluding discounts)" - }, - "order": { - "type": "object", - "required": [ - "amount" - ], - "properties": { - "amount": { - "type": "object", - "required": [ - "every", - "points" - ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", - "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - } - } - } + ], + "total": 13 + } + ] + }, + "22_res_list_locations": { + "title": "List Locations Response Body", + "type": "object", + "description": "Response schema for listing locations using **GET** `/locations`.", + "properties": { + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about locations in a dictionary.", + "default": "list" + }, + "data_ref": { + "type": "string", + "description": "Identifies the name of the attribute that contains the array of metadata schema objects.", + "default": "data" + }, + "data": { + "type": "array", + "description": "Array of location objects.", + "items": { + "$ref": "#/components/schemas/22_obj_location_object" + } + }, + "total": { + "type": "integer", + "description": "Total number of locations." + }, + "has_more": { + "type": "boolean", + "description": "As query results are always limited (by the limit parameter), the `has_more` flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different end date filter) to get more records returned in the results." + } + }, + "examples": [ + { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "loc_NoMGXmHO9OUs7iz9mGWpamma", + "object": "location", + "name": "Belleville", + "shape": { + "type": "circle", + "format": "distance", + "distance": { + "center": "geo:40.79372699823857,-74.15092132694554", + "radius": "1.54 km" } - } - }, - "required": [ - "type", - "calculation_type", - "order" - ] - }, - "EarningRuleProportionalOrderTotalAmount": { - "title": "Order Total Amount", - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "PROPORTIONAL" - ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." - }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_TOTAL_AMOUNT" - ], - "description": "`ORDER_TOTAL_AMOUNT`: Total order amount (X points for every Y spent including discount)" }, - "order": { - "type": "object", - "required": [ - "total_amount" - ], - "properties": { - "total_amount": { - "type": "object", - "required": [ - "every", - "points" - ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", - "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - } - } - } - } - } + "created_at": "2022-07-15T06:04:36.924Z", + "updated_at": null }, - "required": [ - "type", - "calculation_type", - "order" - ] - }, - "EarningRuleProportionalOrderMetadata": { - "title": "Order Metadata", - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "PROPORTIONAL" - ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + { + "id": "loc_ae2gKWpAFMsuRhyMqGx2FZFF", + "object": "location", + "name": "New York", + "shape": { + "type": "polygon", + "format": "geojson", + "geojson": { + "type": "Polygon", + "coordinates": [ + [ + [ + -74.016167, + 40.703186 + ], + [ + -74.008687, + 40.750656 + ], + [ + -73.943597, + 40.851838 + ], + [ + -73.928559, + 40.845285 + ], + [ + -73.936152, + 40.8356 + ], + [ + -73.934298, + 40.810015 + ], + [ + -73.92711, + 40.795145 + ], + [ + -73.978623, + 40.710432 + ], + [ + -74.013201, + 40.701619 + ], + [ + -74.016167, + 40.703186 + ] + ] + ] + } }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_METADATA" - ], - "description": "`ORDER_METADATA`: Order Metadata (X points for every Y in metadata attribute, defined in the property key under the order.metadata object)" + "created_at": "2022-07-15T05:37:45.299Z", + "updated_at": null + }, + { + "id": "loc_f5HqjVaiq7g9ISlmivpytxSf", + "object": "location", + "name": "Germany", + "shape": { + "type": "circle", + "format": "distance", + "distance": { + "center": "geo:51.303908897065064,10.222253628401518", + "radius": "192.37 km" + } }, - "order": { - "type": "object", - "required": [ - "metadata" - ], - "description": "Defines the formula for calculating points proportionally.", - "properties": { - "metadata": { - "type": "object", - "required": [ - "every", - "points", - "property" - ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points.", - "properties": { - "every": { - "type": "integer", - "description": "For how many increments of the order metadata property to grant points for." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - }, - "property": { - "type": "string", - "description": "Order metadata property." - } - } - } + "created_at": "2022-07-14T15:51:39.265Z", + "updated_at": null + }, + { + "id": "loc_RcYz537sV07e1t5aG5tIH9FD", + "object": "location", + "name": "Poland", + "shape": { + "type": "polygon", + "format": "geojson", + "geojson": { + "type": "Polygon", + "coordinates": [ + [ + [ + 18.553923, + 50.559107 + ], + [ + 18.528805, + 51.087437 + ], + [ + 19.591667, + 50.832424 + ], + [ + 19.425109, + 50.497984 + ], + [ + 19.375814, + 50.330652 + ], + [ + 19.398107, + 50.111652 + ], + [ + 18.73906, + 49.981498 + ], + [ + 18.272477, + 50.088707 + ], + [ + 18.553923, + 50.559107 + ] + ] + ] } - } + }, + "created_at": "2022-07-14T15:21:55.085Z", + "updated_at": null + } + ], + "total": 4, + "has_more": false + } + ] + }, + "22_obj_location_object": { + "title": "Location object", + "type": "object", + "description": "This is an object representing a location.", + "x-tags": [ + "LOCATIONS API" + ], + "properties": { + "id": { + "type": "string", + "description": "Unique location ID, assigned by the Voucherify API.", + "example": "loc_NoMGXmHO9OUs7iz9mGWpamma" + }, + "object": { + "type": "string", + "description": "The type of object represented by JSON. This object stores information about a `location`.", + "default": "location" + }, + "name": { + "type": "string", + "description": "Location name." + }, + "shape": { + "type": "object", + "description": "Defines the shape and boundaries of the location.", + "anyOf": [ + { + "$ref": "#/components/schemas/22_obj_location_object_shape_circle" }, - "required": [ - "type", - "calculation_type", - "order" - ] - }, - "EarningRuleProportionalOrderItemsQuantity": { - "title": "Order Items Quantity", + { + "$ref": "#/components/schemas/22_obj_location_object_shape_polygon" + } + ] + }, + "created_at": { + "type": "string", + "example": "2022-02-14T15:12:06.817Z", + "description": "Timestamp representing the date and time when the location was created in ISO 8601 format.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2022-03-14T15:12:06.817Z", + "description": "Timestamp representing the date and time when the location was updated in ISO 8601 format.", + "format": "date-time" + } + } + }, + "22_obj_location_object_shape_circle": { + "title": "Circle", + "type": "object", + "description": "This is an object representing a circular shape.", + "properties": { + "type": { + "type": "string", + "description": "The type of shape being defined is a `circle`.", + "default": "circle" + }, + "format": { + "type": "string", + "description": "The location is defined in terms of a `distance` object.", + "default": "distance" + }, + "distance": { + "type": "object", + "title": "Distance", + "description": "Defines the parameters for the circle.", + "properties": { + "center": { + "type": "string", + "description": "Center of the circle identified by GPS coordinates in decimal degrees.", + "example": "geo:40.79372699823857,-74.15092132694554" + }, + "radius": { + "type": "string", + "description": "Defines the radius of the circle." + } + } + } + } + }, + "22_obj_location_object_shape_polygon": { + "title": "Polygon", + "type": "object", + "description": "This is an object representing a polygon.", + "properties": { + "type": { + "type": "string", + "description": "The type of shape being defined is a `polygon`.", + "default": "polygon" + }, + "format": { + "type": "string", + "description": "The location is defined in terms of a `geojson` object.", + "default": "geojson" + }, + "distance": { + "type": "object", + "title": "Geojson", + "description": "Defines the parameters for the polygon.", + "properties": { + "type": { + "type": "string", + "description": "Type of geojson coordinates, i.e. `Polygon`.", + "default": "Polygon" + }, + "coordinates": { + "type": "array", + "description": "Contains array of GeoJSON coordinate arrays.", + "items": { + "$ref": "#/components/schemas/22_geojson_array" + } + } + } + } + } + }, + "22_geojson_array": { + "title": "GeoJSON coordinate array.", + "type": "array", + "description": "GeoJSON coordinate array.", + "items": { + "$ref": "#/components/schemas/22_geojson_coordinates" + } + }, + "22_geojson_coordinates": { + "title": "GeoJSON coordinate.", + "type": "array", + "description": "GeoJSON coordinate.", + "items": { + "type": "integer" + } + }, + "22_filter_updated_at": { + "type": "object", + "title": "Updated at", + "properties": { + "updated_at": { + "$ref": "#/components/schemas/16_filter_conditions_date_time" + } + }, + "description": "A filter on the list based on the object `updated_at` field. The value is a dictionary with the following options: `before`, `after`. A date value must be presented in ISO 8601 format (`2016-11-16T14:14:31Z` or `2016-11-16`). An example: `[updated_at][before]=2017-09-08T13:52:18.227Z`" + }, + "22_filter_created_at": { + "type": "object", + "title": "Created at", + "properties": { + "created_at": { + "$ref": "#/components/schemas/16_filter_conditions_date_time" + } + }, + "description": "A filter on the list based on the object `created_at` field. The value is a dictionary with the following options: `before`, `after`. A date value must be presented in ISO 8601 format (`2016-11-16T14:14:31Z` or `2016-11-16`). An example: `[created_at][before]=2017-09-08T13:52:18.227Z`" + }, + "22_filter_name": { + "type": "object", + "title": "Name", + "properties": { + "name": { + "$ref": "#/components/schemas/16_filter_conditions_string" + } + }, + "description": "A filter on the list based on the name field." + }, + "22_filter_id": { + "type": "object", + "title": "ID", + "properties": { + "id": { + "$ref": "#/components/schemas/16_filter_conditions_string" + } + }, + "description": "A filter on the list based on the id of the location." + }, + "23_obj_qualification_object": { + "title": "Qualification object", + "type": "object", + "description": "This is an object representing a qualification.", + "x-tags": [ + "QUALIFICATIONS API" + ], + "properties": { + "redeemables": { + "$ref": "#/components/schemas/23_obj_qualification_redeemables" + }, + "tracking_id": { + "type": "string", + "description": "This identifier is generated during voucher qualification based on your internal id (e.g., email, database ID). This is a hashed customer source ID." + }, + "order": { + "type": "object", + "description": "The order object sent in the request.", + "$ref": "#/components/schemas/23_obj_order_object" + }, + "stacking_rules": { + "$ref": "#/components/schemas/23_obj_qualification_object_stacking_rules" + } + } + }, + "23_obj_order_object": { + "type": "object", + "title": "Order object", + "description": "This is an object representing an order. \n\nThe purchase transactions can be tracked in Voucherify by the creation of an order object. You can create, retrieve, and pay individual orders, as well as list and export all of them in a CSV format. Orders are identified by a unique ID.\n\nOrders are automatically created during the [redeem voucher](ref:redeem-voucher) and [redeem promotion](redeem-promotion) call.\n\n\n> #### order.id and order session\n>\n> If you use the same order.id in more than one redemption request, all valid discounts provided in the redemption payload will be applied to the given order.\n> \n> Each time you use particular order in your requests, the API will automatically trigger a new session linked to the order.id. The session is active during the request and ends asynchronously after the request is completed. The session mechanism ensures that the particular order.id can be used in one API request at once.", + "x-tags": [ + "ORDERS API" + ], + "properties": { + "id": { + "type": "string", + "description": "Unique order ID, assigned by Voucherify.", + "example": "ord_GFDbbv2I0wnO0sFUBOOOXPj2" + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the order was created in ISO 8601 format.", + "example": "2022-03-09T11:19:04.819Z", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "example": "2022-08-12T13:34:10.681Z", + "description": "Timestamp representing the date and time when the order was updated in ISO 8601 format.", + "format": "date-time" + }, + "status": { + "type": "string", + "description": "Order status.", + "enum": [ + "CREATED", + "PAID", + "CANCELED", + "FULFILLED" + ] + }, + "amount": { + "type": "integer", + "description": "Order amount before applying any discount." + }, + "discount_amount": { + "type": "integer", + "description": "Sum of all order-level discounts applied to the order." + }, + "items_discount_amount": { + "type": "integer", + "description": "Sum of all product-specific discounts applied to the order. \n`sum(items, i => i.discount_amount)`" + }, + "total_discount_amount": { + "type": "integer", + "description": "Sum of all order-level AND all product-specific discounts applied to the order. \n`total_discount_amount` = `discount_amount` + `items_discount_amount`\t" + }, + "total_amount": { + "type": "integer", + "description": "Order amount after applying all the discounts. \n`total_amount` = `amount` - `total_discount_amount`" + }, + "items": { + "type": "array", + "description": "Array of order items that have been applied to the order. Each order item can show the effects of particular discounts on the item-level.", + "items": { "type": "object", "properties": { - "type": { + "object": { "type": "string", - "enum": [ - "PROPORTIONAL" - ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + "default": "order_item", + "description": "The type of object represented by JSON. This object stores information about the `order_item`." }, - "calculation_type": { + "product_id": { "type": "string", - "enum": [ - "ORDER_ITEMS_QUANTITY" - ], - "description": "`ORDER_ITEMS_QUANTITY`: Quantity of items defined in order_items.quantity.object & .id (X points for every Y items excluding free items)" + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." }, - "order_items": { - "type": "object", - "required": [ - "quantity" - ], - "properties": { - "quantity": { - "type": "object", - "required": [ - "every", - "points", - "object", - "id" - ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", - "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - }, - "object": { - "type": "string", - "description": "Type of object taken under consideration.", - "enum": [ - "products_collection", - "product", - "sku" - ] - }, - "id": { - "type": "string", - "description": "Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619." - } - } - } - } - } - }, - "required": [ - "type", - "calculation_type", - "order_items" - ] - }, - "EarningRuleProportionalOrderItemsAmount": { - "title": "Order Items Amount", - "type": "object", - "properties": { - "type": { + "sku_id": { "type": "string", - "enum": [ - "PROPORTIONAL" - ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_ITEMS_AMOUNT" - ], - "description": "ORDER_ITEMS_AMOUNT; Pre-discount amount spent on items defined in the order_items.amount.object & .id (X points for every Y spent on items excluding discounts)" + "quantity": { + "type": "integer", + "description": "Quantity of the item in the cart." }, - "order_items": { - "type": "object", - "required": [ - "amount" - ], - "properties": { - "amount": { - "type": "object", - "required": [ - "every", - "points", - "object", - "id" - ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", - "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - }, - "object": { - "type": "string", - "description": "Type of object taken under consideration.", - "enum": [ - "products_collection", - "product", - "sku" - ] - }, - "id": { - "type": "string", - "description": "Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619." - } - } - } - } - } - }, - "required": [ - "type", - "calculation_type", - "order_items" - ] - }, - "EarningRuleProportionalOrderItemsSubtotalAmount": { - "title": "Order Items Subtotal Amount", - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "PROPORTIONAL" - ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + "amount": { + "type": "integer", + "description": "Represents a total pre-discount amount of order item (`price` * `quantity`)." }, - "calculation_type": { - "type": "string", - "enum": [ - "ORDER_ITEMS_SUBTOTAL_AMOUNT" - ], - "description": "ORDER_ITEMS_SUBTOTAL_AMOUNT; Amount spent on items defined in the order_items.subtotal_amount.object & .id (X points for every Y spent on items including discounts)" + "discount_amount": { + "type": "integer", + "description": "The item-level discount applied to the item." }, - "order_items": { - "type": "object", - "required": [ - "subtotal_amount" - ], - "properties": { - "subtotal_amount": { - "type": "object", - "required": [ - "every", - "points", - "object", - "id" - ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", - "properties": { - "every": { - "type": "integer", - "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - }, - "object": { - "type": "string", - "description": "Type of object taken under consideration.", - "enum": [ - "products_collection", - "product", - "sku" - ] - }, - "id": { - "type": "string", - "description": "Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619." - } - } - } - } - } - }, - "required": [ - "type", - "calculation_type", - "order_items" - ] - }, - "EarningRuleProportionalCustomerMetadata": { - "title": "Customer Metadata", - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "PROPORTIONAL" - ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + "price": { + "type": "integer", + "description": "Unit price of an item. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." }, - "calculation_type": { - "type": "string", - "enum": [ - "CUSTOMER_METADATA" - ], - "description": "CUSTOMER_METADATA: Customer Metadata (X points for every Y in metadata attribute, defined in the property key under the customer.metadata object)" + "subtotal_amount": { + "type": "integer", + "description": "Final order item amount after the applied item-level discount. If there are no item-level discounts applied, this item is equal to the `amount`. \n`subtotal_amount`=`amount`-`discount_amount`" }, - "customer": { + "product": { "type": "object", - "required": [ - "metadata" - ], + "description": "This object stores more information about the related product.", "properties": { - "metadata": { - "type": "object", - "required": [ - "every", - "points", - "property" - ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points.", - "properties": { - "every": { - "type": "integer", - "description": "For how many increments of the customer metadata property to grant points for." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - }, - "property": { - "type": "string", - "description": "Customer metadata property." - } - } + "id": { + "type": "string", + "example": "prod_5h0wc453_1", + "description": "A unique identifier that represents the product and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "description": "A unique product identifier from your inventory system.", + "example": "illy-arabica" + }, + "name": { + "type": "string", + "example": "Brewing System", + "description": "Product name." + }, + "price": { + "type": "integer", + "description": "Unit price of a product. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." } } - } - }, - "required": [ - "type", - "calculation_type", - "customer" - ] - }, - "EarningRuleProportionalCustomEvent": { - "title": "Custom Event", - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "PROPORTIONAL" - ], - "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." - }, - "calculation_type": { - "type": "string", - "enum": [ - "CUSTOM_EVENT_METADATA" - ], - "description": "CUSTOM_EVENT_METADATA: Custom event metadata (X points for every Y in metadata attribute)." }, - "custom_event": { + "sku": { "type": "object", - "required": [ - "metadata" - ], + "description": "This object stores more information about the related SKU.", "properties": { - "metadata": { - "type": "object", - "required": [ - "every", - "points", - "property" - ], - "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points.", - "properties": { - "every": { - "type": "integer", - "description": "For how many increments of the customer metadata property to grant points for." - }, - "points": { - "type": "integer", - "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." - }, - "property": { - "type": "string", - "description": "\nCustom event metadata property." - } - } + "id": { + "type": "string", + "example": "sku_prod_5h0wc453_1_1", + "description": "A unique identifier that represents the SKU and is assigned by Voucherify." + }, + "source_id": { + "type": "string", + "example": "illy-arabica-250g", + "description": "A unique SKU identifier from your inventory system." + }, + "sku": { + "type": "string", + "description": "SKU name." + }, + "price": { + "type": "integer", + "description": "Unit price of a SKU. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 is written as 10000." } } } + } + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are attached to an order object. Stores additional information about the order in a structured format." + }, + "customer": { + "type": "object", + "description": "Object containing information about the customer that is making the purchase.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique customer ID of the customer making the purchase." }, - "required": [ - "type", - "calculation_type", - "custom_event" - ] - }, - "EarningRuleProportional": { - "anyOf": [ - { - "$ref": "#/components/schemas/EarningRuleProportionalOrder" - }, - { - "$ref": "#/components/schemas/EarningRuleProportionalOrderItems" - }, - { - "$ref": "#/components/schemas/EarningRuleProportionalCustomerMetadata" - }, - { - "$ref": "#/components/schemas/EarningRuleProportionalCustomEvent" - } - ], - "title": "Calculate points proportionally" - }, - "EarningRuleProportionalOrderItems": { - "anyOf": [ - { - "$ref": "#/components/schemas/EarningRuleProportionalOrderItemsQuantity" - }, - { - "$ref": "#/components/schemas/EarningRuleProportionalOrderItemsAmount" - }, - { - "$ref": "#/components/schemas/EarningRuleProportionalOrderItemsSubtotalAmount" - } - ], - "title": "Order Items" - }, - "LoyaltiesListMemberRewardsRequestQuery": { - "title": "Loyalties List Member Rewards Request Query", - "type": "object", - "properties": { - "affordable_only": { - "type": "string" - }, - "limit": { - "type": "integer" - }, - "page": { - "type": "integer" - } + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the `customer` object." } - }, - "LoyaltiesGetPointsExpirationRequestQuery": { - "title": "Loyalties Get Points Expiration Request Query", - "type": "object", - "properties": { - "limit": { - "type": "integer", - "minimum": 1, - "multipleOf": 100 - }, - "page": { - "type": "integer" - } + } + }, + "referrer": { + "type": "object", + "description": "Object containing information about the referrer.", + "properties": { + "id": { + "type": "string", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1", + "description": "Unique referrer ID, who referred the customer making the purchase." + }, + "object": { + "type": "string", + "default": "customer", + "description": "Type of object represented by the referrer object." } - }, - "LoyaltiesListCardTransactionsRequestQuery": { - "title": "Loyalties List Card Transactions Request Query", - "type": "object", - "properties": { - "limit": { - "type": "integer", - "minimum": 1, - "multipleOf": 100 - }, - "page": { - "type": "integer" - } + } + }, + "customer_id": { + "type": "string", + "description": "Unique customer ID of the customer making the purchase.", + "example": "cust_7iUa6ICKyU6gH40dBU25kQU1" + }, + "referrer_id": { + "type": "string", + "example": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "description": "Unique referrer ID." + }, + "object": { + "type": "string", + "default": "order", + "description": "The type of object represented by JSON. This object stores information about the `order`." + } + } + }, + "23_obj_qualification_object_stacking_rules": { + "type": "object", + "title": "Examine Qualification Stacking Rules", + "description": "Defines stacking rules for the redeemables.", + "properties": { + "redeemables_limit": { + "type": "integer", + "description": "Defines how many redeemables can be sent with one stacking request. We have extended the maximum value from 5 to 30 (comment: but more redeemables means more processing time!). Default limit is `30`.", + "default": 30 + }, + "applicable_redeemables_limit": { + "type": "integer", + "description": "Defines how many of sent redeemables will be actually applied to the order (e.g. user can select 30 discounts but only 5 will be applied to the order, the remaining will be marked as SKIPPED). Default limit is `5`.", + "default": 5 + } + } + }, + "23_req_create_qualification": { + "type": "object", + "title": "Examine Qualification Request Body", + "description": "Request body schema for examining a qualification`.", + "properties": { + "customer": { + "anyOf": [ + { + "$ref": "#/components/schemas/23_req_create_qualification_customer_id" + }, + { + "$ref": "#/components/schemas/23_req_create_qualification_customer_source_id" + }, + { + "$ref": "#/components/schemas/9_req_create_customer" } - }, - "LoyaltiesListCardTransactionsResponseBody": { - "title": "Loyalties List Card Transactions Response Body", - "type": "object", - "properties": { - "object": { - "type": "string", - "pattern": "list", - "enum": [ - "list" - ], - "description": "The type of object represented by JSON." - }, - "data_ref": { - "type": "string", - "pattern": "data", - "enum": [ - "data" - ], - "description": "Identifies the name of the attribute that contains the array of transaction objects." - }, - "data": { - "type": "array", - "description": "A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object.", - "items": { - "$ref": "#/components/schemas/LoyaltyCardTransaction" - } - }, - "has_more": { - "type": "boolean", - "description": "As query results are always limited (by the limit parameter), the has_more flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results." - } + ], + "description": "Customer's information." + }, + "order": { + "anyOf": [ + { + "$ref": "#/components/schemas/23_req_create_qualification_order_id" }, - "required": [ - "object", - "data_ref", - "data", - "has_more" - ] - }, - "LoyaltyCardTransactionsType": { - "type": "string", - "enum": [ - "POINTS_ACCRUAL", - "POINTS_CANCELLATION", - "POINTS_REDEMPTION", - "POINTS_REFUND", - "POINTS_ADDITION", - "POINTS_REMOVAL", - "POINTS_EXPIRATION", - "POINTS_TRANSFER_IN", - "POINTS_TRANSFER_OUT" - ] - }, - "SimpleLoyaltyVoucher": { - "title": "Simple Loyalty Voucher", - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "code": { - "type": "string" - }, - "loyalty_card": { - "type": "object", - "required": [ - "points", - "balance" - ], - "properties": { - "points": { - "type": "string" - }, - "balance": { - "type": "string" - }, - "next_expiration_date": { - "type": "string" - }, - "next_expiration_points": { - "type": "string" - } - } - }, - "type": { - "type": "string", - "enum": [ - "LOYALTY_CARD" - ] - }, - "campaign": { - "type": "string" - }, - "campaign_id": { - "type": "string" - }, - "is_referral_code": { - "type": "boolean" - }, - "holder_id": { - "type": "string" - }, - "referrer_id": { - "type": "string" - }, - "created_at": { - "type": "string" - }, - "object": { + { + "$ref": "#/components/schemas/23_req_create_qualification_order_source_id" + }, + { + "$ref": "#/components/schemas/10_req_create_order" + } + ], + "description": "Order information. This object enables you to pass purchase transaction data. Read what properties you can use in the [Order object](ref:get-order)." + }, + "options": { + "type": "object", + "description": "Configure parameters returned in the response.", + "properties": { + "expand": { + "type": "array", + "description": "Expand array lets you configure params included in the response. Depending on the strings included in the array, the response will contain different details. \n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"redeemable\"] | - Returns the redeemables' metadata. |\n| [\"category\"] | - Returns an expanded `categories` object, showing details about the category. |", + "items": { "type": "string", - "pattern": "voucher", "enum": [ - "voucher" + "redeemable", + "category" ] } }, - "required": [ - "id", - "code", - "loyalty_card", - "type", - "campaign", - "campaign_id", - "object" - ] - }, - "LoyaltyCardTransaction": { - "title": "Loyalty Card Transaction", + "limit": { + "type": "integer", + "description": "The maximum number of redeemables to be returned in the API request. The actual number of returned redeemables will be determined by the API. The default value is set to 5, and the maximum value is 50.", + "maximum": 50 + }, + "starting_after": { + "type": "string", + "example": "2021-09-08T13:52:18.227Z", + "format": "date-time", + "description": "Curser used for paging." + }, + "filters": { + "description": "A set of fiters to return only a specific category or type of redeemable.", + "anyOf": [ + { + "$ref": "#/components/schemas/23_obj_filter_resource_type" + }, + { + "$ref": "#/components/schemas/23_obj_filter_category_id" + } + ] + } + } + }, + "metadata": { + "type": "object", + "description": "A set of key/value pairs that you can send in the request body to check against redeemables requiring **redemption** metadata validation rules to be satisfied. The validation runs against rules that are defined through the [Create Validation Rules](ref: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](https://support.voucherify.io/article/148-how-to-build-a-rule)." + }, + "mode": { + "type": "string", + "description": "Defines which resources Voucherify will use. Currently, `BASIC` is supported." + }, + "scenario": { + "type": "string", + "description": "Defines the scenario Voucherify should consider during the qualification process.\n\n- `ALL` - Scenario that returns all redeemables available for the customer in one API request.\n- `CUSTOMER_WALLET` - returns vouchers applicable to the customer’s cart based on the vouchers assigned to the customer’s profile.\n- `AUDIENCE_ONLY` - returns all vouchers, promotion tiers, and campaigns available to the customer. Voucherify validates the rules based on the customer profile only.\n- `PRODUCTS` - returns all promotions available for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule).\n- `PRODUCTS_DISCOUNT` - returns all promotions available for products when a discount is defined as applicable to specific item(s).\n- `PROMOTION_STACKS` - returns the applicable promotion stacks.\n- `PRODUCTS_BY_CUSTOMER` - returns all promotions available for a customer for the products (when a discount is defined to be applied to the item or when the item is required in the validation rule).\n- `PRODUCTS_DISCOUNT_BY_CUSTOMER` - returns all promotions available for a customer for products when a discount is defined as applicable to specific item(s).", + "enum": [ + "ALL", + "CUSTOMER_WALLET", + "AUDIENCE_ONLY", + "PRODUCTS", + "PRODUCTS_DISCOUNT", + "PROMOTION_STACKS", + "PRODUCTS_BY_CUSTOMER", + "PRODUCTS_DISCOUNT_BY_CUSTOMER" + ] + } + } + }, + "23_req_create_qualification_customer_id": { + "title": "Customer ID", + "description": "You can pass the unique customer ID that was assigned by Voucherify.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "The ID of an existing customer that will be linked to redemption in this request.", + "example": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" + } + } + }, + "23_req_create_qualification_customer_source_id": { + "title": "Customer Source ID", + "description": "You can send the source ID that you used to create the customer in Voucherify.", + "type": "object", + "properties": { + "source_id": { + "type": "string", + "description": "A unique identifier of a customer. It can be a customer ID or email from a CRM system, database or 3rd-party service. If you also pass a customer ID (unique ID assigned by Voucherify), the source ID will be ignored." + } + } + }, + "23_req_create_qualification_order_id": { + "title": "Order ID", + "description": "You can pass the unique order ID that was assigned by Voucherify.", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique ID assigned by Voucherify of an existing order that will be linked to the redemption of this request." + } + } + }, + "23_req_create_qualification_order_source_id": { + "title": "Order Source ID", + "description": "You can send the source ID that you used to create the order in Voucherify.", + "type": "object", + "properties": { + "source_id": { + "type": "string", + "description": "Unique source ID of an existing order that will be linked to the redemption of this request." + } + } + }, + "23_obj_filter_resource_type": { + "description": "Filter conditions set on the resource `type`. The resource types include: `voucher`, `promotion_tier`, `campaign`.", + "title": "Filter by type", + "type": "object", + "properties": { + "resource_type": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "23_obj_filter_category_id": { + "description": "Filter conditions set on the resource `category_id`.", + "title": "Filter by category ID", + "type": "object", + "properties": { + "category_id": { + "$ref": "#/components/schemas/16_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "23_obj_qualification_redeemables": { + "title": "Redeemables", + "type": "object", + "description": "List or redeemables for examine qualification.", + "properties": { + "object": { + "type": "string", + "default": "list", + "description": "The type of object represented by JSON. Default is `list`." + }, + "data_ref": { + "type": "string", + "default": "data", + "description": "Identifies the name of the attribute that contains the array of qualified redeemables." + }, + "data": { + "type": "array", + "description": "Array of qualified redeemables.", + "items": { + "allOf": [] + } + }, + "total": { + "type": "integer", + "example": 5, + "description": "The number of redeemables returned in the API request." + }, + "has_more": { + "type": "boolean", + "description": "As results are always limited, the `has_more` flag indicates whether there are more records for given parameters. This let's you know if you are able to run another request (with different options) to get more records returned in the results." + } + } + }, + "LoyaltiesGetPointsExpirationResponseBody": { + "title": "Loyalties Get Points Expiration Response Body", + "type": "object", + "properties": { + "object": { + "type": "string", + "pattern": "list", + "enum": [ + "list" + ], + "description": "The type of object represented by JSON. This object stores information about loyalty points expiration buckets in a dictionary." + }, + "data_ref": { + "type": "string", + "pattern": "data", + "enum": [ + "data" + ], + "description": "Identifies the name of the attribute that contains the array of loyalty points expiration bucket objects." + }, + "data": { + "type": "array", + "description": "Contains array of loyalty points expiration buckets.", + "items": { "type": "object", "properties": { "id": { "type": "string", - "description": "Unique transaction ID." - }, - "source_id": { - "type": [ - "string", - "null" - ], - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is null." + "description": "Unique loyalty points bucket ID." }, "voucher_id": { "type": "string", - "description": "Unique voucher ID." + "description": "Unique parent loyalty card ID." }, "campaign_id": { "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes." - }, - "source": { - "type": [ - "string", - "null" - ], - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is null." - }, - "reason": { - "type": [ - "string", - "null" - ], - "description": "Reason why the transaction occurred. In case of a redemption, this value is null." + "description": "\nUnique parent campaign ID." }, - "type": { - "$ref": "#/components/schemas/LoyaltyCardTransactionsType", - "description": "Type of transaction." - }, - "details": { + "bucket": { "type": "object", - "description": "Contains the detailed information about the transaction.", + "required": [ + "total_points" + ], + "description": "Defines the number of points stored in the given loyalty points bucket.", "properties": { - "balance": { - "type": "object", - "description": "Contains information on how the balance was affected by the transaction.", - "properties": { - "type": { - "type": "string", - "pattern": "loyalty_card", - "enum": [ - "loyalty_card" - ], - "description": "The type of voucher whose balance is being adjusted due to the transaction." - }, - "total": { - "type": "integer", - "description": "The available points prior to the transaction." - }, - "object": { - "type": "string", - "pattern": "balance", - "enum": [ - "balance" - ], - "description": "The type of object represented by the JSON." - }, - "points": { - "type": "integer", - "description": "The amount of points being used up in the transaction." - }, - "balance": { - "type": "integer", - "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." - }, - "related_object": { - "type": "object", - "required": [ - "id", - "type" - ], - "description": "Defines the resource that is being modified with the values that are returned in the balance object.", - "properties": { - "id": { - "type": "string", - "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API." - }, - "type": { - "type": "string", - "pattern": "voucher", - "enum": [ - "voucher" - ], - "description": "The object being modified, i.e. voucher." - } - } - } - }, - "required": [ - "type", - "total", - "object", - "points", - "balance", - "related_object" - ] - }, - "order": { - "type": "object", - "description": "Contains information about the original order.", - "properties": { - "id": { - "type": "string", - "description": "Unique order ID." - }, - "source_id": { - "type": "string", - "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." - } - }, - "required": [ - "id", - "source_id" - ] - }, - "event": { - "type": "object", - "description": "Contains information about the event that triggers the point accrual.", - "properties": { - "id": { - "type": "string", - "description": "Unique event ID." - }, - "type": { - "type": "string", - "description": "Type of event." - } - }, - "required": [ - "id", - "type" - ] - }, - "earning_rule": { - "type": "object", - "description": "Contains information about the earning rule.", - "properties": { - "id": { - "type": "string", - "description": "Unique earning rule ID." - }, - "source": { - "type": "object", - "required": [ - "banner" - ], - "description": "Contains the custom earning rule name.", - "properties": { - "banner": { - "type": "string", - "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." - } - } - } - }, - "required": [ - "id", - "source" - ] - }, - "segment": { - "type": "object", - "description": "Contains information about the segment.", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "required": [ - "id", - "name" - ] - }, - "loyalty_tier": { - "type": "object", - "description": "Contains information about the loyalty tier.", - "properties": { - "id": { - "type": "string" - }, - "name": { - "type": "string" - } - }, - "required": [ - "id", - "name" - ] - }, - "redemption": { - "type": "object", - "description": "Contains information about the original redemption.", - "properties": { - "id": { - "type": "string", - "description": "Unique redemption ID." - } - }, - "required": [ - "id" - ] - }, - "rollback": { - "type": "object", - "description": "Contains information about the redemption rollback.", - "properties": { - "id": { - "type": "string", - "description": "Unique redemption rollback ID." - } - }, - "required": [ - "id" - ] - }, - "custom_event": { - "type": "object", - "description": "Contains information about the custom event that triggers the point accrual.", - "properties": { - "id": { - "type": "string", - "description": "Unique event ID." - }, - "type": { - "type": "string", - "description": "Type of custom event." - } - }, - "required": [ - "id", - "type" - ] - }, - "event_schema": { - "type": "object", - "description": "Contains information about the custom event metadata schema.", - "properties": { - "id": { - "type": "string", - "description": "Unique metadata schema ID." - }, - "name": { - "type": "string", - "description": "Type of custom event." - } - }, - "required": [ - "id", - "name" - ] - }, - "reward": { - "type": "object", - "description": "Contains information about the pay with points reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique reward ID." - }, - "name": { - "type": "string", - "description": "Reward name." - } - }, - "required": [ - "id", - "name" - ] - }, - "source_voucher": { - "$ref": "#/components/schemas/SimpleLoyaltyVoucher", - "description": "Contains information on how the balance on the donor loyalty card was affected by the transaction." - }, - "destination_voucher": { - "$ref": "#/components/schemas/SimpleLoyaltyVoucher", - "description": "Contains information on how the balance on the receiving loyalty card was affected by the transaction." + "total_points": { + "type": "integer", + "description": "Total number of points in the loyalty points bucket." } } }, - "related_transaction_id": { - "type": [ - "string", - "null" - ], - "description": "The related transaction ID on the receiving card." - }, "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the loyalty points bucket object was created in ISO 8601 format.", + "format": "date-time" + }, + "status": { + "type": "string", + "description": "Loyalty points bucket point status." + }, + "expires_at": { + "type": "string", + "format": "date-time", + "description": "Date when the number of points defined in the bucket object are due to expire." + }, + "updated_at": { "type": "string", "format": "date-time", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format.\n\n" + "description": "Timestamp representing the date and time when the loyalty points bucket object was updated in ISO 8601 format." + }, + "object": { + "type": "string", + "pattern": "loyalty_points_bucket", + "enum": [ + "loyalty_points_bucket" + ], + "description": "The type of object represented by JSON. This object stores information about the loyalty points bucket." } }, "required": [ "id", - "source_id", "voucher_id", "campaign_id", - "source", - "reason", - "type", - "details", - "related_transaction_id", - "created_at" - ] - }, - "LoyaltyCardTransactionsFields": { - "type": "string", - "enum": [ - "id", - "campaign_id", - "voucher_id", - "type", - "source_id", - "reason", - "source", - "balance", - "amount", - "related_transaction_id", + "bucket", "created_at", - "details" + "status", + "expires_at", + "object" ] + } + }, + "total": { + "type": "integer", + "description": "Total number of point expiration buckets." + } + }, + "required": [ + "object", + "data_ref", + "data", + "total" + ] + }, + "LoyaltiesGetEarningRuleResponseBody": { + "$ref": "#/components/schemas/EarningRule" + }, + "LoyaltiesEnableEarningRulesResponseBody": { + "allOf": [ + { + "$ref": "#/components/schemas/EarningRuleBase" + }, + { + "type": "object", + "properties": { + "updated_at": { + "type": [ + "string", + "null" + ], + "format": "date-time", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format." + }, + "active": { + "type": "boolean", + "default": true, + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date." + } }, - "LoyaltiesExportCardTransactionsRequestBody": { - "title": "Loyalties Export Card Transactions Request Body", - "type": "object", - "properties": { - "order": { - "type": "string", - "enum": [ - "created_at", - "-created_at" - ], - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/LoyaltyCardTransactionsFields" + "required": [ + "updated_at", + "active" + ] + } + ] + }, + "LoyaltiesDisableEarningRulesResponseBody": { + "allOf": [ + { + "$ref": "#/components/schemas/EarningRuleBase" + }, + { + "type": "object", + "properties": { + "updated_at": { + "type": [ + "string", + "null" + ], + "format": "date-time", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format." + }, + "active": { + "type": "boolean", + "default": false, + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date." + } + }, + "required": [ + "updated_at", + "active" + ] + } + ] + }, + "EarningRuleBase": { + "title": "EarningRuleBase", + "x-stoplight": { + "id": "w4ci1ljqva0r1" + }, + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Assigned by the Voucherify API, identifies the earning rule object." + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the earning rule was created in ISO 8601 format." + }, + "loyalty": { + "anyOf": [ + { + "$ref": "#/components/schemas/EarningRuleFixed" + }, + { + "$ref": "#/components/schemas/EarningRuleProportional" + } + ] + }, + "event": { + "$ref": "#/components/schemas/EarningRuleEvent", + "description": "Defines the event which triggers the earning rule to add points to a loyalty card." + }, + "custom_event": { + "type": "object", + "properties": { + "schema_id": { + "type": "string" + } + }, + "required": [ + "schema_id" + ] + }, + "segment": { + "type": "object", + "description": "Contains the id of a customer segment. Required for the customer.segment.entered option in event.", + "properties": { + "id": { + "type": "string", + "description": "Contains a unique identifier of a customer segment. Assigned by the Voucherify API." + } + }, + "required": [ + "id" + ] + }, + "source": { + "type": "object", + "required": [ + "object_id", + "object_type" + ], + "description": "Contains the custom earning rule name and parent campaign.", + "properties": { + "banner": { + "type": "string", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." + }, + "object_id": { + "type": "string", + "description": "A unique campaign identifier assigned by the Voucherify API." + }, + "object_type": { + "type": "string", + "description": "Defines the object associated with the earning rule. Defaults to `campaign`.", + "enum": [ + "campaign" + ] + } + } + }, + "object": { + "type": "string", + "enum": [ + "earning_rule" + ], + "description": "The type of object represented by JSON. Default is earning_rule." + }, + "automation_id": { + "type": "string", + "description": "For internal use by Voucherify." + }, + "start_date": { + "type": "string", + "description": "Start date defines when the earning rule starts to be active. Activation timestamp in ISO 8601 format. Earning rule is inactive before this date. If you don't define the start date for an earning rule, it'll inherit the campaign start date by default." + }, + "expiration_date": { + "type": "string", + "description": "Expiration date defines when the earning rule expires. Expiration timestamp in ISO 8601 format. Earning rule is inactive after this date.If you don't define the expiration date for an earning rule, it'll inherit the campaign expiration date by default." + }, + "validity_timeframe": { + "type": "object", + "description": "Set recurrent time periods when the earning rule is valid. For example, valid for 1 hour every other day.start_date required when including the `validity_timeframe`.", + "properties": { + "duration": { + "type": "string", + "description": "Defines the amount of time an earning rule will be active in ISO 8601 format. For example, an earning rule with a duration of PT1H will be valid for a duration of one hour." + }, + "interval": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, an earning rule with an interval of P2D will be valid every other day." + } + }, + "required": [ + "duration", + "interval" + ] + }, + "validity_day_of_week": { + "type": "array", + "description": "Integer array corresponding to the particular days of the week in which the earning rule is valid.\n\n- `0` Sunday\n- `1` Monday\n- `2` Tuesday\n- `3` Wednesday\n- `4` Thursday\n- `5` Friday\n- `6` Saturday", + "items": { + "type": "integer", + "minimum": 0, + "maximum": 6 + } + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the earning rule. A set of key/value pairs that you can attach to an earning rule object. It can be useful for storing additional information about the earning rule in a structured format." + } + }, + "required": [ + "id", + "created_at", + "loyalty", + "source", + "object", + "automation_id", + "metadata" + ] + }, + "EarningRuleEvent": { + "title": "EarningRuleEvent", + "x-stoplight": { + "id": "6vxql7fnzg2zp" + }, + "type": "string", + "enum": [ + "order.paid", + "customer.segment.entered", + "custom_event", + "customer.loyalty.tier.upgraded", + "customer.loyalty.tier.downgraded", + "customer.loyalty.tier.prolonged", + "customer.loyalty.tier.joined", + "customer.loyalty.tier.left" + ] + }, + "EarningRuleFixed": { + "title": "Define fixed amount of points", + "x-stoplight": { + "id": "r5o8m0sdli7fq" + }, + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "FIXED" + ], + "description": "The number of points to be added to the loyalty card." + }, + "points": { + "type": "integer", + "description": "Defines how the points will be added to the loyalty card. FIXED adds a fixed number of points." + } + } + }, + "EarningRuleProportionalOrder": { + "anyOf": [ + { + "$ref": "#/components/schemas/EarningRuleProportionalOrderAmount" + }, + { + "$ref": "#/components/schemas/EarningRuleProportionalOrderTotalAmount" + }, + { + "$ref": "#/components/schemas/EarningRuleProportionalOrderMetadata" + } + ], + "title": "Order" + }, + "EarningRuleProportionalOrderAmount": { + "title": "Order Amount", + "x-stoplight": { + "id": "1z7lk7z1lp5af" + }, + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "PROPORTIONAL" + ], + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + }, + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_AMOUNT" + ], + "description": "`ORDER_AMOUNT`: Pre-discount order amount (X points for every Y spent excluding discounts)" + }, + "order": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "type": "object", + "required": [ + "every", + "points" + ], + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", + "properties": { + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + } + } + } + } + } + }, + "required": [ + "type", + "calculation_type", + "order" + ] + }, + "EarningRuleProportionalOrderTotalAmount": { + "title": "Order Total Amount", + "x-stoplight": { + "id": "ekudxr430edgk" + }, + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "PROPORTIONAL" + ], + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + }, + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_TOTAL_AMOUNT" + ], + "description": "`ORDER_TOTAL_AMOUNT`: Total order amount (X points for every Y spent including discount)" + }, + "order": { + "type": "object", + "required": [ + "total_amount" + ], + "properties": { + "total_amount": { + "type": "object", + "required": [ + "every", + "points" + ], + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", + "properties": { + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + } + } + } + } + } + }, + "required": [ + "type", + "calculation_type", + "order" + ] + }, + "EarningRuleProportionalOrderMetadata": { + "title": "Order Metadata", + "x-stoplight": { + "id": "4ccw4gz8b47u5" + }, + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "PROPORTIONAL" + ], + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + }, + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_METADATA" + ], + "description": "`ORDER_METADATA`: Order Metadata (X points for every Y in metadata attribute, defined in the property key under the order.metadata object)" + }, + "order": { + "type": "object", + "required": [ + "metadata" + ], + "description": "Defines the formula for calculating points proportionally.", + "properties": { + "metadata": { + "type": "object", + "required": [ + "every", + "points", + "property" + ], + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points.", + "properties": { + "every": { + "type": "integer", + "description": "For how many increments of the order metadata property to grant points for." + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + }, + "property": { + "type": "string", + "description": "Order metadata property." + } + } + } + } + } + }, + "required": [ + "type", + "calculation_type", + "order" + ] + }, + "EarningRuleProportionalOrderItemsQuantity": { + "title": "Order Items Quantity", + "x-stoplight": { + "id": "pqsn9otpzyot9" + }, + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "PROPORTIONAL" + ], + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + }, + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_ITEMS_QUANTITY" + ], + "description": "`ORDER_ITEMS_QUANTITY`: Quantity of items defined in order_items.quantity.object & .id (X points for every Y items excluding free items)" + }, + "order_items": { + "type": "object", + "required": [ + "quantity" + ], + "properties": { + "quantity": { + "type": "object", + "required": [ + "every", + "points", + "object", + "id" + ], + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", + "properties": { + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + }, + "object": { + "type": "string", + "description": "Type of object taken under consideration.", + "enum": [ + "products_collection", + "product", + "sku" + ] + }, + "id": { + "type": "string", + "description": "Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619." } } } - }, - "LoyaltiesExportCardTransactionsResponseBody": { - "title": "Loyalties Export Card Transactions Response Body", - "type": "object", - "description": "", - "properties": { - "id": { - "type": "string", - "description": "Unique export ID." - }, - "object": { - "type": "string", - "pattern": "export", - "enum": [ - "export" - ], - "description": "The type of object being represented. This object stores information about the export." - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format.", - "format": "date-time" - }, - "status": { - "type": "string", - "pattern": "SCHEDULED", - "enum": [ - "SCHEDULED" - ], - "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated." - }, - "channel": { - "type": "string", - "description": "The channel through which the export was triggered." - }, - "exported_object": { - "type": "string", - "pattern": "voucher_transactions", - "enum": [ - "voucher_transactions" - ], - "description": "The type of exported object." - }, - "parameters": { - "type": "object", - "required": [ - "filters" - ], - "description": "List of available fields and filters that can be exported with loyalty card transactions along with the sorting order of the returned data.", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.\n\n`id`, `campaign_id`, `voucher_id`, `type`, `source_id`, `reason`, `source`, `balance`, `amount`, `related_transaction_id`, `created_at`, `details`", - "items": { - "$ref": "#/components/schemas/LoyaltyCardTransactionsFields" - } - }, - "filters": { - "type": "object", - "required": [ - "voucher_id" - ], - "description": "Filter condition.", - "properties": { - "voucher_id": { - "type": "object", - "required": [ - "conditions" - ], - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "conditions": { - "type": "object", - "required": [ - "$in" - ], - "description": "Data filters used to narrow the data records to be returned in the result.", - "properties": { - "$in": { - "type": "array", - "minItems": 1, - "maxItems": 1, - "items": { - "type": "string", - "minLength": 1, - "maxLength": 1 - } - } - } - } - } - } - } - } + } + } + }, + "required": [ + "type", + "calculation_type", + "order_items" + ] + }, + "EarningRuleProportionalOrderItemsAmount": { + "title": "Order Items Amount", + "x-stoplight": { + "id": "8pg4o23daepkb" + }, + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "PROPORTIONAL" + ], + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + }, + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_ITEMS_AMOUNT" + ], + "description": "ORDER_ITEMS_AMOUNT; Pre-discount amount spent on items defined in the order_items.amount.object & .id (X points for every Y spent on items excluding discounts)" + }, + "order_items": { + "type": "object", + "required": [ + "amount" + ], + "properties": { + "amount": { + "type": "object", + "required": [ + "every", + "points", + "object", + "id" + ], + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", + "properties": { + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + }, + "object": { + "type": "string", + "description": "Type of object taken under consideration.", + "enum": [ + "products_collection", + "product", + "sku" + ] + }, + "id": { + "type": "string", + "description": "Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619." } - }, - "result": { - "type": "null", - "description": "Contains the URL of the CSV file." - }, - "user_id": { - "type": [ - "string", - "null" - ], - "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE." } - }, - "required": [ - "id", - "object", - "created_at", - "status", - "channel", - "exported_object", - "parameters", - "result", - "user_id" - ] - }, - "RewardAssignment": { - "title": "Reward Assignment", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique reward assignment ID, assigned by Voucherify." - }, - "reward_id": { - "type": "string", - "description": "Associated reward ID." - }, - "related_object_id": { - "type": "string", - "description": "Related object ID to which the reward was assigned." - }, - "related_object_type": { - "type": "string", - "description": "Related object type to which the reward was assigned." - }, - "parameters": { - "type": "object", - "description": "Defines the cost of the reward.", - "properties": { - "loyalty": { - "type": "object", - "description": "Defines the equivalent points value of the reward.", - "properties": { - "points": { - "type": "integer", - "description": "The number of points required to redeem the reward." - } - }, - "required": [ - "points" - ] - } + } + } + } + }, + "required": [ + "type", + "calculation_type", + "order_items" + ] + }, + "EarningRuleProportionalOrderItemsSubtotalAmount": { + "title": "Order Items Subtotal Amount", + "x-stoplight": { + "id": "duxy5qw36h5ph" + }, + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "PROPORTIONAL" + ], + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + }, + "calculation_type": { + "type": "string", + "enum": [ + "ORDER_ITEMS_SUBTOTAL_AMOUNT" + ], + "description": "ORDER_ITEMS_SUBTOTAL_AMOUNT; Amount spent on items defined in the order_items.subtotal_amount.object & .id (X points for every Y spent on items including discounts)" + }, + "order_items": { + "type": "object", + "required": [ + "subtotal_amount" + ], + "properties": { + "subtotal_amount": { + "type": "object", + "required": [ + "every", + "points", + "object", + "id" + ], + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every set of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every calculation_type, give points.", + "properties": { + "every": { + "type": "integer", + "description": "Value is multiplied by 100 to precisely represent 2 decimal places. For example, a $10 order amount is written as 1000." + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + }, + "object": { + "type": "string", + "description": "Type of object taken under consideration.", + "enum": [ + "products_collection", + "product", + "sku" + ] + }, + "id": { + "type": "string", + "description": "Unique ID of the resource, i.e. pc_75U0dHlr7u75BJodrW1AE3t6, prod_0bae32322150fd0546, or sku_0b7d7dfb090be5c619." } - }, - "created_at": { - "type": "string", - "description": "Timestamp representing the date and time when the reward assignment was created in ISO 8601 format.", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format.", - "format": "date-time" - }, - "object": { - "type": "string", - "description": "The type of object represented by the JSON. This object stores information about the reward assignment." } - }, - "required": [ - "id", - "reward_id", - "created_at", - "object" - ] - }, - "Reward": { - "allOf": [ - { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique reward ID, assigned by Voucherify." - }, - "name": { - "type": "string", - "description": "Reward name." - }, - "stock": { - "type": "integer", - "description": "Configurable for material rewards. The number of units of the product that you want to share as reward." - }, - "redeemed": { - "type": "integer", - "description": "Defines the number of already invoked (successful) reward redemptions." - }, - "attributes": { - "type": "object", - "description": "These properties are configurable for material rewards.", - "properties": { - "image_url": { - "type": "string", - "description": "The HTTPS URL pointing to the .png or .jpg file." - }, - "description": { - "type": "string", - "description": "An arbitrary string that you can attach to a material reward." - } - } - }, - "created_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the reward was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the reward was updated in ISO 8601 format." - }, - "object": { - "type": "string", - "default": "reward", - "pattern": "reward", - "description": "The type of object represented by the JSON. This object stores information about the reward." - } + } + } + } + }, + "required": [ + "type", + "calculation_type", + "order_items" + ] + }, + "EarningRuleProportionalCustomerMetadata": { + "title": "Customer Metadata", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "PROPORTIONAL" + ], + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + }, + "calculation_type": { + "type": "string", + "enum": [ + "CUSTOMER_METADATA" + ], + "description": "CUSTOMER_METADATA: Customer Metadata (X points for every Y in metadata attribute, defined in the property key under the customer.metadata object)" + }, + "customer": { + "type": "object", + "required": [ + "metadata" + ], + "properties": { + "metadata": { + "type": "object", + "required": [ + "every", + "points", + "property" + ], + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points.", + "properties": { + "every": { + "type": "integer", + "description": "For how many increments of the customer metadata property to grant points for." }, - "required": [ - "id", - "created_at", - "object" - ] - }, - { - "$ref": "#/components/schemas/RewardType" - } - ] - }, - "RewardType": { - "title": "Reward Type", - "anyOf": [ - { - "$ref": "#/components/schemas/RewardTypeCampaign" - }, - { - "$ref": "#/components/schemas/RewardTypeCoin" - }, - { - "$ref": "#/components/schemas/RewardTypeCoin" + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + }, + "property": { + "type": "string", + "description": "Customer metadata property." + } } - ] - }, - "RewardTypeCoin": { - "title": "Reward Type Coin", - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "COIN" - ], - "description": "Reward type." - }, - "parameters": { - "type": "object", - "required": [ - "coin" - ], - "description": "Defines how the reward is generated.", - "properties": { - "coin": { - "type": "object", - "required": [ - "exchange_ratio" - ], - "description": "Defines the ratio by mapping the number of loyalty points in points_ratio to a predefined cash amount in exchange_ratio.", - "properties": { - "exchange_ratio": { - "type": "number", - "description": "The cash equivalent of the points defined in the points_ratio property." - }, - "points_ratio": { - "type": "integer", - "description": "The number of loyalty points that will map to the predefined cash amount defined by the exchange_ratio property." - } - } - } + } + } + } + }, + "required": [ + "type", + "calculation_type", + "customer" + ] + }, + "EarningRuleProportionalCustomEvent": { + "title": "Custom Event", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "PROPORTIONAL" + ], + "description": "Defines how the points will be added to the loyalty card.PROPORTIONAL adds points based on a pre-defined ratio." + }, + "calculation_type": { + "type": "string", + "enum": [ + "CUSTOM_EVENT_METADATA" + ], + "description": "CUSTOM_EVENT_METADATA: Custom event metadata (X points for every Y in metadata attribute)." + }, + "custom_event": { + "type": "object", + "required": [ + "metadata" + ], + "properties": { + "metadata": { + "type": "object", + "required": [ + "every", + "points", + "property" + ], + "description": "Defines the ratio based on the property defined in the calculation_type parameter. For every given increment of value (1, 10, etc) defined in the every parameter for the property defined in calculation_type, give the customer the number of points defined in the points parameter. In other words, for every order metadata property value, give points.", + "properties": { + "every": { + "type": "integer", + "description": "For how many increments of the customer metadata property to grant points for." + }, + "points": { + "type": "integer", + "description": "Number of points to be awarded, i.e. how many points to be added to the loyalty card." + }, + "property": { + "type": "string", + "description": "\nCustom event metadata property." } } + } + } + } + }, + "required": [ + "type", + "calculation_type", + "custom_event" + ] + }, + "EarningRuleProportional": { + "anyOf": [ + { + "$ref": "#/components/schemas/EarningRuleProportionalOrder" + }, + { + "$ref": "#/components/schemas/EarningRuleProportionalOrderItems" + }, + { + "$ref": "#/components/schemas/EarningRuleProportionalCustomerMetadata" + }, + { + "$ref": "#/components/schemas/EarningRuleProportionalCustomEvent" + } + ], + "title": "Calculate points proportionally" + }, + "EarningRuleProportionalOrderItems": { + "anyOf": [ + { + "$ref": "#/components/schemas/EarningRuleProportionalOrderItemsQuantity" + }, + { + "$ref": "#/components/schemas/EarningRuleProportionalOrderItemsAmount" + }, + { + "$ref": "#/components/schemas/EarningRuleProportionalOrderItemsSubtotalAmount" + } + ], + "title": "Order Items" + }, + "LoyaltiesListMemberRewardsRequestQuery": { + "title": "Loyalties List Member Rewards Request Query", + "type": "object", + "properties": { + "affordable_only": { + "type": "string" + }, + "limit": { + "type": "integer" + }, + "page": { + "type": "integer" + } + } + }, + "LoyaltiesGetPointsExpirationRequestQuery": { + "title": "Loyalties Get Points Expiration Request Query", + "type": "object", + "properties": { + "limit": { + "type": "integer", + "minimum": 1, + "multipleOf": 100 + }, + "page": { + "type": "integer" + } + } + }, + "LoyaltiesListCardTransactionsRequestQuery": { + "title": "Loyalties List Card Transactions Request Query", + "type": "object", + "properties": { + "limit": { + "type": "integer", + "minimum": 1, + "multipleOf": 100 + }, + "page": { + "type": "integer" + } + } + }, + "LoyaltiesListCardTransactionsResponseBody": { + "title": "Loyalties List Card Transactions Response Body", + "type": "object", + "properties": { + "object": { + "type": "string", + "pattern": "list", + "enum": [ + "list" + ], + "description": "The type of object represented by JSON." + }, + "data_ref": { + "type": "string", + "pattern": "data", + "enum": [ + "data" + ], + "description": "Identifies the name of the attribute that contains the array of transaction objects." + }, + "data": { + "type": "array", + "description": "A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object.", + "items": { + "$ref": "#/components/schemas/LoyaltyCardTransaction" + } + }, + "has_more": { + "type": "boolean", + "description": "As query results are always limited (by the limit parameter), the has_more flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results." + } + }, + "required": [ + "object", + "data_ref", + "data", + "has_more" + ] + }, + "LoyaltyCardTransactionsType": { + "type": "string", + "enum": [ + "POINTS_ACCRUAL", + "POINTS_CANCELLATION", + "POINTS_REDEMPTION", + "POINTS_REFUND", + "POINTS_ADDITION", + "POINTS_REMOVAL", + "POINTS_EXPIRATION", + "POINTS_TRANSFER_IN", + "POINTS_TRANSFER_OUT" + ] + }, + "SimpleLoyaltyVoucher": { + "title": "Simple Loyalty Voucher", + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "code": { + "type": "string" + }, + "loyalty_card": { + "type": "object", + "required": [ + "points", + "balance" + ], + "properties": { + "points": { + "type": "string" }, - "required": [ - "type", - "parameters" - ] - }, - "RewardTypeMaterial": { - "title": "Reward Type Material", - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "MATERIAL" - ], - "description": "Reward type." - }, - "parameters": { - "type": "object", - "required": [ - "product" - ], - "description": "Defines how the reward is generated.", - "properties": { - "product": { - "type": "object", - "required": [ - "id", - "sku" - ], - "description": "Contains information about the product given as a reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique product ID, assigned by Voucherify." - }, - "sku": { - "type": [ - "string", - "null" - ], - "description": "Unique SKU ID, assigned by Voucherify, of the SKU given as a reward." - } + "balance": { + "type": "string" + }, + "next_expiration_date": { + "type": "string" + }, + "next_expiration_points": { + "type": "string" + } + } + }, + "type": { + "type": "string", + "enum": [ + "LOYALTY_CARD" + ] + }, + "campaign": { + "type": "string" + }, + "campaign_id": { + "type": "string" + }, + "is_referral_code": { + "type": "boolean" + }, + "holder_id": { + "type": "string" + }, + "referrer_id": { + "type": "string" + }, + "created_at": { + "type": "string" + }, + "object": { + "type": "string", + "pattern": "voucher", + "enum": [ + "voucher" + ] + } + }, + "required": [ + "id", + "code", + "loyalty_card", + "type", + "campaign", + "campaign_id", + "object" + ] + }, + "LoyaltyCardTransaction": { + "title": "Loyalty Card Transaction", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique transaction ID." + }, + "source_id": { + "type": [ + "string", + "null" + ], + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is null." + }, + "voucher_id": { + "type": "string", + "description": "Unique voucher ID." + }, + "campaign_id": { + "type": "string", + "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaign that generates bulk codes." + }, + "source": { + "type": [ + "string", + "null" + ], + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is null." + }, + "reason": { + "type": [ + "string", + "null" + ], + "description": "Reason why the transaction occurred. In case of a redemption, this value is null." + }, + "type": { + "$ref": "#/components/schemas/LoyaltyCardTransactionsType", + "description": "Type of transaction." + }, + "details": { + "type": "object", + "description": "Contains the detailed information about the transaction.", + "properties": { + "balance": { + "type": "object", + "description": "Contains information on how the balance was affected by the transaction.", + "properties": { + "type": { + "type": "string", + "pattern": "loyalty_card", + "enum": [ + "loyalty_card" + ], + "description": "The type of voucher whose balance is being adjusted due to the transaction." + }, + "total": { + "type": "integer", + "description": "The available points prior to the transaction." + }, + "object": { + "type": "string", + "pattern": "balance", + "enum": [ + "balance" + ], + "description": "The type of object represented by the JSON." + }, + "points": { + "type": "integer", + "description": "The amount of points being used up in the transaction." + }, + "balance": { + "type": "integer", + "description": "The points balance on the loyalty card after the points in the transaction are subtracted from the loyalty card." + }, + "related_object": { + "type": "object", + "required": [ + "id", + "type" + ], + "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "properties": { + "id": { + "type": "string", + "description": "Identifies the voucher that is being modified, this is the ID that was assigned by the Voucherify API." + }, + "type": { + "type": "string", + "pattern": "voucher", + "enum": [ + "voucher" + ], + "description": "The object being modified, i.e. voucher." } } } - } - }, - "required": [ - "type", - "parameters" - ] - }, - "RewardTypeCampaign": { - "title": "Reward Type Campaign", - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "CAMPAIGN" - ], - "description": "Reward type." }, - "parameters": { - "type": "object", - "required": [ - "campaign" - ], - "description": "Defines how the reward is generated.", - "properties": { - "campaign": { - "type": "object", - "required": [ - "id", - "type" - ], - "description": "Objects stores information about the campaign related to the reward.", - "properties": { - "id": { - "type": "string", - "description": "Unique campaign ID, assigned by Voucherify." - }, - "balance": { - "type": "integer", - "description": "The incremental amout to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." - }, - "type": { - "type": "string", - "enum": [ - "DISCOUNT_COUPONS", - "PROMOTION", - "GIFT_VOUCHERS", - "REFERRAL_PROGRAM" - ], - "description": "Campaign type." - } - } - } - } - } + "required": [ + "type", + "total", + "object", + "points", + "balance", + "related_object" + ] }, - "required": [ - "type", - "parameters" - ] - }, - "LoyaltiesAddOrRemoveCardBalanceResponseBody": { - "title": "Loyalties Add Or Remove Card Balance Response Body", - "type": "object", - "description": "Response schema for adding or removing points from a loyalty card.", - "properties": { - "points": { - "type": "integer", - "description": "The incremental points removed or added to the current balance on the loyalty card." - }, - "total": { - "type": "integer", - "description": "The total of points accrued over the lifetime of the loyalty card." - }, - "balance": { - "type": "integer", - "minimum": 0, - "description": "The balance after adding/removing points." - }, - "type": { - "type": "string", - "enum": [ - "LOYALTY_CARD", - "GIFT_VOUCHER" - ], - "description": "The type of voucher being modified." - }, - "object": { - "type": "string", - "pattern": "balance", - "enum": [ - "balance" - ], - "description": "The type of object represented by JSON. Default is balance." - }, - "related_object": { - "type": "object", - "required": [ - "type", - "id" - ], - "description": "Defines the object that is being modified with the values that are returned in the balance object.", - "properties": { - "type": { - "type": "string", - "enum": [ - "voucher" - ], - "description": "The object being modified." - }, - "id": { - "type": "string", - "description": "Identifies the loyalty card that is being modified, this is the ID that was assigned by the Voucherify API." - } + "order": { + "type": "object", + "description": "Contains information about the original order.", + "properties": { + "id": { + "type": "string", + "description": "Unique order ID." + }, + "source_id": { + "type": "string", + "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." } }, - "operation_type": { - "type": "string", - "enum": [ - "MANUAL", - "AUTOMATIC" - ] - } + "required": [ + "id", + "source_id" + ] }, - "required": [ - "points", - "total", - "balance", - "type", - "object", - "related_object" - ] - }, - "LoyaltiesTransferPointsResponseBody": { - "title": "Loyalties Transfer Points Response Body", - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Assigned by the Voucherify API, identifies the voucher." - }, - "code": { - "type": "string", - "description": "A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters." - }, - "campaign": { - "type": "string", - "description": "A unique campaign name, identifies the voucher's parent campaign." - }, - "campaign_id": { - "type": "string", - "description": "Assigned by the Voucherify API, identifies the voucher's parent campaign." - }, - "category": { - "type": [ - "string", - "null" - ], - "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint." - }, - "category_id": { - "type": [ - "string", - "null" - ], - "description": "Unique category ID assigned by Voucherify." - }, - "categories": { - "type": "array", - "items": { - "$ref": "#/components/schemas/Category" - } - }, - "type": { - "type": "string", - "enum": [ - "LOYALTY_CARD" - ], - "description": "Defines the type of voucher." - }, - "loyalty_card": { - "type": "object", - "description": "Object representing loyalty card parameters. Child attributes are present only if type is LOYALTY_CARD.", - "required": [ - "points", - "balance" - ], - "properties": { - "points": { - "type": "integer", - "description": "Total points incurred over lifespan of loyalty card." - }, - "balance": { - "type": "integer", - "description": "Points available for reward redemption." - }, - "next_expiration_date": { - "type": "string", - "description": "The next closest date when the next set of points are due to expire." - }, - "next_expiration_points": { - "type": "integer", - "description": "The amount of points that are set to expire next." - } - } - }, - "start_date": { - "type": [ - "string", - "null" - ], - "description": "Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is inactive before this date.", - "format": "date-time" - }, - "expiration_date": { - "type": [ - "string", - "null" - ], - "description": "Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is inactive after this date.", - "format": "date-time" - }, - "validity_timeframe": { - "type": [ - "object", - "null" - ], - "description": "Set recurrent time periods when the voucher is valid. For example, valid for 1 hour every other day.start_date required when including the validity_timeframe.", - "properties": { - "interval": { - "type": "string", - "description": "Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a duration of PT1H will be valid for a duration of one hour." - }, - "duration": { - "type": "string", - "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an interval of P2D will be active every other day." - } - } - }, - "validity_day_of_week": { - "type": [ - "array", - "null" - ], - "description": "Integer array corresponding to the particular days of the week in which the voucher is valid.\n\n- `0` Sunday\n- `1` Monday\n- `2` Tuesday\n- `3` Wednesday\n- `4` Thursday\n- `5` Friday\n- `6` Saturday", - "items": { - "type": "integer", - "minimum": 0, - "maximum": 6 - } - }, - "publish": { - "type": "object", - "description": "This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or publish voucher API method.", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "description": "The type of object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute." - }, - "count": { - "type": "integer", - "description": "Publication events counter." - }, - "entries": { - "type": "array", - "items": { - "type": "string" - } - }, - "url": { - "type": "string", - "description": "The endpoint where this list of publications can be accessed using a GET method. /v1/vouchers/{voucher_code}/publications" - } + "event": { + "type": "object", + "description": "Contains information about the event that triggers the point accrual.", + "properties": { + "id": { + "type": "string", + "description": "Unique event ID." }, - "required": [ - "object" - ] + "type": { + "type": "string", + "description": "Type of event." + } }, - "redemption": { - "type": "object", - "description": "Stores a summary of redemptions that have been applied to the voucher.", - "properties": { - "quantity": { - "type": [ - "integer", - "null" - ], - "description": "How many times a voucher can be redeemed. A null value means unlimited." - }, - "redeemed_points": { - "type": "integer", - "description": "Total loyalty points redeemed." - }, - "redeemed_quantity": { - "type": "integer", - "description": "How many times a voucher has already been redeemed." - }, - "redemption_entries": { - "type": "array", - "items": { - "type": "string" - } - }, - "object": { - "type": "string", - "enum": [ - "list" - ], - "description": "The type of object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute." - }, - "url": { - "type": "string", - "description": "The endpoint where this list of redemptions can be accessed using a GET method. /v1/vouchers/{voucher_code}/redemptions" - } + "required": [ + "id", + "type" + ] + }, + "earning_rule": { + "type": "object", + "description": "Contains information about the earning rule.", + "properties": { + "id": { + "type": "string", + "description": "Unique earning rule ID." }, - "required": [ - "quantity" - ] - }, - "active": { - "type": "string", - "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the start_date and expiration_date.\n\n- `true` indicates an active voucher\n- `false` indicates an inactive voucher" - }, - "additional_info": { - "type": [ - "string", - "null" - ], - "description": "An optional field to keep any extra textual information about the code such as a code description and details." - }, - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." - }, - "assets": { - "type": "object", - "description": "Stores links to images of QR and barcode that correspond to an encrypted voucher code.", - "properties": { - "qr": { - "type": "object", - "description": "Stores Quick Response (QR) representation of encrypted code.", - "properties": { - "id": { - "type": "string", - "example": "U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK+t4pp7U7oFzjGJzj9q/bmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg+BaZk5QwXMf8k/OzSlOEVybpwSq+AiqPoNtjeuqtIgkDyvT6Q==", - "description": "Encrypted voucher code ID." - }, - "url": { - "type": "string", - "example": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK%2Bt4pp7U7oFzjGJzj9q%2FbmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg%2BBaZk5QwXMf8k%2FOzSlOEVybpwSq%2BAiqPoNtjeuqtIgkDyvT6Q%3D%3D", - "description": "URL to QR code \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" - } - } - }, - "barcode": { - "type": "object", - "description": "Stores barcode representation of encrypted code.", - "properties": { - "id": { - "type": "string", - "example": "U2FsdGVkX19eJhGfWwUrH9+tulBkON+AnMktic+N6CVWzZ9+fHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ+kJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6/pFs61apEn9SJx32ttCF6d3oxKISQQ==", - "description": "Encrypted voucher code ID." - }, - "url": { - "type": "string", - "example": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19eJhGfWwUrH9%2BtulBkON%2BAnMktic%2BN6CVWzZ9%2BfHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ%2BkJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6%2FpFs61apEn9SJx32ttCF6d3oxKISQQ%3D%3D", - "description": "URL to barcode \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" - } + "source": { + "type": "object", + "required": [ + "banner" + ], + "description": "Contains the custom earning rule name.", + "properties": { + "banner": { + "type": "string", + "description": "Name of the earning rule. This is displayed as a header for the earning rule in the Dashboard." } } } }, - "is_referral_code": { - "type": "boolean", - "description": "Flag indicating whether this voucher is a referral code." - }, - "holder_id": { - "type": "string", - "description": "Unique customer ID of voucher owner." - }, - "updated_at": { - "type": "string", - "description": "Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.", - "format": "date-time" - }, - "created_at": { - "type": "string", - "format": "date-time" - } + "required": [ + "id", + "source" + ] }, - "required": [ - "id", - "code", - "category", - "category_id", - "type", - "loyalty_card", - "start_date", - "expiration_date", - "validity_timeframe", - "validity_day_of_week", - "active", - "additional_info", - "metadata", - "is_referral_code", - "created_at" - ] - }, - "LoyaltiesTransferPoints": { - "title": "Loyalties Transfer Points", - "type": "object", - "properties": { - "code": { - "type": "string", - "description": "Unique loyalty card code from which the user wants to transfer loyalty points (source)." - }, - "points": { - "type": "integer", - "description": "The number of loyalty points that the user wants to transfer to another loyalty card. The number of points cannot be higher than the current balance on the loyalty card (source)." - }, - "reason": { - "type": "string", - "description": "Reason for the transfer." + "segment": { + "type": "object", + "description": "Contains information about the segment.", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + } }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." - } + "required": [ + "id", + "name" + ] }, - "required": [ - "code", - "points", - "source_id" - ] - }, - "LoyaltiesTransferPointsRequestBody": { - "title": "Loyalties Transfer Points Request Body", - "type": "array", - "items": { - "$ref": "#/components/schemas/LoyaltiesTransferPoints" - } - }, - "LoyaltiesAddOrRemoveCardBalanceRequestBody": { - "title": "Loyalties Add Or Remove Card Balance Request Body", - "type": "object", - "properties": { - "points": { - "type": "integer", - "description": "Incremental balance to be added to/subtracted from the loyalty card.\n\n- To add points: 100\n- To subtract points, add a minus: -100" - }, - "expiration_type": { - "$ref": "#/components/schemas/PointsExpirationTypes", - "description": "Set the type of expiration for added points.\n\n`PROGRAM_RULES`: Inherit rules from campaign.\n`NON_EXPIRING`: Points never expire.\n`CUSTOM_DATE`: Points expire on a particular date. Requires expiration_date parameter." - }, - "expiration_date": { - "type": "string", - "format": "date-time", - "description": "Set expiration date for added points, i.e. `YYYY-MM-DD`. This parameter is required only when expiration_type is set to `CUSTOM_DATE`." - }, - "reason": { - "type": "string", - "description": "Reason for the transfer." + "loyalty_tier": { + "type": "object", + "description": "Contains information about the loyalty tier.", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + } }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." - } + "required": [ + "id", + "name" + ] }, - "required": [ - "points" - ] - }, - "PointsExpirationTypes": { - "title": "Points Expiration Types", - "type": "string", - "enum": [ - "PROGRAM_RULES", - "CUSTOM_DATE", - "NON_EXPIRING" - ] - }, - "Category": { - "title": "Category", - "type": "object", - "description": "This is an object representing a category.", - "properties": { - "id": { - "type": "string", - "description": "Unique category ID assigned by Voucherify." - }, - "name": { - "type": "string", - "description": "Category name." - }, - "hierarchy": { - "type": "integer", - "description": "Category hierarchy." - }, - "created_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the category was created in ISO 8601 format." - }, - "updated_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the category was updated in ISO 8601 format." + "redemption": { + "type": "object", + "description": "Contains information about the original redemption.", + "properties": { + "id": { + "type": "string", + "description": "Unique redemption ID." + } }, - "object": { - "type": "string", - "enum": [ - "category" - ], - "description": "The type of object represented by the JSON. This object stores information about the category." - } + "required": [ + "id" + ] }, - "required": [ - "id", - "name", - "hierarchy", - "created_at", - "object" - ] - }, - "ExportsCreateRequestBody": { - "anyOf": [ - { - "title": "Export Vouchers", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "voucher" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportVoucherOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportVoucherFields" - } - }, - "filters": { - "$ref": "#/components/schemas/ExportVoucherFilters", - "description": "Filter conditions." - } - }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." - } - }, - "required": [ - "exported_object" - ] - }, - { - "title": "Export Redemptions", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "redemption" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportRedemptionOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportRedemptionFields" - } - }, - "filters": { - "$ref": "#/components/schemas/ExportRedemptionFilters", - "description": "Filter conditions." - } - }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." - } - }, - "required": [ - "exported_object" - ] - }, - { - "title": "Export Customers", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "customer" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportCustomerOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportCustomerFields" - } - }, - "filters": { - "$ref": "#/components/schemas/ExportCustomerFilters", - "description": "Filter conditions." - } - }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." - } - }, - "required": [ - "exported_object" - ] + "rollback": { + "type": "object", + "description": "Contains information about the redemption rollback.", + "properties": { + "id": { + "type": "string", + "description": "Unique redemption rollback ID." + } }, - { - "title": "Export Publications", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "publication" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportPublicationOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportPublicationFields" - } - }, - "filters": { - "$ref": "#/components/schemas/ExportPublicationFilters", - "description": "Filter conditions." - } - }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." - } + "required": [ + "id" + ] + }, + "custom_event": { + "type": "object", + "description": "Contains information about the custom event that triggers the point accrual.", + "properties": { + "id": { + "type": "string", + "description": "Unique event ID." }, - "required": [ - "exported_object" - ] + "type": { + "type": "string", + "description": "Type of custom event." + } }, - { - "title": "Export Order", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "order" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportOrderOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportOrderFields" - } - }, - "filters": { - "$ref": "#/components/schemas/ExportOrderFilters", - "description": "Filter conditions." - } - }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." - } + "required": [ + "id", + "type" + ] + }, + "event_schema": { + "type": "object", + "description": "Contains information about the custom event metadata schema.", + "properties": { + "id": { + "type": "string", + "description": "Unique metadata schema ID." }, - "required": [ - "exported_object" - ] + "name": { + "type": "string", + "description": "Type of custom event." + } }, - { - "title": "Export Points Expirations", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "points_expiration" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportPointsExpirationOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportPointsExpirationFields" - } - }, - "filters": { - "$ref": "#/components/schemas/ExportPointsExpirationFilters", - "description": "Filter conditions." - } - }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." - } + "required": [ + "id", + "name" + ] + }, + "reward": { + "type": "object", + "description": "Contains information about the pay with points reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique reward ID." }, - "required": [ - "exported_object" - ] + "name": { + "type": "string", + "description": "Reward name." + } }, - { - "title": "Export Vouchers Transactions Expiration", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "voucher_transactions" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportVoucherTransactionsOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportVoucherTransactionsFields" + "required": [ + "id", + "name" + ] + }, + "source_voucher": { + "$ref": "#/components/schemas/SimpleLoyaltyVoucher", + "description": "Contains information on how the balance on the donor loyalty card was affected by the transaction." + }, + "destination_voucher": { + "$ref": "#/components/schemas/SimpleLoyaltyVoucher", + "description": "Contains information on how the balance on the receiving loyalty card was affected by the transaction." + } + } + }, + "related_transaction_id": { + "type": [ + "string", + "null" + ], + "description": "The related transaction ID on the receiving card." + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format.\n\n" + } + }, + "required": [ + "id", + "source_id", + "voucher_id", + "campaign_id", + "source", + "reason", + "type", + "details", + "related_transaction_id", + "created_at" + ] + }, + "LoyaltyCardTransactionsFields": { + "type": "string", + "enum": [ + "id", + "campaign_id", + "voucher_id", + "type", + "source_id", + "reason", + "source", + "balance", + "amount", + "related_transaction_id", + "created_at", + "details" + ] + }, + "LoyaltiesExportCardTransactionsRequestBody": { + "title": "Loyalties Export Card Transactions Request Body", + "type": "object", + "properties": { + "order": { + "type": "string", + "enum": [ + "created_at", + "-created_at" + ], + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/LoyaltyCardTransactionsFields" + } + } + } + }, + "LoyaltiesExportCardTransactionsResponseBody": { + "title": "Loyalties Export Card Transactions Response Body", + "type": "object", + "description": "", + "properties": { + "id": { + "type": "string", + "description": "Unique export ID." + }, + "object": { + "type": "string", + "pattern": "export", + "enum": [ + "export" + ], + "description": "The type of object being represented. This object stores information about the export." + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format.", + "format": "date-time" + }, + "status": { + "type": "string", + "pattern": "SCHEDULED", + "enum": [ + "SCHEDULED" + ], + "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated." + }, + "channel": { + "type": "string", + "description": "The channel through which the export was triggered." + }, + "exported_object": { + "type": "string", + "pattern": "voucher_transactions", + "enum": [ + "voucher_transactions" + ], + "description": "The type of exported object." + }, + "parameters": { + "type": "object", + "required": [ + "filters" + ], + "description": "List of available fields and filters that can be exported with loyalty card transactions along with the sorting order of the returned data.", + "properties": { + "order": { + "type": "string", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.\n\n`id`, `campaign_id`, `voucher_id`, `type`, `source_id`, `reason`, `source`, `balance`, `amount`, `related_transaction_id`, `created_at`, `details`", + "items": { + "$ref": "#/components/schemas/LoyaltyCardTransactionsFields" + } + }, + "filters": { + "type": "object", + "required": [ + "voucher_id" + ], + "description": "Filter condition.", + "properties": { + "voucher_id": { + "type": "object", + "required": [ + "conditions" + ], + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "conditions": { + "type": "object", + "required": [ + "$in" + ], + "description": "Data filters used to narrow the data records to be returned in the result.", + "properties": { + "$in": { + "type": "array", + "minItems": 1, + "maxItems": 1, + "items": { + "type": "string", + "minLength": 1, + "maxLength": 1 + } } - }, - "filters": { - "$ref": "#/components/schemas/ExportVoucherTransactionsFilters", - "description": "Filter conditions." } - }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } } + } + } + } + } + }, + "result": { + "type": "null", + "description": "Contains the URL of the CSV file." + }, + "user_id": { + "type": [ + "string", + "null" + ], + "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE." + } + }, + "required": [ + "id", + "object", + "created_at", + "status", + "channel", + "exported_object", + "parameters", + "result", + "user_id" + ] + }, + "RewardAssignment": { + "title": "Reward Assignment", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique reward assignment ID, assigned by Voucherify." + }, + "reward_id": { + "type": "string", + "description": "Associated reward ID." + }, + "related_object_id": { + "type": "string", + "description": "Related object ID to which the reward was assigned." + }, + "related_object_type": { + "type": "string", + "description": "Related object type to which the reward was assigned." + }, + "parameters": { + "type": "object", + "description": "Defines the cost of the reward.", + "properties": { + "loyalty": { + "type": "object", + "description": "Defines the equivalent points value of the reward.", + "properties": { + "points": { + "type": "integer", + "description": "The number of points required to redeem the reward." + } + }, + "required": [ + "points" + ] + } + } + }, + "created_at": { + "type": "string", + "description": "Timestamp representing the date and time when the reward assignment was created in ISO 8601 format.", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the reward assignment was updated in ISO 8601 format.", + "format": "date-time" + }, + "object": { + "type": "string", + "description": "The type of object represented by the JSON. This object stores information about the reward assignment." + } + }, + "required": [ + "id", + "reward_id", + "created_at", + "object" + ] + }, + "Reward": { + "allOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique reward ID, assigned by Voucherify." + }, + "name": { + "type": "string", + "description": "Reward name." + }, + "stock": { + "type": "integer", + "description": "Configurable for material rewards. The number of units of the product that you want to share as reward." + }, + "redeemed": { + "type": "integer", + "description": "Defines the number of already invoked (successful) reward redemptions." + }, + "attributes": { + "type": "object", + "description": "These properties are configurable for material rewards.", + "properties": { + "image_url": { + "type": "string", + "description": "The HTTPS URL pointing to the .png or .jpg file." }, - "required": [ - "exported_object" - ] + "description": { + "type": "string", + "description": "An arbitrary string that you can attach to a material reward." + } } - ], - "type": "object" + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the reward was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the reward was updated in ISO 8601 format." + }, + "object": { + "type": "string", + "default": "reward", + "pattern": "reward", + "description": "The type of object represented by the JSON. This object stores information about the reward." + } }, - "ExportBase": { - "title": "Export Base", - "type": "object", - "additionalProperties": false, - "properties": { - "id": { - "type": "string", - "description": "Unique export ID." - }, - "object": { - "type": "string", - "enum": [ - "export" - ], - "description": "The type of object being represented. This object stores information about the export." - }, - "created_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format." - }, - "status": { - "enum": [ - "SCHEDULED", - "IN_PROGRESS", - "DONE", - "ERROR" - ], - "type": "string", - "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated." - }, - "channel": { - "type": "string", - "description": "The channel through which the export was triggered." - }, - "result": { - "type": [ - "object", - "null" - ], - "required": [ - "url" - ], - "description": "Contains the URL of the CSV file.", - "properties": { - "url": { - "type": "string", - "description": "URL of the CSV file location. It contains the token used for authorization in the Download export method." - } + "required": [ + "id", + "created_at", + "object" + ] + }, + { + "$ref": "#/components/schemas/RewardType" + } + ] + }, + "RewardType": { + "title": "Reward Type", + "anyOf": [ + { + "$ref": "#/components/schemas/RewardTypeCampaign" + }, + { + "$ref": "#/components/schemas/RewardTypeCoin" + }, + { + "$ref": "#/components/schemas/RewardTypeCoin" + } + ] + }, + "RewardTypeCoin": { + "title": "Reward Type Coin", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "COIN" + ], + "description": "Reward type." + }, + "parameters": { + "type": "object", + "required": [ + "coin" + ], + "description": "Defines how the reward is generated.", + "properties": { + "coin": { + "type": "object", + "required": [ + "exchange_ratio" + ], + "description": "Defines the ratio by mapping the number of loyalty points in points_ratio to a predefined cash amount in exchange_ratio.", + "properties": { + "exchange_ratio": { + "type": "number", + "description": "The cash equivalent of the points defined in the points_ratio property." + }, + "points_ratio": { + "type": "integer", + "description": "The number of loyalty points that will map to the predefined cash amount defined by the exchange_ratio property." } - }, - "user_id": { - "type": [ - "string", - "null" - ], - "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE." + } + } + } + } + }, + "required": [ + "type", + "parameters" + ] + }, + "RewardTypeMaterial": { + "title": "Reward Type Material", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "MATERIAL" + ], + "description": "Reward type." + }, + "parameters": { + "type": "object", + "required": [ + "product" + ], + "description": "Defines how the reward is generated.", + "properties": { + "product": { + "type": "object", + "required": [ + "id", + "sku" + ], + "description": "Contains information about the product given as a reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique product ID, assigned by Voucherify." + }, + "sku": { + "type": [ + "string", + "null" + ], + "description": "Unique SKU ID, assigned by Voucherify, of the SKU given as a reward." + } + } + } + } + } + }, + "required": [ + "type", + "parameters" + ] + }, + "RewardTypeCampaign": { + "title": "Reward Type Campaign", + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "CAMPAIGN" + ], + "description": "Reward type." + }, + "parameters": { + "type": "object", + "required": [ + "campaign" + ], + "description": "Defines how the reward is generated.", + "properties": { + "campaign": { + "type": "object", + "required": [ + "id", + "type" + ], + "description": "Objects stores information about the campaign related to the reward.", + "properties": { + "id": { + "type": "string", + "description": "Unique campaign ID, assigned by Voucherify." + }, + "balance": { + "type": "integer", + "description": "The incremental amout to be added to the current balance on the gift card. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." + }, + "type": { + "type": "string", + "enum": [ + "DISCOUNT_COUPONS", + "PROMOTION", + "GIFT_VOUCHERS", + "REFERRAL_PROGRAM" + ], + "description": "Campaign type." + } + } + } + } + } + }, + "required": [ + "type", + "parameters" + ] + }, + "LoyaltiesAddOrRemoveCardBalanceResponseBody": { + "title": "Loyalties Add Or Remove Card Balance Response Body", + "type": "object", + "description": "Response schema for adding or removing points from a loyalty card.", + "properties": { + "points": { + "type": "integer", + "description": "The incremental points removed or added to the current balance on the loyalty card." + }, + "total": { + "type": "integer", + "description": "The total of points accrued over the lifetime of the loyalty card." + }, + "balance": { + "type": "integer", + "minimum": 0, + "description": "The balance after adding/removing points." + }, + "type": { + "type": "string", + "enum": [ + "LOYALTY_CARD", + "GIFT_VOUCHER" + ], + "description": "The type of voucher being modified." + }, + "object": { + "type": "string", + "pattern": "balance", + "enum": [ + "balance" + ], + "description": "The type of object represented by JSON. Default is balance." + }, + "related_object": { + "type": "object", + "required": [ + "type", + "id" + ], + "description": "Defines the object that is being modified with the values that are returned in the balance object.", + "properties": { + "type": { + "type": "string", + "enum": [ + "voucher" + ], + "description": "The object being modified." + }, + "id": { + "type": "string", + "description": "Identifies the loyalty card that is being modified, this is the ID that was assigned by the Voucherify API." + } + } + }, + "operation_type": { + "type": "string", + "enum": [ + "MANUAL", + "AUTOMATIC" + ] + } + }, + "required": [ + "points", + "total", + "balance", + "type", + "object", + "related_object" + ] + }, + "LoyaltiesTransferPointsResponseBody": { + "title": "Loyalties Transfer Points Response Body", + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Assigned by the Voucherify API, identifies the voucher." + }, + "code": { + "type": "string", + "description": "A code that identifies a voucher. Pattern can use all letters of the English alphabet, Arabic numerals, and special characters." + }, + "campaign": { + "type": "string", + "description": "A unique campaign name, identifies the voucher's parent campaign." + }, + "campaign_id": { + "type": "string", + "description": "Assigned by the Voucherify API, identifies the voucher's parent campaign." + }, + "category": { + "type": [ + "string", + "null" + ], + "description": "Tag defining the category that this voucher belongs to. Useful when listing vouchers using the List Vouchers endpoint." + }, + "category_id": { + "type": [ + "string", + "null" + ], + "description": "Unique category ID assigned by Voucherify." + }, + "categories": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Category" + } + }, + "type": { + "type": "string", + "enum": [ + "LOYALTY_CARD" + ], + "description": "Defines the type of voucher." + }, + "loyalty_card": { + "type": "object", + "description": "Object representing loyalty card parameters. Child attributes are present only if type is LOYALTY_CARD.", + "required": [ + "points", + "balance" + ], + "properties": { + "points": { + "type": "integer", + "description": "Total points incurred over lifespan of loyalty card." + }, + "balance": { + "type": "integer", + "description": "Points available for reward redemption." + }, + "next_expiration_date": { + "type": "string", + "description": "The next closest date when the next set of points are due to expire." + }, + "next_expiration_points": { + "type": "integer", + "description": "The amount of points that are set to expire next." + } + } + }, + "start_date": { + "type": [ + "string", + "null" + ], + "description": "Activation timestamp defines when the code starts to be active in ISO 8601 format. Voucher is inactive before this date.", + "format": "date-time" + }, + "expiration_date": { + "type": [ + "string", + "null" + ], + "description": "Expiration timestamp defines when the code expires in ISO 8601 format. Voucher is inactive after this date.", + "format": "date-time" + }, + "validity_timeframe": { + "type": [ + "object", + "null" + ], + "description": "Set recurrent time periods when the voucher is valid. For example, valid for 1 hour every other day.start_date required when including the validity_timeframe.", + "properties": { + "interval": { + "type": "string", + "description": "Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a duration of PT1H will be valid for a duration of one hour." + }, + "duration": { + "type": "string", + "description": "Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an interval of P2D will be active every other day." + } + } + }, + "validity_day_of_week": { + "type": [ + "array", + "null" + ], + "description": "Integer array corresponding to the particular days of the week in which the voucher is valid.\n\n- `0` Sunday\n- `1` Monday\n- `2` Tuesday\n- `3` Wednesday\n- `4` Thursday\n- `5` Friday\n- `6` Saturday", + "items": { + "type": "integer", + "minimum": 0, + "maximum": 6 + } + }, + "publish": { + "type": "object", + "description": "This object stores a summary of publish events: an events counter and an endpoint which can be called to return details of each event. A publication is required for loyalty cards and referral codes. This object gets updated whenever a voucher has been published. Publication means assigning a code to a particular customer. Typically, a publication is made by distributing your codes to your customers, e.g. through Export to MailChimp or publish voucher API method.", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute." + }, + "count": { + "type": "integer", + "description": "Publication events counter." + }, + "entries": { + "type": "array", + "items": { + "type": "string" } }, - "required": [ - "id", - "object", - "created_at", - "status", - "result", - "user_id" - ] + "url": { + "type": "string", + "description": "The endpoint where this list of publications can be accessed using a GET method. /v1/vouchers/{voucher_code}/publications" + } }, - "Export": { - "title": "Export", - "allOf": [ - { - "$ref": "#/components/schemas/ExportBase" - }, - { - "anyOf": [ - { - "$ref": "#/components/schemas/ExportVoucher" - }, - { - "$ref": "#/components/schemas/ExportRedemption" - }, - { - "$ref": "#/components/schemas/ExportCustomer" - }, - { - "$ref": "#/components/schemas/ExportPublication" - }, - { - "$ref": "#/components/schemas/ExportOrder" - }, - { - "$ref": "#/components/schemas/ExportPointsExpiration" - }, - { - "$ref": "#/components/schemas/ExportVoucherTransactionsExpiration" - } - ] + "required": [ + "object" + ] + }, + "redemption": { + "type": "object", + "description": "Stores a summary of redemptions that have been applied to the voucher.", + "properties": { + "quantity": { + "type": [ + "integer", + "null" + ], + "description": "How many times a voucher can be redeemed. A null value means unlimited." + }, + "redeemed_points": { + "type": "integer", + "description": "Total loyalty points redeemed." + }, + "redeemed_quantity": { + "type": "integer", + "description": "How many times a voucher has already been redeemed." + }, + "redemption_entries": { + "type": "array", + "items": { + "type": "string" } - ] + }, + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object represented is by default list. To get this list, you need to make a call to the endpoint returned in the url attribute." + }, + "url": { + "type": "string", + "description": "The endpoint where this list of redemptions can be accessed using a GET method. /v1/vouchers/{voucher_code}/redemptions" + } }, - "ExportsCreateResponseBody": { - "allOf": [ - { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique export ID." - }, - "object": { - "type": "string", - "enum": [ - "export" - ], - "description": "The type of object being represented. This object stores information about the export." - }, - "created_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format." - }, - "status": { - "type": "string", - "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.", - "enum": [ - "SCHEDULED" - ] - }, - "channel": { - "type": "string", - "description": "The channel through which the export was triggered." - }, - "result": { - "type": "null", - "description": "Contains the URL of the CSV file." - }, - "user_id": { - "type": "string", - "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE." - } + "required": [ + "quantity" + ] + }, + "active": { + "type": "string", + "description": "A flag to toggle the voucher on or off. You can disable a voucher even though it's within the active period defined by the start_date and expiration_date.\n\n- `true` indicates an active voucher\n- `false` indicates an inactive voucher" + }, + "additional_info": { + "type": [ + "string", + "null" + ], + "description": "An optional field to keep any extra textual information about the code such as a code description and details." + }, + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the code. A set of key/value pairs that you can attach to a voucher object. It can be useful for storing additional information about the voucher in a structured format." + }, + "assets": { + "type": "object", + "description": "Stores links to images of QR and barcode that correspond to an encrypted voucher code.", + "properties": { + "qr": { + "type": "object", + "description": "Stores Quick Response (QR) representation of encrypted code.", + "properties": { + "id": { + "type": "string", + "example": "U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK+t4pp7U7oFzjGJzj9q/bmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg+BaZk5QwXMf8k/OzSlOEVybpwSq+AiqPoNtjeuqtIgkDyvT6Q==", + "description": "Encrypted voucher code ID." }, - "required": [ - "id", - "object", - "created_at", - "status", - "result", - "user_id" - ] - }, - { - "anyOf": [ - { - "$ref": "#/components/schemas/ExportVoucher" - }, - { - "$ref": "#/components/schemas/ExportRedemption" - }, - { - "$ref": "#/components/schemas/ExportCustomer" - }, - { - "$ref": "#/components/schemas/ExportPublication" - }, - { - "$ref": "#/components/schemas/ExportOrder" - }, - { - "$ref": "#/components/schemas/ExportPointsExpiration" - }, - { - "$ref": "#/components/schemas/ExportVoucherTransactionsExpiration" - } - ] - } - ], - "title": "" - }, - "ExportVoucher": { - "title": "Export Vouchers", - "type": "object", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "voucher" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportVoucherOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportVoucherFields" - } - }, - "filters": { - "$ref": "#/components/schemas/ExportVoucherFilters", - "description": "Filter conditions." - } + "url": { + "type": "string", + "example": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19ucFhvVmBVpVYG5KoswTsjSIaqoKg5L9ie4BK%2Bt4pp7U7oFzjGJzj9q%2FbmuMOj9mEFiVKDMIkSaruKedMvHbKoPX5Sg%2BBaZk5QwXMf8k%2FOzSlOEVybpwSq%2BAiqPoNtjeuqtIgkDyvT6Q%3D%3D", + "description": "URL to QR code \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" } } }, - "required": [ - "exported_object", - "parameters" - ] - }, - "FieldConditions": { - "title": "Field Conditions", - "type": "object", - "properties": { - "conditions": { - "$ref": "#/components/schemas/FiltersCondition", - "description": "Data filters used to narrow the data records to be returned in the result." + "barcode": { + "type": "object", + "description": "Stores barcode representation of encrypted code.", + "properties": { + "id": { + "type": "string", + "example": "U2FsdGVkX19eJhGfWwUrH9+tulBkON+AnMktic+N6CVWzZ9+fHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ+kJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6/pFs61apEn9SJx32ttCF6d3oxKISQQ==", + "description": "Encrypted voucher code ID." + }, + "url": { + "type": "string", + "example": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19eJhGfWwUrH9%2BtulBkON%2BAnMktic%2BN6CVWzZ9%2BfHVxuVx22WakrzxiWXy0skuvvEHSeZIw9HlgyIJ%2BkJ1iPdUKpyENuNYJKzoZlO0mmTf6WQM6%2FpFs61apEn9SJx32ttCF6d3oxKISQQ%3D%3D", + "description": "URL to barcode \n\n*Optional:* Attach query parameters to base URL to customize the image of the encrypted voucher code. \n\n- `size`: integer value from `1` to `100` \n- `format`: string, either `png` (default) or `svg`" + } } } - }, - "FiltersCondition": { - "title": "Filters Condition", - "type": "object", - "properties": { - "$in": { - "$ref": "#/components/schemas/Any" - }, - "$not_in": { - "$ref": "#/components/schemas/Any" - }, - "$is": { - "$ref": "#/components/schemas/Any" - }, - "$is_days_ago": { - "$ref": "#/components/schemas/Any" - }, - "$is_days_in_future": { - "$ref": "#/components/schemas/Any" - }, - "$is_not": { - "$ref": "#/components/schemas/Any" - }, - "$has_value": { - "$ref": "#/components/schemas/Any" - }, - "$is_unknown": { - "$ref": "#/components/schemas/Any" - }, - "$contains": { - "$ref": "#/components/schemas/Any" - }, - "$not_contain": { - "$ref": "#/components/schemas/Any" - }, - "$starts_with": { - "$ref": "#/components/schemas/Any" - }, - "$ends_with": { - "$ref": "#/components/schemas/Any" - }, - "$more_than": { - "$ref": "#/components/schemas/Any" - }, - "$less_than": { - "$ref": "#/components/schemas/Any" - }, - "$more_than_ago": { - "$ref": "#/components/schemas/Any" - }, - "$less_than_ago": { - "$ref": "#/components/schemas/Any" - }, - "$more_than_future": { - "$ref": "#/components/schemas/Any" - }, - "$less_than_future": { - "$ref": "#/components/schemas/Any" - }, - "$more_than_equal": { - "$ref": "#/components/schemas/Any" - }, - "$less_than_equal": { - "$ref": "#/components/schemas/Any" - }, - "$after": { - "$ref": "#/components/schemas/Any" - }, - "$before": { - "$ref": "#/components/schemas/Any" - }, - "$count": { - "$ref": "#/components/schemas/Any" - }, - "$count_less": { - "$ref": "#/components/schemas/Any" + } + }, + "is_referral_code": { + "type": "boolean", + "description": "Flag indicating whether this voucher is a referral code." + }, + "holder_id": { + "type": "string", + "description": "Unique customer ID of voucher owner." + }, + "updated_at": { + "type": "string", + "description": "Timestamp representing the date and time when the voucher was last updated in ISO 8601 format.", + "format": "date-time" + }, + "created_at": { + "type": "string", + "format": "date-time" + } + }, + "required": [ + "id", + "code", + "category", + "category_id", + "type", + "loyalty_card", + "start_date", + "expiration_date", + "validity_timeframe", + "validity_day_of_week", + "active", + "additional_info", + "metadata", + "is_referral_code", + "created_at" + ] + }, + "LoyaltiesTransferPoints": { + "title": "Loyalties Transfer Points", + "type": "object", + "properties": { + "code": { + "type": "string", + "description": "Unique loyalty card code from which the user wants to transfer loyalty points (source)." + }, + "points": { + "type": "integer", + "description": "The number of loyalty points that the user wants to transfer to another loyalty card. The number of points cannot be higher than the current balance on the loyalty card (source)." + }, + "reason": { + "type": "string", + "description": "Reason for the transfer." + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." + } + }, + "required": [ + "code", + "points", + "source_id" + ] + }, + "LoyaltiesTransferPointsRequestBody": { + "title": "Loyalties Transfer Points Request Body", + "type": "array", + "items": { + "$ref": "#/components/schemas/LoyaltiesTransferPoints" + } + }, + "LoyaltiesAddOrRemoveCardBalanceRequestBody": { + "title": "Loyalties Add Or Remove Card Balance Request Body", + "type": "object", + "properties": { + "points": { + "type": "integer", + "description": "Incremental balance to be added to/subtracted from the loyalty card.\n\n- To add points: 100\n- To subtract points, add a minus: -100" + }, + "expiration_type": { + "$ref": "#/components/schemas/PointsExpirationTypes", + "description": "Set the type of expiration for added points.\n\n`PROGRAM_RULES`: Inherit rules from campaign.\n`NON_EXPIRING`: Points never expire.\n`CUSTOM_DATE`: Points expire on a particular date. Requires expiration_date parameter." + }, + "expiration_date": { + "type": "string", + "format": "date-time", + "description": "Set expiration date for added points, i.e. `YYYY-MM-DD`. This parameter is required only when expiration_type is set to `CUSTOM_DATE`." + }, + "reason": { + "type": "string", + "description": "Reason for the transfer." + }, + "source_id": { + "type": "string", + "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." + } + }, + "required": [ + "points" + ] + }, + "PointsExpirationTypes": { + "title": "Points Expiration Types", + "type": "string", + "enum": [ + "PROGRAM_RULES", + "CUSTOM_DATE", + "NON_EXPIRING" + ] + }, + "Category": { + "title": "Category", + "type": "object", + "description": "This is an object representing a category.", + "properties": { + "id": { + "type": "string", + "description": "Unique category ID assigned by Voucherify." + }, + "name": { + "type": "string", + "description": "Category name." + }, + "hierarchy": { + "type": "integer", + "description": "Category hierarchy." + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the category was created in ISO 8601 format." + }, + "updated_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the category was updated in ISO 8601 format." + }, + "object": { + "type": "string", + "enum": [ + "category" + ], + "description": "The type of object represented by the JSON. This object stores information about the category." + } + }, + "required": [ + "id", + "name", + "hierarchy", + "created_at", + "object" + ] + }, + "ExportsCreateRequestBody": { + "anyOf": [ + { + "title": "Export Vouchers", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "voucher" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportVoucherOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportVoucherFields" + } + }, + "filters": { + "$ref": "#/components/schemas/ExportVoucherFilters", + "description": "Filter conditions." + } }, - "$count_more": { - "$ref": "#/components/schemas/Any" - } + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." } }, - "ExportVoucherFilters": { - "title": "Export Voucher Filters", - "type": "object", - "properties": { - "junction": { - "$ref": "#/components/schemas/Junction", - "description": "Filter by conditions set on the junction parameter indicating how the conditions should be accounted for in the query. An AND is an all-inclusive logical operator, meaning the AND operator displays a record if ALL the conditions separated by AND are TRUE, while an OR operator displays a record if ANY of the conditions separated by OR is TRUE." - }, - "code": { - "$ref": "#/components/schemas/FieldConditions" - }, - "voucher_type": { - "$ref": "#/components/schemas/FieldConditions" - }, - "value": { - "$ref": "#/components/schemas/FieldConditions" - }, - "discount_type": { - "$ref": "#/components/schemas/FieldConditions" - }, - "campaign": { - "$ref": "#/components/schemas/FieldConditions" - }, - "category": { - "$ref": "#/components/schemas/FieldConditions" - }, - "start_date": { - "$ref": "#/components/schemas/FieldConditions" - }, - "expiration_date": { - "$ref": "#/components/schemas/FieldConditions" - }, - "gift_balance": { - "$ref": "#/components/schemas/FieldConditions" - }, - "loyalty_balance": { - "$ref": "#/components/schemas/FieldConditions" - }, - "redemption_quantity": { - "$ref": "#/components/schemas/FieldConditions" - }, - "redemption_count": { - "$ref": "#/components/schemas/FieldConditions" - }, - "active": { - "$ref": "#/components/schemas/FieldConditions" - }, - "qr_code": { - "$ref": "#/components/schemas/FieldConditions" - }, - "bar_code": { - "$ref": "#/components/schemas/FieldConditions" - }, - "metadata": { - "$ref": "#/components/schemas/FieldConditions" - }, - "id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "is_referral_code": { - "$ref": "#/components/schemas/FieldConditions" - }, - "created_at": { - "$ref": "#/components/schemas/FieldConditions" - }, - "updated_at": { - "$ref": "#/components/schemas/FieldConditions" - }, - "validity_timeframe_interval": { - "$ref": "#/components/schemas/FieldConditions" - }, - "validity_timeframe_duration": { - "$ref": "#/components/schemas/FieldConditions" - }, - "validity_day_of_week": { - "$ref": "#/components/schemas/FieldConditions" - }, - "discount_amount_limit": { - "$ref": "#/components/schemas/FieldConditions" - }, - "campaign_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "additional_info": { - "$ref": "#/components/schemas/FieldConditions" - }, - "customer_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "discount_unit_type": { - "$ref": "#/components/schemas/FieldConditions" - }, - "discount_unit_effect": { - "$ref": "#/components/schemas/FieldConditions" + "required": [ + "exported_object" + ] + }, + { + "title": "Export Redemptions", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "redemption" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportRedemptionOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportRedemptionFields" + } + }, + "filters": { + "$ref": "#/components/schemas/ExportRedemptionFilters", + "description": "Filter conditions." + } }, - "customer_source_id": { - "$ref": "#/components/schemas/FieldConditions" - } + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." } }, - "Junction": { - "title": "Junction", - "enum": [ - "and", - "AND", - "or", - "OR" - ], - "type": "string" - }, - "ExportRedemption": { - "title": "Export Redemptions", - "type": "object", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "redemption" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportRedemptionOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportRedemptionFields" - } - }, - "filters": { - "$ref": "#/components/schemas/ExportRedemptionFilters", - "description": "Filter conditions." + "required": [ + "exported_object" + ] + }, + { + "title": "Export Customers", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "customer" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportCustomerOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportCustomerFields" } }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." - } - }, - "required": [ - "exported_object", - "parameters" - ] - }, - "ExportRedemptionFilters": { - "title": "Export Redemption Filters", - "type": "object", - "additionalProperties": false, - "properties": { - "junction": { - "$ref": "#/components/schemas/Junction" - }, - "id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "object": { - "$ref": "#/components/schemas/FieldConditions" - }, - "date": { - "$ref": "#/components/schemas/FieldConditions" - }, - "voucher_code": { - "$ref": "#/components/schemas/FieldConditions" - }, - "campaign": { - "$ref": "#/components/schemas/FieldConditions" - }, - "promotion_tier_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "customer_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "customer_source_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "customer_name": { - "$ref": "#/components/schemas/FieldConditions" - }, - "tracking_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "order_amount": { - "$ref": "#/components/schemas/FieldConditions" - }, - "gift_amount": { - "$ref": "#/components/schemas/FieldConditions" - }, - "loyalty_points": { - "$ref": "#/components/schemas/FieldConditions" - }, - "result": { - "$ref": "#/components/schemas/FieldConditions" - }, - "failure_code": { - "$ref": "#/components/schemas/FieldConditions" - }, - "failure_message": { - "$ref": "#/components/schemas/FieldConditions" + "filters": { + "$ref": "#/components/schemas/ExportCustomerFilters", + "description": "Filter conditions." + } }, - "metadata": { - "$ref": "#/components/schemas/FieldConditions" - } + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." } }, - "ExportCustomer": { - "title": "Export Customers", - "type": "object", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "customer" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportCustomerOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportCustomerFields" - } - }, - "filters": { - "$ref": "#/components/schemas/ExportCustomerFilters", - "description": "Filter conditions." + "required": [ + "exported_object" + ] + }, + { + "title": "Export Publications", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "publication" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportPublicationOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportPublicationFields" } }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." - } - }, - "required": [ - "exported_object", - "parameters" - ] - }, - "ExportCustomerFilters": { - "title": "Export Customer Filters", - "type": "object", - "properties": { - "junction": { - "$ref": "#/components/schemas/Junction" - }, - "name": { - "$ref": "#/components/schemas/FieldConditions" - }, - "id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "description": { - "$ref": "#/components/schemas/FieldConditions" - }, - "email": { - "$ref": "#/components/schemas/FieldConditions" - }, - "source_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "created_at": { - "$ref": "#/components/schemas/FieldConditions" - }, - "address_city": { - "$ref": "#/components/schemas/FieldConditions" - }, - "address_state": { - "$ref": "#/components/schemas/FieldConditions" - }, - "address_line_1": { - "$ref": "#/components/schemas/FieldConditions" - }, - "address_line_2": { - "$ref": "#/components/schemas/FieldConditions" - }, - "address_country": { - "$ref": "#/components/schemas/FieldConditions" - }, - "address_postal_code": { - "$ref": "#/components/schemas/FieldConditions" - }, - "redemptions_total_redeemed": { - "$ref": "#/components/schemas/FieldConditions" - }, - "redemptions_total_failed": { - "$ref": "#/components/schemas/FieldConditions" - }, - "redemptions_total_succeeded": { - "$ref": "#/components/schemas/FieldConditions" - }, - "redemptions_total_rolled_back": { - "$ref": "#/components/schemas/FieldConditions" - }, - "redemptions_total_rollback_failed": { - "$ref": "#/components/schemas/FieldConditions" - }, - "redemptions_total_rollback_succeeded": { - "$ref": "#/components/schemas/FieldConditions" - }, - "orders_total_amount": { - "$ref": "#/components/schemas/FieldConditions" - }, - "orders_total_count": { - "$ref": "#/components/schemas/FieldConditions" - }, - "orders_average_amount": { - "$ref": "#/components/schemas/FieldConditions" - }, - "orders_last_order_amount": { - "$ref": "#/components/schemas/FieldConditions" - }, - "orders_last_order_date": { - "$ref": "#/components/schemas/FieldConditions" - }, - "loyalty_points": { - "$ref": "#/components/schemas/FieldConditions" - }, - "loyalty_referred_customers": { - "$ref": "#/components/schemas/FieldConditions" - }, - "updated_at": { - "$ref": "#/components/schemas/FieldConditions" - }, - "phone": { - "$ref": "#/components/schemas/FieldConditions" - }, - "birthday": { - "$ref": "#/components/schemas/FieldConditions" - }, - "metadata": { - "$ref": "#/components/schemas/FieldConditions" + "filters": { + "$ref": "#/components/schemas/ExportPublicationFilters", + "description": "Filter conditions." + } }, - "birthdate": { - "$ref": "#/components/schemas/FieldConditions" - } + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." } }, - "ExportPublication": { - "title": "Export Publications", - "type": "object", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "publication" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportPublicationOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportPublicationFields" - } - }, - "filters": { - "$ref": "#/components/schemas/ExportPublicationFilters", - "description": "Filter conditions." + "required": [ + "exported_object" + ] + }, + { + "title": "Export Order", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "order" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportOrderOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportOrderFields" } }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." - } - }, - "required": [ - "exported_object", - "parameters" - ] - }, - "ExportPublicationFilters": { - "title": "Export Publication Filters", - "type": "object", - "properties": { - "junction": { - "$ref": "#/components/schemas/Junction" - }, - "voucher_code": { - "$ref": "#/components/schemas/FieldConditions" - }, - "customer_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "customer_source_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "date": { - "$ref": "#/components/schemas/FieldConditions" - }, - "channel": { - "$ref": "#/components/schemas/FieldConditions" - }, - "campaign": { - "$ref": "#/components/schemas/FieldConditions" - }, - "is_winner": { - "$ref": "#/components/schemas/FieldConditions" + "filters": { + "$ref": "#/components/schemas/ExportOrderFilters", + "description": "Filter conditions." + } }, - "metadata": { - "$ref": "#/components/schemas/FieldConditions" - } + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." } }, - "ExportOrder": { - "title": "Export Orders", - "type": "object", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "order" - ], - "description": "The type of object to be exported." + "required": [ + "exported_object" + ] + }, + { + "title": "Export Points Expirations", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "points_expiration" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportPointsExpirationOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportPointsExpirationFields" + } + }, + "filters": { + "$ref": "#/components/schemas/ExportPointsExpirationFilters", + "description": "Filter conditions." + } }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportOrderOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportOrderFields" - } - }, - "filters": { - "$ref": "#/components/schemas/ExportOrderFilters", - "description": "Filter conditions." + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object" + ] + }, + { + "title": "Export Vouchers Transactions Expiration", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "voucher_transactions" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportVoucherTransactionsOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportVoucherTransactionsFields" } }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." - } + "filters": { + "$ref": "#/components/schemas/ExportVoucherTransactionsFilters", + "description": "Filter conditions." + } + }, + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object" + ] + } + ], + "type": "object" + }, + "ExportBase": { + "title": "Export Base", + "type": "object", + "additionalProperties": false, + "properties": { + "id": { + "type": "string", + "description": "Unique export ID." + }, + "object": { + "type": "string", + "enum": [ + "export" + ], + "description": "The type of object being represented. This object stores information about the export." + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format." + }, + "status": { + "enum": [ + "SCHEDULED", + "IN_PROGRESS", + "DONE", + "ERROR" + ], + "type": "string", + "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated." + }, + "channel": { + "type": "string", + "description": "The channel through which the export was triggered." + }, + "result": { + "type": [ + "object", + "null" + ], + "required": [ + "url" + ], + "description": "Contains the URL of the CSV file.", + "properties": { + "url": { + "type": "string", + "description": "URL of the CSV file location. It contains the token used for authorization in the Download export method." + } + } + }, + "user_id": { + "type": [ + "string", + "null" + ], + "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE." + } + }, + "required": [ + "id", + "object", + "created_at", + "status", + "result", + "user_id" + ] + }, + "Export": { + "title": "Export", + "allOf": [ + { + "$ref": "#/components/schemas/ExportBase" + }, + { + "anyOf": [ + { + "$ref": "#/components/schemas/ExportVoucher" }, - "required": [ - "exported_object", - "parameters" - ] + { + "$ref": "#/components/schemas/ExportRedemption" + }, + { + "$ref": "#/components/schemas/ExportCustomer" + }, + { + "$ref": "#/components/schemas/ExportPublication" + }, + { + "$ref": "#/components/schemas/ExportOrder" + }, + { + "$ref": "#/components/schemas/ExportPointsExpiration" + }, + { + "$ref": "#/components/schemas/ExportVoucherTransactionsExpiration" + } + ] + } + ] + }, + "ExportsCreateResponseBody": { + "allOf": [ + { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique export ID." + }, + "object": { + "type": "string", + "enum": [ + "export" + ], + "description": "The type of object being represented. This object stores information about the export." + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the export was scheduled in ISO 8601 format." + }, + "status": { + "type": "string", + "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.", + "enum": [ + "SCHEDULED" + ] + }, + "channel": { + "type": "string", + "description": "The channel through which the export was triggered." + }, + "result": { + "type": "null", + "description": "Contains the URL of the CSV file." + }, + "user_id": { + "type": "string", + "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the channel value is WEBSITE." + } }, - "ExportOrderFilters": { - "title": "Export Order Filters", - "type": "object", - "additionalProperties": false, - "properties": { - "junction": { - "$ref": "#/components/schemas/Junction" - }, - "id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "source_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "created_at": { - "$ref": "#/components/schemas/FieldConditions" - }, - "updated_at": { - "$ref": "#/components/schemas/FieldConditions" - }, - "status": { - "$ref": "#/components/schemas/FieldConditions" - }, - "amount": { - "$ref": "#/components/schemas/FieldConditions" - }, - "discount_amount": { - "$ref": "#/components/schemas/FieldConditions" - }, - "items_discount_amount": { - "$ref": "#/components/schemas/FieldConditions" - }, - "total_discount_amount": { - "$ref": "#/components/schemas/FieldConditions" - }, - "total_amount": { - "$ref": "#/components/schemas/FieldConditions" - }, - "customer_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "referrer_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "metadata": { - "$ref": "#/components/schemas/FieldConditions" + "required": [ + "id", + "object", + "created_at", + "status", + "result", + "user_id" + ] + }, + { + "anyOf": [ + { + "$ref": "#/components/schemas/ExportVoucher" + }, + { + "$ref": "#/components/schemas/ExportRedemption" + }, + { + "$ref": "#/components/schemas/ExportCustomer" + }, + { + "$ref": "#/components/schemas/ExportPublication" + }, + { + "$ref": "#/components/schemas/ExportOrder" + }, + { + "$ref": "#/components/schemas/ExportPointsExpiration" + }, + { + "$ref": "#/components/schemas/ExportVoucherTransactionsExpiration" + } + ] + } + ], + "title": "" + }, + "ExportVoucher": { + "title": "Export Vouchers", + "type": "object", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "voucher" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportVoucherOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportVoucherFields" + } + }, + "filters": { + "$ref": "#/components/schemas/ExportVoucherFilters", + "description": "Filter conditions." + } + } + } + }, + "required": [ + "exported_object", + "parameters" + ] + }, + "FieldConditions": { + "title": "Field Conditions", + "type": "object", + "properties": { + "conditions": { + "$ref": "#/components/schemas/FiltersCondition", + "description": "Data filters used to narrow the data records to be returned in the result." + } + } + }, + "FiltersCondition": { + "title": "Filters Condition", + "type": "object", + "properties": { + "$in": { + "$ref": "#/components/schemas/Any" + }, + "$not_in": { + "$ref": "#/components/schemas/Any" + }, + "$is": { + "$ref": "#/components/schemas/Any" + }, + "$is_days_ago": { + "$ref": "#/components/schemas/Any" + }, + "$is_days_in_future": { + "$ref": "#/components/schemas/Any" + }, + "$is_not": { + "$ref": "#/components/schemas/Any" + }, + "$has_value": { + "$ref": "#/components/schemas/Any" + }, + "$is_unknown": { + "$ref": "#/components/schemas/Any" + }, + "$contains": { + "$ref": "#/components/schemas/Any" + }, + "$not_contain": { + "$ref": "#/components/schemas/Any" + }, + "$starts_with": { + "$ref": "#/components/schemas/Any" + }, + "$ends_with": { + "$ref": "#/components/schemas/Any" + }, + "$more_than": { + "$ref": "#/components/schemas/Any" + }, + "$less_than": { + "$ref": "#/components/schemas/Any" + }, + "$more_than_ago": { + "$ref": "#/components/schemas/Any" + }, + "$less_than_ago": { + "$ref": "#/components/schemas/Any" + }, + "$more_than_future": { + "$ref": "#/components/schemas/Any" + }, + "$less_than_future": { + "$ref": "#/components/schemas/Any" + }, + "$more_than_equal": { + "$ref": "#/components/schemas/Any" + }, + "$less_than_equal": { + "$ref": "#/components/schemas/Any" + }, + "$after": { + "$ref": "#/components/schemas/Any" + }, + "$before": { + "$ref": "#/components/schemas/Any" + }, + "$count": { + "$ref": "#/components/schemas/Any" + }, + "$count_less": { + "$ref": "#/components/schemas/Any" + }, + "$count_more": { + "$ref": "#/components/schemas/Any" + } + } + }, + "ExportVoucherFilters": { + "title": "Export Voucher Filters", + "type": "object", + "properties": { + "junction": { + "$ref": "#/components/schemas/Junction", + "description": "Filter by conditions set on the junction parameter indicating how the conditions should be accounted for in the query. An AND is an all-inclusive logical operator, meaning the AND operator displays a record if ALL the conditions separated by AND are TRUE, while an OR operator displays a record if ANY of the conditions separated by OR is TRUE." + }, + "code": { + "$ref": "#/components/schemas/FieldConditions" + }, + "voucher_type": { + "$ref": "#/components/schemas/FieldConditions" + }, + "value": { + "$ref": "#/components/schemas/FieldConditions" + }, + "discount_type": { + "$ref": "#/components/schemas/FieldConditions" + }, + "campaign": { + "$ref": "#/components/schemas/FieldConditions" + }, + "category": { + "$ref": "#/components/schemas/FieldConditions" + }, + "start_date": { + "$ref": "#/components/schemas/FieldConditions" + }, + "expiration_date": { + "$ref": "#/components/schemas/FieldConditions" + }, + "gift_balance": { + "$ref": "#/components/schemas/FieldConditions" + }, + "loyalty_balance": { + "$ref": "#/components/schemas/FieldConditions" + }, + "redemption_quantity": { + "$ref": "#/components/schemas/FieldConditions" + }, + "redemption_count": { + "$ref": "#/components/schemas/FieldConditions" + }, + "active": { + "$ref": "#/components/schemas/FieldConditions" + }, + "qr_code": { + "$ref": "#/components/schemas/FieldConditions" + }, + "bar_code": { + "$ref": "#/components/schemas/FieldConditions" + }, + "metadata": { + "$ref": "#/components/schemas/FieldConditions" + }, + "id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "is_referral_code": { + "$ref": "#/components/schemas/FieldConditions" + }, + "created_at": { + "$ref": "#/components/schemas/FieldConditions" + }, + "updated_at": { + "$ref": "#/components/schemas/FieldConditions" + }, + "validity_timeframe_interval": { + "$ref": "#/components/schemas/FieldConditions" + }, + "validity_timeframe_duration": { + "$ref": "#/components/schemas/FieldConditions" + }, + "validity_day_of_week": { + "$ref": "#/components/schemas/FieldConditions" + }, + "discount_amount_limit": { + "$ref": "#/components/schemas/FieldConditions" + }, + "campaign_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "additional_info": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "discount_unit_type": { + "$ref": "#/components/schemas/FieldConditions" + }, + "discount_unit_effect": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_source_id": { + "$ref": "#/components/schemas/FieldConditions" + } + } + }, + "Junction": { + "title": "Junction", + "enum": [ + "and", + "AND", + "or", + "OR" + ], + "type": "string" + }, + "ExportRedemption": { + "title": "Export Redemptions", + "type": "object", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "redemption" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportRedemptionOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportRedemptionFields" } + }, + "filters": { + "$ref": "#/components/schemas/ExportRedemptionFilters", + "description": "Filter conditions." } }, - "ExportPointsExpiration": { - "title": "Export Points Expirations", - "type": "object", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "points_expiration" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportPointsExpirationOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportPointsExpirationFields" - } - }, - "filters": { - "$ref": "#/components/schemas/ExportPointsExpirationFilters", - "description": "Filter conditions." - } - }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object", + "parameters" + ] + }, + "ExportRedemptionFilters": { + "title": "Export Redemption Filters", + "type": "object", + "additionalProperties": false, + "properties": { + "junction": { + "$ref": "#/components/schemas/Junction" + }, + "id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "object": { + "$ref": "#/components/schemas/FieldConditions" + }, + "date": { + "$ref": "#/components/schemas/FieldConditions" + }, + "voucher_code": { + "$ref": "#/components/schemas/FieldConditions" + }, + "campaign": { + "$ref": "#/components/schemas/FieldConditions" + }, + "promotion_tier_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_source_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_name": { + "$ref": "#/components/schemas/FieldConditions" + }, + "tracking_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "order_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "gift_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "loyalty_points": { + "$ref": "#/components/schemas/FieldConditions" + }, + "result": { + "$ref": "#/components/schemas/FieldConditions" + }, + "failure_code": { + "$ref": "#/components/schemas/FieldConditions" + }, + "failure_message": { + "$ref": "#/components/schemas/FieldConditions" + }, + "metadata": { + "$ref": "#/components/schemas/FieldConditions" + } + } + }, + "ExportCustomer": { + "title": "Export Customers", + "type": "object", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "customer" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportCustomerOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportCustomerFields" } }, - "required": [ - "exported_object", - "parameters" - ] - }, - "ExportPointsExpirationFilters": { - "title": "Export Points Expiration Filters", - "type": "object", - "properties": { - "junction": { - "$ref": "#/components/schemas/Junction" - }, - "id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "campaign_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "voucher_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "points": { - "$ref": "#/components/schemas/FieldConditions" - }, - "status": { - "$ref": "#/components/schemas/FieldConditions" - }, - "expires_at": { - "$ref": "#/components/schemas/FieldConditions" + "filters": { + "$ref": "#/components/schemas/ExportCustomerFilters", + "description": "Filter conditions." + } + }, + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object", + "parameters" + ] + }, + "ExportCustomerFilters": { + "title": "Export Customer Filters", + "type": "object", + "properties": { + "junction": { + "$ref": "#/components/schemas/Junction" + }, + "name": { + "$ref": "#/components/schemas/FieldConditions" + }, + "id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "description": { + "$ref": "#/components/schemas/FieldConditions" + }, + "email": { + "$ref": "#/components/schemas/FieldConditions" + }, + "source_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "created_at": { + "$ref": "#/components/schemas/FieldConditions" + }, + "address_city": { + "$ref": "#/components/schemas/FieldConditions" + }, + "address_state": { + "$ref": "#/components/schemas/FieldConditions" + }, + "address_line_1": { + "$ref": "#/components/schemas/FieldConditions" + }, + "address_line_2": { + "$ref": "#/components/schemas/FieldConditions" + }, + "address_country": { + "$ref": "#/components/schemas/FieldConditions" + }, + "address_postal_code": { + "$ref": "#/components/schemas/FieldConditions" + }, + "redemptions_total_redeemed": { + "$ref": "#/components/schemas/FieldConditions" + }, + "redemptions_total_failed": { + "$ref": "#/components/schemas/FieldConditions" + }, + "redemptions_total_succeeded": { + "$ref": "#/components/schemas/FieldConditions" + }, + "redemptions_total_rolled_back": { + "$ref": "#/components/schemas/FieldConditions" + }, + "redemptions_total_rollback_failed": { + "$ref": "#/components/schemas/FieldConditions" + }, + "redemptions_total_rollback_succeeded": { + "$ref": "#/components/schemas/FieldConditions" + }, + "orders_total_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "orders_total_count": { + "$ref": "#/components/schemas/FieldConditions" + }, + "orders_average_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "orders_last_order_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "orders_last_order_date": { + "$ref": "#/components/schemas/FieldConditions" + }, + "loyalty_points": { + "$ref": "#/components/schemas/FieldConditions" + }, + "loyalty_referred_customers": { + "$ref": "#/components/schemas/FieldConditions" + }, + "updated_at": { + "$ref": "#/components/schemas/FieldConditions" + }, + "phone": { + "$ref": "#/components/schemas/FieldConditions" + }, + "birthday": { + "$ref": "#/components/schemas/FieldConditions" + }, + "metadata": { + "$ref": "#/components/schemas/FieldConditions" + }, + "birthdate": { + "$ref": "#/components/schemas/FieldConditions" + } + } + }, + "ExportPublication": { + "title": "Export Publications", + "type": "object", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "publication" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportPublicationOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportPublicationFields" } + }, + "filters": { + "$ref": "#/components/schemas/ExportPublicationFilters", + "description": "Filter conditions." } }, - "ExportVoucherTransactionsExpiration": { - "title": "Export Vouchers Transactions Expiration", - "type": "object", - "properties": { - "exported_object": { - "type": "string", - "enum": [ - "voucher_transactions" - ], - "description": "The type of object to be exported." - }, - "parameters": { - "type": "object", - "properties": { - "order": { - "$ref": "#/components/schemas/ExportVoucherTransactionsOrder", - "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." - }, - "fields": { - "type": "array", - "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", - "items": { - "$ref": "#/components/schemas/ExportVoucherTransactionsFields" - } - }, - "filters": { - "$ref": "#/components/schemas/ExportVoucherTransactionsFilters", - "description": "Filter conditions." - } - }, - "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." - } + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object", + "parameters" + ] + }, + "ExportPublicationFilters": { + "title": "Export Publication Filters", + "type": "object", + "properties": { + "junction": { + "$ref": "#/components/schemas/Junction" + }, + "voucher_code": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_source_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "date": { + "$ref": "#/components/schemas/FieldConditions" + }, + "channel": { + "$ref": "#/components/schemas/FieldConditions" + }, + "campaign": { + "$ref": "#/components/schemas/FieldConditions" + }, + "is_winner": { + "$ref": "#/components/schemas/FieldConditions" + }, + "metadata": { + "$ref": "#/components/schemas/FieldConditions" + } + } + }, + "ExportOrder": { + "title": "Export Orders", + "type": "object", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "order" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportOrderOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." }, - "required": [ - "exported_object", - "parameters" - ] - }, - "ExportVoucherTransactionsFilters": { - "title": "Export Voucher Transactions Filters", - "type": "object", - "properties": { - "junction": { - "$ref": "#/components/schemas/Junction" - }, - "id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "campaign_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "voucher_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "type": { - "$ref": "#/components/schemas/FieldConditions" - }, - "source_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "reason": { - "$ref": "#/components/schemas/FieldConditions" - }, - "source": { - "$ref": "#/components/schemas/FieldConditions" - }, - "balance": { - "$ref": "#/components/schemas/FieldConditions" - }, - "amount": { - "$ref": "#/components/schemas/FieldConditions" - }, - "related_transaction_id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "created_at": { - "$ref": "#/components/schemas/FieldConditions" - }, - "details": { - "$ref": "#/components/schemas/FieldConditions" + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportOrderFields" } + }, + "filters": { + "$ref": "#/components/schemas/ExportOrderFilters", + "description": "Filter conditions." } }, - "ExportsGetResponseBody": { - "$ref": "#/components/schemas/Export", - "title": "" - }, - "ExportsListResponseBody": { - "title": "Exports List Response Body", - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "description": "The type of object represented by JSON. This object stores information about exports." - }, - "data_ref": { - "type": "string", - "enum": [ - "exports" - ], - "description": "Identifies the name of the attribute that contains the array of exports." - }, - "exports": { - "type": "array", - "description": "An array of export objects.", - "items": { - "$ref": "#/components/schemas/Export" - } - }, - "total": { - "type": "integer", - "description": "Total number of exports." + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object", + "parameters" + ] + }, + "ExportOrderFilters": { + "title": "Export Order Filters", + "type": "object", + "additionalProperties": false, + "properties": { + "junction": { + "$ref": "#/components/schemas/Junction" + }, + "id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "source_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "created_at": { + "$ref": "#/components/schemas/FieldConditions" + }, + "updated_at": { + "$ref": "#/components/schemas/FieldConditions" + }, + "status": { + "$ref": "#/components/schemas/FieldConditions" + }, + "amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "discount_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "items_discount_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "total_discount_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "total_amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "customer_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "referrer_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "metadata": { + "$ref": "#/components/schemas/FieldConditions" + } + } + }, + "ExportPointsExpiration": { + "title": "Export Points Expirations", + "type": "object", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "points_expiration" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportPointsExpirationOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportPointsExpirationFields" } }, - "required": [ - "object", - "data_ref", - "exports", - "total" - ] - }, - "ExportCustomerFields": { - "type": "string", - "enum": [ - "name", - "id", - "description", - "email", - "source_id", - "created_at", - "address_city", - "address_state", - "address_line_1", - "address_line_2", - "address_country", - "address_postal_code", - "redemptions_total_redeemed", - "redemptions_total_failed", - "redemptions_total_succeeded", - "redemptions_total_rolled_back", - "redemptions_total_rollback_failed", - "redemptions_total_rollback_succeeded", - "orders_total_amount", - "orders_total_count", - "orders_average_amount", - "orders_last_order_amount", - "orders_last_order_date", - "loyalty_points", - "loyalty_referred_customers", - "updated_at", - "phone", - "birthday", - "metadata", - "birthdate" - ], - "title": "Export Customer Fields" - }, - "ExportCustomerOrder": { - "title": "Export Customer Order", - "type": "string", - "enum": [ - "name", - "-name", - "id", - "-id", - "description", - "-description", - "email", - "-email", - "source_id", - "-source_id", - "created_at", - "-created_at", - "address_city", - "-address_city", - "address_state", - "-address_state", - "address_line_1", - "-address_line_1", - "address_line_2", - "-address_line_2", - "address_country", - "-address_country", - "address_postal_code", - "-address_postal_code", - "redemptions_total_redeemed", - "-redemptions_total_redeemed", - "redemptions_total_failed", - "-redemptions_total_failed", - "redemptions_total_succeeded", - "-redemptions_total_succeeded", - "redemptions_total_rolled_back", - "-redemptions_total_rolled_back", - "redemptions_total_rollback_failed", - "-redemptions_total_rollback_failed", - "redemptions_total_rollback_succeeded", - "-redemptions_total_rollback_succeeded", - "orders_total_amount", - "-orders_total_amount", - "orders_total_count", - "-orders_total_count", - "orders_average_amount", - "-orders_average_amount", - "orders_last_order_amount", - "-orders_last_order_amount", - "orders_last_order_date", - "-orders_last_order_date", - "loyalty_points", - "-loyalty_points", - "loyalty_referred_customers", - "-loyalty_referred_customers", - "updated_at", - "-updated_at", - "phone", - "-phone", - "birthday", - "-birthday", - "metadata", - "-metadata", - "birthdate", - "-birthdate" - ] - }, - "ExportPublicationFields": { - "title": "Export Publication Fields", - "type": "string", - "enum": [ - "voucher_code", - "customer_id", - "customer_source_id", - "date", - "channel", - "campaign", - "is_winner", - "metadata" - ] - }, - "ExportPublicationOrder": { - "title": "Export Publication Order", - "type": "string", - "enum": [ - "voucher_code", - "-voucher_code", - "customer_id", - "-customer_id", - "customer_source_id", - "-customer_source_id", - "date", - "-date", - "channel", - "-channel", - "campaign", - "-campaign", - "is_winner", - "-is_winner", - "metadata", - "-metadata" - ] - }, - "ExportRedemptionFields": { - "title": "Export Redemption Fields", - "type": "string", - "enum": [ - "id", - "object", - "date", - "voucher_code", - "campaign", - "promotion_tier_id", - "customer_id", - "customer_source_id", - "customer_name", - "tracking_id", - "order_amount", - "gift_amount", - "loyalty_points", - "result", - "failure_code", - "failure_message", - "metadata" - ] - }, - "ExportRedemptionOrder": { - "title": "Export Redemption Order", - "type": "string", - "enum": [ - "id", - "-id", - "object", - "-object", - "date", - "-date", - "voucher_code", - "-voucher_code", - "campaign", - "-campaign", - "promotion_tier_id", - "-promotion_tier_id", - "customer_id", - "-customer_id", - "customer_source_id", - "-customer_source_id", - "customer_name", - "-customer_name", - "tracking_id", - "-tracking_id", - "order_amount", - "-order_amount", - "gift_amount", - "-gift_amount", - "loyalty_points", - "-loyalty_points", - "result", - "-result", - "failure_code", - "-failure_code", - "failure_message", - "-failure_message", - "metadata", - "-metadata" - ] - }, - "ExportVoucherFields": { - "title": "Export Voucher Fields", - "type": "string", - "enum": [ - "code", - "voucher_type", - "value", - "discount_type", - "campaign", - "category", - "start_date", - "expiration_date", - "gift_balance", - "loyalty_balance", - "redemption_quantity", - "redemption_count", - "active", - "qr_code", - "bar_code", - "metadata", - "id", - "is_referral_code", - "created_at", - "updated_at", - "validity_timeframe_interval", - "validity_timeframe_duration", - "validity_day_of_week", - "discount_amount_limit", - "campaign_id", - "additional_info", - "customer_id", - "discount_unit_type", - "discount_unit_effect", - "customer_source_id" - ] - }, - "ExportVoucherOrder": { - "title": "Export Voucher Order", - "type": "string", - "enum": [ - "code", - "-code", - "voucher_type", - "-voucher_type", - "value", - "-value", - "discount_type", - "-discount_type", - "campaign", - "-campaign", - "category", - "-category", - "start_date", - "-start_date", - "expiration_date", - "-expiration_date", - "gift_balance", - "-gift_balance", - "loyalty_balance", - "-loyalty_balance", - "redemption_quantity", - "-redemption_quantity", - "redemption_count", - "-redemption_count", - "active", - "-active", - "qr_code", - "-qr_code", - "bar_code", - "-bar_code", - "metadata", - "-metadata", - "id", - "-id", - "is_referral_code", - "-is_referral_code", - "created_at", - "-created_at", - "updated_at", - "-updated_at", - "validity_timeframe_interval", - "-validity_timeframe_interval", - "validity_timeframe_duration", - "-validity_timeframe_duration", - "validity_day_of_week", - "-validity_day_of_week", - "discount_amount_limit", - "-discount_amount_limit", - "campaign_id", - "-campaign_id", - "additional_info", - "-additional_info", - "customer_id", - "-customer_id", - "discount_unit_type", - "-discount_unit_type", - "discount_unit_effect", - "-discount_unit_effect", - "customer_source_id", - "-customer_source_id" - ] - }, - "ExportOrderFields": { - "title": "Export Order Fields", - "type": "string", - "enum": [ - "id", - "source_id", - "created_at", - "updated_at", - "status", - "amount", - "discount_amount", - "items_discount_amount", - "total_discount_amount", - "total_amount", - "customer_id", - "referrer_id", - "metadata" - ] - }, - "ExportOrderOrder": { - "title": "Export Order Order", - "type": "string", - "enum": [ - "id", - "-id", - "source_id", - "-source_id", - "created_at", - "-created_at", - "updated_at", - "-updated_at", - "status", - "-status", - "amount", - "-amount", - "discount_amount", - "-discount_amount", - "items_discount_amount", - "-items_discount_amount", - "total_discount_amount", - "-total_discount_amount", - "total_amount", - "-total_amount", - "customer_id", - "-customer_id", - "referrer_id", - "-referrer_id", - "metadata", - "-metadata" - ] - }, - "ExportPointsExpirationFields": { - "title": "Export Points Expiration Fields", - "type": "string", - "enum": [ - "id", - "campaign_id", - "voucher_id", - "points", - "status", - "expires_at" - ] - }, - "ExportPointsExpirationOrder": { - "title": "Export Points Expiration Order", - "type": "string", - "enum": [ - "id", - "-id", - "campaign_id", - "-campaign_id", - "voucher_id", - "-voucher_id", - "points", - "-points", - "status", - "-status", - "expires_at", - "-expires_at" - ] - }, - "ExportVoucherTransactionsFields": { - "title": "Export Voucher Transactions Fields", - "type": "string", - "enum": [ - "id", - "campaign_id", - "voucher_id", - "type", - "source_id", - "reason", - "source", - "balance", - "amount", - "related_transaction_id", - "created_at", - "details" - ] + "filters": { + "$ref": "#/components/schemas/ExportPointsExpirationFilters", + "description": "Filter conditions." + } }, - "ExportVoucherTransactionsOrder": { - "title": "Export Voucher Transactions Order", - "type": "string", - "enum": [ - "id", - "-id", - "campaign_id", - "-campaign_id", - "voucher_id", - "-voucher_id", - "type", - "-type", - "source_id", - "-source_id", - "reason", - "-reason", - "source", - "-source", - "balance", - "-balance", - "amount", - "-amount", - "related_transaction_id", - "-related_transaction_id", - "created_at", - "-created_at", - "details", - "-details" - ] + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object", + "parameters" + ] + }, + "ExportPointsExpirationFilters": { + "title": "Export Points Expiration Filters", + "type": "object", + "properties": { + "junction": { + "$ref": "#/components/schemas/Junction" + }, + "id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "campaign_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "voucher_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "points": { + "$ref": "#/components/schemas/FieldConditions" + }, + "status": { + "$ref": "#/components/schemas/FieldConditions" + }, + "expires_at": { + "$ref": "#/components/schemas/FieldConditions" + } + } + }, + "ExportVoucherTransactionsExpiration": { + "title": "Export Vouchers Transactions Expiration", + "type": "object", + "properties": { + "exported_object": { + "type": "string", + "enum": [ + "voucher_transactions" + ], + "description": "The type of object to be exported." + }, + "parameters": { + "type": "object", + "properties": { + "order": { + "$ref": "#/components/schemas/ExportVoucherTransactionsOrder", + "description": "How the export is filtered, where the dash - preceding a sorting option means sorting in a descending order." + }, + "fields": { + "type": "array", + "description": "Array of strings containing the data in the export. These fields define the headers in the CSV file.", + "items": { + "$ref": "#/components/schemas/ExportVoucherTransactionsFields" + } + }, + "filters": { + "$ref": "#/components/schemas/ExportVoucherTransactionsFilters", + "description": "Filter conditions." + } }, - "Any": { + "description": "List of available fields and filters that can be exported with an order along with the sorting order of the returned data." + } + }, + "required": [ + "exported_object", + "parameters" + ] + }, + "ExportVoucherTransactionsFilters": { + "title": "Export Voucher Transactions Filters", + "type": "object", + "properties": { + "junction": { + "$ref": "#/components/schemas/Junction" + }, + "id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "campaign_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "voucher_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "type": { + "$ref": "#/components/schemas/FieldConditions" + }, + "source_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "reason": { + "$ref": "#/components/schemas/FieldConditions" + }, + "source": { + "$ref": "#/components/schemas/FieldConditions" + }, + "balance": { + "$ref": "#/components/schemas/FieldConditions" + }, + "amount": { + "$ref": "#/components/schemas/FieldConditions" + }, + "related_transaction_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "created_at": { + "$ref": "#/components/schemas/FieldConditions" + }, + "details": { + "$ref": "#/components/schemas/FieldConditions" + } + } + }, + "ExportsGetResponseBody": { + "$ref": "#/components/schemas/Export", + "title": "" + }, + "ExportsListResponseBody": { + "title": "Exports List Response Body", + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object represented by JSON. This object stores information about exports." + }, + "data_ref": { + "type": "string", + "enum": [ + "exports" + ], + "description": "Identifies the name of the attribute that contains the array of exports." + }, + "exports": { + "type": "array", + "description": "An array of export objects.", + "items": { + "$ref": "#/components/schemas/Export" + } + }, + "total": { + "type": "integer", + "description": "Total number of exports." + } + }, + "required": [ + "object", + "data_ref", + "exports", + "total" + ] + }, + "ExportCustomerFields": { + "type": "string", + "enum": [ + "name", + "id", + "description", + "email", + "source_id", + "created_at", + "address_city", + "address_state", + "address_line_1", + "address_line_2", + "address_country", + "address_postal_code", + "redemptions_total_redeemed", + "redemptions_total_failed", + "redemptions_total_succeeded", + "redemptions_total_rolled_back", + "redemptions_total_rollback_failed", + "redemptions_total_rollback_succeeded", + "orders_total_amount", + "orders_total_count", + "orders_average_amount", + "orders_last_order_amount", + "orders_last_order_date", + "loyalty_points", + "loyalty_referred_customers", + "updated_at", + "phone", + "birthday", + "metadata", + "birthdate" + ], + "title": "Export Customer Fields" + }, + "ExportCustomerOrder": { + "title": "Export Customer Order", + "type": "string", + "enum": [ + "name", + "-name", + "id", + "-id", + "description", + "-description", + "email", + "-email", + "source_id", + "-source_id", + "created_at", + "-created_at", + "address_city", + "-address_city", + "address_state", + "-address_state", + "address_line_1", + "-address_line_1", + "address_line_2", + "-address_line_2", + "address_country", + "-address_country", + "address_postal_code", + "-address_postal_code", + "redemptions_total_redeemed", + "-redemptions_total_redeemed", + "redemptions_total_failed", + "-redemptions_total_failed", + "redemptions_total_succeeded", + "-redemptions_total_succeeded", + "redemptions_total_rolled_back", + "-redemptions_total_rolled_back", + "redemptions_total_rollback_failed", + "-redemptions_total_rollback_failed", + "redemptions_total_rollback_succeeded", + "-redemptions_total_rollback_succeeded", + "orders_total_amount", + "-orders_total_amount", + "orders_total_count", + "-orders_total_count", + "orders_average_amount", + "-orders_average_amount", + "orders_last_order_amount", + "-orders_last_order_amount", + "orders_last_order_date", + "-orders_last_order_date", + "loyalty_points", + "-loyalty_points", + "loyalty_referred_customers", + "-loyalty_referred_customers", + "updated_at", + "-updated_at", + "phone", + "-phone", + "birthday", + "-birthday", + "metadata", + "-metadata", + "birthdate", + "-birthdate" + ] + }, + "ExportPublicationFields": { + "title": "Export Publication Fields", + "type": "string", + "enum": [ + "voucher_code", + "customer_id", + "customer_source_id", + "date", + "channel", + "campaign", + "is_winner", + "metadata" + ] + }, + "ExportPublicationOrder": { + "title": "Export Publication Order", + "type": "string", + "enum": [ + "voucher_code", + "-voucher_code", + "customer_id", + "-customer_id", + "customer_source_id", + "-customer_source_id", + "date", + "-date", + "channel", + "-channel", + "campaign", + "-campaign", + "is_winner", + "-is_winner", + "metadata", + "-metadata" + ] + }, + "ExportRedemptionFields": { + "title": "Export Redemption Fields", + "type": "string", + "enum": [ + "id", + "object", + "date", + "voucher_code", + "campaign", + "promotion_tier_id", + "customer_id", + "customer_source_id", + "customer_name", + "tracking_id", + "order_amount", + "gift_amount", + "loyalty_points", + "result", + "failure_code", + "failure_message", + "metadata" + ] + }, + "ExportRedemptionOrder": { + "title": "Export Redemption Order", + "type": "string", + "enum": [ + "id", + "-id", + "object", + "-object", + "date", + "-date", + "voucher_code", + "-voucher_code", + "campaign", + "-campaign", + "promotion_tier_id", + "-promotion_tier_id", + "customer_id", + "-customer_id", + "customer_source_id", + "-customer_source_id", + "customer_name", + "-customer_name", + "tracking_id", + "-tracking_id", + "order_amount", + "-order_amount", + "gift_amount", + "-gift_amount", + "loyalty_points", + "-loyalty_points", + "result", + "-result", + "failure_code", + "-failure_code", + "failure_message", + "-failure_message", + "metadata", + "-metadata" + ] + }, + "ExportVoucherFields": { + "title": "Export Voucher Fields", + "type": "string", + "enum": [ + "code", + "voucher_type", + "value", + "discount_type", + "campaign", + "category", + "start_date", + "expiration_date", + "gift_balance", + "loyalty_balance", + "redemption_quantity", + "redemption_count", + "active", + "qr_code", + "bar_code", + "metadata", + "id", + "is_referral_code", + "created_at", + "updated_at", + "validity_timeframe_interval", + "validity_timeframe_duration", + "validity_day_of_week", + "discount_amount_limit", + "campaign_id", + "additional_info", + "customer_id", + "discount_unit_type", + "discount_unit_effect", + "customer_source_id" + ] + }, + "ExportVoucherOrder": { + "title": "Export Voucher Order", + "type": "string", + "enum": [ + "code", + "-code", + "voucher_type", + "-voucher_type", + "value", + "-value", + "discount_type", + "-discount_type", + "campaign", + "-campaign", + "category", + "-category", + "start_date", + "-start_date", + "expiration_date", + "-expiration_date", + "gift_balance", + "-gift_balance", + "loyalty_balance", + "-loyalty_balance", + "redemption_quantity", + "-redemption_quantity", + "redemption_count", + "-redemption_count", + "active", + "-active", + "qr_code", + "-qr_code", + "bar_code", + "-bar_code", + "metadata", + "-metadata", + "id", + "-id", + "is_referral_code", + "-is_referral_code", + "created_at", + "-created_at", + "updated_at", + "-updated_at", + "validity_timeframe_interval", + "-validity_timeframe_interval", + "validity_timeframe_duration", + "-validity_timeframe_duration", + "validity_day_of_week", + "-validity_day_of_week", + "discount_amount_limit", + "-discount_amount_limit", + "campaign_id", + "-campaign_id", + "additional_info", + "-additional_info", + "customer_id", + "-customer_id", + "discount_unit_type", + "-discount_unit_type", + "discount_unit_effect", + "-discount_unit_effect", + "customer_source_id", + "-customer_source_id" + ] + }, + "ExportOrderFields": { + "title": "Export Order Fields", + "type": "string", + "enum": [ + "id", + "source_id", + "created_at", + "updated_at", + "status", + "amount", + "discount_amount", + "items_discount_amount", + "total_discount_amount", + "total_amount", + "customer_id", + "referrer_id", + "metadata" + ] + }, + "ExportOrderOrder": { + "title": "Export Order Order", + "type": "string", + "enum": [ + "id", + "-id", + "source_id", + "-source_id", + "created_at", + "-created_at", + "updated_at", + "-updated_at", + "status", + "-status", + "amount", + "-amount", + "discount_amount", + "-discount_amount", + "items_discount_amount", + "-items_discount_amount", + "total_discount_amount", + "-total_discount_amount", + "total_amount", + "-total_amount", + "customer_id", + "-customer_id", + "referrer_id", + "-referrer_id", + "metadata", + "-metadata" + ] + }, + "ExportPointsExpirationFields": { + "title": "Export Points Expiration Fields", + "type": "string", + "enum": [ + "id", + "campaign_id", + "voucher_id", + "points", + "status", + "expires_at" + ] + }, + "ExportPointsExpirationOrder": { + "title": "Export Points Expiration Order", + "type": "string", + "enum": [ + "id", + "-id", + "campaign_id", + "-campaign_id", + "voucher_id", + "-voucher_id", + "points", + "-points", + "status", + "-status", + "expires_at", + "-expires_at" + ] + }, + "ExportVoucherTransactionsFields": { + "title": "Export Voucher Transactions Fields", + "type": "string", + "enum": [ + "id", + "campaign_id", + "voucher_id", + "type", + "source_id", + "reason", + "source", + "balance", + "amount", + "related_transaction_id", + "created_at", + "details" + ] + }, + "ExportVoucherTransactionsOrder": { + "title": "Export Voucher Transactions Order", + "type": "string", + "enum": [ + "id", + "-id", + "campaign_id", + "-campaign_id", + "voucher_id", + "-voucher_id", + "type", + "-type", + "source_id", + "-source_id", + "reason", + "-reason", + "source", + "-source", + "balance", + "-balance", + "amount", + "-amount", + "related_transaction_id", + "-related_transaction_id", + "created_at", + "-created_at", + "details", + "-details" + ] + }, + "Any": { + "anyOf": [ + { + "title": "array", + "type": "array", + "items": { "anyOf": [ - { - "title": "array", - "type": "array", - "items": { - "anyOf": [ - { - "title": "string", - "type": "string" - }, - { - "title": "number", - "type": "number" - }, - { - "title": "object", - "type": "object" - } - ] - } - }, { "title": "string", "type": "string" @@ -43334,1708 +43353,4304 @@ "title": "object", "type": "object" } - ], - "title": "Any" - }, - "LoyaltiesCreateTiersRequestBody": { - "title": "Loyalties Create Tiers Request Body", - "type": "array", - "items": { - "allOf": [ - { - "$ref": "#/components/schemas/LoyaltyTierBase" - }, - { - "type": "object", - "properties": { - "metadata": { - "description": "The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format.", - "type": "object" - } - } - } - ] - } - }, - "LoyaltiesCreateTiersResponseBody": { - "title": "Loyalties Create Tiers Response Body", - "type": "array", - "items": { - "$ref": "#/components/schemas/LoyaltyTier" - } - }, - "LoyaltiesGetRewardAssignmentResponseBody": { - "$ref": "#/components/schemas/RewardAssignment" - }, - "LoyaltiesGetRewardDetailsResponseBody": { - "$ref": "#/components/schemas/Reward" - }, - "LoyaltiesListTiersRequestQuery": { - "title": "Loyalties List Tiers Request Query", - "type": "object", - "properties": { - "limit": { - "type": "integer", - "minimum": 1, - "multipleOf": 100, - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." - }, - "page": { - "type": "integer", - "description": "Which page of results to return." - }, - "order": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ], - "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." - } - } + ] + } + }, + { + "title": "string", + "type": "string" + }, + { + "title": "number", + "type": "number" + }, + { + "title": "object", + "type": "object" + } + ], + "title": "Any" + }, + "LoyaltiesCreateTiersRequestBody": { + "title": "Loyalties Create Tiers Request Body", + "x-stoplight": { + "id": "i1emmwlaqp7lt" + }, + "type": "array", + "items": { + "allOf": [ + { + "$ref": "#/components/schemas/LoyaltyTierBase" }, - "LoyaltiesListLoyaltyTierEarningRulesRequestQuery": { - "title": "LoyaltiesListLoyaltyTierEarningRulesRequestQuery", + { "type": "object", "properties": { - "limit": { - "type": "integer", - "minimum": 1, - "multipleOf": 100, - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." - }, - "page": { - "type": "integer", - "description": "Which page of results to return." + "metadata": { + "description": "The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format.", + "type": "object" } } - }, - "LoyaltiesGetTierResponseBody": { + } + ] + } + }, + "LoyaltiesCreateTiersResponseBody": { + "title": "Loyalties Create Tiers Response Body", + "x-stoplight": { + "id": "ix7g5mnuwqsp6" + }, + "type": "array", + "items": { + "$ref": "#/components/schemas/LoyaltyTier" + } + }, + "LoyaltiesGetRewardAssignmentResponseBody": { + "$ref": "#/components/schemas/RewardAssignment", + "x-stoplight": { + "id": "fnbbaq9l1l9it" + } + }, + "LoyaltiesGetRewardDetailsResponseBody": { + "$ref": "#/components/schemas/Reward", + "x-stoplight": { + "id": "44hds9u0hhukf" + } + }, + "LoyaltiesListTiersRequestQuery": { + "title": "Loyalties List Tiers Request Query", + "x-stoplight": { + "id": "d5sluzqkxu8km" + }, + "type": "object", + "properties": { + "limit": { + "type": "integer", + "minimum": 1, + "multipleOf": 100, + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." + }, + "page": { + "type": "integer", + "description": "Which page of results to return." + }, + "order": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ], + "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." + } + } + }, + "LoyaltiesListLoyaltyTierEarningRulesRequestQuery": { + "title": "LoyaltiesListLoyaltyTierEarningRulesRequestQuery", + "x-stoplight": { + "id": "zs0z1cyyzac9u" + }, + "type": "object", + "properties": { + "limit": { + "type": "integer", + "minimum": 1, + "multipleOf": 100, + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." + }, + "page": { + "type": "integer", + "description": "Which page of results to return." + } + } + }, + "LoyaltiesGetTierResponseBody": { + "$ref": "#/components/schemas/LoyaltyTier", + "x-stoplight": { + "id": "hzcsijl2b4d5o" + } + }, + "LoyaltiesListTiersResponseBody": { + "title": "Loyalties List Tiers Response Body", + "x-stoplight": { + "id": "kw06g2szvv479" + }, + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary." + }, + "data_ref": { + "type": "string", + "enum": [ + "data" + ], + "description": "Identifies the name of the attribute that contains the array of loyalty tier objects." + }, + "data": { + "type": "array", + "description": "This is an object representing a loyalty tier. Loyalty tiers are used to create a loyalty program with different levels of membership and varied earning rules and rewards based on customer’s tiers.", + "items": { "$ref": "#/components/schemas/LoyaltyTier" - }, - "LoyaltiesListTiersResponseBody": { - "title": "Loyalties List Tiers Response Body", - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "description": "The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary." - }, - "data_ref": { - "type": "string", - "enum": [ - "data" - ], - "description": "Identifies the name of the attribute that contains the array of loyalty tier objects." - }, - "data": { - "type": "array", - "description": "This is an object representing a loyalty tier. Loyalty tiers are used to create a loyalty program with different levels of membership and varied earning rules and rewards based on customer’s tiers.", - "items": { - "$ref": "#/components/schemas/LoyaltyTier" - } - }, - "total": { - "type": "integer", - "description": "Total number of loyalty tier objects." - } - }, - "required": [ - "object", - "data_ref", - "data", - "total" - ] - }, - "LoyaltiesListMemberLoyaltyTiersResponseBody": { - "title": "Loyalties List Member Loyalty Tiers Response Body", - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "description": "The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary." - }, - "data_ref": { - "type": "string", - "enum": [ - "data" - ], - "description": "Identifies the name of the attribute that contains the array of loyalty tier objects." - }, - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/LoyaltyTier" - } - }, - "total": { - "type": "integer", - "description": "Total number of loyalty tier objects." - } - }, - "required": [ - "object", - "data_ref", - "data", - "total" - ] - }, - "EarningRule": { - "allOf": [ - { - "$ref": "#/components/schemas/EarningRuleBase" - }, - { - "type": "object", - "properties": { - "validation_rule_id": { - "type": [ - "string", - "null" - ], - "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." - }, - "updated_at": { - "type": [ - "string", - "null" - ], - "format": "date-time", - "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format." - }, - "active": { - "type": "boolean", - "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date.\n\n- `true` indicates an active earning rule\n- `false` indicates an inactive earning rule" - } - }, - "required": [ - "validation_rule_id", - "updated_at", - "active" - ] - } - ] - }, - "LoyaltiesListLoyaltyTierEarningRulesResponseBody": { - "title": "Loyalties List Loyalty Tier Earning Rules ResponseBody", - "type": "object", - "properties": { - "object": { - "type": "string", - "enum": [ - "list" - ], - "description": "The type of object represented by JSON. This object stores information about earning rules in a dictionary." - }, - "data_ref": { - "type": "string", - "enum": [ - "data" - ], - "description": "Identifies the name of the attribute that contains the array of earning rule objects." - }, - "data": { - "type": "array", - "description": "Contains array of earning rule objects.", - "items": { - "$ref": "#/components/schemas/EarningRule" - } - }, - "total": { - "type": "integer", - "description": "Total number of earning rule objects." - } + } + }, + "total": { + "type": "integer", + "description": "Total number of loyalty tier objects." + } + }, + "required": [ + "object", + "data_ref", + "data", + "total" + ] + }, + "LoyaltiesListMemberLoyaltyTiersResponseBody": { + "title": "Loyalties List Member Loyalty Tiers Response Body", + "x-stoplight": { + "id": "s3zpgud510xl6" + }, + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object represented by JSON. This object stores information about loyalty tiers in a dictionary." + }, + "data_ref": { + "type": "string", + "enum": [ + "data" + ], + "description": "Identifies the name of the attribute that contains the array of loyalty tier objects." + }, + "data": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LoyaltyTier" + } + }, + "total": { + "type": "integer", + "description": "Total number of loyalty tier objects." + } + }, + "required": [ + "object", + "data_ref", + "data", + "total" + ] + }, + "EarningRule": { + "allOf": [ + { + "$ref": "#/components/schemas/EarningRuleBase" + }, + { + "type": "object", + "properties": { + "validation_rule_id": { + "type": [ + "string", + "null" + ], + "description": "A unique validation rule identifier assigned by the Voucherify API. The validation rule is verified before points are added to the balance." }, - "required": [ - "object", - "data_ref", - "data", - "total" - ] - }, - "LoyaltyTierBase": { - "title": "Loyalty Tier Base", - "type": "object", - "properties": { - "name": { - "type": "string", - "description": "Loyalty Tier name." - }, - "earning_rules": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/MappingPoints" - }, - "description": "Contains a list of earning rule IDs and their points mapping for the given earning rule." - }, - "rewards": { - "type": "object", - "additionalProperties": { - "$ref": "#/components/schemas/MappingPoints" - }, - "description": "Contains a list of reward IDs and their points mapping for the given reward." - }, - "points": { - "type": "object", - "description": "Defines range of loyalty tier in points.", - "properties": { - "from": { - "type": "integer", - "description": "Bottom points threshold value." - }, - "to": { - "type": "integer", - "description": "Top points threshold value." - } - } - } + "updated_at": { + "type": [ + "string", + "null" + ], + "format": "date-time", + "description": "Timestamp representing the date and time when the earning rule was last updated in ISO 8601 format." }, - "required": [ - "name", - "points" - ] + "active": { + "type": "boolean", + "description": "A flag to toggle the earning rule on or off. You can disable an earning rule even though it's within the active period defined by the start_date and expiration_date of the campaign or the earning rule's own start_date and expiration_date.\n\n- `true` indicates an active earning rule\n- `false` indicates an inactive earning rule" + } }, - "LoyaltyTier": { - "allOf": [ - { - "$ref": "#/components/schemas/LoyaltyTierBase" - }, - { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Unique loyalty tier ID." - }, - "campaign_id": { - "type": "string", - "description": "Unique parent campaign ID." - }, - "metadata": { - "type": [ - "object", - "null" - ], - "description": "The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format." - }, - "created_at": { - "type": "string", - "format": "date-time", - "description": "Timestamp representing the date and time when the loyalty tier was created in ISO 8601 format." - }, - "updated_at": { - "type": [ - "string", - "null" - ], - "format": "date-time", - "description": "Timestamp representing the date and time when the loyalty tier was updated in ISO 8601 format." - }, - "config": { - "type": "object", - "description": "Defines loyalty tier range in points.", - "required": [ - "points" - ], - "properties": { - "points": { - "type": "object", - "description": "Defines range of loyalty tier in points.", - "properties": { - "from": { - "type": "integer", - "description": "Bottom points threshold value." - }, - "to": { - "type": "integer", - "description": "Top points threshold value." - } - } - } - } - }, - "expiration": { - "type": "object", - "description": "Defines loyalty tier expiration date.", - "properties": { - "customer_id": { - "type": "string" - }, - "campaign_id": { - "type": "string" - }, - "tier_id": { - "type": "string" - }, - "start_date": { - "type": "string", - "format": "date-time" - }, - "expiration_date": { - "type": "string", - "format": "date-time" - }, - "created_at": { - "type": "string", - "format": "date-time" - }, - "updated_at": { - "type": "string", - "format": "date-time" - } + "required": [ + "validation_rule_id", + "updated_at", + "active" + ] + } + ] + }, + "LoyaltiesListLoyaltyTierEarningRulesResponseBody": { + "title": "Loyalties List Loyalty Tier Earning Rules ResponseBody", + "x-stoplight": { + "id": "i180zbh3ffwaa" + }, + "type": "object", + "properties": { + "object": { + "type": "string", + "enum": [ + "list" + ], + "description": "The type of object represented by JSON. This object stores information about earning rules in a dictionary." + }, + "data_ref": { + "type": "string", + "enum": [ + "data" + ], + "description": "Identifies the name of the attribute that contains the array of earning rule objects." + }, + "data": { + "type": "array", + "description": "Contains array of earning rule objects.", + "items": { + "$ref": "#/components/schemas/EarningRule" + } + }, + "total": { + "type": "integer", + "description": "Total number of earning rule objects." + } + }, + "required": [ + "object", + "data_ref", + "data", + "total" + ] + }, + "LoyaltyTierBase": { + "title": "Loyalty Tier Base", + "x-stoplight": { + "id": "3af9422223696" + }, + "type": "object", + "properties": { + "name": { + "type": "string", + "description": "Loyalty Tier name." + }, + "earning_rules": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/MappingPoints" + }, + "description": "Contains a list of earning rule IDs and their points mapping for the given earning rule." + }, + "rewards": { + "type": "object", + "additionalProperties": { + "$ref": "#/components/schemas/MappingPoints" + }, + "description": "Contains a list of reward IDs and their points mapping for the given reward." + }, + "points": { + "type": "object", + "description": "Defines range of loyalty tier in points.", + "properties": { + "from": { + "type": "integer", + "description": "Bottom points threshold value." + }, + "to": { + "type": "integer", + "description": "Top points threshold value." + } + } + } + }, + "required": [ + "name", + "points" + ] + }, + "LoyaltyTier": { + "allOf": [ + { + "$ref": "#/components/schemas/LoyaltyTierBase" + }, + { + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Unique loyalty tier ID." + }, + "campaign_id": { + "type": "string", + "description": "Unique parent campaign ID." + }, + "metadata": { + "type": [ + "object", + "null" + ], + "description": "The metadata object stores all custom attributes assigned to the loyalty tier. A set of key/value pairs that you can attach to a loyalty tier object. It can be useful for storing additional information about the loyalty tier in a structured format." + }, + "created_at": { + "type": "string", + "format": "date-time", + "description": "Timestamp representing the date and time when the loyalty tier was created in ISO 8601 format." + }, + "updated_at": { + "type": [ + "string", + "null" + ], + "format": "date-time", + "description": "Timestamp representing the date and time when the loyalty tier was updated in ISO 8601 format." + }, + "config": { + "type": "object", + "description": "Defines loyalty tier range in points.", + "required": [ + "points" + ], + "properties": { + "points": { + "type": "object", + "description": "Defines range of loyalty tier in points.", + "properties": { + "from": { + "type": "integer", + "description": "Bottom points threshold value." }, - "required": [ - "customer_id", - "campaign_id", - "tier_id", - "created_at" - ] - }, - "object": { - "type": "string", - "enum": [ - "loyalty_tier" - ], - "description": "The type of object represented by JSON. This object stores information about the loyalty." + "to": { + "type": "integer", + "description": "Top points threshold value." + } } - }, - "required": [ - "id", - "campaign_id", - "metadata", - "created_at", - "config", - "object" - ] + } } - ] - }, - "MappingMultiply": { - "title": "MappingMultiply", - "type": "object", - "properties": { - "type": { - "type": "string", - "enum": [ - "MULTIPLY" - ], - "description": "Type of calculation." + }, + "expiration": { + "type": "object", + "description": "Defines loyalty tier expiration date.", + "properties": { + "customer_id": { + "type": "string" + }, + "campaign_id": { + "type": "string" + }, + "tier_id": { + "type": "string" + }, + "start_date": { + "type": "string", + "format": "date-time" + }, + "expiration_date": { + "type": "string", + "format": "date-time" + }, + "created_at": { + "type": "string", + "format": "date-time" + }, + "updated_at": { + "type": "string", + "format": "date-time" + } }, - "multiplier": { - "type": "number", - "description": "Multiplication factor used to multiply the points to obtain the mapped points." - } + "required": [ + "customer_id", + "campaign_id", + "tier_id", + "created_at" + ] + }, + "object": { + "type": "string", + "enum": [ + "loyalty_tier" + ], + "description": "The type of object represented by JSON. This object stores information about the loyalty." + } + }, + "required": [ + "id", + "campaign_id", + "metadata", + "created_at", + "config", + "object" + ] + } + ] + }, + "MappingMultiply": { + "title": "MappingMultiply", + "x-stoplight": { + "id": "7zrwgr2oqh4tj" + }, + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "MULTIPLY" + ], + "description": "Type of calculation." + }, + "multiplier": { + "type": "number", + "description": "Multiplication factor used to multiply the points to obtain the mapped points." + } + } + }, + "MappingFixed": { + "title": "MappingFixed", + "x-stoplight": { + "id": "86eksegayxcxa" + }, + "type": "object", + "properties": { + "type": { + "type": "string", + "enum": [ + "CUSTOM" + ], + "description": "Type of calculation.\n\n" + }, + "points": { + "type": "integer", + "description": "Fixed number of points to be applied." + } + } + }, + "MappingPoints": { + "anyOf": [ + { + "$ref": "#/components/schemas/MappingMultiply" + }, + { + "$ref": "#/components/schemas/MappingFixed" + } + ] + }, + "a_req_importCSV": { + "type": "object", + "title": "Import CSV file", + "description": "Request body schema for importing data using a CSV file.", + "format": "binary", + "properties": { + "file": { + "type": "string", + "format": "binary", + "description": "File path." + } + }, + "required": [ + "file" + ] + }, + "a_res_async_actions": { + "type": "object", + "title": "Asynchronous Actions", + "description": "Response to requests that are processed asynchronously.", + "additionalProperties": false, + "examples": [ + { + "async_action_id": "aa_0a875d56c805df6601" + } + ], + "properties": { + "async_action_id": { + "type": "string", + "example": "aa_0a875d56c805df6601", + "description": "The ID of the scheduled asynchronous action." + } + }, + "required": [ + "async_action_id" + ] + }, + "error": { + "title": "error", + "type": "object", + "properties": {}, + "discriminator": { + "propertyName": "key", + "mapping": { + "not_enough_codes": "not_enough_codes" + } + }, + "description": "Short error response", + "examples": [] + }, + "e_error": { + "title": "Error Object", + "type": "object", + "description": "Error details", + "properties": { + "code": { + "type": "integer", + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a885062c80375740f", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + }, + "error": { + "type": "object", + "description": "Contains custom user-defined error message translation.", + "properties": { + "message": { + "type": "string", + "description": "Error message translation defined in Dashboard → Project Settings → Error Messages" + } + } + } + } + }, + "e_error_expanded": { + "title": "Error Object", + "type": "object", + "description": "Error details", + "properties": { + "code": { + "type": "integer", + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a885062c80375740f", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + }, + "resource_id": { + "type": "string", + "description": "Unique resource ID that can be used in another endpoint to get more details.", + "example": "rf_0c5d710a87c8a31f86" + }, + "resource_type": { + "type": "string", + "description": "The resource type.", + "example": "redemption" + }, + "error": { + "type": "object", + "description": "Contains custom user-defined error message translation.", + "properties": { + "message": { + "type": "string", + "description": "Error message translation defined in Dashboard → Project Settings → Error Messages" + } + } + } + } + }, + "e_error_no_translation": { + "title": "Error Object", + "type": "object", + "description": "Error details", + "properties": { + "code": { + "type": "integer", + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a885062c80375740f", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + } + } + }, + "e_integration_key": { + "title": "Error Object", + "type": "object", + "description": "Error details", + "properties": { + "code": { + "type": "integer", + "description": "Error's HTTP status code." + }, + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the error." + }, + "key": { + "type": "string", + "description": "Short string describing the kind of error which occurred." + } + } + }, + "e_400_missing_param": { + "description": "Error: Bad Request → Missing Parameters", + "type": "object", + "title": "Missing Parameters", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "missing_param", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Missing required parameter", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "example": "Parameter 'custom_event.schema_id' is required", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a96c19b1a41c03999", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + } + } + }, + "e_400_not_enough_source_ids": { + "description": "Error: Bad Request → Missing Parameters", + "type": "object", + "title": "Not Enough Source ID's", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "not_enought_source_ids", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Not enough source_ids", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "example": "Specify at least 1 source_id", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a96c19b1a41c03999", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + } + } + }, + "e_400_invalid_payload": { + "title": "Invalid Payload", + "type": "object", + "description": "Error: Bad Request → Invalid Payload", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "invalid_payload", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Invalid payload", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a884c6be8c3756f42", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + } + } + }, + "e_400_invalid_balance": { + "title": "Invalid Balance", + "type": "object", + "description": "Error: Bad Request → Invalid Balance", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "invalid_balance", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a884c6be8c3756f42", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + } + } + }, + "e_400_resource_in_use": { + "title": "Resource in use", + "type": "object", + "description": "Error: Bad Request - Resource in use", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "resource_in_use", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Resource in use", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a884c6be8c3756f42", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + }, + "related_object_ids": { + "type": "array", + "description": "Name or ID of the resources that are related.", + "items": { + "type": "string", + "example": "rewa_5WV7H3y2lT3GGl03Xjw29IEc" + } + }, + "related_object_type": { + "type": "string", + "description": "Specifies the type of resource that is related." + } + } + }, + "e_400_invalid_export_fields": { + "title": "Invalid Export Fields", + "type": "object", + "description": "Error: Bad Request → Invalid Export Fields", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "invalid_export_fields", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Invalid Export", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a884c6be8c3756f42", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + } + } + }, + "e_400_invalid_voucher": { + "title": "Invalid Voucher", + "type": "object", + "description": "Error: Bad Request → Invalid Voucher", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "invalid_voucher", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Invalid Voucher", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a884c6be8c3756f42", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + } + } + }, + "e_400_invalid_validation_rules": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "description": "Error's HTTP status code.", + "default": 400 + }, + "key": { + "type": "string", + "default": "invalid_validation_rules", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + } + }, + "title": "Invalid Validation Rules", + "description": "Error: Bad Request → Invalid Validation Rules" + }, + "e_400_not_enough_codes": { + "title": "Not Enough Codes", + "type": "object", + "description": "Error: Bad Request → Not enough codes", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "not_enough_codes", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Not enough codes", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "example": "Specify at least 1 code in codes.", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a885062c80375740f", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + } + } + }, + "e_400_metadata_validation_failed": { + "title": "Metadata Validation Failed", + "type": "object", + "description": "Error: Bad Request → Metadata validation failed", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "metadata_validation_failed", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Metadata validation failed", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "example": "Ranking: must be a number (actual value is 'true')", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a885062c80375740f", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + } + } + }, + "e_400_missing_reward": { + "title": "Missing Reward", + "type": "object", + "description": "Error: Bad Request → Missing Reward", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "missing_reward", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Missing reward", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "example": "A reward is required when redeeming a LOYALTY_CARD", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a885062c80375740f", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + }, + "resource_id": { + "type": "string", + "example": "rf_0b3a1814550e5aaa34", + "description": "Unique resource ID that can be used in another endpoint to get more details." + }, + "resource_type": { + "type": "string", + "example": "redemption", + "description": "The resource type." + }, + "error": { + "type": "object", + "description": "Contains error message translation.", + "properties": { + "message": { + "type": "string", + "example": "Missing reward = please add one.", + "description": "Error message translation defined in Dashboard → Project Settings → Error Messages" + } + } + } + } + }, + "e_400_missing_order": { + "title": "Missing Order", + "type": "object", + "description": "Error: Bad Request → Missing Order", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "missing_order", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Missing order", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "example": "An order is required when redeeming a LOYALTY_CARD", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a885062c80375740f", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + }, + "resource_id": { + "type": "string", + "example": "rf_0b3a1814550e5aaa34", + "description": "Unique resource ID that can be used in another endpoint to get more details." + }, + "resource_type": { + "type": "string", + "example": "redemption", + "description": "The resource type." + }, + "error": { + "type": "object", + "description": "Contains error message translation.", + "properties": { + "message": { + "type": "string", + "example": "Missing order = please add one.", + "description": "Error message translation defined in Dashboard → Project Settings → Error Messages" + } + } + } + } + }, + "e_400_loyalty_card_points_exceeded": { + "title": "Loyalty Card Points Exceeded", + "type": "object", + "description": "Error: Bad Request → Loyalty Card Points Exceeded", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "loyalty_card_points_exceeded", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "loyalty card points exceeded", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "example": "SoAm6kbC", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a885062c80375740f", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + }, + "resource_id": { + "type": "string", + "example": "rf_0b3a1814550e5aaa34", + "description": "Unique resource ID that can be used in another endpoint to get more details." + }, + "resource_type": { + "type": "string", + "example": "redemption", + "description": "The resource type." + }, + "error": { + "type": "object", + "description": "Contains error message translation.", + "properties": { + "message": { + "type": "string", + "example": "There are not enough loyalty points on the card.", + "description": "Error message translation defined in Dashboard → Project Settings → Error Messages" + } + } + } + } + }, + "e_403_wrong_api_endpoint": { + "title": "Wrong API Endpoint", + "type": "object", + "description": "Error: Forbidden → Wrong API Endpoint", + "properties": { + "code": { + "type": "integer", + "default": 403, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "wrong_api_endpoint", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Wrong API endpoint", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "example": "Given project is bound to different API endpoint, you should use: https://api.voucherify.io", + "description": "A human-readable message providing more details about the error." + } + } + }, + "e_404_not_found": { + "description": "Error: Not Found", + "type": "object", + "title": "Not Found", + "properties": { + "code": { + "type": "integer", + "default": 404, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "not_found", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Resource not found", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0a96cd820301c0483a", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + }, + "resource_id": { + "type": "string", + "description": "Name or ID of the resource that was not found." + }, + "resource_type": { + "type": "string", + "description": "Specifies the type of resource that was not found." + } + } + }, + "e_409_duplicate_found": { + "title": "Duplicated Resource", + "type": "object", + "description": "Error: Conflict → Duplicated resource found", + "properties": { + "code": { + "type": "integer", + "default": 409, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "duplicate_found", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Duplicated resource found", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0aa36e570e44cb3bdd", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + }, + "resource_id": { + "type": "string", + "description": "Name or ID of the resource that already exists." + }, + "resource_type": { + "type": "string", + "description": "Specifies the type of resource that already exists." + } + } + }, + "e_400_duplicate_key": { + "title": "Duplicated Key", + "type": "object", + "description": "Error: Conflict → Duplicated key found", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "duplicate_key", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Duplicate codes", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0aa36e570e44cb3bdd", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + } + } + }, + "e_400_duplicate_source_id": { + "title": "Duplicate Source ID", + "type": "object", + "description": "Error: Conflict → Duplicate source_id found", + "properties": { + "code": { + "type": "integer", + "default": 400, + "description": "Error's HTTP status code." + }, + "key": { + "type": "string", + "default": "duplicate_source_id", + "description": "Short string describing the kind of error which occurred." + }, + "message": { + "type": "string", + "default": "Duplicate source_id", + "description": "A human-readable message providing a short description about the error." + }, + "details": { + "type": "string", + "description": "A human-readable message providing more details about the error." + }, + "request_id": { + "type": "string", + "example": "v-0aa36e570e44cb3bdd", + "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + } + } + }, + "product_collections_get_response_body": { + "$ref": "#/components/schemas/product_collections_collection_item", + "description": "\"Response body schema for **GET** `/product-collections/{collectionId}`.\",", + "title": "Get Product Collection Response Body" + }, + "product_collections_collection_item": { + "title": "Product Collection Object", + "description": "This is an object representing a product collection. \n\nThe products can be grouped into collections by the creation of a products collection object. You can retrieve a product collection and a list of products in the collection. Product collections are identified by a unique ID.", + "x-tags": [ + "PRODUCT COLLECTIONS API" + ], + "allOf": [ + { + "$ref": "#/components/schemas/product_collections_collection_item_base" + }, + { + "anyOf": [ + { + "$ref": "#/components/schemas/product_collections_static_collection" + }, + { + "$ref": "#/components/schemas/product_collections_dynamic_collection" } - }, - "MappingFixed": { - "title": "MappingFixed", + ] + } + ] + }, + "product_collections_collection_item_base": { + "title": "Product Collection Base", + "description": "This is an object representing a product collection base. ", + "x-tags": [ + "PRODUCT COLLECTIONS API" + ], + "type": "object", + "properties": { + "id": { + "type": "string", + "description": "Product collection ID." + }, + "name": { + "type": "string", + "example": "All Products", + "description": "Unique user-defined product collection name." + }, + "created_at": { + "type": "string", + "example": "2021-12-09T12:51:29.898Z", + "description": "Timestamp representing the date and time when the product collection was created in ISO 8601 format.", + "format": "date-time" + }, + "object": { + "description": "The type of object represented by JSON. This object stores information about the static product collection.", + "enum": [ + "products_collection" + ] + } + }, + "required": [ + "id", + "name", + "created_at", + "object" + ] + }, + "product_collections_create_request_body": { + "title": "product_collections_create_request_body", + "anyOf": [ + { + "$ref": "#/components/schemas/product_collections_create_static_request_body" + }, + { + "$ref": "#/components/schemas/product_collections_create_dynamic_request_body" + } + ] + }, + "product_collections_create_static_request_body": { + "title": "Create Product Collection - Static", + "type": "object", + "properties": { + "type": { + "enum": [ + "STATIC" + ] + }, + "name": { + "type": "string" + }, + "products": { + "type": "array", + "items": { "type": "object", "properties": { - "type": { - "type": "string", - "enum": [ - "CUSTOM" - ], - "description": "Type of calculation.\n\n" + "id": { + "type": "string" }, - "points": { - "type": "integer", - "description": "Fixed number of points to be applied." - } - } - }, - "MappingPoints": { - "anyOf": [ - { - "$ref": "#/components/schemas/MappingMultiply" + "product_id": { + "type": "string" }, - { - "$ref": "#/components/schemas/MappingFixed" - } - ] - }, - "a_req_importCSV": { - "type": "object", - "title": "Import CSV file", - "description": "Request body schema for importing data using a CSV file.", - "format": "binary", - "properties": { - "file": { - "type": "string", - "format": "binary", - "description": "File path." + "object": { + "enum": [ + "sku", + "product" + ] } }, "required": [ - "file" + "id", + "object" ] - }, - "a_res_async_actions": { - "type": "object", - "title": "Asynchronous Actions", - "description": "Response to requests that are processed asynchronously.", - "additionalProperties": false, - "examples": [ - { - "async_action_id": "aa_0a875d56c805df6601" - } - ], - "properties": { - "async_action_id": { - "type": "string", - "example": "aa_0a875d56c805df6601", - "description": "The ID of the scheduled asynchronous action." - } + } + } + }, + "required": [ + "type", + "name" + ] + }, + "product_collections_create_dynamic_request_body": { + "title": "Create Product Collection - Auto Update", + "type": "object", + "properties": { + "type": { + "enum": [ + "AUTO_UPDATE" + ] + }, + "name": { + "type": "string" + }, + "filter": { + "type": "object", + "additionalProperties": false, + "required": [ + "junction" + ], + "properties": { + "junction": { + "$ref": "#/components/schemas/Junction" }, - "required": [ - "async_action_id" - ] - }, - "error": { - "title": "error", - "type": "object", - "properties": {}, - "discriminator": { - "propertyName": "key", - "mapping": { - "not_enough_codes": "not_enough_codes" - } + "id": { + "$ref": "#/components/schemas/FieldConditions" }, - "description": "Short error response", - "examples": [] - }, - "e_error": { - "title": "Error Object", - "type": "object", - "description": "Error details", - "properties": { - "code": { - "type": "integer", - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a885062c80375740f", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - }, - "error": { - "type": "object", - "description": "Contains custom user-defined error message translation.", - "properties": { - "message": { - "type": "string", - "description": "Error message translation defined in Dashboard → Project Settings → Error Messages" - } - } - } - } - }, - "e_error_expanded": { - "title": "Error Object", - "type": "object", - "description": "Error details", - "properties": { - "code": { - "type": "integer", - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a885062c80375740f", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - }, - "resource_id": { - "type": "string", - "description": "Unique resource ID that can be used in another endpoint to get more details.", - "example": "rf_0c5d710a87c8a31f86" - }, - "resource_type": { - "type": "string", - "description": "The resource type.", - "example": "redemption" - }, - "error": { - "type": "object", - "description": "Contains custom user-defined error message translation.", - "properties": { - "message": { - "type": "string", - "description": "Error message translation defined in Dashboard → Project Settings → Error Messages" - } - } - } - } - }, - "e_error_no_translation": { - "title": "Error Object", - "type": "object", - "description": "Error details", - "properties": { - "code": { - "type": "integer", - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a885062c80375740f", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - } - } - }, - "e_integration_key": { - "title": "Error Object", - "type": "object", - "description": "Error details", - "properties": { - "code": { - "type": "integer", - "description": "Error's HTTP status code." - }, - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the error." - }, - "key": { - "type": "string", - "description": "Short string describing the kind of error which occurred." - } - } - }, - "e_400_missing_param": { - "description": "Error: Bad Request → Missing Parameters", - "type": "object", - "title": "Missing Parameters", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "missing_param", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Missing required parameter", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "example": "Parameter 'custom_event.schema_id' is required", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a96c19b1a41c03999", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - } - } - }, - "e_400_not_enough_source_ids": { - "description": "Error: Bad Request → Missing Parameters", - "type": "object", - "title": "Not Enough Source ID's", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "not_enought_source_ids", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Not enough source_ids", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "example": "Specify at least 1 source_id", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a96c19b1a41c03999", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - } - } - }, - "e_400_invalid_payload": { - "title": "Invalid Payload", - "type": "object", - "description": "Error: Bad Request → Invalid Payload", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "invalid_payload", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Invalid payload", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a884c6be8c3756f42", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - } - } - }, - "e_400_invalid_balance": { - "title": "Invalid Balance", - "type": "object", - "description": "Error: Bad Request → Invalid Balance", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "invalid_balance", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a884c6be8c3756f42", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - } - } - }, - "e_400_resource_in_use": { - "title": "Resource in use", - "type": "object", - "description": "Error: Bad Request - Resource in use", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "resource_in_use", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Resource in use", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a884c6be8c3756f42", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - }, - "related_object_ids": { - "type": "array", - "description": "Name or ID of the resources that are related.", - "items": { - "type": "string", - "example": "rewa_5WV7H3y2lT3GGl03Xjw29IEc" - } - }, - "related_object_type": { - "type": "string", - "description": "Specifies the type of resource that is related." - } - } - }, - "e_400_invalid_export_fields": { - "title": "Invalid Export Fields", - "type": "object", - "description": "Error: Bad Request → Invalid Export Fields", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "invalid_export_fields", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Invalid Export", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a884c6be8c3756f42", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - } - } - }, - "e_400_invalid_voucher": { - "title": "Invalid Voucher", - "type": "object", - "description": "Error: Bad Request → Invalid Voucher", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "invalid_voucher", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Invalid Voucher", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a884c6be8c3756f42", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - } - } - }, - "e_400_invalid_validation_rules": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "description": "Error's HTTP status code.", - "default": 400 - }, - "key": { - "type": "string", - "default": "invalid_validation_rules", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - } + "product_id": { + "$ref": "#/components/schemas/FieldConditions" }, - "title": "Invalid Validation Rules", - "description": "Error: Bad Request → Invalid Validation Rules" - }, - "e_400_not_enough_codes": { - "title": "Not Enough Codes", - "type": "object", - "description": "Error: Bad Request → Not enough codes", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "not_enough_codes", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Not enough codes", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "example": "Specify at least 1 code in codes.", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a885062c80375740f", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + "source_id": { + "$ref": "#/components/schemas/FieldConditions" + }, + "name": { + "$ref": "#/components/schemas/FieldConditions" + }, + "price": { + "$ref": "#/components/schemas/FieldConditions" + }, + "object": { + "$ref": "#/components/schemas/FieldConditions" + }, + "attributes": { + "$ref": "#/components/schemas/FieldConditions" + }, + "metadata": { + "$ref": "#/components/schemas/FieldConditions" + }, + "image_url": { + "$ref": "#/components/schemas/FieldConditions" + }, + "skus": { + "$ref": "#/components/schemas/FieldConditions" + }, + "created_at": { + "$ref": "#/components/schemas/FieldConditions" + }, + "updated_at": { + "$ref": "#/components/schemas/FieldConditions" + } + } + } + }, + "required": [ + "type", + "name", + "filter" + ] + } + }, + "examples": { + "req_vouchers_metadata_1": { + "value": { + "codes": [ + "PROMO-CODE810", + "PROMO-CODE726" + ], + "metadata": { + "lang": "en", + "authorized_internally": true + } + } + }, + "req_vouchers_metadata_2": { + "value": { + "codes": [ + "PROMO-CODE810", + "PROMO-CODE726", + "PROMO-CODE888" + ], + "metadata": { + "lang": "en", + "authorized_internally": true + } + } + }, + "res_async_actions": { + "value": { + "async_action_id": "aa_0ab2df092385be5ca5" + } + } + } + }, + "paths": { + "/v1/voucher-object": { + "get": { + "operationId": "voucher-object", + "tags": [ + "VOUCHERS API" + ], + "summary": "Voucher Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Voucher Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_obj_voucher_object" } } + } + } + } + } + }, + "/v1/vouchers": { + "get": { + "operationId": "list-vouchers", + "tags": [ + "VOUCHERS API" + ], + "summary": "List Vouchers", + "description": "Returns a list of your vouchers. By default, the vouchers are returned sorted by creation date, with the most recent vouchers appearing first. A maximum of 10 vouchers are returned in the response.\n\nWhen you get a list of vouchers, you can optionally specify query parameters to customize the amount of vouchers returned per call using `limit`, which page of vouchers to return using `page`, sort the vouchers using the `order` query parameter and more.\n\nThis method will return an error when trying to return a limit of more than 100 vouchers.\n", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "$ref": "#/components/parameters/category" + }, + { + "in": "query", + "name": "campaign_id", + "description": "Limit search results to vouchers within the specified campaign", + "schema": { + "type": "string", + "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3" + } + }, + { + "$ref": "#/components/parameters/customer" + }, + { + "$ref": "#/components/parameters/campaign" + }, + { + "$ref": "#/components/parameters/created_at" + }, + { + "$ref": "#/components/parameters/updated_at" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at", + "code", + "-code" + ] }, - "e_400_metadata_validation_failed": { - "title": "Metadata Validation Failed", - "type": "object", - "description": "Error: Bad Request → Metadata validation failed", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "metadata_validation_failed", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Metadata validation failed", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "example": "Ranking: must be a number (actual value is 'true')", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a885062c80375740f", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary that contains an array of vouchers. Each entry in the array is a separate voucher object. If no more vouchers are available (query parameter `page` incremented over and above the voucher count), the resulting array will be empty. The result can be narrowed down according to specified (or default) filters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_res_vouchers_GET" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "vouchers", + "vouchers": [ + { + "id": "v_hrMBBeT4sOP9VSGPmj5KAgJwX202UjiY", + "code": "LOYALTY-CARD-xLPbpbXR", + "campaign": "Loyalty Program Fall 2022", + "campaign_id": "camp_f7fBbQxUuTN7dI7tGOo5XMDA", + "category": "First", + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" + } + ], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 110, + "balance": 100, + "next_expiration_date": "2023-12-31", + "next_expiration_points": 100 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8/6I6hUEqtz/F6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD/DjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8%2F6I6hUEqtz%2FF6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD%2FDjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/SpYuOrU9wd6/o1wzy6E/04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ/FJtiw69djuzQk1f4HdQo8s5gaZ7fd2U+1zbaeAvi9usyvRHZE4=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FSpYuOrU9wd6%2Fo1wzy6E%2F04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ%2FFJtiw69djuzQk1f4HdQo8s5gaZ7fd2U%2B1zbaeAvi9usyvRHZE4%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-19T07:56:22.355Z", + "updated_at": "2022-09-19T08:04:22.458Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "redeemed_points": 10, + "object": "list", + "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/publications?page=1&limit=10" + }, + "object": "voucher" + }, + { + "id": "v_OBVfpTVf24DBz0HZmKVZa5UEl1DUg2bn", + "code": "AmountDiscount", + "campaign": null, + "campaign_id": null, + "category": "First", + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" + } + ], + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 400, + "amount_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", + "effect": "APPLY_TO_ORDER" + }, + "gift": null, + "loyalty_card": null, + "start_date": "2022-09-01T00:00:00.000Z", + "expiration_date": "2022-10-31T00:00:00.000Z", + "validity_timeframe": null, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": true, + "additional_info": "This voucher discount is based on a formula, payment must be using VISA, and order must be over $100.", + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX18tV6jdzxWPwEzjeiX4DoM06JpwaoKUNGMNx4Td5e8FwA68uIHQwPaRpJr9CUCpiP4IsSD8nEJn1YtEv6FnY83wIv7uljYoQOYmMPyhKec8Ct3zH7KurMGuj4Fhws3HNA3bqP5MYEy+aA==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX18tV6jdzxWPwEzjeiX4DoM06JpwaoKUNGMNx4Td5e8FwA68uIHQwPaRpJr9CUCpiP4IsSD8nEJn1YtEv6FnY83wIv7uljYoQOYmMPyhKec8Ct3zH7KurMGuj4Fhws3HNA3bqP5MYEy%2BaA%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX181+WljOgxIt9Jg1Urbuv226+8Ug0DIyZiI0WtThPNYKZZEodzqQpIsGSdrDGXr2chLo+4FH3Ey8G2YXCPM6nUhZRSMF5oL3+uNjcLtBvb7MF5+ynY5fIgpXolwUK0R/BuT4Pa8prhgTg==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX181%2BWljOgxIt9Jg1Urbuv226%2B8Ug0DIyZiI0WtThPNYKZZEodzqQpIsGSdrDGXr2chLo%2B4FH3Ey8G2YXCPM6nUhZRSMF5oL3%2BuNjcLtBvb7MF5%2BynY5fIgpXolwUK0R%2FBuT4Pa8prhgTg%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-12T07:51:02.145Z", + "updated_at": "2022-09-19T08:29:12.566Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "redemption": { + "quantity": null, + "redeemed_quantity": 2, + "object": "list", + "url": "/v1/vouchers/AmountDiscount/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AmountDiscount/publications?page=1&limit=10" + }, + "object": "voucher" + } + ], + "total": 2 + } + } } } - }, - "e_400_missing_reward": { - "title": "Missing Reward", - "type": "object", - "description": "Error: Bad Request → Missing Reward", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "missing_reward", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Missing reward", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "example": "A reward is required when redeeming a LOYALTY_CARD", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a885062c80375740f", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - }, - "resource_id": { - "type": "string", - "example": "rf_0b3a1814550e5aaa34", - "description": "Unique resource ID that can be used in another endpoint to get more details." - }, - "resource_type": { - "type": "string", - "example": "redemption", - "description": "The resource type." + } + } + } + } + }, + "/v1/vouchers/{code}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "7fjWdr" + }, + "in": "path", + "name": "code", + "description": "A unique **code** that identifies the voucher.", + "required": true + } + ], + "get": { + "operationId": "get-voucher", + "tags": [ + "VOUCHERS API" + ], + "summary": "Get Voucher", + "description": "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`.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a voucher object if a valid identifier was provided. \n\nAdditionally, the response returns validation rules related to the voucher object. They can be inherited from a campaign.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_obj_voucher_object" }, - "error": { - "type": "object", - "description": "Contains error message translation.", - "properties": { - "message": { - "type": "string", - "example": "Missing reward = please add one.", - "description": "Error message translation defined in Dashboard → Project Settings → Error Messages" + "examples": { + "Loyalty Card": { + "value": { + "id": "v_hrMBBeT4sOP9VSGPmj5KAgJwX202UjiY", + "code": "LOYALTY-CARD-xLPbpbXR", + "campaign": "Loyalty Program Fall 2022", + "campaign_id": "camp_f7fBbQxUuTN7dI7tGOo5XMDA", + "category": "First", + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" + } + ], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 110, + "balance": 100, + "next_expiration_date": "2023-12-31", + "next_expiration_points": 100 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8/6I6hUEqtz/F6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD/DjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8%2F6I6hUEqtz%2FF6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD%2FDjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/SpYuOrU9wd6/o1wzy6E/04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ/FJtiw69djuzQk1f4HdQo8s5gaZ7fd2U+1zbaeAvi9usyvRHZE4=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FSpYuOrU9wd6%2Fo1wzy6E%2F04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ%2FFJtiw69djuzQk1f4HdQo8s5gaZ7fd2U%2B1zbaeAvi9usyvRHZE4%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-19T07:56:22.355Z", + "updated_at": "2022-09-19T08:04:22.458Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "redeemed_points": 10, + "object": "list", + "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Gift Card": { + "value": { + "id": "v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk", + "code": "GIFT-CARD-xwc6X7Tk", + "campaign": "Gift Cards", + "campaign_id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", + "category": null, + "category_id": null, + "type": "GIFT_VOUCHER", + "discount": null, + "gift": { + "amount": 55000, + "balance": 44700, + "effect": "APPLY_TO_ORDER" + }, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM/aTyHCYfr7kRWb2vv08WIgY/Tv53SJGW+k2keqfsTq/Ohb5shkCN3FTFsaI8gulTp616sEGn/JJoIInIoNkO9Vd1+AfrKiAjmirCmekE6cz2SVCyNAXs=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM%2FaTyHCYfr7kRWb2vv08WIgY%2FTv53SJGW%2Bk2keqfsTq%2FOhb5shkCN3FTFsaI8gulTp616sEGn%2FJJoIInIoNkO9Vd1%2BAfrKiAjmirCmekE6cz2SVCyNAXs%3D" + }, + "barcode": { + "id": "U2FsdGVkX18vWc/qplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO/199U+zicnFNWqg/jF5ZCQW+6jO1q8=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18vWc%2FqplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO%2F199U%2BzicnFNWqg%2FjF5ZCQW%2B6jO1q8%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-07-08T09:44:33.179Z", + "updated_at": "2022-08-29T09:37:20.185Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 7, + "redeemed_amount": 10300, + "object": "list", + "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Amount Discount": { + "value": { + "id": "v_OBVfpTVf24DBz0HZmKVZa5UEl1DUg2bn", + "code": "AMOUNTDISCOUNTUSINGFORMULA", + "campaign": null, + "campaign_id": null, + "category": "First", + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" + } + ], + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 400, + "amount_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", + "effect": "APPLY_TO_ORDER" + }, + "gift": null, + "loyalty_card": null, + "start_date": "2022-09-01T00:00:00.000Z", + "expiration_date": "2022-10-31T00:00:00.000Z", + "validity_timeframe": null, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": true, + "additional_info": "This voucher discount is based on a formula, payment must be using VISA, and order must be over $100.", + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX18tV6jdzxWPwEzjeiX4DoM06JpwaoKUNGMNx4Td5e8FwA68uIHQwPaRpJr9CUCpiP4IsSD8nEJn1YtEv6FnY83wIv7uljYoQOYmMPyhKec8Ct3zH7KurMGuj4Fhws3HNA3bqP5MYEy+aA==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX18tV6jdzxWPwEzjeiX4DoM06JpwaoKUNGMNx4Td5e8FwA68uIHQwPaRpJr9CUCpiP4IsSD8nEJn1YtEv6FnY83wIv7uljYoQOYmMPyhKec8Ct3zH7KurMGuj4Fhws3HNA3bqP5MYEy%2BaA%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX181+WljOgxIt9Jg1Urbuv226+8Ug0DIyZiI0WtThPNYKZZEodzqQpIsGSdrDGXr2chLo+4FH3Ey8G2YXCPM6nUhZRSMF5oL3+uNjcLtBvb7MF5+ynY5fIgpXolwUK0R/BuT4Pa8prhgTg==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX181%2BWljOgxIt9Jg1Urbuv226%2B8Ug0DIyZiI0WtThPNYKZZEodzqQpIsGSdrDGXr2chLo%2B4FH3Ey8G2YXCPM6nUhZRSMF5oL3%2BuNjcLtBvb7MF5%2BynY5fIgpXolwUK0R%2FBuT4Pa8prhgTg%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-12T07:51:02.145Z", + "updated_at": "2022-09-19T08:29:12.566Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_tO5AuzXIkkNPTC50", + "rule_id": "val_5h0wc453_2", + "related_object_id": "v_OBVfpTVf24DBz0HZmKVZa5UEl1DUg2bn", + "related_object_type": "voucher", + "created_at": "2022-09-19T08:27:59.160Z", + "object": "validation_rules_assignment" + } + ], + "total": 1 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 2, + "object": "list", + "url": "/v1/vouchers/AMOUNTDISCOUNTUSINGFORMULA/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AMOUNTDISCOUNTUSINGFORMULA/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Percent Discount": { + "value": { + "id": "v_2LcXRN4X0TNNgPoBceXIsE4LYs13kta1", + "code": "PercentDiscountUsingFormula", + "campaign": null, + "campaign_id": null, + "category": null, + "category_id": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "percent_off": 3, + "percent_off_formula": "CUSTOMER_METADATA(\"age\")", + "effect": "APPLY_TO_ITEMS" + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1+74dNbbuHNdVR+5SXVrdo6Zp2tUInlseZtheoYEvrayBBDEoJFaeDuC1BzQr+j8ayuFU7+BtCdNe25YRae4Mp+3Y1HsrkVudshKRzMBdS/43GT9Qi6tOXQDsYjHh70zNz13lMOC9bnaX6WZCVU0vRWM/VDXbYNxGZH6V1wpcGOkmkhkEYPSuIXBDF65FsgHOAwIPvKBxa/aQ==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B74dNbbuHNdVR%2B5SXVrdo6Zp2tUInlseZtheoYEvrayBBDEoJFaeDuC1BzQr%2Bj8ayuFU7%2BBtCdNe25YRae4Mp%2B3Y1HsrkVudshKRzMBdS%2F43GT9Qi6tOXQDsYjHh70zNz13lMOC9bnaX6WZCVU0vRWM%2FVDXbYNxGZH6V1wpcGOkmkhkEYPSuIXBDF65FsgHOAwIPvKBxa%2FaQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX19t8/dJWDNnnwPtxt3e0kZTDAELYiQcSHWIEO5wr6uLeDbM2KKbGYUfkKKtZRsWtiKhOQQc7zmNoCqR82UB+p0gzGM0tyXa/npbPUTe0Y5Y/arDPnomb9AaUFjK9Uq5OUBYbxi1ERqEhy/20Owr0m0e0E2I3jQmgAxkNokRm1g31zX4zheea8gTtiFwb6ZrYvGbaOhj5IxYWg==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19t8%2FdJWDNnnwPtxt3e0kZTDAELYiQcSHWIEO5wr6uLeDbM2KKbGYUfkKKtZRsWtiKhOQQc7zmNoCqR82UB%2Bp0gzGM0tyXa%2FnpbPUTe0Y5Y%2FarDPnomb9AaUFjK9Uq5OUBYbxi1ERqEhy%2F20Owr0m0e0E2I3jQmgAxkNokRm1g31zX4zheea8gTtiFwb6ZrYvGbaOhj5IxYWg%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-15T10:20:46.467Z", + "updated_at": "2022-09-15T10:43:51.116Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_EuYasM5fyDR9G2r4", + "rule_id": "val_0k19OQHjNZRT", + "related_object_id": "v_2LcXRN4X0TNNgPoBceXIsE4LYs13kta1", + "related_object_type": "voucher", + "created_at": "2022-09-15T10:20:46.460Z", + "object": "validation_rules_assignment" + } + ], + "total": 1 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 3, + "object": "list", + "url": "/v1/vouchers/PercentDiscountUsingFormula/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/PercentDiscountUsingFormula/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Fixed Discount": { + "value": { + "id": "v_zXQtyi5FYQYoRXv459hmK8M5Gi2lLoDl", + "code": "FixedDiscountUsingFormula", + "campaign": null, + "campaign_id": null, + "category": null, + "category_id": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "FIXED", + "effect": "APPLY_TO_ORDER", + "fixed_amount": 200, + "fixed_amount_formula": "IF(ORDER_UNITS_QUANTITY > 3;CUSTOMER_METADATA(\"age\") + 2;CUSTOMER_METADATA(\"age\") - 2)" + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1+sY8iWRFMrrPOjY6pS7JZSqJUPIzAgFO5oy5GvTj27KrukNxucE4wrA4n9QL7pua3CfJzGWe0Hc5J6XXU2m5ktik4iUNRO6pxZmL4ZuR96C1XHJAGaIiI7lM17OjJD2b72/hyyDUi8DflzcYixFdXTOR3o1rcaPoY=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BsY8iWRFMrrPOjY6pS7JZSqJUPIzAgFO5oy5GvTj27KrukNxucE4wrA4n9QL7pua3CfJzGWe0Hc5J6XXU2m5ktik4iUNRO6pxZmL4ZuR96C1XHJAGaIiI7lM17OjJD2b72%2FhyyDUi8DflzcYixFdXTOR3o1rcaPoY%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+af+iouhzUVUL0IocB7BAWR8rB0z8/9/OgYi32EHQ9salEEtE3XYPWtseOAxi5keMRp6K3JLDyx4RvYpw3Fe5SN0ed7PEcWr4fLUoUBntHtH0lOPFOtWxpY3tAjnyWpE/CYTR/S135KZ6GIfCS/+VQNrzbS/bFXgY=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2Baf%2BiouhzUVUL0IocB7BAWR8rB0z8%2F9%2FOgYi32EHQ9salEEtE3XYPWtseOAxi5keMRp6K3JLDyx4RvYpw3Fe5SN0ed7PEcWr4fLUoUBntHtH0lOPFOtWxpY3tAjnyWpE%2FCYTR%2FS135KZ6GIfCS%2F%2BVQNrzbS%2FbFXgY%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-15T12:46:55.818Z", + "updated_at": "2022-09-16T10:03:25.057Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 5, + "object": "list", + "url": "/v1/vouchers/FixedDiscountUsingFormula/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/FixedDiscountUsingFormula/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Unit Discount": { + "value": { + "id": "v_JkjV4v9OKTsaIuHoqXGrkGijNaRGYNzm", + "code": "UnitDiscountUsingFormula", + "campaign": null, + "campaign_id": null, + "category": null, + "category_id": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "UNIT", + "unit_off": 1, + "unit_off_formula": "IF(ORDER_UNITS_QUANTITY > 3;CUSTOMER_METADATA(\"age\") / 5;CUSTOMER_METADATA(\"age\") / 10)", + "unit_type": "sku_0b661e41eccd35a8e9", + "effect": "ADD_MISSING_ITEMS" + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1+6okuUQBKDcu0jGGg0jOU3kwYUFhX79TdwYKjXyV14BX74z/lehzciL0vdtutoiMVf8Nzl+B278gSHI5TiecPsTXChbGKSjH9gYUxZkdQev0qfmR4frKHjKKHHfT9DEcRWCLwKDJ9V+b89EAmbMouLlaDvkD63bZI=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B6okuUQBKDcu0jGGg0jOU3kwYUFhX79TdwYKjXyV14BX74z%2FlehzciL0vdtutoiMVf8Nzl%2BB278gSHI5TiecPsTXChbGKSjH9gYUxZkdQev0qfmR4frKHjKKHHfT9DEcRWCLwKDJ9V%2Bb89EAmbMouLlaDvkD63bZI%3D" + }, + "barcode": { + "id": "U2FsdGVkX19E7POETWB9YO+S4gkbGFQSm4VDNXEvqdlln6cWiyWTplnWkiUbs/2XMIva3q2rHDFP4toeKrLOGeS5mqhJcdd3yVsWXjHaALwCJIis2D4l5soDvz+Ka/vTqJdFWQzqsIl0BqEpr1tLLy8JFMGN7MY5nY3nr/ciSN8=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19E7POETWB9YO%2BS4gkbGFQSm4VDNXEvqdlln6cWiyWTplnWkiUbs%2F2XMIva3q2rHDFP4toeKrLOGeS5mqhJcdd3yVsWXjHaALwCJIis2D4l5soDvz%2BKa%2FvTqJdFWQzqsIl0BqEpr1tLLy8JFMGN7MY5nY3nr%2FciSN8%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-15T13:36:27.838Z", + "updated_at": "2022-09-16T10:03:25.057Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 5, + "object": "list", + "url": "/v1/vouchers/UnitDiscountUsingFormula/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/UnitDiscountUsingFormula/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Multiple Unit Discount": { + "value": { + "id": "v_5Xgi5ht4sw432LQ7bwmyjKnUAYtOrJAh", + "code": "UnitDiscountUsingFormulaForMultipleProductVariants", + "campaign": null, + "campaign_id": null, + "category": null, + "category_id": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "UNIT", + "effect": "ADD_MANY_ITEMS", + "units": [ + { + "unit_off": 3, + "unit_off_formula": "IF(ORDER_AMOUNT > 100;CUSTOMER_METADATA(\"age\");CUSTOMER_METADATA(\"age\") / 2)", + "unit_type": "sku_0b661e41fc8d35a8f7", + "effect": "ADD_MISSING_ITEMS" + }, + { + "unit_off": 4, + "unit_off_formula": "IF(ORDER_AMOUNT > 100;CUSTOMER_METADATA(\"age\") + 2;CUSTOMER_METADATA(\"age\") - -2)", + "unit_type": "sku_0b661e41fc8d35a8f6", + "effect": "ADD_NEW_ITEMS" + } + ] + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1+qkwm+Yu29uhfotQxirJftPuWjA1P9WGxHqqmOHsU9esf6R5Ln7AeiqX8l9iIpy+D3yav5GmF2UrY6PD6fS9Y+yu+7yTVQu+agFZqdN1jvWw4DBOCHKPgynaMiNS29Cv4EIOFCY9Ux+4Lp8aVdalItCVCEH25DxWD+HUKq1lE31Y0DfWssg95oO2m73ZeGa8je7zd09eW7cg==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bqkwm%2BYu29uhfotQxirJftPuWjA1P9WGxHqqmOHsU9esf6R5Ln7AeiqX8l9iIpy%2BD3yav5GmF2UrY6PD6fS9Y%2Byu%2B7yTVQu%2BagFZqdN1jvWw4DBOCHKPgynaMiNS29Cv4EIOFCY9Ux%2B4Lp8aVdalItCVCEH25DxWD%2BHUKq1lE31Y0DfWssg95oO2m73ZeGa8je7zd09eW7cg%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+poCeZMw207p8HWtpoeokpaPfUQQoRIxpGXmqi5ic2ZPhQwKrUnujPDW4Sw1ODgHV6nLWQQQ9g7j3S4793YfzHDi1H8L3kZroH0TwWFNBgzQkV/QLqc387xUUckr0fvmhTBCarpsB+dWPOwlaNuVivTVB+Yyh/1FcbGbjvbj1Sm12wVNom2KZ3m1K/lJ6vBoGkXqq0jutytA==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BpoCeZMw207p8HWtpoeokpaPfUQQoRIxpGXmqi5ic2ZPhQwKrUnujPDW4Sw1ODgHV6nLWQQQ9g7j3S4793YfzHDi1H8L3kZroH0TwWFNBgzQkV%2FQLqc387xUUckr0fvmhTBCarpsB%2BdWPOwlaNuVivTVB%2BYyh%2F1FcbGbjvbj1Sm12wVNom2KZ3m1K%2FlJ6vBoGkXqq0jutytA%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-16T05:44:50.722Z", + "updated_at": "2022-09-19T09:25:17.303Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 3, + "object": "list", + "url": "/v1/vouchers/UnitDiscountUsingFormulaForMultipleProductVariants/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/UnitDiscountUsingFormulaForMultipleProductVariants/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Free Shipping": { + "value": { + "id": "v_gO13ON60WqVmP1DASWuJRF83Xt5KrVNL", + "code": "FreeShipping", + "campaign": null, + "campaign_id": null, + "category": null, + "category_id": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "UNIT", + "unit_off": 1, + "unit_type": "prod_5h1pp1ng", + "effect": "ADD_MISSING_ITEMS" + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX19R0AaZSL8eog8GYSGvRcADkJ24Hhr52Awb2KNF11CE7oyTHVBq+S3gexrVR8PxHgEz/jR1Hh2YfM5h0k5CYPD24I/pXJYQVTa1CpXFBrrxVET9QyK48z5hxu2nsHHBsV7g0zK1nIVibsw06db8x1F1zaR7Un9oq6A=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19R0AaZSL8eog8GYSGvRcADkJ24Hhr52Awb2KNF11CE7oyTHVBq%2BS3gexrVR8PxHgEz%2FjR1Hh2YfM5h0k5CYPD24I%2FpXJYQVTa1CpXFBrrxVET9QyK48z5hxu2nsHHBsV7g0zK1nIVibsw06db8x1F1zaR7Un9oq6A%3D" + }, + "barcode": { + "id": "U2FsdGVkX19XHGrCUHCfcSz/VLWmN1UU13QmDsH9ezEYtzHAUAeaLvN12Yv5eBJ7h7R2Og2pNm7mdHxfMR8gBJWEgHuBkodwXch1llhO6hNy9KXebNU+McRx9iEB/DqSzagjaxCiUNB1xitLgXDlUH5cH9naOCOtCHGMrEQW4h0=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19XHGrCUHCfcSz%2FVLWmN1UU13QmDsH9ezEYtzHAUAeaLvN12Yv5eBJ7h7R2Og2pNm7mdHxfMR8gBJWEgHuBkodwXch1llhO6hNy9KXebNU%2BMcRx9iEB%2FDqSzagjaxCiUNB1xitLgXDlUH5cH9naOCOtCHGMrEQW4h0%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-16T07:19:53.945Z", + "updated_at": "2022-09-16T07:26:35.361Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 2, + "object": "list", + "url": "/v1/vouchers/FreeShipping/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/FreeShipping/publications?page=1&limit=10" + }, + "object": "voucher" } } } } - }, - "e_400_missing_order": { - "title": "Missing Order", - "type": "object", - "description": "Error: Bad Request → Missing Order", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "missing_order", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Missing order", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "example": "An order is required when redeeming a LOYALTY_CARD", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a885062c80375740f", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - }, - "resource_id": { - "type": "string", - "example": "rf_0b3a1814550e5aaa34", - "description": "Unique resource ID that can be used in another endpoint to get more details." - }, - "resource_type": { - "type": "string", - "example": "redemption", - "description": "The resource type." + } + }, + "404": { + "description": "Returns an error when requesting the code of a voucher that has been deleted or does not exist.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" }, - "error": { - "type": "object", - "description": "Contains error message translation.", - "properties": { - "message": { - "type": "string", - "example": "Missing order = please add one.", - "description": "Error message translation defined in Dashboard → Project Settings → Error Messages" + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id v_OBVfpTVf24DBz0HZmKVZa5UEl1DUg2b", + "request_id": "v-0bb3403b9a158c87b2", + "resource_id": "v_OBVfpTVf24DBz0HZmKVZa5UEl1DUg2b", + "resource_type": "voucher" } } } } - }, - "e_400_loyalty_card_points_exceeded": { - "title": "Loyalty Card Points Exceeded", - "type": "object", - "description": "Error: Bad Request → Loyalty Card Points Exceeded", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "loyalty_card_points_exceeded", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "loyalty card points exceeded", - "description": "A human-readable message providing a short description about the error." + } + } + } + }, + "put": { + "operationId": "update-voucher", + "tags": [ + "VOUCHERS API" + ], + "summary": "Update Voucher", + "description": "Updates the specified voucher by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged.\n\nFields other than the ones listed in the request body won't be modified. Even if provided, they will be silently skipped.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "required": true, + "description": "Specify the parameters to be updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_req_vouchers_code_PUT" + }, + "examples": { + "Percent Discount": { + "value": { + "category": "Second", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "percent_off": 45, + "percent_off_formula": "IF(ORDER_AMOUNT > 100;CUSTOMER_METADATA(\"age\");CUSTOMER_METADATA(\"age\") / 2)", + "amount_limit": 1800, + "effect": "APPLY_TO_ORDER" + }, + "start_date": "2020-02-01T00:00:00Z", + "expiration_date": "2023-12-31T23:59:59Z", + "validity_timeframe": { + "duration": "PT2H", + "interval": "P3D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "active": false, + "additional_info": "This voucher can be used with other coupons. Please feel free to do so.", + "metadata": { + "Season": "Winter" + } + } }, - "details": { - "type": "string", - "example": "SoAm6kbC", - "description": "A human-readable message providing more details about the error." + "Gift Card": { + "value": { + "category": "Existing Customers", + "gift": { + "amount": 20000, + "effect": "APPLY_TO_ITEMS" + }, + "start_date": "2021-01-01T00:00:00Z", + "active": false, + "additional_info": "This gift card is disabled.", + "metadata": { + "test": false, + "locale": "de-en-pl" + } + } }, - "request_id": { - "type": "string", - "example": "v-0a885062c80375740f", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + "Loyalty Card": { + "value": { + "category": "Existing Customers", + "loyalty_card": { + "points": 20000 + }, + "active": false, + "additional_info": "This loyalty card is being deactivated and points updated.", + "metadata": { + "test": false, + "locale": "de-en-pl" + } + } }, - "resource_id": { - "type": "string", - "example": "rf_0b3a1814550e5aaa34", - "description": "Unique resource ID that can be used in another endpoint to get more details." + "Amount Discount": { + "value": { + "category": "Existing Customers", + "discount": { + "amount_off": 2000, + "type": "AMOUNT", + "effect": "APPLY_TO_ITEMS" + }, + "start_date": "2021-01-01T00:00:00Z" + } }, - "resource_type": { - "type": "string", - "example": "redemption", - "description": "The resource type." + "Fixed Discount": { + "value": { + "category": "Existing Customers", + "discount": { + "type": "FIXED", + "fixed_amount": 2000, + "effect": "APPLY_TO_ITEMS" + }, + "start_date": "2021-01-01T00:00:00Z" + } }, - "error": { - "type": "object", - "description": "Contains error message translation.", - "properties": { - "message": { - "type": "string", - "example": "There are not enough loyalty points on the card.", - "description": "Error message translation defined in Dashboard → Project Settings → Error Messages" + "Unit Discount": { + "value": { + "discount": { + "type": "UNIT", + "effect": "ADD_MANY_ITEMS", + "units": [ + { + "unit_off": 2, + "unit_type": "prod_0a9f9ab4ab019a42d5", + "effect": "ADD_MISSING_ITEMS" + }, + { + "unit_off": 1, + "unit_type": "prod_0a9f9aeddb019a42db", + "effect": "ADD_MISSING_ITEMS" + } + ] } } } } - }, - "e_403_wrong_api_endpoint": { - "title": "Wrong API Endpoint", - "type": "object", - "description": "Error: Forbidden → Wrong API Endpoint", - "properties": { - "code": { - "type": "integer", - "default": 403, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "wrong_api_endpoint", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Wrong API endpoint", - "description": "A human-readable message providing a short description about the error." + } + } + }, + "responses": { + "200": { + "description": "Returns the voucher object if the update succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_obj_voucher_object" }, - "details": { - "type": "string", - "example": "Given project is bound to different API endpoint, you should use: https://api.voucherify.io", - "description": "A human-readable message providing more details about the error." + "examples": { + "Percent Discount": { + "value": { + "id": "v_9PbXndxO3S8xfztwMtIvuMXReonF248m", + "code": "percent1", + "campaign": null, + "campaign_id": null, + "category": "Second", + "category_id": "cat_0bb81a481615a37b5e", + "categories": [ + { + "id": "cat_0bb81a481615a37b5e", + "name": "Second", + "hierarchy": 2, + "created_at": "2022-09-20T05:58:01.561Z", + "object": "category" + } + ], + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "amount_limit": 1800, + "percent_off": 45, + "percent_off_formula": "IF(ORDER_AMOUNT > 100;CUSTOMER_METADATA(\"age\");CUSTOMER_METADATA(\"age\") / 2)", + "effect": "APPLY_TO_ORDER" + }, + "gift": null, + "loyalty_card": null, + "start_date": "2020-02-01T00:00:00.000Z", + "expiration_date": "2023-12-31T23:59:59.000Z", + "validity_timeframe": { + "interval": "P3D", + "duration": "PT2H" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "active": false, + "additional_info": "This voucher can be used with other coupons. Please feel free to do so.", + "metadata": { + "Season": "Winter" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX19MPtNCPjoG/pKloolK+BZH/OCIpjYqj+B6IVJJmTYKeBINcB0JioL/tSw3iuK4FvgF8VyDyTfL26IpzbT81DDOnKeFIDUJraQDJiKxWcrG/RCFsVky4olBJ+GZFb9pLpN5gC/rn0pqYw==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19MPtNCPjoG%2FpKloolK%2BBZH%2FOCIpjYqj%2BB6IVJJmTYKeBINcB0JioL%2FtSw3iuK4FvgF8VyDyTfL26IpzbT81DDOnKeFIDUJraQDJiKxWcrG%2FRCFsVky4olBJ%2BGZFb9pLpN5gC%2Frn0pqYw%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/J73XXWgMf2BsVM21kpnFLQak5dpGzThYNTYPT62U6q+5RDlh/CXylkTrhegRnWJw1HA7iehT8iUoV4M4cV0KBdp5WgJ3lXeFZcpX3Mpu0T02PRcYbdCIiSO1kO50Y8Hg/heHcshw22Q==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FJ73XXWgMf2BsVM21kpnFLQak5dpGzThYNTYPT62U6q%2B5RDlh%2FCXylkTrhegRnWJw1HA7iehT8iUoV4M4cV0KBdp5WgJ3lXeFZcpX3Mpu0T02PRcYbdCIiSO1kO50Y8Hg%2FheHcshw22Q%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-19T14:41:30.976Z", + "updated_at": "2022-09-20T06:00:50.202Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": 101, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/percent1/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/percent1/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Gift Card": { + "value": { + "id": "v_7xaObxyK5LG62Rp0Xqpez7lqiBFL62pL", + "code": "welcomegiftcard", + "campaign": null, + "campaign_id": null, + "category": "Existing Customers", + "type": "GIFT_VOUCHER", + "discount": null, + "gift": { + "amount": 20000, + "balance": 20000, + "effect": "APPLY_TO_ITEMS" + }, + "loyalty_card": null, + "start_date": "2021-01-01T00:00:00.000Z", + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": false, + "additional_info": "This gift card is disabled.", + "metadata": { + "test": false, + "locale": "de-en-pl" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX1+mTbI2MdzBdMJ7AsOPKvGGgRB7O4oHZv5qq8I3M/OBPJm4PV8bTtBgR+oXOU4Jv1ucbIV7yg1mzC86LVFKjO7Ptnj+63mS9QdHvvILEAulBuZZQ+hZ0HmFXjDl4Quz/kUqGwffKGTziQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BmTbI2MdzBdMJ7AsOPKvGGgRB7O4oHZv5qq8I3M%2FOBPJm4PV8bTtBgR%2BoXOU4Jv1ucbIV7yg1mzC86LVFKjO7Ptnj%2B63mS9QdHvvILEAulBuZZQ%2BhZ0HmFXjDl4Quz%2FkUqGwffKGTziQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX184KgQ11OfpqB4WkJuH9ushSwZb0YrcN+8OaGPHxBQMiBr2axwnvQlZYv6YhqWtnc5iHByHrkg+6qYHxOLBPRMWCysIhcuUEB57IDhgYUHRPyM2bWjQadVHngGfVGCQ0CUy4PO/71RdMw==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX184KgQ11OfpqB4WkJuH9ushSwZb0YrcN%2B8OaGPHxBQMiBr2axwnvQlZYv6YhqWtnc5iHByHrkg%2B6qYHxOLBPRMWCysIhcuUEB57IDhgYUHRPyM2bWjQadVHngGfVGCQ0CUy4PO%2F71RdMw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-17T09:09:49.665Z", + "updated_at": "2022-02-17T11:11:48.071Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "redeemed_amount": 0, + "object": "list", + "url": "/v1/vouchers/welcomegiftcard/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/welcomegiftcard/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Loyalty Card": { + "value": { + "id": "v_l84t3fy3keMUiOeaHbN1cbTdW8O5eUlm", + "code": "welcomeloyalty", + "campaign": "Loyalty Campaign", + "campaign_id": "camp_E87CubZLZ8eoQt3c4kAEZsx0", + "category": "Existing Customers", + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 20000, + "balance": 20000 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": false, + "additional_info": "This loyalty card is being deactivated and points updated.", + "metadata": { + "test": false, + "locale": "de-en-pl" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX186PCWooyrNsjfI+nb+Y9ziUZ1k7xe+nJQ53Ms1ynNJOX6JXC6SwxS1WDhYwAKX5FxaDoKyuPf5MkQrkeB6u5bSx333ldAyLypNnqwBD2N17S64WFnTqV7eXUk3hS30wDYcz0cQAJFDcQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186PCWooyrNsjfI%2Bnb%2BY9ziUZ1k7xe%2BnJQ53Ms1ynNJOX6JXC6SwxS1WDhYwAKX5FxaDoKyuPf5MkQrkeB6u5bSx333ldAyLypNnqwBD2N17S64WFnTqV7eXUk3hS30wDYcz0cQAJFDcQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/FWUg0RbOU7R7Zqg7/8Ba6oYuXrmIl7EdXGgaPMPfpePNGRzxBu4LP2dNEUO9h1Sh37MR1PxOoaemPwlgTDo/1G8dX1JjSppNoaTHhkzk2w4yutNhP7o8cq3ZBbT3TNMTKb2H3fUMc7A==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FFWUg0RbOU7R7Zqg7%2F8Ba6oYuXrmIl7EdXGgaPMPfpePNGRzxBu4LP2dNEUO9h1Sh37MR1PxOoaemPwlgTDo%2F1G8dX1JjSppNoaTHhkzk2w4yutNhP7o8cq3ZBbT3TNMTKb2H3fUMc7A%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-17T09:12:01.428Z", + "updated_at": "2022-02-17T11:20:12.447Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "redeemed_points": 0, + "object": "list", + "url": "/v1/vouchers/welcomeloyalty/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/welcomeloyalty/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Amount Discount": { + "value": { + "id": "v_jMIjKfG2oJ7vCwIPhsLsbXYGTdPLlbJd", + "code": "WelcomeDiscountAmount", + "campaign": null, + "campaign_id": null, + "category": "Existing Customers", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 2000, + "effect": "APPLY_TO_ITEMS" + }, + "gift": null, + "loyalty_card": null, + "start_date": "2021-01-01T00:00:00.000Z", + "expiration_date": "2022-12-31T23:59:59.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "PT1H" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": false, + "additional_info": "This voucher will remain inactive until enabled.", + "metadata": { + "test": true, + "locale": "de-en" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX1+TcEE9sZP6aMfAW3NZv9GWlCnUNn+SiK4FIbMRWWjN5hzTR7Yc/73yfldUb6SMgIvUNL551Nz/nPjrMY2iauia1MSWX21MItsSPfy8qccrC+WAlvpGK/1ZklnxYaeKqxTqwSXl7ppSlgcuEejbFiaqEDajvYUZsF4=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BTcEE9sZP6aMfAW3NZv9GWlCnUNn%2BSiK4FIbMRWWjN5hzTR7Yc%2F73yfldUb6SMgIvUNL551Nz%2FnPjrMY2iauia1MSWX21MItsSPfy8qccrC%2BWAlvpGK%2F1ZklnxYaeKqxTqwSXl7ppSlgcuEejbFiaqEDajvYUZsF4%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/AhpZMq/h+Phi8JZF9m4qL8/U/Z5AST82jaAOnnhdHdbaGjB1+/0VFIdGBA8w2+3JX5qd61Dfk6yfiLCraVw7lYjQddCHF5SKtJs4hqsLHZevQTCzpZkeIHC3ThsG/fLZTsaNn8tjewd/W4qn/2Cc5NgTdv7fqui4=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FAhpZMq%2Fh%2BPhi8JZF9m4qL8%2FU%2FZ5AST82jaAOnnhdHdbaGjB1%2B%2F0VFIdGBA8w2%2B3JX5qd61Dfk6yfiLCraVw7lYjQddCHF5SKtJs4hqsLHZevQTCzpZkeIHC3ThsG%2FfLZTsaNn8tjewd%2FW4qn%2F2Cc5NgTdv7fqui4%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-17T11:41:05.236Z", + "updated_at": "2022-02-17T11:45:29.269Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_tDN7MJNayjrf1wyn", + "rule_id": "val_4j7DCRm2IS59", + "related_object_id": "v_jMIjKfG2oJ7vCwIPhsLsbXYGTdPLlbJd", + "related_object_type": "voucher", + "created_at": "2022-02-17T11:41:05.210Z", + "object": "validation_rules_assignment" + } + ], + "total": 1 + }, + "redemption": { + "quantity": 10, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/WelcomeDiscountAmount/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/WelcomeDiscountAmount/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Fixed Discount": { + "value": { + "id": "v_B1Pe7QPTjXCHm8IcDkJAQs4g6Zc08UlK", + "code": "wou4w1Og", + "campaign": "Fixed", + "campaign_id": "camp_2jVA6EKGSAe6scyc3i1q9ROD", + "category": "Existing Customers", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "FIXED", + "effect": "APPLY_TO_ITEMS", + "fixed_amount": 2000 + }, + "gift": null, + "loyalty_card": null, + "start_date": "2021-01-01T00:00:00.000Z", + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX18zxYPpRIYeGHCoCAp3ZAPEUM0qacHQIIW/82oGOW24bFMA06kahjkZKVA/1mqqJsqh83C29Jhdz82KrRsM2zl9nzplu5hrmn7m0twnf5NQaTTcovEvnBV8Kej9tGhzc/dPwqE+xEKuDg==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX18zxYPpRIYeGHCoCAp3ZAPEUM0qacHQIIW%2F82oGOW24bFMA06kahjkZKVA%2F1mqqJsqh83C29Jhdz82KrRsM2zl9nzplu5hrmn7m0twnf5NQaTTcovEvnBV8Kej9tGhzc%2FdPwqE%2BxEKuDg%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX18tsK1tz0X2IQWbFHCY4wZBDjoysFt1fBlWo/9bm/HNTci1Q3bSFuIzqIQqlU2TkSacFBgOWGuVG08XboZsqNSXXsAgST9tyoxpaOJ22B2EwWspdvuwJqvZh4PpEyh3BBDS7eOWsr3+Sw==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18tsK1tz0X2IQWbFHCY4wZBDjoysFt1fBlWo%2F9bm%2FHNTci1Q3bSFuIzqIQqlU2TkSacFBgOWGuVG08XboZsqNSXXsAgST9tyoxpaOJ22B2EwWspdvuwJqvZh4PpEyh3BBDS7eOWsr3%2BSw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-17T11:54:37.766Z", + "updated_at": "2022-02-17T12:04:53.346Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": 1, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/wou4w1Og/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/wou4w1Og/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Unit Discount": { + "value": { + "id": "v_cu8nyozvTDA413H17bH5BLha0cjxt7s8", + "code": "MultipleUnitTypesUnitDiscount", + "campaign": null, + "campaign_id": null, + "category": "New Customers", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "UNIT", + "effect": "ADD_MANY_ITEMS", + "units": [ + { + "unit_off": 2, + "unit_type": "prod_0a9f9ab4ab019a42d5", + "effect": "ADD_MISSING_ITEMS" + }, + { + "unit_off": 1, + "unit_type": "prod_0a9f9aeddb019a42db", + "effect": "ADD_MISSING_ITEMS" + } + ] + }, + "gift": null, + "loyalty_card": null, + "start_date": "2020-01-01T00:00:00.000Z", + "expiration_date": "2022-12-31T23:59:59.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "PT1H" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": false, + "additional_info": "This voucher will remain inactive until enabled.", + "metadata": { + "test": true, + "locale": "de-en" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX1+ocJBtZ9NqT97gZ/QTfOz54TAoRoKO3tnCYBtHZWMghEHT0b2aFrPSL1lqMyf6fYy6DH2/DkH5p5Vd8dOozW1LV6wPVatWpa1lZMeMIB0OcARCW3q+3QydoW2KdliLKyksFwumH9C7Fsnj6HTaEbUjSttTZE/be+o=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BocJBtZ9NqT97gZ%2FQTfOz54TAoRoKO3tnCYBtHZWMghEHT0b2aFrPSL1lqMyf6fYy6DH2%2FDkH5p5Vd8dOozW1LV6wPVatWpa1lZMeMIB0OcARCW3q%2B3QydoW2KdliLKyksFwumH9C7Fsnj6HTaEbUjSttTZE%2Fbe%2Bo%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+Sly3IYj3EbZFHGGNxV6Ns4j76O8d0kRQe3WriJz5qY6s4GBIwlsdy13AciaQuiVt232HlOlZ4TzGaSSk3+ZMldwBGaTp/fIN9SGBW/NVUtfDOI2sIDLZCBBrdK7WVvtCQQ+1Y+6qClYg/QurJExCFRkDeKpKjDug=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BSly3IYj3EbZFHGGNxV6Ns4j76O8d0kRQe3WriJz5qY6s4GBIwlsdy13AciaQuiVt232HlOlZ4TzGaSSk3%2BZMldwBGaTp%2FfIN9SGBW%2FNVUtfDOI2sIDLZCBBrdK7WVvtCQQ%2B1Y%2B6qClYg%2FQurJExCFRkDeKpKjDug%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-18T06:27:45.619Z", + "updated_at": "2022-02-18T06:31:08.630Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": 5, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/publications?page=1&limit=10" + }, + "object": "voucher" + } + } } } - }, - "e_404_not_found": { - "description": "Error: Not Found", - "type": "object", - "title": "Not Found", - "properties": { - "code": { - "type": "integer", - "default": 404, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "not_found", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Resource not found", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0a96cd820301c0483a", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - }, - "resource_id": { - "type": "string", - "description": "Name or ID of the resource that was not found." + } + }, + "400": { + "description": "Returns an error if, for example, the AMOUNT type discount doesn't have the `type` attribute defined.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" }, - "resource_type": { - "type": "string", - "description": "Specifies the type of resource that was not found." + "examples": { + "Invalid Voucher": { + "value": { + "code": 400, + "key": "invalid_voucher", + "message": "Invalid Voucher", + "details": "It is not possible to change Voucher discount type", + "request_id": "b7f5149d-83e5-46ef-93ad-ef191a87b185" + } + } } } + } + } + } + }, + "delete": { + "operationId": "delete-voucher", + "tags": [ + "VOUCHERS API" + ], + "summary": "Delete Voucher", + "description": "Deletes a voucher. This operation cannot be undone. Additionally, this operation removes any redemptions on the voucher.", + "parameters": [ + { + "schema": { + "type": "string" }, - "e_409_duplicate_found": { - "title": "Duplicated Resource", - "type": "object", - "description": "Error: Conflict → Duplicated resource found", - "properties": { - "code": { - "type": "integer", - "default": 409, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "duplicate_found", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Duplicated resource found", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." - }, - "request_id": { - "type": "string", - "example": "v-0aa36e570e44cb3bdd", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." - }, - "resource_id": { - "type": "string", - "description": "Name or ID of the resource that already exists." + "in": "query", + "name": "force", + "description": "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." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." + }, + "404": { + "description": "Returns an error indicating that the voucher with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" }, - "resource_type": { - "type": "string", - "description": "Specifies the type of resource that already exists." + "examples": { + "Voucher Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id 10OFF", + "request_id": "v-0ae28d3cec96bb1b7e", + "resource_id": "10OFF", + "resource_type": "voucher" + } + } } } - }, - "e_400_duplicate_key": { - "title": "Duplicated Key", - "type": "object", - "description": "Error: Conflict → Duplicated key found", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." + } + } + } + }, + "post": { + "operationId": "create-voucher", + "tags": [ + "VOUCHERS API" + ], + "summary": "Create Voucher", + "description": "Create a standalone voucher. You can choose to create a `GIFT_VOUCHER`, a `DISCOUNT_VOUCHER`, or a `LOYALTY_CARD`. The code path parameter can use all letters of the English alphabet, Arabic numerals and special characters. \n\nWhen you create a new voucher, you can specify a type to create it.\nCreating a new voucher will create a new stand alone voucher if no `campaign` name or `campaign_id` is provided. In case of the loyalty card, a campaign name is required.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the details of the voucher that you would like to create.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_req_vouchers_code_POST" + }, + "examples": { + "Percentage Discount": { + "value": { + "category": "New Customers", + "type": "DISCOUNT_VOUCHER", + "discount": { + "percent_off": 10, + "type": "PERCENT", + "effect": "APPLY_TO_ORDER" + }, + "start_date": "2022-01-01T00:00:00Z", + "expiration_date": "2022-12-31T23:59:59Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P2D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": false, + "additional_info": "This voucher will remain inactive until enabled.", + "redemption": { + "quantity": 10 + }, + "metadata": { + "test": true, + "locale": "de-en" + }, + "validation_rules": [ + "val_4j7DCRm2IS59" + ] + } }, - "key": { - "type": "string", - "default": "duplicate_key", - "description": "Short string describing the kind of error which occurred." + "Gift Card": { + "value": { + "category": "New Customers", + "type": "GIFT_VOUCHER", + "gift": { + "amount": 10000, + "effect": "APPLY_TO_ORDER" + }, + "start_date": "2022-01-01T00:00:00Z", + "active": true, + "additional_info": "This gift card is enabled immediately upon creation.", + "metadata": { + "test": true, + "locale": "de-en" + } + } }, - "message": { - "type": "string", - "default": "Duplicate codes", - "description": "A human-readable message providing a short description about the error." + "Loyalty Card": { + "value": { + "category": "New Customers", + "campaign": "camp_E87CubZLZ8eoQt3c4kAEZsx0", + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 10000 + }, + "additional_info": "This loyalty card is enabled immediately upon creation.", + "metadata": { + "test": true, + "locale": "de-en" + } + } }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." + "Amount Discount with Formula": { + "value": { + "category": "First", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 100, + "amount_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", + "effect": "APPLY_TO_ORDER" + }, + "start_date": "2020-01-01T00:00:00Z", + "expiration_date": "2022-12-31T23:59:59Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P2D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": true, + "additional_info": "This voucher can be used with other coupons.", + "redemption": { + "quantity": 100 + }, + "metadata": { + "Season": "Spring" + } + } }, - "request_id": { - "type": "string", - "example": "v-0aa36e570e44cb3bdd", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + "Percent Discount with Formula": { + "value": { + "category": "First", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "percent_off": 40, + "percent_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", + "amount_limit": 1700, + "effect": "APPLY_TO_ORDER" + }, + "start_date": "2020-01-01T00:00:00Z", + "expiration_date": "2022-12-31T23:59:59Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P2D" + }, + "validity_day_of_week": [ + 0, + 1 + ], + "active": true, + "additional_info": "This voucher can be used with other coupons.", + "redemption": { + "quantity": 101 + }, + "metadata": { + "Season": "Fall" + } + } } } - }, - "e_400_duplicate_source_id": { - "title": "Duplicate Source ID", - "type": "object", - "description": "Error: Conflict → Duplicate source_id found", - "properties": { - "code": { - "type": "integer", - "default": 400, - "description": "Error's HTTP status code." - }, - "key": { - "type": "string", - "default": "duplicate_source_id", - "description": "Short string describing the kind of error which occurred." - }, - "message": { - "type": "string", - "default": "Duplicate source_id", - "description": "A human-readable message providing a short description about the error." - }, - "details": { - "type": "string", - "description": "A human-readable message providing more details about the error." + } + } + }, + "responses": { + "200": { + "description": "Returns a voucher object if the call succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_obj_voucher_object" }, - "request_id": { - "type": "string", - "example": "v-0aa36e570e44cb3bdd", - "description": "This ID is useful when troubleshooting and/or finding the root cause of an error response by our support team." + "examples": { + "Percentage Discount": { + "value": { + "id": "v_MBOEmHelKwvykVZ8JcT4TE5Kla5IMJyc", + "code": "welcome", + "campaign": null, + "campaign_id": null, + "category": "New Customers", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "percent_off": 10, + "effect": "APPLY_TO_ORDER" + }, + "gift": null, + "loyalty_card": null, + "start_date": "2022-01-01T00:00:00.000Z", + "expiration_date": "2022-12-31T23:59:59.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "PT1H" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": false, + "additional_info": "This voucher will remain inactive until enabled.", + "metadata": { + "test": true, + "locale": "de-en" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX1+by33CNzWu6xXjCrLKRr1+H9K3I9wOSa7idiHrMYJe0HlrWiy7INhaJf1BnaKJjLKcUC+4/hCbILtJ9lHXZWhewG5q5rmx29gK0IH2eRauw1qCZKIlXfqeGTG2T5ftPsEl1D4xf8W2MA==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bby33CNzWu6xXjCrLKRr1%2BH9K3I9wOSa7idiHrMYJe0HlrWiy7INhaJf1BnaKJjLKcUC%2B4%2FhCbILtJ9lHXZWhewG5q5rmx29gK0IH2eRauw1qCZKIlXfqeGTG2T5ftPsEl1D4xf8W2MA%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX19wOdFeXYXZ4Xu22L0Ummk03Urz/ZTnXUFeHeehtK4L6RTvNgVeSR+McTZR4DYNLEGydZ+Fo2xEqqM1UWyl8Bx22Pi1CxghADOcy3bAvSca7EEPpvKrCY403UWUDvaO/OEAjvVoiEuaHA==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19wOdFeXYXZ4Xu22L0Ummk03Urz%2FZTnXUFeHeehtK4L6RTvNgVeSR%2BMcTZR4DYNLEGydZ%2BFo2xEqqM1UWyl8Bx22Pi1CxghADOcy3bAvSca7EEPpvKrCY403UWUDvaO%2FOEAjvVoiEuaHA%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-17T09:05:34.668Z", + "updated_at": null, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_74F7QZoYbUoljwQO", + "rule_id": "val_4j7DCRm2IS59", + "related_object_id": "v_MBOEmHelKwvykVZ8JcT4TE5Kla5IMJyc", + "related_object_type": "voucher", + "created_at": "2022-02-17T09:05:34.642Z", + "object": "validation_rules_assignment" + } + ], + "total": 1 + }, + "redemption": { + "quantity": 10, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/welcome/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/welcome/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Gift Card": { + "value": { + "id": "v_7xaObxyK5LG62Rp0Xqpez7lqiBFL62pL", + "code": "welcomegiftcard", + "campaign": null, + "campaign_id": null, + "category": "New Customers", + "type": "GIFT_VOUCHER", + "discount": null, + "gift": { + "amount": 10000, + "balance": 10000, + "effect": "APPLY_TO_ORDER" + }, + "loyalty_card": null, + "start_date": "2022-01-01T00:00:00.000Z", + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": "This gift card is enabled immediately upon creation.", + "metadata": { + "test": true, + "locale": "de-en" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX1+mTbI2MdzBdMJ7AsOPKvGGgRB7O4oHZv5qq8I3M/OBPJm4PV8bTtBgR+oXOU4Jv1ucbIV7yg1mzC86LVFKjO7Ptnj+63mS9QdHvvILEAulBuZZQ+hZ0HmFXjDl4Quz/kUqGwffKGTziQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BmTbI2MdzBdMJ7AsOPKvGGgRB7O4oHZv5qq8I3M%2FOBPJm4PV8bTtBgR%2BoXOU4Jv1ucbIV7yg1mzC86LVFKjO7Ptnj%2B63mS9QdHvvILEAulBuZZQ%2BhZ0HmFXjDl4Quz%2FkUqGwffKGTziQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX184KgQ11OfpqB4WkJuH9ushSwZb0YrcN+8OaGPHxBQMiBr2axwnvQlZYv6YhqWtnc5iHByHrkg+6qYHxOLBPRMWCysIhcuUEB57IDhgYUHRPyM2bWjQadVHngGfVGCQ0CUy4PO/71RdMw==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX184KgQ11OfpqB4WkJuH9ushSwZb0YrcN%2B8OaGPHxBQMiBr2axwnvQlZYv6YhqWtnc5iHByHrkg%2B6qYHxOLBPRMWCysIhcuUEB57IDhgYUHRPyM2bWjQadVHngGfVGCQ0CUy4PO%2F71RdMw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-17T09:09:49.665Z", + "updated_at": null, + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "redeemed_amount": 0, + "object": "list", + "url": "/v1/vouchers/welcomegiftcard/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/welcomegiftcard/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Loyalty Card": { + "value": { + "id": "v_l84t3fy3keMUiOeaHbN1cbTdW8O5eUlm", + "code": "welcomeloyalty", + "campaign": "Loyalty Campaign", + "campaign_id": "camp_E87CubZLZ8eoQt3c4kAEZsx0", + "category": "New Customers", + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 10000, + "balance": 10000 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": "This loyalty card is enabled immediately upon creation.", + "metadata": { + "test": true, + "locale": "de-en" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX186PCWooyrNsjfI+nb+Y9ziUZ1k7xe+nJQ53Ms1ynNJOX6JXC6SwxS1WDhYwAKX5FxaDoKyuPf5MkQrkeB6u5bSx333ldAyLypNnqwBD2N17S64WFnTqV7eXUk3hS30wDYcz0cQAJFDcQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186PCWooyrNsjfI%2Bnb%2BY9ziUZ1k7xe%2BnJQ53Ms1ynNJOX6JXC6SwxS1WDhYwAKX5FxaDoKyuPf5MkQrkeB6u5bSx333ldAyLypNnqwBD2N17S64WFnTqV7eXUk3hS30wDYcz0cQAJFDcQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/FWUg0RbOU7R7Zqg7/8Ba6oYuXrmIl7EdXGgaPMPfpePNGRzxBu4LP2dNEUO9h1Sh37MR1PxOoaemPwlgTDo/1G8dX1JjSppNoaTHhkzk2w4yutNhP7o8cq3ZBbT3TNMTKb2H3fUMc7A==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FFWUg0RbOU7R7Zqg7%2F8Ba6oYuXrmIl7EdXGgaPMPfpePNGRzxBu4LP2dNEUO9h1Sh37MR1PxOoaemPwlgTDo%2F1G8dX1JjSppNoaTHhkzk2w4yutNhP7o8cq3ZBbT3TNMTKb2H3fUMc7A%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-17T09:12:01.428Z", + "updated_at": null, + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "redeemed_points": 0, + "object": "list", + "url": "/v1/vouchers/welcomeloyalty/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/welcomeloyalty/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Amount Discount with Formula": { + "value": { + "id": "v_pmjVYKEDFzMqwNroHTlFcI1yKLqUcVVS", + "code": "amount1", + "campaign": null, + "campaign_id": null, + "category": "First", + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" + } + ], + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 100, + "amount_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", + "effect": "APPLY_TO_ORDER" + }, + "gift": null, + "loyalty_card": null, + "start_date": "2020-01-01T00:00:00.000Z", + "expiration_date": "2022-12-31T23:59:59.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "PT1H" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": true, + "additional_info": "This voucher can be used with other coupons.", + "metadata": { + "Season": "Spring" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX1+aMFY2yoGxlWkhulvTPR8RlMZtfOaWXnL6PCnegsV73aCTsue+JlUrQsbh+dmp2gJigaVixgvyC7/zUxQjf8tnVT4R79G4LmUkltHMqHsaf++fsP1G07nDl9/2WHh/QVb6z4KP/DX5Dw==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BaMFY2yoGxlWkhulvTPR8RlMZtfOaWXnL6PCnegsV73aCTsue%2BJlUrQsbh%2Bdmp2gJigaVixgvyC7%2FzUxQjf8tnVT4R79G4LmUkltHMqHsaf%2B%2BfsP1G07nDl9%2F2WHh%2FQVb6z4KP%2FDX5Dw%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+X2OimwSCEmGvGrZXXK+b4OrStQELVsHRup8Su+uISCOBz7xWdbpoLVJlSFepcRxSNUUdjcbpgKH7YNfaclrta8Ig6/GK/4YFlh0cPKCGOG5WWyXWzxxmVgVqRdI7KR8/hdaq2FCQeWA==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BX2OimwSCEmGvGrZXXK%2Bb4OrStQELVsHRup8Su%2BuISCOBz7xWdbpoLVJlSFepcRxSNUUdjcbpgKH7YNfaclrta8Ig6%2FGK%2F4YFlh0cPKCGOG5WWyXWzxxmVgVqRdI7KR8%2Fhdaq2FCQeWA%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-19T14:22:50.552Z", + "updated_at": null, + "redemption": { + "quantity": 100, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/amount1/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/amount1/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Percent Discount with Formula": { + "value": { + "id": "v_9PbXndxO3S8xfztwMtIvuMXReonF248m", + "code": "percent1", + "campaign": null, + "campaign_id": null, + "category": "First", + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" + } + ], + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "amount_limit": 1700, + "percent_off": 40, + "percent_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", + "effect": "APPLY_TO_ORDER" + }, + "gift": null, + "loyalty_card": null, + "start_date": "2020-01-01T00:00:00.000Z", + "expiration_date": "2022-12-31T23:59:59.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "PT1H" + }, + "validity_day_of_week": [ + 0, + 1 + ], + "active": true, + "additional_info": "This voucher can be used with other coupons.", + "metadata": { + "Season": "Fall" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX19MPtNCPjoG/pKloolK+BZH/OCIpjYqj+B6IVJJmTYKeBINcB0JioL/tSw3iuK4FvgF8VyDyTfL26IpzbT81DDOnKeFIDUJraQDJiKxWcrG/RCFsVky4olBJ+GZFb9pLpN5gC/rn0pqYw==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19MPtNCPjoG%2FpKloolK%2BBZH%2FOCIpjYqj%2BB6IVJJmTYKeBINcB0JioL%2FtSw3iuK4FvgF8VyDyTfL26IpzbT81DDOnKeFIDUJraQDJiKxWcrG%2FRCFsVky4olBJ%2BGZFb9pLpN5gC%2Frn0pqYw%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/J73XXWgMf2BsVM21kpnFLQak5dpGzThYNTYPT62U6q+5RDlh/CXylkTrhegRnWJw1HA7iehT8iUoV4M4cV0KBdp5WgJ3lXeFZcpX3Mpu0T02PRcYbdCIiSO1kO50Y8Hg/heHcshw22Q==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FJ73XXWgMf2BsVM21kpnFLQak5dpGzThYNTYPT62U6q%2B5RDlh%2FCXylkTrhegRnWJw1HA7iehT8iUoV4M4cV0KBdp5WgJ3lXeFZcpX3Mpu0T02PRcYbdCIiSO1kO50Y8Hg%2FheHcshw22Q%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-19T14:41:30.976Z", + "updated_at": null, + "redemption": { + "quantity": 101, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/percent1/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/percent1/publications?page=1&limit=10" + }, + "object": "voucher" + } + } } } - }, - "product_collections_get_response_body": { - "$ref": "#/components/schemas/product_collections_collection_item", - "description": "\"Response body schema for **GET** `/product-collections/{collectionId}`.\",", - "title": "Get Product Collection Response Body" - }, - "product_collections_collection_item": { - "title": "Product Collection Object", - "description": "This is an object representing a product collection. \n\nThe products can be grouped into collections by the creation of a products collection object. You can retrieve a product collection and a list of products in the collection. Product collections are identified by a unique ID.", - "x-tags": [ - "PRODUCT COLLECTIONS API" - ], - "allOf": [ - { - "$ref": "#/components/schemas/product_collections_collection_item_base" + } + }, + "409": { + "description": "Returns an error if a voucher code already exists.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_409_duplicate_found" }, - { - "anyOf": [ - { - "$ref": "#/components/schemas/product_collections_static_collection" - }, - { - "$ref": "#/components/schemas/product_collections_dynamic_collection" + "examples": { + "Duplicate Code": { + "value": { + "code": 409, + "key": "duplicate_found", + "message": "Duplicated resource found", + "details": "Duplicated voucher exists with id CODE", + "request_id": "v-0ae786a8f786b73dfa", + "resource_id": "CODE", + "resource_type": "voucher" } - ] - } - ] - }, - "product_collections_collection_item_base": { - "title": "Product Collection Base", - "description": "This is an object representing a product collection base. ", - "x-tags": [ - "PRODUCT COLLECTIONS API" - ], - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "Product collection ID." - }, - "name": { - "type": "string", - "example": "All Products", - "description": "Unique user-defined product collection name." - }, - "created_at": { - "type": "string", - "example": "2021-12-09T12:51:29.898Z", - "description": "Timestamp representing the date and time when the product collection was created in ISO 8601 format.", - "format": "date-time" - }, - "object": { - "description": "The type of object represented by JSON. This object stores information about the static product collection.", - "enum": [ - "products_collection" - ] - } - }, - "required": [ - "id", - "name", - "created_at", - "object" - ] - }, - "product_collections_create_request_body": { - "title": "product_collections_create_request_body", - "anyOf": [ - { - "$ref": "#/components/schemas/product_collections_create_static_request_body" - }, - { - "$ref": "#/components/schemas/product_collections_create_dynamic_request_body" - } - ] - }, - "product_collections_create_static_request_body": { - "title": "Create Product Collection - Static", - "type": "object", - "properties": { - "type": { - "enum": [ - "STATIC" - ] - }, - "name": { - "type": "string" - }, - "products": { - "type": "array", - "items": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "product_id": { - "type": "string" - }, - "object": { - "enum": [ - "sku", - "product" - ] - } - }, - "required": [ - "id", - "object" - ] } } + } + } + } + } + } + }, + "/v1/vouchers/": { + "post": { + "operationId": "generate-random-code", + "tags": [ + "VOUCHERS API" + ], + "summary": "Generate Random Code", + "description": "Create a standalone voucher. You can choose to create a `GIFT_VOUCHER`, a `DISCOUNT_VOUCHER`, or a `LOYALTY_CARD`. \n\nWhen you create a new voucher, you can specify a type to create it.\nCreating a new voucher will create a new stand alone voucher if no `campaign` name or `campaign_id` is provided. In case of the loyalty card, a campaign name is required.\n\nYou can optionally use the `code` parameter to define a specific code or the `code_config` parameter to design rules for Voucherify API to create a random code. If neither of the two parameters are passed, then a random code is generated by the Voucherify API.\n\nThis method will return an error when trying to create a voucher that already exists.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the details of the voucher that you would like to create.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_req_vouchers__POST" }, - "required": [ - "type", - "name" - ] - }, - "product_collections_create_dynamic_request_body": { - "title": "Create Product Collection - Auto Update", - "type": "object", - "properties": { - "type": { - "enum": [ - "AUTO_UPDATE" - ] - }, - "name": { - "type": "string" - }, - "filter": { - "type": "object", - "additionalProperties": false, - "required": [ - "junction" - ], - "properties": { - "junction": { - "$ref": "#/components/schemas/Junction" - }, - "id": { - "$ref": "#/components/schemas/FieldConditions" - }, - "product_id": { - "$ref": "#/components/schemas/FieldConditions" + "examples": { + "Percentage Discount": { + "value": { + "category": "New Customers", + "code": "NEW-WELCOME-COUPON", + "type": "DISCOUNT_VOUCHER", + "campaign_id": "camp_Y6dLsYIZloGqP8izufXY6SSJ", + "discount": { + "percent_off": 10, + "type": "PERCENT", + "effect": "APPLY_TO_ORDER" }, - "source_id": { - "$ref": "#/components/schemas/FieldConditions" + "start_date": "2016-01-01T00:00:00Z", + "expiration_date": "2022-12-31T23:59:59Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P2D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": false, + "additional_info": "This voucher will remain inactive until enabled.", + "redemption": { + "quantity": 10 }, - "name": { - "$ref": "#/components/schemas/FieldConditions" + "metadata": { + "test": true, + "locale": "de-en" }, - "price": { - "$ref": "#/components/schemas/FieldConditions" + "validation_rules": [ + "val_4j7DCRm2IS59" + ] + } + }, + "Gift Card": { + "value": { + "category": "New Customers", + "type": "GIFT_VOUCHER", + "gift": { + "amount": 10000, + "effect": "APPLY_TO_ORDER" }, - "object": { - "$ref": "#/components/schemas/FieldConditions" + "start_date": "2022-01-01T00:00:00Z", + "active": true, + "additional_info": "This gift card is enabled immediately upon creation.", + "metadata": { + "test": true, + "locale": "de-en" }, - "attributes": { - "$ref": "#/components/schemas/FieldConditions" + "code_config": { + "pattern": "GIFT-CARD-##########", + "prefix": "New-", + "postfix": "0", + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + } + } + }, + "Loyalty Card": { + "value": { + "category": "New Customers", + "campaign": "camp_E87CubZLZ8eoQt3c4kAEZsx0", + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 10000 }, + "additional_info": "This loyalty card is enabled immediately upon creation.", "metadata": { - "$ref": "#/components/schemas/FieldConditions" + "test": true, + "locale": "de-en" }, - "image_url": { - "$ref": "#/components/schemas/FieldConditions" - }, - "skus": { - "$ref": "#/components/schemas/FieldConditions" + "code_config": { + "pattern": "LOYALTY-CARD-##", + "prefix": "New-", + "postfix": "1", + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + } + } + }, + "Unit Discount Multiple Items": { + "value": { + "category": "New Customers", + "code": "MultipleUnitTypesUnitDiscount", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "UNIT", + "effect": "ADD_MANY_ITEMS", + "units": [ + { + "unit_off": 1, + "unit_type": "prod_0a9f9ab4ab019a42d5", + "effect": "ADD_NEW_ITEMS" + }, + { + "unit_off": 1, + "unit_type": "prod_0a9f9aeddb019a42db", + "effect": "ADD_MISSING_ITEMS" + } + ] }, - "created_at": { - "$ref": "#/components/schemas/FieldConditions" + "start_date": "2020-01-01T00:00:00Z", + "expiration_date": "2022-12-31T23:59:59Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P2D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": false, + "additional_info": "This voucher will remain inactive until enabled.", + "redemption": { + "quantity": 5 }, - "updated_at": { - "$ref": "#/components/schemas/FieldConditions" + "metadata": { + "test": true, + "locale": "de-en" + } + } + }, + "Unit Discount Single Item": { + "value": { + "category": "New Customers", + "code": "AddMissingItemDiscount", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "UNIT", + "unit_off": 1, + "unit_type": "prod_0a9f9ab4ab019a42d5", + "effect": "ADD_MISSING_ITEMS" + }, + "start_date": "2020-01-01T00:00:00Z", + "expiration_date": "2022-12-31T23:59:59Z", + "active": false, + "additional_info": "This voucher will remain inactive until enabled.", + "redemption": { + "quantity": 3 } } } - }, - "required": [ - "type", - "name", - "filter" - ] + } } - }, - "examples": { - "req_vouchers_metadata_1": { - "value": { - "codes": [ - "PROMO-CODE810", - "PROMO-CODE726" - ], - "metadata": { - "lang": "en", - "authorized_internally": true + } + }, + "responses": { + "200": { + "description": "Returns a voucher object if the call succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_obj_voucher_object" + }, + "examples": { + "Percentage Discount": { + "value": { + "id": "v_YJYfeKoR0XAGIvaM7k51wTbDjU4WIpC5", + "code": "NEW-WELCOME-COUPON", + "campaign": "Bug fix", + "campaign_id": "camp_Y6dLsYIZloGqP8izufXY6SSJ", + "category": "New Customers", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "percent_off": 10, + "effect": "APPLY_TO_ORDER" + }, + "gift": null, + "loyalty_card": null, + "start_date": "2016-01-01T00:00:00.000Z", + "expiration_date": "2022-12-31T23:59:59.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "PT1H" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": false, + "additional_info": "This voucher will remain inactive until enabled.", + "metadata": { + "test": true, + "locale": "de-en" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX180g6GhUA0kT47tHGvZ5thjCgY5nbsPtiecixkkEznFVg2v3SDG9dpCbXR6BSUdM/d78Wm/zru1ybT4+AQ2X0JnEy86N7TZ/aoezZORjcBRUfyVM/scUUF/vmD4Ezn+Elp2+V9AFcAXN/WthaRMl9e7xvEeIEQ5nao=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX180g6GhUA0kT47tHGvZ5thjCgY5nbsPtiecixkkEznFVg2v3SDG9dpCbXR6BSUdM%2Fd78Wm%2Fzru1ybT4%2BAQ2X0JnEy86N7TZ%2FaoezZORjcBRUfyVM%2FscUUF%2FvmD4Ezn%2BElp2%2BV9AFcAXN%2FWthaRMl9e7xvEeIEQ5nao%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/AynivxYCEIxfTnf3A1lO0xsNihOlbUMo6Y6873LQ2qpmkk90aUFnaFKd7pVumcirRweblzGVSxy24Phhd174VSPaLxxmSKp0FPv0dRos/XWBg8zu0Kta0pA/yvFK3WWGlNoPPPnvEhVWKKzOr09Gj94SMrr+TGlI=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FAynivxYCEIxfTnf3A1lO0xsNihOlbUMo6Y6873LQ2qpmkk90aUFnaFKd7pVumcirRweblzGVSxy24Phhd174VSPaLxxmSKp0FPv0dRos%2FXWBg8zu0Kta0pA%2FyvFK3WWGlNoPPPnvEhVWKKzOr09Gj94SMrr%2BTGlI%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-17T07:14:40.096Z", + "updated_at": null, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_COu5PJAsWmAwuCqR", + "rule_id": "val_4j7DCRm2IS59", + "related_object_id": "v_YJYfeKoR0XAGIvaM7k51wTbDjU4WIpC5", + "related_object_type": "voucher", + "created_at": "2022-02-17T07:14:40.280Z", + "object": "validation_rules_assignment" + } + ], + "total": 1 + }, + "redemption": { + "quantity": 10, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/NEW-WELCOME-COUPON/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/NEW-WELCOME-COUPON/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Gift Voucher": { + "value": { + "id": "v_yAZyBimXtF9yQ2C5BEF9WMhNzOMJNfz6", + "code": "New-GIFT-CARD-8tqB6FcyhE0", + "campaign": null, + "campaign_id": null, + "category": "New Customers", + "type": "GIFT_VOUCHER", + "discount": null, + "gift": { + "amount": 10000, + "balance": 10000, + "effect": "APPLY_TO_ORDER" + }, + "loyalty_card": null, + "start_date": "2022-01-01T00:00:00.000Z", + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": "This gift card is enabled immediately upon creation.", + "metadata": { + "test": true, + "locale": "de-en" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX1+pm0q3U4i/KrjResuZpwDigEa5WcDOlwYS/bj3rsesZXDpJF5MNHMUsKqy0+wn5tY3QbjPGv0dwbqRn/OjrIRgNlP99azD0n0n9C/chiTABp8BxlJmMKKFo5AggBbQu4+Mw8Cv8V3+0Ga7ETzeehS+Yrj6c+3ioxg=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bpm0q3U4i%2FKrjResuZpwDigEa5WcDOlwYS%2Fbj3rsesZXDpJF5MNHMUsKqy0%2Bwn5tY3QbjPGv0dwbqRn%2FOjrIRgNlP99azD0n0n9C%2FchiTABp8BxlJmMKKFo5AggBbQu4%2BMw8Cv8V3%2B0Ga7ETzeehS%2BYrj6c%2B3ioxg%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/UaGX0zV8oXbpYah2G76V1ljYSy6hDSnWAZhpz5v10vRibGaOJUahyLcClMyxAsUhU9WXWi4BUGWIEEu510AxzxyGHOTDTjavJH0Q79PI0ciLHdujNFOgLOXWe9Ffwzj+Kvjmbhb22/SVZd/xzQlUBJcv7XboJYU0=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FUaGX0zV8oXbpYah2G76V1ljYSy6hDSnWAZhpz5v10vRibGaOJUahyLcClMyxAsUhU9WXWi4BUGWIEEu510AxzxyGHOTDTjavJH0Q79PI0ciLHdujNFOgLOXWe9Ffwzj%2BKvjmbhb22%2FSVZd%2FxzQlUBJcv7XboJYU0%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-17T07:49:10.834Z", + "updated_at": null, + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "redeemed_amount": 0, + "object": "list", + "url": "/v1/vouchers/New-GIFT-CARD-8tqB6FcyhE0/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/New-GIFT-CARD-8tqB6FcyhE0/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Loyalty Card": { + "value": { + "id": "v_tVkcOhjHCz9W7q8QnuJnTGPBR2hdaYrC", + "code": "New-LOYALTY-CARD-UC1", + "campaign": "Loyalty Campaign", + "campaign_id": "camp_E87CubZLZ8eoQt3c4kAEZsx0", + "category": "New Customers", + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 10000, + "balance": 10000 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": "This loyalty card is enabled immediately upon creation.", + "metadata": { + "test": true, + "locale": "de-en" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX1+6lGBFlqtS9OoY2wbAsoSupV43qa+g5sGu+R0IDTq2k85LIfbKfV9sDSYv80pP9ucsazJ6qGI9ineqQyhv9VVHdsJ2qGRiuZzpw/vRkSA0a7J9N1MpANgzqpIULZHLjYtrCQ/2el72nZ6Hpr2NkWtk19JTpNwB8tk=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B6lGBFlqtS9OoY2wbAsoSupV43qa%2Bg5sGu%2BR0IDTq2k85LIfbKfV9sDSYv80pP9ucsazJ6qGI9ineqQyhv9VVHdsJ2qGRiuZzpw%2FvRkSA0a7J9N1MpANgzqpIULZHLjYtrCQ%2F2el72nZ6Hpr2NkWtk19JTpNwB8tk%3D" + }, + "barcode": { + "id": "U2FsdGVkX180bvJVsyZvpAqwYXTnm4MvvH4Rur+ZhM+Mbmnva/fgYUcUbOttsFXPY/PMZ9Xi8pomVp26a7amIPguNimD8w4PMZLMavMtH7EtJ4k+0V0Wp7JUkudIKeRw2fDnQ3/0cgqvK6PMReUwFWb5nUT3ABpZDAdaOVoMDhE=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX180bvJVsyZvpAqwYXTnm4MvvH4Rur%2BZhM%2BMbmnva%2FfgYUcUbOttsFXPY%2FPMZ9Xi8pomVp26a7amIPguNimD8w4PMZLMavMtH7EtJ4k%2B0V0Wp7JUkudIKeRw2fDnQ3%2F0cgqvK6PMReUwFWb5nUT3ABpZDAdaOVoMDhE%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-17T08:06:41.091Z", + "updated_at": null, + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "redeemed_points": 0, + "object": "list", + "url": "/v1/vouchers/New-LOYALTY-CARD-UC1/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/New-LOYALTY-CARD-UC1/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Unit Discount Multiple Items": { + "value": { + "id": "v_cu8nyozvTDA413H17bH5BLha0cjxt7s8", + "code": "MultipleUnitTypesUnitDiscount", + "campaign": null, + "campaign_id": null, + "category": "New Customers", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "UNIT", + "effect": "ADD_MANY_ITEMS", + "units": [ + { + "unit_off": 1, + "unit_type": "prod_0a9f9ab4ab019a42d5", + "effect": "ADD_NEW_ITEMS" + }, + { + "unit_off": 1, + "unit_type": "prod_0a9f9aeddb019a42db", + "effect": "ADD_MISSING_ITEMS" + } + ] + }, + "gift": null, + "loyalty_card": null, + "start_date": "2020-01-01T00:00:00.000Z", + "expiration_date": "2022-12-31T23:59:59.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "PT1H" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": false, + "additional_info": "This voucher will remain inactive until enabled.", + "metadata": { + "test": true, + "locale": "de-en" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX1+ocJBtZ9NqT97gZ/QTfOz54TAoRoKO3tnCYBtHZWMghEHT0b2aFrPSL1lqMyf6fYy6DH2/DkH5p5Vd8dOozW1LV6wPVatWpa1lZMeMIB0OcARCW3q+3QydoW2KdliLKyksFwumH9C7Fsnj6HTaEbUjSttTZE/be+o=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BocJBtZ9NqT97gZ%2FQTfOz54TAoRoKO3tnCYBtHZWMghEHT0b2aFrPSL1lqMyf6fYy6DH2%2FDkH5p5Vd8dOozW1LV6wPVatWpa1lZMeMIB0OcARCW3q%2B3QydoW2KdliLKyksFwumH9C7Fsnj6HTaEbUjSttTZE%2Fbe%2Bo%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+Sly3IYj3EbZFHGGNxV6Ns4j76O8d0kRQe3WriJz5qY6s4GBIwlsdy13AciaQuiVt232HlOlZ4TzGaSSk3+ZMldwBGaTp/fIN9SGBW/NVUtfDOI2sIDLZCBBrdK7WVvtCQQ+1Y+6qClYg/QurJExCFRkDeKpKjDug=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BSly3IYj3EbZFHGGNxV6Ns4j76O8d0kRQe3WriJz5qY6s4GBIwlsdy13AciaQuiVt232HlOlZ4TzGaSSk3%2BZMldwBGaTp%2FfIN9SGBW%2FNVUtfDOI2sIDLZCBBrdK7WVvtCQQ%2B1Y%2B6qClYg%2FQurJExCFRkDeKpKjDug%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-18T06:27:45.619Z", + "updated_at": null, + "redemption": { + "quantity": 5, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/publications?page=1&limit=10" + }, + "object": "voucher" + } + }, + "Unit Discount Single Item": { + "value": { + "id": "v_NQdraO4fXWYvMMWYL9OY22hRernr553n", + "code": "AddMissingItemDiscount", + "campaign": null, + "campaign_id": null, + "category": "New Customers", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "UNIT", + "unit_off": 1, + "unit_type": "prod_0a9f9ab4ab019a42d5", + "effect": "ADD_MISSING_ITEMS" + }, + "gift": null, + "loyalty_card": null, + "start_date": "2020-01-01T00:00:00.000Z", + "expiration_date": "2022-12-31T23:59:59.000Z", + "validity_timeframe": null, + "validity_day_of_week": null, + "active": false, + "additional_info": "This voucher will remain inactive until enabled.", + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX19Yh7LTNyOVKSXQ+ceTr023saElWAUeucwOgjTH50x1SoSF/PP1aoGBr6sSxHZNZOvBGumWNHjsF85y7cPY7La/4a0d1kWqnAiBWeWnGOgDFeQFqthGswypFOK1jdAzUPqLSbxW3O6q936N6Bsmoz4QHYE//kfWFhs=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19Yh7LTNyOVKSXQ%2BceTr023saElWAUeucwOgjTH50x1SoSF%2FPP1aoGBr6sSxHZNZOvBGumWNHjsF85y7cPY7La%2F4a0d1kWqnAiBWeWnGOgDFeQFqthGswypFOK1jdAzUPqLSbxW3O6q936N6Bsmoz4QHYE%2F%2FkfWFhs%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+RqzgyYsIJzAEBxmQt1OZLu4+PSUDQBldDKK1o5XsEoBSQEMPWHis1wJSg4ZNqJ9ZdJ0Ukc+K6X1fjg0ggDsCdXP2ZxpyGPD8/1ReggJZ/tq823ji7A5pzhG1TljA6+vmISuHvs2wkcum0djN9AWuAlB0F/vbXexo=", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BRqzgyYsIJzAEBxmQt1OZLu4%2BPSUDQBldDKK1o5XsEoBSQEMPWHis1wJSg4ZNqJ9ZdJ0Ukc%2BK6X1fjg0ggDsCdXP2ZxpyGPD8%2F1ReggJZ%2Ftq823ji7A5pzhG1TljA6%2BvmISuHvs2wkcum0djN9AWuAlB0F%2FvbXexo%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-18T06:46:44.536Z", + "updated_at": null, + "redemption": { + "quantity": 3, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/AddMissingItemDiscount/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/AddMissingItemDiscount/publications?page=1&limit=10" + }, + "object": "voucher" + } + } } } - }, - "req_vouchers_metadata_2": { - "value": { - "codes": [ - "PROMO-CODE810", - "PROMO-CODE726", - "PROMO-CODE888" - ], - "metadata": { - "lang": "en", - "authorized_internally": true + } + } + } + } + }, + "/v1/vouchers/{code}/enable": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "2CpRCE2c" + }, + "name": "code", + "in": "path", + "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. `v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u`.", + "required": true + } + ], + "post": { + "operationId": "enable-voucher", + "tags": [ + "VOUCHERS API" + ], + "summary": "Enable Voucher", + "description": "There are various times when you'll want to manage a voucher's accessibility. This can be done by two API methods for managing the voucher state - *enable* and *disable*. \n___\nThe 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.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a voucher object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_obj_voucher_object" + }, + "examples": { + "Example": { + "value": { + "id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "code": "2CpRCE2c", + "campaign": null, + "campaign_id": null, + "category": null, + "category_id": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 300, + "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1+ro/6HLsfI9E/rz0QEoYv+rcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz+WQtg4nKpjUS0wcA7AuIbz2zb870YfJO/r5UBS5gCqQ==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bro%2F6HLsfI9E%2Frz0QEoYv%2BrcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz%2BWQtg4nKpjUS0wcA7AuIbz2zb870YfJO%2Fr5UBS5gCqQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3/4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ+aTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3%2F4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ%2BaTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-19T10:06:07.932Z", + "updated_at": "2022-09-19T11:54:17.248Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_HesdqEzt5e9c0T56", + "rule_id": "val_gZft0NKZSUWK", + "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "related_object_type": "voucher", + "created_at": "2022-09-19T10:06:07.934Z", + "object": "validation_rules_assignment" + } + ], + "total": 1 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/2CpRCE2c/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/2CpRCE2c/publications?page=1&limit=10" + }, + "object": "voucher" + } + } } } - }, - "res_async_actions": { - "value": { - "async_action_id": "aa_0ab2df092385be5ca5" + } + }, + "404": { + "description": "Returns an error if the voucher code does not exist or has been deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id IrKORhS", + "request_id": "v-0a96cd820301c0483a", + "resource_id": "IrKORhS", + "resource_type": "voucher" + } + } + } } } } - }, - "paths": { - "/v1/voucher-object": { - "get": { - "operationId": "voucher-object", - "tags": [ - "VOUCHERS API" - ], - "summary": "Voucher Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Voucher Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_obj_voucher_object" - } + } + } + }, + "/v1/vouchers/{code}/disable": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "2CpRCE2c" + }, + "name": "code", + "in": "path", + "required": true, + "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. `v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u`." + } + ], + "post": { + "operationId": "disable-voucher", + "tags": [ + "VOUCHERS API" + ], + "summary": "Disable Voucher", + "description": "There are various times when you'll want to manage a voucher's accessibility. This can be done by two API methods for managing the voucher state - *enable* and *disable*. \n___\nThis method sets the voucher state to **inactive**. The voucher cannot be redeemed.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a voucher object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_obj_voucher_object" + }, + "examples": { + "Example": { + "value": { + "id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "code": "2CpRCE2c", + "campaign": null, + "campaign_id": null, + "category": null, + "category_id": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 300, + "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": false, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1+ro/6HLsfI9E/rz0QEoYv+rcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz+WQtg4nKpjUS0wcA7AuIbz2zb870YfJO/r5UBS5gCqQ==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bro%2F6HLsfI9E%2Frz0QEoYv%2BrcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz%2BWQtg4nKpjUS0wcA7AuIbz2zb870YfJO%2Fr5UBS5gCqQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3/4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ+aTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3%2F4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ%2BaTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-19T10:06:07.932Z", + "updated_at": "2022-09-19T11:53:23.452Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_HesdqEzt5e9c0T56", + "rule_id": "val_gZft0NKZSUWK", + "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "related_object_type": "voucher", + "created_at": "2022-09-19T10:06:07.934Z", + "object": "validation_rules_assignment" + } + ], + "total": 1 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/2CpRCE2c/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/2CpRCE2c/publications?page=1&limit=10" + }, + "object": "voucher" } } } } } }, - "/v1/vouchers": { - "get": { - "operationId": "list-vouchers", - "tags": [ - "VOUCHERS API" - ], - "summary": "List Vouchers", - "description": "Returns a list of your vouchers. By default, the vouchers are returned sorted by creation date, with the most recent vouchers appearing first. A maximum of 10 vouchers are returned in the response.\n\nWhen you get a list of vouchers, you can optionally specify query parameters to customize the amount of vouchers returned per call using `limit`, which page of vouchers to return using `page`, sort the vouchers using the `order` query parameter and more.\n\nThis method will return an error when trying to return a limit of more than 100 vouchers.\n", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "$ref": "#/components/parameters/category" + "404": { + "description": "Returns an error if the voucher code does not exist or has been deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" }, - { - "in": "query", - "name": "campaign_id", - "description": "Limit search results to vouchers within the specified campaign", - "schema": { - "type": "string", - "example": "camp_Pfja7X91b1GoyH5wnpzCwlP3" + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id IrKORhS", + "request_id": "v-0a96cd820301c0483a", + "resource_id": "IrKORhS", + "resource_type": "voucher" + } } - }, - { - "$ref": "#/components/parameters/customer" - }, - { - "$ref": "#/components/parameters/campaign" - }, - { - "$ref": "#/components/parameters/created_at" - }, - { - "$ref": "#/components/parameters/updated_at" - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at", - "code", - "-code" - ] - }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + } + } + } + } + } + }, + "/v1/vouchers/{code}/balance": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "GIFT-CARD-1" + }, + "name": "code", + "in": "path", + "required": true, + "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. `v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u`." + } + ], + "post": { + "operationId": "add-remove-gift-voucher-balance", + "tags": [ + "VOUCHERS API" + ], + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "summary": "Add or Remove Gift Card Balance", + "description": "Add balance to an existing gift card.", + "requestBody": { + "required": true, + "description": "Provide the amount to be added to/subtracted from the gift card.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_req_vouchers_code_balance" + }, + "examples": { + "Example": { + "value": { + "amount": 10000 + } } - ], - "responses": { - "200": { - "description": "Returns a dictionary that contains an array of vouchers. Each entry in the array is a separate voucher object. If no more vouchers are available (query parameter `page` incremented over and above the voucher count), the resulting array will be empty. The result can be narrowed down according to specified (or default) filters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_res_vouchers_GET" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "vouchers", - "vouchers": [ - { - "id": "v_hrMBBeT4sOP9VSGPmj5KAgJwX202UjiY", - "code": "LOYALTY-CARD-xLPbpbXR", - "campaign": "Loyalty Program Fall 2022", - "campaign_id": "camp_f7fBbQxUuTN7dI7tGOo5XMDA", - "category": "First", - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" - } - ], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 110, - "balance": 100, - "next_expiration_date": "2023-12-31", - "next_expiration_points": 100 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8/6I6hUEqtz/F6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD/DjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8%2F6I6hUEqtz%2FF6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD%2FDjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/SpYuOrU9wd6/o1wzy6E/04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ/FJtiw69djuzQk1f4HdQo8s5gaZ7fd2U+1zbaeAvi9usyvRHZE4=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FSpYuOrU9wd6%2Fo1wzy6E%2F04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ%2FFJtiw69djuzQk1f4HdQo8s5gaZ7fd2U%2B1zbaeAvi9usyvRHZE4%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-19T07:56:22.355Z", - "updated_at": "2022-09-19T08:04:22.458Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "redemption": { - "quantity": null, - "redeemed_quantity": 1, - "redeemed_points": 10, - "object": "list", - "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/publications?page=1&limit=10" - }, - "object": "voucher" - }, - { - "id": "v_OBVfpTVf24DBz0HZmKVZa5UEl1DUg2bn", - "code": "AmountDiscount", - "campaign": null, - "campaign_id": null, - "category": "First", - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" - } - ], - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 400, - "amount_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", - "effect": "APPLY_TO_ORDER" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2022-09-01T00:00:00.000Z", - "expiration_date": "2022-10-31T00:00:00.000Z", - "validity_timeframe": null, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": true, - "additional_info": "This voucher discount is based on a formula, payment must be using VISA, and order must be over $100.", - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX18tV6jdzxWPwEzjeiX4DoM06JpwaoKUNGMNx4Td5e8FwA68uIHQwPaRpJr9CUCpiP4IsSD8nEJn1YtEv6FnY83wIv7uljYoQOYmMPyhKec8Ct3zH7KurMGuj4Fhws3HNA3bqP5MYEy+aA==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX18tV6jdzxWPwEzjeiX4DoM06JpwaoKUNGMNx4Td5e8FwA68uIHQwPaRpJr9CUCpiP4IsSD8nEJn1YtEv6FnY83wIv7uljYoQOYmMPyhKec8Ct3zH7KurMGuj4Fhws3HNA3bqP5MYEy%2BaA%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX181+WljOgxIt9Jg1Urbuv226+8Ug0DIyZiI0WtThPNYKZZEodzqQpIsGSdrDGXr2chLo+4FH3Ey8G2YXCPM6nUhZRSMF5oL3+uNjcLtBvb7MF5+ynY5fIgpXolwUK0R/BuT4Pa8prhgTg==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX181%2BWljOgxIt9Jg1Urbuv226%2B8Ug0DIyZiI0WtThPNYKZZEodzqQpIsGSdrDGXr2chLo%2B4FH3Ey8G2YXCPM6nUhZRSMF5oL3%2BuNjcLtBvb7MF5%2BynY5fIgpXolwUK0R%2FBuT4Pa8prhgTg%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-12T07:51:02.145Z", - "updated_at": "2022-09-19T08:29:12.566Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "redemption": { - "quantity": null, - "redeemed_quantity": 2, - "object": "list", - "url": "/v1/vouchers/AmountDiscount/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AmountDiscount/publications?page=1&limit=10" - }, - "object": "voucher" - } - ], - "total": 2 - } - } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a balance object if the operation succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_res_vouchers_code_balance" + }, + "examples": { + "Example": { + "value": { + "amount": 10000, + "total": 20100, + "balance": 20100, + "type": "gift_voucher", + "object": "balance", + "related_object": { + "type": "voucher", + "id": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" } } } @@ -45043,6319 +47658,5452 @@ } } }, - "/v1/vouchers/{code}": { - "parameters": [ - { + "404": { + "description": "Returns an error if the voucher code does not exist or has been deleted.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "7fjWdr" + "$ref": "#/components/schemas/e_404_not_found" }, - "in": "path", - "name": "code", - "description": "A unique **code** that identifies the voucher.", - "required": true - } - ], - "get": { - "operationId": "get-voucher", - "tags": [ - "VOUCHERS API" - ], - "summary": "Get Voucher", - "description": "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`.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id IrKORhS", + "request_id": "v-0a96cd820301c0483a", + "resource_id": "IrKORhS", + "resource_type": "voucher" + } + } } - ], - "responses": { - "200": { - "description": "Returns a voucher object if a valid identifier was provided. \n\nAdditionally, the response returns validation rules related to the voucher object. They can be inherited from a campaign.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_obj_voucher_object" - }, - "examples": { - "Loyalty Card": { - "value": { - "id": "v_hrMBBeT4sOP9VSGPmj5KAgJwX202UjiY", - "code": "LOYALTY-CARD-xLPbpbXR", - "campaign": "Loyalty Program Fall 2022", - "campaign_id": "camp_f7fBbQxUuTN7dI7tGOo5XMDA", - "category": "First", - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" - } - ], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 110, - "balance": 100, - "next_expiration_date": "2023-12-31", - "next_expiration_points": 100 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8/6I6hUEqtz/F6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD/DjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19OrTPNyUztbNretF7tPRL4ZlUDPAUXVGL9e5UCPh6dic8zXEP8%2F6I6hUEqtz%2FF6IMIghWz1ljdjzpdizGHG3HZBw4c19fd8SD%2FDjhBRDSr8APqKGpZTLKe4QC2gislFTeDAq2lmJb6T1oOTBUGkUEwMgEX1Vlco9A%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/SpYuOrU9wd6/o1wzy6E/04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ/FJtiw69djuzQk1f4HdQo8s5gaZ7fd2U+1zbaeAvi9usyvRHZE4=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FSpYuOrU9wd6%2Fo1wzy6E%2F04wURHJ1xuMutzkIUx6OBTmHX5BO8XZRmEFHkgjC5eWJ27ArgAruJfwRXWuQfTNFD4raI9YvIiQNEzsZ0ydxwKBqJ%2FFJtiw69djuzQk1f4HdQo8s5gaZ7fd2U%2B1zbaeAvi9usyvRHZE4%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-19T07:56:22.355Z", - "updated_at": "2022-09-19T08:04:22.458Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 1, - "redeemed_points": 10, - "object": "list", - "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/LOYALTY-CARD-xLPbpbXR/publications?page=1&limit=10" - }, - "object": "voucher" - } - }, - "Gift Card": { - "value": { - "id": "v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk", - "code": "GIFT-CARD-xwc6X7Tk", - "campaign": "Gift Cards", - "campaign_id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", - "category": null, - "category_id": null, - "type": "GIFT_VOUCHER", - "discount": null, - "gift": { - "amount": 55000, - "balance": 44700, - "effect": "APPLY_TO_ORDER" - }, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM/aTyHCYfr7kRWb2vv08WIgY/Tv53SJGW+k2keqfsTq/Ohb5shkCN3FTFsaI8gulTp616sEGn/JJoIInIoNkO9Vd1+AfrKiAjmirCmekE6cz2SVCyNAXs=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM%2FaTyHCYfr7kRWb2vv08WIgY%2FTv53SJGW%2Bk2keqfsTq%2FOhb5shkCN3FTFsaI8gulTp616sEGn%2FJJoIInIoNkO9Vd1%2BAfrKiAjmirCmekE6cz2SVCyNAXs%3D" - }, - "barcode": { - "id": "U2FsdGVkX18vWc/qplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO/199U+zicnFNWqg/jF5ZCQW+6jO1q8=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18vWc%2FqplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO%2F199U%2BzicnFNWqg%2FjF5ZCQW%2B6jO1q8%3D" + } + } + } + } + } + }, + "/v1/vouchers/{code}/transactions": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "GIFT-CARD-1" + }, + "name": "code", + "in": "path", + "required": true, + "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. `v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u`." + } + ], + "get": { + "operationId": "list-gift-card-transactions", + "tags": [ + "VOUCHERS API" + ], + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "summary": "List Gift Card Transactions", + "description": "List transactions that are associated with credit movements on a gift card.", + "responses": { + "200": { + "description": "Returns a dictionary of transaction objects", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_res_vouchers_code_transactions" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "vtx_0c9dccc4d5813e71bd", + "source_id": "20230317_subtract_1", + "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", + "source": "API", + "reason": "Subtracting credits from card", + "type": "CREDITS_REMOVAL", + "details": { + "balance": { + "type": "gift_voucher", + "total": 128020, + "amount": -2000, + "object": "balance", + "balance": 121020, + "related_object": { + "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "type": "voucher" } - }, - "is_referral_code": false, - "created_at": "2022-07-08T09:44:33.179Z", - "updated_at": "2022-08-29T09:37:20.185Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 7, - "redeemed_amount": 10300, - "object": "list", - "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/publications?page=1&limit=10" - }, - "object": "voucher" - } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-17T15:50:00.786Z" }, - "Amount Discount": { - "value": { - "id": "v_OBVfpTVf24DBz0HZmKVZa5UEl1DUg2bn", - "code": "AMOUNTDISCOUNTUSINGFORMULA", - "campaign": null, - "campaign_id": null, - "category": "First", - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" - } - ], - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 400, - "amount_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", - "effect": "APPLY_TO_ORDER" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2022-09-01T00:00:00.000Z", - "expiration_date": "2022-10-31T00:00:00.000Z", - "validity_timeframe": null, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": true, - "additional_info": "This voucher discount is based on a formula, payment must be using VISA, and order must be over $100.", - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX18tV6jdzxWPwEzjeiX4DoM06JpwaoKUNGMNx4Td5e8FwA68uIHQwPaRpJr9CUCpiP4IsSD8nEJn1YtEv6FnY83wIv7uljYoQOYmMPyhKec8Ct3zH7KurMGuj4Fhws3HNA3bqP5MYEy+aA==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX18tV6jdzxWPwEzjeiX4DoM06JpwaoKUNGMNx4Td5e8FwA68uIHQwPaRpJr9CUCpiP4IsSD8nEJn1YtEv6FnY83wIv7uljYoQOYmMPyhKec8Ct3zH7KurMGuj4Fhws3HNA3bqP5MYEy%2BaA%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX181+WljOgxIt9Jg1Urbuv226+8Ug0DIyZiI0WtThPNYKZZEodzqQpIsGSdrDGXr2chLo+4FH3Ey8G2YXCPM6nUhZRSMF5oL3+uNjcLtBvb7MF5+ynY5fIgpXolwUK0R/BuT4Pa8prhgTg==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX181%2BWljOgxIt9Jg1Urbuv226%2B8Ug0DIyZiI0WtThPNYKZZEodzqQpIsGSdrDGXr2chLo%2B4FH3Ey8G2YXCPM6nUhZRSMF5oL3%2BuNjcLtBvb7MF5%2BynY5fIgpXolwUK0R%2FBuT4Pa8prhgTg%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-12T07:51:02.145Z", - "updated_at": "2022-09-19T08:29:12.566Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_tO5AuzXIkkNPTC50", - "rule_id": "val_5h0wc453_2", - "related_object_id": "v_OBVfpTVf24DBz0HZmKVZa5UEl1DUg2bn", - "related_object_type": "voucher", - "created_at": "2022-09-19T08:27:59.160Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 2, - "object": "list", - "url": "/v1/vouchers/AMOUNTDISCOUNTUSINGFORMULA/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AMOUNTDISCOUNTUSINGFORMULA/publications?page=1&limit=10" - }, - "object": "voucher" - } + { + "id": "vtx_0c9dcc920ac0e9ef82", + "source_id": "20230317_add_1", + "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", + "source": "API", + "reason": "Adding more points to card", + "type": "CREDITS_ADDITION", + "details": { + "balance": { + "type": "gift_voucher", + "total": 130020, + "amount": 20, + "object": "balance", + "balance": 123020, + "related_object": { + "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "type": "voucher" + } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-17T15:49:08.768Z" }, - "Percent Discount": { - "value": { - "id": "v_2LcXRN4X0TNNgPoBceXIsE4LYs13kta1", - "code": "PercentDiscountUsingFormula", - "campaign": null, - "campaign_id": null, - "category": null, - "category_id": null, - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "percent_off": 3, - "percent_off_formula": "CUSTOMER_METADATA(\"age\")", - "effect": "APPLY_TO_ITEMS" - }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1+74dNbbuHNdVR+5SXVrdo6Zp2tUInlseZtheoYEvrayBBDEoJFaeDuC1BzQr+j8ayuFU7+BtCdNe25YRae4Mp+3Y1HsrkVudshKRzMBdS/43GT9Qi6tOXQDsYjHh70zNz13lMOC9bnaX6WZCVU0vRWM/VDXbYNxGZH6V1wpcGOkmkhkEYPSuIXBDF65FsgHOAwIPvKBxa/aQ==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B74dNbbuHNdVR%2B5SXVrdo6Zp2tUInlseZtheoYEvrayBBDEoJFaeDuC1BzQr%2Bj8ayuFU7%2BBtCdNe25YRae4Mp%2B3Y1HsrkVudshKRzMBdS%2F43GT9Qi6tOXQDsYjHh70zNz13lMOC9bnaX6WZCVU0vRWM%2FVDXbYNxGZH6V1wpcGOkmkhkEYPSuIXBDF65FsgHOAwIPvKBxa%2FaQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX19t8/dJWDNnnwPtxt3e0kZTDAELYiQcSHWIEO5wr6uLeDbM2KKbGYUfkKKtZRsWtiKhOQQc7zmNoCqR82UB+p0gzGM0tyXa/npbPUTe0Y5Y/arDPnomb9AaUFjK9Uq5OUBYbxi1ERqEhy/20Owr0m0e0E2I3jQmgAxkNokRm1g31zX4zheea8gTtiFwb6ZrYvGbaOhj5IxYWg==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19t8%2FdJWDNnnwPtxt3e0kZTDAELYiQcSHWIEO5wr6uLeDbM2KKbGYUfkKKtZRsWtiKhOQQc7zmNoCqR82UB%2Bp0gzGM0tyXa%2FnpbPUTe0Y5Y%2FarDPnomb9AaUFjK9Uq5OUBYbxi1ERqEhy%2F20Owr0m0e0E2I3jQmgAxkNokRm1g31zX4zheea8gTtiFwb6ZrYvGbaOhj5IxYWg%3D%3D" + { + "id": "vtx_0c94f018d30bef6689", + "source_id": "HRwc0oHz_reward", + "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", + "source": "voucherify-web-ui", + "reason": "cash reward", + "type": "CREDITS_ADDITION", + "details": { + "balance": { + "type": "gift_voucher", + "total": 130000, + "amount": 2000, + "object": "balance", + "balance": 123000, + "related_object": { + "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "type": "voucher" } - }, - "is_referral_code": false, - "created_at": "2022-09-15T10:20:46.467Z", - "updated_at": "2022-09-15T10:43:51.116Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_EuYasM5fyDR9G2r4", - "rule_id": "val_0k19OQHjNZRT", - "related_object_id": "v_2LcXRN4X0TNNgPoBceXIsE4LYs13kta1", - "related_object_type": "voucher", - "created_at": "2022-09-15T10:20:46.460Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 3, - "object": "list", - "url": "/v1/vouchers/PercentDiscountUsingFormula/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/PercentDiscountUsingFormula/publications?page=1&limit=10" - }, - "object": "voucher" - } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-10T18:38:02.055Z" }, - "Fixed Discount": { - "value": { - "id": "v_zXQtyi5FYQYoRXv459hmK8M5Gi2lLoDl", - "code": "FixedDiscountUsingFormula", - "campaign": null, - "campaign_id": null, - "category": null, - "category_id": null, - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "FIXED", - "effect": "APPLY_TO_ORDER", - "fixed_amount": 200, - "fixed_amount_formula": "IF(ORDER_UNITS_QUANTITY > 3;CUSTOMER_METADATA(\"age\") + 2;CUSTOMER_METADATA(\"age\") - 2)" - }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1+sY8iWRFMrrPOjY6pS7JZSqJUPIzAgFO5oy5GvTj27KrukNxucE4wrA4n9QL7pua3CfJzGWe0Hc5J6XXU2m5ktik4iUNRO6pxZmL4ZuR96C1XHJAGaIiI7lM17OjJD2b72/hyyDUi8DflzcYixFdXTOR3o1rcaPoY=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BsY8iWRFMrrPOjY6pS7JZSqJUPIzAgFO5oy5GvTj27KrukNxucE4wrA4n9QL7pua3CfJzGWe0Hc5J6XXU2m5ktik4iUNRO6pxZmL4ZuR96C1XHJAGaIiI7lM17OjJD2b72%2FhyyDUi8DflzcYixFdXTOR3o1rcaPoY%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+af+iouhzUVUL0IocB7BAWR8rB0z8/9/OgYi32EHQ9salEEtE3XYPWtseOAxi5keMRp6K3JLDyx4RvYpw3Fe5SN0ed7PEcWr4fLUoUBntHtH0lOPFOtWxpY3tAjnyWpE/CYTR/S135KZ6GIfCS/+VQNrzbS/bFXgY=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2Baf%2BiouhzUVUL0IocB7BAWR8rB0z8%2F9%2FOgYi32EHQ9salEEtE3XYPWtseOAxi5keMRp6K3JLDyx4RvYpw3Fe5SN0ed7PEcWr4fLUoUBntHtH0lOPFOtWxpY3tAjnyWpE%2FCYTR%2FS135KZ6GIfCS%2F%2BVQNrzbS%2FbFXgY%3D" + { + "id": "vtx_0c94edbbaccbef5db6", + "source_id": null, + "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", + "source": null, + "reason": null, + "type": "CREDITS_REFUND", + "details": { + "balance": { + "type": "gift_voucher", + "total": 128000, + "amount": 44, + "object": "balance", + "balance": 121000, + "related_object": { + "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "type": "voucher" } }, - "is_referral_code": false, - "created_at": "2022-09-15T12:46:55.818Z", - "updated_at": "2022-09-16T10:03:25.057Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 + "order": { + "id": "ord_jj5EzDxDOd2xFPsAJJ18IaZK", + "source_id": null }, "redemption": { - "quantity": null, - "redeemed_quantity": 5, - "object": "list", - "url": "/v1/vouchers/FixedDiscountUsingFormula/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/FixedDiscountUsingFormula/publications?page=1&limit=10" + "id": "r_0c94ed583fcafc31c1" }, - "object": "voucher" - } + "rollback": { + "id": "rr_0c94edbb8d0bef5d9e" + } + }, + "related_transaction_id": null, + "created_at": "2023-03-10T18:27:42.389Z" }, - "Unit Discount": { - "value": { - "id": "v_JkjV4v9OKTsaIuHoqXGrkGijNaRGYNzm", - "code": "UnitDiscountUsingFormula", - "campaign": null, - "campaign_id": null, - "category": null, - "category_id": null, - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "UNIT", - "unit_off": 1, - "unit_off_formula": "IF(ORDER_UNITS_QUANTITY > 3;CUSTOMER_METADATA(\"age\") / 5;CUSTOMER_METADATA(\"age\") / 10)", - "unit_type": "sku_0b661e41eccd35a8e9", - "effect": "ADD_MISSING_ITEMS" - }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1+6okuUQBKDcu0jGGg0jOU3kwYUFhX79TdwYKjXyV14BX74z/lehzciL0vdtutoiMVf8Nzl+B278gSHI5TiecPsTXChbGKSjH9gYUxZkdQev0qfmR4frKHjKKHHfT9DEcRWCLwKDJ9V+b89EAmbMouLlaDvkD63bZI=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B6okuUQBKDcu0jGGg0jOU3kwYUFhX79TdwYKjXyV14BX74z%2FlehzciL0vdtutoiMVf8Nzl%2BB278gSHI5TiecPsTXChbGKSjH9gYUxZkdQev0qfmR4frKHjKKHHfT9DEcRWCLwKDJ9V%2Bb89EAmbMouLlaDvkD63bZI%3D" - }, - "barcode": { - "id": "U2FsdGVkX19E7POETWB9YO+S4gkbGFQSm4VDNXEvqdlln6cWiyWTplnWkiUbs/2XMIva3q2rHDFP4toeKrLOGeS5mqhJcdd3yVsWXjHaALwCJIis2D4l5soDvz+Ka/vTqJdFWQzqsIl0BqEpr1tLLy8JFMGN7MY5nY3nr/ciSN8=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19E7POETWB9YO%2BS4gkbGFQSm4VDNXEvqdlln6cWiyWTplnWkiUbs%2F2XMIva3q2rHDFP4toeKrLOGeS5mqhJcdd3yVsWXjHaALwCJIis2D4l5soDvz%2BKa%2FvTqJdFWQzqsIl0BqEpr1tLLy8JFMGN7MY5nY3nr%2FciSN8%3D" + { + "id": "vtx_0c94ed584f4afc31da", + "source_id": null, + "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", + "source": null, + "reason": null, + "type": "CREDITS_REDEMPTION", + "details": { + "balance": { + "type": "gift_voucher", + "total": 128000, + "amount": -44, + "object": "balance", + "balance": 120956, + "related_object": { + "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "type": "voucher" } }, - "is_referral_code": false, - "created_at": "2022-09-15T13:36:27.838Z", - "updated_at": "2022-09-16T10:03:25.057Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 + "order": { + "id": "ord_jj5EzDxDOd2xFPsAJJ18IaZK", + "source_id": null }, "redemption": { - "quantity": null, - "redeemed_quantity": 5, - "object": "list", - "url": "/v1/vouchers/UnitDiscountUsingFormula/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/UnitDiscountUsingFormula/publications?page=1&limit=10" - }, - "object": "voucher" - } + "id": "r_0c94ed583fcafc31c1" + } + }, + "related_transaction_id": null, + "created_at": "2023-03-10T18:26:00.640Z" }, - "Multiple Unit Discount": { - "value": { - "id": "v_5Xgi5ht4sw432LQ7bwmyjKnUAYtOrJAh", - "code": "UnitDiscountUsingFormulaForMultipleProductVariants", - "campaign": null, - "campaign_id": null, - "category": null, - "category_id": null, - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "UNIT", - "effect": "ADD_MANY_ITEMS", - "units": [ - { - "unit_off": 3, - "unit_off_formula": "IF(ORDER_AMOUNT > 100;CUSTOMER_METADATA(\"age\");CUSTOMER_METADATA(\"age\") / 2)", - "unit_type": "sku_0b661e41fc8d35a8f7", - "effect": "ADD_MISSING_ITEMS" - }, - { - "unit_off": 4, - "unit_off_formula": "IF(ORDER_AMOUNT > 100;CUSTOMER_METADATA(\"age\") + 2;CUSTOMER_METADATA(\"age\") - -2)", - "unit_type": "sku_0b661e41fc8d35a8f6", - "effect": "ADD_NEW_ITEMS" - } - ] - }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1+qkwm+Yu29uhfotQxirJftPuWjA1P9WGxHqqmOHsU9esf6R5Ln7AeiqX8l9iIpy+D3yav5GmF2UrY6PD6fS9Y+yu+7yTVQu+agFZqdN1jvWw4DBOCHKPgynaMiNS29Cv4EIOFCY9Ux+4Lp8aVdalItCVCEH25DxWD+HUKq1lE31Y0DfWssg95oO2m73ZeGa8je7zd09eW7cg==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bqkwm%2BYu29uhfotQxirJftPuWjA1P9WGxHqqmOHsU9esf6R5Ln7AeiqX8l9iIpy%2BD3yav5GmF2UrY6PD6fS9Y%2Byu%2B7yTVQu%2BagFZqdN1jvWw4DBOCHKPgynaMiNS29Cv4EIOFCY9Ux%2B4Lp8aVdalItCVCEH25DxWD%2BHUKq1lE31Y0DfWssg95oO2m73ZeGa8je7zd09eW7cg%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+poCeZMw207p8HWtpoeokpaPfUQQoRIxpGXmqi5ic2ZPhQwKrUnujPDW4Sw1ODgHV6nLWQQQ9g7j3S4793YfzHDi1H8L3kZroH0TwWFNBgzQkV/QLqc387xUUckr0fvmhTBCarpsB+dWPOwlaNuVivTVB+Yyh/1FcbGbjvbj1Sm12wVNom2KZ3m1K/lJ6vBoGkXqq0jutytA==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BpoCeZMw207p8HWtpoeokpaPfUQQoRIxpGXmqi5ic2ZPhQwKrUnujPDW4Sw1ODgHV6nLWQQQ9g7j3S4793YfzHDi1H8L3kZroH0TwWFNBgzQkV%2FQLqc387xUUckr0fvmhTBCarpsB%2BdWPOwlaNuVivTVB%2BYyh%2F1FcbGbjvbj1Sm12wVNom2KZ3m1K%2FlJ6vBoGkXqq0jutytA%3D%3D" + { + "id": "vtx_0c94e9432c4afc2134", + "source_id": "HRwc0oHz_removal", + "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", + "source": "voucherify-web-ui", + "reason": "removal", + "type": "CREDITS_REMOVAL", + "details": { + "balance": { + "type": "gift_voucher", + "total": 128000, + "amount": -2000, + "object": "balance", + "balance": 121000, + "related_object": { + "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "type": "voucher" } - }, - "is_referral_code": false, - "created_at": "2022-09-16T05:44:50.722Z", - "updated_at": "2022-09-19T09:25:17.303Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 3, - "object": "list", - "url": "/v1/vouchers/UnitDiscountUsingFormulaForMultipleProductVariants/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/UnitDiscountUsingFormulaForMultipleProductVariants/publications?page=1&limit=10" - }, - "object": "voucher" - } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-10T18:08:10.413Z" }, - "Free Shipping": { - "value": { - "id": "v_gO13ON60WqVmP1DASWuJRF83Xt5KrVNL", - "code": "FreeShipping", - "campaign": null, - "campaign_id": null, - "category": null, - "category_id": null, - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "UNIT", - "unit_off": 1, - "unit_type": "prod_5h1pp1ng", - "effect": "ADD_MISSING_ITEMS" - }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX19R0AaZSL8eog8GYSGvRcADkJ24Hhr52Awb2KNF11CE7oyTHVBq+S3gexrVR8PxHgEz/jR1Hh2YfM5h0k5CYPD24I/pXJYQVTa1CpXFBrrxVET9QyK48z5hxu2nsHHBsV7g0zK1nIVibsw06db8x1F1zaR7Un9oq6A=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19R0AaZSL8eog8GYSGvRcADkJ24Hhr52Awb2KNF11CE7oyTHVBq%2BS3gexrVR8PxHgEz%2FjR1Hh2YfM5h0k5CYPD24I%2FpXJYQVTa1CpXFBrrxVET9QyK48z5hxu2nsHHBsV7g0zK1nIVibsw06db8x1F1zaR7Un9oq6A%3D" - }, - "barcode": { - "id": "U2FsdGVkX19XHGrCUHCfcSz/VLWmN1UU13QmDsH9ezEYtzHAUAeaLvN12Yv5eBJ7h7R2Og2pNm7mdHxfMR8gBJWEgHuBkodwXch1llhO6hNy9KXebNU+McRx9iEB/DqSzagjaxCiUNB1xitLgXDlUH5cH9naOCOtCHGMrEQW4h0=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19XHGrCUHCfcSz%2FVLWmN1UU13QmDsH9ezEYtzHAUAeaLvN12Yv5eBJ7h7R2Og2pNm7mdHxfMR8gBJWEgHuBkodwXch1llhO6hNy9KXebNU%2BMcRx9iEB%2FDqSzagjaxCiUNB1xitLgXDlUH5cH9naOCOtCHGMrEQW4h0%3D" + { + "id": "vtx_0c94e8100f8afc1c6c", + "source_id": null, + "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", + "source": null, + "reason": null, + "type": "CREDITS_REDEMPTION", + "details": { + "balance": { + "type": "gift_voucher", + "total": 130000, + "amount": -7000, + "object": "balance", + "balance": 123000, + "related_object": { + "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "type": "voucher" } }, - "is_referral_code": false, - "created_at": "2022-09-16T07:19:53.945Z", - "updated_at": "2022-09-16T07:26:35.361Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 + "order": { + "id": "ord_qZX3pEt5rFf5W23qRMDQcVt9", + "source_id": null }, "redemption": { - "quantity": null, - "redeemed_quantity": 2, - "object": "list", - "url": "/v1/vouchers/FreeShipping/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/FreeShipping/publications?page=1&limit=10" - }, - "object": "voucher" - } + "id": "r_0c94e80fda4afc1c59" + } + }, + "related_transaction_id": null, + "created_at": "2023-03-10T18:02:55.935Z" + }, + { + "id": "vtx_0c94e6b82a4bef406c", + "source_id": "walmart", + "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", + "source": "voucherify-web-ui", + "reason": "return", + "type": "CREDITS_ADDITION", + "details": { + "balance": { + "type": "gift_voucher", + "total": 130000, + "amount": 5000, + "object": "balance", + "balance": 130000, + "related_object": { + "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", + "type": "voucher" + } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-10T17:57:03.758Z" } - } + ], + "has_more": false } } + } + } + } + }, + "404": { + "description": "Returns an error if the voucher code does not exist or has been deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" }, - "404": { - "description": "Returns an error when requesting the code of a voucher that has been deleted or does not exist.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id v_OBVfpTVf24DBz0HZmKVZa5UEl1DUg2b", - "request_id": "v-0bb3403b9a158c87b2", - "resource_id": "v_OBVfpTVf24DBz0HZmKVZa5UEl1DUg2b", - "resource_type": "voucher" - } - } - } + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id IrKORhS", + "request_id": "v-0a96cd820301c0483a", + "resource_id": "IrKORhS", + "resource_type": "voucher" } } } } - }, - "put": { - "operationId": "update-voucher", - "tags": [ - "VOUCHERS API" - ], - "summary": "Update Voucher", - "description": "Updates the specified voucher by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged.\n\nFields other than the ones listed in the request body won't be modified. Even if provided, they will be silently skipped.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + } + } + } + } + }, + "/v1/vouchers/{code}/transactions/export": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "GIFT-CARD-1" + }, + "name": "code", + "in": "path", + "required": true, + "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. `v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u`." + } + ], + "post": { + "operationId": "export-gift-card-transactions", + "tags": [ + "VOUCHERS API" + ], + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "summary": "Export Gift Card Transactions", + "description": "Export transactions that are associated with credit movements on a gift card.\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
                  - `CREDITS_ADDITION`
                  - `CREDITS_REFUND`
                  - `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |", + "requestBody": { + "description": "Specify the parameters for the transaction export.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_req_create_gift_card_transactions_export" + }, + "examples": { + "Example": { + "value": { + "parameters": { + "order": "-created_at", + "fields": [ + "id", + "type", + "source_id", + "reason", + "balance", + "amount", + "created_at", + "voucher_id", + "campaign_id", + "details", + "source" + ] + } + } } - ], - "requestBody": { - "required": true, - "description": "Specify the parameters to be updated.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_req_vouchers_code_PUT" - }, - "examples": { - "Percent Discount": { - "value": { - "category": "Second", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "percent_off": 45, - "percent_off_formula": "IF(ORDER_AMOUNT > 100;CUSTOMER_METADATA(\"age\");CUSTOMER_METADATA(\"age\") / 2)", - "amount_limit": 1800, - "effect": "APPLY_TO_ORDER" - }, - "start_date": "2020-02-01T00:00:00Z", - "expiration_date": "2023-12-31T23:59:59Z", - "validity_timeframe": { - "duration": "PT2H", - "interval": "P3D" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "active": false, - "additional_info": "This voucher can be used with other coupons. Please feel free to do so.", - "metadata": { - "Season": "Winter" + } + } + } + }, + "responses": { + "200": { + "description": "Returns an export object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_obj_export_transactions_object" + }, + "examples": { + "Example": { + "value": { + "id": "exp_ARi2UbRjgfrHQJoVcKFrBUgA", + "object": "export", + "created_at": "2023-05-16T08:30:21.496Z", + "status": "SCHEDULED", + "channel": "API", + "exported_object": "voucher_transactions", + "parameters": { + "order": "-created_at", + "fields": [ + "id", + "type", + "source_id", + "reason", + "balance", + "amount", + "created_at", + "voucher_id", + "campaign_id", + "details", + "related_transaction_id", + "source" + ], + "filters": { + "voucher_id": { + "conditions": { + "$in": [ + "HRwc0oHz" + ] + } } } }, - "Gift Card": { - "value": { - "category": "Existing Customers", - "gift": { - "amount": 20000, - "effect": "APPLY_TO_ITEMS" - }, - "start_date": "2021-01-01T00:00:00Z", - "active": false, - "additional_info": "This gift card is disabled.", - "metadata": { - "test": false, - "locale": "de-en-pl" + "result": null, + "user_id": null + } + }, + "No request body": { + "value": { + "id": "exp_ExEE5A6OIK4tssuNswr5O6SU", + "object": "export", + "created_at": "2023-03-21T13:34:57.034Z", + "status": "SCHEDULED", + "channel": "API", + "exported_object": "voucher_transactions", + "parameters": { + "filters": { + "voucher_id": { + "conditions": { + "$in": [ + "HRwc0oHz" + ] + } } } }, - "Loyalty Card": { - "value": { - "category": "Existing Customers", - "loyalty_card": { - "points": 20000 + "result": null, + "user_id": null + } + } + } + } + } + }, + "404": { + "description": "Returns an error if the voucher code does not exist or has been deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id IrKORhS", + "request_id": "v-0a96cd820301c0483a", + "resource_id": "IrKORhS", + "resource_type": "voucher" + } + } + } + } + } + } + } + } + }, + "/v1/vouchers/import": { + "post": { + "operationId": "import-vouchers", + "tags": [ + "VOUCHERS API" + ], + "summary": "Import Vouchers", + "description": "Import standalone vouchers and gift cards into the repository.\n\n\n\n> 📘 Important notes\n>\n> - **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z.\n> - Custom code attributes (not supported by-default) need to be added as code **metadata**.\n> - You **cannot import the same codes** to a single Voucherify Project.\n\nAny parameters not provided in the payload will be left blank or null.\n\nFor both **standalone discount vouchers and gift cards**, you can import the following fields: \n\n- code\n- category\n- active\n- type\n- start_date\n- expiration_date\n- redemption.quantity\n- additional_info\n- metadata\n\nFor **gift cards**, you can also import the following field:\n\n- gift.amount\n\nFor **discount vouchers**, you can import the `discount` object. The object will slightly vary depending on the type of discount. Each discount type **requires** the `type` to be defined in the import.\n\n| **Discount Type** | **Required fields** |\n|:---|:---|\n| Amount | amount_off, effect |\n| Percent | percent_off, effect |\n| Fixed | fixed_amount, effect |\n| Unit - One item | unit_off, unit_type, effect |\n| Unit - Multiple items | unit_off, unit_type, effect |\n| Shipping | unit_off, unit_type, effect |\n\nFields other than the ones listed above won't be imported. Even if provided, they will be silently skipped.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "required": true, + "description": "The request body is an array of objects. Each object contains details about a specific voucher. ", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_req_vouchers_import" + }, + "examples": { + "Example": { + "value": [ + { + "code": "PROMO-CODE30OFF-NO-EFFECT", + "category": "new customer acquisition", + "type": "DISCOUNT_VOUCHER", + "active": true, + "discount": { + "amount_off": 3000, + "type": "AMOUNT" + }, + "start_date": "2020-12-01T23:00:00Z", + "expiration_date": "2023-12-19T23:00:00Z", + "redemption": { + "quantity": 1 + }, + "metadata": { + "unit": "EUR" + }, + "additional_info": "secret-code1" + }, + { + "code": "PROMO-CODE30-PERCENT-NO-EFFECT", + "type": "DISCOUNT_VOUCHER", + "active": false, + "discount": { + "percent_off": 30, + "type": "PERCENT" + }, + "start_date": "2020-12-10T23:00:00Z", + "expiration_date": "2023-12-31T23:00:00Z", + "redemption": { + "quantity": 1 + }, + "metadata": { + "unit": "EUR" + }, + "additional_info": "secret-code2" + }, + { + "code": "GIFT-CARD-100", + "type": "GIFT_VOUCHER", + "active": true, + "category": "new customer acquisition", + "gift": { + "amount": 10000 + }, + "start_date": "2020-12-10T23:00:00Z", + "expiration_date": "2023-12-31T23:00:00Z", + "redemption": { + "quantity": 5 + }, + "metadata": { + "unit": "EUR" + }, + "additional_info": "secret-GIFT-code2" + }, + { + "code": "PROMO-CODE1-PERCENT-EFFECT-ORDER", + "type": "DISCOUNT_VOUCHER", + "active": false, + "discount": { + "percent_off": 30, + "type": "PERCENT", + "effect": "APPLY_TO_ORDER" + }, + "start_date": "2020-12-10T23:00:00Z", + "expiration_date": "2023-12-31T23:00:00Z", + "redemption": { + "quantity": 1 + }, + "metadata": { + "unit": "EUR" + }, + "additional_info": "secret-code2" + }, + { + "code": "PROMO-CODE2-PERCENT-EFFECT-ITEM", + "type": "DISCOUNT_VOUCHER", + "active": false, + "discount": { + "percent_off": 30, + "type": "PERCENT", + "effect": "APPLY_TO_ITEMS" + }, + "start_date": "2020-12-10T23:00:00Z", + "expiration_date": "2023-12-31T23:00:00Z", + "redemption": { + "quantity": 1 + }, + "metadata": { + "unit": "EUR" + }, + "additional_info": "secret-code2" + }, + { + "code": "PROMO-CODE1-PERCENT-NO-EFFECT-REDEEMED-QUANTITY-ATTRIBUTE-DOESNT-GET-PASSED", + "type": "DISCOUNT_VOUCHER", + "active": false, + "discount": { + "percent_off": 30, + "type": "PERCENT" + }, + "start_date": "2020-12-10T23:00:00Z", + "expiration_date": "2023-12-31T23:00:00Z", + "redemption": { + "quantity": 1, + "redeemed_quantity": 1 + }, + "metadata": { + "unit": "EUR" + }, + "additional_info": "secret-code2" + }, + { + "code": "PROMO-CODE1-AMOUNT-EFFECT-ITEMS-PROPORTIONALLY", + "type": "DISCOUNT_VOUCHER", + "active": false, + "discount": { + "amount_off": 30, + "type": "AMOUNT", + "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" + }, + "start_date": "2020-12-10T23:00:00Z", + "expiration_date": "2023-12-31T23:00:00Z", + "redemption": { + "quantity": 1 + }, + "metadata": { + "unit": "EUR" + }, + "additional_info": "secret-code2" + }, + { + "code": "PROMO-CODE1-FIXED-EFFECT-ORDER", + "type": "DISCOUNT_VOUCHER", + "active": false, + "discount": { + "fixed_amount": 30, + "type": "FIXED", + "effect": "APPLY_TO_ORDER" + }, + "start_date": "2020-12-10T23:00:00Z", + "expiration_date": "2023-12-31T23:00:00Z", + "redemption": { + "quantity": 1 + }, + "metadata": { + "unit": "EUR" + }, + "additional_info": "secret-code2" + }, + { + "code": "PROMO-CODE1-UNIT-SINGLE-ITEM-EFFECT-MISSING", + "type": "DISCOUNT_VOUCHER", + "active": false, + "discount": { + "unit_off": 1, + "unit_type": "prod_0a9f9aeddb019a42db", + "type": "UNIT", + "effect": "ADD_MISSING_ITEMS" + }, + "start_date": "2020-12-10T23:00:00Z", + "expiration_date": "2023-12-31T23:00:00Z", + "redemption": { + "quantity": 1 + }, + "metadata": { + "unit": "EUR" + }, + "additional_info": "secret-code2" + }, + { + "code": "PROMO-CODE2-UNIT-MULTIPLE-ITEMS", + "type": "DISCOUNT_VOUCHER", + "active": true, + "discount": { + "type": "UNIT", + "effect": "ADD_MANY_ITEMS", + "units": [ + { + "unit_off": 1, + "unit_type": "prod_0a9f9aeddb019a42db", + "effect": "ADD_MISSING_ITEMS" }, - "active": false, - "additional_info": "This loyalty card is being deactivated and points updated.", - "metadata": { - "test": false, - "locale": "de-en-pl" + { + "unit_off": 1, + "unit_type": "prod_0a9f9aeddb019a42db", + "effect": "ADD_NEW_ITEMS" } - } + ] }, - "Amount Discount": { - "value": { - "category": "Existing Customers", - "discount": { - "amount_off": 2000, - "type": "AMOUNT", - "effect": "APPLY_TO_ITEMS" - }, - "start_date": "2021-01-01T00:00:00Z" - } + "start_date": "2020-12-10T23:00:00Z", + "expiration_date": "2023-12-31T23:00:00Z", + "redemption": { + "quantity": 1 }, - "Fixed Discount": { - "value": { - "category": "Existing Customers", - "discount": { - "type": "FIXED", - "fixed_amount": 2000, - "effect": "APPLY_TO_ITEMS" - }, - "start_date": "2021-01-01T00:00:00Z" - } + "metadata": { + "unit": "EUR" }, - "Unit Discount": { - "value": { - "discount": { - "type": "UNIT", - "effect": "ADD_MANY_ITEMS", - "units": [ - { - "unit_off": 2, - "unit_type": "prod_0a9f9ab4ab019a42d5", - "effect": "ADD_MISSING_ITEMS" - }, - { - "unit_off": 1, - "unit_type": "prod_0a9f9aeddb019a42db", - "effect": "ADD_MISSING_ITEMS" - } - ] - } - } - } + "additional_info": "secret-code2" + }, + { + "code": "PROMO-CODE1-SHIPPING", + "type": "DISCOUNT_VOUCHER", + "active": false, + "discount": { + "type": "UNIT", + "unit_off": 1, + "unit_type": "prod_5h1pp1ng", + "effect": "ADD_MISSING_ITEMS" + }, + "start_date": "2020-12-10T23:00:00Z", + "expiration_date": "2023-12-31T23:00:00Z", + "redemption": { + "quantity": 1 + }, + "metadata": { + "unit": "EUR" + }, + "additional_info": "secret-code2" } - } + ] } - }, - "responses": { - "200": { - "description": "Returns the voucher object if the update succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_obj_voucher_object" - }, - "examples": { - "Percent Discount": { - "value": { - "id": "v_9PbXndxO3S8xfztwMtIvuMXReonF248m", - "code": "percent1", - "campaign": null, - "campaign_id": null, - "category": "Second", - "category_id": "cat_0bb81a481615a37b5e", - "categories": [ - { - "id": "cat_0bb81a481615a37b5e", - "name": "Second", - "hierarchy": 2, - "created_at": "2022-09-20T05:58:01.561Z", - "object": "category" - } - ], - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "amount_limit": 1800, - "percent_off": 45, - "percent_off_formula": "IF(ORDER_AMOUNT > 100;CUSTOMER_METADATA(\"age\");CUSTOMER_METADATA(\"age\") / 2)", - "effect": "APPLY_TO_ORDER" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2020-02-01T00:00:00.000Z", - "expiration_date": "2023-12-31T23:59:59.000Z", - "validity_timeframe": { - "interval": "P3D", - "duration": "PT2H" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "active": false, - "additional_info": "This voucher can be used with other coupons. Please feel free to do so.", - "metadata": { - "Season": "Winter" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX19MPtNCPjoG/pKloolK+BZH/OCIpjYqj+B6IVJJmTYKeBINcB0JioL/tSw3iuK4FvgF8VyDyTfL26IpzbT81DDOnKeFIDUJraQDJiKxWcrG/RCFsVky4olBJ+GZFb9pLpN5gC/rn0pqYw==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19MPtNCPjoG%2FpKloolK%2BBZH%2FOCIpjYqj%2BB6IVJJmTYKeBINcB0JioL%2FtSw3iuK4FvgF8VyDyTfL26IpzbT81DDOnKeFIDUJraQDJiKxWcrG%2FRCFsVky4olBJ%2BGZFb9pLpN5gC%2Frn0pqYw%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/J73XXWgMf2BsVM21kpnFLQak5dpGzThYNTYPT62U6q+5RDlh/CXylkTrhegRnWJw1HA7iehT8iUoV4M4cV0KBdp5WgJ3lXeFZcpX3Mpu0T02PRcYbdCIiSO1kO50Y8Hg/heHcshw22Q==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FJ73XXWgMf2BsVM21kpnFLQak5dpGzThYNTYPT62U6q%2B5RDlh%2FCXylkTrhegRnWJw1HA7iehT8iUoV4M4cV0KBdp5WgJ3lXeFZcpX3Mpu0T02PRcYbdCIiSO1kO50Y8Hg%2FheHcshw22Q%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-19T14:41:30.976Z", - "updated_at": "2022-09-20T06:00:50.202Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": 101, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/percent1/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/percent1/publications?page=1&limit=10" - }, - "object": "voucher" - } - }, - "Gift Card": { - "value": { - "id": "v_7xaObxyK5LG62Rp0Xqpez7lqiBFL62pL", - "code": "welcomegiftcard", - "campaign": null, - "campaign_id": null, - "category": "Existing Customers", - "type": "GIFT_VOUCHER", - "discount": null, - "gift": { - "amount": 20000, - "balance": 20000, - "effect": "APPLY_TO_ITEMS" - }, - "loyalty_card": null, - "start_date": "2021-01-01T00:00:00.000Z", - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": false, - "additional_info": "This gift card is disabled.", - "metadata": { - "test": false, - "locale": "de-en-pl" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+mTbI2MdzBdMJ7AsOPKvGGgRB7O4oHZv5qq8I3M/OBPJm4PV8bTtBgR+oXOU4Jv1ucbIV7yg1mzC86LVFKjO7Ptnj+63mS9QdHvvILEAulBuZZQ+hZ0HmFXjDl4Quz/kUqGwffKGTziQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BmTbI2MdzBdMJ7AsOPKvGGgRB7O4oHZv5qq8I3M%2FOBPJm4PV8bTtBgR%2BoXOU4Jv1ucbIV7yg1mzC86LVFKjO7Ptnj%2B63mS9QdHvvILEAulBuZZQ%2BhZ0HmFXjDl4Quz%2FkUqGwffKGTziQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX184KgQ11OfpqB4WkJuH9ushSwZb0YrcN+8OaGPHxBQMiBr2axwnvQlZYv6YhqWtnc5iHByHrkg+6qYHxOLBPRMWCysIhcuUEB57IDhgYUHRPyM2bWjQadVHngGfVGCQ0CUy4PO/71RdMw==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX184KgQ11OfpqB4WkJuH9ushSwZb0YrcN%2B8OaGPHxBQMiBr2axwnvQlZYv6YhqWtnc5iHByHrkg%2B6qYHxOLBPRMWCysIhcuUEB57IDhgYUHRPyM2bWjQadVHngGfVGCQ0CUy4PO%2F71RdMw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-02-17T09:09:49.665Z", - "updated_at": "2022-02-17T11:11:48.071Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "redeemed_amount": 0, - "object": "list", - "url": "/v1/vouchers/welcomegiftcard/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/welcomegiftcard/publications?page=1&limit=10" - }, - "object": "voucher" - } - }, - "Loyalty Card": { - "value": { - "id": "v_l84t3fy3keMUiOeaHbN1cbTdW8O5eUlm", - "code": "welcomeloyalty", - "campaign": "Loyalty Campaign", - "campaign_id": "camp_E87CubZLZ8eoQt3c4kAEZsx0", - "category": "Existing Customers", - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 20000, - "balance": 20000 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": false, - "additional_info": "This loyalty card is being deactivated and points updated.", - "metadata": { - "test": false, - "locale": "de-en-pl" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX186PCWooyrNsjfI+nb+Y9ziUZ1k7xe+nJQ53Ms1ynNJOX6JXC6SwxS1WDhYwAKX5FxaDoKyuPf5MkQrkeB6u5bSx333ldAyLypNnqwBD2N17S64WFnTqV7eXUk3hS30wDYcz0cQAJFDcQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186PCWooyrNsjfI%2Bnb%2BY9ziUZ1k7xe%2BnJQ53Ms1ynNJOX6JXC6SwxS1WDhYwAKX5FxaDoKyuPf5MkQrkeB6u5bSx333ldAyLypNnqwBD2N17S64WFnTqV7eXUk3hS30wDYcz0cQAJFDcQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/FWUg0RbOU7R7Zqg7/8Ba6oYuXrmIl7EdXGgaPMPfpePNGRzxBu4LP2dNEUO9h1Sh37MR1PxOoaemPwlgTDo/1G8dX1JjSppNoaTHhkzk2w4yutNhP7o8cq3ZBbT3TNMTKb2H3fUMc7A==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FFWUg0RbOU7R7Zqg7%2F8Ba6oYuXrmIl7EdXGgaPMPfpePNGRzxBu4LP2dNEUO9h1Sh37MR1PxOoaemPwlgTDo%2F1G8dX1JjSppNoaTHhkzk2w4yutNhP7o8cq3ZBbT3TNMTKb2H3fUMc7A%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-02-17T09:12:01.428Z", - "updated_at": "2022-02-17T11:20:12.447Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "redeemed_points": 0, - "object": "list", - "url": "/v1/vouchers/welcomeloyalty/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/welcomeloyalty/publications?page=1&limit=10" - }, - "object": "voucher" - } - }, - "Amount Discount": { - "value": { - "id": "v_jMIjKfG2oJ7vCwIPhsLsbXYGTdPLlbJd", - "code": "WelcomeDiscountAmount", - "campaign": null, - "campaign_id": null, - "category": "Existing Customers", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 2000, - "effect": "APPLY_TO_ITEMS" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2021-01-01T00:00:00.000Z", - "expiration_date": "2022-12-31T23:59:59.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "PT1H" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", - "metadata": { - "test": true, - "locale": "de-en" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+TcEE9sZP6aMfAW3NZv9GWlCnUNn+SiK4FIbMRWWjN5hzTR7Yc/73yfldUb6SMgIvUNL551Nz/nPjrMY2iauia1MSWX21MItsSPfy8qccrC+WAlvpGK/1ZklnxYaeKqxTqwSXl7ppSlgcuEejbFiaqEDajvYUZsF4=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BTcEE9sZP6aMfAW3NZv9GWlCnUNn%2BSiK4FIbMRWWjN5hzTR7Yc%2F73yfldUb6SMgIvUNL551Nz%2FnPjrMY2iauia1MSWX21MItsSPfy8qccrC%2BWAlvpGK%2F1ZklnxYaeKqxTqwSXl7ppSlgcuEejbFiaqEDajvYUZsF4%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/AhpZMq/h+Phi8JZF9m4qL8/U/Z5AST82jaAOnnhdHdbaGjB1+/0VFIdGBA8w2+3JX5qd61Dfk6yfiLCraVw7lYjQddCHF5SKtJs4hqsLHZevQTCzpZkeIHC3ThsG/fLZTsaNn8tjewd/W4qn/2Cc5NgTdv7fqui4=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FAhpZMq%2Fh%2BPhi8JZF9m4qL8%2FU%2FZ5AST82jaAOnnhdHdbaGjB1%2B%2F0VFIdGBA8w2%2B3JX5qd61Dfk6yfiLCraVw7lYjQddCHF5SKtJs4hqsLHZevQTCzpZkeIHC3ThsG%2FfLZTsaNn8tjewd%2FW4qn%2F2Cc5NgTdv7fqui4%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-02-17T11:41:05.236Z", - "updated_at": "2022-02-17T11:45:29.269Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_tDN7MJNayjrf1wyn", - "rule_id": "val_4j7DCRm2IS59", - "related_object_id": "v_jMIjKfG2oJ7vCwIPhsLsbXYGTdPLlbJd", - "related_object_type": "voucher", - "created_at": "2022-02-17T11:41:05.210Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - }, - "redemption": { - "quantity": 10, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/WelcomeDiscountAmount/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/WelcomeDiscountAmount/publications?page=1&limit=10" - }, - "object": "voucher" - } - }, - "Fixed Discount": { - "value": { - "id": "v_B1Pe7QPTjXCHm8IcDkJAQs4g6Zc08UlK", - "code": "wou4w1Og", - "campaign": "Fixed", - "campaign_id": "camp_2jVA6EKGSAe6scyc3i1q9ROD", - "category": "Existing Customers", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "FIXED", - "effect": "APPLY_TO_ITEMS", - "fixed_amount": 2000 - }, - "gift": null, - "loyalty_card": null, - "start_date": "2021-01-01T00:00:00.000Z", - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX18zxYPpRIYeGHCoCAp3ZAPEUM0qacHQIIW/82oGOW24bFMA06kahjkZKVA/1mqqJsqh83C29Jhdz82KrRsM2zl9nzplu5hrmn7m0twnf5NQaTTcovEvnBV8Kej9tGhzc/dPwqE+xEKuDg==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX18zxYPpRIYeGHCoCAp3ZAPEUM0qacHQIIW%2F82oGOW24bFMA06kahjkZKVA%2F1mqqJsqh83C29Jhdz82KrRsM2zl9nzplu5hrmn7m0twnf5NQaTTcovEvnBV8Kej9tGhzc%2FdPwqE%2BxEKuDg%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX18tsK1tz0X2IQWbFHCY4wZBDjoysFt1fBlWo/9bm/HNTci1Q3bSFuIzqIQqlU2TkSacFBgOWGuVG08XboZsqNSXXsAgST9tyoxpaOJ22B2EwWspdvuwJqvZh4PpEyh3BBDS7eOWsr3+Sw==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18tsK1tz0X2IQWbFHCY4wZBDjoysFt1fBlWo%2F9bm%2FHNTci1Q3bSFuIzqIQqlU2TkSacFBgOWGuVG08XboZsqNSXXsAgST9tyoxpaOJ22B2EwWspdvuwJqvZh4PpEyh3BBDS7eOWsr3%2BSw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-02-17T11:54:37.766Z", - "updated_at": "2022-02-17T12:04:53.346Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": 1, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/wou4w1Og/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/wou4w1Og/publications?page=1&limit=10" - }, - "object": "voucher" - } - }, - "Unit Discount": { - "value": { - "id": "v_cu8nyozvTDA413H17bH5BLha0cjxt7s8", - "code": "MultipleUnitTypesUnitDiscount", - "campaign": null, - "campaign_id": null, - "category": "New Customers", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "UNIT", - "effect": "ADD_MANY_ITEMS", - "units": [ - { - "unit_off": 2, - "unit_type": "prod_0a9f9ab4ab019a42d5", - "effect": "ADD_MISSING_ITEMS" - }, - { - "unit_off": 1, - "unit_type": "prod_0a9f9aeddb019a42db", - "effect": "ADD_MISSING_ITEMS" - } - ] - }, - "gift": null, - "loyalty_card": null, - "start_date": "2020-01-01T00:00:00.000Z", - "expiration_date": "2022-12-31T23:59:59.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "PT1H" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", - "metadata": { - "test": true, - "locale": "de-en" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+ocJBtZ9NqT97gZ/QTfOz54TAoRoKO3tnCYBtHZWMghEHT0b2aFrPSL1lqMyf6fYy6DH2/DkH5p5Vd8dOozW1LV6wPVatWpa1lZMeMIB0OcARCW3q+3QydoW2KdliLKyksFwumH9C7Fsnj6HTaEbUjSttTZE/be+o=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BocJBtZ9NqT97gZ%2FQTfOz54TAoRoKO3tnCYBtHZWMghEHT0b2aFrPSL1lqMyf6fYy6DH2%2FDkH5p5Vd8dOozW1LV6wPVatWpa1lZMeMIB0OcARCW3q%2B3QydoW2KdliLKyksFwumH9C7Fsnj6HTaEbUjSttTZE%2Fbe%2Bo%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+Sly3IYj3EbZFHGGNxV6Ns4j76O8d0kRQe3WriJz5qY6s4GBIwlsdy13AciaQuiVt232HlOlZ4TzGaSSk3+ZMldwBGaTp/fIN9SGBW/NVUtfDOI2sIDLZCBBrdK7WVvtCQQ+1Y+6qClYg/QurJExCFRkDeKpKjDug=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BSly3IYj3EbZFHGGNxV6Ns4j76O8d0kRQe3WriJz5qY6s4GBIwlsdy13AciaQuiVt232HlOlZ4TzGaSSk3%2BZMldwBGaTp%2FfIN9SGBW%2FNVUtfDOI2sIDLZCBBrdK7WVvtCQQ%2B1Y%2B6qClYg%2FQurJExCFRkDeKpKjDug%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-02-18T06:27:45.619Z", - "updated_at": "2022-02-18T06:31:08.630Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": 5, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/publications?page=1&limit=10" - }, - "object": "voucher" - } - } - } + } + } + } + }, + "responses": { + "202": { + "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and vouchers will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" + }, + "examples": { + "Example": { + "value": { + "async_action_id": "aa_0aac93c6af84485df3" + } + } + } + } + } + } + } + } + }, + "/v1/vouchers/importCSV": { + "post": { + "operationId": "import-vouchers-using-csv", + "tags": [ + "VOUCHERS API" + ], + "summary": "Import Vouchers using CSV", + "description": "Import standalone vouchers into the repository using a CSV file.\n\nThe 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. \n\nYou can find an example CSV file [here](https://support.voucherify.io/article/45-import-codes-and-share-them-digitally#coupons).\n___\n\n```cURL cURL example\ncurl -X POST \\\n https://api.voucherify.io/v1/vouchers/importCSV \\\n -F file=@/path/to/vouchers.csv \\\n -H \"X-App-Id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n -H \"X-App-Token: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n```\n\n\n\n> 📘 Standard voucher fields mapping\n>\n> - Go to the [import vouchers](ref:import-vouchers) endpoint to see all standard CSV fields description (body params section).\n> - 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\n>- **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z. \n> - `YYYY-MM-DD`\n> - `YYYY-MM-DDTHH`\n> - `YYYY-MM-DDTHH:mm`\n> - `YYYY-MM-DDTHH:mm:ss`\n> - `YYYY-MM-DDTHH:mm:ssZ`\n> - `YYYY-MM-DDTHH:mm:ssZ`\n> - `YYYY-MM-DDTHH:mm:ss.SSSZ`\n> - Custom code attributes (not supported by-default) need to be added as code **metadata**.\n> - You **cannot import the same codes** to a single Voucherify Project.\n\n\n\n> 📘 Categories\n>\n> 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](ref:list-vouchers) endpoint.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "The file path is stored in the form `file` header.", + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/a_req_importCSV" + } + } + } + }, + "responses": { + "202": { + "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and vouchers will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the **response** and pass it using the [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" + }, + "examples": { + "Example": { + "value": { + "async_action_id": "aa_0a875d56c805df6601" } } + } + } + } + }, + "400": { + "description": "Invalid payload. You may receive this error if you have incorrectly or have not specified the content type as `multipart/form-data` in the headers.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" }, - "400": { - "description": "Returns an error if, for example, the AMOUNT type discount doesn't have the `type` attribute defined.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Invalid Voucher": { - "value": { - "code": 400, - "key": "invalid_voucher", - "message": "Invalid Voucher", - "details": "It is not possible to change Voucher discount type", - "request_id": "b7f5149d-83e5-46ef-93ad-ef191a87b185" - } - } - } + "examples": { + "Example 1": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Payload should have required property 'file'", + "request_id": "74e4bb71-5b6d-49b9-98eb-239691c9d67a" } } } } + } + } + } + } + }, + "/v1/vouchers/qualification": { + "post": { + "operationId": "examine-vouchers-qualification", + "deprecated": true, + "tags": [ + "VOUCHERS API" + ], + "summary": "Examine Qualification [Deprecated]", + "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for qualification, and we do not recommend using it. The new [Qualifications API](ref:examine-qualification) introduces additional features and improvements while maintaining backward compatibility. 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. \n\nDisplay vouchers qualified to the given customer and context (e.g., order, loyalty reward). Checks up to 50 **standalone vouchers**. \n\n> 👍 Prevailing assumption\n> You data is synced with Voucherify.\n\n ## How does this endpoint work? \n\n A property's value that does not meet a validation rule requirement will disqualify that particular voucher and it will not be listed in the results.\n\nAs a sample use case, you can imagine a requirement of displaying coupons available for the customer below the shopping cart. The customer can choose and apply the proposed voucher.\n\n ## What's excluded? \n\n The verification logic won't run against _coupons from bulk unique code campaigns_. For campaigns with multiple unique codes, you should run a [dedicated function](ref:examine-campaigns-qualification) for searching and identifying qualified campaigns.\n\n ## Customizing the response\n\n> 📘 Query parameters let you sort and filter the returned vouchers\n>\n> Customize your response:\n> - If you only care about verifying a customer, use `audienceRulesOnly` set to `true`. \n>- If you want to limit the number of vouchers to be returned from the entire pool of eligible vouchers, set a `limit`. This will return vouchers sorted by `-created_at`, by default beginning with the most recent vouchers listed at the top.\n> - If you have a preference on the sorting order of the returned vouchers, you can use `order` to customize your response.\n\n ## Sending the request body payload\n\n\n ## Customer\n\nYou have the option of sending customer data via the dedicated `customer` object in the request body or a nested `customer` object within the `order` object.\n ### Available options:\n\n - You can either pass a customer `id` (Voucherify system generated),\n\n - a `source_id` (your own unique internal customer identifier e.g., email, database ID, CRM id), \n\n - a combination of the remaining parameters in the customer object, \n\n - a combination of customer `id` and remaining parameters excluding `source_id`, or\n\n - a combination of `source_id` and remaining parameters excluding `id`\n\n #### Note:\n\n For the latter two options, if you pass the `source_id` or the `id` with the other parameters, the logic will run independently for parameters explicitly passed in the request body versus those not explicitly passed in the request body. For _parameters not explicitly listed in the payload_, the verification will be against the data stored for that customer in the system. On the other hand, for any _parameter values explicitly passed in the payload_, the logic will ignore those stored in the system and will use the new values provided in the qualification request body. \n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). \n\n## Order\n\n ### Available options:\n\n - You can either pass an order `id` (Voucherify system generated),\n\n - a `source_id` (your own unique internal order identifier), \n\n - a combination of the remaining parameters in the order object, \n\n - a combination of order `id` and remaining parameters excluding `source_id`, or\n\n - a combination of `source_id` and remaining parameters excluding `id`\n\n #### Note:\n\n For the latter two options, if you pass the `source_id` or the `id` with the other parameters, the logic will run independently for parameters explicitly passed in the request body versus those not explicitly passed in the request body. For _parameters not explicitly listed in the payload_, the verification will be against the data stored for that order in the system. On the other hand, for any _parameter values explicitly passed in the payload_, the logic will ignore those stored in the system and will use the new values provided in the qualification request body. \n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).\n\n## Guidelines:\n\nTo validate against vouchers with total order `amount` requirements, make sure to include the total order `amount` in the order object or alternatively the `amount` for _every_ order item (the application will then add each amount to get the total and perform the qualification checks). If the total order `amount` is provided along with the individual items' amounts, the total order `amount` will take precedence.\n\n\n| **Case** | **Order-Level Parameter Included** | **Item-Level Parameter Included** | **Precedence** | **Calculation Result** | **Parameter included in payload accounts for checks against requirements in these validation rules** |\n|:---:|:---:|:---:|:---:|---|---|\n| **1** | `amount` | `amount` | Order-level | Uses order-level `amount` | - Total order amount |\n| **2** | | `amount` | Item-level | Sums each item-level `amount` | - Total order amount
                  - subtotal of matched items |\n| **3** | | `price`
                  `quantity` | Item-level | Multiplies each item's (`price` x `quantity`) to get item `amount` and then adds each item's `amount` to get total order `amount` | - Total order amount
                  - Subtotal of matched items
                  - Unit price of any matching order line
                  - Price of each item/Price of any item |\n| **4** | | `amount`
                  `price`
                  `quantity` | Item-level `amount` | Uses item-level `amount` for total order `amount` calculation, ignores (`price` x `quantity`) calculation | - Total order amount (uses item `amount` if provided or `price` x `quantity` for items without `amount` property; `amount` takes precedence in case all 3 properties are provided for an item)
                  - Subtotal of matched items (uses item `amount`, takes precedence if all 3 properties are provided)
                  - Unit price of any matching order line
                  - Price of each item/Price of any item |\n| **5** | `amount` | `amount`
                  `price`
                  `quantity` | Order-level | Uses order-level `amount` for total order `amount` | - Total order amount (uses order-level `amount`).
                  - Subtotal of matched items (see case **4** for details).
                  - Unit price of any matching order line
                  - Price of each item/Price of any item |\n \n\n## Reward\n\n ## Gift Card", + "parameters": [ + { + "$ref": "#/components/parameters/audienceRulesOnly" + }, + { + "schema": { + "type": "integer", + "maximum": 50 }, - "delete": { - "operationId": "delete-voucher", - "tags": [ - "VOUCHERS API" - ], - "summary": "Delete Voucher", - "description": "Deletes a voucher. This operation cannot be undone. Additionally, this operation removes any redemptions on the voucher.", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "force", - "description": "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." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." - }, - "404": { - "description": "Returns an error indicating that the voucher with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Voucher Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id 10OFF", - "request_id": "v-0ae28d3cec96bb1b7e", - "resource_id": "10OFF", - "resource_type": "voucher" + "in": "query", + "name": "limit", + "description": "The number of vouchers to be qualified." + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at", + "code", + "-code" + ] + }, + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash `-` means sorting in a descending order." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "required": true, + "description": "Should contain given customer and context such as an order.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_req_vouchers_qualification" + }, + "examples": { + "Example": { + "value": { + "customer": { + "source_id": "source-id", + "metadata": { + "key": "value" + } + }, + "order": { + "amount": 10000, + "items": [ + { + "product_id": "product-id", + "quantity": "1", + "price": 10000, + "related_object": "product", + "product": { + "metadata": { + "key": "value" + } } } - } + ] + }, + "metadata": { + "key": "value" } } - } - } - }, - "post": { - "operationId": "create-voucher", - "tags": [ - "VOUCHERS API" - ], - "summary": "Create Voucher", - "description": "Create a standalone voucher. You can choose to create a `GIFT_VOUCHER`, a `DISCOUNT_VOUCHER`, or a `LOYALTY_CARD`. The code path parameter can use all letters of the English alphabet, Arabic numerals and special characters. \n\nWhen you create a new voucher, you can specify a type to create it.\nCreating a new voucher will create a new stand alone voucher if no `campaign` name or `campaign_id` is provided. In case of the loyalty card, a campaign name is required.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the details of the voucher that you would like to create.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_req_vouchers_code_POST" + }, + "Qualify product using product_id": { + "value": { + "customer": { + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" + }, + "metadata": {}, + "birthdate": "YYYY-MM-DD" }, - "examples": { - "Percentage Discount": { - "value": { - "category": "New Customers", - "type": "DISCOUNT_VOUCHER", - "discount": { - "percent_off": 10, - "type": "PERCENT", - "effect": "APPLY_TO_ORDER" - }, - "start_date": "2022-01-01T00:00:00Z", - "expiration_date": "2022-12-31T23:59:59Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P2D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", - "redemption": { - "quantity": 10 - }, - "metadata": { - "test": true, - "locale": "de-en" - }, - "validation_rules": [ - "val_4j7DCRm2IS59" - ] + "order": { + "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", + "source_id": "string", + "amount": 10000, + "items": [ + { + "source_id": "product_1234", + "product_id": "prod_0a9f9aeddb019a42db", + "amount": 10000, + "quantity": 1, + "price": 10000, + "metadata": {}, + "related_object": "product", + "product": { + "source_id": "product_1234", + "name": "Phone", + "price": 10000, + "metadata": {} + } } + ], + "customer": { + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" + }, + "metadata": {}, + "birthdate": "YYYY-MM-DD" }, - "Gift Card": { - "value": { - "category": "New Customers", - "type": "GIFT_VOUCHER", - "gift": { - "amount": 10000, - "effect": "APPLY_TO_ORDER" - }, - "start_date": "2022-01-01T00:00:00Z", - "active": true, - "additional_info": "This gift card is enabled immediately upon creation.", - "metadata": { - "test": true, - "locale": "de-en" + "referrer": {}, + "metadata": "string" + }, + "reward": { + "points": 0, + "assignment_id": "string", + "id": "string" + }, + "metadata": {} + } + }, + "Qualify product using source_id": { + "value": { + "customer": { + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" + }, + "metadata": {}, + "birthdate": "YYYY-MM-DD" + }, + "order": { + "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", + "source_id": "string", + "amount": 10000, + "items": [ + { + "source_id": "product_1234", + "product_id": "prod_0a9f9aeddb019a42db", + "amount": 10000, + "quantity": 1, + "price": 10000, + "metadata": {}, + "related_object": "product", + "product": { + "source_id": "product_1234", + "name": "Phone", + "price": 10000, + "metadata": {} } } + ], + "customer": { + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" + }, + "metadata": {}, + "birthdate": "YYYY-MM-DD" }, - "Loyalty Card": { - "value": { - "category": "New Customers", - "campaign": "camp_E87CubZLZ8eoQt3c4kAEZsx0", - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 10000 - }, - "additional_info": "This loyalty card is enabled immediately upon creation.", - "metadata": { - "test": true, - "locale": "de-en" + "referrer": {}, + "metadata": "string" + }, + "reward": { + "points": 0, + "assignment_id": "string", + "id": "string" + }, + "metadata": {} + } + }, + "Qualify SKU using sku_id": { + "value": { + "customer": { + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" + }, + "metadata": {}, + "birthdate": "YYYY-MM-DD" + }, + "order": { + "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", + "source_id": "string", + "amount": 10000, + "items": [ + { + "source_id": "product_1234", + "product_id": "prod_0a9f9aeddb019a42db", + "amount": 10000, + "quantity": 1, + "price": 10000, + "metadata": {}, + "related_object": "product", + "product": { + "source_id": "product_1234", + "name": "Phone", + "price": 10000, + "metadata": {} } } + ], + "customer": { + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" + }, + "metadata": {}, + "birthdate": "YYYY-MM-DD" }, - "Amount Discount with Formula": { - "value": { - "category": "First", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 100, - "amount_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", - "effect": "APPLY_TO_ORDER" - }, - "start_date": "2020-01-01T00:00:00Z", - "expiration_date": "2022-12-31T23:59:59Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P2D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": true, - "additional_info": "This voucher can be used with other coupons.", - "redemption": { - "quantity": 100 - }, - "metadata": { - "Season": "Spring" + "referrer": {}, + "metadata": "string" + }, + "reward": { + "points": 0, + "assignment_id": "string", + "id": "string" + }, + "metadata": {} + } + }, + "Qualify SKU using source_id": { + "value": { + "customer": { + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" + }, + "metadata": {}, + "birthdate": "YYYY-MM-DD" + }, + "order": { + "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", + "source_id": "string", + "amount": 10000, + "items": [ + { + "source_id": "product_1234", + "product_id": "prod_0a9f9aeddb019a42db", + "amount": 10000, + "quantity": 1, + "price": 10000, + "metadata": {}, + "related_object": "product", + "product": { + "source_id": "product_1234", + "name": "Phone", + "price": 10000, + "metadata": {} + } + } + ], + "customer": { + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" + }, + "metadata": {}, + "birthdate": "YYYY-MM-DD" + }, + "referrer": {}, + "metadata": "string" + }, + "reward": { + "points": 0, + "assignment_id": "string", + "id": "string" + }, + "metadata": {} + } + }, + "Qualify redemption metadata": { + "value": { + "customer": { + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" + }, + "metadata": {}, + "birthdate": "YYYY-MM-DD" + }, + "order": { + "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", + "source_id": "string", + "amount": 10000, + "items": [ + { + "source_id": "product_1234", + "product_id": "prod_0a9f9aeddb019a42db", + "amount": 10000, + "quantity": 1, + "price": 10000, + "metadata": {}, + "related_object": "product", + "product": { + "source_id": "product_1234", + "name": "Phone", + "price": 10000, + "metadata": {} } } + ], + "customer": { + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" + }, + "metadata": {}, + "birthdate": "YYYY-MM-DD" }, - "Percent Discount with Formula": { - "value": { - "category": "First", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "percent_off": 40, - "percent_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", - "amount_limit": 1700, - "effect": "APPLY_TO_ORDER" - }, - "start_date": "2020-01-01T00:00:00Z", - "expiration_date": "2022-12-31T23:59:59Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P2D" - }, - "validity_day_of_week": [ - 0, - 1 - ], - "active": true, - "additional_info": "This voucher can be used with other coupons.", - "redemption": { - "quantity": 101 - }, - "metadata": { - "Season": "Fall" + "referrer": {}, + "metadata": "string" + }, + "reward": { + "points": 0, + "assignment_id": "string", + "id": "string" + }, + "metadata": {} + } + }, + "Qualify order line item metadata": { + "value": { + "customer": { + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" + }, + "metadata": {}, + "birthdate": "YYYY-MM-DD" + }, + "order": { + "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", + "source_id": "string", + "amount": 10000, + "items": [ + { + "source_id": "product_1234", + "product_id": "prod_0a9f9aeddb019a42db", + "amount": 10000, + "quantity": 1, + "price": 10000, + "metadata": {}, + "related_object": "product", + "product": { + "source_id": "product_1234", + "name": "Phone", + "price": 10000, + "metadata": {} } } + ], + "customer": { + "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", + "source_id": "firstname.lastname@mycompany.com", + "name": "FirstName LastName", + "email": "firstname.lastname@mycompany.com", + "phone": "string", + "address": { + "city": "New York", + "country": "United States of America", + "postal_code": "10001", + "state": "NY" + }, + "metadata": {}, + "birthdate": "YYYY-MM-DD" + }, + "referrer": {}, + "metadata": "string" + }, + "reward": { + "points": 0, + "assignment_id": "string", + "id": "string" + }, + "metadata": {} + } + } + } + } + } + }, + "responses": { + "200": { + "description": "This operation returns the list of valid and active vouchers based on the qualification of given context (e.g., customer profile, redemptions metadata, order).", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_res_vouchers_qualification" + } + } + } + } + } + } + }, + "/v1/vouchers/bulk/async": { + "post": { + "operationId": "update-vouchers-in-bulk", + "tags": [ + "VOUCHERS API" + ], + "summary": "Update Vouchers in bulk", + "description": "Use this endpoint to update specific metadata parameters for each code, respectively. You can update each code's metadata property separately. \n\n- Update up to **100 records** in one request.\n- Upserts are not supported. \n\n> 🚧 \n> \n> Currently only **metadata** updates are supported.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "required": true, + "description": "List of objects, each containing a code that is being updated and the metadata key/value pairs for that code.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_req_vouchers_bulk_async" + }, + "examples": { + "Example": { + "value": [ + { + "code": "example_code", + "metadata": { + "lang": "en", + "test": false, + "MetadataTest": "Update metadata", + "update_value": 1, + "next_update_date": "2022-11-11T09:00:00.000Z" + } + }, + { + "code": "example_code2", + "metadata": { + "lang": "pl", + "test": false, + "MetadataTest": "Update metadata", + "update_value": 2 } } + ] + } + } + } + } + }, + "responses": { + "202": { + "description": "Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the voucher(s) will be updated in the repository asynchronously. To check the status and result, copy the `async_action_id` from the response and pass it using [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" + }, + "examples": { + "Example": { + "$ref": "#/components/examples/res_async_actions" + } + } + } + } + } + } + } + }, + "/v1/vouchers/metadata/async": { + "post": { + "operationId": "update-vouchers-metadata-in-bulk", + "tags": [ + "VOUCHERS API" + ], + "summary": "Update Vouchers' metadata in bulk", + "description": "Use this endpoint to update the same metadata parameters for a list of codes. \nUpdate up to **100 records** in one request. Upserts are not supported. \n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "required": true, + "description": "Request to update vouchers metadata in bulk. Provide an array of voucher codes in the `codes` parameter along with the `metadata` object. The `metadata` object should contain the key value pairs that you would like to update for all the vouchers included in the `codes` parameter.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_req_vouchers_metadata_async" + }, + "examples": { + "Example": { + "value": { + "codes": [ + "PROMO-CODE810", + "PROMO-CODE726" + ], + "metadata": { + "lang": "en", + "authorized_internally": true + } + } + } + } + } + } + }, + "responses": { + "202": { + "description": "Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the voucher(s) will be updated in the repository asynchronously. To check the status and result, copy the `async_action_id` from the response and pass it using [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" + }, + "examples": { + "Example": { + "$ref": "#/components/examples/res_async_actions" + } + } + } + } + }, + "400": { + "description": "Returns an error indicating the reason for an unsuccessfull operation.", + "content": { + "application/json": { + "schema": { + "oneOf": [ + { + "$ref": "#/components/schemas/e_400_invalid_payload" + }, + { + "$ref": "#/components/schemas/e_400_not_enough_codes" + }, + { + "$ref": "#/components/schemas/e_400_metadata_validation_failed" + } + ], + "discriminator": { + "propertyName": "key" + } + }, + "examples": { + "Not enough codes": { + "value": { + "code": 400, + "key": "not_enough_codes", + "message": "Not enough codes", + "details": "Specify at least 1 code in codes.", + "request_id": "v-0c4b067a8f161e120f" + } } } + } + } + } + } + } + }, + "/v1/vouchers/{code}/sessions/{sessionKey}": { + "parameters": [ + { + "name": "code", + "in": "path", + "schema": { + "type": "string", + "example": "7fjWdr" + }, + "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify.", + "required": true + }, + { + "schema": { + "type": "string", + "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" + }, + "name": "sessionKey", + "in": "path", + "required": true, + "description": "A unique session identifier." + } + ], + "delete": { + "operationId": "release-validation-session", + "tags": [ + "VOUCHERS API" + ], + "summary": "Release Validation Session", + "description": "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](doc:locking-validation-session). \n\n> 📘 Release Session using Dashboard\n>\n> You can also use the Validations Manager in the Dashboard to unlock sessions. [Read more](https://support.voucherify.io/article/16-dashboard-sections#validations).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if the validation session was released successfully." + } + } + } + }, + "/v1/campaign-object": { + "get": { + "operationId": "campaign-object", + "tags": [ + "CAMPAIGNS API" + ], + "summary": "Campaign Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Campaign Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_obj_campaign_object" + } + } + } + } + } + } + }, + "/v1/campaigns": { + "post": { + "operationId": "create-campaign", + "tags": [ + "CAMPAIGNS API", + "PROMOTIONS API" + ], + "summary": "Create Campaign", + "description": "Method to create a batch of vouchers aggregated in one campaign. You can choose a variety of voucher types and define a unique pattern for generating codes. \n\n\n> 📘 Global uniqueness\n>\n> All campaign codes are unique across the whole project. Voucherify will not allow you to generate 2 campaigns with the same coupon code. \n\n> 🚧 Code generation status\n>\n> This is an asynchronous action; you can't read or modify a newly created campaign until the code generation is completed. See the `creation_status` field in the [campaign object](ref:get-campaign) description.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the details of the campaign that you would like to create.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_req_create_campaign" }, - "responses": { - "200": { - "description": "Returns a voucher object if the call succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_obj_voucher_object" + "examples": { + "Discount Campaign": { + "value": { + "name": "Discount Campaign 4", + "campaign_type": "DISCOUNT_COUPONS", + "join_once": true, + "type": "AUTO_UPDATE", + "category_id": "cat_0bb343dee3cdb5ec0c", + "start_date": "2020-08-16T00:00:00Z", + "expiration_date": "2023-12-26T00:00:00Z", + "vouchers_count": 3, + "voucher": { + "type": "DISCOUNT_VOUCHER", + "discount": { + "percent_off": 10, + "type": "PERCENT" }, - "examples": { - "Percentage Discount": { - "value": { - "id": "v_MBOEmHelKwvykVZ8JcT4TE5Kla5IMJyc", - "code": "welcome", - "campaign": null, - "campaign_id": null, - "category": "New Customers", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "percent_off": 10, - "effect": "APPLY_TO_ORDER" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2022-01-01T00:00:00.000Z", - "expiration_date": "2022-12-31T23:59:59.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "PT1H" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", - "metadata": { - "test": true, - "locale": "de-en" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+by33CNzWu6xXjCrLKRr1+H9K3I9wOSa7idiHrMYJe0HlrWiy7INhaJf1BnaKJjLKcUC+4/hCbILtJ9lHXZWhewG5q5rmx29gK0IH2eRauw1qCZKIlXfqeGTG2T5ftPsEl1D4xf8W2MA==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bby33CNzWu6xXjCrLKRr1%2BH9K3I9wOSa7idiHrMYJe0HlrWiy7INhaJf1BnaKJjLKcUC%2B4%2FhCbILtJ9lHXZWhewG5q5rmx29gK0IH2eRauw1qCZKIlXfqeGTG2T5ftPsEl1D4xf8W2MA%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX19wOdFeXYXZ4Xu22L0Ummk03Urz/ZTnXUFeHeehtK4L6RTvNgVeSR+McTZR4DYNLEGydZ+Fo2xEqqM1UWyl8Bx22Pi1CxghADOcy3bAvSca7EEPpvKrCY403UWUDvaO/OEAjvVoiEuaHA==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19wOdFeXYXZ4Xu22L0Ummk03Urz%2FZTnXUFeHeehtK4L6RTvNgVeSR%2BMcTZR4DYNLEGydZ%2BFo2xEqqM1UWyl8Bx22Pi1CxghADOcy3bAvSca7EEPpvKrCY403UWUDvaO%2FOEAjvVoiEuaHA%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-02-17T09:05:34.668Z", - "updated_at": null, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_74F7QZoYbUoljwQO", - "rule_id": "val_4j7DCRm2IS59", - "related_object_id": "v_MBOEmHelKwvykVZ8JcT4TE5Kla5IMJyc", - "related_object_type": "voucher", - "created_at": "2022-02-17T09:05:34.642Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - }, - "redemption": { - "quantity": 10, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/welcome/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/welcome/publications?page=1&limit=10" - }, - "object": "voucher" - } - }, - "Gift Card": { - "value": { - "id": "v_7xaObxyK5LG62Rp0Xqpez7lqiBFL62pL", - "code": "welcomegiftcard", - "campaign": null, - "campaign_id": null, - "category": "New Customers", - "type": "GIFT_VOUCHER", - "discount": null, - "gift": { - "amount": 10000, - "balance": 10000, - "effect": "APPLY_TO_ORDER" - }, - "loyalty_card": null, - "start_date": "2022-01-01T00:00:00.000Z", - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": "This gift card is enabled immediately upon creation.", - "metadata": { - "test": true, - "locale": "de-en" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+mTbI2MdzBdMJ7AsOPKvGGgRB7O4oHZv5qq8I3M/OBPJm4PV8bTtBgR+oXOU4Jv1ucbIV7yg1mzC86LVFKjO7Ptnj+63mS9QdHvvILEAulBuZZQ+hZ0HmFXjDl4Quz/kUqGwffKGTziQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BmTbI2MdzBdMJ7AsOPKvGGgRB7O4oHZv5qq8I3M%2FOBPJm4PV8bTtBgR%2BoXOU4Jv1ucbIV7yg1mzC86LVFKjO7Ptnj%2B63mS9QdHvvILEAulBuZZQ%2BhZ0HmFXjDl4Quz%2FkUqGwffKGTziQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX184KgQ11OfpqB4WkJuH9ushSwZb0YrcN+8OaGPHxBQMiBr2axwnvQlZYv6YhqWtnc5iHByHrkg+6qYHxOLBPRMWCysIhcuUEB57IDhgYUHRPyM2bWjQadVHngGfVGCQ0CUy4PO/71RdMw==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX184KgQ11OfpqB4WkJuH9ushSwZb0YrcN%2B8OaGPHxBQMiBr2axwnvQlZYv6YhqWtnc5iHByHrkg%2B6qYHxOLBPRMWCysIhcuUEB57IDhgYUHRPyM2bWjQadVHngGfVGCQ0CUy4PO%2F71RdMw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-02-17T09:09:49.665Z", - "updated_at": null, - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "redeemed_amount": 0, - "object": "list", - "url": "/v1/vouchers/welcomegiftcard/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/welcomegiftcard/publications?page=1&limit=10" - }, - "object": "voucher" - } - }, - "Loyalty Card": { - "value": { - "id": "v_l84t3fy3keMUiOeaHbN1cbTdW8O5eUlm", - "code": "welcomeloyalty", - "campaign": "Loyalty Campaign", - "campaign_id": "camp_E87CubZLZ8eoQt3c4kAEZsx0", - "category": "New Customers", - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 10000, - "balance": 10000 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": "This loyalty card is enabled immediately upon creation.", - "metadata": { - "test": true, - "locale": "de-en" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX186PCWooyrNsjfI+nb+Y9ziUZ1k7xe+nJQ53Ms1ynNJOX6JXC6SwxS1WDhYwAKX5FxaDoKyuPf5MkQrkeB6u5bSx333ldAyLypNnqwBD2N17S64WFnTqV7eXUk3hS30wDYcz0cQAJFDcQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX186PCWooyrNsjfI%2Bnb%2BY9ziUZ1k7xe%2BnJQ53Ms1ynNJOX6JXC6SwxS1WDhYwAKX5FxaDoKyuPf5MkQrkeB6u5bSx333ldAyLypNnqwBD2N17S64WFnTqV7eXUk3hS30wDYcz0cQAJFDcQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/FWUg0RbOU7R7Zqg7/8Ba6oYuXrmIl7EdXGgaPMPfpePNGRzxBu4LP2dNEUO9h1Sh37MR1PxOoaemPwlgTDo/1G8dX1JjSppNoaTHhkzk2w4yutNhP7o8cq3ZBbT3TNMTKb2H3fUMc7A==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FFWUg0RbOU7R7Zqg7%2F8Ba6oYuXrmIl7EdXGgaPMPfpePNGRzxBu4LP2dNEUO9h1Sh37MR1PxOoaemPwlgTDo%2F1G8dX1JjSppNoaTHhkzk2w4yutNhP7o8cq3ZBbT3TNMTKb2H3fUMc7A%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-02-17T09:12:01.428Z", - "updated_at": null, - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "redeemed_points": 0, - "object": "list", - "url": "/v1/vouchers/welcomeloyalty/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/welcomeloyalty/publications?page=1&limit=10" - }, - "object": "voucher" - } - }, - "Amount Discount with Formula": { - "value": { - "id": "v_pmjVYKEDFzMqwNroHTlFcI1yKLqUcVVS", - "code": "amount1", - "campaign": null, - "campaign_id": null, - "category": "First", - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" - } - ], - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 100, - "amount_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", - "effect": "APPLY_TO_ORDER" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2020-01-01T00:00:00.000Z", - "expiration_date": "2022-12-31T23:59:59.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "PT1H" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": true, - "additional_info": "This voucher can be used with other coupons.", - "metadata": { - "Season": "Spring" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+aMFY2yoGxlWkhulvTPR8RlMZtfOaWXnL6PCnegsV73aCTsue+JlUrQsbh+dmp2gJigaVixgvyC7/zUxQjf8tnVT4R79G4LmUkltHMqHsaf++fsP1G07nDl9/2WHh/QVb6z4KP/DX5Dw==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BaMFY2yoGxlWkhulvTPR8RlMZtfOaWXnL6PCnegsV73aCTsue%2BJlUrQsbh%2Bdmp2gJigaVixgvyC7%2FzUxQjf8tnVT4R79G4LmUkltHMqHsaf%2B%2BfsP1G07nDl9%2F2WHh%2FQVb6z4KP%2FDX5Dw%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+X2OimwSCEmGvGrZXXK+b4OrStQELVsHRup8Su+uISCOBz7xWdbpoLVJlSFepcRxSNUUdjcbpgKH7YNfaclrta8Ig6/GK/4YFlh0cPKCGOG5WWyXWzxxmVgVqRdI7KR8/hdaq2FCQeWA==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BX2OimwSCEmGvGrZXXK%2Bb4OrStQELVsHRup8Su%2BuISCOBz7xWdbpoLVJlSFepcRxSNUUdjcbpgKH7YNfaclrta8Ig6%2FGK%2F4YFlh0cPKCGOG5WWyXWzxxmVgVqRdI7KR8%2Fhdaq2FCQeWA%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-19T14:22:50.552Z", - "updated_at": null, - "redemption": { - "quantity": 100, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/amount1/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/amount1/publications?page=1&limit=10" - }, - "object": "voucher" - } - }, - "Percent Discount with Formula": { - "value": { - "id": "v_9PbXndxO3S8xfztwMtIvuMXReonF248m", - "code": "percent1", - "campaign": null, - "campaign_id": null, - "category": "First", - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" - } - ], - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "amount_limit": 1700, - "percent_off": 40, - "percent_off_formula": "IF(CUSTOMER_METADATA(\"favorite_brands\") contains \"Nike\";20;CUSTOMER_METADATA(\"age\"))", - "effect": "APPLY_TO_ORDER" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2020-01-01T00:00:00.000Z", - "expiration_date": "2022-12-31T23:59:59.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "PT1H" - }, - "validity_day_of_week": [ - 0, - 1 - ], - "active": true, - "additional_info": "This voucher can be used with other coupons.", - "metadata": { - "Season": "Fall" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX19MPtNCPjoG/pKloolK+BZH/OCIpjYqj+B6IVJJmTYKeBINcB0JioL/tSw3iuK4FvgF8VyDyTfL26IpzbT81DDOnKeFIDUJraQDJiKxWcrG/RCFsVky4olBJ+GZFb9pLpN5gC/rn0pqYw==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19MPtNCPjoG%2FpKloolK%2BBZH%2FOCIpjYqj%2BB6IVJJmTYKeBINcB0JioL%2FtSw3iuK4FvgF8VyDyTfL26IpzbT81DDOnKeFIDUJraQDJiKxWcrG%2FRCFsVky4olBJ%2BGZFb9pLpN5gC%2Frn0pqYw%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/J73XXWgMf2BsVM21kpnFLQak5dpGzThYNTYPT62U6q+5RDlh/CXylkTrhegRnWJw1HA7iehT8iUoV4M4cV0KBdp5WgJ3lXeFZcpX3Mpu0T02PRcYbdCIiSO1kO50Y8Hg/heHcshw22Q==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FJ73XXWgMf2BsVM21kpnFLQak5dpGzThYNTYPT62U6q%2B5RDlh%2FCXylkTrhegRnWJw1HA7iehT8iUoV4M4cV0KBdp5WgJ3lXeFZcpX3Mpu0T02PRcYbdCIiSO1kO50Y8Hg%2FheHcshw22Q%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-19T14:41:30.976Z", - "updated_at": null, - "redemption": { - "quantity": 101, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/percent1/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/percent1/publications?page=1&limit=10" - }, - "object": "voucher" - } - } + "redemption": { + "quantity": 10 + }, + "code_config": { + "pattern": "10OFF-#######" } + }, + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "activity_duration_after_publishing": "P24D", + "use_voucher_metadata_schema": false, + "metadata": { + "region": "AMER" } } }, - "409": { - "description": "Returns an error if a voucher code already exists.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" - }, - "examples": { - "Duplicate Code": { - "value": { - "code": 409, - "key": "duplicate_found", - "message": "Duplicated resource found", - "details": "Duplicated voucher exists with id CODE", - "request_id": "v-0ae786a8f786b73dfa", - "resource_id": "CODE", - "resource_type": "voucher" - } - } + "Gift Card Campaign": { + "value": { + "name": "Gift Card Campaign", + "campaign_type": "GIFT_VOUCHERS", + "join_once": true, + "type": "AUTO_UPDATE", + "category_id": "cat_0bb343dee3cdb5ec0c", + "start_date": "2020-08-16T00:00:00Z", + "expiration_date": "2023-12-26T00:00:00Z", + "vouchers_count": 2, + "voucher": { + "type": "GIFT_VOUCHER", + "gift": { + "amount": 1000, + "effect": "APPLY_TO_ORDER" + }, + "redemption": { + "quantity": 10 + }, + "code_config": { + "pattern": "GIFT-CARD-#######" } + }, + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "activity_duration_after_publishing": "P24D", + "use_voucher_metadata_schema": false, + "metadata": { + "region": "APAC" } } - } - } - } - }, - "/v1/vouchers/": { - "post": { - "operationId": "generate-random-code", - "tags": [ - "VOUCHERS API" - ], - "summary": "Generate Random Code", - "description": "Create a standalone voucher. You can choose to create a `GIFT_VOUCHER`, a `DISCOUNT_VOUCHER`, or a `LOYALTY_CARD`. \n\nWhen you create a new voucher, you can specify a type to create it.\nCreating a new voucher will create a new stand alone voucher if no `campaign` name or `campaign_id` is provided. In case of the loyalty card, a campaign name is required.\n\nYou can optionally use the `code` parameter to define a specific code or the `code_config` parameter to design rules for Voucherify API to create a random code. If neither of the two parameters are passed, then a random code is generated by the Voucherify API.\n\nThis method will return an error when trying to create a voucher that already exists.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the details of the voucher that you would like to create.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_req_vouchers__POST" + }, + "Loyalty Program": { + "value": { + "name": "Loyalty Campaign", + "campaign_type": "LOYALTY_PROGRAM", + "auto_join": true, + "join_once": true, + "type": "AUTO_UPDATE", + "category_id": "cat_0bb343dee3cdb5ec0c", + "start_date": "2020-08-16T00:00:00Z", + "expiration_date": "2023-12-26T00:00:00Z", + "vouchers_count": 2, + "voucher": { + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 1000, + "expiration_rules": { + "period_type": "MONTH", + "period_value": 3, + "rounding_type": "END_OF_YEAR" + } + }, + "redemption": { + "quantity": 10 + }, + "code_config": { + "pattern": "LOYALTY-CARD-#######" + } }, - "examples": { - "Percentage Discount": { - "value": { - "category": "New Customers", - "code": "NEW-WELCOME-COUPON", - "type": "DISCOUNT_VOUCHER", - "campaign_id": "camp_Y6dLsYIZloGqP8izufXY6SSJ", - "discount": { - "percent_off": 10, - "type": "PERCENT", - "effect": "APPLY_TO_ORDER" + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "activity_duration_after_publishing": "P24D", + "use_voucher_metadata_schema": false, + "metadata": { + "region": "APAC" + } + } + }, + "Promotion": { + "value": { + "name": "Promotion - API - 4", + "campaign_type": "PROMOTION", + "type": "STATIC", + "category_id": "cat_0bb343dee3cdb5ec0c", + "use_voucher_metadata_schema": false, + "start_date": "2020-08-16T00:00:00Z", + "expiration_date": "2023-12-26T00:00:00Z", + "active": false, + "promotion": { + "tiers": [ + { + "name": "Percent Discount", + "banner": "Get 40% off", + "action": { + "discount": { + "type": "PERCENT", + "percent_off": 40, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": { + "level": "B" }, - "start_date": "2016-01-01T00:00:00Z", - "expiration_date": "2022-12-31T23:59:59Z", + "active": false, + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", "validity_timeframe": { - "duration": "PT1H", - "interval": "P2D" + "interval": "P2D", + "duration": "P1D" }, "validity_day_of_week": [ 1, 2, 3, - 4, - 5 + 4 ], - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", - "redemption": { - "quantity": 10 - }, - "metadata": { - "test": true, - "locale": "de-en" - }, "validation_rules": [ - "val_4j7DCRm2IS59" + "val_q8qUBMOh5qIQ" ] - } - }, - "Gift Card": { - "value": { - "category": "New Customers", - "type": "GIFT_VOUCHER", - "gift": { - "amount": 10000, - "effect": "APPLY_TO_ORDER" - }, - "start_date": "2022-01-01T00:00:00Z", - "active": true, - "additional_info": "This gift card is enabled immediately upon creation.", - "metadata": { - "test": true, - "locale": "de-en" - }, - "code_config": { - "pattern": "GIFT-CARD-##########", - "prefix": "New-", - "postfix": "0", - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" - } - } - }, - "Loyalty Card": { - "value": { - "category": "New Customers", - "campaign": "camp_E87CubZLZ8eoQt3c4kAEZsx0", - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 10000 + }, + { + "name": "Order more than $100", + "banner": "Get $30 off", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 3000, + "effect": "APPLY_TO_ORDER" + } }, - "additional_info": "This loyalty card is enabled immediately upon creation.", "metadata": { - "test": true, - "locale": "de-en" - }, - "code_config": { - "pattern": "LOYALTY-CARD-##", - "prefix": "New-", - "postfix": "1", - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" - } - } - }, - "Unit Discount Multiple Items": { - "value": { - "category": "New Customers", - "code": "MultipleUnitTypesUnitDiscount", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "UNIT", - "effect": "ADD_MANY_ITEMS", - "units": [ - { - "unit_off": 1, - "unit_type": "prod_0a9f9ab4ab019a42d5", - "effect": "ADD_NEW_ITEMS" - }, - { - "unit_off": 1, - "unit_type": "prod_0a9f9aeddb019a42db", - "effect": "ADD_MISSING_ITEMS" - } - ] + "level": "A" }, - "start_date": "2020-01-01T00:00:00Z", - "expiration_date": "2022-12-31T23:59:59Z", + "active": false, + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", "validity_timeframe": { - "duration": "PT1H", - "interval": "P2D" + "interval": "P2D", + "duration": "P1D" }, "validity_day_of_week": [ 1, 2, 3, - 4, - 5 + 4 ], - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", - "redemption": { - "quantity": 5 - }, - "metadata": { - "test": true, - "locale": "de-en" - } + "validation_rules": [ + "val_q8qUBMOh5qIQ" + ] } + ] + }, + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "activity_duration_after_publishing": "P24D", + "metadata": { + "region": "APAC" + } + } + }, + "Referral Program": { + "value": { + "name": "Referral Campaign 2", + "campaign_type": "REFERRAL_PROGRAM", + "join_once": true, + "type": "AUTO_UPDATE", + "category_id": "cat_0bb343dee3cdb5ec0c", + "start_date": "2020-08-16T00:00:00Z", + "expiration_date": "2023-12-26T00:00:00Z", + "vouchers_count": 2, + "referral_program": { + "conversion_event_type": "redemption" + }, + "voucher": { + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "percent_off": 45, + "effect": "APPLY_TO_ORDER", + "amount_limit": 15 }, - "Unit Discount Single Item": { - "value": { - "category": "New Customers", - "code": "AddMissingItemDiscount", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "UNIT", - "unit_off": 1, - "unit_type": "prod_0a9f9ab4ab019a42d5", - "effect": "ADD_MISSING_ITEMS" - }, - "start_date": "2020-01-01T00:00:00Z", - "expiration_date": "2022-12-31T23:59:59Z", - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", - "redemption": { - "quantity": 3 - } - } - } + "redemption": { + "quantity": 10 + }, + "code_config": { + "pattern": "REFERRAL-CODE-#######" + }, + "is_referral_code": true + }, + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "activity_duration_after_publishing": "P24D", + "use_voucher_metadata_schema": false, + "metadata": { + "region": "APAC" } } } - }, - "responses": { - "200": { - "description": "Returns a voucher object if the call succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_obj_voucher_object" - }, - "examples": { - "Percentage Discount": { - "value": { - "id": "v_YJYfeKoR0XAGIvaM7k51wTbDjU4WIpC5", - "code": "NEW-WELCOME-COUPON", - "campaign": "Bug fix", - "campaign_id": "camp_Y6dLsYIZloGqP8izufXY6SSJ", - "category": "New Customers", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "percent_off": 10, - "effect": "APPLY_TO_ORDER" + } + } + } + }, + "responses": { + "200": { + "description": "Returns a campaign object if the call succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_obj_campaign_object" + }, + "examples": { + "Discount Campaign": { + "value": { + "id": "camp_NdBCAQk1AAZcMcv6kt6X164Q", + "name": "Discount Campaign 4", + "campaign_type": "DISCOUNT_COUPONS", + "type": "AUTO_UPDATE", + "voucher": { + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "percent_off": 10 + }, + "redemption": { + "quantity": 10 + }, + "code_config": { + "length": 7, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "10OFF-#######" + }, + "is_referral_code": false, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + } + }, + "auto_join": false, + "join_once": true, + "use_voucher_metadata_schema": false, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "activity_duration_after_publishing": "P24D", + "vouchers_count": 0, + "active": true, + "metadata": { + "region": "AMER" + }, + "created_at": "2022-09-21T09:25:49.617Z", + "category": "First", + "creation_status": "IN_PROGRESS", + "vouchers_generation_status": "IN_PROGRESS", + "protected": false, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" + } + ], + "object": "campaign" + } + }, + "Gift Card Campaign": { + "value": { + "id": "camp_B2Gx83JsSbmvj05MOwxYbNm6", + "name": "Gift Card Campaign", + "campaign_type": "GIFT_VOUCHERS", + "type": "AUTO_UPDATE", + "voucher": { + "type": "GIFT_VOUCHER", + "gift": { + "amount": 1000, + "effect": "APPLY_TO_ORDER" + }, + "redemption": { + "quantity": 10 + }, + "code_config": { + "length": 7, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "GIFT-CARD-#######" + }, + "is_referral_code": false, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + } + }, + "auto_join": false, + "join_once": true, + "use_voucher_metadata_schema": false, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "activity_duration_after_publishing": "P24D", + "vouchers_count": 0, + "active": true, + "metadata": { + "region": "APAC" + }, + "created_at": "2022-09-21T09:31:16.266Z", + "category": "First", + "creation_status": "IN_PROGRESS", + "vouchers_generation_status": "IN_PROGRESS", + "protected": false, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" + } + ], + "object": "campaign" + } + }, + "Loyalty Program": { + "value": { + "id": "camp_FZL4iTTdZw36nZOoXYQ172fQ", + "name": "Loyalty Campaign", + "campaign_type": "LOYALTY_PROGRAM", + "type": "AUTO_UPDATE", + "voucher": { + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 1000, + "expiration_rules": { + "period_type": "MONTH", + "period_value": 3, + "rounding_type": "END_OF_YEAR" + } + }, + "redemption": { + "quantity": 10 + }, + "code_config": { + "length": 7, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "LOYALTY-CARD-#######" + }, + "is_referral_code": false, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + } + }, + "auto_join": true, + "join_once": true, + "use_voucher_metadata_schema": false, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "activity_duration_after_publishing": "P24D", + "vouchers_count": 0, + "active": true, + "metadata": { + "region": "APAC" + }, + "created_at": "2022-09-21T09:39:45.479Z", + "category": "First", + "creation_status": "IN_PROGRESS", + "vouchers_generation_status": "IN_PROGRESS", + "protected": false, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" + } + ], + "object": "campaign" + } + }, + "Promotion": { + "value": { + "id": "camp_ru1B8mQjY75KxXupt7RPZcb8", + "name": "Promotion - API - 4", + "campaign_type": "PROMOTION", + "type": "STATIC", + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": false, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "activity_duration_after_publishing": "P24D", + "active": true, + "metadata": { + "region": "APAC" + }, + "created_at": "2022-09-23T08:54:38.281Z", + "category": "First", + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "promotion": { + "object": "list", + "data_ref": "tiers", + "tiers": [ + { + "id": "promo_M4OfmMgSUyN12JPAw3l4hWjD", + "created_at": "2022-09-23T08:54:38.286Z", + "name": "Percent Discount", + "banner": "Get 40% off", + "action": { + "discount": { + "type": "PERCENT", + "percent_off": 40, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": { + "level": "B" + }, + "hierarchy": 1, + "promotion_id": "camp_ru1B8mQjY75KxXupt7RPZcb8", + "campaign": { + "id": "camp_ru1B8mQjY75KxXupt7RPZcb8", + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "active": true, + "category_id": "cat_0bb343dee3cdb5ec0c", + "object": "campaign" }, - "gift": null, - "loyalty_card": null, - "start_date": "2016-01-01T00:00:00.000Z", - "expiration_date": "2022-12-31T23:59:59.000Z", + "campaign_id": "camp_ru1B8mQjY75KxXupt7RPZcb8", + "active": false, + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", "validity_timeframe": { "interval": "P2D", - "duration": "PT1H" + "duration": "P1D" }, "validity_day_of_week": [ 1, 2, 3, - 4, - 5 + 4 ], - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", - "metadata": { - "test": true, - "locale": "de-en" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX180g6GhUA0kT47tHGvZ5thjCgY5nbsPtiecixkkEznFVg2v3SDG9dpCbXR6BSUdM/d78Wm/zru1ybT4+AQ2X0JnEy86N7TZ/aoezZORjcBRUfyVM/scUUF/vmD4Ezn+Elp2+V9AFcAXN/WthaRMl9e7xvEeIEQ5nao=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX180g6GhUA0kT47tHGvZ5thjCgY5nbsPtiecixkkEznFVg2v3SDG9dpCbXR6BSUdM%2Fd78Wm%2Fzru1ybT4%2BAQ2X0JnEy86N7TZ%2FaoezZORjcBRUfyVM%2FscUUF%2FvmD4Ezn%2BElp2%2BV9AFcAXN%2FWthaRMl9e7xvEeIEQ5nao%3D" + "summary": { + "redemptions": { + "total_redeemed": 0 }, - "barcode": { - "id": "U2FsdGVkX1/AynivxYCEIxfTnf3A1lO0xsNihOlbUMo6Y6873LQ2qpmkk90aUFnaFKd7pVumcirRweblzGVSxy24Phhd174VSPaLxxmSKp0FPv0dRos/XWBg8zu0Kta0pA/yvFK3WWGlNoPPPnvEhVWKKzOr09Gj94SMrr+TGlI=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FAynivxYCEIxfTnf3A1lO0xsNihOlbUMo6Y6873LQ2qpmkk90aUFnaFKd7pVumcirRweblzGVSxy24Phhd174VSPaLxxmSKp0FPv0dRos%2FXWBg8zu0Kta0pA%2FyvFK3WWGlNoPPPnvEhVWKKzOr09Gj94SMrr%2BTGlI%3D" + "orders": { + "total_amount": 0, + "total_discount_amount": 0 } }, - "is_referral_code": false, - "created_at": "2022-02-17T07:14:40.096Z", - "updated_at": null, - "validation_rules_assignments": { + "object": "promotion_tier", + "validation_rule_assignments": { "object": "list", "data_ref": "data", "data": [ { - "id": "asgm_COu5PJAsWmAwuCqR", - "rule_id": "val_4j7DCRm2IS59", - "related_object_id": "v_YJYfeKoR0XAGIvaM7k51wTbDjU4WIpC5", - "related_object_type": "voucher", - "created_at": "2022-02-17T07:14:40.280Z", + "id": "asgm_dr3oXeN98YfiTF60", + "rule_id": "val_q8qUBMOh5qIQ", + "related_object_id": "promo_M4OfmMgSUyN12JPAw3l4hWjD", + "related_object_type": "promotion_tier", + "created_at": "2022-09-23T08:54:38.286Z", "object": "validation_rules_assignment" } ], "total": 1 - }, - "redemption": { - "quantity": 10, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/NEW-WELCOME-COUPON/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/NEW-WELCOME-COUPON/publications?page=1&limit=10" - }, - "object": "voucher" - } - }, - "Gift Voucher": { - "value": { - "id": "v_yAZyBimXtF9yQ2C5BEF9WMhNzOMJNfz6", - "code": "New-GIFT-CARD-8tqB6FcyhE0", - "campaign": null, - "campaign_id": null, - "category": "New Customers", - "type": "GIFT_VOUCHER", - "discount": null, - "gift": { - "amount": 10000, - "balance": 10000, - "effect": "APPLY_TO_ORDER" - }, - "loyalty_card": null, - "start_date": "2022-01-01T00:00:00.000Z", - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": "This gift card is enabled immediately upon creation.", - "metadata": { - "test": true, - "locale": "de-en" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+pm0q3U4i/KrjResuZpwDigEa5WcDOlwYS/bj3rsesZXDpJF5MNHMUsKqy0+wn5tY3QbjPGv0dwbqRn/OjrIRgNlP99azD0n0n9C/chiTABp8BxlJmMKKFo5AggBbQu4+Mw8Cv8V3+0Ga7ETzeehS+Yrj6c+3ioxg=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bpm0q3U4i%2FKrjResuZpwDigEa5WcDOlwYS%2Fbj3rsesZXDpJF5MNHMUsKqy0%2Bwn5tY3QbjPGv0dwbqRn%2FOjrIRgNlP99azD0n0n9C%2FchiTABp8BxlJmMKKFo5AggBbQu4%2BMw8Cv8V3%2B0Ga7ETzeehS%2BYrj6c%2B3ioxg%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/UaGX0zV8oXbpYah2G76V1ljYSy6hDSnWAZhpz5v10vRibGaOJUahyLcClMyxAsUhU9WXWi4BUGWIEEu510AxzxyGHOTDTjavJH0Q79PI0ciLHdujNFOgLOXWe9Ffwzj+Kvjmbhb22/SVZd/xzQlUBJcv7XboJYU0=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FUaGX0zV8oXbpYah2G76V1ljYSy6hDSnWAZhpz5v10vRibGaOJUahyLcClMyxAsUhU9WXWi4BUGWIEEu510AxzxyGHOTDTjavJH0Q79PI0ciLHdujNFOgLOXWe9Ffwzj%2BKvjmbhb22%2FSVZd%2FxzQlUBJcv7XboJYU0%3D" + } + }, + { + "id": "promo_uMSxvzhxXDp3Ijs3659npqb2", + "created_at": "2022-09-23T08:54:38.314Z", + "name": "Order more than $100", + "banner": "Get $30 off", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 3000, + "effect": "APPLY_TO_ORDER" } }, - "is_referral_code": false, - "created_at": "2022-02-17T07:49:10.834Z", - "updated_at": null, - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "redeemed_amount": 0, - "object": "list", - "url": "/v1/vouchers/New-GIFT-CARD-8tqB6FcyhE0/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/New-GIFT-CARD-8tqB6FcyhE0/publications?page=1&limit=10" - }, - "object": "voucher" - } - }, - "Loyalty Card": { - "value": { - "id": "v_tVkcOhjHCz9W7q8QnuJnTGPBR2hdaYrC", - "code": "New-LOYALTY-CARD-UC1", - "campaign": "Loyalty Campaign", - "campaign_id": "camp_E87CubZLZ8eoQt3c4kAEZsx0", - "category": "New Customers", - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 10000, - "balance": 10000 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": "This loyalty card is enabled immediately upon creation.", "metadata": { - "test": true, - "locale": "de-en" + "level": "A" }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+6lGBFlqtS9OoY2wbAsoSupV43qa+g5sGu+R0IDTq2k85LIfbKfV9sDSYv80pP9ucsazJ6qGI9ineqQyhv9VVHdsJ2qGRiuZzpw/vRkSA0a7J9N1MpANgzqpIULZHLjYtrCQ/2el72nZ6Hpr2NkWtk19JTpNwB8tk=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B6lGBFlqtS9OoY2wbAsoSupV43qa%2Bg5sGu%2BR0IDTq2k85LIfbKfV9sDSYv80pP9ucsazJ6qGI9ineqQyhv9VVHdsJ2qGRiuZzpw%2FvRkSA0a7J9N1MpANgzqpIULZHLjYtrCQ%2F2el72nZ6Hpr2NkWtk19JTpNwB8tk%3D" + "hierarchy": 2, + "promotion_id": "camp_ru1B8mQjY75KxXupt7RPZcb8", + "campaign": { + "id": "camp_ru1B8mQjY75KxXupt7RPZcb8", + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" }, - "barcode": { - "id": "U2FsdGVkX180bvJVsyZvpAqwYXTnm4MvvH4Rur+ZhM+Mbmnva/fgYUcUbOttsFXPY/PMZ9Xi8pomVp26a7amIPguNimD8w4PMZLMavMtH7EtJ4k+0V0Wp7JUkudIKeRw2fDnQ3/0cgqvK6PMReUwFWb5nUT3ABpZDAdaOVoMDhE=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX180bvJVsyZvpAqwYXTnm4MvvH4Rur%2BZhM%2BMbmnva%2FfgYUcUbOttsFXPY%2FPMZ9Xi8pomVp26a7amIPguNimD8w4PMZLMavMtH7EtJ4k%2B0V0Wp7JUkudIKeRw2fDnQ3%2F0cgqvK6PMReUwFWb5nUT3ABpZDAdaOVoMDhE%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-02-17T08:06:41.091Z", - "updated_at": null, - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "redeemed_points": 0, - "object": "list", - "url": "/v1/vouchers/New-LOYALTY-CARD-UC1/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/New-LOYALTY-CARD-UC1/publications?page=1&limit=10" - }, - "object": "voucher" - } - }, - "Unit Discount Multiple Items": { - "value": { - "id": "v_cu8nyozvTDA413H17bH5BLha0cjxt7s8", - "code": "MultipleUnitTypesUnitDiscount", - "campaign": null, - "campaign_id": null, - "category": "New Customers", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "UNIT", - "effect": "ADD_MANY_ITEMS", - "units": [ - { - "unit_off": 1, - "unit_type": "prod_0a9f9ab4ab019a42d5", - "effect": "ADD_NEW_ITEMS" - }, - { - "unit_off": 1, - "unit_type": "prod_0a9f9aeddb019a42db", - "effect": "ADD_MISSING_ITEMS" - } - ] + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "active": true, + "category_id": "cat_0bb343dee3cdb5ec0c", + "object": "campaign" }, - "gift": null, - "loyalty_card": null, - "start_date": "2020-01-01T00:00:00.000Z", - "expiration_date": "2022-12-31T23:59:59.000Z", + "campaign_id": "camp_ru1B8mQjY75KxXupt7RPZcb8", + "active": false, + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", "validity_timeframe": { "interval": "P2D", - "duration": "PT1H" + "duration": "P1D" }, "validity_day_of_week": [ 1, 2, 3, - 4, - 5 + 4 ], - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", - "metadata": { - "test": true, - "locale": "de-en" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+ocJBtZ9NqT97gZ/QTfOz54TAoRoKO3tnCYBtHZWMghEHT0b2aFrPSL1lqMyf6fYy6DH2/DkH5p5Vd8dOozW1LV6wPVatWpa1lZMeMIB0OcARCW3q+3QydoW2KdliLKyksFwumH9C7Fsnj6HTaEbUjSttTZE/be+o=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BocJBtZ9NqT97gZ%2FQTfOz54TAoRoKO3tnCYBtHZWMghEHT0b2aFrPSL1lqMyf6fYy6DH2%2FDkH5p5Vd8dOozW1LV6wPVatWpa1lZMeMIB0OcARCW3q%2B3QydoW2KdliLKyksFwumH9C7Fsnj6HTaEbUjSttTZE%2Fbe%2Bo%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+Sly3IYj3EbZFHGGNxV6Ns4j76O8d0kRQe3WriJz5qY6s4GBIwlsdy13AciaQuiVt232HlOlZ4TzGaSSk3+ZMldwBGaTp/fIN9SGBW/NVUtfDOI2sIDLZCBBrdK7WVvtCQQ+1Y+6qClYg/QurJExCFRkDeKpKjDug=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BSly3IYj3EbZFHGGNxV6Ns4j76O8d0kRQe3WriJz5qY6s4GBIwlsdy13AciaQuiVt232HlOlZ4TzGaSSk3%2BZMldwBGaTp%2FfIN9SGBW%2FNVUtfDOI2sIDLZCBBrdK7WVvtCQQ%2B1Y%2B6qClYg%2FQurJExCFRkDeKpKjDug%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-02-18T06:27:45.619Z", - "updated_at": null, - "redemption": { - "quantity": 5, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/MultipleUnitTypesUnitDiscount/publications?page=1&limit=10" - }, - "object": "voucher" - } - }, - "Unit Discount Single Item": { - "value": { - "id": "v_NQdraO4fXWYvMMWYL9OY22hRernr553n", - "code": "AddMissingItemDiscount", - "campaign": null, - "campaign_id": null, - "category": "New Customers", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "UNIT", - "unit_off": 1, - "unit_type": "prod_0a9f9ab4ab019a42d5", - "effect": "ADD_MISSING_ITEMS" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2020-01-01T00:00:00.000Z", - "expiration_date": "2022-12-31T23:59:59.000Z", - "validity_timeframe": null, - "validity_day_of_week": null, - "active": false, - "additional_info": "This voucher will remain inactive until enabled.", - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX19Yh7LTNyOVKSXQ+ceTr023saElWAUeucwOgjTH50x1SoSF/PP1aoGBr6sSxHZNZOvBGumWNHjsF85y7cPY7La/4a0d1kWqnAiBWeWnGOgDFeQFqthGswypFOK1jdAzUPqLSbxW3O6q936N6Bsmoz4QHYE//kfWFhs=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19Yh7LTNyOVKSXQ%2BceTr023saElWAUeucwOgjTH50x1SoSF%2FPP1aoGBr6sSxHZNZOvBGumWNHjsF85y7cPY7La%2F4a0d1kWqnAiBWeWnGOgDFeQFqthGswypFOK1jdAzUPqLSbxW3O6q936N6Bsmoz4QHYE%2F%2FkfWFhs%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+RqzgyYsIJzAEBxmQt1OZLu4+PSUDQBldDKK1o5XsEoBSQEMPWHis1wJSg4ZNqJ9ZdJ0Ukc+K6X1fjg0ggDsCdXP2ZxpyGPD8/1ReggJZ/tq823ji7A5pzhG1TljA6+vmISuHvs2wkcum0djN9AWuAlB0F/vbXexo=", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BRqzgyYsIJzAEBxmQt1OZLu4%2BPSUDQBldDKK1o5XsEoBSQEMPWHis1wJSg4ZNqJ9ZdJ0Ukc%2BK6X1fjg0ggDsCdXP2ZxpyGPD8%2F1ReggJZ%2Ftq823ji7A5pzhG1TljA6%2BvmISuHvs2wkcum0djN9AWuAlB0F%2FvbXexo%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-02-18T06:46:44.536Z", - "updated_at": null, - "redemption": { - "quantity": 3, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/AddMissingItemDiscount/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/AddMissingItemDiscount/publications?page=1&limit=10" - }, - "object": "voucher" - } - } - } - } - } - } - } - } - }, - "/v1/vouchers/{code}/enable": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "2CpRCE2c" - }, - "name": "code", - "in": "path", - "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. `v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u`.", - "required": true - } - ], - "post": { - "operationId": "enable-voucher", - "tags": [ - "VOUCHERS API" - ], - "summary": "Enable Voucher", - "description": "There are various times when you'll want to manage a voucher's accessibility. This can be done by two API methods for managing the voucher state - *enable* and *disable*. \n___\nThe 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.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a voucher object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_obj_voucher_object" - }, - "examples": { - "Example": { - "value": { - "id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "code": "2CpRCE2c", - "campaign": null, - "campaign_id": null, - "category": null, - "category_id": null, - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 300, - "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" - }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1+ro/6HLsfI9E/rz0QEoYv+rcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz+WQtg4nKpjUS0wcA7AuIbz2zb870YfJO/r5UBS5gCqQ==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bro%2F6HLsfI9E%2Frz0QEoYv%2BrcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz%2BWQtg4nKpjUS0wcA7AuIbz2zb870YfJO%2Fr5UBS5gCqQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3/4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ+aTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3%2F4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ%2BaTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-19T10:06:07.932Z", - "updated_at": "2022-09-19T11:54:17.248Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_HesdqEzt5e9c0T56", - "rule_id": "val_gZft0NKZSUWK", - "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "related_object_type": "voucher", - "created_at": "2022-09-19T10:06:07.934Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/2CpRCE2c/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/2CpRCE2c/publications?page=1&limit=10" - }, - "object": "voucher" - } - } - } - } - } - }, - "404": { - "description": "Returns an error if the voucher code does not exist or has been deleted.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id IrKORhS", - "request_id": "v-0a96cd820301c0483a", - "resource_id": "IrKORhS", - "resource_type": "voucher" - } - } - } - } - } - } - } - } - }, - "/v1/vouchers/{code}/disable": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "2CpRCE2c" - }, - "name": "code", - "in": "path", - "required": true, - "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. `v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u`." - } - ], - "post": { - "operationId": "disable-voucher", - "tags": [ - "VOUCHERS API" - ], - "summary": "Disable Voucher", - "description": "There are various times when you'll want to manage a voucher's accessibility. This can be done by two API methods for managing the voucher state - *enable* and *disable*. \n___\nThis method sets the voucher state to **inactive**. The voucher cannot be redeemed.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a voucher object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_obj_voucher_object" - }, - "examples": { - "Example": { - "value": { - "id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "code": "2CpRCE2c", - "campaign": null, - "campaign_id": null, - "category": null, - "category_id": null, - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 300, - "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" - }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": false, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1+ro/6HLsfI9E/rz0QEoYv+rcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz+WQtg4nKpjUS0wcA7AuIbz2zb870YfJO/r5UBS5gCqQ==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bro%2F6HLsfI9E%2Frz0QEoYv%2BrcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz%2BWQtg4nKpjUS0wcA7AuIbz2zb870YfJO%2Fr5UBS5gCqQ%3D%3D" + "summary": { + "redemptions": { + "total_redeemed": 0 }, - "barcode": { - "id": "U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3/4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ+aTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3%2F4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ%2BaTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw%3D%3D" + "orders": { + "total_amount": 0, + "total_discount_amount": 0 } }, - "is_referral_code": false, - "created_at": "2022-09-19T10:06:07.932Z", - "updated_at": "2022-09-19T11:53:23.452Z", - "validation_rules_assignments": { + "object": "promotion_tier", + "validation_rule_assignments": { "object": "list", "data_ref": "data", "data": [ { - "id": "asgm_HesdqEzt5e9c0T56", - "rule_id": "val_gZft0NKZSUWK", - "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "related_object_type": "voucher", - "created_at": "2022-09-19T10:06:07.934Z", + "id": "asgm_jgJlWms7GVK59iNR", + "rule_id": "val_q8qUBMOh5qIQ", + "related_object_id": "promo_uMSxvzhxXDp3Ijs3659npqb2", + "related_object_type": "promotion_tier", + "created_at": "2022-09-23T08:54:38.314Z", "object": "validation_rules_assignment" - } - ], - "total": 1 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/2CpRCE2c/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/2CpRCE2c/publications?page=1&limit=10" - }, - "object": "voucher" - } - } - } - } - } - }, - "404": { - "description": "Returns an error if the voucher code does not exist or has been deleted.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id IrKORhS", - "request_id": "v-0a96cd820301c0483a", - "resource_id": "IrKORhS", - "resource_type": "voucher" - } - } - } - } - } - } - } - } - }, - "/v1/vouchers/{code}/balance": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "GIFT-CARD-1" - }, - "name": "code", - "in": "path", - "required": true, - "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. `v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u`." - } - ], - "post": { - "operationId": "add-remove-gift-voucher-balance", - "tags": [ - "VOUCHERS API" - ], - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "summary": "Add or Remove Gift Card Balance", - "description": "Add balance to an existing gift card.", - "requestBody": { - "required": true, - "description": "Provide the amount to be added to/subtracted from the gift card.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_req_vouchers_code_balance" - }, - "examples": { - "Example": { - "value": { - "amount": 10000 - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns a balance object if the operation succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_res_vouchers_code_balance" - }, - "examples": { - "Example": { - "value": { - "amount": 10000, - "total": 20100, - "balance": 20100, - "type": "gift_voucher", - "object": "balance", - "related_object": { - "type": "voucher", - "id": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" + } + ], + "total": 1 } } + ], + "total": 2, + "has_more": false + }, + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" } - } + ], + "object": "campaign" } - } - }, - "404": { - "description": "Returns an error if the voucher code does not exist or has been deleted.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id IrKORhS", - "request_id": "v-0a96cd820301c0483a", - "resource_id": "IrKORhS", - "resource_type": "voucher" - } + }, + "Referral Program": { + "value": { + "id": "camp_N8rztKAqOYIdFxNLr9eNIjyB", + "name": "Referral Campaign 2", + "campaign_type": "REFERRAL_PROGRAM", + "type": "AUTO_UPDATE", + "voucher": { + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "amount_limit": 15, + "percent_off": 45, + "effect": "APPLY_TO_ORDER" + }, + "redemption": { + "quantity": 10 + }, + "code_config": { + "length": 7, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "REFERRAL-CODE-#######" + }, + "is_referral_code": true, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + } + }, + "referral_program": { + "conversion_event_type": "redemption" + }, + "auto_join": false, + "join_once": true, + "use_voucher_metadata_schema": false, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "activity_duration_after_publishing": "P24D", + "vouchers_count": 0, + "active": true, + "metadata": { + "region": "APAC" + }, + "created_at": "2022-09-23T09:06:41.757Z", + "category": "First", + "creation_status": "IN_PROGRESS", + "vouchers_generation_status": "IN_PROGRESS", + "protected": false, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" } - } + ], + "object": "campaign" } } } } } }, - "/v1/vouchers/{code}/transactions": { - "parameters": [ - { + "400": { + "description": "Returns an error if an incomplete request body is provided.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "GIFT-CARD-1" - }, - "name": "code", - "in": "path", - "required": true, - "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. `v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u`." - } - ], - "get": { - "operationId": "list-voucher-transactions", - "tags": [ - "VOUCHERS API" - ], - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "summary": "List Voucher Transactions", - "description": "List transactions that are associated with credit movements on a gift card or loyalty card.", - "responses": { - "200": { - "description": "Returns a dictionary of transaction objects", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/vouchers_list_transactions_response_body" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "vtx_0c9dccc4d5813e71bd", - "source_id": "20230317_subtract_1", - "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "source": "API", - "reason": "Subtracting credits from card", - "type": "CREDITS_REMOVAL", - "details": { - "balance": { - "type": "gift_voucher", - "total": 128020, - "amount": -2000, - "object": "balance", - "balance": 121020, - "related_object": { - "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "type": "voucher" - } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-17T15:50:00.786Z" - }, - { - "id": "vtx_0c9dcc920ac0e9ef82", - "source_id": "20230317_add_1", - "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "source": "API", - "reason": "Adding more points to card", - "type": "CREDITS_ADDITION", - "details": { - "balance": { - "type": "gift_voucher", - "total": 130020, - "amount": 20, - "object": "balance", - "balance": 123020, - "related_object": { - "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "type": "voucher" - } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-17T15:49:08.768Z" - }, - { - "id": "vtx_0c94f018d30bef6689", - "source_id": "HRwc0oHz_reward", - "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "source": "voucherify-web-ui", - "reason": "cash reward", - "type": "CREDITS_ADDITION", - "details": { - "balance": { - "type": "gift_voucher", - "total": 130000, - "amount": 2000, - "object": "balance", - "balance": 123000, - "related_object": { - "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "type": "voucher" - } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-10T18:38:02.055Z" - }, - { - "id": "vtx_0c94edbbaccbef5db6", - "source_id": null, - "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "source": null, - "reason": null, - "type": "CREDITS_REFUND", - "details": { - "balance": { - "type": "gift_voucher", - "total": 128000, - "amount": 44, - "object": "balance", - "balance": 121000, - "related_object": { - "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "type": "voucher" - } - }, - "order": { - "id": "ord_jj5EzDxDOd2xFPsAJJ18IaZK", - "source_id": null - }, - "redemption": { - "id": "r_0c94ed583fcafc31c1" - }, - "rollback": { - "id": "rr_0c94edbb8d0bef5d9e" - } - }, - "related_transaction_id": null, - "created_at": "2023-03-10T18:27:42.389Z" - }, - { - "id": "vtx_0c94ed584f4afc31da", - "source_id": null, - "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "source": null, - "reason": null, - "type": "CREDITS_REDEMPTION", - "details": { - "balance": { - "type": "gift_voucher", - "total": 128000, - "amount": -44, - "object": "balance", - "balance": 120956, - "related_object": { - "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "type": "voucher" - } - }, - "order": { - "id": "ord_jj5EzDxDOd2xFPsAJJ18IaZK", - "source_id": null - }, - "redemption": { - "id": "r_0c94ed583fcafc31c1" - } - }, - "related_transaction_id": null, - "created_at": "2023-03-10T18:26:00.640Z" - }, - { - "id": "vtx_0c94e9432c4afc2134", - "source_id": "HRwc0oHz_removal", - "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "source": "voucherify-web-ui", - "reason": "removal", - "type": "CREDITS_REMOVAL", - "details": { - "balance": { - "type": "gift_voucher", - "total": 128000, - "amount": -2000, - "object": "balance", - "balance": 121000, - "related_object": { - "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "type": "voucher" - } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-10T18:08:10.413Z" - }, - { - "id": "vtx_0c94e8100f8afc1c6c", - "source_id": null, - "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "source": null, - "reason": null, - "type": "CREDITS_REDEMPTION", - "details": { - "balance": { - "type": "gift_voucher", - "total": 130000, - "amount": -7000, - "object": "balance", - "balance": 123000, - "related_object": { - "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "type": "voucher" - } - }, - "order": { - "id": "ord_qZX3pEt5rFf5W23qRMDQcVt9", - "source_id": null - }, - "redemption": { - "id": "r_0c94e80fda4afc1c59" - } - }, - "related_transaction_id": null, - "created_at": "2023-03-10T18:02:55.935Z" - }, - { - "id": "vtx_0c94e6b82a4bef406c", - "source_id": "walmart", - "voucher_id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "campaign_id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "source": "voucherify-web-ui", - "reason": "return", - "type": "CREDITS_ADDITION", - "details": { - "balance": { - "type": "gift_voucher", - "total": 130000, - "amount": 5000, - "object": "balance", - "balance": 130000, - "related_object": { - "id": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp", - "type": "voucher" - } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-10T17:57:03.758Z" - } - ], - "has_more": false - } - } - } - } - } + "$ref": "#/components/schemas/e_error_no_translation" }, - "404": { - "description": "Returns an error if the voucher code does not exist or has been deleted.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id IrKORhS", - "request_id": "v-0a96cd820301c0483a", - "resource_id": "IrKORhS", - "resource_type": "voucher" - } - } - } + "examples": { + "Example": { + "value": { + "code": 400, + "key": "invalid_campaign", + "message": "Invalid Campaign", + "details": "Property 'discount' is required for REFERRAL_PROGRAM campaign", + "request_id": "v-0bb99c9213425fa250" } } } } } }, - "/v1/vouchers/{code}/transactions/export": { - "parameters": [ - { + "404": { + "description": "When a payload value is not found.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "GIFT-CARD-1" + "$ref": "#/components/schemas/e_404_not_found" }, - "name": "code", - "in": "path", - "required": true, - "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify, i.e. `v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u`." - } - ], - "post": { - "operationId": "export-gift-card-transactions", - "tags": [ - "VOUCHERS API" - ], - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "summary": "Export Gift Card Transactions", - "description": "Export transactions that are associated with credit movements on a gift card.\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
                  - `CREDITS_ADDITION`
                  - `CREDITS_REFUND`
                  - `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |", - "requestBody": { - "description": "Specify the parameters for the transaction export.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_req_create_gift_card_transactions_export" - }, - "examples": { - "Example": { - "value": { - "parameters": { - "order": "-created_at", - "fields": [ - "id", - "type", - "source_id", - "reason", - "balance", - "amount", - "created_at", - "voucher_id", - "campaign_id", - "details", - "source" - ] - } - } - } + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find category with id cat_0bb343dee3cdb5ec0c", + "request_id": "v-0c55671ed1cb0f1a27", + "resource_id": "cat_0bb343dee3cdb5ec0c", + "resource_type": "category" } } } - }, - "responses": { - "200": { - "description": "Returns an export object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_obj_export_transactions_object" - }, - "examples": { - "Example": { - "value": { - "id": "exp_ARi2UbRjgfrHQJoVcKFrBUgA", - "object": "export", - "created_at": "2023-05-16T08:30:21.496Z", - "status": "SCHEDULED", - "channel": "API", - "exported_object": "voucher_transactions", - "parameters": { - "order": "-created_at", - "fields": [ - "id", - "type", - "source_id", - "reason", - "balance", - "amount", - "created_at", - "voucher_id", - "campaign_id", - "details", - "related_transaction_id", - "source" - ], - "filters": { - "voucher_id": { - "conditions": { - "$in": [ - "HRwc0oHz" - ] - } - } - } - }, - "result": null, - "user_id": null - } - }, - "No request body": { - "value": { - "id": "exp_ExEE5A6OIK4tssuNswr5O6SU", - "object": "export", - "created_at": "2023-03-21T13:34:57.034Z", - "status": "SCHEDULED", - "channel": "API", - "exported_object": "voucher_transactions", - "parameters": { - "filters": { - "voucher_id": { - "conditions": { - "$in": [ - "HRwc0oHz" - ] - } - } - } - }, - "result": null, - "user_id": null - } - } - } - } - } + } + } + }, + "409": { + "description": "Returns an error if a campaign with the same name already exists.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_409_duplicate_found" }, - "404": { - "description": "Returns an error if the voucher code does not exist or has been deleted.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id IrKORhS", - "request_id": "v-0a96cd820301c0483a", - "resource_id": "IrKORhS", - "resource_type": "voucher" - } - } - } + "examples": { + "Example": { + "value": { + "code": 409, + "key": "duplicate_found", + "message": "Duplicated resource found", + "details": "Duplicated campaign exists with name Discount Campaign", + "request_id": "v-0bb98f8c6552250aab", + "resource_id": "Discount Campaign", + "resource_type": "campaign" } } } } } + } + } + }, + "get": { + "operationId": "list-campaigns", + "tags": [ + "CAMPAIGNS API" + ], + "summary": "List Campaigns", + "description": "Retrieve a list of campaigns in a project. \n\nThe campaigns are returned sorted by creation date, with the most recent campaigns appearing first. \n\nWhen you get a list of campaigns, you can optionally specify query parameters to customize the amount of campaigns returned per call using `limit`, which page of campaigns to return using `page`, sort the campaigns using the `order` query parameter and filter the results by the `campaign_type`.\n\nThis method will return an error when trying to return a limit of more than 100 campaigns.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" }, - "/v1/vouchers/import": { - "post": { - "operationId": "import-vouchers", - "tags": [ - "VOUCHERS API" - ], - "summary": "Import Vouchers", - "description": "Import standalone vouchers and gift cards into the repository.\n\n\n\n> 📘 Important notes\n>\n> - **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z.\n> - Custom code attributes (not supported by-default) need to be added as code **metadata**.\n> - You **cannot import the same codes** to a single Voucherify Project.\n\nAny parameters not provided in the payload will be left blank or null.\n\nFor both **standalone discount vouchers and gift cards**, you can import the following fields: \n\n- code\n- category\n- active\n- type\n- start_date\n- expiration_date\n- redemption.quantity\n- additional_info\n- metadata\n\nFor **gift cards**, you can also import the following field:\n\n- gift.amount\n\nFor **discount vouchers**, you can import the `discount` object. The object will slightly vary depending on the type of discount. Each discount type **requires** the `type` to be defined in the import.\n\n| **Discount Type** | **Required fields** |\n|:---|:---|\n| Amount | amount_off, effect |\n| Percent | percent_off, effect |\n| Fixed | fixed_amount, effect |\n| Unit - One item | unit_off, unit_type, effect |\n| Unit - Multiple items | unit_off, unit_type, effect |\n| Shipping | unit_off, unit_type, effect |\n\nFields other than the ones listed above won't be imported. Even if provided, they will be silently skipped.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "required": true, - "description": "The request body is an array of objects. Each object contains details about a specific voucher. ", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_req_vouchers_import" - }, - "examples": { - "Example": { - "value": [ - { - "code": "PROMO-CODE30OFF-NO-EFFECT", - "category": "new customer acquisition", - "type": "DISCOUNT_VOUCHER", - "active": true, - "discount": { - "amount_off": 3000, - "type": "AMOUNT" - }, - "start_date": "2020-12-01T23:00:00Z", - "expiration_date": "2023-12-19T23:00:00Z", - "redemption": { - "quantity": 1 - }, - "metadata": { - "unit": "EUR" - }, - "additional_info": "secret-code1" - }, - { - "code": "PROMO-CODE30-PERCENT-NO-EFFECT", + { + "$ref": "#/components/parameters/page" + }, + { + "$ref": "#/components/parameters/campaign_type" + }, + { + "schema": { + "type": "string", + "default": "category" + }, + "in": "query", + "name": "expand", + "description": "Include an expanded `categories` object in the response." + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + }, + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with a `campaign` property that contains an array of campaigns. The maximum number of campaigns returned is determined by the `limit` query parameter. Each entry in the array is a separate campaign object. If no more campaigns are available, the resulting array on a given page will be empty.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_res_list_campaigns" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "campaigns", + "campaigns": [ + { + "id": "camp_SibPsDRKQvg3SUtptgPZCNZb", + "name": "Voucher Metadata", + "campaign_type": "DISCOUNT_COUPONS", + "type": "AUTO_UPDATE", + "voucher": { "type": "DISCOUNT_VOUCHER", - "active": false, "discount": { + "type": "PERCENT", + "amount_limit": 4400, "percent_off": 30, - "type": "PERCENT" + "effect": "APPLY_TO_ORDER" }, - "start_date": "2020-12-10T23:00:00Z", - "expiration_date": "2023-12-31T23:00:00Z", "redemption": { - "quantity": 1 + "quantity": null }, - "metadata": { - "unit": "EUR" + "code_config": { + "length": 9, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "#########", + "prefix": "Discount-", + "postfix": "YY" }, - "additional_info": "secret-code2" + "is_referral_code": false, + "start_date": "2022-09-20T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": { + "interval": "P3D", + "duration": "P1D" + } }, - { - "code": "GIFT-CARD-100", - "type": "GIFT_VOUCHER", - "active": true, - "category": "new customer acquisition", - "gift": { - "amount": 10000 - }, - "start_date": "2020-12-10T23:00:00Z", - "expiration_date": "2023-12-31T23:00:00Z", - "redemption": { - "quantity": 5 - }, - "metadata": { - "unit": "EUR" - }, - "additional_info": "secret-GIFT-code2" + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": false, + "start_date": "2022-09-20T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": { + "interval": "P3D", + "duration": "P1D" }, - { - "code": "PROMO-CODE1-PERCENT-EFFECT-ORDER", + "validity_day_of_week": [ + 1, + 2, + 3, + 4 + ], + "activity_duration_after_publishing": "P24D", + "vouchers_count": 1, + "active": true, + "metadata": { + "region": "AMER" + }, + "created_at": "2022-09-20T09:32:29.530Z", + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "category_id": null, + "object": "campaign" + }, + { + "id": "camp_HgsbCKauXmEoPnnh8aas0ISe", + "name": "Static Campaign", + "campaign_type": "DISCOUNT_COUPONS", + "type": "STATIC", + "voucher": { "type": "DISCOUNT_VOUCHER", - "active": false, "discount": { - "percent_off": 30, - "type": "PERCENT", + "type": "AMOUNT", + "amount_off": 3000, "effect": "APPLY_TO_ORDER" }, - "start_date": "2020-12-10T23:00:00Z", - "expiration_date": "2023-12-31T23:00:00Z", "redemption": { "quantity": 1 }, - "metadata": { - "unit": "EUR" + "code_config": { + "length": 8, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "########" }, - "additional_info": "secret-code2" + "is_referral_code": false }, - { - "code": "PROMO-CODE2-PERCENT-EFFECT-ITEM", - "type": "DISCOUNT_VOUCHER", - "active": false, - "discount": { - "percent_off": 30, - "type": "PERCENT", - "effect": "APPLY_TO_ITEMS" + "auto_join": false, + "join_once": true, + "use_voucher_metadata_schema": true, + "vouchers_count": 1, + "active": true, + "metadata": {}, + "created_at": "2022-09-20T07:52:34.499Z", + "updated_at": "2022-09-20T11:38:13.501Z", + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "category_id": null, + "object": "campaign" + }, + { + "id": "camp_f7fBbQxUuTN7dI7tGOo5XMDA", + "name": "Loyalty Program Fall 2022", + "campaign_type": "LOYALTY_PROGRAM", + "type": "AUTO_UPDATE", + "voucher": { + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 0, + "expiration_rules": { + "period_type": "MONTH", + "period_value": 7, + "rounding_type": "END_OF_YEAR" + } }, - "start_date": "2020-12-10T23:00:00Z", - "expiration_date": "2023-12-31T23:00:00Z", "redemption": { - "quantity": 1 + "quantity": null }, - "metadata": { - "unit": "EUR" + "code_config": { + "length": 8, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "########", + "prefix": "LOYALTY-CARD-" }, - "additional_info": "secret-code2" + "is_referral_code": false }, - { - "code": "PROMO-CODE1-PERCENT-NO-EFFECT-REDEEMED-QUANTITY-ATTRIBUTE-DOESNT-GET-PASSED", + "auto_join": true, + "join_once": true, + "use_voucher_metadata_schema": true, + "vouchers_count": 1, + "active": true, + "metadata": {}, + "created_at": "2022-09-19T07:56:22.103Z", + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "category_id": "cat_0bb343dee3cdb5ec0c", + "object": "campaign" + }, + { + "id": "camp_4tHsQEDUOER6PeW8SoMdnHH6", + "name": "Dynamic Discounts", + "campaign_type": "DISCOUNT_COUPONS", + "type": "AUTO_UPDATE", + "voucher": { "type": "DISCOUNT_VOUCHER", - "active": false, "discount": { - "percent_off": 30, - "type": "PERCENT" + "type": "PERCENT", + "percent_off": 5, + "percent_off_formula": "IF(ORDER_AMOUNT > 300;15;5)", + "effect": "APPLY_TO_ORDER" }, - "start_date": "2020-12-10T23:00:00Z", - "expiration_date": "2023-12-31T23:00:00Z", "redemption": { - "quantity": 1, - "redeemed_quantity": 1 + "quantity": null }, - "metadata": { - "unit": "EUR" + "code_config": { + "length": 8, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "########", + "prefix": "DYNAMIC-" }, - "additional_info": "secret-code2" + "is_referral_code": false }, - { - "code": "PROMO-CODE1-AMOUNT-EFFECT-ITEMS-PROPORTIONALLY", - "type": "DISCOUNT_VOUCHER", - "active": false, - "discount": { - "amount_off": 30, - "type": "AMOUNT", - "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" - }, - "start_date": "2020-12-10T23:00:00Z", - "expiration_date": "2023-12-31T23:00:00Z", - "redemption": { - "quantity": 1 - }, - "metadata": { - "unit": "EUR" - }, - "additional_info": "secret-code2" + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": true, + "vouchers_count": 1, + "active": true, + "metadata": { + "marketing_text": "Purchases above $300 are eligible for a 15% discount." }, - { - "code": "PROMO-CODE1-FIXED-EFFECT-ORDER", + "created_at": "2022-07-12T15:12:02.575Z", + "updated_at": "2022-07-20T10:48:05.617Z", + "category": "test", + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "category_id": "cat_0b688929a2476386a8", + "object": "campaign" + }, + { + "id": "camp_JlsseNSDO7l4neFtev6p6945", + "name": "$20 OFF Entire Order", + "campaign_type": "DISCOUNT_COUPONS", + "type": "AUTO_UPDATE", + "voucher": { "type": "DISCOUNT_VOUCHER", - "active": false, "discount": { - "fixed_amount": 30, - "type": "FIXED", + "type": "AMOUNT", + "amount_off": 2000, "effect": "APPLY_TO_ORDER" }, - "start_date": "2020-12-10T23:00:00Z", - "expiration_date": "2023-12-31T23:00:00Z", - "redemption": { - "quantity": 1 - }, - "metadata": { - "unit": "EUR" - }, - "additional_info": "secret-code2" - }, - { - "code": "PROMO-CODE1-UNIT-SINGLE-ITEM-EFFECT-MISSING", - "type": "DISCOUNT_VOUCHER", - "active": false, - "discount": { - "unit_off": 1, - "unit_type": "prod_0a9f9aeddb019a42db", - "type": "UNIT", - "effect": "ADD_MISSING_ITEMS" - }, - "start_date": "2020-12-10T23:00:00Z", - "expiration_date": "2023-12-31T23:00:00Z", "redemption": { - "quantity": 1 + "quantity": null }, - "metadata": { - "unit": "EUR" + "code_config": { + "length": 8, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "########", + "prefix": "$20OFFORDER-" }, - "additional_info": "secret-code2" + "is_referral_code": false }, - { - "code": "PROMO-CODE2-UNIT-MULTIPLE-ITEMS", + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": true, + "vouchers_count": 1, + "active": true, + "metadata": {}, + "created_at": "2022-07-11T09:43:36.057Z", + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "category_id": null, + "object": "campaign" + }, + { + "id": "camp_Uj3cNbWSgt7Zl4AyHM7Sa5Qk", + "name": "3% OFF Entire Order", + "campaign_type": "DISCOUNT_COUPONS", + "type": "AUTO_UPDATE", + "voucher": { "type": "DISCOUNT_VOUCHER", - "active": true, "discount": { - "type": "UNIT", - "effect": "ADD_MANY_ITEMS", - "units": [ - { - "unit_off": 1, - "unit_type": "prod_0a9f9aeddb019a42db", - "effect": "ADD_MISSING_ITEMS" - }, - { - "unit_off": 1, - "unit_type": "prod_0a9f9aeddb019a42db", - "effect": "ADD_NEW_ITEMS" - } - ] + "type": "PERCENT", + "percent_off": 3, + "effect": "APPLY_TO_ORDER" }, - "start_date": "2020-12-10T23:00:00Z", - "expiration_date": "2023-12-31T23:00:00Z", "redemption": { - "quantity": 1 + "quantity": null }, - "metadata": { - "unit": "EUR" + "code_config": { + "length": 8, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "########", + "prefix": "3%OFFORDER-" }, - "additional_info": "secret-code2" + "is_referral_code": false }, - { - "code": "PROMO-CODE1-SHIPPING", - "type": "DISCOUNT_VOUCHER", - "active": false, - "discount": { - "type": "UNIT", - "unit_off": 1, - "unit_type": "prod_5h1pp1ng", - "effect": "ADD_MISSING_ITEMS" - }, - "start_date": "2020-12-10T23:00:00Z", - "expiration_date": "2023-12-31T23:00:00Z", - "redemption": { - "quantity": 1 - }, - "metadata": { - "unit": "EUR" - }, - "additional_info": "secret-code2" - } - ] - } + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": true, + "vouchers_count": 1, + "active": true, + "metadata": {}, + "created_at": "2022-07-11T09:41:12.087Z", + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "category_id": null, + "object": "campaign" + } + ], + "total": 6 } } } - }, - "responses": { - "202": { - "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and vouchers will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" + } + } + } + } + } + }, + "/v1/campaigns/{campaignId}": { + "parameters": [ + { + "in": "path", + "name": "campaignId", + "description": "You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.", + "schema": { + "type": "string", + "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" + }, + "required": true + } + ], + "get": { + "operationId": "get-campaign", + "tags": [ + "CAMPAIGNS API" + ], + "summary": "Get Campaign", + "description": "Retrieves the campaign with the given campaign ID or campaign name.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a campaign object if a valid identifier was provided.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_obj_campaign_object" + }, + "examples": { + "Example": { + "value": { + "id": "camp_JlsseNSDO7l4neFtev6p6945", + "name": "$20 OFF Entire Order", + "campaign_type": "DISCOUNT_COUPONS", + "type": "AUTO_UPDATE", + "voucher": { + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 2000, + "effect": "APPLY_TO_ORDER" + }, + "redemption": { + "quantity": null + }, + "code_config": { + "length": 8, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "########", + "prefix": "$20OFFORDER-" + }, + "is_referral_code": false + }, + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": true, + "vouchers_count": 1, + "active": true, + "metadata": {}, + "created_at": "2022-07-11T09:43:36.057Z", + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 }, - "examples": { - "Example": { - "value": { - "async_action_id": "aa_0aac93c6af84485df3" + "category_id": null, + "object": "campaign" + } + } + } + } + } + }, + "404": { + "description": "Returns an error when requesting the campaign that has been deleted or cannot be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id camp_jcErmtGAOmHUAy0oUgkwKnP", + "request_id": "v-0bb8694614d58bf2a8", + "resource_id": "camp_jcErmtGAOmHUAy0oUgkwKnP", + "resource_type": "campaign" + } + } + } + } + } + } + } + }, + "put": { + "operationId": "update-campaign", + "tags": [ + "CAMPAIGNS API" + ], + "summary": "Update Campaign", + "description": "Updates the specified campaign by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. \n\nFields other than the ones listed in the request body won't be modified. Even if provided, they will be silently skipped. \n\n> #### Vouchers will be affected\n>\n> This method will update vouchers aggregated in the campaign. It will affect all vouchers that are not published or redeemed yet.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the campaign parameters to be updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_req_update_campaign" + }, + "examples": { + "Example": { + "value": { + "description": "New description" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns the campaign object if the update succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_obj_campaign_object" + }, + "examples": { + "Example": { + "value": { + "id": "camp_FZL4iTTdZw36nZOoXYQ172fQ", + "name": "Loyalty Campaign", + "campaign_type": "LOYALTY_PROGRAM", + "type": "AUTO_UPDATE", + "voucher": { + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 1000, + "expiration_rules": { + "period_type": "MONTH", + "period_value": 3, + "rounding_type": "END_OF_YEAR" } + }, + "redemption": { + "quantity": 10 + }, + "code_config": { + "length": 7, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "LOYALTY-CARD-#######" + }, + "is_referral_code": false, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + } + }, + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": false, + "description": "New description", + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": "2023-12-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2 + ], + "activity_duration_after_publishing": "P24D", + "vouchers_count": 2, + "active": true, + "metadata": { + "region": "APAC" + }, + "created_at": "2022-09-21T09:39:45.479Z", + "updated_at": "2022-09-23T09:47:00.205Z", + "category": "First", + "creation_status": "MODIFYING", + "vouchers_generation_status": "MODIFYING", + "protected": false, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [ + { + "id": "cat_0bb343dee3cdb5ec0c", + "name": "First", + "hierarchy": 1, + "created_at": "2022-09-16T11:47:19.568Z", + "object": "category" } - } + ], + "object": "campaign" } } } } } + } + } + }, + "delete": { + "operationId": "delete-campaign", + "tags": [ + "CAMPAIGNS API" + ], + "summary": "Delete Campaign", + "description": "Permanently deletes a campaign and all related vouchers. This action cannot be undone. Also, this method immediately removes any redemptions on the voucher.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [ + { + "schema": { + "type": "boolean" + }, + "in": "query", + "description": "If this flag is set to `true`, the campaign and related vouchers will be removed permanently. Going forward, the user will be able to create the next campaign with exactly the same name.", + "name": "force" + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "202": { + "description": "Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the campaign will be deleted from the repository asynchronously. To check the deletion status and result, copy the `async_action_id` from the response and pass it using [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" + }, + "examples": { + "Delete Campaign": { + "$ref": "#/components/examples/res_async_actions" + } + } + } + } }, - "/v1/vouchers/importCSV": { - "post": { - "operationId": "import-vouchers-using-csv", - "tags": [ - "VOUCHERS API" - ], - "summary": "Import Vouchers using CSV", - "description": "Import standalone vouchers into the repository using a CSV file.\n\nThe 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. \n\nYou can find an example CSV file [here](https://support.voucherify.io/article/45-import-codes-and-share-them-digitally#coupons).\n___\n\n```cURL cURL example\ncurl -X POST \\\n https://api.voucherify.io/v1/vouchers/importCSV \\\n -F file=@/path/to/vouchers.csv \\\n -H \"X-App-Id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\" \\\n -H \"X-App-Token: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"\n```\n\n\n\n> 📘 Standard voucher fields mapping\n>\n> - Go to the [import vouchers](ref:import-vouchers) endpoint to see all standard CSV fields description (body params section).\n> - 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\n>- **Start and expiration dates** need to be provided in compliance with the ISO 8601 norms. For example, 2020-03-11T09:00:00.000Z. \n> - `YYYY-MM-DD`\n> - `YYYY-MM-DDTHH`\n> - `YYYY-MM-DDTHH:mm`\n> - `YYYY-MM-DDTHH:mm:ss`\n> - `YYYY-MM-DDTHH:mm:ssZ`\n> - `YYYY-MM-DDTHH:mm:ssZ`\n> - `YYYY-MM-DDTHH:mm:ss.SSSZ`\n> - Custom code attributes (not supported by-default) need to be added as code **metadata**.\n> - You **cannot import the same codes** to a single Voucherify Project.\n\n\n\n> 📘 Categories\n>\n> 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](ref:list-vouchers) endpoint.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + "404": { + "description": "Returns an error indicating that the campaign with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Campaign Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id Spring Campaign", + "request_id": "v-0adac46be8cdbfd921", + "resource_id": "Spring Campaign", + "resource_type": "campaign" + } + } } - ], - "requestBody": { - "description": "The file path is stored in the form `file` header.", - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/a_req_importCSV" + } + } + } + } + } + }, + "/v1/campaigns/{campaignId}/vouchers": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the campaign to which voucher(s) will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value." + } + ], + "post": { + "operationId": "add-vouchers-to-campaign", + "tags": [ + "CAMPAIGNS API" + ], + "summary": "Add Vouchers to Campaign", + "description": "This method gives the possibility to push new vouchers to an existing campaign. New vouchers will inherit properties from the campaign profile. However, it is possible to overwrite some of them in the request body. If you provide an optional `code_config` parameter with a voucher code configuration, then it will be used to generate new voucher codes. Otherwise, the voucher code configuration from the campaign will be used.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [ + { + "schema": { + "type": "integer" + }, + "in": "query", + "name": "vouchers_count", + "description": "Number of vouchers that should be added." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the voucher parameters that you would like to overwrite.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_req_add_vouchers_to_campaign" + }, + "examples": { + "Example": { + "value": { + "category_id": "cat_0bb81a481615a37b5e", + "start_date": "2022-09-24T00:00:00Z", + "expiration_date": "2022-09-25T23:59:59Z", + "active": false, + "redemption": { + "quantity": null + }, + "code_config": { + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "length": 8, + "prefix": "Add-", + "pattern": null, + "postfix": "-API" + }, + "additional_info": "Voucher added using API", + "metadata": { + "Season": "Fall" + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a voucher object if the call succeeded for a voucher count of 1.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_obj_voucher_object" + }, + "examples": { + "Example": { + "value": { + "async_action_id": "aa_0bb96ebb7ec3720252" } } } + } + } + }, + "202": { + "description": "Returns an `async_action_id` if the request was made to create more than 1 voucher.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" + } + } + } + } + } + } + }, + "/v1/campaigns/{campaignId}/vouchers/{code}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the campaign to which voucher will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value." + }, + { + "schema": { + "type": "string" + }, + "name": "code", + "in": "path", + "required": true, + "description": "A custom **code** that identifies the voucher." + } + ], + "post": { + "operationId": "add-voucher-with-specific-code-to-campaign", + "tags": [ + "CAMPAIGNS API" + ], + "summary": "Add Voucher with Specific Code to Campaign", + "description": "This method gives a possibility to add a new voucher to an existing campaign. The voucher definition will be inherited from the definition kept in the campaign profile. However, you are able to overwrite a few properties inherited from the campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the voucher parameters that you would like to overwrite.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_req_add_vouchers_with_specific_code_to_campaign" }, - "responses": { - "202": { - "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and vouchers will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the **response** and pass it using the [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" + "examples": { + "Example": { + "value": { + "category_id": "cat_0bb81a481615a37b5e", + "start_date": "2022-09-24T00:00:00Z", + "expiration_date": "2022-09-25T23:59:59Z", + "active": false, + "redemption": { + "quantity": null + }, + "additional_info": "Voucher added using API", + "metadata": { + "Season": "Fall" + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a voucher object if the call succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/1_obj_voucher_object" + }, + "examples": { + "Example": { + "value": { + "id": "v_EJwB9Wy2aOIsDpWhnl2QBY51OqjQ5Ukg", + "code": "Code3", + "campaign": "Add Vouchers to Campaign", + "campaign_id": "camp_xxpmFyWO9h9s5cEe7HtmOK5B", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "PERCENT", + "amount_limit": 2000, + "percent_off": 30, + "effect": "APPLY_TO_ORDER" + }, + "gift": null, + "loyalty_card": null, + "start_date": "2022-09-24T00:00:00.000Z", + "expiration_date": "2022-09-25T23:59:59.000Z", + "validity_timeframe": null, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": true, + "additional_info": "Voucher added using API", + "metadata": { + "Season": "Fall" }, - "examples": { - "Example": { - "value": { - "async_action_id": "aa_0a875d56c805df6601" - } + "assets": { + "qr": { + "id": "U2FsdGVkX1+p2kdatp7KAUZxgSATC1gRWgsb1Q3RQyClNOBrfUrRKpTjSPSzBuUSZzb45TIpfWRISSiaz1QXGh8z9sVSHIWQsGLO6+1N81zXuY6/pnC7gRBa4edwMaRoCAwzqO9JDw148AGk4XrXLg==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bp2kdatp7KAUZxgSATC1gRWgsb1Q3RQyClNOBrfUrRKpTjSPSzBuUSZzb45TIpfWRISSiaz1QXGh8z9sVSHIWQsGLO6%2B1N81zXuY6%2FpnC7gRBa4edwMaRoCAwzqO9JDw148AGk4XrXLg%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX19wrLVWzIOgoVd9an76OxiJWB5/u9yWGoD7cqN6Qd1K9noNyR1YwvHnBrcN5fa5qtY+sOXonn7WsynAWeR289gA0XobsHHE2VWe8BzNZ7h2kH90SsiW+NCQg6Ts8clYWWP5lrGyV/fzoA==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19wrLVWzIOgoVd9an76OxiJWB5%2Fu9yWGoD7cqN6Qd1K9noNyR1YwvHnBrcN5fa5qtY%2BsOXonn7WsynAWeR289gA0XobsHHE2VWe8BzNZ7h2kH90SsiW%2BNCQg6Ts8clYWWP5lrGyV%2FfzoA%3D%3D" } - } + }, + "is_referral_code": false, + "created_at": "2022-09-21T07:14:28.217Z", + "updated_at": null, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/Code3/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/Code3/publications?page=1&limit=10" + }, + "object": "voucher" } } + } + } + } + }, + "409": { + "description": "Returns an error if a voucher with the same code already exists.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_409_duplicate_found" }, - "400": { - "description": "Invalid payload. You may receive this error if you have incorrectly or have not specified the content type as `multipart/form-data` in the headers.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Example 1": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Payload should have required property 'file'", - "request_id": "74e4bb71-5b6d-49b9-98eb-239691c9d67a" - } - } - } + "examples": { + "Duplicate": { + "value": { + "code": 409, + "key": "duplicate_found", + "message": "Duplicated resource found", + "details": "Duplicated voucher exists with id Code1", + "request_id": "v-0bb974be99d22504cd", + "resource_id": "Code1", + "resource_type": "voucher" } } } } } + } + } + } + }, + "/v1/campaigns/{campaignId}/import": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" }, - "/v1/vouchers/qualification": { - "post": { - "operationId": "examine-vouchers-qualification", - "deprecated": true, - "tags": [ - "VOUCHERS API" - ], - "summary": "Examine Qualification [Deprecated]", - "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for qualification, and we do not recommend using it. The new [Qualifications API](ref:examine-qualification) introduces additional features and improvements while maintaining backward compatibility. 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. \n\nDisplay vouchers qualified to the given customer and context (e.g., order, loyalty reward). Checks up to 50 **standalone vouchers**. \n\n> 👍 Prevailing assumption\n> You data is synced with Voucherify.\n\n ## How does this endpoint work? \n\n A property's value that does not meet a validation rule requirement will disqualify that particular voucher and it will not be listed in the results.\n\nAs a sample use case, you can imagine a requirement of displaying coupons available for the customer below the shopping cart. The customer can choose and apply the proposed voucher.\n\n ## What's excluded? \n\n The verification logic won't run against _coupons from bulk unique code campaigns_. For campaigns with multiple unique codes, you should run a [dedicated function](ref:examine-campaigns-qualification) for searching and identifying qualified campaigns.\n\n ## Customizing the response\n\n> 📘 Query parameters let you sort and filter the returned vouchers\n>\n> Customize your response:\n> - If you only care about verifying a customer, use `audienceRulesOnly` set to `true`. \n>- If you want to limit the number of vouchers to be returned from the entire pool of eligible vouchers, set a `limit`. This will return vouchers sorted by `-created_at`, by default beginning with the most recent vouchers listed at the top.\n> - If you have a preference on the sorting order of the returned vouchers, you can use `order` to customize your response.\n\n ## Sending the request body payload\n\n\n ## Customer\n\nYou have the option of sending customer data via the dedicated `customer` object in the request body or a nested `customer` object within the `order` object.\n ### Available options:\n\n - You can either pass a customer `id` (Voucherify system generated),\n\n - a `source_id` (your own unique internal customer identifier e.g., email, database ID, CRM id), \n\n - a combination of the remaining parameters in the customer object, \n\n - a combination of customer `id` and remaining parameters excluding `source_id`, or\n\n - a combination of `source_id` and remaining parameters excluding `id`\n\n #### Note:\n\n For the latter two options, if you pass the `source_id` or the `id` with the other parameters, the logic will run independently for parameters explicitly passed in the request body versus those not explicitly passed in the request body. For _parameters not explicitly listed in the payload_, the verification will be against the data stored for that customer in the system. On the other hand, for any _parameter values explicitly passed in the payload_, the logic will ignore those stored in the system and will use the new values provided in the qualification request body. \n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule). \n\n## Order\n\n ### Available options:\n\n - You can either pass an order `id` (Voucherify system generated),\n\n - a `source_id` (your own unique internal order identifier), \n\n - a combination of the remaining parameters in the order object, \n\n - a combination of order `id` and remaining parameters excluding `source_id`, or\n\n - a combination of `source_id` and remaining parameters excluding `id`\n\n #### Note:\n\n For the latter two options, if you pass the `source_id` or the `id` with the other parameters, the logic will run independently for parameters explicitly passed in the request body versus those not explicitly passed in the request body. For _parameters not explicitly listed in the payload_, the verification will be against the data stored for that order in the system. On the other hand, for any _parameter values explicitly passed in the payload_, the logic will ignore those stored in the system and will use the new values provided in the qualification request body. \n\n The qualification runs against rules that are defined through the [Create Validation Rules](ref:create-validation-rules) endpoint or via the Dashboard. [Read more](https://support.voucherify.io/article/148-how-to-build-a-rule).\n\n## Guidelines:\n\nTo validate against vouchers with total order `amount` requirements, make sure to include the total order `amount` in the order object or alternatively the `amount` for _every_ order item (the application will then add each amount to get the total and perform the qualification checks). If the total order `amount` is provided along with the individual items' amounts, the total order `amount` will take precedence.\n\n\n| **Case** | **Order-Level Parameter Included** | **Item-Level Parameter Included** | **Precedence** | **Calculation Result** | **Parameter included in payload accounts for checks against requirements in these validation rules** |\n|:---:|:---:|:---:|:---:|---|---|\n| **1** | `amount` | `amount` | Order-level | Uses order-level `amount` | - Total order amount |\n| **2** | | `amount` | Item-level | Sums each item-level `amount` | - Total order amount
                  - subtotal of matched items |\n| **3** | | `price`
                  `quantity` | Item-level | Multiplies each item's (`price` x `quantity`) to get item `amount` and then adds each item's `amount` to get total order `amount` | - Total order amount
                  - Subtotal of matched items
                  - Unit price of any matching order line
                  - Price of each item/Price of any item |\n| **4** | | `amount`
                  `price`
                  `quantity` | Item-level `amount` | Uses item-level `amount` for total order `amount` calculation, ignores (`price` x `quantity`) calculation | - Total order amount (uses item `amount` if provided or `price` x `quantity` for items without `amount` property; `amount` takes precedence in case all 3 properties are provided for an item)
                  - Subtotal of matched items (uses item `amount`, takes precedence if all 3 properties are provided)
                  - Unit price of any matching order line
                  - Price of each item/Price of any item |\n| **5** | `amount` | `amount`
                  `price`
                  `quantity` | Order-level | Uses order-level `amount` for total order `amount` | - Total order amount (uses order-level `amount`).
                  - Subtotal of matched items (see case **4** for details).
                  - Unit price of any matching order line
                  - Price of each item/Price of any item |\n \n\n## Reward\n\n ## Gift Card", - "parameters": [ - { - "$ref": "#/components/parameters/audienceRulesOnly" - }, - { - "schema": { - "type": "integer", - "maximum": 50 - }, - "in": "query", - "name": "limit", - "description": "The number of vouchers to be qualified." + "name": "campaignId", + "in": "path", + "required": true, + "description": "The ID of an existing campaign to which you're importing the codes. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value." + } + ], + "post": { + "operationId": "import-vouchers-to-campaign", + "tags": [ + "CAMPAIGNS API" + ], + "summary": "Import Vouchers to Campaign", + "description": "Imports vouchers to an **existing** campaign.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Discount type, expiration date and the remaining attributes will be taken from the [Campaign](ref:get-campaign) settings.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_req_import_vouchers_to_campaign" + }, + "examples": { + "Example": { + "value": [ + { + "code": "CODE7", + "category": "First", + "redemption": { + "quantity": 1 + }, + "metadata": { + "season": "Fall" + }, + "additional_info": "secret-code1", + "active": true + }, + { + "code": "CODE8", + "category": "Second", + "redemption": { + "quantity": 18 + }, + "metadata": { + "season": "Fall" + }, + "additional_info": "secret-code1", + "active": true + }, + { + "code": "CODE9", + "category_id": "cat_0bb343dee3cdb5ec0c", + "redemption": { + "quantity": 4 + }, + "metadata": { + "season": "Fall" + }, + "additional_info": "secret-code1", + "active": true + } + ] }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at", - "code", - "-code" - ] - }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash `-` means sorting in a descending order." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "required": true, - "description": "Should contain given customer and context such as an order.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_req_vouchers_qualification" + "Gift Cards": { + "value": [ + { + "code": "CODE13", + "category": "First", + "redemption": { + "quantity": 1 + }, + "metadata": { + "season": "Fall" + }, + "additional_info": "secret-code1", + "gift": { + "amount": 500 + }, + "active": true }, - "examples": { - "Example": { - "value": { - "customer": { - "source_id": "source-id", - "metadata": { - "key": "value" - } - }, - "order": { - "amount": 10000, - "items": [ - { - "product_id": "product-id", - "quantity": "1", - "price": 10000, - "related_object": "product", - "product": { - "metadata": { - "key": "value" - } - } - } - ] - }, - "metadata": { - "key": "value" - } - } + { + "code": "CODE14", + "category": "Second", + "redemption": { + "quantity": 18 }, - "Qualify product using product_id": { - "value": { - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" - }, - "order": { - "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", - "source_id": "string", - "amount": 10000, - "items": [ - { - "source_id": "product_1234", - "product_id": "prod_0a9f9aeddb019a42db", - "amount": 10000, - "quantity": 1, - "price": 10000, - "metadata": {}, - "related_object": "product", - "product": { - "source_id": "product_1234", - "name": "Phone", - "price": 10000, - "metadata": {} - } - } - ], - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" - }, - "referrer": {}, - "metadata": "string" - }, - "reward": { - "points": 0, - "assignment_id": "string", - "id": "string" - }, - "metadata": {} - } + "metadata": { + "season": "Fall" }, - "Qualify product using source_id": { - "value": { - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" - }, - "order": { - "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", - "source_id": "string", - "amount": 10000, - "items": [ - { - "source_id": "product_1234", - "product_id": "prod_0a9f9aeddb019a42db", - "amount": 10000, - "quantity": 1, - "price": 10000, - "metadata": {}, - "related_object": "product", - "product": { - "source_id": "product_1234", - "name": "Phone", - "price": 10000, - "metadata": {} - } - } - ], - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" - }, - "referrer": {}, - "metadata": "string" - }, - "reward": { - "points": 0, - "assignment_id": "string", - "id": "string" - }, - "metadata": {} - } + "additional_info": "secret-code1", + "gift": { + "amount": 2000 }, - "Qualify SKU using sku_id": { - "value": { - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" - }, - "order": { - "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", - "source_id": "string", - "amount": 10000, - "items": [ - { - "source_id": "product_1234", - "product_id": "prod_0a9f9aeddb019a42db", - "amount": 10000, - "quantity": 1, - "price": 10000, - "metadata": {}, - "related_object": "product", - "product": { - "source_id": "product_1234", - "name": "Phone", - "price": 10000, - "metadata": {} - } - } - ], - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" - }, - "referrer": {}, - "metadata": "string" - }, - "reward": { - "points": 0, - "assignment_id": "string", - "id": "string" - }, - "metadata": {} - } + "active": true + }, + { + "code": "CODE15", + "category_id": "cat_0bb343dee3cdb5ec0c", + "redemption": { + "quantity": 4 }, - "Qualify SKU using source_id": { - "value": { - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" - }, - "order": { - "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", - "source_id": "string", - "amount": 10000, - "items": [ - { - "source_id": "product_1234", - "product_id": "prod_0a9f9aeddb019a42db", - "amount": 10000, - "quantity": 1, - "price": 10000, - "metadata": {}, - "related_object": "product", - "product": { - "source_id": "product_1234", - "name": "Phone", - "price": 10000, - "metadata": {} - } - } - ], - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" - }, - "referrer": {}, - "metadata": "string" - }, - "reward": { - "points": 0, - "assignment_id": "string", - "id": "string" - }, - "metadata": {} - } + "metadata": { + "season": "Fall" }, - "Qualify redemption metadata": { - "value": { - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" - }, - "order": { - "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", - "source_id": "string", - "amount": 10000, - "items": [ - { - "source_id": "product_1234", - "product_id": "prod_0a9f9aeddb019a42db", - "amount": 10000, - "quantity": 1, - "price": 10000, - "metadata": {}, - "related_object": "product", - "product": { - "source_id": "product_1234", - "name": "Phone", - "price": 10000, - "metadata": {} - } - } - ], - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" - }, - "referrer": {}, - "metadata": "string" - }, - "reward": { - "points": 0, - "assignment_id": "string", - "id": "string" - }, - "metadata": {} - } + "additional_info": "secret-code1", + "active": false + } + ] + }, + "Loyalty Cards": { + "value": [ + { + "code": "CODE10", + "category": "First", + "redemption": { + "quantity": 1 }, - "Qualify order line item metadata": { - "value": { - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" - }, - "order": { - "id": "ord_gqj1QYW2j2A1E3Ula2YjdPf4", - "source_id": "string", - "amount": 10000, - "items": [ - { - "source_id": "product_1234", - "product_id": "prod_0a9f9aeddb019a42db", - "amount": 10000, - "quantity": 1, - "price": 10000, - "metadata": {}, - "related_object": "product", - "product": { - "source_id": "product_1234", - "name": "Phone", - "price": 10000, - "metadata": {} - } - } - ], - "customer": { - "id": "cust_J1CDUdbqn5Exva8ASWk1Fq0j", - "source_id": "firstname.lastname@mycompany.com", - "name": "FirstName LastName", - "email": "firstname.lastname@mycompany.com", - "phone": "string", - "address": { - "city": "New York", - "country": "United States of America", - "postal_code": "10001", - "state": "NY" - }, - "metadata": {}, - "birthdate": "YYYY-MM-DD" - }, - "referrer": {}, - "metadata": "string" - }, - "reward": { - "points": 0, - "assignment_id": "string", - "id": "string" - }, - "metadata": {} - } - } + "metadata": { + "season": "Fall" + }, + "additional_info": "secret-code1", + "loyalty_card": { + "points": 300 + }, + "active": true + }, + { + "code": "CODE11", + "category": "Second", + "redemption": { + "quantity": 18 + }, + "metadata": { + "season": "Fall" + }, + "additional_info": "secret-code1", + "loyalty_card": { + "points": 2000 + }, + "active": true + }, + { + "code": "CODE12", + "category_id": "cat_0bb343dee3cdb5ec0c", + "redemption": { + "quantity": 4 + }, + "metadata": { + "season": "Fall" + }, + "additional_info": "secret-code1", + "active": true } - } + ] } - }, - "responses": { - "200": { - "description": "This operation returns the list of valid and active vouchers based on the qualification of given context (e.g., customer profile, redemptions metadata, order).", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_res_vouchers_qualification" - } - } + } + } + } + }, + "responses": { + "202": { + "description": "Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the vouchers will be imported 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](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" + }, + "examples": { + "Example": { + "$ref": "#/components/examples/res_async_actions" } } } } }, - "/v1/vouchers/bulk/async": { - "post": { - "operationId": "update-vouchers-in-bulk", - "tags": [ - "VOUCHERS API" - ], - "summary": "Update Vouchers in bulk", - "description": "Use this endpoint to update specific metadata parameters for each code, respectively. You can update each code's metadata property separately. \n\n- Update up to **100 records** in one request.\n- Upserts are not supported. \n\n> 🚧 \n> \n> Currently only **metadata** updates are supported.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "required": true, - "description": "List of objects, each containing a code that is being updated and the metadata key/value pairs for that code.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_req_vouchers_bulk_async" + "400": { + "description": "Returns an error if the request includes incorrect data, e.g. a wrong data type or duplicated codes.", + "content": { + "application/json": { + "schema": { + "anyOf": [ + { + "$ref": "#/components/schemas/e_400_invalid_voucher" }, - "examples": { - "Example": { - "value": [ - { - "code": "example_code", - "metadata": { - "lang": "en", - "test": false, - "MetadataTest": "Update metadata", - "update_value": 1, - "next_update_date": "2022-11-11T09:00:00.000Z" - } - }, - { - "code": "example_code2", - "metadata": { - "lang": "pl", - "test": false, - "MetadataTest": "Update metadata", - "update_value": 2 - } - } - ] - } + { + "$ref": "#/components/schemas/e_400_duplicate_key" } - } - } - }, - "responses": { - "202": { - "description": "Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the voucher(s) will be updated in the repository asynchronously. To check the status and result, copy the `async_action_id` from the response and pass it using [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" - }, - "examples": { - "Example": { - "$ref": "#/components/examples/res_async_actions" - } - } + ] + }, + "examples": { + "Duplicate Codes": { + "value": { + "code": 400, + "key": "duplicate_key", + "message": "Duplicate codes", + "details": "2 voucher codes(s) already exist.", + "request_id": "v-0adaccaba61502e4b3" + } + }, + "Missing Code": { + "value": { + "code": 400, + "key": "invalid_voucher", + "message": "Invalid Voucher", + "details": "Found 1 voucher(s) without 'code' value", + "request_id": "v-0bbc38ce088c8b2f9a" + } + }, + "Invalid Payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Property .redemption.quantity should be number,null", + "request_id": "v-0c545db3808418908f" } } } } } + } + } + } + }, + "/v1/campaigns/{campaignId}/importCSV": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value." + } + ], + "post": { + "operationId": "import-vouchers-to-campaign-using-csv", + "tags": [ + "CAMPAIGNS API" + ], + "summary": "Import Vouchers to Campaign by CSV", + "description": "Imports vouchers to an **existing** campaign. \n\n\nThe CSV file has to include headers in the first line. \n\nCurl Example\n\n```cURL\ncurl -X POST \\\n https://api.voucherify.io/v1/campaigns/TEST-CAMPAIGN/importCSV \\\n -F file=@/path/to/campaigns.csv \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\"\n```\n\nYou can import values for the following fields: `Code` (**required**), `Category`, `Active`. In a gift cards import, you can also include the current card balance using the `Gift Amount` header and the amount that was redeemed using the `Redeemed Amount` header. In a loyalty cards import, you can also include the current loyalty card score in points using the `Loyalty Points` header. Remaining CSV columns will be mapped to metadata properties. \n\nDiscount type, time limits, and validation rules will be taken from the [campaign object](ref:get-campaign) settings. \n\n\n| **Active** | **Code** | **Loyalty Points** | **Gift Amount** | **Redeemed Amount** | **Redeemed Quantity** | **Category** | **Custom_metadata_property** |\n|---|---|---|---|---|---|---|---|\n| Use `true` or `false` to enable or disable the voucher; this flag can be used to turn off the ability to redeem a voucher even though it is within the campaign's start/end validity timeframe. | The unique voucher code. | The number of points to be added to the loyalty card. If you leave this undefined, then the initial number of points will be set according to the campaign settings.
                  Context: `LOYALTY_PROGRAM` | The initial gift card balance.
                  Context: `GIFT_VOUCHERS` | The amount that was redeemed from the available balance on a gift card. | The number of times the voucher has been redeemed. | A custom tag for the voucher to help you filter codes; you can either import the category name or a unique Voucherify-assigned category ID. | Any additional data that you would like to store for the given loyalty card as a Custom attribute. Remember to define the metadata schema in the Dashboard prior to importing codes. |\n|\n\n> 📘 Active\n>\n> The CSV file is allowed in two versions; either with or without a column titled `Active`. It indicates whether the voucher is enabled after the import event. \n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/a_req_importCSV" + } + } }, - "/v1/vouchers/metadata/async": { - "post": { - "operationId": "update-vouchers-metadata-in-bulk", - "tags": [ - "VOUCHERS API" - ], - "summary": "Update Vouchers' metadata in bulk", - "description": "Use this endpoint to update the same metadata parameters for a list of codes. \nUpdate up to **100 records** in one request. Upserts are not supported. \n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + "description": "The file path is stored in the form `file` header." + }, + "responses": { + "200": { + "description": "Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the vouchers will be imported 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](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" + }, + "examples": { + "Example": { + "$ref": "#/components/examples/res_async_actions" + } } - ], - "requestBody": { - "required": true, - "description": "Request to update vouchers metadata in bulk. Provide an array of voucher codes in the `codes` parameter along with the `metadata` object. The `metadata` object should contain the key value pairs that you would like to update for all the vouchers included in the `codes` parameter.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_req_vouchers_metadata_async" - }, - "examples": { - "Example": { - "value": { - "codes": [ - "PROMO-CODE810", - "PROMO-CODE726" - ], - "metadata": { - "lang": "en", - "authorized_internally": true - } - } - } + } + } + }, + "404": { + "description": "Returns an error if the campaign cannot be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Example": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id camp_FZL4iTTdZw36nZOoXYQ172fQ", + "request_id": "v-0bc26adad888b6fed1", + "resource_id": "camp_FZL4iTTdZw36nZOoXYQ172fQ", + "resource_type": "campaign" } } } + } + } + } + } + } + }, + "/v1/campaigns/qualification": { + "post": { + "operationId": "examine-campaigns-qualification", + "deprecated": true, + "tags": [ + "CAMPAIGNS API" + ], + "summary": "Examine Qualification [Deprecated]", + "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for qualification, and we do not recommend using it. The new [Qualifications API](ref:examine-qualification) introduces additional features and improvements while maintaining backward compatibility. 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. \n\nThe method can be used for sending a request to display all campaigns qualified to the given customer and context (e.g., order). \n\nThe maximum number of **returned campaigns is 50**.\n\n## What campaign types are included in the response?\n\n- `DISCOUNT_COUPONS`\n- `GIFT_VOUCHERS`\n- `REFERRAL_PROGRAM`\n\n## What's excluded?\n\nA checking logic will be run only among campaigns and will ignore _standalone vouchers_. For standalone vouchers, you should run a [dedicated endpoint](ref:examine-vouchers-qualification) for searching and identifing vouchers. \n\n## Subsequent Steps\n\nAs a recommended subsequent step after selecting a qualified campaign is to publish a voucher code from that campaign. The [API method for publishing](ref:create-publication) will return a unique code which will belong to a given customer.\n\n## Sample use case\n\nAs a sample use case, you can imagine a requirement of displaying coupons (grouped in campaigns) that a customer is eligible to use. The customer should get assigned to the particular voucher from the campaign and then may redeem that particular code when he/she places an order.\n\n[Read](doc:checking-eligibility-for-coupons) about Qualification API limits before you start.", + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "audienceRulesOnly", + "description": "This parameter set to true will ask only for verifying vouchers' validation rules only against conditions applied to audiences' attributes (belonging into segment and Customer metadata)" + }, + { + "schema": { + "type": "integer", + "maximum": 50 + }, + "in": "query", + "name": "limit", + "description": "The number of campaigns to be qualified. The maximum number is 50." + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at", + "type", + "-type", + "code", + "-code", + "category", + "-category", + "campaign", + "-campaign" + ] + }, + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash `-` means sorting in a descending order." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_req_examine_qualification" }, - "responses": { - "202": { - "description": "Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the voucher(s) will be updated in the repository asynchronously. To check the status and result, copy the `async_action_id` from the response and pass it using [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" - }, - "examples": { - "Example": { - "$ref": "#/components/examples/res_async_actions" - } + "examples": { + "Example": { + "value": { + "customer": { + "source_id": "source-id", + "metadata": { + "key": "value" } - } - } - }, - "400": { - "description": "Returns an error indicating the reason for an unsuccessfull operation.", - "content": { - "application/json": { - "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/e_400_invalid_payload" - }, - { - "$ref": "#/components/schemas/e_400_not_enough_codes" - }, - { - "$ref": "#/components/schemas/e_400_metadata_validation_failed" - } - ], - "discriminator": { - "propertyName": "key" - } - }, - "examples": { - "Not enough codes": { - "value": { - "code": 400, - "key": "not_enough_codes", - "message": "Not enough codes", - "details": "Specify at least 1 code in codes.", - "request_id": "v-0c4b067a8f161e120f" + }, + "order": { + "amount": 10000, + "items": [ + { + "product_id": "product-id", + "quantity": "1", + "price": 10000, + "related_object": "product", + "product": { + "metadata": { + "key": "value" + } } } - } + ] + }, + "metadata": { + "key": "value" } } } } } + } + }, + "responses": { + "200": { + "description": "This operation returns the list of valid and active campaigns based on the qualification of a given context (e.g., customer profile, redemptions metadata, order).\n\n[Read](doc:checking-eligibility-for-coupons) about Qualification API limits before you start.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/2_res_examine_qualification" + } + } + } + } + } + } + }, + "/v1/campaigns/{campaignId}/enable": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" }, - "/v1/vouchers/{code}/sessions/{sessionKey}": { - "parameters": [ - { - "name": "code", - "in": "path", + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value." + } + ], + "post": { + "operationId": "enable-campaign", + "tags": [ + "CAMPAIGNS API" + ], + "summary": "Enable Campaign", + "description": "There are various times when you'll want to manage a campaign's accessibility. This can be done by two API methods for managing the campaign state - *enable* and *disable*. \n\nSets campaign state to **active**. The vouchers in this campaign can be redeemed - only if the redemption occurs after the start date of the campaign and voucher and the voucher and campaign are not expired.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns an empty json `{}`.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "7fjWdr" + "$ref": "#/components/schemas/res_empty_json" }, - "description": "A **code** that identifies the voucher or a unique voucher ID assigned by Voucherify.", - "required": true - }, - { + "examples": { + "Empty JSON": { + "value": {} + } + } + } + } + }, + "404": { + "description": "Returns an error if the campaign cannot be found.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" + "$ref": "#/components/schemas/e_404_not_found" }, - "name": "sessionKey", - "in": "path", - "required": true, - "description": "A unique session identifier." - } - ], - "delete": { - "operationId": "release-validation-session", - "tags": [ - "VOUCHERS API" - ], - "summary": "Release Validation Session", - "description": "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](doc:locking-validation-session). \n\n> 📘 Release Session using Dashboard\n>\n> You can also use the Validations Manager in the Dashboard to unlock sessions. [Read more](https://support.voucherify.io/article/16-dashboard-sections#validations).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id camp_h8RyP6FV94F3Ev2odP24j5p", + "request_id": "v-0adaf4847c9502879b", + "resource_id": "camp_h8RyP6FV94F3Ev2odP24j5p", + "resource_type": "campaign" + } + } } - ], - "responses": { - "204": { - "description": "Returns no content if the validation session was released successfully." + } + } + } + } + } + }, + "/v1/campaigns/{campaignId}/disable": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the campaign being disabled. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value." + } + ], + "post": { + "operationId": "disable-campaign", + "tags": [ + "CAMPAIGNS API" + ], + "summary": "Disable Campaign", + "description": "There are various times when you'll want to manage a campaign's accessibility. This can be done by two API methods for managing the campaign state - *enable* and *disable*. \n\nSets campaign state to **inactive**. The vouchers in this campaign can no longer be redeemed.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns an empty json `{}`.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/res_empty_json" + }, + "examples": { + "Empty JSON": { + "value": {} + } } } } }, - "/v1/campaign-object": { - "get": { - "operationId": "campaign-object", - "tags": [ - "CAMPAIGNS API" - ], - "summary": "Campaign Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Campaign Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_obj_campaign_object" - } + "404": { + "description": "Returns an error if the campaign cannot be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id Spring Campaign", + "request_id": "v-0adaf3735116bb298b", + "resource_id": "Spring Campaign", + "resource_type": "campaign" } } } } } - }, - "/v1/campaigns": { - "post": { - "operationId": "create-campaign", - "tags": [ - "CAMPAIGNS API", - "PROMOTIONS API" - ], - "summary": "Create Campaign", - "description": "Method to create a batch of vouchers aggregated in one campaign. You can choose a variety of voucher types and define a unique pattern for generating codes. \n\n\n> 📘 Global uniqueness\n>\n> All campaign codes are unique across the whole project. Voucherify will not allow you to generate 2 campaigns with the same coupon code. \n\n> 🚧 Code generation status\n>\n> This is an asynchronous action; you can't read or modify a newly created campaign until the code generation is completed. See the `creation_status` field in the [campaign object](ref:get-campaign) description.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + } + } + } + }, + "/v1/promotion-tier-object": { + "get": { + "operationId": "promotion-tier-object", + "tags": [ + "PROMOTIONS API" + ], + "summary": "Promotion Tier Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Promotion Tier Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_obj_promotion_tier_object" } - ], - "requestBody": { - "description": "Specify the details of the campaign that you would like to create.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_req_create_campaign" - }, - "examples": { - "Discount Campaign": { - "value": { - "name": "Discount Campaign 4", - "campaign_type": "DISCOUNT_COUPONS", - "join_once": true, - "type": "AUTO_UPDATE", - "category_id": "cat_0bb343dee3cdb5ec0c", - "start_date": "2020-08-16T00:00:00Z", - "expiration_date": "2023-12-26T00:00:00Z", - "vouchers_count": 3, - "voucher": { - "type": "DISCOUNT_VOUCHER", - "discount": { - "percent_off": 10, - "type": "PERCENT" - }, - "redemption": { - "quantity": 10 - }, - "code_config": { - "pattern": "10OFF-#######" + } + } + } + } + } + }, + "/v1/promotions/tiers": { + "get": { + "operationId": "list-promotion-tiers", + "tags": [ + "PROMOTIONS API" + ], + "summary": "List Promotion Tiers", + "description": "This method enables you to list promotion tiers.", + "parameters": [ + { + "schema": { + "type": "boolean" + }, + "in": "query", + "name": "is_available", + "description": "This parameter allows filtering promotions that are only available at the moment. When set to `true`, it selects only non-expired and active promotions." + }, + { + "schema": { + "type": "integer" + }, + "in": "query", + "name": "limit", + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "description": "Which page of results to return.", + "name": "page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + }, + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with a `tiers` property that contains an array of promotion tiers.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_res_list_promotion_tiers" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "tiers", + "tiers": [ + { + "id": "promo_NzjTc3ZXTe7md5SziK3uYtei", + "created_at": "2022-09-21T11:38:34.962Z", + "name": "Order more than $100", + "banner": "Order more than $100", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 3000, + "effect": "APPLY_TO_ORDER" } }, + "metadata": {}, + "hierarchy": 1, + "promotion_id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "campaign": { + "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": { + "interval": "P3D", + "duration": "P2D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": true, + "category_id": "cat_0bb81a481615a37b5e", + "object": "campaign" + }, + "campaign_id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "active": true, + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" + "interval": "P3D", + "duration": "P2D" }, "validity_day_of_week": [ - 0, 1, 2 ], - "activity_duration_after_publishing": "P24D", - "use_voucher_metadata_schema": false, - "metadata": { - "region": "AMER" - } - } - }, - "Gift Card Campaign": { - "value": { - "name": "Gift Card Campaign", - "campaign_type": "GIFT_VOUCHERS", - "join_once": true, - "type": "AUTO_UPDATE", - "category_id": "cat_0bb343dee3cdb5ec0c", - "start_date": "2020-08-16T00:00:00Z", - "expiration_date": "2023-12-26T00:00:00Z", - "vouchers_count": 2, - "voucher": { - "type": "GIFT_VOUCHER", - "gift": { - "amount": 1000, - "effect": "APPLY_TO_ORDER" - }, - "redemption": { - "quantity": 10 + "summary": { + "redemptions": { + "total_redeemed": 0 }, - "code_config": { - "pattern": "GIFT-CARD-#######" + "orders": { + "total_amount": 0, + "total_discount_amount": 0 } }, - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" + "object": "promotion_tier", + "validation_rule_assignments": null + }, + { + "id": "promo_RaYHtUBre5jU8frUXOvYBtlN", + "created_at": "2021-12-15T11:34:01.358Z", + "updated_at": "2022-02-09T09:20:08.619Z", + "name": "Hot Promotion - Tier 2", + "banner": "Get Tier 2 Discount $20 Off", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 2000, + "effect": "APPLY_TO_ORDER" + } }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "activity_duration_after_publishing": "P24D", - "use_voucher_metadata_schema": false, - "metadata": { - "region": "APAC" - } - } - }, - "Loyalty Program": { - "value": { - "name": "Loyalty Campaign", - "campaign_type": "LOYALTY_PROGRAM", - "auto_join": true, - "join_once": true, - "type": "AUTO_UPDATE", - "category_id": "cat_0bb343dee3cdb5ec0c", - "start_date": "2020-08-16T00:00:00Z", - "expiration_date": "2023-12-26T00:00:00Z", - "vouchers_count": 2, - "voucher": { - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 1000, - "expiration_rules": { - "period_type": "MONTH", - "period_value": 3, - "rounding_type": "END_OF_YEAR" - } - }, - "redemption": { - "quantity": 10 + "metadata": {}, + "hierarchy": 2, + "promotion_id": "camp_5h0wc453_5", + "campaign": { + "id": "camp_5h0wc453_5", + "start_date": null, + "expiration_date": null, + "active": true, + "category_id": "cat_0b688929a2476386a6", + "object": "campaign" + }, + "campaign_id": "camp_5h0wc453_5", + "active": true, + "summary": { + "redemptions": { + "total_redeemed": 33 }, - "code_config": { - "pattern": "LOYALTY-CARD-#######" + "orders": { + "total_amount": 519200, + "total_discount_amount": 66000 } }, - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "activity_duration_after_publishing": "P24D", - "use_voucher_metadata_schema": false, - "metadata": { - "region": "APAC" - } - } - }, - "Promotion": { - "value": { - "name": "Promotion - API - 4", - "campaign_type": "PROMOTION", - "type": "STATIC", - "category_id": "cat_0bb343dee3cdb5ec0c", - "use_voucher_metadata_schema": false, - "start_date": "2020-08-16T00:00:00Z", - "expiration_date": "2023-12-26T00:00:00Z", - "active": false, - "promotion": { - "tiers": [ - { - "name": "Percent Discount", - "banner": "Get 40% off", - "action": { - "discount": { - "type": "PERCENT", - "percent_off": 40, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": { - "level": "B" - }, - "active": false, - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4 - ], - "validation_rules": [ - "val_q8qUBMOh5qIQ" - ] - }, + "object": "promotion_tier", + "validation_rule_assignments": { + "object": "list", + "data_ref": "data", + "data": [ { - "name": "Order more than $100", - "banner": "Get $30 off", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 3000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": { - "level": "A" - }, - "active": false, - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4 - ], - "validation_rules": [ - "val_q8qUBMOh5qIQ" - ] + "id": "asgm_pEe1inoYSfmO12p7", + "rule_id": "val_5h0wc453_5", + "related_object_id": "promo_RaYHtUBre5jU8frUXOvYBtlN", + "related_object_type": "promotion_tier", + "created_at": "2021-12-15T11:34:01.358Z", + "object": "validation_rules_assignment" } - ] - }, - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" + ], + "total": 1 + } + }, + { + "id": "promo_63fYCt81Aw0h7lzyRkrGZh9p", + "created_at": "2021-12-15T11:34:01.333Z", + "updated_at": "2022-02-09T09:20:05.603Z", + "name": "Hot Promotion - Tier 1", + "banner": "Get Tier 1 Discount 10zl", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 1000, + "effect": "APPLY_TO_ORDER" + } }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "activity_duration_after_publishing": "P24D", "metadata": { - "region": "APAC" - } - } - }, - "Referral Program": { - "value": { - "name": "Referral Campaign 2", - "campaign_type": "REFERRAL_PROGRAM", - "join_once": true, - "type": "AUTO_UPDATE", - "category_id": "cat_0bb343dee3cdb5ec0c", - "start_date": "2020-08-16T00:00:00Z", - "expiration_date": "2023-12-26T00:00:00Z", - "vouchers_count": 2, - "referral_program": { - "conversion_event_type": "redemption" + "ProductionMetaData": "Hot Promotion - Tier 1" }, - "voucher": { - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "percent_off": 45, - "effect": "APPLY_TO_ORDER", - "amount_limit": 15 - }, - "redemption": { - "quantity": 10 - }, - "code_config": { - "pattern": "REFERRAL-CODE-#######" - }, - "is_referral_code": true + "hierarchy": 1, + "promotion_id": "camp_5h0wc453_5", + "campaign": { + "id": "camp_5h0wc453_5", + "start_date": null, + "expiration_date": null, + "active": true, + "category_id": "cat_0b688929a2476386a6", + "object": "campaign" }, - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" + "campaign_id": "camp_5h0wc453_5", + "active": true, + "summary": { + "redemptions": { + "total_redeemed": 11 + }, + "orders": { + "total_amount": 1414979, + "total_discount_amount": 11000 + } }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "activity_duration_after_publishing": "P24D", - "use_voucher_metadata_schema": false, - "metadata": { - "region": "APAC" + "object": "promotion_tier", + "validation_rule_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_QqYs7GGVy7cuh3L9", + "rule_id": "val_5h0wc453_4", + "related_object_id": "promo_63fYCt81Aw0h7lzyRkrGZh9p", + "related_object_type": "promotion_tier", + "created_at": "2021-12-15T11:34:01.333Z", + "object": "validation_rules_assignment" + } + ], + "total": 1 } } - } + ], + "total": 3 } } } - }, - "responses": { - "200": { - "description": "Returns a campaign object if the call succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_obj_campaign_object" - }, - "examples": { - "Discount Campaign": { - "value": { - "id": "camp_NdBCAQk1AAZcMcv6kt6X164Q", - "name": "Discount Campaign 4", - "campaign_type": "DISCOUNT_COUPONS", - "type": "AUTO_UPDATE", - "voucher": { - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "percent_off": 10 - }, - "redemption": { - "quantity": 10 - }, - "code_config": { - "length": 7, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "10OFF-#######" - }, - "is_referral_code": false, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - } - }, - "auto_join": false, - "join_once": true, - "use_voucher_metadata_schema": false, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", + } + } + } + } + } + }, + "/client/v1/promotions/tiers": { + "get": { + "operationId": "list-promotion-tiers-client-side", + "tags": [ + "PROMOTIONS API" + ], + "summary": "List Promotion Tiers (client-side)", + "description": "This method enables you to list promotion tiers.", + "parameters": [ + { + "schema": { + "type": "boolean" + }, + "in": "query", + "name": "is_available", + "description": "This parameter allows filtering promotions that are only available at the moment. When set to `true`, it selects only non-expired and active promotions." + }, + { + "schema": { + "type": "integer" + }, + "in": "query", + "name": "limit", + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "description": "Which page of results to return.", + "name": "page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + }, + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." + }, + { + "$ref": "#/components/parameters/origin" + } + ], + "security": [ + { + "X-Client-Application-Id-1": [], + "X-Client-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with a `tiers` property that contains an array of promotion tiers.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_res_list_promotion_tiers" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "tiers", + "tiers": [ + { + "id": "promo_NzjTc3ZXTe7md5SziK3uYtei", + "created_at": "2022-09-21T11:38:34.962Z", + "name": "Order more than $100", + "banner": "Order more than $100", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 3000, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": {}, + "hierarchy": 1, + "promotion_id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "campaign": { + "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" + "interval": "P3D", + "duration": "P2D" }, "validity_day_of_week": [ - 0, 1, - 2 + 2, + 3, + 4, + 5 ], - "activity_duration_after_publishing": "P24D", - "vouchers_count": 0, "active": true, - "metadata": { - "region": "AMER" - }, - "created_at": "2022-09-21T09:25:49.617Z", - "category": "First", - "creation_status": "IN_PROGRESS", - "vouchers_generation_status": "IN_PROGRESS", - "protected": false, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" - } - ], + "category_id": "cat_0bb81a481615a37b5e", "object": "campaign" - } - }, - "Gift Card Campaign": { - "value": { - "id": "camp_B2Gx83JsSbmvj05MOwxYbNm6", - "name": "Gift Card Campaign", - "campaign_type": "GIFT_VOUCHERS", - "type": "AUTO_UPDATE", - "voucher": { - "type": "GIFT_VOUCHER", - "gift": { - "amount": 1000, - "effect": "APPLY_TO_ORDER" - }, - "redemption": { - "quantity": 10 - }, - "code_config": { - "length": 7, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "GIFT-CARD-#######" - }, - "is_referral_code": false, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - } - }, - "auto_join": false, - "join_once": true, - "use_voucher_metadata_schema": false, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "activity_duration_after_publishing": "P24D", - "vouchers_count": 0, - "active": true, - "metadata": { - "region": "APAC" - }, - "created_at": "2022-09-21T09:31:16.266Z", - "category": "First", - "creation_status": "IN_PROGRESS", - "vouchers_generation_status": "IN_PROGRESS", - "protected": false, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 + }, + "campaign_id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "active": true, + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": { + "interval": "P3D", + "duration": "P2D" + }, + "validity_day_of_week": [ + 1, + 2 + ], + "summary": { + "redemptions": { + "total_redeemed": 0 }, - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" - } - ], - "object": "campaign" - } + "orders": { + "total_amount": 0, + "total_discount_amount": 0 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": null }, - "Loyalty Program": { - "value": { - "id": "camp_FZL4iTTdZw36nZOoXYQ172fQ", - "name": "Loyalty Campaign", - "campaign_type": "LOYALTY_PROGRAM", - "type": "AUTO_UPDATE", - "voucher": { - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 1000, - "expiration_rules": { - "period_type": "MONTH", - "period_value": 3, - "rounding_type": "END_OF_YEAR" - } - }, - "redemption": { - "quantity": 10 - }, - "code_config": { - "length": 7, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "LOYALTY-CARD-#######" - }, - "is_referral_code": false, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - } - }, - "auto_join": true, - "join_once": true, - "use_voucher_metadata_schema": false, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "activity_duration_after_publishing": "P24D", - "vouchers_count": 0, + { + "id": "promo_RaYHtUBre5jU8frUXOvYBtlN", + "created_at": "2021-12-15T11:34:01.358Z", + "updated_at": "2022-02-09T09:20:08.619Z", + "name": "Hot Promotion - Tier 2", + "banner": "Get Tier 2 Discount $20 Off", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 2000, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": {}, + "hierarchy": 2, + "promotion_id": "camp_5h0wc453_5", + "campaign": { + "id": "camp_5h0wc453_5", + "start_date": null, + "expiration_date": null, "active": true, - "metadata": { - "region": "APAC" - }, - "created_at": "2022-09-21T09:39:45.479Z", - "category": "First", - "creation_status": "IN_PROGRESS", - "vouchers_generation_status": "IN_PROGRESS", - "protected": false, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" - } - ], + "category_id": "cat_0b688929a2476386a6", "object": "campaign" - } - }, - "Promotion": { - "value": { - "id": "camp_ru1B8mQjY75KxXupt7RPZcb8", - "name": "Promotion - API - 4", - "campaign_type": "PROMOTION", - "type": "STATIC", - "auto_join": false, - "join_once": false, - "use_voucher_metadata_schema": false, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "activity_duration_after_publishing": "P24D", - "active": true, - "metadata": { - "region": "APAC" - }, - "created_at": "2022-09-23T08:54:38.281Z", - "category": "First", - "creation_status": "DONE", - "vouchers_generation_status": "DONE", - "protected": false, - "promotion": { - "object": "list", - "data_ref": "tiers", - "tiers": [ - { - "id": "promo_M4OfmMgSUyN12JPAw3l4hWjD", - "created_at": "2022-09-23T08:54:38.286Z", - "name": "Percent Discount", - "banner": "Get 40% off", - "action": { - "discount": { - "type": "PERCENT", - "percent_off": 40, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": { - "level": "B" - }, - "hierarchy": 1, - "promotion_id": "camp_ru1B8mQjY75KxXupt7RPZcb8", - "campaign": { - "id": "camp_ru1B8mQjY75KxXupt7RPZcb8", - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "active": true, - "category_id": "cat_0bb343dee3cdb5ec0c", - "object": "campaign" - }, - "campaign_id": "camp_ru1B8mQjY75KxXupt7RPZcb8", - "active": false, - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4 - ], - "summary": { - "redemptions": { - "total_redeemed": 0 - }, - "orders": { - "total_amount": 0, - "total_discount_amount": 0 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_dr3oXeN98YfiTF60", - "rule_id": "val_q8qUBMOh5qIQ", - "related_object_id": "promo_M4OfmMgSUyN12JPAw3l4hWjD", - "related_object_type": "promotion_tier", - "created_at": "2022-09-23T08:54:38.286Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - } - }, - { - "id": "promo_uMSxvzhxXDp3Ijs3659npqb2", - "created_at": "2022-09-23T08:54:38.314Z", - "name": "Order more than $100", - "banner": "Get $30 off", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 3000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": { - "level": "A" - }, - "hierarchy": 2, - "promotion_id": "camp_ru1B8mQjY75KxXupt7RPZcb8", - "campaign": { - "id": "camp_ru1B8mQjY75KxXupt7RPZcb8", - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "active": true, - "category_id": "cat_0bb343dee3cdb5ec0c", - "object": "campaign" - }, - "campaign_id": "camp_ru1B8mQjY75KxXupt7RPZcb8", - "active": false, - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4 - ], - "summary": { - "redemptions": { - "total_redeemed": 0 - }, - "orders": { - "total_amount": 0, - "total_discount_amount": 0 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_jgJlWms7GVK59iNR", - "rule_id": "val_q8qUBMOh5qIQ", - "related_object_id": "promo_uMSxvzhxXDp3Ijs3659npqb2", - "related_object_type": "promotion_tier", - "created_at": "2022-09-23T08:54:38.314Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - } - } - ], - "total": 2, - "has_more": false + }, + "campaign_id": "camp_5h0wc453_5", + "active": true, + "summary": { + "redemptions": { + "total_redeemed": 33 }, - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ + "orders": { + "total_amount": 519200, + "total_discount_amount": 66000 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": { + "object": "list", + "data_ref": "data", + "data": [ { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" + "id": "asgm_pEe1inoYSfmO12p7", + "rule_id": "val_5h0wc453_5", + "related_object_id": "promo_RaYHtUBre5jU8frUXOvYBtlN", + "related_object_type": "promotion_tier", + "created_at": "2021-12-15T11:34:01.358Z", + "object": "validation_rules_assignment" } ], - "object": "campaign" + "total": 1 } }, - "Referral Program": { - "value": { - "id": "camp_N8rztKAqOYIdFxNLr9eNIjyB", - "name": "Referral Campaign 2", - "campaign_type": "REFERRAL_PROGRAM", - "type": "AUTO_UPDATE", - "voucher": { - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "amount_limit": 15, - "percent_off": 45, - "effect": "APPLY_TO_ORDER" - }, - "redemption": { - "quantity": 10 - }, - "code_config": { - "length": 7, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "REFERRAL-CODE-#######" - }, - "is_referral_code": true, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - } - }, - "referral_program": { - "conversion_event_type": "redemption" - }, - "auto_join": false, - "join_once": true, - "use_voucher_metadata_schema": false, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "activity_duration_after_publishing": "P24D", - "vouchers_count": 0, - "active": true, - "metadata": { - "region": "APAC" - }, - "created_at": "2022-09-23T09:06:41.757Z", - "category": "First", - "creation_status": "IN_PROGRESS", - "vouchers_generation_status": "IN_PROGRESS", - "protected": false, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" - } - ], - "object": "campaign" - } - } - } - } - } - }, - "400": { - "description": "Returns an error if an incomplete request body is provided.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Example": { - "value": { - "code": 400, - "key": "invalid_campaign", - "message": "Invalid Campaign", - "details": "Property 'discount' is required for REFERRAL_PROGRAM campaign", - "request_id": "v-0bb99c9213425fa250" - } - } - } - } - } - }, - "404": { - "description": "When a payload value is not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find category with id cat_0bb343dee3cdb5ec0c", - "request_id": "v-0c55671ed1cb0f1a27", - "resource_id": "cat_0bb343dee3cdb5ec0c", - "resource_type": "category" - } - } - } - } - } - }, - "409": { - "description": "Returns an error if a campaign with the same name already exists.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" - }, - "examples": { - "Example": { - "value": { - "code": 409, - "key": "duplicate_found", - "message": "Duplicated resource found", - "details": "Duplicated campaign exists with name Discount Campaign", - "request_id": "v-0bb98f8c6552250aab", - "resource_id": "Discount Campaign", - "resource_type": "campaign" - } - } - } - } - } - } - } - }, - "get": { - "operationId": "list-campaigns", - "tags": [ - "CAMPAIGNS API" - ], - "summary": "List Campaigns", - "description": "Retrieve a list of campaigns in a project. \n\nThe campaigns are returned sorted by creation date, with the most recent campaigns appearing first. \n\nWhen you get a list of campaigns, you can optionally specify query parameters to customize the amount of campaigns returned per call using `limit`, which page of campaigns to return using `page`, sort the campaigns using the `order` query parameter and filter the results by the `campaign_type`.\n\nThis method will return an error when trying to return a limit of more than 100 campaigns.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "$ref": "#/components/parameters/campaign_type" - }, - { - "schema": { - "type": "string", - "default": "category" - }, - "in": "query", - "name": "expand", - "description": "Include an expanded `categories` object in the response." - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ] - }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary with a `campaign` property that contains an array of campaigns. The maximum number of campaigns returned is determined by the `limit` query parameter. Each entry in the array is a separate campaign object. If no more campaigns are available, the resulting array on a given page will be empty.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_res_list_campaigns" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "campaigns", - "campaigns": [ - { - "id": "camp_SibPsDRKQvg3SUtptgPZCNZb", - "name": "Voucher Metadata", - "campaign_type": "DISCOUNT_COUPONS", - "type": "AUTO_UPDATE", - "voucher": { - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "amount_limit": 4400, - "percent_off": 30, - "effect": "APPLY_TO_ORDER" - }, - "redemption": { - "quantity": null - }, - "code_config": { - "length": 9, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "#########", - "prefix": "Discount-", - "postfix": "YY" - }, - "is_referral_code": false, - "start_date": "2022-09-20T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P3D", - "duration": "P1D" - } - }, - "auto_join": false, - "join_once": false, - "use_voucher_metadata_schema": false, - "start_date": "2022-09-20T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P3D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4 - ], - "activity_duration_after_publishing": "P24D", - "vouchers_count": 1, - "active": true, - "metadata": { - "region": "AMER" - }, - "created_at": "2022-09-20T09:32:29.530Z", - "creation_status": "DONE", - "vouchers_generation_status": "DONE", - "protected": false, - "category_id": null, - "object": "campaign" - }, - { - "id": "camp_HgsbCKauXmEoPnnh8aas0ISe", - "name": "Static Campaign", - "campaign_type": "DISCOUNT_COUPONS", - "type": "STATIC", - "voucher": { - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 3000, - "effect": "APPLY_TO_ORDER" - }, - "redemption": { - "quantity": 1 - }, - "code_config": { - "length": 8, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "########" - }, - "is_referral_code": false - }, - "auto_join": false, - "join_once": true, - "use_voucher_metadata_schema": true, - "vouchers_count": 1, - "active": true, - "metadata": {}, - "created_at": "2022-09-20T07:52:34.499Z", - "updated_at": "2022-09-20T11:38:13.501Z", - "creation_status": "DONE", - "vouchers_generation_status": "DONE", - "protected": false, - "category_id": null, - "object": "campaign" - }, - { - "id": "camp_f7fBbQxUuTN7dI7tGOo5XMDA", - "name": "Loyalty Program Fall 2022", - "campaign_type": "LOYALTY_PROGRAM", - "type": "AUTO_UPDATE", - "voucher": { - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 0, - "expiration_rules": { - "period_type": "MONTH", - "period_value": 7, - "rounding_type": "END_OF_YEAR" - } - }, - "redemption": { - "quantity": null - }, - "code_config": { - "length": 8, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "########", - "prefix": "LOYALTY-CARD-" - }, - "is_referral_code": false - }, - "auto_join": true, - "join_once": true, - "use_voucher_metadata_schema": true, - "vouchers_count": 1, - "active": true, - "metadata": {}, - "created_at": "2022-09-19T07:56:22.103Z", - "creation_status": "DONE", - "vouchers_generation_status": "DONE", - "protected": false, - "category_id": "cat_0bb343dee3cdb5ec0c", - "object": "campaign" - }, - { - "id": "camp_4tHsQEDUOER6PeW8SoMdnHH6", - "name": "Dynamic Discounts", - "campaign_type": "DISCOUNT_COUPONS", - "type": "AUTO_UPDATE", - "voucher": { - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "percent_off": 5, - "percent_off_formula": "IF(ORDER_AMOUNT > 300;15;5)", - "effect": "APPLY_TO_ORDER" - }, - "redemption": { - "quantity": null - }, - "code_config": { - "length": 8, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "########", - "prefix": "DYNAMIC-" - }, - "is_referral_code": false - }, - "auto_join": false, - "join_once": false, - "use_voucher_metadata_schema": true, - "vouchers_count": 1, - "active": true, - "metadata": { - "marketing_text": "Purchases above $300 are eligible for a 15% discount." - }, - "created_at": "2022-07-12T15:12:02.575Z", - "updated_at": "2022-07-20T10:48:05.617Z", - "category": "test", - "creation_status": "DONE", - "vouchers_generation_status": "DONE", - "protected": false, - "category_id": "cat_0b688929a2476386a8", - "object": "campaign" - }, - { - "id": "camp_JlsseNSDO7l4neFtev6p6945", - "name": "$20 OFF Entire Order", - "campaign_type": "DISCOUNT_COUPONS", - "type": "AUTO_UPDATE", - "voucher": { - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 2000, - "effect": "APPLY_TO_ORDER" - }, - "redemption": { - "quantity": null - }, - "code_config": { - "length": 8, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "########", - "prefix": "$20OFFORDER-" - }, - "is_referral_code": false - }, - "auto_join": false, - "join_once": false, - "use_voucher_metadata_schema": true, - "vouchers_count": 1, - "active": true, - "metadata": {}, - "created_at": "2022-07-11T09:43:36.057Z", - "creation_status": "DONE", - "vouchers_generation_status": "DONE", - "protected": false, - "category_id": null, - "object": "campaign" - }, + { + "id": "promo_63fYCt81Aw0h7lzyRkrGZh9p", + "created_at": "2021-12-15T11:34:01.333Z", + "updated_at": "2022-02-09T09:20:05.603Z", + "name": "Hot Promotion - Tier 1", + "banner": "Get Tier 1 Discount 10zl", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 1000, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": { + "ProductionMetaData": "Hot Promotion - Tier 1" + }, + "hierarchy": 1, + "promotion_id": "camp_5h0wc453_5", + "campaign": { + "id": "camp_5h0wc453_5", + "start_date": null, + "expiration_date": null, + "active": true, + "category_id": "cat_0b688929a2476386a6", + "object": "campaign" + }, + "campaign_id": "camp_5h0wc453_5", + "active": true, + "summary": { + "redemptions": { + "total_redeemed": 11 + }, + "orders": { + "total_amount": 1414979, + "total_discount_amount": 11000 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": { + "object": "list", + "data_ref": "data", + "data": [ { - "id": "camp_Uj3cNbWSgt7Zl4AyHM7Sa5Qk", - "name": "3% OFF Entire Order", - "campaign_type": "DISCOUNT_COUPONS", - "type": "AUTO_UPDATE", - "voucher": { - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "percent_off": 3, - "effect": "APPLY_TO_ORDER" - }, - "redemption": { - "quantity": null - }, - "code_config": { - "length": 8, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "########", - "prefix": "3%OFFORDER-" - }, - "is_referral_code": false - }, - "auto_join": false, - "join_once": false, - "use_voucher_metadata_schema": true, - "vouchers_count": 1, - "active": true, - "metadata": {}, - "created_at": "2022-07-11T09:41:12.087Z", - "creation_status": "DONE", - "vouchers_generation_status": "DONE", - "protected": false, - "category_id": null, - "object": "campaign" + "id": "asgm_QqYs7GGVy7cuh3L9", + "rule_id": "val_5h0wc453_4", + "related_object_id": "promo_63fYCt81Aw0h7lzyRkrGZh9p", + "related_object_type": "promotion_tier", + "created_at": "2021-12-15T11:34:01.333Z", + "object": "validation_rules_assignment" } ], - "total": 6 + "total": 1 } } - } + ], + "total": 3 } } } } } + } + } + } + }, + "/v1/promotions/{campaignId}/tiers": { + "parameters": [ + { + "schema": { + "type": "string" }, - "/v1/campaigns/{campaignId}": { - "parameters": [ - { - "in": "path", - "name": "campaignId", - "description": "You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value.", + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID assigned by Voucherify." + } + ], + "get": { + "operationId": "list-promotion-tiers-from-campaign", + "tags": [ + "PROMOTIONS API" + ], + "summary": "List Promotion Tiers from Campaign", + "description": "This method enables you to list promotion tiers from a specified campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with a `tiers` property that contains an array of promotion tiers.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" + "$ref": "#/components/schemas/3_res_list_promotion_tiers_from_campaign" }, - "required": true - } - ], - "get": { - "operationId": "get-campaign", - "tags": [ - "CAMPAIGNS API" - ], - "summary": "Get Campaign", - "description": "Retrieves the campaign with the given campaign ID or campaign name.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a campaign object if a valid identifier was provided.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_obj_campaign_object" - }, - "examples": { - "Example": { - "value": { - "id": "camp_JlsseNSDO7l4neFtev6p6945", - "name": "$20 OFF Entire Order", - "campaign_type": "DISCOUNT_COUPONS", - "type": "AUTO_UPDATE", - "voucher": { - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 2000, - "effect": "APPLY_TO_ORDER" - }, - "redemption": { - "quantity": null - }, - "code_config": { - "length": 8, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "########", - "prefix": "$20OFFORDER-" - }, - "is_referral_code": false - }, - "auto_join": false, - "join_once": false, - "use_voucher_metadata_schema": true, - "vouchers_count": 1, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "tiers", + "tiers": [ + { + "id": "promo_xyOKjAmysZrwt3aqq1dMUwMU", + "created_at": "2022-04-07T08:43:53.730Z", + "updated_at": "2022-08-26T05:22:43.220Z", + "name": "Amount", + "banner": "Get $10 off entire order", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 1000, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": {}, + "hierarchy": 2, + "promotion_id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", + "campaign": { + "id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", + "start_date": null, + "expiration_date": null, "active": true, - "metadata": {}, - "created_at": "2022-07-11T09:43:36.057Z", - "creation_status": "DONE", - "vouchers_generation_status": "DONE", - "protected": false, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 + "category_id": "cat_0b5f67863083bf7c05", + "object": "campaign" + }, + "campaign_id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", + "active": true, + "summary": { + "redemptions": { + "total_redeemed": 1 }, - "category_id": null, + "orders": { + "total_amount": 2187, + "total_discount_amount": 1000 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": null + }, + { + "id": "promo_CQonGnrsFAdEJfJQ3oKB3a8G", + "created_at": "2022-04-07T08:43:53.581Z", + "updated_at": "2022-08-26T05:22:43.008Z", + "name": "Percentage", + "banner": "Get 10% OFF on entire order", + "action": { + "discount": { + "type": "PERCENT", + "percent_off": 10, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": {}, + "hierarchy": 1, + "promotion_id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", + "campaign": { + "id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", + "start_date": null, + "expiration_date": null, + "active": true, + "category_id": "cat_0b5f67863083bf7c05", "object": "campaign" - } - } - } - } - } - }, - "404": { - "description": "Returns an error when requesting the campaign that has been deleted or cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id camp_jcErmtGAOmHUAy0oUgkwKnP", - "request_id": "v-0bb8694614d58bf2a8", - "resource_id": "camp_jcErmtGAOmHUAy0oUgkwKnP", - "resource_type": "campaign" - } + }, + "campaign_id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", + "active": true, + "summary": { + "redemptions": { + "total_redeemed": 1 + }, + "orders": { + "total_amount": 71600, + "total_discount_amount": 7160 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": null } - } + ], + "total": 2, + "has_more": false } } } } - }, - "put": { - "operationId": "update-campaign", - "tags": [ - "CAMPAIGNS API" - ], - "summary": "Update Campaign", - "description": "Updates the specified campaign by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged. \n\nFields other than the ones listed in the request body won't be modified. Even if provided, they will be silently skipped. \n\n> #### Vouchers will be affected\n>\n> This method will update vouchers aggregated in the campaign. It will affect all vouchers that are not published or redeemed yet.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the campaign parameters to be updated.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_req_update_campaign" + } + } + } + }, + "post": { + "operationId": "add-promotion-tier-to-campaign", + "tags": [ + "PROMOTIONS API" + ], + "summary": "Add Promotion Tier to Campaign", + "description": "This method allows you to add a new promotion tier to an existing campaign. The tier hierarchy will be set as the next consequtive integer following the lowest ranking tier.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the promotion tier parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_req_add_promotion_tier_to_campaign" + }, + "examples": { + "Example": { + "value": { + "name": "Order more than $100", + "banner": "Order more than $100", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 3000, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": {}, + "active": true, + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" }, - "examples": { - "Example": { - "value": { - "description": "New description" - } - } - } + "validity_day_of_week": [ + 1, + 2, + 3, + 4 + ], + "validation_rules": [ + "val_q8qUBMOh5qIQ" + ] } } - }, - "responses": { - "200": { - "description": "Returns the campaign object if the update succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_obj_campaign_object" + } + } + } + }, + "responses": { + "200": { + "description": "Returns a promotion tier object if the promotion tier was successfully added to the campaign.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_obj_promotion_tier_object" + }, + "examples": { + "Example": { + "value": { + "id": "promo_JcYGIKJsnv0SpZcx2njZm69x", + "created_at": "2022-09-22T11:21:57.808Z", + "name": "Order more than $100", + "banner": "Order more than $100", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 3000, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": {}, + "hierarchy": 6, + "campaign": { + "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": true, + "object": "campaign" + }, + "campaign_id": null, + "active": true, + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "P1D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4 + ], + "summary": { + "redemptions": { + "total_redeemed": 0 + }, + "orders": { + "total_amount": 0, + "total_discount_amount": 0 + } }, - "examples": { - "Example": { - "value": { - "id": "camp_FZL4iTTdZw36nZOoXYQ172fQ", - "name": "Loyalty Campaign", - "campaign_type": "LOYALTY_PROGRAM", - "type": "AUTO_UPDATE", - "voucher": { - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 1000, - "expiration_rules": { - "period_type": "MONTH", - "period_value": 3, - "rounding_type": "END_OF_YEAR" - } - }, - "redemption": { - "quantity": 10 - }, - "code_config": { - "length": 7, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "LOYALTY-CARD-#######" - }, - "is_referral_code": false, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - } - }, - "auto_join": false, - "join_once": false, - "use_voucher_metadata_schema": false, - "description": "New description", - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": "2023-12-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2 - ], - "activity_duration_after_publishing": "P24D", - "vouchers_count": 2, - "active": true, - "metadata": { - "region": "APAC" - }, - "created_at": "2022-09-21T09:39:45.479Z", - "updated_at": "2022-09-23T09:47:00.205Z", - "category": "First", - "creation_status": "MODIFYING", - "vouchers_generation_status": "MODIFYING", - "protected": false, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [ - { - "id": "cat_0bb343dee3cdb5ec0c", - "name": "First", - "hierarchy": 1, - "created_at": "2022-09-16T11:47:19.568Z", - "object": "category" - } - ], - "object": "campaign" + "object": "promotion_tier", + "validation_rule_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_AmeYPmiLZKaIxq01", + "rule_id": "val_q8qUBMOh5qIQ", + "related_object_id": "promo_JcYGIKJsnv0SpZcx2njZm69x", + "related_object_type": "promotion_tier", + "created_at": "2022-09-22T11:21:57.808Z", + "object": "validation_rules_assignment" } - } + ], + "total": 1 } } } } } - }, - "delete": { - "operationId": "delete-campaign", - "tags": [ - "CAMPAIGNS API" - ], - "summary": "Delete Campaign", - "description": "Permanently deletes a campaign and all related vouchers. This action cannot be undone. Also, this method immediately removes any redemptions on the voucher.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [ - { - "schema": { - "type": "boolean" - }, - "in": "query", - "description": "If this flag is set to `true`, the campaign and related vouchers will be removed permanently. Going forward, the user will be able to create the next campaign with exactly the same name.", - "name": "force" - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + } + } + } + } + }, + "/v1/promotions/tiers/{promotionTierId}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "promo_2EnAik6Jt7dKTOMkRTIgEjZH" + }, + "name": "promotionTierId", + "in": "path", + "required": true, + "description": "Unique promotion tier ID." + } + ], + "get": { + "operationId": "get-promotion-tier", + "tags": [ + "PROMOTIONS API" + ], + "summary": "Get Promotion Tier", + "description": "This method enables you to retrieve a specific promotion tier.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a promotion tier object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_obj_promotion_tier_object" } - ], - "responses": { - "202": { - "description": "Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the campaign will be deleted from the repository asynchronously. To check the deletion status and result, copy the `async_action_id` from the response and pass it using [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" - }, - "examples": { - "Delete Campaign": { - "$ref": "#/components/examples/res_async_actions" - } + } + } + } + } + }, + "put": { + "operationId": "update-promotion-tier", + "tags": [ + "PROMOTIONS API" + ], + "summary": "Update Promotion Tier", + "description": "This method updates a promotion tier.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the promotion tier parameters that you would like to update.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_req_update_promotion_tier" + }, + "examples": { + "Example": { + "value": { + "name": "Order more than $100 USD", + "banner": "Order more than $100 USD", + "action": { + "discount": { + "type": "PERCENT", + "percent_off": 25, + "effect": "APPLY_TO_ORDER" } - } + }, + "metadata": { + "level": "A-21" + }, + "hierarchy": 1, + "start_date": "2022-09-22T00:00:00.000Z", + "expiration_date": "2022-09-29T00:00:00.000Z", + "validity_timeframe": { + "interval": "P3D", + "duration": "P2D" + }, + "validity_day_of_week": [ + 1, + 2, + 3 + ] } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a promotion tier object if the update was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_obj_promotion_tier_object" }, - "404": { - "description": "Returns an error indicating that the campaign with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Campaign Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id Spring Campaign", - "request_id": "v-0adac46be8cdbfd921", - "resource_id": "Spring Campaign", - "resource_type": "campaign" - } + "examples": { + "Example": { + "value": { + "id": "promo_hINAfBAVhmFuSAzi3vptfyxW", + "created_at": "2022-09-22T12:40:23.286Z", + "updated_at": "2022-09-22T12:40:58.626Z", + "name": "Order more than $100 USD", + "banner": "Order more than $100 USD", + "action": { + "discount": { + "type": "PERCENT", + "percent_off": 25, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": { + "level": "A-21" + }, + "hierarchy": 1, + "campaign": { + "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": true, + "object": "campaign" + }, + "campaign_id": null, + "active": false, + "start_date": "2022-09-22T00:00:00.000Z", + "expiration_date": "2022-09-29T00:00:00.000Z", + "validity_timeframe": { + "interval": "P3D", + "duration": "P2D" + }, + "validity_day_of_week": [ + 1, + 2, + 3 + ], + "summary": { + "redemptions": { + "total_redeemed": 0 + }, + "orders": { + "total_amount": 0, + "total_discount_amount": 0 } + }, + "object": "promotion_tier", + "validation_rule_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_8e3e53ZgDNcoRGAI", + "rule_id": "val_q8qUBMOh5qIQ", + "related_object_id": "promo_hINAfBAVhmFuSAzi3vptfyxW", + "related_object_type": "promotion_tier", + "created_at": "2022-09-22T12:40:23.286Z", + "object": "validation_rules_assignment" + } + ], + "total": 1 } } } } } } + } + } + }, + "delete": { + "operationId": "delete-promotion-tier", + "tags": [ + "PROMOTIONS API" + ], + "summary": "Delete Promotion Tier", + "description": "This method deletes a promotion tier.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." }, - "/v1/campaigns/{campaignId}/vouchers": { - "parameters": [ - { + "404": { + "description": "Returns an error indicating that the promotion tier with given ID was not found.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" + "$ref": "#/components/schemas/e_404_not_found" }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the campaign to which voucher(s) will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value." - } - ], - "post": { - "operationId": "add-vouchers-to-campaign", - "tags": [ - "CAMPAIGNS API" - ], - "summary": "Add Vouchers to Campaign", - "description": "This method gives the possibility to push new vouchers to an existing campaign. New vouchers will inherit properties from the campaign profile. However, it is possible to overwrite some of them in the request body. If you provide an optional `code_config` parameter with a voucher code configuration, then it will be used to generate new voucher codes. Otherwise, the voucher code configuration from the campaign will be used.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [ - { - "schema": { - "type": "integer" - }, - "in": "query", - "name": "vouchers_count", - "description": "Number of vouchers that should be added." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the voucher parameters that you would like to overwrite.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_req_add_vouchers_to_campaign" - }, - "examples": { - "Example": { - "value": { - "category_id": "cat_0bb81a481615a37b5e", - "start_date": "2022-09-24T00:00:00Z", - "expiration_date": "2022-09-25T23:59:59Z", - "active": false, - "redemption": { - "quantity": null - }, - "code_config": { - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "length": 8, - "prefix": "Add-", - "pattern": null, - "postfix": "-API" - }, - "additional_info": "Voucher added using API", - "metadata": { - "Season": "Fall" - } - } - } + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find promotion_tier with id promo_2EnAik6Jt7dKTOMkRTIgEjZ", + "request_id": "v-0ae284707e9027a79d", + "resource_id": "promo_2EnAik6Jt7dKTOMkRTIgEjZ", + "resource_type": "promotion_tier" } } } - }, - "responses": { - "200": { - "description": "Returns a voucher object if the call succeeded for a voucher count of 1.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_obj_voucher_object" - }, - "examples": { - "Example": { - "value": { - "async_action_id": "aa_0bb96ebb7ec3720252" - } + } + } + } + } + } + }, + "/v1/promotions/tiers/{promotionTierId}/enable": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" + }, + "name": "promotionTierId", + "in": "path", + "required": true, + "description": "Unique promotion tier ID." + } + ], + "post": { + "operationId": "enable-promotion-tier", + "tags": [ + "PROMOTIONS API" + ], + "summary": "Enable Promotion Tier", + "description": "This method enables a promotion tier, i.e. makes the `active` parameter = `true`.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns the promotion tier object with an updated `active` parameter.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_obj_promotion_tier_object" + }, + "examples": { + "Example": { + "value": { + "id": "promo_NzjTc3ZXTe7md5SziK3uYtei", + "created_at": "2022-09-21T11:38:34.962Z", + "updated_at": "2022-09-22T10:32:07.712Z", + "name": "Order more than $100", + "banner": "Order more than $100", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 3000, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": {}, + "hierarchy": 1, + "campaign": { + "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": true, + "object": "campaign" + }, + "campaign_id": null, + "active": true, + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "summary": { + "redemptions": { + "total_redeemed": 2 + }, + "orders": { + "total_amount": 37650, + "total_discount_amount": 6000 } - } + }, + "object": "promotion_tier", + "validation_rule_assignments": null } } + } + } + } + }, + "404": { + "description": "Returns an error if the promotion tier cannot be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" }, - "202": { - "description": "Returns an `async_action_id` if the request was made to create more than 1 voucher.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" - } + "examples": { + "Example": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find promotion_tier with id promo_NzjTc3ZXTe7md5SziK3uYte", + "request_id": "v-0bbaea52be14cc9782", + "resource_id": "promo_NzjTc3ZXTe7md5SziK3uYte", + "resource_type": "promotion_tier" } } } } } + } + } + } + }, + "/v1/promotions/tiers/{promotionTierId}/disable": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" }, - "/v1/campaigns/{campaignId}/vouchers/{code}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the campaign to which voucher will be added. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value." - }, - { + "name": "promotionTierId", + "in": "path", + "required": true, + "description": "Unique promotion tier ID." + } + ], + "post": { + "operationId": "disable-promotion-tier", + "tags": [ + "PROMOTIONS API" + ], + "summary": "Disable Promotion Tier", + "description": "This method disables a promotion tier, i.e. makes the `active` parameter = `false`.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns the promotion tier object with an updated `active` parameter.", + "content": { + "application/json": { "schema": { - "type": "string" + "$ref": "#/components/schemas/3_obj_promotion_tier_object" }, - "name": "code", - "in": "path", - "required": true, - "description": "A custom **code** that identifies the voucher." - } - ], - "post": { - "operationId": "add-voucher-with-specific-code-to-campaign", - "tags": [ - "CAMPAIGNS API" - ], - "summary": "Add Voucher with Specific Code to Campaign", - "description": "This method gives a possibility to add a new voucher to an existing campaign. The voucher definition will be inherited from the definition kept in the campaign profile. However, you are able to overwrite a few properties inherited from the campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the voucher parameters that you would like to overwrite.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_req_add_vouchers_with_specific_code_to_campaign" - }, - "examples": { - "Example": { - "value": { - "category_id": "cat_0bb81a481615a37b5e", - "start_date": "2022-09-24T00:00:00Z", - "expiration_date": "2022-09-25T23:59:59Z", - "active": false, - "redemption": { - "quantity": null - }, - "additional_info": "Voucher added using API", - "metadata": { - "Season": "Fall" - } + "examples": { + "Example": { + "value": { + "id": "promo_NzjTc3ZXTe7md5SziK3uYtei", + "created_at": "2022-09-21T11:38:34.962Z", + "updated_at": "2022-09-22T10:34:09.529Z", + "name": "Order more than $100", + "banner": "Order more than $100", + "action": { + "discount": { + "type": "AMOUNT", + "amount_off": 3000, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": {}, + "hierarchy": 1, + "campaign": { + "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "active": true, + "object": "campaign" + }, + "campaign_id": null, + "active": false, + "start_date": "2022-09-21T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "summary": { + "redemptions": { + "total_redeemed": 2 + }, + "orders": { + "total_amount": 37650, + "total_discount_amount": 6000 } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns a voucher object if the call succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/1_obj_voucher_object" }, - "examples": { - "Example": { - "value": { - "id": "v_EJwB9Wy2aOIsDpWhnl2QBY51OqjQ5Ukg", - "code": "Code3", - "campaign": "Add Vouchers to Campaign", - "campaign_id": "camp_xxpmFyWO9h9s5cEe7HtmOK5B", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "PERCENT", - "amount_limit": 2000, - "percent_off": 30, - "effect": "APPLY_TO_ORDER" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2022-09-24T00:00:00.000Z", - "expiration_date": "2022-09-25T23:59:59.000Z", - "validity_timeframe": null, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": true, - "additional_info": "Voucher added using API", - "metadata": { - "Season": "Fall" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+p2kdatp7KAUZxgSATC1gRWgsb1Q3RQyClNOBrfUrRKpTjSPSzBuUSZzb45TIpfWRISSiaz1QXGh8z9sVSHIWQsGLO6+1N81zXuY6/pnC7gRBa4edwMaRoCAwzqO9JDw148AGk4XrXLg==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bp2kdatp7KAUZxgSATC1gRWgsb1Q3RQyClNOBrfUrRKpTjSPSzBuUSZzb45TIpfWRISSiaz1QXGh8z9sVSHIWQsGLO6%2B1N81zXuY6%2FpnC7gRBa4edwMaRoCAwzqO9JDw148AGk4XrXLg%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX19wrLVWzIOgoVd9an76OxiJWB5/u9yWGoD7cqN6Qd1K9noNyR1YwvHnBrcN5fa5qtY+sOXonn7WsynAWeR289gA0XobsHHE2VWe8BzNZ7h2kH90SsiW+NCQg6Ts8clYWWP5lrGyV/fzoA==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19wrLVWzIOgoVd9an76OxiJWB5%2Fu9yWGoD7cqN6Qd1K9noNyR1YwvHnBrcN5fa5qtY%2BsOXonn7WsynAWeR289gA0XobsHHE2VWe8BzNZ7h2kH90SsiW%2BNCQg6Ts8clYWWP5lrGyV%2FfzoA%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-21T07:14:28.217Z", - "updated_at": null, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/Code3/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/Code3/publications?page=1&limit=10" - }, - "object": "voucher" - } - } - } + "object": "promotion_tier", + "validation_rule_assignments": null } } + } + } + } + }, + "404": { + "description": "Returns an error if the promotion tier cannot be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" }, - "409": { - "description": "Returns an error if a voucher with the same code already exists.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" - }, - "examples": { - "Duplicate": { - "value": { - "code": 409, - "key": "duplicate_found", - "message": "Duplicated resource found", - "details": "Duplicated voucher exists with id Code1", - "request_id": "v-0bb974be99d22504cd", - "resource_id": "Code1", - "resource_type": "voucher" - } - } - } + "examples": { + "Example": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find promotion_tier with id promo_NzjTc3ZXTe7md5SziK3uYte", + "request_id": "v-0bbaea52be14cc9782", + "resource_id": "promo_NzjTc3ZXTe7md5SziK3uYte", + "resource_type": "promotion_tier" } } } } } + } + } + } + }, + "/v1/promotions/stacks": { + "get": { + "operationId": "list-all-promotion-stacks", + "tags": [ + "PROMOTIONS API" + ], + "summary": "List Promotion Stacks", + "description": "This method enables you to list promotion stacks irrespective of the campaign they are associated with. \n\nYou can use filters in the query parameters to specify the stacks to be returned in the response.\n\n## Advanced filters for fetching promotion stacks\n\n| **Filters** | **Examples** |\n| :--- | :--- |\n| Created Before | - `[created_at][before]=2021-12-30T13:52:18.227Z`
                  - `[filters][created_at][conditions][$before][0]=2021-12-30T13:52:18.227Z` |\n| Created After | - `[created_at][after]=2021-12-30T13:52:18.227Z`
                  - `[filters][created_at][conditions][$after][0]=2021-12-30T13:52:18.227Z` |\n| Updated Before | - `[updated_at][before]=2021-12-30T13:52:18.227Z`
                  - `[filters][updated_at][conditions][$before][0]=2021-12-30T13:52:18.227Z` |\n| Updated After | - `[updated_at][after]=2021-12-30T13:52:18.227Z`
                  - `[filters][updated_at][conditions][$after][0]=2021-12-30T13:52:18.227Z` |", + "parameters": [ + { + "schema": { + "type": "integer" + }, + "in": "query", + "name": "limit", + "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." }, - "/v1/campaigns/{campaignId}/import": { - "parameters": [ - { + { + "schema": { + "type": "string" + }, + "in": "query", + "description": "Which page of results to return.", + "name": "page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at", + "name", + "-name" + ] + }, + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." + }, + { + "$ref": "#/components/parameters/created_at" + }, + { + "$ref": "#/components/parameters/updated_at" + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with a `data` property that contains an array of promotion stacks across all your campaigns.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The ID of an existing campaign to which you're importing the codes. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value." - } - ], - "post": { - "operationId": "import-vouchers-to-campaign", - "tags": [ - "CAMPAIGNS API" - ], - "summary": "Import Vouchers to Campaign", - "description": "Imports vouchers to an **existing** campaign.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Discount type, expiration date and the remaining attributes will be taken from the [Campaign](ref:get-campaign) settings.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_req_import_vouchers_to_campaign" - }, - "examples": { - "Example": { - "value": [ - { - "code": "CODE7", - "category": "First", - "redemption": { - "quantity": 1 - }, - "metadata": { - "season": "Fall" - }, - "additional_info": "secret-code1", - "active": true - }, - { - "code": "CODE8", - "category": "Second", - "redemption": { - "quantity": 18 - }, - "metadata": { - "season": "Fall" - }, - "additional_info": "secret-code1", - "active": true - }, - { - "code": "CODE9", - "category_id": "cat_0bb343dee3cdb5ec0c", - "redemption": { - "quantity": 4 - }, - "metadata": { - "season": "Fall" - }, - "additional_info": "secret-code1", - "active": true - } - ] - }, - "Gift Cards": { - "value": [ - { - "code": "CODE13", - "category": "First", - "redemption": { - "quantity": 1 - }, - "metadata": { - "season": "Fall" - }, - "additional_info": "secret-code1", - "gift": { - "amount": 500 - }, - "active": true - }, - { - "code": "CODE14", - "category": "Second", - "redemption": { - "quantity": 18 - }, - "metadata": { - "season": "Fall" - }, - "additional_info": "secret-code1", - "gift": { - "amount": 2000 - }, - "active": true - }, - { - "code": "CODE15", - "category_id": "cat_0bb343dee3cdb5ec0c", - "redemption": { - "quantity": 4 - }, - "metadata": { - "season": "Fall" - }, - "additional_info": "secret-code1", - "active": false - } - ] - }, - "Loyalty Cards": { - "value": [ - { - "code": "CODE10", - "category": "First", - "redemption": { - "quantity": 1 - }, - "metadata": { - "season": "Fall" - }, - "additional_info": "secret-code1", - "loyalty_card": { - "points": 300 - }, - "active": true - }, - { - "code": "CODE11", - "category": "Second", - "redemption": { - "quantity": 18 - }, - "metadata": { - "season": "Fall" - }, - "additional_info": "secret-code1", - "loyalty_card": { - "points": 2000 - }, - "active": true - }, - { - "code": "CODE12", - "category_id": "cat_0bb343dee3cdb5ec0c", - "redemption": { - "quantity": 4 - }, - "metadata": { - "season": "Fall" - }, - "additional_info": "secret-code1", - "active": true + "$ref": "#/components/schemas/3_res_list_promotion_stacks" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "stack_SLuhQrAt3mXwHg776lYkzZO8", + "name": "Stack 2", + "created_at": "2022-11-03T10:18:58.356Z", + "campaign_id": "camp_h8RyP6FV94F3Ev2odP24j5p1", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_Mfww2TuoeU23enqSmnz0f3rh", + "promo_vU5IHaLKS7mmZ3ylABET6ikb", + "promo_TeHA11JlfN29mUftDcpqIWWq", + "promo_bhKBsIX3tO7yqmpTLCLLuaud" + ], + "hierarchy_mode": "MANUAL" } - ] - } - } - } - } - }, - "responses": { - "202": { - "description": "Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the vouchers will be imported 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](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" - }, - "examples": { - "Example": { - "$ref": "#/components/examples/res_async_actions" - } - } - } - } - }, - "400": { - "description": "Returns an error if the request includes incorrect data, e.g. a wrong data type or duplicated codes.", - "content": { - "application/json": { - "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/e_400_invalid_voucher" - }, - { - "$ref": "#/components/schemas/e_400_duplicate_key" + }, + { + "id": "stack_twQWp1TyaxX5RlSqn061xGVy", + "name": "First stack", + "created_at": "2021-12-27T11:59:21.838Z", + "updated_at": "2022-12-16T08:22:51.970Z", + "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_Vet0vCNyyo5pOddHfu2X3FCB", + "promo_PoIyRVFA5c0Jk514xCpzKHga", + "promo_Mwy9XpA0TLctSGriM5kum0qp" + ], + "hierarchy_mode": "MANUAL" } - ] - }, - "examples": { - "Duplicate Codes": { - "value": { - "code": 400, - "key": "duplicate_key", - "message": "Duplicate codes", - "details": "2 voucher codes(s) already exist.", - "request_id": "v-0adaccaba61502e4b3" + }, + { + "id": "stack_vhCqN5PY7rmPw8yACRvHRZaz", + "name": "Second stack", + "created_at": "2021-12-27T11:55:47.431Z", + "updated_at": "2022-12-16T08:22:52.221Z", + "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_Vet0vCNyyo5pOddHfu2X3FCB", + "promo_PoIyRVFA5c0Jk514xCpzKHga", + "promo_Mwy9XpA0TLctSGriM5kum0qp" + ], + "hierarchy_mode": "MANUAL" + } + }, + { + "id": "stack_zwChew7GY1AnDZJQ6GVP2sdT", + "name": "Third stack", + "created_at": "2021-12-27T11:54:26.283Z", + "updated_at": "2022-12-16T08:22:52.483Z", + "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_Vet0vCNyyo5pOddHfu2X3FCB", + "promo_Mwy9XpA0TLctSGriM5kum0qp", + "promo_PoIyRVFA5c0Jk514xCpzKHga" + ], + "hierarchy_mode": "MANUAL" + } + }, + { + "id": "stack_NS5hEUznL9XPa89rbrOZYMey", + "name": "Fourth stack", + "created_at": "2021-12-27T11:48:43.982Z", + "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_Vet0vCNyyo5pOddHfu2X3FCB", + "promo_Mwy9XpA0TLctSGriM5kum0qp", + "promo_PoIyRVFA5c0Jk514xCpzKHga" + ], + "hierarchy_mode": "MANUAL" + } + }, + { + "id": "stack_Rz0NvFtCZOObS3J5R68KET17", + "name": "Third stack", + "created_at": "2021-12-27T11:40:57.426Z", + "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_Vet0vCNyyo5pOddHfu2X3FCB", + "promo_PoIyRVFA5c0Jk514xCpzKHga" + ], + "hierarchy_mode": "MANUAL" + } + }, + { + "id": "stack_e8pH0nIuANmYRPE0x8hwDrpm", + "name": "Second stack", + "created_at": "2021-12-27T08:43:13.875Z", + "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_Mwy9XpA0TLctSGriM5kum0qp", + "promo_PoIyRVFA5c0Jk514xCpzKHga" + ], + "hierarchy_mode": "MANUAL" } }, - "Missing Code": { - "value": { - "code": 400, - "key": "invalid_voucher", - "message": "Invalid Voucher", - "details": "Found 1 voucher(s) without 'code' value", - "request_id": "v-0bbc38ce088c8b2f9a" + { + "id": "stack_3Q4EJpZqg3DI5IRwgBYfsb37", + "name": "First stack", + "created_at": "2021-12-27T08:43:13.498Z", + "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_Vet0vCNyyo5pOddHfu2X3FCB", + "promo_PoIyRVFA5c0Jk514xCpzKHga" + ], + "hierarchy_mode": "MANUAL" } }, - "Invalid Payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Property .redemption.quantity should be number,null", - "request_id": "v-0c545db3808418908f" + { + "id": "stack_KxSD0GahLUg9ULB6TseGfUHJ", + "name": "Stack 1", + "created_at": "2021-12-23T12:28:38.881Z", + "campaign_id": "camp_h8RyP6FV94F3Ev2odP24j5p1", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_NMex647s5UushvbBUJmYT2Fc", + "promo_4TqHr24boFISDrcOHSlfAxwm" + ], + "hierarchy_mode": "MANUAL" } } - } + ], + "total": 9 } } } } } + } + } + } + }, + "/v1/promotions/{campaignId}/stacks": { + "parameters": [ + { + "schema": { + "type": "string" }, - "/v1/campaigns/{campaignId}/importCSV": { - "parameters": [ - { + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID." + } + ], + "get": { + "operationId": "list-promotion-stacks-in-campaign", + "tags": [ + "PROMOTIONS API" + ], + "summary": "List Promotion Stacks in Campaign", + "description": "This method enables you to list promotion stacks from a specified campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of promotion stack objects.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value." - } - ], - "post": { - "operationId": "import-vouchers-to-campaign-using-csv", - "tags": [ - "CAMPAIGNS API" - ], - "summary": "Import Vouchers to Campaign by CSV", - "description": "Imports vouchers to an **existing** campaign. \n\n\nThe CSV file has to include headers in the first line. \n\nCurl Example\n\n```cURL\ncurl -X POST \\\n https://api.voucherify.io/v1/campaigns/TEST-CAMPAIGN/importCSV \\\n -F file=@/path/to/campaigns.csv \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\"\n```\n\nYou can import values for the following fields: `Code` (**required**), `Category`, `Active`. In a gift cards import, you can also include the current card balance using the `Gift Amount` header and the amount that was redeemed using the `Redeemed Amount` header. In a loyalty cards import, you can also include the current loyalty card score in points using the `Loyalty Points` header. Remaining CSV columns will be mapped to metadata properties. \n\nDiscount type, time limits, and validation rules will be taken from the [campaign object](ref:get-campaign) settings. \n\n\n| **Active** | **Code** | **Loyalty Points** | **Gift Amount** | **Redeemed Amount** | **Redeemed Quantity** | **Category** | **Custom_metadata_property** |\n|---|---|---|---|---|---|---|---|\n| Use `true` or `false` to enable or disable the voucher; this flag can be used to turn off the ability to redeem a voucher even though it is within the campaign's start/end validity timeframe. | The unique voucher code. | The number of points to be added to the loyalty card. If you leave this undefined, then the initial number of points will be set according to the campaign settings.
                  Context: `LOYALTY_PROGRAM` | The initial gift card balance.
                  Context: `GIFT_VOUCHERS` | The amount that was redeemed from the available balance on a gift card. | The number of times the voucher has been redeemed. | A custom tag for the voucher to help you filter codes; you can either import the category name or a unique Voucherify-assigned category ID. | Any additional data that you would like to store for the given loyalty card as a Custom attribute. Remember to define the metadata schema in the Dashboard prior to importing codes. |\n|\n\n> 📘 Active\n>\n> The CSV file is allowed in two versions; either with or without a column titled `Active`. It indicates whether the voucher is enabled after the import event. \n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/a_req_importCSV" - } - } - }, - "description": "The file path is stored in the form `file` header." - }, - "responses": { - "200": { - "description": "Returns the ID of the scheduled asynchronous action, informing you that your request has been accepted and the vouchers will be imported 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](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" - }, - "examples": { - "Example": { - "$ref": "#/components/examples/res_async_actions" - } - } - } - } - }, - "404": { - "description": "Returns an error if the campaign cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Example": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id camp_FZL4iTTdZw36nZOoXYQ172fQ", - "request_id": "v-0bc26adad888b6fed1", - "resource_id": "camp_FZL4iTTdZw36nZOoXYQ172fQ", - "resource_type": "campaign" + "$ref": "#/components/schemas/3_res_list_promotion_stacks" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "stack_p0WhtyyDU95crobleMpRabhH", + "name": "First stack", + "created_at": "2022-09-22T13:03:25.740Z", + "campaign_id": "camp_99HUWI53bVyLzPN1Fg5TBLWX", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_dJNhAEeV5sR5oPQq1UrUdnMC", + "promo_aaAF8mVAzA0PF1igia2OC63d" + ], + "hierarchy_mode": "MANUAL" + } + }, + { + "id": "stack_XAzn8AFR3Ks3DBPLAQxV7zHe", + "name": "Second stack", + "created_at": "2022-09-22T13:03:25.903Z", + "campaign_id": "camp_99HUWI53bVyLzPN1Fg5TBLWX", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_aaAF8mVAzA0PF1igia2OC63d", + "promo_dJNhAEeV5sR5oPQq1UrUdnMC" + ], + "hierarchy_mode": "MANUAL" } } - } + ], + "total": 2 } } } } } - }, - "/v1/campaigns/qualification": { - "post": { - "operationId": "examine-campaigns-qualification", - "deprecated": true, - "tags": [ - "CAMPAIGNS API" - ], - "summary": "Examine Qualification [Deprecated]", - "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for qualification, and we do not recommend using it. The new [Qualifications API](ref:examine-qualification) introduces additional features and improvements while maintaining backward compatibility. 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. \n\nThe method can be used for sending a request to display all campaigns qualified to the given customer and context (e.g., order). \n\nThe maximum number of **returned campaigns is 50**.\n\n## What campaign types are included in the response?\n\n- `DISCOUNT_COUPONS`\n- `GIFT_VOUCHERS`\n- `REFERRAL_PROGRAM`\n\n## What's excluded?\n\nA checking logic will be run only among campaigns and will ignore _standalone vouchers_. For standalone vouchers, you should run a [dedicated endpoint](ref:examine-vouchers-qualification) for searching and identifing vouchers. \n\n## Subsequent Steps\n\nAs a recommended subsequent step after selecting a qualified campaign is to publish a voucher code from that campaign. The [API method for publishing](ref:create-publication) will return a unique code which will belong to a given customer.\n\n## Sample use case\n\nAs a sample use case, you can imagine a requirement of displaying coupons (grouped in campaigns) that a customer is eligible to use. The customer should get assigned to the particular voucher from the campaign and then may redeem that particular code when he/she places an order.\n\n[Read](doc:checking-eligibility-for-coupons) about Qualification API limits before you start.", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "audienceRulesOnly", - "description": "This parameter set to true will ask only for verifying vouchers' validation rules only against conditions applied to audiences' attributes (belonging into segment and Customer metadata)" - }, - { - "schema": { - "type": "integer", - "maximum": 50 - }, - "in": "query", - "name": "limit", - "description": "The number of campaigns to be qualified. The maximum number is 50." - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at", - "type", - "-type", - "code", - "-code", - "category", - "-category", - "campaign", - "-campaign" - ] - }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash `-` means sorting in a descending order." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_req_examine_qualification" - }, - "examples": { - "Example": { - "value": { - "customer": { - "source_id": "source-id", - "metadata": { - "key": "value" - } - }, - "order": { - "amount": 10000, - "items": [ - { - "product_id": "product-id", - "quantity": "1", - "price": 10000, - "related_object": "product", - "product": { - "metadata": { - "key": "value" - } - } - } - ] - }, - "metadata": { - "key": "value" - } - } - } - } - } - } + } + } + }, + "post": { + "operationId": "create-promotion-stack", + "tags": [ + "PROMOTIONS API" + ], + "summary": "Create Promotion Stack", + "description": "This method creates one promotion stack. The sequence of promotion tier IDs will determine the promotion stacking order.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the order of promotion tiers for the promotion stack.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_req_create_promotion_stack" }, - "responses": { - "200": { - "description": "This operation returns the list of valid and active campaigns based on the qualification of a given context (e.g., customer profile, redemptions metadata, order).\n\n[Read](doc:checking-eligibility-for-coupons) about Qualification API limits before you start.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/2_res_examine_qualification" - } + "examples": { + "Example": { + "value": { + "name": "Fifth Stack", + "tiers": { + "ids": [ + "promo_aaAF8mVAzA0PF1igia2OC63d", + "promo_t9zdL6XMFk7B8fQ23zxELtdE", + "promo_dJNhAEeV5sR5oPQq1UrUdnMC" + ], + "hierarchy_mode": "MANUAL" } } } } } - }, - "/v1/campaigns/{campaignId}/enable": { - "parameters": [ - { + } + }, + "responses": { + "200": { + "description": "Returns a new stack object if a valid promotion campaign identifier was provided in the path and available promotion IDs in the payload.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the campaign being enabled. You can either pass the campaign ID, which was assigned by Voucherify or the name of the campaign as the path parameter value." - } - ], - "post": { - "operationId": "enable-campaign", - "tags": [ - "CAMPAIGNS API" - ], - "summary": "Enable Campaign", - "description": "There are various times when you'll want to manage a campaign's accessibility. This can be done by two API methods for managing the campaign state - *enable* and *disable*. \n\nSets campaign state to **active**. The vouchers in this campaign can be redeemed - only if the redemption occurs after the start date of the campaign and voucher and the voucher and campaign are not expired.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns an empty json `{}`.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/res_empty_json" - }, - "examples": { - "Empty JSON": { - "value": {} - } - } - } - } - }, - "404": { - "description": "Returns an error if the campaign cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id camp_h8RyP6FV94F3Ev2odP24j5p", - "request_id": "v-0adaf4847c9502879b", - "resource_id": "camp_h8RyP6FV94F3Ev2odP24j5p", - "resource_type": "campaign" - } - } + "$ref": "#/components/schemas/3_obj_promotion_stack_object" + }, + "examples": { + "Example": { + "value": { + "id": "stack_q2AmzFvOMCmg4Wdu5bDBlME6", + "name": "Fifth Stack", + "created_at": "2022-09-23T07:44:53.888Z", + "campaign_id": "camp_99HUWI53bVyLzPN1Fg5TBLWX", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_aaAF8mVAzA0PF1igia2OC63d", + "promo_t9zdL6XMFk7B8fQ23zxELtdE", + "promo_dJNhAEeV5sR5oPQq1UrUdnMC" + ], + "hierarchy_mode": "MANUAL" } } } @@ -51363,90 +53111,102 @@ } } }, - "/v1/campaigns/{campaignId}/disable": { - "parameters": [ - { + "404": { + "description": "Returns an error if the campaign or promotion tier cannot be found.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the campaign being disabled. You can either pass the campaign ID, which was assigned by Voucherify, or the name of the campaign as the path parameter value." - } - ], - "post": { - "operationId": "disable-campaign", - "tags": [ - "CAMPAIGNS API" - ], - "summary": "Disable Campaign", - "description": "There are various times when you'll want to manage a campaign's accessibility. This can be done by two API methods for managing the campaign state - *enable* and *disable*. \n\nSets campaign state to **inactive**. The vouchers in this campaign can no longer be redeemed.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns an empty json `{}`.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/res_empty_json" - }, - "examples": { - "Empty JSON": { - "value": {} - } - } + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Campaign Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id camp_99HUWI53bVyLzPN1Fg5TBLW", + "request_id": "v-0bbc10de5886137afd", + "resource_id": "camp_99HUWI53bVyLzPN1Fg5TBLW", + "resource_type": "campaign" } - } - }, - "404": { - "description": "Returns an error if the campaign cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id Spring Campaign", - "request_id": "v-0adaf3735116bb298b", - "resource_id": "Spring Campaign", - "resource_type": "campaign" - } - } - } + }, + "Promotion Tier Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find promotion_tier with id promo_dJNhAEeV5sR5oPQq1UrUdnM", + "request_id": "v-0bbc11186303fa288a", + "resource_id": "promo_dJNhAEeV5sR5oPQq1UrUdnM", + "resource_type": "promotion_tier" } } } } } + } + } + } + }, + "/v1/promotions/{campaignId}/stacks/{stackId}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" }, - "/v1/promotion-tier-object": { - "get": { - "operationId": "promotion-tier-object", - "tags": [ - "PROMOTIONS API" - ], - "summary": "Promotion Tier Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Promotion Tier Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_obj_promotion_tier_object" + "name": "campaignId", + "in": "path", + "required": true, + "description": "ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty Campaign`. " + }, + { + "schema": { + "type": "string", + "example": "stack_KOIde7AUf08at12lZ1r3OfFL" + }, + "name": "stackId", + "in": "path", + "required": true, + "description": "Promotion stack ID." + } + ], + "get": { + "operationId": "get-promotion-stack", + "tags": [ + "PROMOTIONS API" + ], + "summary": "Get Promotion Stack", + "description": "This method returns the details of a promotion stack, including the promotion tiers grouped within the stack.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a stack object if valid identifiers were provided in the path.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_obj_promotion_stack_object" + }, + "examples": { + "Example": { + "value": { + "id": "stack_p0WhtyyDU95crobleMpRabhH", + "name": "First stack", + "created_at": "2022-09-22T13:03:25.740Z", + "campaign_id": "camp_99HUWI53bVyLzPN1Fg5TBLWX", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_dJNhAEeV5sR5oPQq1UrUdnMC", + "promo_aaAF8mVAzA0PF1igia2OC63d" + ], + "hierarchy_mode": "MANUAL" } } } @@ -51454,13066 +53214,9926 @@ } } }, - "/v1/promotions/tiers": { - "get": { - "operationId": "list-promotion-tiers", - "tags": [ - "PROMOTIONS API" - ], - "summary": "List Promotion Tiers", - "description": "This method enables you to list promotion tiers.", - "parameters": [ - { - "schema": { - "type": "boolean" - }, - "in": "query", - "name": "is_available", - "description": "This parameter allows filtering promotions that are only available at the moment. When set to `true`, it selects only non-expired and active promotions." - }, - { - "schema": { - "type": "integer" - }, - "in": "query", - "name": "limit", - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "description": "Which page of results to return.", - "name": "page" - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ] + "404": { + "description": "Returns an error if the campaign or promotion stack cannot be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Stack Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find promotion_stack with id stack_p0WhtyyDU95crobleMpRabh", + "request_id": "v-0bbc0a659591f99d65", + "resource_id": "stack_p0WhtyyDU95crobleMpRabh", + "resource_type": "promotion_stack" + } }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary with a `tiers` property that contains an array of promotion tiers.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_res_list_promotion_tiers" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "tiers", - "tiers": [ - { - "id": "promo_NzjTc3ZXTe7md5SziK3uYtei", - "created_at": "2022-09-21T11:38:34.962Z", - "name": "Order more than $100", - "banner": "Order more than $100", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 3000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "hierarchy": 1, - "promotion_id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "campaign": { - "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P3D", - "duration": "P2D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": true, - "category_id": "cat_0bb81a481615a37b5e", - "object": "campaign" - }, - "campaign_id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "active": true, - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P3D", - "duration": "P2D" - }, - "validity_day_of_week": [ - 1, - 2 - ], - "summary": { - "redemptions": { - "total_redeemed": 0 - }, - "orders": { - "total_amount": 0, - "total_discount_amount": 0 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": null - }, - { - "id": "promo_RaYHtUBre5jU8frUXOvYBtlN", - "created_at": "2021-12-15T11:34:01.358Z", - "updated_at": "2022-02-09T09:20:08.619Z", - "name": "Hot Promotion - Tier 2", - "banner": "Get Tier 2 Discount $20 Off", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 2000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "hierarchy": 2, - "promotion_id": "camp_5h0wc453_5", - "campaign": { - "id": "camp_5h0wc453_5", - "start_date": null, - "expiration_date": null, - "active": true, - "category_id": "cat_0b688929a2476386a6", - "object": "campaign" - }, - "campaign_id": "camp_5h0wc453_5", - "active": true, - "summary": { - "redemptions": { - "total_redeemed": 33 - }, - "orders": { - "total_amount": 519200, - "total_discount_amount": 66000 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_pEe1inoYSfmO12p7", - "rule_id": "val_5h0wc453_5", - "related_object_id": "promo_RaYHtUBre5jU8frUXOvYBtlN", - "related_object_type": "promotion_tier", - "created_at": "2021-12-15T11:34:01.358Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - } - }, - { - "id": "promo_63fYCt81Aw0h7lzyRkrGZh9p", - "created_at": "2021-12-15T11:34:01.333Z", - "updated_at": "2022-02-09T09:20:05.603Z", - "name": "Hot Promotion - Tier 1", - "banner": "Get Tier 1 Discount 10zl", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 1000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": { - "ProductionMetaData": "Hot Promotion - Tier 1" - }, - "hierarchy": 1, - "promotion_id": "camp_5h0wc453_5", - "campaign": { - "id": "camp_5h0wc453_5", - "start_date": null, - "expiration_date": null, - "active": true, - "category_id": "cat_0b688929a2476386a6", - "object": "campaign" - }, - "campaign_id": "camp_5h0wc453_5", - "active": true, - "summary": { - "redemptions": { - "total_redeemed": 11 - }, - "orders": { - "total_amount": 1414979, - "total_discount_amount": 11000 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_QqYs7GGVy7cuh3L9", - "rule_id": "val_5h0wc453_4", - "related_object_id": "promo_63fYCt81Aw0h7lzyRkrGZh9p", - "related_object_type": "promotion_tier", - "created_at": "2021-12-15T11:34:01.333Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - } - } - ], - "total": 3 - } - } - } + "Campaign Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id camp_99HUWI53bVyLzPN1Fg5TBLW", + "request_id": "v-0bbc0aa77a0c8b78e8", + "resource_id": "camp_99HUWI53bVyLzPN1Fg5TBLW", + "resource_type": "campaign" } } } } } - }, - "/client/v1/promotions/tiers": { - "get": { - "operationId": "list-promotion-tiers-client-side", - "tags": [ - "PROMOTIONS API" - ], - "summary": "List Promotion Tiers (client-side)", - "description": "This method enables you to list promotion tiers.", - "parameters": [ - { - "schema": { - "type": "boolean" - }, - "in": "query", - "name": "is_available", - "description": "This parameter allows filtering promotions that are only available at the moment. When set to `true`, it selects only non-expired and active promotions." - }, - { - "schema": { - "type": "integer" - }, - "in": "query", - "name": "limit", - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "description": "Which page of results to return.", - "name": "page" - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ] - }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." - }, - { - "$ref": "#/components/parameters/origin" - } - ], - "security": [ - { - "X-Client-Application-Id-1": [], - "X-Client-Token-1": [] + } + } + }, + "put": { + "operationId": "update-promotion-stack", + "tags": [ + "PROMOTIONS API" + ], + "summary": "Update Promotion Stack", + "description": "This methods allows for editing an existing stack.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the promotion stack parameters that you would like to update.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_req_create_promotion_stack" + }, + "examples": { + "Example": { + "value": { + "name": "Fifth Stack Modified", + "tiers": { + "ids": [ + "promo_aaAF8mVAzA0PF1igia2OC63d", + "promo_t9zdL6XMFk7B8fQ23zxELtdE" + ], + "hierarchy_mode": "MANUAL" + } + } } - ], - "responses": { - "200": { - "description": "Returns a dictionary with a `tiers` property that contains an array of promotion tiers.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_res_list_promotion_tiers" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "tiers", - "tiers": [ - { - "id": "promo_NzjTc3ZXTe7md5SziK3uYtei", - "created_at": "2022-09-21T11:38:34.962Z", - "name": "Order more than $100", - "banner": "Order more than $100", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 3000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "hierarchy": 1, - "promotion_id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "campaign": { - "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P3D", - "duration": "P2D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": true, - "category_id": "cat_0bb81a481615a37b5e", - "object": "campaign" - }, - "campaign_id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "active": true, - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P3D", - "duration": "P2D" - }, - "validity_day_of_week": [ - 1, - 2 - ], - "summary": { - "redemptions": { - "total_redeemed": 0 - }, - "orders": { - "total_amount": 0, - "total_discount_amount": 0 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": null - }, - { - "id": "promo_RaYHtUBre5jU8frUXOvYBtlN", - "created_at": "2021-12-15T11:34:01.358Z", - "updated_at": "2022-02-09T09:20:08.619Z", - "name": "Hot Promotion - Tier 2", - "banner": "Get Tier 2 Discount $20 Off", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 2000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "hierarchy": 2, - "promotion_id": "camp_5h0wc453_5", - "campaign": { - "id": "camp_5h0wc453_5", - "start_date": null, - "expiration_date": null, - "active": true, - "category_id": "cat_0b688929a2476386a6", - "object": "campaign" - }, - "campaign_id": "camp_5h0wc453_5", - "active": true, - "summary": { - "redemptions": { - "total_redeemed": 33 - }, - "orders": { - "total_amount": 519200, - "total_discount_amount": 66000 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_pEe1inoYSfmO12p7", - "rule_id": "val_5h0wc453_5", - "related_object_id": "promo_RaYHtUBre5jU8frUXOvYBtlN", - "related_object_type": "promotion_tier", - "created_at": "2021-12-15T11:34:01.358Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - } - }, - { - "id": "promo_63fYCt81Aw0h7lzyRkrGZh9p", - "created_at": "2021-12-15T11:34:01.333Z", - "updated_at": "2022-02-09T09:20:05.603Z", - "name": "Hot Promotion - Tier 1", - "banner": "Get Tier 1 Discount 10zl", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 1000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": { - "ProductionMetaData": "Hot Promotion - Tier 1" - }, - "hierarchy": 1, - "promotion_id": "camp_5h0wc453_5", - "campaign": { - "id": "camp_5h0wc453_5", - "start_date": null, - "expiration_date": null, - "active": true, - "category_id": "cat_0b688929a2476386a6", - "object": "campaign" - }, - "campaign_id": "camp_5h0wc453_5", - "active": true, - "summary": { - "redemptions": { - "total_redeemed": 11 - }, - "orders": { - "total_amount": 1414979, - "total_discount_amount": 11000 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_QqYs7GGVy7cuh3L9", - "rule_id": "val_5h0wc453_4", - "related_object_id": "promo_63fYCt81Aw0h7lzyRkrGZh9p", - "related_object_type": "promotion_tier", - "created_at": "2021-12-15T11:34:01.333Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - } - } - ], - "total": 3 - } - } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a promotion stack with updated parameters if the update was successful.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/3_obj_promotion_stack_object" + }, + "examples": { + "Example": { + "value": { + "id": "stack_q2AmzFvOMCmg4Wdu5bDBlME6", + "name": "Fifth Stack Modified", + "created_at": "2022-09-23T07:44:53.888Z", + "updated_at": "2022-09-23T07:59:44.172Z", + "campaign_id": "camp_99HUWI53bVyLzPN1Fg5TBLWX", + "object": "promotion_stack", + "tiers": { + "ids": [ + "promo_aaAF8mVAzA0PF1igia2OC63d", + "promo_t9zdL6XMFk7B8fQ23zxELtdE" + ], + "hierarchy_mode": "MANUAL" } } } } } } + } + } + }, + "delete": { + "operationId": "delete-promotion-stack", + "tags": [ + "PROMOTIONS API" + ], + "summary": "Delete Promotion Stack", + "description": "This method deletes a promotion stack.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." }, - "/v1/promotions/{campaignId}/tiers": { - "parameters": [ - { + "404": { + "description": "Returns an error indicating that the stack or campaign with given ID was not found.", + "content": { + "application/json": { "schema": { - "type": "string" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID assigned by Voucherify." - } - ], - "get": { - "operationId": "list-promotion-tiers-from-campaign", - "tags": [ - "PROMOTIONS API" - ], - "summary": "List Promotion Tiers from Campaign", - "description": "This method enables you to list promotion tiers from a specified campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary with a `tiers` property that contains an array of promotion tiers.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_res_list_promotion_tiers_from_campaign" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "tiers", - "tiers": [ - { - "id": "promo_xyOKjAmysZrwt3aqq1dMUwMU", - "created_at": "2022-04-07T08:43:53.730Z", - "updated_at": "2022-08-26T05:22:43.220Z", - "name": "Amount", - "banner": "Get $10 off entire order", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 1000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "hierarchy": 2, - "promotion_id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", - "campaign": { - "id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", - "start_date": null, - "expiration_date": null, - "active": true, - "category_id": "cat_0b5f67863083bf7c05", - "object": "campaign" - }, - "campaign_id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", - "active": true, - "summary": { - "redemptions": { - "total_redeemed": 1 - }, - "orders": { - "total_amount": 2187, - "total_discount_amount": 1000 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": null - }, - { - "id": "promo_CQonGnrsFAdEJfJQ3oKB3a8G", - "created_at": "2022-04-07T08:43:53.581Z", - "updated_at": "2022-08-26T05:22:43.008Z", - "name": "Percentage", - "banner": "Get 10% OFF on entire order", - "action": { - "discount": { - "type": "PERCENT", - "percent_off": 10, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "hierarchy": 1, - "promotion_id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", - "campaign": { - "id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", - "start_date": null, - "expiration_date": null, - "active": true, - "category_id": "cat_0b5f67863083bf7c05", - "object": "campaign" - }, - "campaign_id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0", - "active": true, - "summary": { - "redemptions": { - "total_redeemed": 1 - }, - "orders": { - "total_amount": 71600, - "total_discount_amount": 7160 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": null - } - ], - "total": 2, - "has_more": false - } - } - } + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Stack Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find promotion_stack with id stack_KOIde7AUf08at12lZ1r3OfFp", + "request_id": "v-0ae289ca779027b030", + "resource_id": "stack_KOIde7AUf08at12lZ1r3OfFp", + "resource_type": "promotion_stack" + } + }, + "Campaign Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id Summer % Promotion", + "request_id": "v-0ae28a621c46af534b", + "resource_id": "Summer % Promotion", + "resource_type": "campaign" } } } } - }, - "post": { - "operationId": "add-promotion-tier-to-campaign", - "tags": [ - "PROMOTIONS API" - ], - "summary": "Add Promotion Tier to Campaign", - "description": "This method allows you to add a new promotion tier to an existing campaign. The tier hierarchy will be set as the next consequtive integer following the lowest ranking tier.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + } + } + } + } + }, + "/v1/reward-object": { + "get": { + "operationId": "reward-object", + "tags": [ + "REWARDS API" + ], + "summary": "Reward Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Reward object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_obj_reward_object" } - ], - "requestBody": { - "description": "Specify the promotion tier parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_req_add_promotion_tier_to_campaign" - }, - "examples": { - "Example": { - "value": { - "name": "Order more than $100", - "banner": "Order more than $100", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 3000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "active": true, - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4 - ], - "validation_rules": [ - "val_q8qUBMOh5qIQ" - ] - } - } - } - } + } + } + } + } + } + }, + "/v1/reward-assignment-object": { + "get": { + "operationId": "reward-assignment-object", + "tags": [ + "REWARDS API" + ], + "summary": "Reward Assignment Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Reward Assignment Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_obj_reward_assignment_object" } - }, - "responses": { - "200": { - "description": "Returns a promotion tier object if the promotion tier was successfully added to the campaign.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_obj_promotion_tier_object" - }, - "examples": { - "Example": { - "value": { - "id": "promo_JcYGIKJsnv0SpZcx2njZm69x", - "created_at": "2022-09-22T11:21:57.808Z", - "name": "Order more than $100", - "banner": "Order more than $100", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 3000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "hierarchy": 6, - "campaign": { - "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": true, - "object": "campaign" - }, - "campaign_id": null, - "active": true, - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4 - ], - "summary": { - "redemptions": { - "total_redeemed": 0 - }, - "orders": { - "total_amount": 0, - "total_discount_amount": 0 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_AmeYPmiLZKaIxq01", - "rule_id": "val_q8qUBMOh5qIQ", - "related_object_id": "promo_JcYGIKJsnv0SpZcx2njZm69x", - "related_object_type": "promotion_tier", - "created_at": "2022-09-22T11:21:57.808Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 + } + } + } + } + } + }, + "/v1/rewards": { + "get": { + "operationId": "list-rewards", + "tags": [ + "REWARDS API" + ], + "summary": "List Rewards", + "description": "Retrieve rewards.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "example": "rewa_m9hEAu10KsPcLhGXiHG85aY0" + }, + "in": "query", + "name": "assignment_id", + "description": "A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary of reward objects.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_res_list_rewards" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "rew_3e7IqghVtTR7L3xQMSCxjFu2", + "name": "Get $10", + "type": "CAMPAIGN", + "parameters": { + "campaign": { + "id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", + "balance": 1000, + "type": "GIFT_VOUCHERS" } - } + }, + "stock": null, + "redeemed": null, + "attributes": {}, + "created_at": "2022-03-10T08:40:20.917Z", + "updated_at": "2022-08-17T07:52:56.965Z", + "metadata": null, + "object": "reward" + }, + { + "id": "rew_nIy4gHpQHle2c3pNMwuj7G6j", + "name": "Get 100 Points", + "type": "CAMPAIGN", + "parameters": { + "campaign": { + "id": "camp_E87CubZLZ8eoQt3c4kAEZsx0", + "balance": 100, + "type": "LOYALTY_PROGRAM" + } + }, + "stock": null, + "redeemed": null, + "attributes": {}, + "created_at": "2022-02-28T11:56:13.764Z", + "updated_at": null, + "metadata": null, + "object": "reward" + }, + { + "id": "rew_BNZ3van6AF2AiquWp8Lfw0xq", + "name": "30% discount", + "type": "CAMPAIGN", + "parameters": { + "campaign": { + "id": "camp_ZtHLATYVpItqmuSqmaz1rZ2Y", + "type": "DISCOUNT_COUPONS" + } + }, + "stock": null, + "redeemed": null, + "attributes": {}, + "created_at": "2022-08-11T09:48:50.609Z", + "updated_at": null, + "metadata": {}, + "object": "reward" + }, + { + "id": "rew_nlV8bgWU1jNO9YWQ7CdZmzq7", + "name": "1 point = $0.01", + "type": "COIN", + "parameters": { + "coin": { + "exchange_ratio": 0.01, + "points_ratio": 1 + } + }, + "stock": null, + "redeemed": null, + "attributes": {}, + "created_at": "2022-08-11T16:45:21.582Z", + "updated_at": null, + "metadata": { + "Type": "0.01" + }, + "object": "reward" + }, + { + "id": "rew_x6FmF1KFdDs06hYPr9lK6ajf", + "name": "Material Reward", + "type": "MATERIAL", + "parameters": { + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619" + } + }, + "stock": "4", + "redeemed": "1", + "attributes": { + "image_url": "https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_wJHdZUAVSpWtYM6ORq4up3I2.png", + "description": "Get a Comic Book in Archie's series." + }, + "created_at": "2022-08-17T07:13:32.781Z", + "updated_at": null, + "metadata": { + "Type": "Personal" + }, + "object": "reward" } - } + ], + "total": 5 } } } } } - }, - "/v1/promotions/tiers/{promotionTierId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "promo_2EnAik6Jt7dKTOMkRTIgEjZH" + } + } + }, + "post": { + "operationId": "create-reward", + "tags": [ + "REWARDS API" + ], + "summary": "Create Reward", + "description": "Create a new reward.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Define parameters of the new reward.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_req_create_reward" + }, + "examples": { + "Gift card credits": { + "value": { + "name": "Digital - Gift Card Reward", + "type": "CAMPAIGN", + "metadata": { + "Type": "Gift" + }, + "parameters": { + "campaign": { + "id": "camp_hC2GdqYtOmTT45zfhib62cK1", + "balance": 3000 + } + } + } }, - "name": "promotionTierId", - "in": "path", - "required": true, - "description": "Unique promotion tier ID." - } - ], - "get": { - "operationId": "get-promotion-tier", - "tags": [ - "PROMOTIONS API" - ], - "summary": "Get Promotion Tier", - "description": "This method enables you to retrieve a specific promotion tier.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a promotion tier object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_obj_promotion_tier_object" + "Discount Coupon": { + "value": { + "name": "Digital - Discount Coupon", + "type": "CAMPAIGN", + "metadata": { + "Type": "Discount" + }, + "parameters": { + "campaign": { + "id": "camp_hC2GdqYtOmTT45zfhib62cK1" } } } - } - } - }, - "put": { - "operationId": "update-promotion-tier", - "tags": [ - "PROMOTIONS API" - ], - "summary": "Update Promotion Tier", - "description": "This method updates a promotion tier.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the promotion tier parameters that you would like to update.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_req_update_promotion_tier" + }, + "Loyalty Points": { + "value": { + "name": "Digital - Loyalty Points Reward", + "type": "CAMPAIGN", + "metadata": { + "Type": "Loyalty Points" }, - "examples": { - "Example": { - "value": { - "name": "Order more than $100 USD", - "banner": "Order more than $100 USD", - "action": { - "discount": { - "type": "PERCENT", - "percent_off": 25, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": { - "level": "A-21" - }, - "hierarchy": 1, - "start_date": "2022-09-22T00:00:00.000Z", - "expiration_date": "2022-09-29T00:00:00.000Z", - "validity_timeframe": { - "interval": "P3D", - "duration": "P2D" - }, - "validity_day_of_week": [ - 1, - 2, - 3 - ] - } + "parameters": { + "campaign": { + "id": "camp_hC2GdqYtOmTT45zfhib62cK1", + "balance": 100 } } } - } - }, - "responses": { - "200": { - "description": "Returns a promotion tier object if the update was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_obj_promotion_tier_object" - }, - "examples": { - "Example": { - "value": { - "id": "promo_hINAfBAVhmFuSAzi3vptfyxW", - "created_at": "2022-09-22T12:40:23.286Z", - "updated_at": "2022-09-22T12:40:58.626Z", - "name": "Order more than $100 USD", - "banner": "Order more than $100 USD", - "action": { - "discount": { - "type": "PERCENT", - "percent_off": 25, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": { - "level": "A-21" - }, - "hierarchy": 1, - "campaign": { - "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": true, - "object": "campaign" - }, - "campaign_id": null, - "active": false, - "start_date": "2022-09-22T00:00:00.000Z", - "expiration_date": "2022-09-29T00:00:00.000Z", - "validity_timeframe": { - "interval": "P3D", - "duration": "P2D" - }, - "validity_day_of_week": [ - 1, - 2, - 3 - ], - "summary": { - "redemptions": { - "total_redeemed": 0 - }, - "orders": { - "total_amount": 0, - "total_discount_amount": 0 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_8e3e53ZgDNcoRGAI", - "rule_id": "val_q8qUBMOh5qIQ", - "related_object_id": "promo_hINAfBAVhmFuSAzi3vptfyxW", - "related_object_type": "promotion_tier", - "created_at": "2022-09-22T12:40:23.286Z", - "object": "validation_rules_assignment" - } - ], - "total": 1 - } - } - } + }, + "Pay with Points": { + "value": { + "name": "Pay with Points Reward", + "type": "COIN", + "metadata": { + "Type": "Coin" + }, + "parameters": { + "coin": { + "exchange_ratio": 900, + "points_ratio": 8000 + } + } + } + }, + "Material Reward": { + "value": { + "name": "Get a Comic Book", + "metadata": { + "Type": "Material" + }, + "type": "MATERIAL", + "parameters": { + "product": { + "id": "prod_0b15f6b9f650c16990", + "sku_id": "sku_0b1621b319d248b79f" } + }, + "stock": 2, + "attributes": { + "image_url": "https://www.website.com/img_fPHsk9Ob.png", + "description": "Archie's Series" } } } } - }, - "delete": { - "operationId": "delete-promotion-tier", - "tags": [ - "PROMOTIONS API" - ], - "summary": "Delete Promotion Tier", - "description": "This method deletes a promotion tier.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." - }, - "404": { - "description": "Returns an error indicating that the promotion tier with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find promotion_tier with id promo_2EnAik6Jt7dKTOMkRTIgEjZ", - "request_id": "v-0ae284707e9027a79d", - "resource_id": "promo_2EnAik6Jt7dKTOMkRTIgEjZ", - "resource_type": "promotion_tier" - } + } + } + }, + "responses": { + "200": { + "description": "Returns a reward object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_obj_reward_object" + }, + "examples": { + "Material": { + "value": { + "id": "rew_Crmu3hu2FKZWZIML59AeAs1n", + "name": "Material Reward", + "type": "MATERIAL", + "parameters": { + "product": { + "id": "prod_0b15f6b9f650c16990", + "sku_id": "sku_0b1621b319d248b79f" } - } + }, + "stock": "2", + "redeemed": null, + "attributes": { + "image_url": "https://www.website.com/img_fPH9oOb.png", + "description": "Archie's Series" + }, + "created_at": "2022-08-25T11:20:58.172Z", + "updated_at": null, + "metadata": { + "Type": "Material" + }, + "object": "reward" } } } } } + } + } + } + }, + "/v1/rewards/{rewardId}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "rew_2erjvECLs92GYzKbak3QkyTV" }, - "/v1/promotions/tiers/{promotionTierId}/enable": { - "parameters": [ - { + "name": "rewardId", + "in": "path", + "required": true, + "description": "A unique reward ID." + } + ], + "get": { + "operationId": "get-reward", + "tags": [ + "REWARDS API" + ], + "summary": "Get Reward", + "description": "Retrieve a reward by the reward ID.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a reward object if a valid identifier was provided. ", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" - }, - "name": "promotionTierId", - "in": "path", - "required": true, - "description": "Unique promotion tier ID." + "$ref": "#/components/schemas/4_obj_reward_object" + } } - ], - "post": { - "operationId": "enable-promotion-tier", - "tags": [ - "PROMOTIONS API" - ], - "summary": "Enable Promotion Tier", - "description": "This method enables a promotion tier, i.e. makes the `active` parameter = `true`.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + } + }, + "404": { + "description": "Not Found. When requesting a reward that has been deleted or does not exist, the resource will not be returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find reward with id rew_C7wS9eHFDN4CIbXI5PpLSkG", + "request_id": "v-0b8c77bcc890215e35", + "resource_id": "rew_C7wS9eHFDN4CIbXI5PpLSkG", + "resource_type": "reward" + } + } } - ], - "responses": { - "200": { - "description": "Returns the promotion tier object with an updated `active` parameter.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_obj_promotion_tier_object" - }, - "examples": { - "Example": { - "value": { - "id": "promo_NzjTc3ZXTe7md5SziK3uYtei", - "created_at": "2022-09-21T11:38:34.962Z", - "updated_at": "2022-09-22T10:32:07.712Z", - "name": "Order more than $100", - "banner": "Order more than $100", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 3000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "hierarchy": 1, - "campaign": { - "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": true, - "object": "campaign" - }, - "campaign_id": null, - "active": true, - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "summary": { - "redemptions": { - "total_redeemed": 2 - }, - "orders": { - "total_amount": 37650, - "total_discount_amount": 6000 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": null - } - } + } + } + } + } + }, + "put": { + "operationId": "update-reward", + "tags": [ + "REWARDS API" + ], + "summary": "Update Reward", + "description": "Update the details of a reward.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Define the parameters to be updated for the reward.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_req_update_reward" + }, + "examples": { + "Gift card credits": { + "value": { + "name": "Digital - Gift Card Reward", + "metadata": { + "Type": "Gift" + }, + "parameters": { + "campaign": { + "id": "camp_hC2GdqYtOmTT45zfhib62cK1", + "balance": 3000 } } } }, - "404": { - "description": "Returns an error if the promotion tier cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Example": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find promotion_tier with id promo_NzjTc3ZXTe7md5SziK3uYte", - "request_id": "v-0bbaea52be14cc9782", - "resource_id": "promo_NzjTc3ZXTe7md5SziK3uYte", - "resource_type": "promotion_tier" - } - } + "Discount Coupon": { + "value": { + "name": "Digital - Discount Coupon", + "metadata": { + "Type": "Discount" + }, + "parameters": { + "campaign": { + "id": "camp_hC2GdqYtOmTT45zfhib62cK1" + } + } + } + }, + "Loyalty points": { + "value": { + "name": "Digital - Loyalty Points Reward", + "metadata": { + "Type": "Loyalty Points" + }, + "parameters": { + "campaign": { + "id": "camp_hC2GdqYtOmTT45zfhib62cK1", + "balance": 100 + } + } + } + }, + "Pay with Points": { + "value": { + "name": "Pay with Points Reward", + "metadata": { + "Type": "Coin" + }, + "parameters": { + "coin": { + "exchange_ratio": 900, + "points_ratio": 8000 + } + } + } + }, + "Material Reward": { + "value": { + "name": "Get a Comic Book", + "metadata": { + "Type": "Physical product" + }, + "parameters": { + "product": { + "id": "prod_0b15f6b9f650c16990", + "sku_id": "sku_0b1621b319d248b79f" } + }, + "stock": 2, + "attributes": { + "image_url": "https://www.website.com/img_fPH9.png", + "description": "Comic book" } } } } } - }, - "/v1/promotions/tiers/{promotionTierId}/disable": { - "parameters": [ - { + } + }, + "responses": { + "200": { + "description": "Returns an updated reward object.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "promo_NzjTc3ZXTe7md5SziK3uYtei" + "$ref": "#/components/schemas/4_obj_reward_object" }, - "name": "promotionTierId", - "in": "path", - "required": true, - "description": "Unique promotion tier ID." - } - ], - "post": { - "operationId": "disable-promotion-tier", - "tags": [ - "PROMOTIONS API" - ], - "summary": "Disable Promotion Tier", - "description": "This method disables a promotion tier, i.e. makes the `active` parameter = `false`.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns the promotion tier object with an updated `active` parameter.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_obj_promotion_tier_object" - }, - "examples": { - "Example": { - "value": { - "id": "promo_NzjTc3ZXTe7md5SziK3uYtei", - "created_at": "2022-09-21T11:38:34.962Z", - "updated_at": "2022-09-22T10:34:09.529Z", - "name": "Order more than $100", - "banner": "Order more than $100", - "action": { - "discount": { - "type": "AMOUNT", - "amount_off": 3000, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "hierarchy": 1, - "campaign": { - "id": "camp_VEL7UX0jZjrvLx3hfNZBVzpq", - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "active": true, - "object": "campaign" - }, - "campaign_id": null, - "active": false, - "start_date": "2022-09-21T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "summary": { - "redemptions": { - "total_redeemed": 2 - }, - "orders": { - "total_amount": 37650, - "total_discount_amount": 6000 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": null - } + "examples": { + "Material": { + "value": { + "id": "rew_wg2pvCr5LDhCq4uVQZ9LhuZm", + "name": "Get a Comic Book", + "type": "MATERIAL", + "parameters": { + "product": { + "id": "prod_0b15f6b9f650c16990", + "sku_id": "sku_0b1621b319d248b79f" } - } + }, + "stock": "2", + "redeemed": null, + "attributes": { + "image_url": "https://www.website.com/img_fPH9.png", + "description": "Comic book" + }, + "created_at": "2022-08-25T10:00:12.794Z", + "updated_at": "2022-08-25T10:06:30.655Z", + "metadata": { + "Type": "Physical product" + }, + "object": "reward" } } + } + } + } + }, + "400": { + "description": "Returns an error if the balance parameter is not defined correctly.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_400_invalid_balance" }, - "404": { - "description": "Returns an error if the promotion tier cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Example": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find promotion_tier with id promo_NzjTc3ZXTe7md5SziK3uYte", - "request_id": "v-0bbaea52be14cc9782", - "resource_id": "promo_NzjTc3ZXTe7md5SziK3uYte", - "resource_type": "promotion_tier" - } - } - } + "examples": { + "Invalid Balance": { + "value": { + "code": 400, + "key": "invalid_balance", + "message": "Property 'parameters.campaign.balance' is invalid", + "details": "Property 'parameters.campaign.balance' must be greater than zero for campaign type: GIFT_VOUCHERS", + "request_id": "v-0b96d2b90dce48855f" } } } } } + } + } + }, + "delete": { + "operationId": "delete-reward", + "tags": [ + "REWARDS API" + ], + "summary": "Delete Reward", + "description": "Delete a reward.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." }, - "/v1/promotions/stacks": { - "get": { - "operationId": "list-all-promotion-stacks", - "tags": [ - "PROMOTIONS API" - ], - "summary": "List Promotion Stacks", - "description": "This method enables you to list promotion stacks irrespective of the campaign they are associated with. \n\nYou can use filters in the query parameters to specify the stacks to be returned in the response.\n\n## Advanced filters for fetching promotion stacks\n\n| **Filters** | **Examples** |\n| :--- | :--- |\n| Created Before | - `[created_at][before]=2021-12-30T13:52:18.227Z`
                  - `[filters][created_at][conditions][$before][0]=2021-12-30T13:52:18.227Z` |\n| Created After | - `[created_at][after]=2021-12-30T13:52:18.227Z`
                  - `[filters][created_at][conditions][$after][0]=2021-12-30T13:52:18.227Z` |\n| Updated Before | - `[updated_at][before]=2021-12-30T13:52:18.227Z`
                  - `[filters][updated_at][conditions][$before][0]=2021-12-30T13:52:18.227Z` |\n| Updated After | - `[updated_at][after]=2021-12-30T13:52:18.227Z`
                  - `[filters][updated_at][conditions][$after][0]=2021-12-30T13:52:18.227Z` |", - "parameters": [ - { - "schema": { - "type": "integer" - }, - "in": "query", - "name": "limit", - "description": "A limit on the number of objects to be returned. Limit can range between 1 and 100 items." - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "description": "Which page of results to return.", - "name": "page" - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at", - "name", - "-name" - ] - }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." - }, - { - "$ref": "#/components/parameters/created_at" - }, - { - "$ref": "#/components/parameters/updated_at" - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary with a `data` property that contains an array of promotion stacks across all your campaigns.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_res_list_promotion_stacks" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "stack_SLuhQrAt3mXwHg776lYkzZO8", - "name": "Stack 2", - "created_at": "2022-11-03T10:18:58.356Z", - "campaign_id": "camp_h8RyP6FV94F3Ev2odP24j5p1", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_Mfww2TuoeU23enqSmnz0f3rh", - "promo_vU5IHaLKS7mmZ3ylABET6ikb", - "promo_TeHA11JlfN29mUftDcpqIWWq", - "promo_bhKBsIX3tO7yqmpTLCLLuaud" - ], - "hierarchy_mode": "MANUAL" - } - }, - { - "id": "stack_twQWp1TyaxX5RlSqn061xGVy", - "name": "First stack", - "created_at": "2021-12-27T11:59:21.838Z", - "updated_at": "2022-12-16T08:22:51.970Z", - "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_Vet0vCNyyo5pOddHfu2X3FCB", - "promo_PoIyRVFA5c0Jk514xCpzKHga", - "promo_Mwy9XpA0TLctSGriM5kum0qp" - ], - "hierarchy_mode": "MANUAL" - } - }, - { - "id": "stack_vhCqN5PY7rmPw8yACRvHRZaz", - "name": "Second stack", - "created_at": "2021-12-27T11:55:47.431Z", - "updated_at": "2022-12-16T08:22:52.221Z", - "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_Vet0vCNyyo5pOddHfu2X3FCB", - "promo_PoIyRVFA5c0Jk514xCpzKHga", - "promo_Mwy9XpA0TLctSGriM5kum0qp" - ], - "hierarchy_mode": "MANUAL" - } - }, - { - "id": "stack_zwChew7GY1AnDZJQ6GVP2sdT", - "name": "Third stack", - "created_at": "2021-12-27T11:54:26.283Z", - "updated_at": "2022-12-16T08:22:52.483Z", - "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_Vet0vCNyyo5pOddHfu2X3FCB", - "promo_Mwy9XpA0TLctSGriM5kum0qp", - "promo_PoIyRVFA5c0Jk514xCpzKHga" - ], - "hierarchy_mode": "MANUAL" - } - }, - { - "id": "stack_NS5hEUznL9XPa89rbrOZYMey", - "name": "Fourth stack", - "created_at": "2021-12-27T11:48:43.982Z", - "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_Vet0vCNyyo5pOddHfu2X3FCB", - "promo_Mwy9XpA0TLctSGriM5kum0qp", - "promo_PoIyRVFA5c0Jk514xCpzKHga" - ], - "hierarchy_mode": "MANUAL" - } - }, - { - "id": "stack_Rz0NvFtCZOObS3J5R68KET17", - "name": "Third stack", - "created_at": "2021-12-27T11:40:57.426Z", - "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_Vet0vCNyyo5pOddHfu2X3FCB", - "promo_PoIyRVFA5c0Jk514xCpzKHga" - ], - "hierarchy_mode": "MANUAL" - } - }, - { - "id": "stack_e8pH0nIuANmYRPE0x8hwDrpm", - "name": "Second stack", - "created_at": "2021-12-27T08:43:13.875Z", - "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_Mwy9XpA0TLctSGriM5kum0qp", - "promo_PoIyRVFA5c0Jk514xCpzKHga" - ], - "hierarchy_mode": "MANUAL" - } - }, - { - "id": "stack_3Q4EJpZqg3DI5IRwgBYfsb37", - "name": "First stack", - "created_at": "2021-12-27T08:43:13.498Z", - "campaign_id": "camp_HXsR22VUMC4hN4DR7eAhCalp", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_Vet0vCNyyo5pOddHfu2X3FCB", - "promo_PoIyRVFA5c0Jk514xCpzKHga" - ], - "hierarchy_mode": "MANUAL" - } - }, - { - "id": "stack_KxSD0GahLUg9ULB6TseGfUHJ", - "name": "Stack 1", - "created_at": "2021-12-23T12:28:38.881Z", - "campaign_id": "camp_h8RyP6FV94F3Ev2odP24j5p1", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_NMex647s5UushvbBUJmYT2Fc", - "promo_4TqHr24boFISDrcOHSlfAxwm" - ], - "hierarchy_mode": "MANUAL" - } - } - ], - "total": 9 - } - } - } + "400": { + "description": "Bad Request. Returns an error indicating that the reward with given ID is assigned to a resource.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_400_resource_in_use" + }, + "examples": { + "Example": { + "value": { + "code": 400, + "key": "resource_in_use", + "message": "Resource in use", + "details": "Resource reward with id rew_fcYALROsORec6cP0VBItCVfq is in use by reward_assignments with ids [rewa_5WV7H3y2lT3GGl03Xjw29IEc]", + "request_id": "v-0b8c7b967950216291", + "related_object_ids": [ + "rewa_5WV7H3y2lT3GGl03Xjw29IEc" + ], + "related_object_type": "reward_assignment" } } } } } }, - "/v1/promotions/{campaignId}/stacks": { - "parameters": [ - { + "404": { + "description": "Returns an error indicating that the reward with given ID was not found.", + "content": { + "application/json": { "schema": { - "type": "string" + "$ref": "#/components/schemas/e_404_not_found" }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID." - } - ], - "get": { - "operationId": "list-promotion-stacks-in-campaign", - "tags": [ - "PROMOTIONS API" - ], - "summary": "List Promotion Stacks in Campaign", - "description": "This method enables you to list promotion stacks from a specified campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + "examples": { + "Reward Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find reward with id rew_2erjvECLs92GYzKbak3QkyT", + "request_id": "v-0ae29895e8c6b7781a", + "resource_id": "rew_2erjvECLs92GYzKbak3QkyT", + "resource_type": "reward" + } + } } - ], - "responses": { - "200": { - "description": "Returns a list of promotion stack objects.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_res_list_promotion_stacks" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "stack_p0WhtyyDU95crobleMpRabhH", - "name": "First stack", - "created_at": "2022-09-22T13:03:25.740Z", - "campaign_id": "camp_99HUWI53bVyLzPN1Fg5TBLWX", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_dJNhAEeV5sR5oPQq1UrUdnMC", - "promo_aaAF8mVAzA0PF1igia2OC63d" - ], - "hierarchy_mode": "MANUAL" - } - }, - { - "id": "stack_XAzn8AFR3Ks3DBPLAQxV7zHe", - "name": "Second stack", - "created_at": "2022-09-22T13:03:25.903Z", - "campaign_id": "camp_99HUWI53bVyLzPN1Fg5TBLWX", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_aaAF8mVAzA0PF1igia2OC63d", - "promo_dJNhAEeV5sR5oPQq1UrUdnMC" - ], - "hierarchy_mode": "MANUAL" - } - } - ], - "total": 2 - } + } + } + } + } + } + }, + "/v1/rewards/{rewardId}/assignments": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "rewardId", + "in": "path", + "required": true, + "description": "A unique reward ID." + } + ], + "get": { + "operationId": "list-reward-assignments", + "tags": [ + "REWARDS API" + ], + "summary": "List Reward Assignments", + "description": "Retrieve reward assignments by the reward ID.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary of reward assignment objects. Each object contains information regarding the resource to which the reward was assigned and the cost in loyalty points for the reward.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_res_list_reward_assignments" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "rewa_PbIRoMXpwe5QhobW4JKu0VjH", + "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", + "related_object_id": "camp_wciTvaOfYmAa3EmIIW3QpXXZ", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 15 + } + }, + "created_at": "2022-08-17T08:13:02.507Z", + "updated_at": null, + "object": "reward_assignment" + }, + { + "id": "rewa_pJYQBXSitK2OVPK3XMXZK76X", + "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", + "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 20 + } + }, + "created_at": "2022-08-24T11:40:22.418Z", + "updated_at": null, + "object": "reward_assignment" } - } + ], + "total": 2 } } } } - }, - "post": { - "operationId": "create-promotion-stack", - "tags": [ - "PROMOTIONS API" - ], - "summary": "Create Promotion Stack", - "description": "This method creates one promotion stack. The sequence of promotion tier IDs will determine the promotion stacking order.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the order of promotion tiers for the promotion stack.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_req_create_promotion_stack" - }, - "examples": { - "Example": { - "value": { - "name": "Fifth Stack", - "tiers": { - "ids": [ - "promo_aaAF8mVAzA0PF1igia2OC63d", - "promo_t9zdL6XMFk7B8fQ23zxELtdE", - "promo_dJNhAEeV5sR5oPQq1UrUdnMC" - ], - "hierarchy_mode": "MANUAL" - } - } - } + } + }, + "404": { + "description": "Returns an error if the given reward is missing, does not exist or was deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find reward with id rew_C7wS9eHFDN4CIbXI5PpLSkGYi", + "request_id": "v-0b95a68c678ad5c765", + "resource_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGYi", + "resource_type": "reward" } } } + } + } + } + } + }, + "post": { + "operationId": "create-reward-assignment", + "tags": [ + "REWARDS API" + ], + "summary": "Create Reward Assignment", + "description": "Assigns a reward to a specified loyalty campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Provide the campaign ID of the campaign to which the reward is to be assigned and define the cost of the reward in terms of loyalty points.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_req_create_reward_assignment" }, - "responses": { - "200": { - "description": "Returns a new stack object if a valid promotion campaign identifier was provided in the path and available promotion IDs in the payload.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_obj_promotion_stack_object" - }, - "examples": { - "Example": { - "value": { - "id": "stack_q2AmzFvOMCmg4Wdu5bDBlME6", - "name": "Fifth Stack", - "created_at": "2022-09-23T07:44:53.888Z", - "campaign_id": "camp_99HUWI53bVyLzPN1Fg5TBLWX", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_aaAF8mVAzA0PF1igia2OC63d", - "promo_t9zdL6XMFk7B8fQ23zxELtdE", - "promo_dJNhAEeV5sR5oPQq1UrUdnMC" - ], - "hierarchy_mode": "MANUAL" - } - } - } + "examples": { + "Example": { + "value": { + "campaign": "camp_OTuGGP90PivbvROsRvfM65El", + "parameters": { + "loyalty": { + "points": 39 } } } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a reward assignment object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_obj_reward_assignment_object" }, - "404": { - "description": "Returns an error if the campaign or promotion tier cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Campaign Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id camp_99HUWI53bVyLzPN1Fg5TBLW", - "request_id": "v-0bbc10de5886137afd", - "resource_id": "camp_99HUWI53bVyLzPN1Fg5TBLW", - "resource_type": "campaign" - } - }, - "Promotion Tier Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find promotion_tier with id promo_dJNhAEeV5sR5oPQq1UrUdnM", - "request_id": "v-0bbc11186303fa288a", - "resource_id": "promo_dJNhAEeV5sR5oPQq1UrUdnM", - "resource_type": "promotion_tier" - } + "examples": { + "Example": { + "value": { + "id": "rewa_cqD2XE5x8LcD2c1FLlvqikti", + "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", + "related_object_id": "camp_OTuGGP90PivbvROsRvfM65El", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 39 } - } + }, + "created_at": "2022-08-24T13:44:42.610Z", + "updated_at": null, + "object": "reward_assignment" } } } } } }, - "/v1/promotions/{campaignId}/stacks/{stackId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_BcHeMm4QaKjqCWMQFecMp1U0" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "ID of the promotion campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty Campaign`. " - }, - { + "400": { + "description": "Returns an error if request body parameters are missing.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "stack_KOIde7AUf08at12lZ1r3OfFL" + "$ref": "#/components/schemas/e_400_missing_param" }, - "name": "stackId", - "in": "path", - "required": true, - "description": "Promotion stack ID." - } - ], - "get": { - "operationId": "get-promotion-stack", - "tags": [ - "PROMOTIONS API" - ], - "summary": "Get Promotion Stack", - "description": "This method returns the details of a promotion stack, including the promotion tiers grouped within the stack.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + "examples": { + "Missing Parameter": { + "value": { + "code": 400, + "key": "missing_param", + "message": "Missing required parameter", + "details": "Parameter 'parameters.loyalty' is required", + "request_id": "v-0b95c7f3684ad5f06d" + } + } } - ], - "responses": { - "200": { - "description": "Returns a stack object if valid identifiers were provided in the path.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_obj_promotion_stack_object" - }, - "examples": { - "Example": { - "value": { - "id": "stack_p0WhtyyDU95crobleMpRabhH", - "name": "First stack", - "created_at": "2022-09-22T13:03:25.740Z", - "campaign_id": "camp_99HUWI53bVyLzPN1Fg5TBLWX", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_dJNhAEeV5sR5oPQq1UrUdnMC", - "promo_aaAF8mVAzA0PF1igia2OC63d" - ], - "hierarchy_mode": "MANUAL" - } - } - } - } + } + } + }, + "404": { + "description": "Returns an error when creating a reward assignment for a reward that has been deleted or does not exist.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Reward Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find reward with id rew_C7wS9eHFDN4CIbXI5PpLSkGYi", + "request_id": "v-0b95c0bedf46fcbe83", + "resource_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGYi", + "resource_type": "reward" + } + }, + "Missing Campaign": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id null", + "request_id": "v-0b95c68b12cad5eebb", + "resource_id": null, + "resource_type": "campaign" } } + } + } + } + }, + "409": { + "description": "Returns an error if a conflict is found, i.e. an assignment for the reward has already been created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_409_duplicate_found" }, - "404": { - "description": "Returns an error if the campaign or promotion stack cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Stack Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find promotion_stack with id stack_p0WhtyyDU95crobleMpRabh", - "request_id": "v-0bbc0a659591f99d65", - "resource_id": "stack_p0WhtyyDU95crobleMpRabh", - "resource_type": "promotion_stack" - } - }, - "Campaign Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id camp_99HUWI53bVyLzPN1Fg5TBLW", - "request_id": "v-0bbc0aa77a0c8b78e8", - "resource_id": "camp_99HUWI53bVyLzPN1Fg5TBLW", - "resource_type": "campaign" - } - } - } + "examples": { + "Duplicate Found": { + "value": { + "code": 409, + "key": "duplicate_found", + "message": "Duplicated resource found", + "details": "Duplicated reward_assignment exists with id rewa_q1Ad955TUZS4nVIxplOw9pL3", + "request_id": "v-0b95c78daa06fcc6bb", + "resource_id": "rewa_q1Ad955TUZS4nVIxplOw9pL3", + "resource_type": "reward_assignment" } } } } - }, - "put": { - "operationId": "update-promotion-stack", - "tags": [ - "PROMOTIONS API" - ], - "summary": "Update Promotion Stack", - "description": "This methods allows for editing an existing stack.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the promotion stack parameters that you would like to update.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_req_create_promotion_stack" - }, - "examples": { - "Example": { - "value": { - "name": "Fifth Stack Modified", - "tiers": { - "ids": [ - "promo_aaAF8mVAzA0PF1igia2OC63d", - "promo_t9zdL6XMFk7B8fQ23zxELtdE" - ], - "hierarchy_mode": "MANUAL" - } - } + } + } + } + } + }, + "/v1/rewards/{rewardId}/assignments/{assignmentId}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "rew_2erjvECLs92GYzKbak3QkyTV" + }, + "name": "rewardId", + "in": "path", + "required": true, + "description": "A unique reward ID." + }, + { + "schema": { + "type": "string", + "example": "rewa_YkwQ5ezNYTQV2geodMVhTpy4" + }, + "name": "assignmentId", + "in": "path", + "required": true, + "description": "A unique reward assignment ID." + } + ], + "put": { + "operationId": "update-reward-assignment", + "tags": [ + "REWARDS API" + ], + "summary": "Update Reward Assignment", + "description": "Update the number of points needed to successfully redeem the reward.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Define the number of points required to exchange for the reward.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_req_update_reward_assignment" + }, + "examples": { + "Example": { + "value": { + "parameters": { + "loyalty": { + "points": 35 } } } } - }, - "responses": { - "200": { - "description": "Returns a promotion stack with updated parameters if the update was successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/3_obj_promotion_stack_object" - }, - "examples": { - "Example": { - "value": { - "id": "stack_q2AmzFvOMCmg4Wdu5bDBlME6", - "name": "Fifth Stack Modified", - "created_at": "2022-09-23T07:44:53.888Z", - "updated_at": "2022-09-23T07:59:44.172Z", - "campaign_id": "camp_99HUWI53bVyLzPN1Fg5TBLWX", - "object": "promotion_stack", - "tiers": { - "ids": [ - "promo_aaAF8mVAzA0PF1igia2OC63d", - "promo_t9zdL6XMFk7B8fQ23zxELtdE" - ], - "hierarchy_mode": "MANUAL" - } - } + } + } + } + }, + "responses": { + "200": { + "description": "Returns the updated reward assignment object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_obj_reward_assignment_object" + }, + "examples": { + "Example": { + "value": { + "id": "rewa_pJYQBXSitK2OVPK3XMXZK76X", + "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", + "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 35 } - } + }, + "created_at": "2022-08-24T11:40:22.418Z", + "updated_at": "2022-08-24T13:02:32.262Z", + "object": "reward_assignment" } } } } - }, - "delete": { - "operationId": "delete-promotion-stack", - "tags": [ - "PROMOTIONS API" - ], - "summary": "Delete Promotion Stack", - "description": "This method deletes a promotion stack.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." - }, - "404": { - "description": "Returns an error indicating that the stack or campaign with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Stack Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find promotion_stack with id stack_KOIde7AUf08at12lZ1r3OfFp", - "request_id": "v-0ae289ca779027b030", - "resource_id": "stack_KOIde7AUf08at12lZ1r3OfFp", - "resource_type": "promotion_stack" - } - }, - "Campaign Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id Summer % Promotion", - "request_id": "v-0ae28a621c46af534b", - "resource_id": "Summer % Promotion", - "resource_type": "campaign" - } - } - } + } + }, + "404": { + "description": "Returns an error indicating that the reward assignment with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find reward_assignment with id rewa_pJYQBXSitK2OVPK3XMXZK76XI", + "request_id": "v-0b95b8760a4ad5dda1", + "resource_id": "rewa_pJYQBXSitK2OVPK3XMXZK76XI", + "resource_type": "reward_assignment" } } } } } + } + } + }, + "delete": { + "operationId": "delete-reward-assignment", + "tags": [ + "REWARDS API" + ], + "summary": "Delete Reward Assignment", + "description": "This method deletes a reward assignment for a particular reward.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." }, - "/v1/reward-object": { - "get": { - "operationId": "reward-object", - "tags": [ - "REWARDS API" - ], - "summary": "Reward Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Reward object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_obj_reward_object" - } + "404": { + "description": "Returns an error indicating that the reward or reward assignment with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Reward Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find reward with id rew_2erjvECLs92GYzKbak3QkyT", + "request_id": "v-0ae29f325e1027cde8", + "resource_id": "rew_2erjvECLs92GYzKbak3QkyT", + "resource_type": "reward" + } + }, + "Reward Assignment Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find reward_assignment with id rewa_YkwQ5ezNYTQV2geodMVhTpy", + "request_id": "v-0ae2a0588b9027cf95", + "resource_id": "rewa_YkwQ5ezNYTQV2geodMVhTpy", + "resource_type": "reward_assignment" } } } } } + } + } + }, + "get": { + "operationId": "get-reward-assignment", + "tags": [ + "REWARDS API" + ], + "summary": "Get Reward Assignment", + "description": "Retrieve a reward assignment.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a reward assignment object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_obj_reward_assignment_object" + } + } + } }, - "/v1/reward-assignment-object": { - "get": { - "operationId": "reward-assignment-object", - "tags": [ - "REWARDS API" - ], - "summary": "Reward Assignment Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Reward Assignment Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" - } + "404": { + "description": "Returns an error indicating that the reward assignment with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Reward Assignment Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find reward_assignment with id rewa_pJYQBXSitK2OVPK3XMXZK76X", + "request_id": "v-0b95b596e98ad5da24", + "resource_id": "rewa_pJYQBXSitK2OVPK3XMXZK76X", + "resource_type": "reward_assignment" } } } } } + } + } + } + }, + "/v1/publication-object": { + "get": { + "operationId": "publication-object", + "tags": [ + "PUBLICATIONS API" + ], + "summary": "Publication Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Publication Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/5_obj_publication_object" + } + } + } + } + } + } + }, + "/v1/publications/create": { + "get": { + "operationId": "create-publication-1", + "tags": [ + "PUBLICATIONS API" + ], + "summary": "Create Publication", + "description": "This method selects vouchers that are suitable for publication, adds a publish entry and returns the publication.\n\nA voucher is suitable for publication when it's active and hasn't been published yet.\n> ❗️ Limited access\n>\n> Access to this endpoint is limited. This endpoint is designed for specific integrations and the API keys need to be configured to access this endpoint. Navigate to the **Dashboard** → **Project Settings** → **General** → **Integration Keys** to set up a pair of API keys and use them to send the request. \n\n\n> 🚧 Clearly define the source of the voucher\n>\n> You must clearly define which source you want to publish the voucher code from. It can either be a code from a campaign or a specific voucher identified by a code. \n\n> 🚧 Publish multiple vouchers\n> This endpoint does not support the publishing of multiple vouchers from a single campaign. In case you want to publish multiple vouchers within a single publication, you need to use a [dedicated endpoint](ref:create-publication). \n\n\n> 📘 Specifying the voucher to be published\n>\n> - In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use an **auto-update** campaign and in the query parameters specify the `campaign` without specifying the voucher.\n> - If you would like to publish a specific code from a specific campaign, then you need to provide the `campaign` and the `voucher` parameters.\n> - If you would like to publish a standalone voucher, then omit the campaign parameter and simply provide the `voucher` parameter. \n\n## Example Request \n```markdown Publication Query \n/publications/create?campaign=camp_T0bUgWGCAV6S0X3smH4MEboG&metadata[year]=2&metadata[Date]=2023-03-03&metadata[DateTime]=2023-03-03T14:06:08.311Z&metadata[Flag]=true&metadata[Number]=222&metadata[String]=stringy&metadata[ImageURL]=https://user-images.githubusercontent.com/95409292/222734777-a6d9e41a-de3a-42a8-8cc7-24f31e857edd.png&metadata[Object][payment][payment_tax]=9&metadata[Object][payment][payment_method]=Visa&metadata[Object][payment][payment_date]=2023-03-03&metadata[Object][payment][payment_datetime]=2023-03-03T14:06:08.311Z&metadata[Object][payment][payment_completed]=true&metadata[Object][payment][payment_url]=https://user-images.githubusercontent.com/95409292/222734777-a6d9e41a-de3a-42a8-8cc7-24f31e857edd.png&customer[source_id]=try-new-12&customer[name]=John%20Jimmy&customer[description]=This is testing the publication endpoint.&customer[email]=johnjimy2%40email.com&customer[phone]=%2B48%20123%20333%20333&customer[address][city]=Warsaw&customer[address][state]=Mazowieckie&customer[address][line_1]=4499%20Main%20St.&customer[address][line_2]=Blg%202%20APT%204&customer[address][country]=Poland&customer[address][postal_code]=122333&customer[birthday]=2222-01-22&customer[metadata][paid_bill]=true&customer[metadata][age]=22&customer[metadata][location]=Poland&customer[metadata][acquisition_date]=2022-09-09&customer[metadata][birth_date]=2023-03-20T18:44:19.215Z&customer[metadata][ImageURL]=https://user-images.githubusercontent.com/95409292/222734777-a6d9e41a-de3a-42a8-8cc7-24f31e857edd.png&customer[metadata][location-unknown][city]=Katowice&customer[metadata][location-unknown][state]=slask&customer[metadata][location-unknown][number]=2&customer[metadata][location-unknown][date]=2034-09-11&customer[metadata][location-unknown][dateTime]=2023-03-20T18:44:19.215Z&customer[metadata][Object][payment][payment_date]=2023-03-03&customer[metadata][Object][payment][payment_datetime]=2023-03-03T14:06:08.311Z&customer[metadata][Object][payment][payment_completed]=true&customer[metadata][Object][payment][payment_url]=https://user-images.githubusercontent.com/95409292/222734777-a6d9e41a-de3a-42a8-8cc7-24f31e857edd.png&customer[metadata][Object][payment][payment_tax]=9&customer[metadata][Object][payment][payment_method]=Visa```", + "parameters": [ + { + "schema": { + "type": "string", + "example": "custom_publication_source_id" + }, + "in": "query", + "name": "source_id", + "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service." }, - "/v1/rewards": { - "get": { - "operationId": "list-rewards", - "tags": [ - "REWARDS API" - ], - "summary": "List Rewards", - "description": "Retrieve rewards.", - "parameters": [ + { + "schema": { + "type": "string", + "example": "PROMO-1LwwzYI" + }, + "in": "query", + "name": "voucher", + "description": "Code of voucher being published. If there is a particular code that you would like to publish, then you can use this parameter to specify the code. You can omit this parameter if you would like to publish a random code from a campaign, where the campaign is in `AUTO_UPDATE` mode." + }, + { + "name": "metadata", + "in": "query", + "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format.", + "style": "deepObject", + "explode": true, + "schema": { + "type": "object" + } + }, + { + "name": "customer", + "in": "query", + "required": true, + "description": "Specify the customer who is to receive a code. You can either directly provide the respective ID's as strings or provide them in the form of an object.", + "style": "deepObject", + "explode": true, + "schema": { + "anyOf": [ { - "$ref": "#/components/parameters/limit" + "$ref": "#/components/schemas/5_req_create_publication_customer" }, { - "$ref": "#/components/parameters/page" + "$ref": "#/components/schemas/5_res_create_publication_customer_id" }, { - "schema": { - "type": "string", - "example": "rewa_m9hEAu10KsPcLhGXiHG85aY0" - }, - "in": "query", - "name": "assignment_id", - "description": "A unique reward assignment ID. Use this parameter to get the reward details in the context of an assignment ID." - } - ], - "security": [ + "$ref": "#/components/schemas/5_res_create_publication_customer_source_id" + }, { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary of reward objects.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_res_list_rewards" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "rew_3e7IqghVtTR7L3xQMSCxjFu2", - "name": "Get $10", - "type": "CAMPAIGN", - "parameters": { - "campaign": { - "id": "camp_FNYR4jhqZBM9xTptxDGgeNBV", - "balance": 1000, - "type": "GIFT_VOUCHERS" - } - }, - "stock": null, - "redeemed": null, - "attributes": {}, - "created_at": "2022-03-10T08:40:20.917Z", - "updated_at": "2022-08-17T07:52:56.965Z", - "metadata": null, - "object": "reward" - }, - { - "id": "rew_nIy4gHpQHle2c3pNMwuj7G6j", - "name": "Get 100 Points", - "type": "CAMPAIGN", - "parameters": { - "campaign": { - "id": "camp_E87CubZLZ8eoQt3c4kAEZsx0", - "balance": 100, - "type": "LOYALTY_PROGRAM" - } - }, - "stock": null, - "redeemed": null, - "attributes": {}, - "created_at": "2022-02-28T11:56:13.764Z", - "updated_at": null, - "metadata": null, - "object": "reward" - }, - { - "id": "rew_BNZ3van6AF2AiquWp8Lfw0xq", - "name": "30% discount", - "type": "CAMPAIGN", - "parameters": { - "campaign": { - "id": "camp_ZtHLATYVpItqmuSqmaz1rZ2Y", - "type": "DISCOUNT_COUPONS" - } - }, - "stock": null, - "redeemed": null, - "attributes": {}, - "created_at": "2022-08-11T09:48:50.609Z", - "updated_at": null, - "metadata": {}, - "object": "reward" - }, - { - "id": "rew_nlV8bgWU1jNO9YWQ7CdZmzq7", - "name": "1 point = $0.01", - "type": "COIN", - "parameters": { - "coin": { - "exchange_ratio": 0.01, - "points_ratio": 1 - } - }, - "stock": null, - "redeemed": null, - "attributes": {}, - "created_at": "2022-08-11T16:45:21.582Z", - "updated_at": null, - "metadata": { - "Type": "0.01" - }, - "object": "reward" - }, - { - "id": "rew_x6FmF1KFdDs06hYPr9lK6ajf", - "name": "Material Reward", - "type": "MATERIAL", - "parameters": { - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619" - } - }, - "stock": "4", - "redeemed": "1", - "attributes": { - "image_url": "https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_wJHdZUAVSpWtYM6ORq4up3I2.png", - "description": "Get a Comic Book in Archie's series." - }, - "created_at": "2022-08-17T07:13:32.781Z", - "updated_at": null, - "metadata": { - "Type": "Personal" - }, - "object": "reward" - } - ], - "total": 5 - } - } - } - } - } + "$ref": "#/components/schemas/9_req_create_customer" } - } - }, - "post": { - "operationId": "create-reward", - "tags": [ - "REWARDS API" - ], - "summary": "Create Reward", - "description": "Create a new reward.", - "parameters": [], - "security": [ + ] + } + }, + { + "name": "campaign", + "in": "query", + "required": true, + "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`. You can use this parameter without having to specify a particular `voucher` code if the campaign is in `AUTO_UPDATE` mode. This parameter not required for a standalone code, however, if you intend to use a code from a campaign, then this parameter is required.", + "style": "deepObject", + "explode": true, + "schema": { + "anyOf": [ { - "X-App-Id-1": [], - "X-App-Token-1": [] + "$ref": "#/components/schemas/5_req_create_publication_campaign" + }, + { + "$ref": "#/components/schemas/5_req_create_publication_campaign_id" + }, + { + "$ref": "#/components/schemas/5_req_create_publication_campaign_name" } - ], - "requestBody": { - "description": "Define parameters of the new reward.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_req_create_reward" - }, - "examples": { - "Gift card credits": { - "value": { - "name": "Digital - Gift Card Reward", - "type": "CAMPAIGN", - "metadata": { - "Type": "Gift" - }, - "parameters": { - "campaign": { - "id": "camp_hC2GdqYtOmTT45zfhib62cK1", - "balance": 3000 - } - } - } - }, - "Discount Coupon": { - "value": { - "name": "Digital - Discount Coupon", - "type": "CAMPAIGN", - "metadata": { - "Type": "Discount" - }, - "parameters": { - "campaign": { - "id": "camp_hC2GdqYtOmTT45zfhib62cK1" - } - } - } - }, - "Loyalty Points": { - "value": { - "name": "Digital - Loyalty Points Reward", - "type": "CAMPAIGN", - "metadata": { - "Type": "Loyalty Points" - }, - "parameters": { - "campaign": { - "id": "camp_hC2GdqYtOmTT45zfhib62cK1", - "balance": 100 - } - } - } - }, - "Pay with Points": { - "value": { - "name": "Pay with Points Reward", - "type": "COIN", - "metadata": { - "Type": "Coin" + ] + } + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a publication object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/5_res_create_publication" + }, + "examples": { + "Example": { + "value": { + "id": "pub_ocaXCa023ayJ3WL1ARxUeKgIvg3JcEGh", + "object": "publication", + "created_at": "2022-09-30T16:30:32.924Z", + "customer_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", + "tracking_id": "pub_source_customer_5", + "metadata": { + "year": 2022 + }, + "channel": "myown", + "source_id": "publication_source_ID_10", + "result": "SUCCESS", + "customer": { + "id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", + "name": "Bob Jones", + "email": "bob.smith@email.com", + "source_id": "pub_source_customer_5", + "metadata": { + "lang": "en", + "test": true + }, + "object": "customer" + }, + "voucher": { + "id": "v_6Hy5FdNlu3dP65fJu5BgXma31Sl3rgkf", + "code": "cEsMn0uA", + "campaign": "Test - Discount Effect - Amount - Items", + "campaign_id": "camp_dphuwqH7BOVkgh4JmpDtS32l", + "category": null, + "category_id": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 300, + "effect": "APPLY_TO_ITEMS" + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX188XVmOotyCyR2j3G8sJR8HzS3DQ+6J1OElPWSmjlEnthuJc7rkc7WIVxjT4pTl1JVVkHEuGXNXdzRik11H8S18HQeQFJFiuwLZ2mzEC2zZitEinyUxtZwhnEHoi0eGAgYCG7iVMNuOQA==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX188XVmOotyCyR2j3G8sJR8HzS3DQ%2B6J1OElPWSmjlEnthuJc7rkc7WIVxjT4pTl1JVVkHEuGXNXdzRik11H8S18HQeQFJFiuwLZ2mzEC2zZitEinyUxtZwhnEHoi0eGAgYCG7iVMNuOQA%3D%3D" }, - "parameters": { - "coin": { - "exchange_ratio": 900, - "points_ratio": 8000 - } + "barcode": { + "id": "U2FsdGVkX18wDd9CcLM0Ef7aBfUSXZUoCQpuNpk4CHGOipbn+wFkfzcIZGBtUlxrI2KsXciCqF+c93AKzsymq5Yw8eEAFF/FK5f94z4/sgzaLDvyBmPCXHuS11Ew9S4ZEMjdTkUJftER2IlxWaCARA==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18wDd9CcLM0Ef7aBfUSXZUoCQpuNpk4CHGOipbn%2BwFkfzcIZGBtUlxrI2KsXciCqF%2Bc93AKzsymq5Yw8eEAFF%2FFK5f94z4%2FsgzaLDvyBmPCXHuS11Ew9S4ZEMjdTkUJftER2IlxWaCARA%3D%3D" } - } + }, + "is_referral_code": false, + "created_at": "2022-09-30T16:30:32.956Z", + "updated_at": null, + "holder_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", + "redemption": { + "quantity": 1, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/cEsMn0uA/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/cEsMn0uA/publications?page=1&limit=10" + }, + "object": "voucher" }, - "Material Reward": { - "value": { - "name": "Get a Comic Book", - "metadata": { - "Type": "Material" - }, - "type": "MATERIAL", - "parameters": { - "product": { - "id": "prod_0b15f6b9f650c16990", - "sku_id": "sku_0b1621b319d248b79f" - } - }, - "stock": 2, - "attributes": { - "image_url": "https://www.website.com/img_fPHsk9Ob.png", - "description": "Archie's Series" - } - } - } + "vouchers_id": [ + "v_6Hy5FdNlu3dP65fJu5BgXma31Sl3rgkf" + ] } } } - }, - "responses": { - "200": { - "description": "Returns a reward object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_obj_reward_object" - }, - "examples": { - "Material": { - "value": { - "id": "rew_Crmu3hu2FKZWZIML59AeAs1n", - "name": "Material Reward", - "type": "MATERIAL", - "parameters": { - "product": { - "id": "prod_0b15f6b9f650c16990", - "sku_id": "sku_0b1621b319d248b79f" - } - }, - "stock": "2", - "redeemed": null, - "attributes": { - "image_url": "https://www.website.com/img_fPH9oOb.png", - "description": "Archie's Series" - }, - "created_at": "2022-08-25T11:20:58.172Z", - "updated_at": null, - "metadata": { - "Type": "Material" - }, - "object": "reward" - } - } - } + } + } + }, + "400": { + "description": "Returns an error if the query parameters are incomplete.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Missing customer": { + "value": { + "code": 400, + "key": "invalid_query_params", + "message": "Invalid query params", + "details": "Query should have required property 'customer'", + "request_id": "v-0c8b6423f3c80ed3e4" + } + }, + "Missing vouchers": { + "value": { + "code": 400, + "key": "missing_vouchers", + "message": "Missing vouchers", + "details": "Either Campaign or Voucher is required" + } + }, + "Voucher cannot be published": { + "value": { + "code": 400, + "key": "voucher_cannot_be_published", + "message": "Voucher cannot be published", + "details": "Voucher cannot be published. Customer already joined program.", + "request_id": "v-0c8b763544080efed2" + } + }, + "Voucher already published": { + "value": { + "code": 400, + "key": "voucher_already_published", + "message": "Voucher already published", + "details": "Voucher 'v_vM7vQZmgV86k0wuz05cFAOfarj4s8BQE' has already been published", + "request_id": "v-0c8baebc67c80e97a0" + } + }, + "Duplicate source ID": { + "value": { + "code": 400, + "key": "duplicate_source_id", + "message": "Duplicate source_id", + "details": "Publication with source_id: 'test_publication_source_id_test_voucher' already exists", + "request_id": "v-0c8b7e8f78c80e94a2" + } + }, + "Too many vouchers requested": { + "value": { + "code": 400, + "key": "too_many_vouchers_requested", + "message": "Too many vouchers requested", + "details": "Only up to 1 can be published", + "request_id": "v-0c8bac9a25c80e912d" + } + }, + "Metadata validation failed": { + "value": { + "code": 400, + "key": "metadata_validation_failed", + "message": "Metadata validation failed", + "details": "ImageURL: must be a URL pointing to JPG/JPEG or PNG resource (actual value is 'http.com')", + "request_id": "v-0c8bcbd742080ee807" } } } } } }, - "/v1/rewards/{rewardId}": { - "parameters": [ - { + "403": { + "description": "Returns an error if you don't have a specific credentials set up. Navigate to the **Dashboard** → **Project Settings** → **General** → **Integration Keys** to set up a pair of API keys and use them to send the request.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "rew_2erjvECLs92GYzKbak3QkyTV" + "$ref": "#/components/schemas/e_integration_key" }, - "name": "rewardId", - "in": "path", - "required": true, - "description": "A unique reward ID." - } - ], - "get": { - "operationId": "get-reward", - "tags": [ - "REWARDS API" - ], - "summary": "Get Reward", - "description": "Retrieve a reward by the reward ID.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a reward object if a valid identifier was provided. ", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_obj_reward_object" - } + "examples": { + "Example": { + "value": { + "code": 403, + "message": "Forbidden", + "key": "integration_api_key_required" } } + } + } + } + }, + "404": { + "description": "Returns an error if a resource is not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" }, - "404": { - "description": "Not Found. When requesting a reward that has been deleted or does not exist, the resource will not be returned.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find reward with id rew_C7wS9eHFDN4CIbXI5PpLSkG", - "request_id": "v-0b8c77bcc890215e35", - "resource_id": "rew_C7wS9eHFDN4CIbXI5PpLSkG", - "resource_type": "reward" - } - } - } + "examples": { + "Resource not found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find customer with id cust_xqA7DGj5eYPHg6PHVKwYRWiA", + "request_id": "v-0c8b6b35294af6f192", + "resource_id": "cust_xqA7DGj5eYPHg6PHVKwYRWiA", + "resource_type": "customer" } } } } + } + } + } + } + }, + "/v1/publications": { + "get": { + "operationId": "list-publications", + "tags": [ + "PUBLICATIONS API" + ], + "summary": "List Publications", + "description": "Retrieve a list of publications. To return a **particular** publication, you can use the `source_id` query parameter and provide the `source_id` of the publication you are looking for specifically.\n\n## Pagination\n\n\n> 🚧 Important!\n>\n> If you want to scroll through a huge set of records, it is recommended to use the [Exports API](ref:create-export). This API will return an error `page_over_limit` if you reach a page above 1000.\n\n## Filter Query\n\nThe `filters` query parameter allows for joining multiple parameters with logical operators. The syntax looks as follows:\n\n\n```url\nfilters[][conditions][][]=\n```\n\n### Operators:\n\n\n```\n \"$in\"\n \"$not_in\"\n \"$is\"\n \"$is_not\"\n \"$has_value\"\n \"$is_unknown\"\n \"$contains\"\n \"$starts_with\"\n \"$ends_with\"\n \"$more_than\"\n \"$less_than\"\n \"$more_than_equal\"\n \"$less_than_equal\"\n```\n\n### Examples\n\n\n```url\nGET /v1/publications?filters[customer_id][conditions][$is][0]=cust_lUET6gRpO5Wxlg5p2j2gRCgL\n```\n\n```url\nGET /v1/publications?filters[customer_id][conditions][$in][0]=cust_lUET6gRpO5Wxlg5p2j2gRCgL&filters[customer_id][conditions][$in][1]=cust_aR7NfHusxT7PdTMAKMfWDXnc\n```\n\n```url\nGET /v1/publications?filters[customer_id][conditions][$is][0]=cust_lUET6gRpO5Wxlg5p2j2gRCgL&filters[customer_id][conditions][$is][1]=cust_aR7NfHusxT7PdTMAKMfWDXnc&filters[junction]=OR\n```", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "enum": [ + "id", + "-id", + "voucher_code", + "-voucher_code", + "tracking_id", + "-tracking_id", + "customer_id", + "-customer_id", + "created_at", + "-created_at", + "channel", + "-channel" + ] }, - "put": { - "operationId": "update-reward", - "tags": [ - "REWARDS API" - ], - "summary": "Update Reward", - "description": "Update the details of a reward.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Define the parameters to be updated for the reward.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_req_update_reward" - }, - "examples": { - "Gift card credits": { - "value": { - "name": "Digital - Gift Card Reward", - "metadata": { - "Type": "Gift" - }, - "parameters": { - "campaign": { - "id": "camp_hC2GdqYtOmTT45zfhib62cK1", - "balance": 3000 - } - } - } - }, - "Discount Coupon": { - "value": { - "name": "Digital - Discount Coupon", - "metadata": { - "Type": "Discount" - }, - "parameters": { - "campaign": { - "id": "camp_hC2GdqYtOmTT45zfhib62cK1" - } - } - } - }, - "Loyalty points": { - "value": { - "name": "Digital - Loyalty Points Reward", - "metadata": { - "Type": "Loyalty Points" - }, - "parameters": { - "campaign": { - "id": "camp_hC2GdqYtOmTT45zfhib62cK1", - "balance": 100 - } - } - } - }, - "Pay with Points": { - "value": { - "name": "Pay with Points Reward", + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "campaign", + "description": "Filters by a given campaign name." + }, + { + "schema": { + "type": "string", + "example": "cust_jl33V8ZDQJp4goU1z8DmFioo" + }, + "in": "query", + "name": "customer", + "description": "Filters by a unique customer ID." + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "voucher", + "description": "Filters by a given voucher code." + }, + { + "schema": { + "type": "string", + "enum": [ + "SUCCESS", + "FAILURE" + ] + }, + "in": "query", + "name": "result", + "description": "Filters by a publication result." + }, + { + "schema": { + "type": "string", + "enum": [ + "discount", + "loyalty", + "lucky_draw" + ] + }, + "in": "query", + "name": "voucher_type", + "description": "Filters by a voucher type." + }, + { + "schema": { + "type": "boolean" + }, + "in": "query", + "name": "is_referral_code", + "description": "This filter works only for the `true` option. If set to `true`, the query returns only publications of codes from referral campaigns. " + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "filters", + "description": "Allows for combining the filters mentioned in the endpoint description." + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "source_id", + "description": "Using this endpoint with a particular publication `source_id`, which was sent with the original request to create a publication, returns in the response, exactly the same code published initially because the code was assigned to the given publication. As a result, you can use this endpoint as a reference and return a code that was assigned in a publication by using a particular `source_id`." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of publications you’ve previously created with [create publication](ref:create-publication) or implicitly by the distribution manager. The publications are returned in sorted order, with the most recent ones appearing first.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/5_res_list_publications" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "publications", + "publications": [ + { + "id": "pub_QzQT50e5i2y3bRoEVvhFgrKbZ7t6BRwu", + "object": "publication", + "created_at": "2022-09-28T13:31:23.522Z", + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "tracking_id": "cindy.jones@email.com", "metadata": { - "Type": "Coin" + "distribution_id": "distr_WXm0CBttar2ug2hBx3EdPtS8Ei", + "source_type": "distribution", + "source_id": "distr_WXm0CBttar2ug2hBx3EdPtS8Ei" }, - "parameters": { - "coin": { - "exchange_ratio": 900, - "points_ratio": 8000 - } - } - } - }, - "Material Reward": { - "value": { - "name": "Get a Comic Book", - "metadata": { - "Type": "Physical product" + "channel": "Automation", + "source_id": null, + "result": "SUCCESS", + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "name": "Cindy Jones", + "email": "cindy.jones@email.com", + "source_id": "cindy.jones@email.com", + "metadata": { + "acquisition_channel": "Facebook" + }, + "object": "customer" }, - "parameters": { - "product": { - "id": "prod_0b15f6b9f650c16990", - "sku_id": "sku_0b1621b319d248b79f" - } + "voucher": { + "code": "FNV5IrtY", + "object": "voucher", + "campaign": "Loyalty Campaign", + "loyalty_card": { + "points": 0, + "balance": 0 + }, + "is_referral_code": false }, - "stock": 2, - "attributes": { - "image_url": "https://www.website.com/img_fPH9.png", - "description": "Comic book" - } - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns an updated reward object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_obj_reward_object" - }, - "examples": { - "Material": { - "value": { - "id": "rew_wg2pvCr5LDhCq4uVQZ9LhuZm", - "name": "Get a Comic Book", - "type": "MATERIAL", - "parameters": { - "product": { - "id": "prod_0b15f6b9f650c16990", - "sku_id": "sku_0b1621b319d248b79f" - } + "vouchers_id": [ + "v_i3HOzVClfJUDia0qCu7TSuGfDj7c0dgD" + ] + }, + { + "id": "pub_8KOKHObAjuemuI0b6225emIhmWDL1ZoX", + "object": "publication", + "created_at": "2022-09-28T13:31:02.766Z", + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "tracking_id": "sandy.jones@email.com", + "metadata": {}, + "channel": "voucherify-website", + "source_id": null, + "result": "SUCCESS", + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "name": "Sandy Jones", + "email": "sandy.jones@email.com", + "source_id": "sandy.jones@email.com", + "metadata": { + "acquisition_channel": "Facebook" }, - "stock": "2", - "redeemed": null, - "attributes": { - "image_url": "https://www.website.com/img_fPH9.png", - "description": "Comic book" + "object": "customer" + }, + "voucher": { + "code": "Voucher-1", + "object": "voucher", + "campaign": null, + "discount": { + "type": "AMOUNT", + "amount_off": 200, + "amount_off_formula": "IF(VOUCHER_PUBLISH_COUNT = 1;25;5)", + "effect": "APPLY_TO_ORDER" }, - "created_at": "2022-08-25T10:00:12.794Z", - "updated_at": "2022-08-25T10:06:30.655Z", + "is_referral_code": false + }, + "vouchers_id": [ + "v_1iEL92K634EIOqeYJw6AHrnjEhGPEdpu" + ] + }, + { + "id": "pub_DcQPfyVYzomtkQGXFW7dcdyNoJ6vQ4NV", + "object": "publication", + "created_at": "2022-09-13T06:15:08.249Z", + "customer_id": "cust_ur1hIPGflbaAe14mLlLdon3G", + "tracking_id": "1", + "metadata": {}, + "channel": "voucherify-website", + "source_id": null, + "result": "SUCCESS", + "customer": { + "id": "cust_ur1hIPGflbaAe14mLlLdon3G", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "1", "metadata": { - "Type": "Physical product" + "accepts_marketing": false }, - "object": "reward" - } + "object": "customer" + }, + "voucher": { + "code": "GIFT-WOZaK5YF1Fs87tAX", + "object": "voucher", + "campaign": "Gift Cards", + "gift": { + "amount": 0, + "balance": 0 + }, + "is_referral_code": false + }, + "vouchers_id": [ + "v_yzOeb7vw63vbPfA30215dFm7aRXa8Xoc" + ] } - } + ], + "total": 3 } } + } + } + } + }, + "400": { + "description": "Returns an error if you request a page higher than 1000.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" }, - "400": { - "description": "Returns an error if the balance parameter is not defined correctly.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_400_invalid_balance" - }, - "examples": { - "Invalid Balance": { - "value": { - "code": 400, - "key": "invalid_balance", - "message": "Property 'parameters.campaign.balance' is invalid", - "details": "Property 'parameters.campaign.balance' must be greater than zero for campaign type: GIFT_VOUCHERS", - "request_id": "v-0b96d2b90dce48855f" - } - } - } + "examples": { + "Example": { + "value": { + "code": 400, + "key": "page_over_limit", + "message": "Listing resource above 1000 page is not supported", + "details": "Property .page cannot be higher than 1000", + "request_id": "v-0bc2a39574c61362af" } } } } + } + } + } + }, + "post": { + "operationId": "create-publication", + "tags": [ + "PUBLICATIONS API" + ], + "summary": "Create Publication", + "description": "This method selects vouchers that are suitable for publication, adds a publish entry and returns the publication.\n\nA voucher is suitable for publication when it's active and hasn't been published yet. \n\n\n> 🚧 Clearly define the source of the voucher\n>\n> You must clearly define which source you want to publish the voucher code from. It can either be a code from a campaign or a specific voucher identified by a code. \n\n> 🚧 Publish multiple vouchers\n> In case you want to publish multiple vouchers within a single publication, you need to specify the campaign name and number of vouchers you want to publish. \n\n\n> 📘 Auto-update campaign\n>\n> In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use an **auto-update** campaign.", + "parameters": [ + { + "schema": { + "type": "boolean" }, - "delete": { - "operationId": "delete-reward", - "tags": [ - "REWARDS API" - ], - "summary": "Delete Reward", - "description": "Delete a reward.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." - }, - "400": { - "description": "Bad Request. Returns an error indicating that the reward with given ID is assigned to a resource.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_400_resource_in_use" - }, - "examples": { - "Example": { - "value": { - "code": 400, - "key": "resource_in_use", - "message": "Resource in use", - "details": "Resource reward with id rew_fcYALROsORec6cP0VBItCVfq is in use by reward_assignments with ids [rewa_5WV7H3y2lT3GGl03Xjw29IEc]", - "request_id": "v-0b8c7b967950216291", - "related_object_ids": [ - "rewa_5WV7H3y2lT3GGl03Xjw29IEc" - ], - "related_object_type": "reward_assignment" - } - } - } + "in": "query", + "name": "join_once", + "description": "Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the publication parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/5_req_create_publication" + }, + "examples": { + "Example - Specific Voucher": { + "value": { + "campaign": { + "name": "campaign-name" + }, + "customer": { + "source_id": "source-id", + "Name": "Customer Name", + "email": "customer email" + }, + "voucher": "voucher-code", + "metadata": { + "key": "value" + } + } + }, + "Example - Random Voucher": { + "value": { + "campaign": { + "name": "campaign-name", + "count": 1 + }, + "customer": { + "source_id": "source-id", + "Name": "Customer Name", + "email": "customer email" + }, + "voucher": "voucher-code", + "metadata": { + "key": "value" } } }, - "404": { - "description": "Returns an error indicating that the reward with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Reward Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find reward with id rew_2erjvECLs92GYzKbak3QkyT", - "request_id": "v-0ae29895e8c6b7781a", - "resource_id": "rew_2erjvECLs92GYzKbak3QkyT", - "resource_type": "reward" + "Example 3": { + "value": { + "source_id": "publication_source_ID_10", + "campaign": "Test - Discount Effect - Amount - Items", + "channel": "myown", + "customer": { + "source_id": "pub_source_customer_5", + "name": "Bob Jones", + "description": "A frequent customer", + "email": "bob.smith@email.com", + "phone": "+1 933 222 3333", + "address": { + "city": "New York", + "country": "United States", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 5", + "postal_code": "10001", + "state": "NY" + }, + "metadata": { + "lang": "en", + "test": true + }, + "birthday": "1901-12-01" + }, + "metadata": { + "year": 2022 + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a publication object if a valid identifier was provided.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/5_res_create_publication" + }, + "examples": { + "Example": { + "value": { + "id": "pub_ocaXCa023ayJ3WL1ARxUeKgIvg3JcEGh", + "object": "publication", + "created_at": "2022-09-30T16:30:32.924Z", + "customer_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", + "tracking_id": "pub_source_customer_5", + "metadata": { + "year": 2022 + }, + "channel": "myown", + "source_id": "publication_source_ID_10", + "result": "SUCCESS", + "customer": { + "id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", + "name": "Bob Jones", + "email": "bob.smith@email.com", + "source_id": "pub_source_customer_5", + "metadata": { + "lang": "en", + "test": true + }, + "object": "customer" + }, + "voucher": { + "id": "v_6Hy5FdNlu3dP65fJu5BgXma31Sl3rgkf", + "code": "cEsMn0uA", + "campaign": "Test - Discount Effect - Amount - Items", + "campaign_id": "camp_dphuwqH7BOVkgh4JmpDtS32l", + "category": null, + "category_id": null, + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 300, + "effect": "APPLY_TO_ITEMS" + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX188XVmOotyCyR2j3G8sJR8HzS3DQ+6J1OElPWSmjlEnthuJc7rkc7WIVxjT4pTl1JVVkHEuGXNXdzRik11H8S18HQeQFJFiuwLZ2mzEC2zZitEinyUxtZwhnEHoi0eGAgYCG7iVMNuOQA==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX188XVmOotyCyR2j3G8sJR8HzS3DQ%2B6J1OElPWSmjlEnthuJc7rkc7WIVxjT4pTl1JVVkHEuGXNXdzRik11H8S18HQeQFJFiuwLZ2mzEC2zZitEinyUxtZwhnEHoi0eGAgYCG7iVMNuOQA%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX18wDd9CcLM0Ef7aBfUSXZUoCQpuNpk4CHGOipbn+wFkfzcIZGBtUlxrI2KsXciCqF+c93AKzsymq5Yw8eEAFF/FK5f94z4/sgzaLDvyBmPCXHuS11Ew9S4ZEMjdTkUJftER2IlxWaCARA==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18wDd9CcLM0Ef7aBfUSXZUoCQpuNpk4CHGOipbn%2BwFkfzcIZGBtUlxrI2KsXciCqF%2Bc93AKzsymq5Yw8eEAFF%2FFK5f94z4%2FsgzaLDvyBmPCXHuS11Ew9S4ZEMjdTkUJftER2IlxWaCARA%3D%3D" } - } - } + }, + "is_referral_code": false, + "created_at": "2022-09-30T16:30:32.956Z", + "updated_at": null, + "holder_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", + "redemption": { + "quantity": 1, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/cEsMn0uA/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/cEsMn0uA/publications?page=1&limit=10" + }, + "object": "voucher" + }, + "vouchers_id": [ + "v_6Hy5FdNlu3dP65fJu5BgXma31Sl3rgkf" + ] } } } } } }, - "/v1/rewards/{rewardId}/assignments": { - "parameters": [ - { + "400": { + "description": "Returns an error if a publication with the same source ID already exists in the system or some request body parameter is missing.", + "content": { + "application/json": { "schema": { - "type": "string" + "$ref": "#/components/schemas/e_error_no_translation" }, - "name": "rewardId", - "in": "path", - "required": true, - "description": "A unique reward ID." + "examples": { + "Missing Parameters": { + "value": { + "code": 400, + "key": "missing_vouchers", + "message": "Missing vouchers", + "details": "Either Campaign or Voucher is required" + } + }, + "Already published": { + "value": { + "code": 400, + "key": "voucher_already_published", + "message": "Voucher already published", + "details": "Voucher 'v_Y5P4UZ1yilkiYOIJmAAgWazUi1wfkNwF' has already been published", + "request_id": "v-0bc40bb800d5651137" + } + }, + "Duplicate Source ID": { + "value": { + "code": 400, + "key": "duplicate_source_id", + "message": "Duplicate source_id", + "details": "Publication with source_id: 'publication_source_ID_1' already exists", + "request_id": "v-0bc40bf81555651191" + } + } + } } - ], - "get": { - "operationId": "list-reward-assignments", - "tags": [ - "REWARDS API" - ], - "summary": "List Reward Assignments", - "description": "Retrieve reward assignments by the reward ID.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" + } + }, + "404": { + "description": "Returns an error if a resource is not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" }, - { - "$ref": "#/components/parameters/page" + "examples": { + "Campaign Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id 1", + "request_id": "v-0bc40546e5d56508e5", + "resource_id": "1", + "resource_type": "campaign" + } + } } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + } + } + } + } + } + }, + "/v1/validation-object": { + "get": { + "operationId": "validation-object", + "tags": [ + "VALIDATIONS API" + ], + "summary": "Validation Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Validation Object", + "content": { + "application/json": { + "schema": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_voucher_false" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher" + } + ] } - ], - "responses": { - "200": { - "description": "Returns a dictionary of reward assignment objects. Each object contains information regarding the resource to which the reward was assigned and the cost in loyalty points for the reward.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_res_list_reward_assignments" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "rewa_PbIRoMXpwe5QhobW4JKu0VjH", - "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", - "related_object_id": "camp_wciTvaOfYmAa3EmIIW3QpXXZ", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 15 - } - }, - "created_at": "2022-08-17T08:13:02.507Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_pJYQBXSitK2OVPK3XMXZK76X", - "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", - "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 20 - } - }, - "created_at": "2022-08-24T11:40:22.418Z", - "updated_at": null, - "object": "reward_assignment" - } - ], - "total": 2 - } + } + } + } + } + } + }, + "/v1/vouchers/{code}/validate": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "Testing7fjWdr" + }, + "name": "code", + "in": "path", + "required": true, + "description": "A code that identifies the voucher." + } + ], + "post": { + "operationId": "validate-voucher", + "deprecated": true, + "tags": [ + "VALIDATIONS API" + ], + "summary": "Validate Voucher [Deprecated]", + "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for voucher validation, and we do not recommend using it. The new [Stackable Discounts API](ref:validate-stacked-discounts) 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. \n\nTo verify a voucher code given by a customer, you can use this method. It is designed for a server side integration, which means that is accessible only through private keys. \n\n\n> ❗️ Important \n>\n> This endpoint supports the validation of a single promo code. If you need to validate more than one incentive, you can use the [Stackable discounts API](ref:stackable-discounts-api). The stacking discounts API lets you validate up to 5 incentives per call. Before integrating Voucherify, choose which validation endpoint you prefer to use.\n\n#### Gift Vouchers - validate Gift Card and control amount to redeem\nVoucherify also gives the possibility to create a gift card, which allows using credits to fulfill the order. A user can specify how many credits he wants to use from the gift card. The available balance of credits is counted based on policy rules attached to the Gift Voucher definition. \n\nThis operation returns information about the validity of the code. Moreover, it returns a hashed source identifier which can be used as a tracking ID in future calls.\n\nIf a validation session is established, then the session details will be returned as well. Read more about sessions [here](doc:locking-validation-session).\n\nVoucher validation might fail because of one of these reasons:\n* `voucher not found` - voucher doesn't exist or was [deleted](ref:delete-voucher)\n* `voucher expired` - voucher is out of start date - expiration date time frame\n* `voucher is disabled` - learn more about a [disabled voucher](ref:disable-voucher)\n* `customer does not match segment rules` - learn more [customer tracking](doc:customers#customer-tracking) \n* `order does not match validation rules` - learn more about [validation rules](doc:validation-rules)", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the voucher validation context using the request body parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/6_req_validate_voucher" + }, + "examples": { + "Free Shipping": { + "value": { + "customer": { + "id": "cust_4vMj8Twr5nBzvTrNCgipMb6M" + }, + "order": { + "items": [ + { + "product_id": "prod_0ba621bae5d39762ce", + "quantity": "1" + }, + { + "product_id": "prod_0b661d404787ec6d3b", + "quantity": "1", + "price": 3100 } - } + ] } } }, - "404": { - "description": "Returns an error if the given reward is missing, does not exist or was deleted.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find reward with id rew_C7wS9eHFDN4CIbXI5PpLSkGYi", - "request_id": "v-0b95a68c678ad5c765", - "resource_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGYi", - "resource_type": "reward" - } - } - } + "Multiple Product Variants": { + "value": { + "customer": { + "source_id": "08dd9b5a-26de-44aa-a1d4-d9adfa9e8ec2" + }, + "order": { + "id": "ord_FDdsDI3FppuiqHa4s7drZEMP" } } - } - } - }, - "post": { - "operationId": "create-reward-assignment", - "tags": [ - "REWARDS API" - ], - "summary": "Create Reward Assignment", - "description": "Assigns a reward to a specified loyalty campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Provide the campaign ID of the campaign to which the reward is to be assigned and define the cost of the reward in terms of loyalty points.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_req_create_reward_assignment" + }, + "Unit - Add order items": { + "value": { + "customer": { + "source_id": "08dd9b5a-26de-44aa-a1d4-d9adfa9e8ec2" }, - "examples": { - "Example": { - "value": { - "campaign": "camp_OTuGGP90PivbvROsRvfM65El", - "parameters": { - "loyalty": { - "points": 39 - } - } + "order": { + "source_id": "47f491d1-a697-4f92-95ca-2ba1f463efa8" + }, + "session": { + "type": "LOCK", + "ttl_unit": "NANOSECONDS", + "ttl": 1 + } + } + }, + "Fixed": { + "value": { + "customer": { + "source_id": "08dd9b5a-26de-44aa-a1d4-d9adfa9e8ec2" + }, + "order": { + "items": [ + { + "source_id": "webinar_BF_sweater_pink_sweater", + "quantity": "1", + "price": 6500, + "related_object": "product" + }, + { + "source_id": "webinar_BF_pants_navy_sweat_pants", + "quantity": "1", + "price": 6000, + "related_object": "product" + }, + { + "source_id": "5h1pp1ng", + "quantity": "1", + "price": 2000, + "related_object": "product" + }, + { + "source_id": "webinar_BF_pants_gray_sweat_pants", + "quantity": "2", + "price": 5000, + "related_object": "product" + }, + { + "source_id": "webinar_BF_sweater_pearl", + "quantity": "2", + "price": 11000, + "related_object": "product" } - } + ] + }, + "session": { + "type": "LOCK" } } - } - }, - "responses": { - "200": { - "description": "Returns a reward assignment object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" + }, + "Percentage": { + "value": { + "customer": { + "source_id": "your_customer_source_ID", + "name": "Bob Smith", + "description": "A frequent customer", + "email": "bob.smith@email.com", + "phone": "+1 933 222 3333", + "address": { + "city": "New York", + "country": "United States", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 5", + "postal_code": "10001", + "state": "NY" }, - "examples": { - "Example": { - "value": { - "id": "rewa_cqD2XE5x8LcD2c1FLlvqikti", - "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", - "related_object_id": "camp_OTuGGP90PivbvROsRvfM65El", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 39 - } - }, - "created_at": "2022-08-24T13:44:42.610Z", - "updated_at": null, - "object": "reward_assignment" - } + "metadata": { + "lang": "en", + "test": true + }, + "birthday": "1960-12-01" + }, + "order": { + "items": [ + { + "source_id": "webinar_BF_sweater_pink_sweater", + "quantity": "1", + "price": 6500, + "related_object": "product" + }, + { + "source_id": "webinar_BF_pants_navy_sweat_pants", + "quantity": "1", + "price": 6000, + "related_object": "product" + }, + { + "source_id": "5h1pp1ng", + "quantity": "1", + "price": 2000, + "related_object": "product" + }, + { + "source_id": "webinar_BF_pants_gray_sweat_pants", + "quantity": "2", + "price": 5000, + "related_object": "product" + }, + { + "source_id": "webinar_BF_sweater_pearl", + "quantity": "2", + "price": 11000, + "related_object": "product" } - } + ] + }, + "session": { + "type": "LOCK", + "key": "your_custom_key", + "ttl_unit": "NANOSECONDS", + "ttl": 1 } } }, - "400": { - "description": "Returns an error if request body parameters are missing.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_400_missing_param" + "Amount": { + "value": { + "customer": { + "source_id": "your_customer_source_ID", + "name": "Bob Smith", + "description": "A frequent customer", + "email": "bob.smith@email.com", + "phone": "+1 933 222 3333", + "address": { + "city": "New York", + "country": "United States", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 5", + "postal_code": "10001", + "state": "NY" }, - "examples": { - "Missing Parameter": { - "value": { - "code": 400, - "key": "missing_param", - "message": "Missing required parameter", - "details": "Parameter 'parameters.loyalty' is required", - "request_id": "v-0b95c7f3684ad5f06d" - } + "metadata": { + "lang": "en", + "test": true + }, + "birthday": "1960-12-01" + }, + "order": { + "items": [ + { + "source_id": "webinar_BF_sweater_pink_sweater", + "quantity": "1", + "price": 6500, + "related_object": "product" + }, + { + "source_id": "webinar_BF_pants_navy_sweat_pants", + "quantity": "1", + "price": 6000, + "related_object": "product" + }, + { + "source_id": "5h1pp1ng", + "quantity": "1", + "price": 2000, + "related_object": "product" + }, + { + "source_id": "webinar_BF_pants_gray_sweat_pants", + "quantity": "2", + "price": 5000, + "related_object": "product" + }, + { + "source_id": "webinar_BF_sweater_pearl", + "quantity": "2", + "price": 11000, + "related_object": "product" } + ], + "metadata": { + "currency": "EUR" } + }, + "session": { + "type": "LOCK", + "key": "your_custom_key", + "ttl_unit": "NANOSECONDS", + "ttl": 1 } } }, - "404": { - "description": "Returns an error when creating a reward assignment for a reward that has been deleted or does not exist.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Reward Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find reward with id rew_C7wS9eHFDN4CIbXI5PpLSkGYi", - "request_id": "v-0b95c0bedf46fcbe83", - "resource_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGYi", - "resource_type": "reward" - } + "Loyalty Card": { + "value": { + "order": { + "items": [ + { + "product_id": "prod_0bd76fc58f8038b043", + "quantity": "1" }, - "Missing Campaign": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id null", - "request_id": "v-0b95c68b12cad5eebb", - "resource_id": null, - "resource_type": "campaign" - } + { + "product_id": "prod_0bd76bd0e204542738", + "quantity": "1" } + ] + }, + "reward": { + "id": "rew_4ZF6Y69U2PXE3GLIZxfozgg1", + "points": 10 + } + } + }, + "Gift Card": { + "value": { + "customer": { + "source_id": "286401dc-6f4c-4ebb-8ca2-9f78b3e84c7d" + }, + "order": { + "amount": 1000, + "metadata": { + "currency": "USD" } + }, + "gift": { + "credits": 2 + }, + "metadata": { + "location_id": [ + "L1" + ] } } }, - "409": { - "description": "Returns an error if a conflict is found, i.e. an assignment for the reward has already been created.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" - }, - "examples": { - "Duplicate Found": { - "value": { - "code": 409, - "key": "duplicate_found", - "message": "Duplicated resource found", - "details": "Duplicated reward_assignment exists with id rewa_q1Ad955TUZS4nVIxplOw9pL3", - "request_id": "v-0b95c78daa06fcc6bb", - "resource_id": "rewa_q1Ad955TUZS4nVIxplOw9pL3", - "resource_type": "reward_assignment" - } - } + "Referral Code": { + "value": { + "customer": { + "source_id": "earlybirdcust" + }, + "order": { + "amount": 20000, + "metadata": { + "currency": "USD" } + }, + "metadata": { + "location_id": [ + "L1" + ] } } } } } - }, - "/v1/rewards/{rewardId}/assignments/{assignmentId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "rew_2erjvECLs92GYzKbak3QkyTV" - }, - "name": "rewardId", - "in": "path", - "required": true, - "description": "A unique reward ID." - }, - { + } + }, + "responses": { + "200": { + "description": "Returns information whether the voucher is valid in the context of the parameter values provided in the request body.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "rewa_YkwQ5ezNYTQV2geodMVhTpy4" - }, - "name": "assignmentId", - "in": "path", - "required": true, - "description": "A unique reward assignment ID." - } - ], - "put": { - "operationId": "update-reward-assignment", - "tags": [ - "REWARDS API" - ], - "summary": "Update Reward Assignment", - "description": "Update the number of points needed to successfully redeem the reward.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Define the number of points required to exchange for the reward.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_req_update_reward_assignment" + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_voucher" }, - "examples": { - "Example": { - "value": { - "parameters": { - "loyalty": { - "points": 35 + { + "$ref": "#/components/schemas/6_res_validate_voucher_false" + } + ] + }, + "examples": { + "False": { + "value": { + "valid": false, + "reason": "redemption does not match validation rules", + "error": { + "code": 400, + "key": "redemption_rules_violated", + "message": "redemption does not match validation rules", + "details": "Gift Card cannot be redeemed because of violated validation rules: val_wvipKm99CJuL", + "request_id": "v-0bccef7a9585cf63b6" + }, + "tracking_id": "track_ZGPtmYcM+Mw=", + "code": "vBQvYFEM", + "metadata": {} + } + }, + "Free Shipping": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_rynPcKGW2z7+kd2Vry4p12+Rx2NtyXZyiApdGWEXPrdX+44Fg6LRBQ==", + "order": { + "amount": 4300, + "total_amount": 4300, + "items": [ + { + "object": "order_item", + "product_id": "prod_0ba621bae5d39762ce", + "quantity": 1, + "amount": 1200, + "price": 1200, + "subtotal_amount": 1200, + "product": { + "id": "prod_0ba621bae5d39762ce", + "source_id": "arabica_plus", + "name": "Arabica Coffee 250g", + "price": 1200 + } + }, + { + "object": "order_item", + "product_id": "prod_0b661d404787ec6d3b", + "quantity": 1, + "amount": 3100, + "price": 3100, + "subtotal_amount": 3100, + "product": { + "id": "prod_0b661d404787ec6d3b", + "source_id": "7717f389-4621-4c7a-a6db-d4acfe051a97", + "name": "Kate Moss by Mario Testino" + } + }, + { + "object": "order_item", + "product_id": "prod_5h1pp1ng", + "quantity": 1, + "discount_quantity": 1, + "initial_quantity": 0, + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping" } } + ], + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "code": "Test - Discount - Free Shipping", + "discount": { + "type": "UNIT", + "effect": "ADD_MISSING_ITEMS", + "unit_off": 1, + "unit_type": "prod_5h1pp1ng", + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping" } - } + }, + "metadata": {} } - } - } - }, - "responses": { - "200": { - "description": "Returns the updated reward assignment object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" + }, + "Multiple Product Varients": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_rynPcKGW2z7+kd2Vry4p12+Rx2NtyXZyiApdGWEXPrdX+44Fg6LRBQ==", + "order": { + "id": "ord_FDdsDI3FppuiqHa4s7drZEMP", + "source_id": "47f491d1-a697-4f92-95ca-2ba1f463efa8", + "created_at": "2022-09-21T13:09:25.773Z", + "updated_at": "2022-09-21T13:09:27.139Z", + "status": "PAID", + "amount": 237300, + "initial_amount": 28000, + "discount_amount": 8400, + "items_discount_amount": 209300, + "total_discount_amount": 217700, + "total_amount": 19600, + "items_applied_discount_amount": 209300, + "total_applied_discount_amount": 209300, + "items": [ + { + "object": "order_item", + "source_id": "A0E20000000295J", + "related_object": "sku", + "product_id": "prod_0b661d31134b299cc2", + "quantity": 1, + "amount": 9500, + "price": 9500, + "subtotal_amount": 9500, + "product": { + "id": "prod_0b661d31134b299cc2", + "source_id": "2c446063-d582-4d7e-9651-23971b3e56f7", + "name": "Keychain D‘Amico" + }, + "sku": { + "id": "sku_0b661d6265cb29ae52", + "source_id": "A0E20000000295J", + "sku": "Keychain D‘Amico", + "metadata": {}, + "price": 9500 + } + }, + { + "object": "order_item", + "source_id": "M0E20000000EAT6", + "related_object": "sku", + "quantity": 1, + "amount": 18500, + "price": 18500, + "subtotal_amount": 18500, + "product": { + "name": "Jogging pants Paolo Pecora light grey" + }, + "sku": { + "sku": "Jogging pants Paolo Pecora light grey", + "metadata": {} + } + }, + { + "object": "order_item", + "product_id": "prod_5h1pp1ng", + "quantity": 1, + "discount_quantity": 1, + "initial_quantity": 0, + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping" + } + }, + { + "object": "order_item", + "product_id": "prod_0b661d4bd2c7ec7d1f", + "sku_id": "sku_0b661e41fc8d35a8f7", + "quantity": 3, + "discount_quantity": 3, + "initial_quantity": 0, + "amount": 89700, + "discount_amount": 89700, + "initial_amount": 0, + "applied_discount_amount": 89700, + "price": 29900, + "subtotal_amount": 0, + "product": { + "id": "prod_0b661d4bd2c7ec7d1f", + "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", + "name": "Casual jacket Michael Kors beige" + }, + "sku": { + "id": "sku_0b661e41fc8d35a8f7", + "source_id": "M0E20000000ELDG", + "sku": "Casual jacket Michael Kors beige", + "price": 29900 + } + }, + { + "object": "order_item", + "product_id": "prod_0b661d4bd2c7ec7d1f", + "sku_id": "sku_0b661e41fc8d35a8f6", + "quantity": 4, + "discount_quantity": 4, + "initial_quantity": 0, + "amount": 119600, + "discount_amount": 119600, + "initial_amount": 0, + "applied_discount_amount": 119600, + "price": 29900, + "subtotal_amount": 0, + "product": { + "id": "prod_0b661d4bd2c7ec7d1f", + "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", + "name": "Casual jacket Michael Kors beige" + }, + "sku": { + "id": "sku_0b661e41fc8d35a8f6", + "source_id": "M0E20000000ELDF", + "sku": "Casual jacket Michael Kors beige", + "price": 29900 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "object": "customer" + }, + "customer_id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0bb9c69ca9d5a364b2": { + "date": "2022-09-21T13:09:25.799Z", + "related_object_type": "redemption", + "related_object_id": "r_0bb9c69ca9d5a364b2", + "stacked": [ + "r_0bb9c69ca9d5a364b3", + "r_0bb9c69ca9d5a364b4" + ] + } + } }, - "examples": { - "Example": { - "value": { - "id": "rewa_pJYQBXSitK2OVPK3XMXZK76X", - "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", - "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 35 - } + "code": "Test - Discount - Unit - Multiple - Product Variants", + "discount": { + "type": "UNIT", + "effect": "ADD_MANY_ITEMS", + "units": [ + { + "effect": "ADD_MISSING_ITEMS", + "unit_off": 3, + "unit_type": "sku_0b661e41fc8d35a8f7", + "sku": { + "id": "sku_0b661e41fc8d35a8f7", + "source_id": "M0E20000000ELDG", + "sku": "Casual jacket Michael Kors beige" }, - "created_at": "2022-08-24T11:40:22.418Z", - "updated_at": "2022-08-24T13:02:32.262Z", - "object": "reward_assignment" + "product": { + "id": "prod_0b661d4bd2c7ec7d1f", + "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", + "name": "Casual jacket Michael Kors beige" + } + }, + { + "effect": "ADD_NEW_ITEMS", + "unit_off": 4, + "unit_type": "sku_0b661e41fc8d35a8f6", + "sku": { + "id": "sku_0b661e41fc8d35a8f6", + "source_id": "M0E20000000ELDF", + "sku": "Casual jacket Michael Kors beige" + }, + "product": { + "id": "prod_0b661d4bd2c7ec7d1f", + "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", + "name": "Casual jacket Michael Kors beige" + } + } + ] + }, + "metadata": {} + } + }, + "Unit - Add order items": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_rynPcKGW2z7+kd2Vry4p12+Rx2NtyXZyiApdGWEXPrdX+44Fg6LRBQ==", + "session": { + "key": "ssn_K7DV3RbAGNCRVrPNZxJfld3FdwAQwOGl", + "type": "LOCK", + "ttl": 1, + "ttl_unit": "NANOSECONDS" + }, + "order": { + "id": "ord_FDdsDI3FppuiqHa4s7drZEMP", + "source_id": "47f491d1-a697-4f92-95ca-2ba1f463efa8", + "created_at": "2022-09-21T13:09:25.773Z", + "updated_at": "2022-09-21T13:09:27.139Z", + "status": "PAID", + "amount": 117700, + "initial_amount": 28000, + "discount_amount": 8400, + "items_discount_amount": 89700, + "total_discount_amount": 98100, + "total_amount": 19600, + "items_applied_discount_amount": 89700, + "total_applied_discount_amount": 89700, + "items": [ + { + "object": "order_item", + "source_id": "A0E20000000295J", + "related_object": "sku", + "product_id": "prod_0b661d31134b299cc2", + "quantity": 1, + "amount": 9500, + "price": 9500, + "subtotal_amount": 9500, + "product": { + "id": "prod_0b661d31134b299cc2", + "source_id": "2c446063-d582-4d7e-9651-23971b3e56f7", + "name": "Keychain D‘Amico" + }, + "sku": { + "id": "sku_0b661d6265cb29ae52", + "source_id": "A0E20000000295J", + "sku": "Keychain D‘Amico", + "metadata": {}, + "price": 9500 + } + }, + { + "object": "order_item", + "source_id": "M0E20000000EAT6", + "related_object": "sku", + "quantity": 1, + "amount": 18500, + "price": 18500, + "subtotal_amount": 18500, + "product": { + "name": "Jogging pants Paolo Pecora light grey" + }, + "sku": { + "sku": "Jogging pants Paolo Pecora light grey", + "metadata": {} + } + }, + { + "object": "order_item", + "product_id": "prod_5h1pp1ng", + "quantity": 1, + "discount_quantity": 1, + "initial_quantity": 0, + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping" + } + }, + { + "object": "order_item", + "product_id": "prod_0b661d4bd2c7ec7d1f", + "sku_id": "sku_0b661e41fc8d35a8f8", + "quantity": 3, + "discount_quantity": 3, + "initial_quantity": 0, + "amount": 89700, + "discount_amount": 89700, + "initial_amount": 0, + "applied_discount_amount": 89700, + "price": 29900, + "subtotal_amount": 0, + "product": { + "id": "prod_0b661d4bd2c7ec7d1f", + "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", + "name": "Casual jacket Michael Kors beige" + }, + "sku": { + "id": "sku_0b661e41fc8d35a8f8", + "source_id": "M0E20000000ELDH", + "sku": "Casual jacket Michael Kors beige", + "price": 29900 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "object": "customer" + }, + "customer_id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0bb9c69ca9d5a364b2": { + "date": "2022-09-21T13:09:25.799Z", + "related_object_type": "redemption", + "related_object_id": "r_0bb9c69ca9d5a364b2", + "stacked": [ + "r_0bb9c69ca9d5a364b3", + "r_0bb9c69ca9d5a364b4" + ] + } + } + }, + "code": "Test - Discount - Unit - Add new order items", + "discount": { + "type": "UNIT", + "effect": "ADD_NEW_ITEMS", + "unit_off": 3, + "unit_type": "sku_0b661e41fc8d35a8f8", + "sku": { + "id": "sku_0b661e41fc8d35a8f8", + "source_id": "M0E20000000ELDH", + "sku": "Casual jacket Michael Kors beige" + }, + "product": { + "id": "prod_0b661d4bd2c7ec7d1f", + "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", + "name": "Casual jacket Michael Kors beige" + } + }, + "metadata": {} + } + }, + "Fixed": { + "value": { + "valid": true, + "applicable_to": { + "data": [ + { + "object": "product", + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "strict": false, + "price": 2000, + "price_formula": "IF(ORDER_AMOUNT > 400;0;20)", + "effect": "APPLY_TO_EVERY" + }, + { + "object": "products_collection", + "id": "pc_2KWKXn09Dk8neCfymqd4xOq8", + "strict": false, + "price": 99900, + "price_formula": "IF(ORDER_AMOUNT > 300;ORDER_ITEM_PRICE * 0.8;ORDER_ITEM_PRICE)", + "effect": "APPLY_TO_EVERY" + }, + { + "object": "products_collection", + "id": "pc_x7HELQo52g2uI6nDuuOTRjAW", + "strict": false, + "price": 99900, + "price_formula": "IF(ORDER_AMOUNT > 200;ORDER_ITEM_PRICE * 0.9;ORDER_ITEM_PRICE)", + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0bd76ca337954ca116", + "source_id": "webinar_BF_sweater_pink_sweater", + "strict": true, + "price": 99900, + "price_formula": "IF(ORDER_AMOUNT > 300;ORDER_ITEM_PRICE * 0.8;ORDER_ITEM_PRICE)", + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0bd76bd0e204542738", + "source_id": "webinar_BF_pants_navy_sweat_pants", + "strict": true, + "price": 99900, + "price_formula": "IF(ORDER_AMOUNT > 200;ORDER_ITEM_PRICE * 0.9;ORDER_ITEM_PRICE)", + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0bd76b8656956a183f", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "strict": true, + "price": 99900, + "price_formula": "IF(ORDER_AMOUNT > 200;ORDER_ITEM_PRICE * 0.9;ORDER_ITEM_PRICE)", + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0bd76f59f98617518e", + "source_id": "webinar_BF_sweater_pearl", + "strict": true, + "price": 99900, + "price_formula": "IF(ORDER_AMOUNT > 300;ORDER_ITEM_PRICE * 0.8;ORDER_ITEM_PRICE)", + "effect": "APPLY_TO_EVERY" + } + ], + "total": 7, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_rynPcKGW2z7+kd2Vry4p12+Rx2NtyXZyiApdGWEXPrdX+44Fg6LRBQ==", + "session": { + "key": "ssn_u8rvi3Ac70S5ZRELWrxYsR2bnolpVWNg", + "type": "LOCK", + "ttl": 7, + "ttl_unit": "DAYS" + }, + "order": { + "amount": 46500, + "items_discount_amount": 9300, + "total_discount_amount": 9300, + "total_amount": 37200, + "items_applied_discount_amount": 9300, + "total_applied_discount_amount": 9300, + "items": [ + { + "object": "order_item", + "source_id": "webinar_BF_sweater_pink_sweater", + "related_object": "product", + "quantity": 1, + "amount": 6500, + "discount_amount": 1300, + "applied_discount_amount": 1300, + "price": 6500, + "subtotal_amount": 5200, + "product": { + "id": "prod_0bd76ca337954ca116", + "source_id": "webinar_BF_sweater_pink_sweater", + "name": "Pink Sweater", + "price": 6500 + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_pants_navy_sweat_pants", + "related_object": "product", + "quantity": 1, + "amount": 6000, + "discount_amount": 600, + "applied_discount_amount": 600, + "price": 6000, + "subtotal_amount": 5400, + "product": { + "id": "prod_0bd76bd0e204542738", + "source_id": "webinar_BF_pants_navy_sweat_pants", + "name": "Navy Sweat Pants", + "price": 6000 + } + }, + { + "object": "order_item", + "source_id": "5h1pp1ng", + "related_object": "product", + "quantity": 1, + "amount": 2000, + "discount_amount": 2000, + "applied_discount_amount": 2000, + "price": 2000, + "subtotal_amount": 0, + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping", + "price": 0 + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "related_object": "product", + "quantity": 2, + "amount": 10000, + "discount_amount": 1000, + "applied_discount_amount": 1000, + "price": 5000, + "subtotal_amount": 9000, + "product": { + "id": "prod_0bd76b8656956a183f", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "name": "Gray Sweat Pants", + "price": 5000 + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_sweater_pearl", + "related_object": "product", + "quantity": 2, + "amount": 22000, + "discount_amount": 4400, + "applied_discount_amount": 4400, + "price": 11000, + "subtotal_amount": 17600, + "product": { + "id": "prod_0bd76f59f98617518e", + "source_id": "webinar_BF_sweater_pearl", + "name": "Pearl Sweater", + "price": 11000 + } + } + ], + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "code": "SPENDMOREGETMORE-DaIXFJvn", + "discount": { + "type": "FIXED", + "effect": "APPLY_TO_ITEMS" + }, + "metadata": { + "shoutout": "Order more than 200€ to get 10% off pants, more than 300€ to get 20% off sweaters, and more than 400€ to get free shipping." + }, + "campaign": "SPENDMOREGETMORE", + "campaign_id": "camp_Nwb2mppeDTtk23s1FVo6riwp" + } + }, + "Voucher expired": { + "value": { + "valid": false, + "reason": "voucher expired", + "error": { + "code": 400, + "key": "voucher_expired", + "message": "voucher expired", + "details": "EarlyBird-tB6zCApA", + "request_id": "v-0be43067028abb6ca8" + }, + "tracking_id": "track_4Wb/eeza4PDXKElxYR/QtlDQOVFpY9mP", + "code": "EarlyBird-tB6zCApA", + "metadata": { + "shoutout": "Get an early bird special. The earlier you order, the better discount you will get." + } + } + }, + "Percentage": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_4Wb/eeza4PDXKElxYR/QtlDQOVFpY9mP", + "session": { + "key": "your_custom_key", + "type": "LOCK", + "ttl": 1, + "ttl_unit": "NANOSECONDS" + }, + "order": { + "amount": 46500, + "discount_amount": 4650, + "total_discount_amount": 4650, + "total_amount": 41850, + "applied_discount_amount": 4650, + "total_applied_discount_amount": 4650, + "items": [ + { + "object": "order_item", + "source_id": "webinar_BF_sweater_pink_sweater", + "related_object": "product", + "quantity": 1, + "amount": 6500, + "price": 6500, + "subtotal_amount": 6500, + "product": { + "id": "prod_0bd76ca337954ca116", + "source_id": "webinar_BF_sweater_pink_sweater", + "name": "Pink Sweater", + "price": 6500 + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_pants_navy_sweat_pants", + "related_object": "product", + "quantity": 1, + "amount": 6000, + "price": 6000, + "subtotal_amount": 6000, + "product": { + "id": "prod_0bd76bd0e204542738", + "source_id": "webinar_BF_pants_navy_sweat_pants", + "name": "Navy Sweat Pants", + "price": 6000 + } + }, + { + "object": "order_item", + "source_id": "5h1pp1ng", + "related_object": "product", + "quantity": 1, + "amount": 2000, + "price": 2000, + "subtotal_amount": 2000, + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping", + "price": 0 + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "related_object": "product", + "quantity": 2, + "amount": 10000, + "price": 5000, + "subtotal_amount": 10000, + "product": { + "id": "prod_0bd76b8656956a183f", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "name": "Gray Sweat Pants", + "price": 5000 + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_sweater_pearl", + "related_object": "product", + "quantity": 2, + "amount": 22000, + "price": 11000, + "subtotal_amount": 22000, + "product": { + "id": "prod_0bd76f59f98617518e", + "source_id": "webinar_BF_sweater_pearl", + "name": "Pearl Sweater", + "price": 11000 + } + } + ], + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "code": "EarlyBird-tB6zCApA", + "discount": { + "type": "PERCENT", + "effect": "APPLY_TO_ORDER", + "percent_off": 10 + }, + "expiration_date": "2022-10-29T00:00:00.000Z", + "metadata": { + "shoutout": "Get an early bird special. The earlier you order, the better discount you will get." + }, + "campaign": "Webinar - Early Bird Scenario", + "campaign_id": "camp_z1g3iFqQe5qiZ9TTYFVpMwC0" + } + }, + "Amount": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_4Wb/eeza4PDXKElxYR/QtlDQOVFpY9mP", + "session": { + "key": "your_custom_key", + "type": "LOCK", + "ttl": 1, + "ttl_unit": "NANOSECONDS" + }, + "order": { + "amount": 46500, + "discount_amount": 1000, + "total_discount_amount": 1000, + "total_amount": 45500, + "applied_discount_amount": 1000, + "total_applied_discount_amount": 1000, + "items": [ + { + "object": "order_item", + "source_id": "webinar_BF_sweater_pink_sweater", + "related_object": "product", + "quantity": 1, + "amount": 6500, + "price": 6500, + "subtotal_amount": 6500, + "product": { + "id": "prod_0bd76ca337954ca116", + "source_id": "webinar_BF_sweater_pink_sweater", + "name": "Pink Sweater", + "price": 6500 + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_pants_navy_sweat_pants", + "related_object": "product", + "quantity": 1, + "amount": 6000, + "price": 6000, + "subtotal_amount": 6000, + "product": { + "id": "prod_0bd76bd0e204542738", + "source_id": "webinar_BF_pants_navy_sweat_pants", + "name": "Navy Sweat Pants", + "price": 6000 + } + }, + { + "object": "order_item", + "source_id": "5h1pp1ng", + "related_object": "product", + "quantity": 1, + "amount": 2000, + "price": 2000, + "subtotal_amount": 2000, + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping", + "price": 0 + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "related_object": "product", + "quantity": 2, + "amount": 10000, + "price": 5000, + "subtotal_amount": 10000, + "product": { + "id": "prod_0bd76b8656956a183f", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "name": "Gray Sweat Pants", + "price": 5000 + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_sweater_pearl", + "related_object": "product", + "quantity": 2, + "amount": 22000, + "price": 11000, + "subtotal_amount": 22000, + "product": { + "id": "prod_0bd76f59f98617518e", + "source_id": "webinar_BF_sweater_pearl", + "name": "Pearl Sweater", + "price": 11000 + } } - } + ], + "metadata": { + "currency": "EUR" + }, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "code": "PAYINEUROS", + "discount": { + "type": "AMOUNT", + "effect": "APPLY_TO_ORDER", + "amount_off": 1000 + }, + "metadata": { + "shoutout": "Pay in euros to get 10 Euros off, any other currency to get 5 off in that currency." } } - } - }, - "404": { - "description": "Returns an error indicating that the reward assignment with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find reward_assignment with id rewa_pJYQBXSitK2OVPK3XMXZK76XI", - "request_id": "v-0b95b8760a4ad5dda1", - "resource_id": "rewa_pJYQBXSitK2OVPK3XMXZK76XI", - "resource_type": "reward_assignment" - } - } - } + }, + "Loyalty points exceeded": { + "value": { + "valid": false, + "reason": "loyalty card points exceeded", + "error": { + "code": 400, + "key": "loyalty_card_points_exceeded", + "message": "loyalty card points exceeded", + "details": "LOYALTY-CARD-ng3Kb9tM", + "request_id": "v-0be434ae35cabb018a" + }, + "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", + "code": "LOYALTY-CARD-ng3Kb9tM", + "metadata": {} } - } - } - } - }, - "delete": { - "operationId": "delete-reward-assignment", - "tags": [ - "REWARDS API" - ], - "summary": "Delete Reward Assignment", - "description": "This method deletes a reward assignment for a particular reward.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." - }, - "404": { - "description": "Returns an error indicating that the reward or reward assignment with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Reward Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find reward with id rew_2erjvECLs92GYzKbak3QkyT", - "request_id": "v-0ae29f325e1027cde8", - "resource_id": "rew_2erjvECLs92GYzKbak3QkyT", - "resource_type": "reward" + }, + "Loyalty Card": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", + "order": { + "amount": 14500, + "discount_amount": 50, + "total_discount_amount": 50, + "total_amount": 14450, + "applied_discount_amount": 50, + "total_applied_discount_amount": 50, + "items": [ + { + "object": "order_item", + "product_id": "prod_0bd76fc58f8038b043", + "quantity": 1, + "amount": 8500, + "price": 8500, + "subtotal_amount": 8500, + "product": { + "id": "prod_0bd76fc58f8038b043", + "source_id": "webinar_BF_sweater_yellow", + "name": "Yellow Sweater", + "price": 8500 + } + }, + { + "object": "order_item", + "product_id": "prod_0bd76bd0e204542738", + "quantity": 1, + "amount": 6000, + "price": 6000, + "subtotal_amount": 6000, + "product": { + "id": "prod_0bd76bd0e204542738", + "source_id": "webinar_BF_pants_navy_sweat_pants", + "name": "Navy Sweat Pants", + "price": 6000 + } } + ], + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "code": "LOYALTY-CARD-ng3Kb9tM", + "loyalty": { + "points_cost": 10 + }, + "reward": { + "id": "rew_4ZF6Y69U2PXE3GLIZxfozgg1", + "assignment_id": "rewa_WkeBlLhj0sRae70J5AAvLbmy", + "points": 10 + }, + "metadata": {}, + "campaign": "Loyalty Campaign", + "campaign_id": "camp_ZNb23Xtw1WuGCm7gdax84PUi" + } + }, + "Voucher disabled": { + "value": { + "valid": false, + "reason": "voucher is disabled", + "error": { + "code": 400, + "key": "voucher_disabled", + "message": "voucher is disabled", + "details": "GIFT-CARD-kW4aEsfB", + "request_id": "v-0be43817d7121a437d" + }, + "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", + "code": "GIFT-CARD-kW4aEsfB", + "metadata": {} + } + }, + "Gift Card": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", + "order": { + "amount": 1000, + "discount_amount": 2, + "total_discount_amount": 2, + "total_amount": 998, + "applied_discount_amount": 2, + "total_applied_discount_amount": 2, + "metadata": { + "currency": "USD" }, - "Reward Assignment Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find reward_assignment with id rewa_YkwQ5ezNYTQV2geodMVhTpy", - "request_id": "v-0ae2a0588b9027cf95", - "resource_id": "rewa_YkwQ5ezNYTQV2geodMVhTpy", - "resource_type": "reward_assignment" - } - } - } + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "code": "GIFT-CARD-kW4aEsfB", + "gift": { + "amount": 32000, + "balance": 21500, + "effect": "APPLY_TO_ORDER" + }, + "metadata": {}, + "campaign": "Gift Card Campaign", + "campaign_id": "camp_ZjoZEdmnyUCPYwMPN0IVbvDK" } - } - } - } - }, - "get": { - "operationId": "get-reward-assignment", - "tags": [ - "REWARDS API" - ], - "summary": "Get Reward Assignment", - "description": "Retrieve a reward assignment.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a reward assignment object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" - } + }, + "Cannot be redeemed by referrer": { + "value": { + "valid": false, + "reason": "voucher cannot be redeemed by referrer", + "error": { + "code": 400, + "key": "referrer_not_permitted_to_redeem", + "message": "voucher cannot be redeemed by referrer", + "details": "REFERRAL-CODE-OxBakPYf", + "request_id": "v-0be43a8a110abb1bd3" + }, + "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", + "code": "REFERRAL-CODE-OxBakPYf", + "metadata": {} } - } - }, - "404": { - "description": "Returns an error indicating that the reward assignment with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Reward Assignment Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find reward_assignment with id rewa_pJYQBXSitK2OVPK3XMXZK76X", - "request_id": "v-0b95b596e98ad5da24", - "resource_id": "rewa_pJYQBXSitK2OVPK3XMXZK76X", - "resource_type": "reward_assignment" - } - } - } + }, + "Referral Code": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_p6hPsnZj2VSvyXDjH9o6aQ==", + "order": { + "amount": 20000, + "discount_amount": 6000, + "total_discount_amount": 6000, + "total_amount": 14000, + "applied_discount_amount": 6000, + "total_applied_discount_amount": 6000, + "metadata": { + "currency": "USD" + }, + "referrer": { + "id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "object": "customer" + }, + "customer_id": null, + "referrer_id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "object": "order" + }, + "code": "REFERRAL-CODE-OxBakPYf", + "discount": { + "type": "PERCENT", + "effect": "APPLY_TO_ORDER", + "percent_off": 30 + }, + "metadata": {}, + "campaign": "Referral Campaign", + "campaign_id": "camp_TnOf5NB4Jtjxwoq38WckMJfy" } } } } } }, - "/v1/publication-object": { - "get": { - "operationId": "publication-object", - "tags": [ - "PUBLICATIONS API" - ], - "summary": "Publication Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Publication Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/5_obj_publication_object" + "400": { + "description": "Returns an error if request body is missing parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error" + }, + "examples": { + "Missing reward": { + "value": { + "code": 400, + "key": "missing_reward", + "message": "Missing reward", + "details": "A reward is required when redeeming a LOYALTY_CARD", + "request_id": "v-0bcb925c6d90f7f8fc", + "error": { + "message": "Missing reward = please add one." + } + } + }, + "Missing Parameter": { + "value": { + "code": 400, + "key": "missing_order_items_amount", + "message": "Missing applicable order items", + "details": "At least one applicable order item with amount is required to redeem this GIFT_VOUCHER", + "request_id": "v-0bcccfd04085cf2540", + "error": { + "message": "Request should contain an amount for the item." } } + }, + "Metadata Validation Failed": { + "value": { + "code": 400, + "key": "metadata_validation_failed", + "message": "Metadata validation failed", + "details": "location_id: must be an array, and every element: must be a string, must be equal to one of L1,L2,L3 (actual value is 'L1')", + "request_id": "v-0bcced27715305d3fa" + } } } } } + } + } + } + }, + "/client/v1/validate": { + "get": { + "operationId": "validate-voucher-client-side", + "deprecated": true, + "tags": [ + "VALIDATIONS API" + ], + "summary": "Validate Voucher (client-side) [Deprecated]", + "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for voucher validation, and we do not recommend using it. The new [Stackable Discounts API](ref:validate-stacked-discounts-client-side) 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. \n\nTo verify a voucher code given by customer, you can use this method. It is designed for client side integration which means that is accessible only through public keys. This method is designed to be run directly either in web browsers or mobile apps.\n\n> ❗️ Specifying gift credits and loyalty points\n>\n> This endpoint does not support specifying the specific amount of gift credits to apply to an order nor the specific amount of loyalty points to an order. It calculates the amount that is available on the card and applies as much credits or points as possible to cover the total amount. \n\n### Set customer identity (optional)\n\nVoucherify can help you track anonymous customers. Once you integrate Voucherify into your web app and call the validate method, Voucherify will return a tracking ID and the script will store it in a cookie. Each subsequent validate call will use the same tracking ID.\n\nVoucherify tracks a user using a tracking ID to see if the user who is validating vouchers is the same as the one who consuming them. Voucherify does this by setting up an identity for the user. A `tracking_id` will be generated on the server side, unless you specify your own `tracking_id`. In both cases, you will receive the `tracking_id` in the validation response.\n\nThe returned `tracking_id` field should be used as the customer `source_id` in subsequent redemption requests. Moreover, the `tracking_id` returned from Validation API is encoded. Voucherify will recognize both values for identifying customer - the one before encryption sent as a query parameter to the **GET** `/validate` request, and the version encrypted and returned as part of the validation request.\n\n### Sample workflow\n\nCustomer tracking workflow in a nutshell:\n\n**Client-side:**\n * A customer visits your website.\n * A customer validates a voucher code. That triggers a validate request to be sent to Voucherify. In the request, you pass the tracking_id or customer.source_id. As a result, the API call to this endpoint returns an **encoded** `tracking_id`.\n\n**Backend:**\n * Once the customer finishes the checkout process, your website passes the `tracking_id` to your backend during a redemption call. The `tracking_id` is sent as a value assigned to the property *source_id* in a customer object.\n * A customer object is created and within the redemption response, you get a customer `id`.\n * You can use the customer `id` or the customer `source_id` to fetch or modify the customer details.\n \nA customer is created (upserted) automatically with a redemption call. Alternatively, you can create a new profile by creating a customer via a dedicated API method. Take a look at the customer object to understand the [entity's structure](ref:get-customer). \n\n\n\n> 📘 Customer identifier\n>\n> The source id of the customer may either be an already hashed version of the `tracking_id`, which you received in a response from a validation request or a custom ID you predefined (i.e. an email address). Nevertheless, we recommend using identifiers delivered by Voucherify API.\n\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -H \"origin: yourdomain.com\" \\\n 'https://api.voucherify.io/client/v1/validate?code=PAYINEUROS&session_type=LOCK&session_key=A&session_ttl=1&session_ttl_unit=NANOSECONDS&customer=cust_4vMj8Twr5nBzvTrNCgipMb6M&[order][metadata][currency]=EUR&[metadata][location_id][0]=L1&[item][0][source_id]=webinar_BF_sweater_pink_sweater&[item][0][quantity]=2&[item][0][related_object]=product'\n```\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -H \"origin: yourdomain.com\" \\\n 'https://api.voucherify.io/client/v1/validate?code=LOYALTY-CARD-ng3Kb9tM&session_type=LOCK&session_key=A&session_ttl=1&session_ttl_unit=NANOSECONDS&customer[source_id]=286401dc-6f4c-4ebb-8ca2-9f78b3e84c7d&[order][metadata][currency]=EUR&[customer][metadata][age]=24&[customer][metadata][acquisition_channel]=Facebook&[metadata][location_id][0]=L1&[item][0][source_id]=webinar_BF_sweater_pink_sweater&[item][0][quantity]=2&[item][0][related_object]=product&[item][1][source_id]=webinar_BF_pants_gray_sweat_pants&[item][1][quantity]=2&[item][1][related_object]=product&[item][2][product_id]=prod_0bd76bb4aa003890cb&[item][2][quantity]=2&[item][3][source_id]=M0E20000000ELDH&[item][3][quantity]=3&[item][3][related_object]=sku'\n```\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -H \"origin: yourdomain.com\" \\\n 'https://api.voucherify.io/client/v1/validate?code=GIFT-CARD-kW4aEsfB&session_type=LOCK&session_key=A&session_ttl=1&session_ttl_unit=NANOSECONDS&customer[source_id]=286401dc-6f4c-4ebb-8ca2-9f78b3e84c7d&[order][metadata][currency]=EUR&[customer][metadata][age]=24&[customer][metadata][acquisition_channel]=Facebook&[metadata][location_id][0]=L1&[item][0][source_id]=webinar_BF_sweater_pink_sweater&[item][0][quantity]=2&[item][0][related_object]=product&[item][1][source_id]=webinar_BF_pants_gray_sweat_pants&[item][1][quantity]=2&[item][1][related_object]=product&[item][2][product_id]=prod_0bd76bb4aa003890cb&[item][2][quantity]=2&[item][3][source_id]=M0E20000000ELDH&[item][3][quantity]=3&[item][3][related_object]=sku&[item][4][sku_id]=sku_0b661e41fc0d35a8f1&[item][4][quantity]=4'\n```\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -H \"origin: yourdomain.com\" \\\n 'https://api.voucherify.io/client/v1/validate?code=REFERRAL-CODE-OxBakPYf&amount=10000'\n```\n\n### [JSFiddle Example](https://jsfiddle.net/voucherify/gfu2bgn5/)\n\n```javascript\n\n\n\n```\n\n### Examples with Query Parameters\n\n| **Query Parameters** | **Example URL** |\n|:---|:---|\n| Shortcut - `customer` query param instead of `customer[source_id]` | `https://api.voucherify.io/client/v1/validate?code=sKKFCKLZ&amount=10100&customer=customer_id` |\n| Pass `customer`'s and `redemption`'s context `metadata` in query parameters | `https://api.voucherify.io/client/v1/validate?code=sKKFCKLZ&amount=10100&customer=sure_he_is_new&metadata[shop]=1&customer[metadata][propsy]=2&metadata[test]=true` |\n| Use `tracking_id` instead of `source_id` | `https://api.voucherify.io/client/v1/validate?code=IKU-mvS-JOG&amount=10100&tracking_id=sure_he_is_new_5&metadata[shop]=1&metadata[test]=true` |\n\n### Reasons why a validation might fail\n\nVoucher validation might fail because of one of these reasons:\n\n* `voucher not found` - voucher doesn't exist or was [deleted](ref:delete-voucher)\n* `voucher expired` - voucher is out of [start date - expiration date] timeframe\n* `voucher is disabled` - learn more about [disabled vouchers](ref:disable-voucher)\n* `customer does not match segment rules` - learn more customer tracking LINK\n* `order does not match validation rules` - learn more about validation rules LINK", + "parameters": [ + { + "$ref": "#/components/parameters/origin" }, - "/v1/publications/create": { - "get": { - "operationId": "create-publication-1", - "tags": [ - "PUBLICATIONS API" - ], - "summary": "Create Publication", - "description": "This method selects vouchers that are suitable for publication, adds a publish entry and returns the publication.\n\nA voucher is suitable for publication when it's active and hasn't been published yet.\n> ❗️ Limited access\n>\n> Access to this endpoint is limited. This endpoint is designed for specific integrations and the API keys need to be configured to access this endpoint. Navigate to the **Dashboard** → **Project Settings** → **General** → **Integration Keys** to set up a pair of API keys and use them to send the request. \n\n\n> 🚧 Clearly define the source of the voucher\n>\n> You must clearly define which source you want to publish the voucher code from. It can either be a code from a campaign or a specific voucher identified by a code. \n\n> 🚧 Publish multiple vouchers\n> This endpoint does not support the publishing of multiple vouchers from a single campaign. In case you want to publish multiple vouchers within a single publication, you need to use a [dedicated endpoint](ref:create-publication). \n\n\n> 📘 Specifying the voucher to be published\n>\n> - In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use an **auto-update** campaign and in the query parameters specify the `campaign` without specifying the voucher.\n> - If you would like to publish a specific code from a specific campaign, then you need to provide the `campaign` and the `voucher` parameters.\n> - If you would like to publish a standalone voucher, then omit the campaign parameter and simply provide the `voucher` parameter. \n\n## Example Request \n```markdown Publication Query \n/publications/create?campaign=camp_T0bUgWGCAV6S0X3smH4MEboG&metadata[year]=2&metadata[Date]=2023-03-03&metadata[DateTime]=2023-03-03T14:06:08.311Z&metadata[Flag]=true&metadata[Number]=222&metadata[String]=stringy&metadata[ImageURL]=https://user-images.githubusercontent.com/95409292/222734777-a6d9e41a-de3a-42a8-8cc7-24f31e857edd.png&metadata[Object][payment][payment_tax]=9&metadata[Object][payment][payment_method]=Visa&metadata[Object][payment][payment_date]=2023-03-03&metadata[Object][payment][payment_datetime]=2023-03-03T14:06:08.311Z&metadata[Object][payment][payment_completed]=true&metadata[Object][payment][payment_url]=https://user-images.githubusercontent.com/95409292/222734777-a6d9e41a-de3a-42a8-8cc7-24f31e857edd.png&customer[source_id]=try-new-12&customer[name]=John%20Jimmy&customer[description]=This is testing the publication endpoint.&customer[email]=johnjimy2%40email.com&customer[phone]=%2B48%20123%20333%20333&customer[address][city]=Warsaw&customer[address][state]=Mazowieckie&customer[address][line_1]=4499%20Main%20St.&customer[address][line_2]=Blg%202%20APT%204&customer[address][country]=Poland&customer[address][postal_code]=122333&customer[birthday]=2222-01-22&customer[metadata][paid_bill]=true&customer[metadata][age]=22&customer[metadata][location]=Poland&customer[metadata][acquisition_date]=2022-09-09&customer[metadata][birth_date]=2023-03-20T18:44:19.215Z&customer[metadata][ImageURL]=https://user-images.githubusercontent.com/95409292/222734777-a6d9e41a-de3a-42a8-8cc7-24f31e857edd.png&customer[metadata][location-unknown][city]=Katowice&customer[metadata][location-unknown][state]=slask&customer[metadata][location-unknown][number]=2&customer[metadata][location-unknown][date]=2034-09-11&customer[metadata][location-unknown][dateTime]=2023-03-20T18:44:19.215Z&customer[metadata][Object][payment][payment_date]=2023-03-03&customer[metadata][Object][payment][payment_datetime]=2023-03-03T14:06:08.311Z&customer[metadata][Object][payment][payment_completed]=true&customer[metadata][Object][payment][payment_url]=https://user-images.githubusercontent.com/95409292/222734777-a6d9e41a-de3a-42a8-8cc7-24f31e857edd.png&customer[metadata][Object][payment][payment_tax]=9&customer[metadata][Object][payment][payment_method]=Visa```", - "parameters": [ - { - "schema": { - "type": "string", - "example": "custom_publication_source_id" - }, - "in": "query", - "name": "source_id", - "description": "The merchant’s publication ID if it is different from the Voucherify publication ID. It's an optional tracking identifier of a publication. It is really useful in case of an integration between multiple systems. It can be a publication ID from a CRM system, database or 3rd-party service." - }, + { + "schema": { + "type": "string", + "example": "7fjWdr" + }, + "in": "query", + "name": "code", + "description": "A code that identifies the voucher." + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "tracking_id", + "description": "A tracking identifier of a user that validated the voucher. This identifier is generated during voucher validation based on your internal ID (e.g., email, database ID) during the first request. This is a hashed customer source ID. If the request is performed for the first time, pass the internal ID to track the customer. **Although not all information is required, the extra information helps prevent fraud.**" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "amount", + "description": "A positive integer in the smallest currency unit (that is, 100 cents for $1.00) representing the total amount of the order. This amount is the sum of the order items' amounts." + }, + { + "schema": { + "type": "string", + "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" + }, + "in": "query", + "name": "session_key", + "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated." + }, + { + "schema": { + "type": "integer" + }, + "in": "query", + "name": "session_ttl", + "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session_ttl_unit` parameter." + }, + { + "schema": { + "type": "string", + "enum": [ + "HOURS", + "DAYS", + "MINUTES", + "SECONDS", + "MILLISECONDS", + "MICROSECONDS", + "NANOSECONDS" + ] + }, + "in": "query", + "name": "session_ttl_unit", + "description": "Defines the type of unit in which the session time is counted." + }, + { + "$ref": "#/components/parameters/metadata" + }, + { + "$ref": "#/components/parameters/item" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "session_type", + "description": "The session is required to establish a session between multiple parallel validation and redemption requests. This parameter is required to establish a new session. The session locks the **redemption quantity by 1** and additionally the redemption **gift credits** specified within the request for a gift card and the **loyalty points** for a loyalty card." + }, + { + "name": "customer", + "in": "query", + "required": false, + "schema": { + "anyOf": [ { - "schema": { - "type": "string", - "example": "PROMO-1LwwzYI" + "type": "object", + "title": "Customer details", + "description": "Customer source ID and/or customer metadata.", + "properties": { + "source_id": { + "type": "string", + "description": "Customer source ID.", + "example": "name.lastname@email.com" + }, + "metadata": { + "type": "object", + "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments.", + "style": "deepObject", + "explode": true + } }, - "in": "query", - "name": "voucher", - "description": "Code of voucher being published. If there is a particular code that you would like to publish, then you can use this parameter to specify the code. You can omit this parameter if you would like to publish a random code from a campaign, where the campaign is in `AUTO_UPDATE` mode." - }, - { - "name": "metadata", - "in": "query", - "description": "The metadata object stores all custom attributes assigned to the publication. A set of key/value pairs that you can attach to a publication object. It can be useful for storing additional information about the publication in a structured format.", - "style": "deepObject", - "explode": true, - "schema": { - "type": "object" - } - }, - { - "name": "customer", - "in": "query", - "required": true, - "description": "Specify the customer who is to receive a code. You can either directly provide the respective ID's as strings or provide them in the form of an object.", "style": "deepObject", - "explode": true, - "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/5_req_create_publication_customer" - }, - { - "$ref": "#/components/schemas/5_res_create_publication_customer_id" - }, - { - "$ref": "#/components/schemas/5_res_create_publication_customer_source_id" - }, - { - "$ref": "#/components/schemas/9_req_create_customer" - } - ] - } + "explode": true }, { - "name": "campaign", - "in": "query", - "required": true, - "description": "Name of voucher's parent campaign or unique campaign ID that was assigned by Voucherify, i.e. `camp_dphuwqH7BOVkgh4JmpDtS32l`. You can use this parameter without having to specify a particular `voucher` code if the campaign is in `AUTO_UPDATE` mode. This parameter not required for a standalone code, however, if you intend to use a code from a campaign, then this parameter is required.", - "style": "deepObject", - "explode": true, - "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/5_req_create_publication_campaign" - }, - { - "$ref": "#/components/schemas/5_req_create_publication_campaign_id" - }, - { - "$ref": "#/components/schemas/5_req_create_publication_campaign_name" - } - ] - } + "type": "string", + "title": "Customer ID", + "description": "Unique customer ID assigned by Voucherify, i.e. `cust_eWgXlBBiY6THFRJwX45Iakv4`.", + "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + ] + }, + "description": "Customer details." + }, + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "type": "object", + "title": "Order details", + "description": "Order details.", + "properties": { + "metadata": { + "type": "object", + "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are attached to an order object. Stores additional information about the order in a structured format.", + "style": "deepObject", + "explode": true } - ], - "responses": { - "200": { - "description": "Returns a publication object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/5_res_create_publication" - }, - "examples": { - "Example": { - "value": { - "id": "pub_ocaXCa023ayJ3WL1ARxUeKgIvg3JcEGh", - "object": "publication", - "created_at": "2022-09-30T16:30:32.924Z", - "customer_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", - "tracking_id": "pub_source_customer_5", - "metadata": { - "year": 2022 - }, - "channel": "myown", - "source_id": "publication_source_ID_10", - "result": "SUCCESS", - "customer": { - "id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", - "name": "Bob Jones", - "email": "bob.smith@email.com", - "source_id": "pub_source_customer_5", - "metadata": { - "lang": "en", - "test": true - }, - "object": "customer" - }, - "voucher": { - "id": "v_6Hy5FdNlu3dP65fJu5BgXma31Sl3rgkf", - "code": "cEsMn0uA", - "campaign": "Test - Discount Effect - Amount - Items", - "campaign_id": "camp_dphuwqH7BOVkgh4JmpDtS32l", - "category": null, - "category_id": null, - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 300, - "effect": "APPLY_TO_ITEMS" - }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX188XVmOotyCyR2j3G8sJR8HzS3DQ+6J1OElPWSmjlEnthuJc7rkc7WIVxjT4pTl1JVVkHEuGXNXdzRik11H8S18HQeQFJFiuwLZ2mzEC2zZitEinyUxtZwhnEHoi0eGAgYCG7iVMNuOQA==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX188XVmOotyCyR2j3G8sJR8HzS3DQ%2B6J1OElPWSmjlEnthuJc7rkc7WIVxjT4pTl1JVVkHEuGXNXdzRik11H8S18HQeQFJFiuwLZ2mzEC2zZitEinyUxtZwhnEHoi0eGAgYCG7iVMNuOQA%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX18wDd9CcLM0Ef7aBfUSXZUoCQpuNpk4CHGOipbn+wFkfzcIZGBtUlxrI2KsXciCqF+c93AKzsymq5Yw8eEAFF/FK5f94z4/sgzaLDvyBmPCXHuS11Ew9S4ZEMjdTkUJftER2IlxWaCARA==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18wDd9CcLM0Ef7aBfUSXZUoCQpuNpk4CHGOipbn%2BwFkfzcIZGBtUlxrI2KsXciCqF%2Bc93AKzsymq5Yw8eEAFF%2FFK5f94z4%2FsgzaLDvyBmPCXHuS11Ew9S4ZEMjdTkUJftER2IlxWaCARA%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-30T16:30:32.956Z", - "updated_at": null, - "holder_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", - "redemption": { - "quantity": 1, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/cEsMn0uA/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/cEsMn0uA/publications?page=1&limit=10" - }, - "object": "voucher" - }, - "vouchers_id": [ - "v_6Hy5FdNlu3dP65fJu5BgXma31Sl3rgkf" - ] - } - } - } + }, + "style": "deepObject", + "explode": true + }, + "description": "Order details." + } + ], + "security": [ + { + "X-Client-Application-Id-1": [], + "X-Client-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns information whether the voucher is valid in the context of the parameter values provided in the query parameters. Moreover, it returns a hashed source identifier which can be used as tracking ID in future calls. If a validation session is established, then the session details will be returned as well. Read more on [validation sessions](doc:locking-validation-session).", + "content": { + "application/json": { + "schema": { + "anyOf": [ + { + "$ref": "#/components/schemas/6_res_validate_voucher" + }, + { + "$ref": "#/components/schemas/6_res_validate_voucher_false" } - } + ] }, - "400": { - "description": "Returns an error if the query parameters are incomplete.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" + "examples": { + "Wrong customer": { + "value": { + "valid": false, + "reason": "customer does not match validation rules", + "error": { + "message": "Only the gift card owner can apply credits from the gift card to the order." }, - "examples": { - "Missing customer": { - "value": { - "code": 400, - "key": "invalid_query_params", - "message": "Invalid query params", - "details": "Query should have required property 'customer'", - "request_id": "v-0c8b6423f3c80ed3e4" - } - }, - "Missing vouchers": { - "value": { - "code": 400, - "key": "missing_vouchers", - "message": "Missing vouchers", - "details": "Either Campaign or Voucher is required" - } - }, - "Voucher cannot be published": { - "value": { - "code": 400, - "key": "voucher_cannot_be_published", - "message": "Voucher cannot be published", - "details": "Voucher cannot be published. Customer already joined program.", - "request_id": "v-0c8b763544080efed2" - } - }, - "Voucher already published": { - "value": { - "code": 400, - "key": "voucher_already_published", - "message": "Voucher already published", - "details": "Voucher 'v_vM7vQZmgV86k0wuz05cFAOfarj4s8BQE' has already been published", - "request_id": "v-0c8baebc67c80e97a0" + "tracking_id": "track_0nmdnu/6xIb6NTN0Ea40oFmM4wD5QYlxAgKdSn6wh+o", + "code": "GIFT-CARD-kW4aEsfB", + "metadata": {} + } + }, + "Validation Rule Not Satisfied": { + "value": { + "valid": false, + "reason": "redemption does not match validation rules", + "error": { + "code": 400, + "key": "redemption_rules_violated", + "message": "redemption does not match validation rules", + "details": "Discount Coupon cannot be redeemed because of violated validation rules: val_WuupvE7OVXyo", + "request_id": "v-0be54f4afa0357c12f" + }, + "tracking_id": "track_0nmdnu/6xIb6NTN0Ea40oFmM4wD5QYlxAgKdSn6wh+oychk", + "code": "PAYINEUROS", + "metadata": { + "shoutout": "Pay in euros to get 10 Euros off, any other currency to get 5 off in that currency." + } + } + }, + "Validate Discount Coupon": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_rynPcKGW2z7+kd2Vry4p12+Rx2NtyXZyiApdGWEXPrdX+44Fg6LRBQ==", + "session": { + "key": "A", + "type": "LOCK", + "ttl": 1, + "ttl_unit": "NANOSECONDS" + }, + "order": { + "amount": 13000, + "discount_amount": 1000, + "total_discount_amount": 1000, + "total_amount": 12000, + "applied_discount_amount": 1000, + "total_applied_discount_amount": 1000, + "items": [ + { + "object": "order_item", + "source_id": "webinar_BF_sweater_pink_sweater", + "related_object": "product", + "quantity": 2, + "amount": 13000, + "price": 6500, + "subtotal_amount": 13000, + "product": { + "id": "prod_0bd76ca337954ca116", + "source_id": "webinar_BF_sweater_pink_sweater", + "name": "Pink Sweater", + "price": 6500 + } } + ], + "metadata": { + "currency": "EUR" }, - "Duplicate source ID": { - "value": { - "code": 400, - "key": "duplicate_source_id", - "message": "Duplicate source_id", - "details": "Publication with source_id: 'test_publication_source_id_test_voucher' already exists", - "request_id": "v-0c8b7e8f78c80e94a2" + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "code": "PAYINEUROS", + "discount": { + "type": "AMOUNT", + "effect": "APPLY_TO_ORDER", + "amount_off": 1000 + }, + "metadata": { + "shoutout": "Pay in euros to get 10 Euros off, any other currency to get 5 off in that currency." + } + } + }, + "Validate Loyalty Card": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", + "session": { + "key": "A", + "type": "LOCK", + "ttl": 1, + "ttl_unit": "NANOSECONDS" + }, + "order": { + "amount": 121700, + "discount_amount": 5000, + "total_discount_amount": 5000, + "total_amount": 116700, + "applied_discount_amount": 5000, + "total_applied_discount_amount": 5000, + "items": [ + { + "object": "order_item", + "source_id": "webinar_BF_sweater_pink_sweater", + "related_object": "product", + "quantity": 2, + "amount": 13000, + "price": 6500, + "subtotal_amount": 13000, + "product": { + "id": "prod_0bd76ca337954ca116", + "source_id": "webinar_BF_sweater_pink_sweater", + "name": "Pink Sweater", + "price": 6500 + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "related_object": "product", + "quantity": 2, + "amount": 10000, + "price": 5000, + "subtotal_amount": 10000, + "product": { + "id": "prod_0bd76b8656956a183f", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "name": "Gray Sweat Pants", + "price": 5000 + } + }, + { + "object": "order_item", + "product_id": "prod_0bd76bb4aa003890cb", + "quantity": 2, + "amount": 9000, + "price": 4500, + "subtotal_amount": 9000, + "product": { + "id": "prod_0bd76bb4aa003890cb", + "source_id": "webinar_BF_pants_black_sweat_pants", + "name": "Black Sweat Pants", + "price": 4500 + } + }, + { + "object": "order_item", + "source_id": "M0E20000000ELDH", + "related_object": "sku", + "product_id": "prod_0b661d4bd2c7ec7d1f", + "quantity": 3, + "amount": 89700, + "price": 29900, + "subtotal_amount": 89700, + "product": { + "id": "prod_0b661d4bd2c7ec7d1f", + "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", + "name": "Casual jacket Michael Kors beige" + }, + "sku": { + "id": "sku_0b661e41fc8d35a8f8", + "source_id": "M0E20000000ELDH", + "sku": "Casual jacket Michael Kors beige", + "price": 29900 + } } + ], + "metadata": { + "currency": "EUR" }, - "Too many vouchers requested": { - "value": { - "code": 400, - "key": "too_many_vouchers_requested", - "message": "Too many vouchers requested", - "details": "Only up to 1 can be published", - "request_id": "v-0c8bac9a25c80e912d" + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "code": "LOYALTY-CARD-ng3Kb9tM", + "loyalty": { + "points_cost": 1000 + }, + "reward": { + "id": "rew_4ZF6Y69U2PXE3GLIZxfozgg1", + "assignment_id": "rewa_WkeBlLhj0sRae70J5AAvLbmy" + }, + "metadata": {}, + "campaign": "Loyalty Campaign", + "campaign_id": "camp_ZNb23Xtw1WuGCm7gdax84PUi" + } + }, + "Validate Gift Card": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", + "session": { + "key": "A", + "type": "LOCK", + "ttl": 1, + "ttl_unit": "NANOSECONDS" + }, + "order": { + "amount": 165700, + "discount_amount": 21500, + "total_discount_amount": 21500, + "total_amount": 144200, + "applied_discount_amount": 21500, + "total_applied_discount_amount": 21500, + "items": [ + { + "object": "order_item", + "source_id": "webinar_BF_sweater_pink_sweater", + "related_object": "product", + "quantity": 2, + "amount": 13000, + "price": 6500, + "subtotal_amount": 13000, + "product": { + "id": "prod_0bd76ca337954ca116", + "source_id": "webinar_BF_sweater_pink_sweater", + "name": "Pink Sweater", + "price": 6500 + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "related_object": "product", + "quantity": 2, + "amount": 10000, + "price": 5000, + "subtotal_amount": 10000, + "product": { + "id": "prod_0bd76b8656956a183f", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "name": "Gray Sweat Pants", + "price": 5000 + } + }, + { + "object": "order_item", + "product_id": "prod_0bd76bb4aa003890cb", + "quantity": 2, + "amount": 9000, + "price": 4500, + "subtotal_amount": 9000, + "product": { + "id": "prod_0bd76bb4aa003890cb", + "source_id": "webinar_BF_pants_black_sweat_pants", + "name": "Black Sweat Pants", + "price": 4500 + } + }, + { + "object": "order_item", + "source_id": "M0E20000000ELDH", + "related_object": "sku", + "product_id": "prod_0b661d4bd2c7ec7d1f", + "quantity": 3, + "amount": 89700, + "price": 29900, + "subtotal_amount": 89700, + "product": { + "id": "prod_0b661d4bd2c7ec7d1f", + "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", + "name": "Casual jacket Michael Kors beige" + }, + "sku": { + "id": "sku_0b661e41fc8d35a8f8", + "source_id": "M0E20000000ELDH", + "sku": "Casual jacket Michael Kors beige", + "price": 29900 + } + }, + { + "object": "order_item", + "product_id": "prod_0b661d4bd347ec7d26", + "sku_id": "sku_0b661e41fc0d35a8f1", + "quantity": 4, + "amount": 44000, + "price": 11000, + "subtotal_amount": 44000, + "product": { + "id": "prod_0b661d4bd347ec7d26", + "source_id": "975193eb-1911-444a-a0f0-f567efce1a8b", + "name": "Pumps ”Flex” Michael Kors black" + }, + "sku": { + "id": "sku_0b661e41fc0d35a8f1", + "source_id": "M0E20000000DMVX", + "sku": "Pumps ”Flex” Michael Kors black", + "price": 11000 + } } + ], + "metadata": { + "currency": "EUR" }, - "Metadata validation failed": { - "value": { - "code": 400, - "key": "metadata_validation_failed", - "message": "Metadata validation failed", - "details": "ImageURL: must be a URL pointing to JPG/JPEG or PNG resource (actual value is 'http.com')", - "request_id": "v-0c8bcbd742080ee807" - } - } - } - } - } - }, - "403": { - "description": "Returns an error if you don't have a specific credentials set up. Navigate to the **Dashboard** → **Project Settings** → **General** → **Integration Keys** to set up a pair of API keys and use them to send the request.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_integration_key" + "customer_id": null, + "referrer_id": null, + "object": "order" }, - "examples": { - "Example": { - "value": { - "code": 403, - "message": "Forbidden", - "key": "integration_api_key_required" - } - } - } + "code": "GIFT-CARD-kW4aEsfB", + "gift": { + "amount": 32000, + "balance": 21500, + "effect": "APPLY_TO_ORDER" + }, + "metadata": {}, + "campaign": "Gift Card Campaign", + "campaign_id": "camp_ZjoZEdmnyUCPYwMPN0IVbvDK" } - } - }, - "404": { - "description": "Returns an error if a resource is not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Resource not found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find customer with id cust_xqA7DGj5eYPHg6PHVKwYRWiA", - "request_id": "v-0c8b6b35294af6f192", - "resource_id": "cust_xqA7DGj5eYPHg6PHVKwYRWiA", - "resource_type": "customer" - } - } - } + }, + "Validate Referral Code": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_p6hPsnZj2VSvyXDjH9o6aQ==", + "order": { + "amount": 10000, + "discount_amount": 3000, + "total_discount_amount": 3000, + "total_amount": 7000, + "applied_discount_amount": 3000, + "total_applied_discount_amount": 3000, + "items": [], + "metadata": {}, + "referrer": { + "id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "object": "customer" + }, + "customer_id": null, + "referrer_id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", + "object": "order" + }, + "code": "REFERRAL-CODE-OxBakPYf", + "discount": { + "type": "PERCENT", + "effect": "APPLY_TO_ORDER", + "percent_off": 30 + }, + "metadata": {}, + "campaign": "Referral Campaign", + "campaign_id": "camp_TnOf5NB4Jtjxwoq38WckMJfy" } } } } } }, - "/v1/publications": { - "get": { - "operationId": "list-publications", - "tags": [ - "PUBLICATIONS API" - ], - "summary": "List Publications", - "description": "Retrieve a list of publications. To return a **particular** publication, you can use the `source_id` query parameter and provide the `source_id` of the publication you are looking for specifically.\n\n## Pagination\n\n\n> 🚧 Important!\n>\n> If you want to scroll through a huge set of records, it is recommended to use the [Exports API](ref:create-export). This API will return an error `page_over_limit` if you reach a page above 1000.\n\n## Filter Query\n\nThe `filters` query parameter allows for joining multiple parameters with logical operators. The syntax looks as follows:\n\n\n```url\nfilters[][conditions][][]=\n```\n\n### Operators:\n\n\n```\n \"$in\"\n \"$not_in\"\n \"$is\"\n \"$is_not\"\n \"$has_value\"\n \"$is_unknown\"\n \"$contains\"\n \"$starts_with\"\n \"$ends_with\"\n \"$more_than\"\n \"$less_than\"\n \"$more_than_equal\"\n \"$less_than_equal\"\n```\n\n### Examples\n\n\n```url\nGET /v1/publications?filters[customer_id][conditions][$is][0]=cust_lUET6gRpO5Wxlg5p2j2gRCgL\n```\n\n```url\nGET /v1/publications?filters[customer_id][conditions][$in][0]=cust_lUET6gRpO5Wxlg5p2j2gRCgL&filters[customer_id][conditions][$in][1]=cust_aR7NfHusxT7PdTMAKMfWDXnc\n```\n\n```url\nGET /v1/publications?filters[customer_id][conditions][$is][0]=cust_lUET6gRpO5Wxlg5p2j2gRCgL&filters[customer_id][conditions][$is][1]=cust_aR7NfHusxT7PdTMAKMfWDXnc&filters[junction]=OR\n```", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "schema": { - "type": "string", - "enum": [ - "id", - "-id", - "voucher_code", - "-voucher_code", - "tracking_id", - "-tracking_id", - "customer_id", - "-customer_id", - "created_at", - "-created_at", - "channel", - "-channel" - ] - }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "campaign", - "description": "Filters by a given campaign name." - }, - { - "schema": { - "type": "string", - "example": "cust_jl33V8ZDQJp4goU1z8DmFioo" - }, - "in": "query", - "name": "customer", - "description": "Filters by a unique customer ID." - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "voucher", - "description": "Filters by a given voucher code." - }, - { - "schema": { - "type": "string", - "enum": [ - "SUCCESS", - "FAILURE" - ] - }, - "in": "query", - "name": "result", - "description": "Filters by a publication result." - }, - { - "schema": { - "type": "string", - "enum": [ - "discount", - "loyalty", - "lucky_draw" - ] - }, - "in": "query", - "name": "voucher_type", - "description": "Filters by a voucher type." - }, - { - "schema": { - "type": "boolean" - }, - "in": "query", - "name": "is_referral_code", - "description": "This filter works only for the `true` option. If set to `true`, the query returns only publications of codes from referral campaigns. " - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "filters", - "description": "Allows for combining the filters mentioned in the endpoint description." + "400": { + "description": "Returns an error if missing required parameters or tracking IDs come from the same origin.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "source_id", - "description": "Using this endpoint with a particular publication `source_id`, which was sent with the original request to create a publication, returns in the response, exactly the same code published initially because the code was assigned to the given publication. As a result, you can use this endpoint as a reference and return a code that was assigned in a publication by using a particular `source_id`." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a list of publications you’ve previously created with [create publication](ref:create-publication) or implicitly by the distribution manager. The publications are returned in sorted order, with the most recent ones appearing first.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/5_res_list_publications" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "publications", - "publications": [ - { - "id": "pub_QzQT50e5i2y3bRoEVvhFgrKbZ7t6BRwu", - "object": "publication", - "created_at": "2022-09-28T13:31:23.522Z", - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "tracking_id": "cindy.jones@email.com", - "metadata": { - "distribution_id": "distr_WXm0CBttar2ug2hBx3EdPtS8Ei", - "source_type": "distribution", - "source_id": "distr_WXm0CBttar2ug2hBx3EdPtS8Ei" - }, - "channel": "Automation", - "source_id": null, - "result": "SUCCESS", - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "name": "Cindy Jones", - "email": "cindy.jones@email.com", - "source_id": "cindy.jones@email.com", - "metadata": { - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "voucher": { - "code": "FNV5IrtY", - "object": "voucher", - "campaign": "Loyalty Campaign", - "loyalty_card": { - "points": 0, - "balance": 0 - }, - "is_referral_code": false - }, - "vouchers_id": [ - "v_i3HOzVClfJUDia0qCu7TSuGfDj7c0dgD" - ] - }, - { - "id": "pub_8KOKHObAjuemuI0b6225emIhmWDL1ZoX", - "object": "publication", - "created_at": "2022-09-28T13:31:02.766Z", - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "tracking_id": "sandy.jones@email.com", - "metadata": {}, - "channel": "voucherify-website", - "source_id": null, - "result": "SUCCESS", - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "name": "Sandy Jones", - "email": "sandy.jones@email.com", - "source_id": "sandy.jones@email.com", - "metadata": { - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "voucher": { - "code": "Voucher-1", - "object": "voucher", - "campaign": null, - "discount": { - "type": "AMOUNT", - "amount_off": 200, - "amount_off_formula": "IF(VOUCHER_PUBLISH_COUNT = 1;25;5)", - "effect": "APPLY_TO_ORDER" - }, - "is_referral_code": false - }, - "vouchers_id": [ - "v_1iEL92K634EIOqeYJw6AHrnjEhGPEdpu" - ] - }, - { - "id": "pub_DcQPfyVYzomtkQGXFW7dcdyNoJ6vQ4NV", - "object": "publication", - "created_at": "2022-09-13T06:15:08.249Z", - "customer_id": "cust_ur1hIPGflbaAe14mLlLdon3G", - "tracking_id": "1", - "metadata": {}, - "channel": "voucherify-website", - "source_id": null, - "result": "SUCCESS", - "customer": { - "id": "cust_ur1hIPGflbaAe14mLlLdon3G", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "1", - "metadata": { - "accepts_marketing": false - }, - "object": "customer" - }, - "voucher": { - "code": "GIFT-WOZaK5YF1Fs87tAX", - "object": "voucher", - "campaign": "Gift Cards", - "gift": { - "amount": 0, - "balance": 0 - }, - "is_referral_code": false - }, - "vouchers_id": [ - "v_yzOeb7vw63vbPfA30215dFm7aRXa8Xoc" - ] - } - ], - "total": 3 - } - } - } + "examples": { + "Missing customer": { + "value": { + "code": 400, + "key": "missing_customer", + "message": "Missing customer", + "details": "Customer is required to validate rules", + "request_id": "v-0be548ae620abb0a73" } - } - }, - "400": { - "description": "Returns an error if you request a page higher than 1000.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Example": { - "value": { - "code": 400, - "key": "page_over_limit", - "message": "Listing resource above 1000 page is not supported", - "details": "Property .page cannot be higher than 1000", - "request_id": "v-0bc2a39574c61362af" - } - } - } + }, + "Ambiguous tracking ID": { + "value": { + "code": 400, + "key": "ambiguous_tracking_id", + "message": "Ambiguous trackingId ('track_0nmdnu/6xIb6NTN0Ea40oFmM4wD5QYlxAgKdSn6wh+oychkbEcMNB5RhcTj+zcKBEcGnUZkAXxg=' vs. 'track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==')", + "details": "The customer cannot be identified as two different identifiers have been used between requests from same origin.", + "request_id": "v-0be550a5a84abb30f8" } } } } + } + } + } + } + }, + "/v1/promotions/validation": { + "post": { + "operationId": "validate-promotions", + "deprecated": true, + "tags": [ + "VALIDATIONS API" + ], + "summary": "Validate Promotions [Deprecated]", + "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for qualification, and we do not recommend using it. The new [Qualifications API](ref:examine-qualification) introduces additional features and improvements while maintaining backward compatibility. 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. \n\nUse this method to get valid promotions for a given customer and order.\n\n### Advanced validation filters\n\nYou can narrow down a validation to a specific promotion ID or tier metadata. Here are the examples of filtering queries you can use:\n\n| **Filter** | **Example** |\n|:---|:---|\n| promotion_id | [filters][promotion_id][conditions][$is]={{campaign_id}} |\n| tier metadata | [filters][metadata.{{promotion tier metadata key}}][conditions][$is]={{promotion tier metadata value}} |\n\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"customer\": {\n \"id\": \"cust_gN9KgORZECfdhG9qT6n82Zr7\"\n },\n \"order\": {\n \"items\": [\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9aeddb019a42db\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": \"1\"\n },\n {\n \"sku_id\": \"sku_0b7d7dfb090be5c619\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b72b0bd64d198e3ae\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b7d7c4e814be5c502\",\n \"quantity\": 1\n }\n ],\n \"metadata\":{\n \"payment_mean\": [\"credit-card\"]\n }\n },\n \"options\": {\n \"expand\": [\n \"category\"\n ]\n }\n }'/\n 'https://api.voucherify.io/v1/promotions/validation?audienceRulesOnly=true'\n```\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -d `{\n \"customer\": {\n \"id\": \"cust_gN9KgORZECfdhG9qT6n82Zr7\"\n },\n \"order\": {\n \"items\": [\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9aeddb019a42db\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": \"1\"\n },\n {\n \"sku_id\": \"sku_0b7d7dfb090be5c619\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b72b0bd64d198e3ae\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b7d7c4e814be5c502\",\n \"quantity\": 1\n }\n ],\n \"metadata\":{\n \"payment_mean\": [\"credit-card\"]\n }\n },\n \"options\": {\n \"expand\": [\n \"category\"\n ]\n },\n \"metadata\": {\n \"store_names\": \"Store 1 - New York - Broadway\"\n }\n }`\\\n 'https://api.voucherify.io/v1/promotions/validation?[filters][promotion_id][conditions][$is]=camp_nYcAyjFXmEaBU0nB7EQ4hVTr'\n```\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -d `{\n \"customer\": {\n \"id\": \"cust_gN9KgORZECfdhG9qT6n82Zr7\"\n },\n \"order\": {\n \"items\": [\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9aeddb019a42db\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": \"1\"\n },\n {\n \"sku_id\": \"sku_0b7d7dfb090be5c619\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b72b0bd64d198e3ae\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b7d7c4e814be5c502\",\n \"quantity\": 1\n }\n ],\n \"metadata\":{\n \"payment_mean\": [\"credit-card\"]\n }\n },\n \"options\": {\n \"expand\": [\n \"category\"\n ]\n }\n }`\\\n 'https://api.voucherify.io/v1/promotions/validation?[filters][metadata.has_budget][conditions][$is]=true'\n```", + "parameters": [ + { + "schema": { + "type": "string" }, - "post": { - "operationId": "create-publication", - "tags": [ - "PUBLICATIONS API" - ], - "summary": "Create Publication", - "description": "This method selects vouchers that are suitable for publication, adds a publish entry and returns the publication.\n\nA voucher is suitable for publication when it's active and hasn't been published yet. \n\n\n> 🚧 Clearly define the source of the voucher\n>\n> You must clearly define which source you want to publish the voucher code from. It can either be a code from a campaign or a specific voucher identified by a code. \n\n> 🚧 Publish multiple vouchers\n> In case you want to publish multiple vouchers within a single publication, you need to specify the campaign name and number of vouchers you want to publish. \n\n\n> 📘 Auto-update campaign\n>\n> In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use an **auto-update** campaign.", - "parameters": [ - { - "schema": { - "type": "boolean" - }, - "in": "query", - "name": "join_once", - "description": "Through this flag, you can control if a particular person gets only one and always the same code even if the app sends multiple publication requests. It means that if you have a referral program, a referrer is assigned only to one code if an integration sends publication requests more than once for the same customer." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the publication parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/5_req_create_publication" - }, - "examples": { - "Example - Specific Voucher": { - "value": { - "campaign": { - "name": "campaign-name" - }, - "customer": { - "source_id": "source-id", - "Name": "Customer Name", - "email": "customer email" - }, - "voucher": "voucher-code", - "metadata": { - "key": "value" - } - } - }, - "Example - Random Voucher": { - "value": { - "campaign": { - "name": "campaign-name", - "count": 1 - }, - "customer": { - "source_id": "source-id", - "Name": "Customer Name", - "email": "customer email" - }, - "voucher": "voucher-code", - "metadata": { - "key": "value" - } - } - }, - "Example 3": { - "value": { - "source_id": "publication_source_ID_10", - "campaign": "Test - Discount Effect - Amount - Items", - "channel": "myown", - "customer": { - "source_id": "pub_source_customer_5", - "name": "Bob Jones", - "description": "A frequent customer", - "email": "bob.smith@email.com", - "phone": "+1 933 222 3333", - "address": { - "city": "New York", - "country": "United States", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 5", - "postal_code": "10001", - "state": "NY" - }, - "metadata": { - "lang": "en", - "test": true - }, - "birthday": "1901-12-01" - }, - "metadata": { - "year": 2022 - } - } - } - } - } + "in": "query", + "name": "audienceRulesOnly", + "description": "If you add a query param AudienceRulesOnly=true, the request will be validated against customer-related rules only, the rest of attached limits and rules will be ignored." + }, + { + "name": "filters", + "in": "query", + "required": false, + "schema": { + "type": "object", + "title": "Promotion filters", + "description": "Promotion filter conditions.", + "properties": { + "metadata": { + "type": "object", + "description": "Allows you to create a filter based on the conditions set for promotion metadata values. The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that are attached to a promotion tier object. Stores additional information about the promotion tier in a structured format.", + "style": "deepObject", + "explode": true + }, + "promotion_id": { + "type": "object", + "description": "Allows you to create a filter based on the unique promotion ID.", + "style": "deepObject", + "explode": true } }, - "responses": { - "200": { - "description": "Returns a publication object if a valid identifier was provided.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/5_res_create_publication" - }, - "examples": { - "Example": { - "value": { - "id": "pub_ocaXCa023ayJ3WL1ARxUeKgIvg3JcEGh", - "object": "publication", - "created_at": "2022-09-30T16:30:32.924Z", - "customer_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", - "tracking_id": "pub_source_customer_5", - "metadata": { - "year": 2022 - }, - "channel": "myown", - "source_id": "publication_source_ID_10", - "result": "SUCCESS", - "customer": { - "id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", - "name": "Bob Jones", - "email": "bob.smith@email.com", - "source_id": "pub_source_customer_5", - "metadata": { - "lang": "en", - "test": true - }, - "object": "customer" - }, - "voucher": { - "id": "v_6Hy5FdNlu3dP65fJu5BgXma31Sl3rgkf", - "code": "cEsMn0uA", - "campaign": "Test - Discount Effect - Amount - Items", - "campaign_id": "camp_dphuwqH7BOVkgh4JmpDtS32l", - "category": null, - "category_id": null, - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 300, - "effect": "APPLY_TO_ITEMS" - }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX188XVmOotyCyR2j3G8sJR8HzS3DQ+6J1OElPWSmjlEnthuJc7rkc7WIVxjT4pTl1JVVkHEuGXNXdzRik11H8S18HQeQFJFiuwLZ2mzEC2zZitEinyUxtZwhnEHoi0eGAgYCG7iVMNuOQA==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX188XVmOotyCyR2j3G8sJR8HzS3DQ%2B6J1OElPWSmjlEnthuJc7rkc7WIVxjT4pTl1JVVkHEuGXNXdzRik11H8S18HQeQFJFiuwLZ2mzEC2zZitEinyUxtZwhnEHoi0eGAgYCG7iVMNuOQA%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX18wDd9CcLM0Ef7aBfUSXZUoCQpuNpk4CHGOipbn+wFkfzcIZGBtUlxrI2KsXciCqF+c93AKzsymq5Yw8eEAFF/FK5f94z4/sgzaLDvyBmPCXHuS11Ew9S4ZEMjdTkUJftER2IlxWaCARA==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18wDd9CcLM0Ef7aBfUSXZUoCQpuNpk4CHGOipbn%2BwFkfzcIZGBtUlxrI2KsXciCqF%2Bc93AKzsymq5Yw8eEAFF%2FFK5f94z4%2FsgzaLDvyBmPCXHuS11Ew9S4ZEMjdTkUJftER2IlxWaCARA%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-30T16:30:32.956Z", - "updated_at": null, - "holder_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", - "redemption": { - "quantity": 1, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/cEsMn0uA/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/cEsMn0uA/publications?page=1&limit=10" - }, - "object": "voucher" - }, - "vouchers_id": [ - "v_6Hy5FdNlu3dP65fJu5BgXma31Sl3rgkf" - ] + "style": "deepObject", + "explode": true + }, + "description": "Filter conditions." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Provide the customer and order context.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/6_req_validate_promotion" + }, + "examples": { + "Example": { + "value": { + "customer": { + "source_id": "source-id", + "metadata": { + "key": "value" + } + }, + "options": { + "expand": [ + "category" + ] + }, + "order": { + "amount": 10000, + "items": [ + { + "product_id": "product-id", + "quantity": "1", + "price": 10000, + "related_object": "product", + "product": { + "metadata": { + "key": "value" + } } } - } + ] + }, + "metadata": { + "key": "value" } } }, - "400": { - "description": "Returns an error if a publication with the same source ID already exists in the system or some request body parameter is missing.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Missing Parameters": { - "value": { - "code": 400, - "key": "missing_vouchers", - "message": "Missing vouchers", - "details": "Either Campaign or Voucher is required" - } + "Customer Rules Only": { + "value": { + "customer": { + "id": "cust_gN9KgORZECfdhG9qT6n82Zr7" + }, + "order": { + "items": [ + { + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1 }, - "Already published": { - "value": { - "code": 400, - "key": "voucher_already_published", - "message": "Voucher already published", - "details": "Voucher 'v_Y5P4UZ1yilkiYOIJmAAgWazUi1wfkNwF' has already been published", - "request_id": "v-0bc40bb800d5651137" - } + { + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 1 }, - "Duplicate Source ID": { - "value": { - "code": 400, - "key": "duplicate_source_id", - "message": "Duplicate source_id", - "details": "Publication with source_id: 'publication_source_ID_1' already exists", - "request_id": "v-0bc40bf81555651191" - } + { + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": "1" + }, + { + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1 + }, + { + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 1 + }, + { + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1 } + ], + "metadata": { + "payment_mean": [ + "credit-card" + ] } + }, + "options": { + "expand": [ + "category" + ] } } }, - "404": { - "description": "Returns an error if a resource is not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Campaign Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id 1", - "request_id": "v-0bc40546e5d56508e5", - "resource_id": "1", - "resource_type": "campaign" - } + "Campaign Specific": { + "value": { + "customer": { + "source_id": "test-user@email.com" + }, + "order": { + "items": [ + { + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1 + }, + { + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 1 + }, + { + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": "1" + }, + { + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1 + }, + { + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 1 + }, + { + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1 } + ], + "metadata": { + "payment_mean": [ + "credit-card" + ] } + }, + "options": { + "expand": [ + "category" + ] + }, + "metadata": { + "store_names": "Store 1 - New York - Broadway" } } - } - } - } - }, - "/v1/validation-object": { - "get": { - "operationId": "validation-object", - "tags": [ - "VALIDATIONS API" - ], - "summary": "Validation Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Validation Object", - "content": { - "application/json": { - "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_voucher_false" - }, - { - "$ref": "#/components/schemas/6_res_validate_voucher" - } + }, + "Promotion Tier Metadata": { + "value": { + "customer": { + "name": "Joe McDonald", + "email": "joey@email.com", + "source_id": "123_source_id" + }, + "order": { + "items": [ + { + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1 + }, + { + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 1 + }, + { + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": "1" + }, + { + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1 + }, + { + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 1 + }, + { + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1 + } + ], + "metadata": { + "payment_mean": [ + "credit-card" ] } + }, + "options": { + "expand": [ + "category" + ] } } } } } - }, - "/v1/vouchers/{code}/validate": { - "parameters": [ - { + } + }, + "responses": { + "200": { + "description": "Returns a list of valid promotions for a given context (customer and order). You can then choose which promotion to apply, i.e. the highest discount amount.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "Testing7fjWdr" - }, - "name": "code", - "in": "path", - "required": true, - "description": "A code that identifies the voucher." - } - ], - "post": { - "operationId": "validate-voucher", - "deprecated": true, - "tags": [ - "VALIDATIONS API" - ], - "summary": "Validate Voucher [Deprecated]", - "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for voucher validation, and we do not recommend using it. The new [Stackable Discounts API](ref:validate-stacked-discounts) 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. \n\nTo verify a voucher code given by a customer, you can use this method. It is designed for a server side integration, which means that is accessible only through private keys. \n\n\n> ❗️ Important \n>\n> This endpoint supports the validation of a single promo code. If you need to validate more than one incentive, you can use the [Stackable discounts API](ref:stackable-discounts-api). The stacking discounts API lets you validate up to 5 incentives per call. Before integrating Voucherify, choose which validation endpoint you prefer to use.\n\n#### Gift Vouchers - validate Gift Card and control amount to redeem\nVoucherify also gives the possibility to create a gift card, which allows using credits to fulfill the order. A user can specify how many credits he wants to use from the gift card. The available balance of credits is counted based on policy rules attached to the Gift Voucher definition. \n\nThis operation returns information about the validity of the code. Moreover, it returns a hashed source identifier which can be used as a tracking ID in future calls.\n\nIf a validation session is established, then the session details will be returned as well. Read more about sessions [here](doc:locking-validation-session).\n\nVoucher validation might fail because of one of these reasons:\n* `voucher not found` - voucher doesn't exist or was [deleted](ref:delete-voucher)\n* `voucher expired` - voucher is out of start date - expiration date time frame\n* `voucher is disabled` - learn more about a [disabled voucher](ref:disable-voucher)\n* `customer does not match segment rules` - learn more [customer tracking](doc:customers#customer-tracking) \n* `order does not match validation rules` - learn more about [validation rules](doc:validation-rules)", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the voucher validation context using the request body parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/6_req_validate_voucher" - }, - "examples": { - "Free Shipping": { - "value": { - "customer": { - "id": "cust_4vMj8Twr5nBzvTrNCgipMb6M" + "$ref": "#/components/schemas/6_res_validate_promotion" + }, + "examples": { + "Customer Rules Only": { + "value": { + "valid": true, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", + "promotions": [ + { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" }, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", "order": { + "amount": 9351000, + "initial_amount": 72100, + "items_discount_amount": 9340400, + "total_discount_amount": 9340400, + "total_amount": 10600, + "items_applied_discount_amount": 9340400, + "total_applied_discount_amount": 9340400, "items": [ { - "product_id": "prod_0ba621bae5d39762ce", - "quantity": "1" + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } }, { - "product_id": "prod_0b661d404787ec6d3b", - "quantity": "1", - "price": 3100 - } - ] - } - } - }, - "Multiple Product Variants": { - "value": { - "customer": { - "source_id": "08dd9b5a-26de-44aa-a1d4-d9adfa9e8ec2" - }, - "order": { - "id": "ord_FDdsDI3FppuiqHa4s7drZEMP" - } - } - }, - "Unit - Add order items": { - "value": { - "customer": { - "source_id": "08dd9b5a-26de-44aa-a1d4-d9adfa9e8ec2" - }, - "order": { - "source_id": "47f491d1-a697-4f92-95ca-2ba1f463efa8" - }, - "session": { - "type": "LOCK", - "ttl_unit": "NANOSECONDS", - "ttl": 1 - } - } - }, - "Fixed": { - "value": { - "customer": { - "source_id": "08dd9b5a-26de-44aa-a1d4-d9adfa9e8ec2" - }, - "order": { - "items": [ + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 1, + "amount": 3100, + "price": 3100, + "subtotal_amount": 3100, + "product": { + "id": "prod_0a9f9aeddb019a42db", + "name": "Blue T-Shirt", + "price": 3100 + } + }, { - "source_id": "webinar_BF_sweater_pink_sweater", - "quantity": "1", - "price": 6500, - "related_object": "product" + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } }, { - "source_id": "webinar_BF_pants_navy_sweat_pants", - "quantity": "1", - "price": 6000, - "related_object": "product" + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 23, + "discount_quantity": 22, + "initial_quantity": 1, + "amount": 39100, + "discount_amount": 37400, + "initial_amount": 1700, + "applied_discount_amount": 37400, + "price": 1700, + "subtotal_amount": 1700, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100 + }, + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1700 + } }, { - "source_id": "5h1pp1ng", - "quantity": "1", - "price": 2000, - "related_object": "product" + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 222, + "discount_quantity": 222, + "initial_quantity": 1, + "amount": 333000, + "discount_amount": 333000, + "initial_amount": 1500, + "applied_discount_amount": 333000, + "price": 1500, + "subtotal_amount": 0, + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage", + "price": 1500 + } }, { - "source_id": "webinar_BF_pants_gray_sweat_pants", - "quantity": "2", - "price": 5000, - "related_object": "product" + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 111, + "discount_quantity": 111, + "initial_quantity": 1, + "amount": 6660000, + "discount_amount": 6660000, + "initial_amount": 60000, + "applied_discount_amount": 6660000, + "price": 60000, + "subtotal_amount": 0, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "price": 60000 + } }, { - "source_id": "webinar_BF_sweater_pearl", - "quantity": "2", - "price": 11000, - "related_object": "product" + "object": "order_item", + "product_id": "prod_0bae2dc5a090fd0184", + "sku_id": "sku_0bae3b28f610fd0da1", + "quantity": 11, + "discount_quantity": 11, + "initial_quantity": 0, + "amount": 2310000, + "discount_amount": 2310000, + "initial_amount": 0, + "applied_discount_amount": 2310000, + "price": 210000, + "subtotal_amount": 0, + "product": { + "id": "prod_0bae2dc5a090fd0184", + "source_id": "first_product", + "name": "Samsung Phone 1", + "price": 220000 + }, + "sku": { + "id": "sku_0bae3b28f610fd0da1", + "source_id": "first_product_sku_1", + "sku": "Samsung phone 256GB", + "price": 210000 + } } - ] - }, - "session": { - "type": "LOCK" - } - } - }, - "Percentage": { - "value": { - "customer": { - "source_id": "your_customer_source_ID", - "name": "Bob Smith", - "description": "A frequent customer", - "email": "bob.smith@email.com", - "phone": "+1 933 222 3333", - "address": { - "city": "New York", - "country": "United States", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 5", - "postal_code": "10001", - "state": "NY" - }, + ], "metadata": { - "lang": "en", - "test": true + "payment_mean": [ + "credit-card" + ] }, - "birthday": "1960-12-01" + "customer_id": null, + "referrer_id": null, + "object": "order" }, - "order": { - "items": [ - { - "source_id": "webinar_BF_sweater_pink_sweater", - "quantity": "1", - "price": 6500, - "related_object": "product" - }, + "id": "promo_ByIIAHC1Mz9ouJsitzAWsush", + "name": "Multiple", + "discount": { + "type": "UNIT", + "effect": "ADD_MANY_ITEMS", + "units": [ { - "source_id": "webinar_BF_pants_navy_sweat_pants", - "quantity": "1", - "price": 6000, - "related_object": "product" + "effect": "ADD_MISSING_ITEMS", + "unit_off": 11, + "unit_type": "sku_0bae3b28f610fd0da1", + "sku": { + "id": "sku_0bae3b28f610fd0da1", + "source_id": "first_product_sku_1", + "sku": "Samsung phone 256GB" + }, + "product": { + "id": "prod_0bae2dc5a090fd0184", + "source_id": "first_product", + "name": "Samsung Phone 1" + } }, { - "source_id": "5h1pp1ng", - "quantity": "1", - "price": 2000, - "related_object": "product" + "effect": "ADD_NEW_ITEMS", + "unit_off": 22, + "unit_type": "sku_0b7d7dfb090be5c619", + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1" + }, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1" + } }, { - "source_id": "webinar_BF_pants_gray_sweat_pants", - "quantity": "2", - "price": 5000, - "related_object": "product" + "effect": "ADD_MISSING_ITEMS", + "unit_off": 111, + "unit_type": "prod_0b7d7c4e814be5c502", + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12" + } }, { - "source_id": "webinar_BF_sweater_pearl", - "quantity": "2", - "price": 11000, - "related_object": "product" + "effect": "ADD_MISSING_ITEMS", + "unit_off": 222, + "unit_type": "prod_0b72b0bd64d198e3ae", + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage" + } } ] }, - "session": { - "type": "LOCK", - "key": "your_custom_key", - "ttl_unit": "NANOSECONDS", - "ttl": 1 - } - } - }, - "Amount": { - "value": { - "customer": { - "source_id": "your_customer_source_ID", - "name": "Bob Smith", - "description": "A frequent customer", - "email": "bob.smith@email.com", - "phone": "+1 933 222 3333", - "address": { - "city": "New York", - "country": "United States", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 5", - "postal_code": "10001", - "state": "NY" - }, - "metadata": { - "lang": "en", - "test": true - }, - "birthday": "1960-12-01" + "campaign": { + "id": "camp_JtoaZ8Qgpf6FkMAy2wWiOJWH", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "hierarchy": 1, + "discount_amount": 9340400, + "applied_discount_amount": 9340400, + "metadata": {}, + "object": "promotion_tier" + }, + { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" }, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", "order": { + "amount": 9522100, + "initial_amount": 72100, + "items_discount_amount": 9450000, + "total_discount_amount": 9450000, + "total_amount": 72100, + "items_applied_discount_amount": 9450000, + "total_applied_discount_amount": 9450000, "items": [ { - "source_id": "webinar_BF_sweater_pink_sweater", - "quantity": "1", - "price": 6500, - "related_object": "product" + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } }, { - "source_id": "webinar_BF_pants_navy_sweat_pants", - "quantity": "1", - "price": 6000, - "related_object": "product" + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 1, + "amount": 3100, + "price": 3100, + "subtotal_amount": 3100, + "product": { + "id": "prod_0a9f9aeddb019a42db", + "name": "Blue T-Shirt", + "price": 3100 + } }, { - "source_id": "5h1pp1ng", - "quantity": "1", - "price": 2000, - "related_object": "product" + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1700, + "price": 1700, + "subtotal_amount": 1700, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100 + }, + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1700 + } + }, + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 1, + "amount": 1500, + "price": 1500, + "subtotal_amount": 1500, + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage", + "price": 1500 + } }, { - "source_id": "webinar_BF_pants_gray_sweat_pants", - "quantity": "2", - "price": 5000, - "related_object": "product" + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 60000, + "price": 60000, + "subtotal_amount": 60000, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "price": 60000 + } }, { - "source_id": "webinar_BF_sweater_pearl", - "quantity": "2", - "price": 11000, - "related_object": "product" + "object": "order_item", + "product_id": "prod_0bae2dc5a090fd0184", + "sku_id": "sku_0bae3b28f610fd0da1", + "quantity": 45, + "discount_quantity": 45, + "initial_quantity": 0, + "amount": 9450000, + "discount_amount": 9450000, + "initial_amount": 0, + "applied_discount_amount": 9450000, + "price": 210000, + "subtotal_amount": 0, + "product": { + "id": "prod_0bae2dc5a090fd0184", + "source_id": "first_product", + "name": "Samsung Phone 1", + "price": 220000 + }, + "sku": { + "id": "sku_0bae3b28f610fd0da1", + "source_id": "first_product_sku_1", + "sku": "Samsung phone 256GB", + "price": 210000 + } } ], "metadata": { - "currency": "EUR" + "payment_mean": [ + "credit-card" + ] + }, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "id": "promo_ZWkx6R0I1Ts3N9HL4kfTdxOm", + "name": "Add new SKU", + "discount": { + "type": "UNIT", + "effect": "ADD_NEW_ITEMS", + "unit_off": 45, + "unit_type": "sku_0bae3b28f610fd0da1", + "sku": { + "id": "sku_0bae3b28f610fd0da1", + "source_id": "first_product_sku_1", + "sku": "Samsung phone 256GB" + }, + "product": { + "id": "prod_0bae2dc5a090fd0184", + "source_id": "first_product", + "name": "Samsung Phone 1" } }, - "session": { - "type": "LOCK", - "key": "your_custom_key", - "ttl_unit": "NANOSECONDS", - "ttl": 1 - } - } - }, - "Loyalty Card": { - "value": { + "campaign": { + "id": "camp_40LC42P5NFbkkD4RWoJ4btks", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "hierarchy": 4, + "discount_amount": 9450000, + "applied_discount_amount": 9450000, + "metadata": {}, + "object": "promotion_tier" + }, + { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", "order": { + "amount": 109500, + "initial_amount": 72100, + "items_discount_amount": 39100, + "total_discount_amount": 39100, + "total_amount": 70400, + "items_applied_discount_amount": 39100, + "total_applied_discount_amount": 39100, "items": [ { - "product_id": "prod_0bd76fc58f8038b043", - "quantity": "1" + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 1, + "amount": 3100, + "price": 3100, + "subtotal_amount": 3100, + "product": { + "id": "prod_0a9f9aeddb019a42db", + "name": "Blue T-Shirt", + "price": 3100 + } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 23, + "discount_quantity": 23, + "initial_quantity": 1, + "amount": 39100, + "discount_amount": 39100, + "initial_amount": 1700, + "applied_discount_amount": 39100, + "price": 1700, + "subtotal_amount": 0, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100 + }, + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1700 + } + }, + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 1, + "amount": 1500, + "price": 1500, + "subtotal_amount": 1500, + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage", + "price": 1500 + } }, { - "product_id": "prod_0bd76bd0e204542738", - "quantity": "1" + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 60000, + "price": 60000, + "subtotal_amount": 60000, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "price": 60000 + } } - ] - }, - "reward": { - "id": "rew_4ZF6Y69U2PXE3GLIZxfozgg1", - "points": 10 - } - } - }, - "Gift Card": { - "value": { - "customer": { - "source_id": "286401dc-6f4c-4ebb-8ca2-9f78b3e84c7d" - }, - "order": { - "amount": 1000, + ], "metadata": { - "currency": "USD" - } - }, - "gift": { - "credits": 2 - }, - "metadata": { - "location_id": [ - "L1" - ] - } - } - }, - "Referral Code": { - "value": { - "customer": { - "source_id": "earlybirdcust" + "payment_mean": [ + "credit-card" + ] + }, + "customer_id": null, + "referrer_id": null, + "object": "order" }, - "order": { - "amount": 20000, - "metadata": { - "currency": "USD" + "id": "promo_NcdD0zLo6FUhKWpNrNuP3Pte", + "name": "Add missing SKU", + "discount": { + "type": "UNIT", + "effect": "ADD_MISSING_ITEMS", + "unit_off": 23, + "unit_type": "sku_0b7d7dfb090be5c619", + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1" + }, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1" } }, - "metadata": { - "location_id": [ - "L1" - ] - } - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns information whether the voucher is valid in the context of the parameter values provided in the request body.", - "content": { - "application/json": { - "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_voucher" + "campaign": { + "id": "camp_40LC42P5NFbkkD4RWoJ4btks", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_false" - } - ] - }, - "examples": { - "False": { - "value": { - "valid": false, - "reason": "redemption does not match validation rules", - "error": { - "code": 400, - "key": "redemption_rules_violated", - "message": "redemption does not match validation rules", - "details": "Gift Card cannot be redeemed because of violated validation rules: val_wvipKm99CJuL", - "request_id": "v-0bccef7a9585cf63b6" - }, - "tracking_id": "track_ZGPtmYcM+Mw=", - "code": "vBQvYFEM", - "metadata": {} - } - }, - "Free Shipping": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_rynPcKGW2z7+kd2Vry4p12+Rx2NtyXZyiApdGWEXPrdX+44Fg6LRBQ==", - "order": { - "amount": 4300, - "total_amount": 4300, - "items": [ - { - "object": "order_item", - "product_id": "prod_0ba621bae5d39762ce", - "quantity": 1, - "amount": 1200, - "price": 1200, - "subtotal_amount": 1200, - "product": { - "id": "prod_0ba621bae5d39762ce", - "source_id": "arabica_plus", - "name": "Arabica Coffee 250g", - "price": 1200 - } - }, - { - "object": "order_item", - "product_id": "prod_0b661d404787ec6d3b", - "quantity": 1, - "amount": 3100, - "price": 3100, - "subtotal_amount": 3100, - "product": { - "id": "prod_0b661d404787ec6d3b", - "source_id": "7717f389-4621-4c7a-a6db-d4acfe051a97", - "name": "Kate Moss by Mario Testino" - } - }, - { - "object": "order_item", - "product_id": "prod_5h1pp1ng", - "quantity": 1, - "discount_quantity": 1, - "initial_quantity": 0, - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping" - } - } - ], - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "code": "Test - Discount - Free Shipping", - "discount": { - "type": "UNIT", - "effect": "ADD_MISSING_ITEMS", - "unit_off": 1, - "unit_type": "prod_5h1pp1ng", - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping" - } - }, - "metadata": {} - } + "hierarchy": 3, + "discount_amount": 39100, + "applied_discount_amount": 39100, + "metadata": {}, + "object": "promotion_tier" }, - "Multiple Product Varients": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_rynPcKGW2z7+kd2Vry4p12+Rx2NtyXZyiApdGWEXPrdX+44Fg6LRBQ==", - "order": { - "id": "ord_FDdsDI3FppuiqHa4s7drZEMP", - "source_id": "47f491d1-a697-4f92-95ca-2ba1f463efa8", - "created_at": "2022-09-21T13:09:25.773Z", - "updated_at": "2022-09-21T13:09:27.139Z", - "status": "PAID", - "amount": 237300, - "initial_amount": 28000, - "discount_amount": 8400, - "items_discount_amount": 209300, - "total_discount_amount": 217700, - "total_amount": 19600, - "items_applied_discount_amount": 209300, - "total_applied_discount_amount": 209300, - "items": [ - { - "object": "order_item", - "source_id": "A0E20000000295J", - "related_object": "sku", - "product_id": "prod_0b661d31134b299cc2", - "quantity": 1, - "amount": 9500, - "price": 9500, - "subtotal_amount": 9500, - "product": { - "id": "prod_0b661d31134b299cc2", - "source_id": "2c446063-d582-4d7e-9651-23971b3e56f7", - "name": "Keychain D‘Amico" - }, - "sku": { - "id": "sku_0b661d6265cb29ae52", - "source_id": "A0E20000000295J", - "sku": "Keychain D‘Amico", - "metadata": {}, - "price": 9500 - } - }, - { - "object": "order_item", - "source_id": "M0E20000000EAT6", - "related_object": "sku", - "quantity": 1, - "amount": 18500, - "price": 18500, - "subtotal_amount": 18500, - "product": { - "name": "Jogging pants Paolo Pecora light grey" - }, - "sku": { - "sku": "Jogging pants Paolo Pecora light grey", - "metadata": {} - } - }, - { - "object": "order_item", - "product_id": "prod_5h1pp1ng", - "quantity": 1, - "discount_quantity": 1, - "initial_quantity": 0, - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping" - } - }, - { - "object": "order_item", - "product_id": "prod_0b661d4bd2c7ec7d1f", - "sku_id": "sku_0b661e41fc8d35a8f7", - "quantity": 3, - "discount_quantity": 3, - "initial_quantity": 0, - "amount": 89700, - "discount_amount": 89700, - "initial_amount": 0, - "applied_discount_amount": 89700, - "price": 29900, - "subtotal_amount": 0, - "product": { - "id": "prod_0b661d4bd2c7ec7d1f", - "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", - "name": "Casual jacket Michael Kors beige" - }, - "sku": { - "id": "sku_0b661e41fc8d35a8f7", - "source_id": "M0E20000000ELDG", - "sku": "Casual jacket Michael Kors beige", - "price": 29900 - } - }, - { - "object": "order_item", - "product_id": "prod_0b661d4bd2c7ec7d1f", - "sku_id": "sku_0b661e41fc8d35a8f6", - "quantity": 4, - "discount_quantity": 4, - "initial_quantity": 0, - "amount": 119600, - "discount_amount": 119600, - "initial_amount": 0, - "applied_discount_amount": 119600, - "price": 29900, - "subtotal_amount": 0, - "product": { - "id": "prod_0b661d4bd2c7ec7d1f", - "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", - "name": "Casual jacket Michael Kors beige" - }, - "sku": { - "id": "sku_0b661e41fc8d35a8f6", - "source_id": "M0E20000000ELDF", - "sku": "Casual jacket Michael Kors beige", - "price": 29900 - } + { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", + "order": { + "amount": 76100, + "initial_amount": 72100, + "items_discount_amount": 4000, + "total_discount_amount": 4000, + "total_amount": 72100, + "items_applied_discount_amount": 4000, + "total_applied_discount_amount": 4000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 } - ], - "metadata": {}, - "customer": { - "id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "object": "customer" }, - "customer_id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0bb9c69ca9d5a364b2": { - "date": "2022-09-21T13:09:25.799Z", - "related_object_type": "redemption", - "related_object_id": "r_0bb9c69ca9d5a364b2", - "stacked": [ - "r_0bb9c69ca9d5a364b3", - "r_0bb9c69ca9d5a364b4" - ] + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 1, + "amount": 3100, + "price": 3100, + "subtotal_amount": 3100, + "product": { + "id": "prod_0a9f9aeddb019a42db", + "name": "Blue T-Shirt", + "price": 3100 } - } - }, - "code": "Test - Discount - Unit - Multiple - Product Variants", - "discount": { - "type": "UNIT", - "effect": "ADD_MANY_ITEMS", - "units": [ - { - "effect": "ADD_MISSING_ITEMS", - "unit_off": 3, - "unit_type": "sku_0b661e41fc8d35a8f7", - "sku": { - "id": "sku_0b661e41fc8d35a8f7", - "source_id": "M0E20000000ELDG", - "sku": "Casual jacket Michael Kors beige" - }, - "product": { - "id": "prod_0b661d4bd2c7ec7d1f", - "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", - "name": "Casual jacket Michael Kors beige" - } - }, - { - "effect": "ADD_NEW_ITEMS", - "unit_off": 4, - "unit_type": "sku_0b661e41fc8d35a8f6", - "sku": { - "id": "sku_0b661e41fc8d35a8f6", - "source_id": "M0E20000000ELDF", - "sku": "Casual jacket Michael Kors beige" - }, - "product": { - "id": "prod_0b661d4bd2c7ec7d1f", - "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", - "name": "Casual jacket Michael Kors beige" - } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 } - ] - }, - "metadata": {} - } - }, - "Unit - Add order items": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_rynPcKGW2z7+kd2Vry4p12+Rx2NtyXZyiApdGWEXPrdX+44Fg6LRBQ==", - "session": { - "key": "ssn_K7DV3RbAGNCRVrPNZxJfld3FdwAQwOGl", - "type": "LOCK", - "ttl": 1, - "ttl_unit": "NANOSECONDS" - }, - "order": { - "id": "ord_FDdsDI3FppuiqHa4s7drZEMP", - "source_id": "47f491d1-a697-4f92-95ca-2ba1f463efa8", - "created_at": "2022-09-21T13:09:25.773Z", - "updated_at": "2022-09-21T13:09:27.139Z", - "status": "PAID", - "amount": 117700, - "initial_amount": 28000, - "discount_amount": 8400, - "items_discount_amount": 89700, - "total_discount_amount": 98100, - "total_amount": 19600, - "items_applied_discount_amount": 89700, - "total_applied_discount_amount": 89700, - "items": [ - { - "object": "order_item", - "source_id": "A0E20000000295J", - "related_object": "sku", - "product_id": "prod_0b661d31134b299cc2", - "quantity": 1, - "amount": 9500, - "price": 9500, - "subtotal_amount": 9500, - "product": { - "id": "prod_0b661d31134b299cc2", - "source_id": "2c446063-d582-4d7e-9651-23971b3e56f7", - "name": "Keychain D‘Amico" - }, - "sku": { - "id": "sku_0b661d6265cb29ae52", - "source_id": "A0E20000000295J", - "sku": "Keychain D‘Amico", - "metadata": {}, - "price": 9500 - } - }, - { - "object": "order_item", - "source_id": "M0E20000000EAT6", - "related_object": "sku", - "quantity": 1, - "amount": 18500, - "price": 18500, - "subtotal_amount": 18500, - "product": { - "name": "Jogging pants Paolo Pecora light grey" - }, - "sku": { - "sku": "Jogging pants Paolo Pecora light grey", - "metadata": {} - } - }, - { - "object": "order_item", - "product_id": "prod_5h1pp1ng", - "quantity": 1, - "discount_quantity": 1, - "initial_quantity": 0, - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping" - } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1700, + "price": 1700, + "subtotal_amount": 1700, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100 }, - { - "object": "order_item", - "product_id": "prod_0b661d4bd2c7ec7d1f", - "sku_id": "sku_0b661e41fc8d35a8f8", - "quantity": 3, - "discount_quantity": 3, - "initial_quantity": 0, - "amount": 89700, - "discount_amount": 89700, - "initial_amount": 0, - "applied_discount_amount": 89700, - "price": 29900, - "subtotal_amount": 0, - "product": { - "id": "prod_0b661d4bd2c7ec7d1f", - "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", - "name": "Casual jacket Michael Kors beige" - }, - "sku": { - "id": "sku_0b661e41fc8d35a8f8", - "source_id": "M0E20000000ELDH", - "sku": "Casual jacket Michael Kors beige", - "price": 29900 - } + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1700 } - ], - "metadata": {}, - "customer": { - "id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "object": "customer" }, - "customer_id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0bb9c69ca9d5a364b2": { - "date": "2022-09-21T13:09:25.799Z", - "related_object_type": "redemption", - "related_object_id": "r_0bb9c69ca9d5a364b2", - "stacked": [ - "r_0bb9c69ca9d5a364b3", - "r_0bb9c69ca9d5a364b4" - ] + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 1, + "amount": 1500, + "price": 1500, + "subtotal_amount": 1500, + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage", + "price": 1500 } - } - }, - "code": "Test - Discount - Unit - Add new order items", - "discount": { - "type": "UNIT", - "effect": "ADD_NEW_ITEMS", - "unit_off": 3, - "unit_type": "sku_0b661e41fc8d35a8f8", - "sku": { - "id": "sku_0b661e41fc8d35a8f8", - "source_id": "M0E20000000ELDH", - "sku": "Casual jacket Michael Kors beige" }, - "product": { - "id": "prod_0b661d4bd2c7ec7d1f", - "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", - "name": "Casual jacket Michael Kors beige" - } - }, - "metadata": {} - } - }, - "Fixed": { - "value": { - "valid": true, - "applicable_to": { - "data": [ - { - "object": "product", - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "strict": false, - "price": 2000, - "price_formula": "IF(ORDER_AMOUNT > 400;0;20)", - "effect": "APPLY_TO_EVERY" - }, - { - "object": "products_collection", - "id": "pc_2KWKXn09Dk8neCfymqd4xOq8", - "strict": false, - "price": 99900, - "price_formula": "IF(ORDER_AMOUNT > 300;ORDER_ITEM_PRICE * 0.8;ORDER_ITEM_PRICE)", - "effect": "APPLY_TO_EVERY" - }, - { - "object": "products_collection", - "id": "pc_x7HELQo52g2uI6nDuuOTRjAW", - "strict": false, - "price": 99900, - "price_formula": "IF(ORDER_AMOUNT > 200;ORDER_ITEM_PRICE * 0.9;ORDER_ITEM_PRICE)", - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0bd76ca337954ca116", - "source_id": "webinar_BF_sweater_pink_sweater", - "strict": true, - "price": 99900, - "price_formula": "IF(ORDER_AMOUNT > 300;ORDER_ITEM_PRICE * 0.8;ORDER_ITEM_PRICE)", - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0bd76bd0e204542738", - "source_id": "webinar_BF_pants_navy_sweat_pants", - "strict": true, - "price": 99900, - "price_formula": "IF(ORDER_AMOUNT > 200;ORDER_ITEM_PRICE * 0.9;ORDER_ITEM_PRICE)", - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0bd76b8656956a183f", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "strict": true, - "price": 99900, - "price_formula": "IF(ORDER_AMOUNT > 200;ORDER_ITEM_PRICE * 0.9;ORDER_ITEM_PRICE)", - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0bd76f59f98617518e", - "source_id": "webinar_BF_sweater_pearl", - "strict": true, - "price": 99900, - "price_formula": "IF(ORDER_AMOUNT > 300;ORDER_ITEM_PRICE * 0.8;ORDER_ITEM_PRICE)", - "effect": "APPLY_TO_EVERY" + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 60000, + "price": 60000, + "subtotal_amount": 60000, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "price": 60000 } - ], - "total": 7, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_rynPcKGW2z7+kd2Vry4p12+Rx2NtyXZyiApdGWEXPrdX+44Fg6LRBQ==", - "session": { - "key": "ssn_u8rvi3Ac70S5ZRELWrxYsR2bnolpVWNg", - "type": "LOCK", - "ttl": 7, - "ttl_unit": "DAYS" - }, - "order": { - "amount": 46500, - "items_discount_amount": 9300, - "total_discount_amount": 9300, - "total_amount": 37200, - "items_applied_discount_amount": 9300, - "total_applied_discount_amount": 9300, - "items": [ - { - "object": "order_item", - "source_id": "webinar_BF_sweater_pink_sweater", - "related_object": "product", - "quantity": 1, - "amount": 6500, - "discount_amount": 1300, - "applied_discount_amount": 1300, - "price": 6500, - "subtotal_amount": 5200, - "product": { - "id": "prod_0bd76ca337954ca116", - "source_id": "webinar_BF_sweater_pink_sweater", - "name": "Pink Sweater", - "price": 6500 - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_pants_navy_sweat_pants", - "related_object": "product", - "quantity": 1, - "amount": 6000, - "discount_amount": 600, - "applied_discount_amount": 600, - "price": 6000, - "subtotal_amount": 5400, - "product": { - "id": "prod_0bd76bd0e204542738", - "source_id": "webinar_BF_pants_navy_sweat_pants", - "name": "Navy Sweat Pants", - "price": 6000 - } - }, - { - "object": "order_item", - "source_id": "5h1pp1ng", - "related_object": "product", - "quantity": 1, - "amount": 2000, - "discount_amount": 2000, - "applied_discount_amount": 2000, - "price": 2000, - "subtotal_amount": 0, - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping", - "price": 0 - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "related_object": "product", - "quantity": 2, - "amount": 10000, - "discount_amount": 1000, - "applied_discount_amount": 1000, - "price": 5000, - "subtotal_amount": 9000, - "product": { - "id": "prod_0bd76b8656956a183f", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "name": "Gray Sweat Pants", - "price": 5000 - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_sweater_pearl", - "related_object": "product", - "quantity": 2, - "amount": 22000, - "discount_amount": 4400, - "applied_discount_amount": 4400, - "price": 11000, - "subtotal_amount": 17600, - "product": { - "id": "prod_0bd76f59f98617518e", - "source_id": "webinar_BF_sweater_pearl", - "name": "Pearl Sweater", - "price": 11000 - } + }, + { + "object": "order_item", + "product_id": "prod_0b72b00ffed198e344", + "quantity": 8, + "discount_quantity": 8, + "initial_quantity": 0, + "amount": 4000, + "discount_amount": 4000, + "initial_amount": 0, + "applied_discount_amount": 4000, + "price": 500, + "subtotal_amount": 0, + "product": { + "id": "prod_0b72b00ffed198e344", + "source_id": "roses_1", + "name": "Bouquet - Romantic Roses", + "price": 500 } - ], - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "code": "SPENDMOREGETMORE-DaIXFJvn", - "discount": { - "type": "FIXED", - "effect": "APPLY_TO_ITEMS" - }, + } + ], "metadata": { - "shoutout": "Order more than 200€ to get 10% off pants, more than 300€ to get 20% off sweaters, and more than 400€ to get free shipping." - }, - "campaign": "SPENDMOREGETMORE", - "campaign_id": "camp_Nwb2mppeDTtk23s1FVo6riwp" - } - }, - "Voucher expired": { - "value": { - "valid": false, - "reason": "voucher expired", - "error": { - "code": 400, - "key": "voucher_expired", - "message": "voucher expired", - "details": "EarlyBird-tB6zCApA", - "request_id": "v-0be43067028abb6ca8" + "payment_mean": [ + "credit-card" + ] }, - "tracking_id": "track_4Wb/eeza4PDXKElxYR/QtlDQOVFpY9mP", - "code": "EarlyBird-tB6zCApA", - "metadata": { - "shoutout": "Get an early bird special. The earlier you order, the better discount you will get." + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "id": "promo_nGr1SWuy9vduABkbbJkl8cHb", + "name": "Add new order items", + "banner": "Add Romantic Roses", + "discount": { + "type": "UNIT", + "effect": "ADD_NEW_ITEMS", + "unit_off": 8, + "unit_type": "prod_0b72b00ffed198e344", + "product": { + "id": "prod_0b72b00ffed198e344", + "source_id": "roses_1", + "name": "Bouquet - Romantic Roses" } - } + }, + "campaign": { + "id": "camp_40LC42P5NFbkkD4RWoJ4btks", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "hierarchy": 2, + "discount_amount": 4000, + "applied_discount_amount": 4000, + "metadata": {}, + "object": "promotion_tier" }, - "Percentage": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_4Wb/eeza4PDXKElxYR/QtlDQOVFpY9mP", - "session": { - "key": "your_custom_key", - "type": "LOCK", - "ttl": 1, - "ttl_unit": "NANOSECONDS" - }, - "order": { - "amount": 46500, - "discount_amount": 4650, - "total_discount_amount": 4650, - "total_amount": 41850, - "applied_discount_amount": 4650, - "total_applied_discount_amount": 4650, - "items": [ - { - "object": "order_item", - "source_id": "webinar_BF_sweater_pink_sweater", - "related_object": "product", - "quantity": 1, - "amount": 6500, - "price": 6500, - "subtotal_amount": 6500, - "product": { - "id": "prod_0bd76ca337954ca116", - "source_id": "webinar_BF_sweater_pink_sweater", - "name": "Pink Sweater", - "price": 6500 - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_pants_navy_sweat_pants", - "related_object": "product", - "quantity": 1, - "amount": 6000, - "price": 6000, - "subtotal_amount": 6000, - "product": { - "id": "prod_0bd76bd0e204542738", - "source_id": "webinar_BF_pants_navy_sweat_pants", - "name": "Navy Sweat Pants", - "price": 6000 - } - }, - { - "object": "order_item", - "source_id": "5h1pp1ng", - "related_object": "product", - "quantity": 1, - "amount": 2000, - "price": 2000, - "subtotal_amount": 2000, - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping", - "price": 0 - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "related_object": "product", - "quantity": 2, - "amount": 10000, - "price": 5000, - "subtotal_amount": 10000, - "product": { - "id": "prod_0bd76b8656956a183f", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "name": "Gray Sweat Pants", - "price": 5000 - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_sweater_pearl", - "related_object": "product", - "quantity": 2, - "amount": 22000, - "price": 11000, - "subtotal_amount": 22000, - "product": { - "id": "prod_0bd76f59f98617518e", - "source_id": "webinar_BF_sweater_pearl", - "name": "Pearl Sweater", - "price": 11000 - } + { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", + "order": { + "amount": 78100, + "initial_amount": 72100, + "items_discount_amount": 7500, + "total_discount_amount": 7500, + "total_amount": 70600, + "items_applied_discount_amount": 7500, + "total_applied_discount_amount": 7500, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 } - ], - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "code": "EarlyBird-tB6zCApA", - "discount": { - "type": "PERCENT", - "effect": "APPLY_TO_ORDER", - "percent_off": 10 - }, - "expiration_date": "2022-10-29T00:00:00.000Z", - "metadata": { - "shoutout": "Get an early bird special. The earlier you order, the better discount you will get." - }, - "campaign": "Webinar - Early Bird Scenario", - "campaign_id": "camp_z1g3iFqQe5qiZ9TTYFVpMwC0" - } - }, - "Amount": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_4Wb/eeza4PDXKElxYR/QtlDQOVFpY9mP", - "session": { - "key": "your_custom_key", - "type": "LOCK", - "ttl": 1, - "ttl_unit": "NANOSECONDS" - }, - "order": { - "amount": 46500, - "discount_amount": 1000, - "total_discount_amount": 1000, - "total_amount": 45500, - "applied_discount_amount": 1000, - "total_applied_discount_amount": 1000, - "items": [ - { - "object": "order_item", - "source_id": "webinar_BF_sweater_pink_sweater", - "related_object": "product", - "quantity": 1, - "amount": 6500, - "price": 6500, - "subtotal_amount": 6500, - "product": { - "id": "prod_0bd76ca337954ca116", - "source_id": "webinar_BF_sweater_pink_sweater", - "name": "Pink Sweater", - "price": 6500 - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_pants_navy_sweat_pants", - "related_object": "product", - "quantity": 1, - "amount": 6000, - "price": 6000, - "subtotal_amount": 6000, - "product": { - "id": "prod_0bd76bd0e204542738", - "source_id": "webinar_BF_pants_navy_sweat_pants", - "name": "Navy Sweat Pants", - "price": 6000 - } - }, - { - "object": "order_item", - "source_id": "5h1pp1ng", - "related_object": "product", - "quantity": 1, - "amount": 2000, - "price": 2000, - "subtotal_amount": 2000, - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping", - "price": 0 - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "related_object": "product", - "quantity": 2, - "amount": 10000, - "price": 5000, - "subtotal_amount": 10000, - "product": { - "id": "prod_0bd76b8656956a183f", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "name": "Gray Sweat Pants", - "price": 5000 - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_sweater_pearl", - "related_object": "product", - "quantity": 2, - "amount": 22000, - "price": 11000, - "subtotal_amount": 22000, - "product": { - "id": "prod_0bd76f59f98617518e", - "source_id": "webinar_BF_sweater_pearl", - "name": "Pearl Sweater", - "price": 11000 - } + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 1, + "amount": 3100, + "price": 3100, + "subtotal_amount": 3100, + "product": { + "id": "prod_0a9f9aeddb019a42db", + "name": "Blue T-Shirt", + "price": 3100 } - ], - "metadata": { - "currency": "EUR" }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "code": "PAYINEUROS", - "discount": { - "type": "AMOUNT", - "effect": "APPLY_TO_ORDER", - "amount_off": 1000 - }, - "metadata": { - "shoutout": "Pay in euros to get 10 Euros off, any other currency to get 5 off in that currency." - } - } - }, - "Loyalty points exceeded": { - "value": { - "valid": false, - "reason": "loyalty card points exceeded", - "error": { - "code": 400, - "key": "loyalty_card_points_exceeded", - "message": "loyalty card points exceeded", - "details": "LOYALTY-CARD-ng3Kb9tM", - "request_id": "v-0be434ae35cabb018a" - }, - "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", - "code": "LOYALTY-CARD-ng3Kb9tM", - "metadata": {} - } - }, - "Loyalty Card": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", - "order": { - "amount": 14500, - "discount_amount": 50, - "total_discount_amount": 50, - "total_amount": 14450, - "applied_discount_amount": 50, - "total_applied_discount_amount": 50, - "items": [ - { - "object": "order_item", - "product_id": "prod_0bd76fc58f8038b043", - "quantity": 1, - "amount": 8500, - "price": 8500, - "subtotal_amount": 8500, - "product": { - "id": "prod_0bd76fc58f8038b043", - "source_id": "webinar_BF_sweater_yellow", - "name": "Yellow Sweater", - "price": 8500 - } - }, - { - "object": "order_item", - "product_id": "prod_0bd76bd0e204542738", - "quantity": 1, - "amount": 6000, - "price": 6000, - "subtotal_amount": 6000, - "product": { - "id": "prod_0bd76bd0e204542738", - "source_id": "webinar_BF_pants_navy_sweat_pants", - "name": "Navy Sweat Pants", - "price": 6000 - } + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 } - ], - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "code": "LOYALTY-CARD-ng3Kb9tM", - "loyalty": { - "points_cost": 10 - }, - "reward": { - "id": "rew_4ZF6Y69U2PXE3GLIZxfozgg1", - "assignment_id": "rewa_WkeBlLhj0sRae70J5AAvLbmy", - "points": 10 - }, - "metadata": {}, - "campaign": "Loyalty Campaign", - "campaign_id": "camp_ZNb23Xtw1WuGCm7gdax84PUi" - } - }, - "Voucher disabled": { - "value": { - "valid": false, - "reason": "voucher is disabled", - "error": { - "code": 400, - "key": "voucher_disabled", - "message": "voucher is disabled", - "details": "GIFT-CARD-kW4aEsfB", - "request_id": "v-0be43817d7121a437d" - }, - "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", - "code": "GIFT-CARD-kW4aEsfB", - "metadata": {} - } - }, - "Gift Card": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", - "order": { - "amount": 1000, - "discount_amount": 2, - "total_discount_amount": 2, - "total_amount": 998, - "applied_discount_amount": 2, - "total_applied_discount_amount": 2, - "metadata": { - "currency": "USD" }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "code": "GIFT-CARD-kW4aEsfB", - "gift": { - "amount": 32000, - "balance": 21500, - "effect": "APPLY_TO_ORDER" - }, - "metadata": {}, - "campaign": "Gift Card Campaign", - "campaign_id": "camp_ZjoZEdmnyUCPYwMPN0IVbvDK" - } - }, - "Cannot be redeemed by referrer": { - "value": { - "valid": false, - "reason": "voucher cannot be redeemed by referrer", - "error": { - "code": 400, - "key": "referrer_not_permitted_to_redeem", - "message": "voucher cannot be redeemed by referrer", - "details": "REFERRAL-CODE-OxBakPYf", - "request_id": "v-0be43a8a110abb1bd3" - }, - "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", - "code": "REFERRAL-CODE-OxBakPYf", - "metadata": {} - } - }, - "Referral Code": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_p6hPsnZj2VSvyXDjH9o6aQ==", - "order": { - "amount": 20000, - "discount_amount": 6000, - "total_discount_amount": 6000, - "total_amount": 14000, - "applied_discount_amount": 6000, - "total_applied_discount_amount": 6000, - "metadata": { - "currency": "USD" + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1700, + "price": 1700, + "subtotal_amount": 1700, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100 + }, + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1700 + } }, - "referrer": { - "id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "object": "customer" + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 5, + "discount_quantity": 5, + "initial_quantity": 1, + "amount": 7500, + "discount_amount": 7500, + "initial_amount": 1500, + "applied_discount_amount": 7500, + "price": 1500, + "subtotal_amount": 0, + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage", + "price": 1500 + } }, - "customer_id": null, - "referrer_id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "object": "order" - }, - "code": "REFERRAL-CODE-OxBakPYf", - "discount": { - "type": "PERCENT", - "effect": "APPLY_TO_ORDER", - "percent_off": 30 + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 60000, + "price": 60000, + "subtotal_amount": 60000, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "price": 60000 + } + } + ], + "metadata": { + "payment_mean": [ + "credit-card" + ] }, - "metadata": {}, - "campaign": "Referral Campaign", - "campaign_id": "camp_TnOf5NB4Jtjxwoq38WckMJfy" - } - } - } - } - } - }, - "400": { - "description": "Returns an error if request body is missing parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error" - }, - "examples": { - "Missing reward": { - "value": { - "code": 400, - "key": "missing_reward", - "message": "Missing reward", - "details": "A reward is required when redeeming a LOYALTY_CARD", - "request_id": "v-0bcb925c6d90f7f8fc", - "error": { - "message": "Missing reward = please add one." - } - } - }, - "Missing Parameter": { - "value": { - "code": 400, - "key": "missing_order_items_amount", - "message": "Missing applicable order items", - "details": "At least one applicable order item with amount is required to redeem this GIFT_VOUCHER", - "request_id": "v-0bcccfd04085cf2540", - "error": { - "message": "Request should contain an amount for the item." + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "id": "promo_R50x0A66V6jmPhM7YYOcFZfL", + "name": "Add missing order items", + "banner": "Add Boho Vintage", + "discount": { + "type": "UNIT", + "effect": "ADD_MISSING_ITEMS", + "unit_off": 5, + "unit_type": "prod_0b72b0bd64d198e3ae", + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage" } - } - }, - "Metadata Validation Failed": { - "value": { - "code": 400, - "key": "metadata_validation_failed", - "message": "Metadata validation failed", - "details": "location_id: must be an array, and every element: must be a string, must be equal to one of L1,L2,L3 (actual value is 'L1')", - "request_id": "v-0bcced27715305d3fa" - } - } - } - } - } - } - } - } - }, - "/client/v1/validate": { - "get": { - "operationId": "validate-voucher-client-side", - "deprecated": true, - "tags": [ - "VALIDATIONS API" - ], - "summary": "Validate Voucher (client-side) [Deprecated]", - "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for voucher validation, and we do not recommend using it. The new [Stackable Discounts API](ref:validate-stacked-discounts-client-side) 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. \n\nTo verify a voucher code given by customer, you can use this method. It is designed for client side integration which means that is accessible only through public keys. This method is designed to be run directly either in web browsers or mobile apps.\n\n> ❗️ Specifying gift credits and loyalty points\n>\n> This endpoint does not support specifying the specific amount of gift credits to apply to an order nor the specific amount of loyalty points to an order. It calculates the amount that is available on the card and applies as much credits or points as possible to cover the total amount. \n\n### Set customer identity (optional)\n\nVoucherify can help you track anonymous customers. Once you integrate Voucherify into your web app and call the validate method, Voucherify will return a tracking ID and the script will store it in a cookie. Each subsequent validate call will use the same tracking ID.\n\nVoucherify tracks a user using a tracking ID to see if the user who is validating vouchers is the same as the one who consuming them. Voucherify does this by setting up an identity for the user. A `tracking_id` will be generated on the server side, unless you specify your own `tracking_id`. In both cases, you will receive the `tracking_id` in the validation response.\n\nThe returned `tracking_id` field should be used as the customer `source_id` in subsequent redemption requests. Moreover, the `tracking_id` returned from Validation API is encoded. Voucherify will recognize both values for identifying customer - the one before encryption sent as a query parameter to the **GET** `/validate` request, and the version encrypted and returned as part of the validation request.\n\n### Sample workflow\n\nCustomer tracking workflow in a nutshell:\n\n**Client-side:**\n * A customer visits your website.\n * A customer validates a voucher code. That triggers a validate request to be sent to Voucherify. In the request, you pass the tracking_id or customer.source_id. As a result, the API call to this endpoint returns an **encoded** `tracking_id`.\n\n**Backend:**\n * Once the customer finishes the checkout process, your website passes the `tracking_id` to your backend during a redemption call. The `tracking_id` is sent as a value assigned to the property *source_id* in a customer object.\n * A customer object is created and within the redemption response, you get a customer `id`.\n * You can use the customer `id` or the customer `source_id` to fetch or modify the customer details.\n \nA customer is created (upserted) automatically with a redemption call. Alternatively, you can create a new profile by creating a customer via a dedicated API method. Take a look at the customer object to understand the [entity's structure](ref:get-customer). \n\n\n\n> 📘 Customer identifier\n>\n> The source id of the customer may either be an already hashed version of the `tracking_id`, which you received in a response from a validation request or a custom ID you predefined (i.e. an email address). Nevertheless, we recommend using identifiers delivered by Voucherify API.\n\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -H \"origin: yourdomain.com\" \\\n 'https://api.voucherify.io/client/v1/validate?code=PAYINEUROS&session_type=LOCK&session_key=A&session_ttl=1&session_ttl_unit=NANOSECONDS&customer=cust_4vMj8Twr5nBzvTrNCgipMb6M&[order][metadata][currency]=EUR&[metadata][location_id][0]=L1&[item][0][source_id]=webinar_BF_sweater_pink_sweater&[item][0][quantity]=2&[item][0][related_object]=product'\n```\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -H \"origin: yourdomain.com\" \\\n 'https://api.voucherify.io/client/v1/validate?code=LOYALTY-CARD-ng3Kb9tM&session_type=LOCK&session_key=A&session_ttl=1&session_ttl_unit=NANOSECONDS&customer[source_id]=286401dc-6f4c-4ebb-8ca2-9f78b3e84c7d&[order][metadata][currency]=EUR&[customer][metadata][age]=24&[customer][metadata][acquisition_channel]=Facebook&[metadata][location_id][0]=L1&[item][0][source_id]=webinar_BF_sweater_pink_sweater&[item][0][quantity]=2&[item][0][related_object]=product&[item][1][source_id]=webinar_BF_pants_gray_sweat_pants&[item][1][quantity]=2&[item][1][related_object]=product&[item][2][product_id]=prod_0bd76bb4aa003890cb&[item][2][quantity]=2&[item][3][source_id]=M0E20000000ELDH&[item][3][quantity]=3&[item][3][related_object]=sku'\n```\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -H \"origin: yourdomain.com\" \\\n 'https://api.voucherify.io/client/v1/validate?code=GIFT-CARD-kW4aEsfB&session_type=LOCK&session_key=A&session_ttl=1&session_ttl_unit=NANOSECONDS&customer[source_id]=286401dc-6f4c-4ebb-8ca2-9f78b3e84c7d&[order][metadata][currency]=EUR&[customer][metadata][age]=24&[customer][metadata][acquisition_channel]=Facebook&[metadata][location_id][0]=L1&[item][0][source_id]=webinar_BF_sweater_pink_sweater&[item][0][quantity]=2&[item][0][related_object]=product&[item][1][source_id]=webinar_BF_pants_gray_sweat_pants&[item][1][quantity]=2&[item][1][related_object]=product&[item][2][product_id]=prod_0bd76bb4aa003890cb&[item][2][quantity]=2&[item][3][source_id]=M0E20000000ELDH&[item][3][quantity]=3&[item][3][related_object]=sku&[item][4][sku_id]=sku_0b661e41fc0d35a8f1&[item][4][quantity]=4'\n```\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -H \"origin: yourdomain.com\" \\\n 'https://api.voucherify.io/client/v1/validate?code=REFERRAL-CODE-OxBakPYf&amount=10000'\n```\n\n### [JSFiddle Example](https://jsfiddle.net/voucherify/gfu2bgn5/)\n\n```javascript\n\n\n\n```\n\n### Examples with Query Parameters\n\n| **Query Parameters** | **Example URL** |\n|:---|:---|\n| Shortcut - `customer` query param instead of `customer[source_id]` | `https://api.voucherify.io/client/v1/validate?code=sKKFCKLZ&amount=10100&customer=customer_id` |\n| Pass `customer`'s and `redemption`'s context `metadata` in query parameters | `https://api.voucherify.io/client/v1/validate?code=sKKFCKLZ&amount=10100&customer=sure_he_is_new&metadata[shop]=1&customer[metadata][propsy]=2&metadata[test]=true` |\n| Use `tracking_id` instead of `source_id` | `https://api.voucherify.io/client/v1/validate?code=IKU-mvS-JOG&amount=10100&tracking_id=sure_he_is_new_5&metadata[shop]=1&metadata[test]=true` |\n\n### Reasons why a validation might fail\n\nVoucher validation might fail because of one of these reasons:\n\n* `voucher not found` - voucher doesn't exist or was [deleted](ref:delete-voucher)\n* `voucher expired` - voucher is out of [start date - expiration date] timeframe\n* `voucher is disabled` - learn more about [disabled vouchers](ref:disable-voucher)\n* `customer does not match segment rules` - learn more customer tracking LINK\n* `order does not match validation rules` - learn more about validation rules LINK", - "parameters": [ - { - "$ref": "#/components/parameters/origin" - }, - { - "schema": { - "type": "string", - "example": "7fjWdr" - }, - "in": "query", - "name": "code", - "description": "A code that identifies the voucher." - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "tracking_id", - "description": "A tracking identifier of a user that validated the voucher. This identifier is generated during voucher validation based on your internal ID (e.g., email, database ID) during the first request. This is a hashed customer source ID. If the request is performed for the first time, pass the internal ID to track the customer. **Although not all information is required, the extra information helps prevent fraud.**" - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "amount", - "description": "A positive integer in the smallest currency unit (that is, 100 cents for $1.00) representing the total amount of the order. This amount is the sum of the order items' amounts." - }, - { - "schema": { - "type": "string", - "example": "ssn_yQGMTeKBSw8OOuFPwlBEjzGy8d8VA9Ts" - }, - "in": "query", - "name": "session_key", - "description": "The session unique ID assigned by Voucherify or your own unique session ID. Sending an existing ID will result in overwriting an existing session. If no session key is provided, then a new ID will be generated." - }, - { - "schema": { - "type": "integer" - }, - "in": "query", - "name": "session_ttl", - "description": "Value for the period of time that the session is active. Units for this parameter are defined by the `session_ttl_unit` parameter." - }, - { - "schema": { - "type": "string", - "enum": [ - "HOURS", - "DAYS", - "MINUTES", - "SECONDS", - "MILLISECONDS", - "MICROSECONDS", - "NANOSECONDS" - ] - }, - "in": "query", - "name": "session_ttl_unit", - "description": "Defines the type of unit in which the session time is counted." - }, - { - "$ref": "#/components/parameters/metadata" - }, - { - "$ref": "#/components/parameters/item" - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "session_type", - "description": "The session is required to establish a session between multiple parallel validation and redemption requests. This parameter is required to establish a new session. The session locks the **redemption quantity by 1** and additionally the redemption **gift credits** specified within the request for a gift card and the **loyalty points** for a loyalty card." - }, - { - "name": "customer", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "type": "object", - "title": "Customer details", - "description": "Customer source ID and/or customer metadata.", - "properties": { - "source_id": { - "type": "string", - "description": "Customer source ID.", - "example": "name.lastname@email.com" }, - "metadata": { - "type": "object", - "description": "A set of custom key/value pairs that you can attach to a customer. The metadata object stores all custom attributes assigned to the customer. It can be useful for storing additional information about the customer in a structured format. This metadata can be used for validating whether the customer qualifies for a discount or it can be used in building customer segments.", - "style": "deepObject", - "explode": true - } - }, - "style": "deepObject", - "explode": true - }, - { - "type": "string", - "title": "Customer ID", - "description": "Unique customer ID assigned by Voucherify, i.e. `cust_eWgXlBBiY6THFRJwX45Iakv4`.", - "example": "cust_eWgXlBBiY6THFRJwX45Iakv4" - } - ] - }, - "description": "Customer details." - }, - { - "name": "order", - "in": "query", - "required": false, - "schema": { - "type": "object", - "title": "Order details", - "description": "Order details.", - "properties": { - "metadata": { - "type": "object", - "description": "The metadata object stores all custom attributes assigned to the order. A set of key/value pairs that are attached to an order object. Stores additional information about the order in a structured format.", - "style": "deepObject", - "explode": true - } - }, - "style": "deepObject", - "explode": true - }, - "description": "Order details." - } - ], - "security": [ - { - "X-Client-Application-Id-1": [], - "X-Client-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns information whether the voucher is valid in the context of the parameter values provided in the query parameters. Moreover, it returns a hashed source identifier which can be used as tracking ID in future calls. If a validation session is established, then the session details will be returned as well. Read more on [validation sessions](doc:locking-validation-session).", - "content": { - "application/json": { - "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/6_res_validate_voucher" + "campaign": { + "id": "camp_40LC42P5NFbkkD4RWoJ4btks", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" }, - { - "$ref": "#/components/schemas/6_res_validate_voucher_false" - } - ] - }, - "examples": { - "Wrong customer": { - "value": { - "valid": false, - "reason": "customer does not match validation rules", - "error": { - "message": "Only the gift card owner can apply credits from the gift card to the order." - }, - "tracking_id": "track_0nmdnu/6xIb6NTN0Ea40oFmM4wD5QYlxAgKdSn6wh+o", - "code": "GIFT-CARD-kW4aEsfB", - "metadata": {} - } - }, - "Validation Rule Not Satisfied": { - "value": { - "valid": false, - "reason": "redemption does not match validation rules", - "error": { - "code": 400, - "key": "redemption_rules_violated", - "message": "redemption does not match validation rules", - "details": "Discount Coupon cannot be redeemed because of violated validation rules: val_WuupvE7OVXyo", - "request_id": "v-0be54f4afa0357c12f" - }, - "tracking_id": "track_0nmdnu/6xIb6NTN0Ea40oFmM4wD5QYlxAgKdSn6wh+oychk", - "code": "PAYINEUROS", - "metadata": { - "shoutout": "Pay in euros to get 10 Euros off, any other currency to get 5 off in that currency." - } - } + "hierarchy": 1, + "discount_amount": 7500, + "applied_discount_amount": 7500, + "metadata": {}, + "object": "promotion_tier" }, - "Validate Discount Coupon": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_rynPcKGW2z7+kd2Vry4p12+Rx2NtyXZyiApdGWEXPrdX+44Fg6LRBQ==", - "session": { - "key": "A", - "type": "LOCK", - "ttl": 1, - "ttl_unit": "NANOSECONDS" - }, - "order": { - "amount": 13000, - "discount_amount": 1000, - "total_discount_amount": 1000, - "total_amount": 12000, - "applied_discount_amount": 1000, - "total_applied_discount_amount": 1000, - "items": [ - { - "object": "order_item", - "source_id": "webinar_BF_sweater_pink_sweater", - "related_object": "product", - "quantity": 2, - "amount": 13000, - "price": 6500, - "subtotal_amount": 13000, - "product": { - "id": "prod_0bd76ca337954ca116", - "source_id": "webinar_BF_sweater_pink_sweater", - "name": "Pink Sweater", - "price": 6500 - } + { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", + "order": { + "amount": 72100, + "total_amount": 72100, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 } - ], - "metadata": { - "currency": "EUR" }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "code": "PAYINEUROS", - "discount": { - "type": "AMOUNT", - "effect": "APPLY_TO_ORDER", - "amount_off": 1000 - }, - "metadata": { - "shoutout": "Pay in euros to get 10 Euros off, any other currency to get 5 off in that currency." - } - } - }, - "Validate Loyalty Card": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", - "session": { - "key": "A", - "type": "LOCK", - "ttl": 1, - "ttl_unit": "NANOSECONDS" - }, - "order": { - "amount": 121700, - "discount_amount": 5000, - "total_discount_amount": 5000, - "total_amount": 116700, - "applied_discount_amount": 5000, - "total_applied_discount_amount": 5000, - "items": [ - { - "object": "order_item", - "source_id": "webinar_BF_sweater_pink_sweater", - "related_object": "product", - "quantity": 2, - "amount": 13000, - "price": 6500, - "subtotal_amount": 13000, - "product": { - "id": "prod_0bd76ca337954ca116", - "source_id": "webinar_BF_sweater_pink_sweater", - "name": "Pink Sweater", - "price": 6500 - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "related_object": "product", - "quantity": 2, - "amount": 10000, - "price": 5000, - "subtotal_amount": 10000, - "product": { - "id": "prod_0bd76b8656956a183f", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "name": "Gray Sweat Pants", - "price": 5000 - } - }, - { - "object": "order_item", - "product_id": "prod_0bd76bb4aa003890cb", - "quantity": 2, - "amount": 9000, - "price": 4500, - "subtotal_amount": 9000, - "product": { - "id": "prod_0bd76bb4aa003890cb", - "source_id": "webinar_BF_pants_black_sweat_pants", - "name": "Black Sweat Pants", - "price": 4500 - } - }, - { - "object": "order_item", - "source_id": "M0E20000000ELDH", - "related_object": "sku", - "product_id": "prod_0b661d4bd2c7ec7d1f", - "quantity": 3, - "amount": 89700, - "price": 29900, - "subtotal_amount": 89700, - "product": { - "id": "prod_0b661d4bd2c7ec7d1f", - "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", - "name": "Casual jacket Michael Kors beige" - }, - "sku": { - "id": "sku_0b661e41fc8d35a8f8", - "source_id": "M0E20000000ELDH", - "sku": "Casual jacket Michael Kors beige", - "price": 29900 - } + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 1, + "amount": 3100, + "price": 3100, + "subtotal_amount": 3100, + "product": { + "id": "prod_0a9f9aeddb019a42db", + "name": "Blue T-Shirt", + "price": 3100 } - ], - "metadata": { - "currency": "EUR" }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "code": "LOYALTY-CARD-ng3Kb9tM", - "loyalty": { - "points_cost": 1000 - }, - "reward": { - "id": "rew_4ZF6Y69U2PXE3GLIZxfozgg1", - "assignment_id": "rewa_WkeBlLhj0sRae70J5AAvLbmy" - }, - "metadata": {}, - "campaign": "Loyalty Campaign", - "campaign_id": "camp_ZNb23Xtw1WuGCm7gdax84PUi" - } - }, - "Validate Gift Card": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==", - "session": { - "key": "A", - "type": "LOCK", - "ttl": 1, - "ttl_unit": "NANOSECONDS" - }, - "order": { - "amount": 165700, - "discount_amount": 21500, - "total_discount_amount": 21500, - "total_amount": 144200, - "applied_discount_amount": 21500, - "total_applied_discount_amount": 21500, - "items": [ - { - "object": "order_item", - "source_id": "webinar_BF_sweater_pink_sweater", - "related_object": "product", - "quantity": 2, - "amount": 13000, - "price": 6500, - "subtotal_amount": 13000, - "product": { - "id": "prod_0bd76ca337954ca116", - "source_id": "webinar_BF_sweater_pink_sweater", - "name": "Pink Sweater", - "price": 6500 - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "related_object": "product", - "quantity": 2, - "amount": 10000, - "price": 5000, - "subtotal_amount": 10000, - "product": { - "id": "prod_0bd76b8656956a183f", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "name": "Gray Sweat Pants", - "price": 5000 - } - }, - { - "object": "order_item", - "product_id": "prod_0bd76bb4aa003890cb", - "quantity": 2, - "amount": 9000, - "price": 4500, - "subtotal_amount": 9000, - "product": { - "id": "prod_0bd76bb4aa003890cb", - "source_id": "webinar_BF_pants_black_sweat_pants", - "name": "Black Sweat Pants", - "price": 4500 - } - }, - { - "object": "order_item", - "source_id": "M0E20000000ELDH", - "related_object": "sku", - "product_id": "prod_0b661d4bd2c7ec7d1f", - "quantity": 3, - "amount": 89700, - "price": 29900, - "subtotal_amount": 89700, - "product": { - "id": "prod_0b661d4bd2c7ec7d1f", - "source_id": "facdc58f-ff7c-40c4-a22f-ab0a084a9107", - "name": "Casual jacket Michael Kors beige" - }, - "sku": { - "id": "sku_0b661e41fc8d35a8f8", - "source_id": "M0E20000000ELDH", - "sku": "Casual jacket Michael Kors beige", - "price": 29900 - } + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1700, + "price": 1700, + "subtotal_amount": 1700, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100 }, - { - "object": "order_item", - "product_id": "prod_0b661d4bd347ec7d26", - "sku_id": "sku_0b661e41fc0d35a8f1", - "quantity": 4, - "amount": 44000, - "price": 11000, - "subtotal_amount": 44000, - "product": { - "id": "prod_0b661d4bd347ec7d26", - "source_id": "975193eb-1911-444a-a0f0-f567efce1a8b", - "name": "Pumps ”Flex” Michael Kors black" - }, - "sku": { - "id": "sku_0b661e41fc0d35a8f1", - "source_id": "M0E20000000DMVX", - "sku": "Pumps ”Flex” Michael Kors black", - "price": 11000 - } + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1700 } - ], - "metadata": { - "currency": "EUR" }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "code": "GIFT-CARD-kW4aEsfB", - "gift": { - "amount": 32000, - "balance": 21500, - "effect": "APPLY_TO_ORDER" - }, - "metadata": {}, - "campaign": "Gift Card Campaign", - "campaign_id": "camp_ZjoZEdmnyUCPYwMPN0IVbvDK" - } - }, - "Validate Referral Code": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_p6hPsnZj2VSvyXDjH9o6aQ==", - "order": { - "amount": 10000, - "discount_amount": 3000, - "total_discount_amount": 3000, - "total_amount": 7000, - "applied_discount_amount": 3000, - "total_applied_discount_amount": 3000, - "items": [], - "metadata": {}, - "referrer": { - "id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "object": "customer" + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 1, + "amount": 1500, + "price": 1500, + "subtotal_amount": 1500, + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage", + "price": 1500 + } }, - "customer_id": null, - "referrer_id": "cust_nM4jqPiaXUvQdVSA6vTRUnix", - "object": "order" - }, - "code": "REFERRAL-CODE-OxBakPYf", - "discount": { - "type": "PERCENT", - "effect": "APPLY_TO_ORDER", - "percent_off": 30 - }, - "metadata": {}, - "campaign": "Referral Campaign", - "campaign_id": "camp_TnOf5NB4Jtjxwoq38WckMJfy" - } - } - } - } - } - }, - "400": { - "description": "Returns an error if missing required parameters or tracking IDs come from the same origin.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Missing customer": { - "value": { - "code": 400, - "key": "missing_customer", - "message": "Missing customer", - "details": "Customer is required to validate rules", - "request_id": "v-0be548ae620abb0a73" - } - }, - "Ambiguous tracking ID": { - "value": { - "code": 400, - "key": "ambiguous_tracking_id", - "message": "Ambiguous trackingId ('track_0nmdnu/6xIb6NTN0Ea40oFmM4wD5QYlxAgKdSn6wh+oychkbEcMNB5RhcTj+zcKBEcGnUZkAXxg=' vs. 'track_Mcg5qK0jIStHAopLoM+nM6ua9crMFQrLt+qSe2YCbmTrTT8932kSlg==')", - "details": "The customer cannot be identified as two different identifiers have been used between requests from same origin.", - "request_id": "v-0be550a5a84abb30f8" - } - } - } - } - } - } - } - } - }, - "/v1/promotions/validation": { - "post": { - "operationId": "validate-promotions", - "deprecated": true, - "tags": [ - "VALIDATIONS API" - ], - "summary": "Validate Promotions [Deprecated]", - "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for qualification, and we do not recommend using it. The new [Qualifications API](ref:examine-qualification) introduces additional features and improvements while maintaining backward compatibility. 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. \n\nUse this method to get valid promotions for a given customer and order.\n\n### Advanced validation filters\n\nYou can narrow down a validation to a specific promotion ID or tier metadata. Here are the examples of filtering queries you can use:\n\n| **Filter** | **Example** |\n|:---|:---|\n| promotion_id | [filters][promotion_id][conditions][$is]={{campaign_id}} |\n| tier metadata | [filters][metadata.{{promotion tier metadata key}}][conditions][$is]={{promotion tier metadata value}} |\n\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"customer\": {\n \"id\": \"cust_gN9KgORZECfdhG9qT6n82Zr7\"\n },\n \"order\": {\n \"items\": [\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9aeddb019a42db\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": \"1\"\n },\n {\n \"sku_id\": \"sku_0b7d7dfb090be5c619\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b72b0bd64d198e3ae\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b7d7c4e814be5c502\",\n \"quantity\": 1\n }\n ],\n \"metadata\":{\n \"payment_mean\": [\"credit-card\"]\n }\n },\n \"options\": {\n \"expand\": [\n \"category\"\n ]\n }\n }'/\n 'https://api.voucherify.io/v1/promotions/validation?audienceRulesOnly=true'\n```\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -d `{\n \"customer\": {\n \"id\": \"cust_gN9KgORZECfdhG9qT6n82Zr7\"\n },\n \"order\": {\n \"items\": [\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9aeddb019a42db\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": \"1\"\n },\n {\n \"sku_id\": \"sku_0b7d7dfb090be5c619\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b72b0bd64d198e3ae\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b7d7c4e814be5c502\",\n \"quantity\": 1\n }\n ],\n \"metadata\":{\n \"payment_mean\": [\"credit-card\"]\n }\n },\n \"options\": {\n \"expand\": [\n \"category\"\n ]\n },\n \"metadata\": {\n \"store_names\": \"Store 1 - New York - Broadway\"\n }\n }`\\\n 'https://api.voucherify.io/v1/promotions/validation?[filters][promotion_id][conditions][$is]=camp_nYcAyjFXmEaBU0nB7EQ4hVTr'\n```\n\n```cURL\ncurl -X GET \\\n -H \"X-Client-Application-Id: 011240bf-d5fc-4ef1-9e82-11eb68c43bf5\" \\\n -H \"X-Client-Token: 9e2230c5-71fb-460a-91c6-fbee64707a20\" \\\n -H \"Content-Type: application/json\" \\\n -d `{\n \"customer\": {\n \"id\": \"cust_gN9KgORZECfdhG9qT6n82Zr7\"\n },\n \"order\": {\n \"items\": [\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9aeddb019a42db\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0a9f9ab4ab019a42d5\",\n \"quantity\": \"1\"\n },\n {\n \"sku_id\": \"sku_0b7d7dfb090be5c619\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b72b0bd64d198e3ae\",\n \"quantity\": 1\n },\n {\n \"product_id\": \"prod_0b7d7c4e814be5c502\",\n \"quantity\": 1\n }\n ],\n \"metadata\":{\n \"payment_mean\": [\"credit-card\"]\n }\n },\n \"options\": {\n \"expand\": [\n \"category\"\n ]\n }\n }`\\\n 'https://api.voucherify.io/v1/promotions/validation?[filters][metadata.has_budget][conditions][$is]=true'\n```", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "audienceRulesOnly", - "description": "If you add a query param AudienceRulesOnly=true, the request will be validated against customer-related rules only, the rest of attached limits and rules will be ignored." - }, - { - "name": "filters", - "in": "query", - "required": false, - "schema": { - "type": "object", - "title": "Promotion filters", - "description": "Promotion filter conditions.", - "properties": { - "metadata": { - "type": "object", - "description": "Allows you to create a filter based on the conditions set for promotion metadata values. The metadata object stores all custom attributes assigned to the promotion tier. A set of key/value pairs that are attached to a promotion tier object. Stores additional information about the promotion tier in a structured format.", - "style": "deepObject", - "explode": true - }, - "promotion_id": { - "type": "object", - "description": "Allows you to create a filter based on the unique promotion ID.", - "style": "deepObject", - "explode": true - } - }, - "style": "deepObject", - "explode": true - }, - "description": "Filter conditions." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Provide the customer and order context.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/6_req_validate_promotion" - }, - "examples": { - "Example": { - "value": { - "customer": { - "source_id": "source-id", + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 60000, + "price": 60000, + "subtotal_amount": 60000, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "price": 60000 + } + }, + { + "object": "order_item", + "product_id": "prod_5h1pp1ng", + "quantity": 1, + "discount_quantity": 1, + "initial_quantity": 0, + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping" + } + } + ], "metadata": { - "key": "value" + "payment_mean": [ + "credit-card" + ] + }, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "id": "promo_jp2l6wRcTL4cARG5E8XRo42A", + "name": "Get", + "banner": "Free shipping", + "discount": { + "type": "UNIT", + "effect": "ADD_MISSING_ITEMS", + "unit_off": 1, + "unit_type": "prod_5h1pp1ng", + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping" } }, - "options": { - "expand": [ - "category" - ] + "campaign": { + "id": "camp_wCEdu2igBcyv7CNna9ughGKc", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" }, - "order": { - "amount": 10000, - "items": [ + "hierarchy": 1, + "metadata": { + "has_budget": true, + "audience_restricted": false + }, + "object": "promotion_tier" + }, + { + "valid": true, + "applicable_to": { + "data": [ { - "product_id": "product-id", - "quantity": "1", - "price": 10000, - "related_object": "product", - "product": { - "metadata": { - "key": "value" - } - } + "object": "products_collection", + "id": "pc_a11pr0dUc75", + "strict": false, + "price": 800, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0a9f9ab4ab019a42d5", + "source_id": "prod_0a9f9ab4ab019a42d5", + "strict": true, + "price": 800, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0a9f9aeddb019a42db", + "source_id": "prod_0a9f9aeddb019a42db", + "strict": true, + "price": 800, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "sku", + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "product_id": "prod_0b7d7dfb05cbe5c616", + "product_source_id": "Books", + "strict": true, + "price": 800, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "strict": true, + "price": 800, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "strict": true, + "price": 800, + "effect": "APPLY_TO_EVERY" } - ] + ], + "total": 6, + "data_ref": "data", + "object": "list" }, - "metadata": { - "key": "value" - } - } - }, - "Customer Rules Only": { - "value": { - "customer": { - "id": "cust_gN9KgORZECfdhG9qT6n82Zr7" + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" }, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", "order": { + "amount": 72100, + "items_discount_amount": 67300, + "total_discount_amount": 67300, + "total_amount": 4800, + "items_applied_discount_amount": 67300, + "total_applied_discount_amount": 67300, "items": [ { + "object": "order_item", "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1 + "quantity": 1, + "amount": 2900, + "discount_amount": 2100, + "applied_discount_amount": 2100, + "price": 2900, + "subtotal_amount": 800, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } }, { + "object": "order_item", "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1 + "quantity": 1, + "amount": 3100, + "discount_amount": 2300, + "applied_discount_amount": 2300, + "price": 3100, + "subtotal_amount": 800, + "product": { + "id": "prod_0a9f9aeddb019a42db", + "name": "Blue T-Shirt", + "price": 3100 + } }, { + "object": "order_item", "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": "1" + "quantity": 1, + "amount": 2900, + "discount_amount": 2100, + "applied_discount_amount": 2100, + "price": 2900, + "subtotal_amount": 800, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } }, { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1 + "quantity": 1, + "amount": 1700, + "discount_amount": 900, + "applied_discount_amount": 900, + "price": 1700, + "subtotal_amount": 800, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100 + }, + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1700 + } }, { + "object": "order_item", "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1 + "quantity": 1, + "amount": 1500, + "discount_amount": 700, + "applied_discount_amount": 700, + "price": 1500, + "subtotal_amount": 800, + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage", + "price": 1500 + } }, { + "object": "order_item", "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1 + "quantity": 1, + "amount": 60000, + "discount_amount": 59200, + "applied_discount_amount": 59200, + "price": 60000, + "subtotal_amount": 800, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "price": 60000 + } } ], "metadata": { "payment_mean": [ "credit-card" ] - } + }, + "customer_id": null, + "referrer_id": null, + "object": "order" }, - "options": { - "expand": [ - "category" - ] - } + "id": "promo_WEloFBBJ8JJDCxrtR1FPy6t1", + "name": "Get Amount Off", + "banner": "Every product is worth 8", + "discount": { + "type": "FIXED", + "effect": "APPLY_TO_ITEMS" + }, + "campaign": { + "id": "camp_Ds2u0MSFGuKhDuR3jEa5dHBx", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "hierarchy": 2, + "discount_amount": 67300, + "applied_discount_amount": 67300, + "metadata": { + "has_budget": true, + "audience_restricted": false + }, + "object": "promotion_tier" } - }, - "Campaign Specific": { - "value": { - "customer": { - "source_id": "test-user@email.com" + ] + } + }, + "Campaign specific": { + "value": { + "valid": true, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", + "promotions": [ + { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" }, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", "order": { + "amount": 72100, + "discount_amount": 100, + "total_discount_amount": 100, + "total_amount": 72000, + "applied_discount_amount": 100, + "total_applied_discount_amount": 100, "items": [ { + "object": "order_item", "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1 + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } }, { + "object": "order_item", "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1 + "quantity": 1, + "amount": 3100, + "price": 3100, + "subtotal_amount": 3100, + "product": { + "id": "prod_0a9f9aeddb019a42db", + "name": "Blue T-Shirt", + "price": 3100 + } }, { + "object": "order_item", "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": "1" + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } }, { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1 + "quantity": 1, + "amount": 1700, + "price": 1700, + "subtotal_amount": 1700, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100 + }, + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1700 + } }, { + "object": "order_item", "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1 + "quantity": 1, + "amount": 1500, + "price": 1500, + "subtotal_amount": 1500, + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage", + "price": 1500 + } }, { + "object": "order_item", "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1 + "quantity": 1, + "amount": 60000, + "price": 60000, + "subtotal_amount": 60000, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "price": 60000 + } } ], "metadata": { "payment_mean": [ "credit-card" ] - } + }, + "customer_id": null, + "referrer_id": null, + "object": "order" }, - "options": { - "expand": [ - "category" - ] + "id": "promo_g83qUzYZpfX0OMAFOVoQuOYG", + "name": "1", + "discount": { + "type": "AMOUNT", + "effect": "APPLY_TO_ORDER", + "amount_off": 100 }, - "metadata": { - "store_names": "Store 1 - New York - Broadway" - } + "campaign": { + "id": "camp_nYcAyjFXmEaBU0nB7EQ4hVTr", + "start_date": null, + "expiration_date": null, + "active": true, + "categories": [ + { + "id": "cat_0b5f66bc97ce5be3c6", + "name": "Sixth", + "hierarchy": 6, + "created_at": "2022-07-13T08:27:14.926Z", + "object": "category" + } + ], + "object": "campaign" + }, + "hierarchy": 1, + "discount_amount": 100, + "applied_discount_amount": 100, + "metadata": {}, + "object": "promotion_tier" } - }, - "Promotion Tier Metadata": { - "value": { - "customer": { - "name": "Joe McDonald", - "email": "joey@email.com", - "source_id": "123_source_id" + ] + } + }, + "Promotion Tier Metadata": { + "value": { + "valid": true, + "tracking_id": "track_oNgl7cQ8tVTg/fIVul/GKA==", + "promotions": [ + { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" }, + "tracking_id": "track_oNgl7cQ8tVTg/fIVul/GKA==", "order": { + "amount": 72100, + "total_amount": 72100, "items": [ { + "object": "order_item", "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1 + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } }, { + "object": "order_item", "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1 + "quantity": 1, + "amount": 3100, + "price": 3100, + "subtotal_amount": 3100, + "product": { + "id": "prod_0a9f9aeddb019a42db", + "name": "Blue T-Shirt", + "price": 3100 + } }, { + "object": "order_item", "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": "1" + "quantity": 1, + "amount": 2900, + "price": 2900, + "subtotal_amount": 2900, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } }, { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1 + "quantity": 1, + "amount": 1700, + "price": 1700, + "subtotal_amount": 1700, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100 + }, + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1700 + } }, { + "object": "order_item", "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1 + "quantity": 1, + "amount": 1500, + "price": 1500, + "subtotal_amount": 1500, + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage", + "price": 1500 + } }, { + "object": "order_item", "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1 + "quantity": 1, + "amount": 60000, + "price": 60000, + "subtotal_amount": 60000, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "price": 60000 + } + }, + { + "object": "order_item", + "product_id": "prod_5h1pp1ng", + "quantity": 1, + "discount_quantity": 1, + "initial_quantity": 0, + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping" + } } ], "metadata": { "payment_mean": [ "credit-card" ] + }, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "id": "promo_jp2l6wRcTL4cARG5E8XRo42A", + "name": "Get", + "banner": "Free shipping", + "discount": { + "type": "UNIT", + "effect": "ADD_MISSING_ITEMS", + "unit_off": 1, + "unit_type": "prod_5h1pp1ng", + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping" } }, - "options": { - "expand": [ - "category" - ] - } - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns a list of valid promotions for a given context (customer and order). You can then choose which promotion to apply, i.e. the highest discount amount.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/6_res_validate_promotion" - }, - "examples": { - "Customer Rules Only": { - "value": { - "valid": true, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "promotions": [ + "campaign": { + "id": "camp_wCEdu2igBcyv7CNna9ughGKc", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "hierarchy": 1, + "metadata": { + "has_budget": true, + "audience_restricted": false + }, + "object": "promotion_tier" + }, + { + "valid": true, + "applicable_to": { + "data": [ { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "order": { - "amount": 9351000, - "initial_amount": 72100, - "items_discount_amount": 9340400, - "total_discount_amount": 9340400, - "total_amount": 10600, - "items_applied_discount_amount": 9340400, - "total_applied_discount_amount": 9340400, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1, - "amount": 3100, - "price": 3100, - "subtotal_amount": 3100, - "product": { - "id": "prod_0a9f9aeddb019a42db", - "name": "Blue T-Shirt", - "price": 3100 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 23, - "discount_quantity": 22, - "initial_quantity": 1, - "amount": 39100, - "discount_amount": 37400, - "initial_amount": 1700, - "applied_discount_amount": 37400, - "price": 1700, - "subtotal_amount": 1700, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100 - }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1700 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 222, - "discount_quantity": 222, - "initial_quantity": 1, - "amount": 333000, - "discount_amount": 333000, - "initial_amount": 1500, - "applied_discount_amount": 333000, - "price": 1500, - "subtotal_amount": 0, - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage", - "price": 1500 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 111, - "discount_quantity": 111, - "initial_quantity": 1, - "amount": 6660000, - "discount_amount": 6660000, - "initial_amount": 60000, - "applied_discount_amount": 6660000, - "price": 60000, - "subtotal_amount": 0, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "price": 60000 - } - }, - { - "object": "order_item", - "product_id": "prod_0bae2dc5a090fd0184", - "sku_id": "sku_0bae3b28f610fd0da1", - "quantity": 11, - "discount_quantity": 11, - "initial_quantity": 0, - "amount": 2310000, - "discount_amount": 2310000, - "initial_amount": 0, - "applied_discount_amount": 2310000, - "price": 210000, - "subtotal_amount": 0, - "product": { - "id": "prod_0bae2dc5a090fd0184", - "source_id": "first_product", - "name": "Samsung Phone 1", - "price": 220000 - }, - "sku": { - "id": "sku_0bae3b28f610fd0da1", - "source_id": "first_product_sku_1", - "sku": "Samsung phone 256GB", - "price": 210000 - } - } - ], - "metadata": { - "payment_mean": [ - "credit-card" - ] - }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "id": "promo_ByIIAHC1Mz9ouJsitzAWsush", - "name": "Multiple", - "discount": { - "type": "UNIT", - "effect": "ADD_MANY_ITEMS", - "units": [ - { - "effect": "ADD_MISSING_ITEMS", - "unit_off": 11, - "unit_type": "sku_0bae3b28f610fd0da1", - "sku": { - "id": "sku_0bae3b28f610fd0da1", - "source_id": "first_product_sku_1", - "sku": "Samsung phone 256GB" - }, - "product": { - "id": "prod_0bae2dc5a090fd0184", - "source_id": "first_product", - "name": "Samsung Phone 1" - } - }, - { - "effect": "ADD_NEW_ITEMS", - "unit_off": 22, - "unit_type": "sku_0b7d7dfb090be5c619", - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1" - }, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1" - } - }, - { - "effect": "ADD_MISSING_ITEMS", - "unit_off": 111, - "unit_type": "prod_0b7d7c4e814be5c502", - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12" - } - }, - { - "effect": "ADD_MISSING_ITEMS", - "unit_off": 222, - "unit_type": "prod_0b72b0bd64d198e3ae", - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage" - } - } - ] - }, - "campaign": { - "id": "camp_JtoaZ8Qgpf6FkMAy2wWiOJWH", - "start_date": null, - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "hierarchy": 1, - "discount_amount": 9340400, - "applied_discount_amount": 9340400, - "metadata": {}, - "object": "promotion_tier" + "object": "products_collection", + "id": "pc_a11pr0dUc75", + "strict": false, + "price": 800, + "effect": "APPLY_TO_EVERY" }, { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "order": { - "amount": 9522100, - "initial_amount": 72100, - "items_discount_amount": 9450000, - "total_discount_amount": 9450000, - "total_amount": 72100, - "items_applied_discount_amount": 9450000, - "total_applied_discount_amount": 9450000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1, - "amount": 3100, - "price": 3100, - "subtotal_amount": 3100, - "product": { - "id": "prod_0a9f9aeddb019a42db", - "name": "Blue T-Shirt", - "price": 3100 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1700, - "price": 1700, - "subtotal_amount": 1700, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100 - }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1700 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1, - "amount": 1500, - "price": 1500, - "subtotal_amount": 1500, - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage", - "price": 1500 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 60000, - "price": 60000, - "subtotal_amount": 60000, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "price": 60000 - } - }, - { - "object": "order_item", - "product_id": "prod_0bae2dc5a090fd0184", - "sku_id": "sku_0bae3b28f610fd0da1", - "quantity": 45, - "discount_quantity": 45, - "initial_quantity": 0, - "amount": 9450000, - "discount_amount": 9450000, - "initial_amount": 0, - "applied_discount_amount": 9450000, - "price": 210000, - "subtotal_amount": 0, - "product": { - "id": "prod_0bae2dc5a090fd0184", - "source_id": "first_product", - "name": "Samsung Phone 1", - "price": 220000 - }, - "sku": { - "id": "sku_0bae3b28f610fd0da1", - "source_id": "first_product_sku_1", - "sku": "Samsung phone 256GB", - "price": 210000 - } - } - ], - "metadata": { - "payment_mean": [ - "credit-card" - ] - }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "id": "promo_ZWkx6R0I1Ts3N9HL4kfTdxOm", - "name": "Add new SKU", - "discount": { - "type": "UNIT", - "effect": "ADD_NEW_ITEMS", - "unit_off": 45, - "unit_type": "sku_0bae3b28f610fd0da1", - "sku": { - "id": "sku_0bae3b28f610fd0da1", - "source_id": "first_product_sku_1", - "sku": "Samsung phone 256GB" - }, - "product": { - "id": "prod_0bae2dc5a090fd0184", - "source_id": "first_product", - "name": "Samsung Phone 1" - } - }, - "campaign": { - "id": "camp_40LC42P5NFbkkD4RWoJ4btks", - "start_date": null, - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "hierarchy": 4, - "discount_amount": 9450000, - "applied_discount_amount": 9450000, - "metadata": {}, - "object": "promotion_tier" + "object": "product", + "id": "prod_0a9f9ab4ab019a42d5", + "source_id": "prod_0a9f9ab4ab019a42d5", + "strict": true, + "price": 800, + "effect": "APPLY_TO_EVERY" }, { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "order": { - "amount": 109500, - "initial_amount": 72100, - "items_discount_amount": 39100, - "total_discount_amount": 39100, - "total_amount": 70400, - "items_applied_discount_amount": 39100, - "total_applied_discount_amount": 39100, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1, - "amount": 3100, - "price": 3100, - "subtotal_amount": 3100, - "product": { - "id": "prod_0a9f9aeddb019a42db", - "name": "Blue T-Shirt", - "price": 3100 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 23, - "discount_quantity": 23, - "initial_quantity": 1, - "amount": 39100, - "discount_amount": 39100, - "initial_amount": 1700, - "applied_discount_amount": 39100, - "price": 1700, - "subtotal_amount": 0, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100 - }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1700 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1, - "amount": 1500, - "price": 1500, - "subtotal_amount": 1500, - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage", - "price": 1500 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 60000, - "price": 60000, - "subtotal_amount": 60000, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "price": 60000 - } - } - ], - "metadata": { - "payment_mean": [ - "credit-card" - ] - }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "id": "promo_NcdD0zLo6FUhKWpNrNuP3Pte", - "name": "Add missing SKU", - "discount": { - "type": "UNIT", - "effect": "ADD_MISSING_ITEMS", - "unit_off": 23, - "unit_type": "sku_0b7d7dfb090be5c619", - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1" - }, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1" - } - }, - "campaign": { - "id": "camp_40LC42P5NFbkkD4RWoJ4btks", - "start_date": null, - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "hierarchy": 3, - "discount_amount": 39100, - "applied_discount_amount": 39100, - "metadata": {}, - "object": "promotion_tier" + "object": "product", + "id": "prod_0a9f9aeddb019a42db", + "source_id": "prod_0a9f9aeddb019a42db", + "strict": true, + "price": 800, + "effect": "APPLY_TO_EVERY" }, { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "order": { - "amount": 76100, - "initial_amount": 72100, - "items_discount_amount": 4000, - "total_discount_amount": 4000, - "total_amount": 72100, - "items_applied_discount_amount": 4000, - "total_applied_discount_amount": 4000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1, - "amount": 3100, - "price": 3100, - "subtotal_amount": 3100, - "product": { - "id": "prod_0a9f9aeddb019a42db", - "name": "Blue T-Shirt", - "price": 3100 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1700, - "price": 1700, - "subtotal_amount": 1700, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100 - }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1700 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1, - "amount": 1500, - "price": 1500, - "subtotal_amount": 1500, - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage", - "price": 1500 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 60000, - "price": 60000, - "subtotal_amount": 60000, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "price": 60000 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b00ffed198e344", - "quantity": 8, - "discount_quantity": 8, - "initial_quantity": 0, - "amount": 4000, - "discount_amount": 4000, - "initial_amount": 0, - "applied_discount_amount": 4000, - "price": 500, - "subtotal_amount": 0, - "product": { - "id": "prod_0b72b00ffed198e344", - "source_id": "roses_1", - "name": "Bouquet - Romantic Roses", - "price": 500 - } - } - ], - "metadata": { - "payment_mean": [ - "credit-card" - ] - }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "id": "promo_nGr1SWuy9vduABkbbJkl8cHb", - "name": "Add new order items", - "banner": "Add Romantic Roses", - "discount": { - "type": "UNIT", - "effect": "ADD_NEW_ITEMS", - "unit_off": 8, - "unit_type": "prod_0b72b00ffed198e344", - "product": { - "id": "prod_0b72b00ffed198e344", - "source_id": "roses_1", - "name": "Bouquet - Romantic Roses" - } - }, - "campaign": { - "id": "camp_40LC42P5NFbkkD4RWoJ4btks", - "start_date": null, - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "hierarchy": 2, - "discount_amount": 4000, - "applied_discount_amount": 4000, - "metadata": {}, - "object": "promotion_tier" + "object": "sku", + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "product_id": "prod_0b7d7dfb05cbe5c616", + "product_source_id": "Books", + "strict": true, + "price": 800, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "strict": true, + "price": 800, + "effect": "APPLY_TO_EVERY" }, { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "order": { - "amount": 78100, - "initial_amount": 72100, - "items_discount_amount": 7500, - "total_discount_amount": 7500, - "total_amount": 70600, - "items_applied_discount_amount": 7500, - "total_applied_discount_amount": 7500, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1, - "amount": 3100, - "price": 3100, - "subtotal_amount": 3100, - "product": { - "id": "prod_0a9f9aeddb019a42db", - "name": "Blue T-Shirt", - "price": 3100 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1700, - "price": 1700, - "subtotal_amount": 1700, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100 - }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1700 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 5, - "discount_quantity": 5, - "initial_quantity": 1, - "amount": 7500, - "discount_amount": 7500, - "initial_amount": 1500, - "applied_discount_amount": 7500, - "price": 1500, - "subtotal_amount": 0, - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage", - "price": 1500 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 60000, - "price": 60000, - "subtotal_amount": 60000, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "price": 60000 - } - } - ], - "metadata": { - "payment_mean": [ - "credit-card" - ] - }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "id": "promo_R50x0A66V6jmPhM7YYOcFZfL", - "name": "Add missing order items", - "banner": "Add Boho Vintage", - "discount": { - "type": "UNIT", - "effect": "ADD_MISSING_ITEMS", - "unit_off": 5, - "unit_type": "prod_0b72b0bd64d198e3ae", - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage" - } - }, - "campaign": { - "id": "camp_40LC42P5NFbkkD4RWoJ4btks", - "start_date": null, - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "hierarchy": 1, - "discount_amount": 7500, - "applied_discount_amount": 7500, - "metadata": {}, - "object": "promotion_tier" + "object": "product", + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "strict": true, + "price": 800, + "effect": "APPLY_TO_EVERY" + } + ], + "total": 6, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_oNgl7cQ8tVTg/fIVul/GKA==", + "order": { + "amount": 72100, + "items_discount_amount": 67300, + "total_discount_amount": 67300, + "total_amount": 4800, + "items_applied_discount_amount": 67300, + "total_applied_discount_amount": 67300, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "discount_amount": 2100, + "applied_discount_amount": 2100, + "price": 2900, + "subtotal_amount": 800, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } }, { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "order": { - "amount": 72100, - "total_amount": 72100, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1, - "amount": 3100, - "price": 3100, - "subtotal_amount": 3100, - "product": { - "id": "prod_0a9f9aeddb019a42db", - "name": "Blue T-Shirt", - "price": 3100 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1700, - "price": 1700, - "subtotal_amount": 1700, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100 - }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1700 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1, - "amount": 1500, - "price": 1500, - "subtotal_amount": 1500, - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage", - "price": 1500 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 60000, - "price": 60000, - "subtotal_amount": 60000, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "price": 60000 - } - }, - { - "object": "order_item", - "product_id": "prod_5h1pp1ng", - "quantity": 1, - "discount_quantity": 1, - "initial_quantity": 0, - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping" - } - } - ], - "metadata": { - "payment_mean": [ - "credit-card" - ] - }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "id": "promo_jp2l6wRcTL4cARG5E8XRo42A", - "name": "Get", - "banner": "Free shipping", - "discount": { - "type": "UNIT", - "effect": "ADD_MISSING_ITEMS", - "unit_off": 1, - "unit_type": "prod_5h1pp1ng", - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping" - } - }, - "campaign": { - "id": "camp_wCEdu2igBcyv7CNna9ughGKc", - "start_date": null, - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "hierarchy": 1, - "metadata": { - "has_budget": true, - "audience_restricted": false - }, - "object": "promotion_tier" + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 1, + "amount": 3100, + "discount_amount": 2300, + "applied_discount_amount": 2300, + "price": 3100, + "subtotal_amount": 800, + "product": { + "id": "prod_0a9f9aeddb019a42db", + "name": "Blue T-Shirt", + "price": 3100 + } }, { - "valid": true, - "applicable_to": { - "data": [ - { - "object": "products_collection", - "id": "pc_a11pr0dUc75", - "strict": false, - "price": 800, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0a9f9ab4ab019a42d5", - "source_id": "prod_0a9f9ab4ab019a42d5", - "strict": true, - "price": 800, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0a9f9aeddb019a42db", - "source_id": "prod_0a9f9aeddb019a42db", - "strict": true, - "price": 800, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "sku", - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "product_id": "prod_0b7d7dfb05cbe5c616", - "product_source_id": "Books", - "strict": true, - "price": 800, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "strict": true, - "price": 800, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "strict": true, - "price": 800, - "effect": "APPLY_TO_EVERY" - } - ], - "total": 6, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "order": { - "amount": 72100, - "items_discount_amount": 67300, - "total_discount_amount": 67300, - "total_amount": 4800, - "items_applied_discount_amount": 67300, - "total_applied_discount_amount": 67300, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "discount_amount": 2100, - "applied_discount_amount": 2100, - "price": 2900, - "subtotal_amount": 800, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1, - "amount": 3100, - "discount_amount": 2300, - "applied_discount_amount": 2300, - "price": 3100, - "subtotal_amount": 800, - "product": { - "id": "prod_0a9f9aeddb019a42db", - "name": "Blue T-Shirt", - "price": 3100 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "discount_amount": 2100, - "applied_discount_amount": 2100, - "price": 2900, - "subtotal_amount": 800, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1700, - "discount_amount": 900, - "applied_discount_amount": 900, - "price": 1700, - "subtotal_amount": 800, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100 - }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1700 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1, - "amount": 1500, - "discount_amount": 700, - "applied_discount_amount": 700, - "price": 1500, - "subtotal_amount": 800, - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage", - "price": 1500 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 60000, - "discount_amount": 59200, - "applied_discount_amount": 59200, - "price": 60000, - "subtotal_amount": 800, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "price": 60000 - } - } - ], - "metadata": { - "payment_mean": [ - "credit-card" - ] - }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "id": "promo_WEloFBBJ8JJDCxrtR1FPy6t1", - "name": "Get Amount Off", - "banner": "Every product is worth 8", - "discount": { - "type": "FIXED", - "effect": "APPLY_TO_ITEMS" - }, - "campaign": { - "id": "camp_Ds2u0MSFGuKhDuR3jEa5dHBx", - "start_date": null, - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "hierarchy": 2, - "discount_amount": 67300, - "applied_discount_amount": 67300, - "metadata": { - "has_budget": true, - "audience_restricted": false - }, - "object": "promotion_tier" - } - ] - } - }, - "Campaign specific": { - "value": { - "valid": true, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "promotions": [ + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 2900, + "discount_amount": 2100, + "applied_discount_amount": 2100, + "price": 2900, + "subtotal_amount": 800, + "product": { + "id": "prod_0a9f9ab4ab019a42d5", + "name": "Red T-Shirt", + "price": 2900 + } + }, { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "order": { - "amount": 72100, - "discount_amount": 100, - "total_discount_amount": 100, - "total_amount": 72000, - "applied_discount_amount": 100, - "total_applied_discount_amount": 100, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1, - "amount": 3100, - "price": 3100, - "subtotal_amount": 3100, - "product": { - "id": "prod_0a9f9aeddb019a42db", - "name": "Blue T-Shirt", - "price": 3100 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1700, - "price": 1700, - "subtotal_amount": 1700, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100 - }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1700 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1, - "amount": 1500, - "price": 1500, - "subtotal_amount": 1500, - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage", - "price": 1500 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 60000, - "price": 60000, - "subtotal_amount": 60000, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "price": 60000 - } - } - ], - "metadata": { - "payment_mean": [ - "credit-card" - ] - }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "id": "promo_g83qUzYZpfX0OMAFOVoQuOYG", - "name": "1", - "discount": { - "type": "AMOUNT", - "effect": "APPLY_TO_ORDER", - "amount_off": 100 - }, - "campaign": { - "id": "camp_nYcAyjFXmEaBU0nB7EQ4hVTr", - "start_date": null, - "expiration_date": null, - "active": true, - "categories": [ - { - "id": "cat_0b5f66bc97ce5be3c6", - "name": "Sixth", - "hierarchy": 6, - "created_at": "2022-07-13T08:27:14.926Z", - "object": "category" - } - ], - "object": "campaign" + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1700, + "discount_amount": 900, + "applied_discount_amount": 900, + "price": 1700, + "subtotal_amount": 800, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100 }, - "hierarchy": 1, - "discount_amount": 100, - "applied_discount_amount": 100, - "metadata": {}, - "object": "promotion_tier" - } - ] - } - }, - "Promotion Tier Metadata": { - "value": { - "valid": true, - "tracking_id": "track_oNgl7cQ8tVTg/fIVul/GKA==", - "promotions": [ + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1700 + } + }, { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_oNgl7cQ8tVTg/fIVul/GKA==", - "order": { - "amount": 72100, - "total_amount": 72100, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1, - "amount": 3100, - "price": 3100, - "subtotal_amount": 3100, - "product": { - "id": "prod_0a9f9aeddb019a42db", - "name": "Blue T-Shirt", - "price": 3100 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "price": 2900, - "subtotal_amount": 2900, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1700, - "price": 1700, - "subtotal_amount": 1700, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100 - }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1700 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1, - "amount": 1500, - "price": 1500, - "subtotal_amount": 1500, - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage", - "price": 1500 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 60000, - "price": 60000, - "subtotal_amount": 60000, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "price": 60000 - } - }, - { - "object": "order_item", - "product_id": "prod_5h1pp1ng", - "quantity": 1, - "discount_quantity": 1, - "initial_quantity": 0, - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping" - } - } - ], - "metadata": { - "payment_mean": [ - "credit-card" - ] - }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "id": "promo_jp2l6wRcTL4cARG5E8XRo42A", - "name": "Get", - "banner": "Free shipping", - "discount": { - "type": "UNIT", - "effect": "ADD_MISSING_ITEMS", - "unit_off": 1, - "unit_type": "prod_5h1pp1ng", - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping" - } - }, - "campaign": { - "id": "camp_wCEdu2igBcyv7CNna9ughGKc", - "start_date": null, - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "hierarchy": 1, - "metadata": { - "has_budget": true, - "audience_restricted": false - }, - "object": "promotion_tier" + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 1, + "amount": 1500, + "discount_amount": 700, + "applied_discount_amount": 700, + "price": 1500, + "subtotal_amount": 800, + "product": { + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage", + "price": 1500 + } }, { - "valid": true, - "applicable_to": { - "data": [ - { - "object": "products_collection", - "id": "pc_a11pr0dUc75", - "strict": false, - "price": 800, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0a9f9ab4ab019a42d5", - "source_id": "prod_0a9f9ab4ab019a42d5", - "strict": true, - "price": 800, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0a9f9aeddb019a42db", - "source_id": "prod_0a9f9aeddb019a42db", - "strict": true, - "price": 800, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "sku", - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "product_id": "prod_0b7d7dfb05cbe5c616", - "product_source_id": "Books", - "strict": true, - "price": 800, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "strict": true, - "price": 800, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "strict": true, - "price": 800, - "effect": "APPLY_TO_EVERY" - } - ], - "total": 6, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_oNgl7cQ8tVTg/fIVul/GKA==", - "order": { - "amount": 72100, - "items_discount_amount": 67300, - "total_discount_amount": 67300, - "total_amount": 4800, - "items_applied_discount_amount": 67300, - "total_applied_discount_amount": 67300, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "discount_amount": 2100, - "applied_discount_amount": 2100, - "price": 2900, - "subtotal_amount": 800, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 1, - "amount": 3100, - "discount_amount": 2300, - "applied_discount_amount": 2300, - "price": 3100, - "subtotal_amount": 800, - "product": { - "id": "prod_0a9f9aeddb019a42db", - "name": "Blue T-Shirt", - "price": 3100 - } - }, - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 2900, - "discount_amount": 2100, - "applied_discount_amount": 2100, - "price": 2900, - "subtotal_amount": 800, - "product": { - "id": "prod_0a9f9ab4ab019a42d5", - "name": "Red T-Shirt", - "price": 2900 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1700, - "discount_amount": 900, - "applied_discount_amount": 900, - "price": 1700, - "subtotal_amount": 800, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100 - }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1700 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1, - "amount": 1500, - "discount_amount": 700, - "applied_discount_amount": 700, - "price": 1500, - "subtotal_amount": 800, - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage", - "price": 1500 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 60000, - "discount_amount": 59200, - "applied_discount_amount": 59200, - "price": 60000, - "subtotal_amount": 800, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "price": 60000 - } - } - ], - "metadata": { - "payment_mean": [ - "credit-card" - ] - }, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "id": "promo_WEloFBBJ8JJDCxrtR1FPy6t1", - "name": "Get Amount Off", - "banner": "Every product is worth 8", - "discount": { - "type": "FIXED", - "effect": "APPLY_TO_ITEMS" - }, - "campaign": { - "id": "camp_Ds2u0MSFGuKhDuR3jEa5dHBx", - "start_date": null, - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "hierarchy": 2, - "discount_amount": 67300, - "applied_discount_amount": 67300, - "metadata": { - "has_budget": true, - "audience_restricted": false - }, - "object": "promotion_tier" + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 60000, + "discount_amount": 59200, + "applied_discount_amount": 59200, + "price": 60000, + "subtotal_amount": 800, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "price": 60000 + } } - ] - } + ], + "metadata": { + "payment_mean": [ + "credit-card" + ] + }, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "id": "promo_WEloFBBJ8JJDCxrtR1FPy6t1", + "name": "Get Amount Off", + "banner": "Every product is worth 8", + "discount": { + "type": "FIXED", + "effect": "APPLY_TO_ITEMS" + }, + "campaign": { + "id": "camp_Ds2u0MSFGuKhDuR3jEa5dHBx", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "hierarchy": 2, + "discount_amount": 67300, + "applied_discount_amount": 67300, + "metadata": { + "has_budget": true, + "audience_restricted": false + }, + "object": "promotion_tier" } - } + ] } } } } } + } + } + } + }, + "/v1/promotions/tiers/{tierId}/validation": { + "parameters": [ + { + "schema": { + "type": "string" }, - "/v1/promotions/tiers/{tierId}/validation": { - "parameters": [ - { - "schema": { - "type": "string" + "name": "tierId", + "in": "path", + "required": true, + "description": "Unique promotion tier ID." + } + ], + "post": { + "operationId": "validate-promotion-tier", + "deprecated": true, + "tags": [ + "VALIDATIONS API" + ], + "summary": "Validate Promotion Tier [Deprecated]", + "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for promotion tier redemption, and we do not recommend using it. The new [Stackable Discounts API](ref:redeem-stacked-discounts) 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. \n\nTo verify whether the promotion tier discount can be applied to an order. This method is designed for server side integration which means that it is accessible only through private keys.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Provide the customer and order context.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/6_req_validate_promotion_tier" + }, + "examples": { + "Using IDs": { + "value": { + "customer": { + "source_id": "test-user@email.io" + }, + "order": { + "id": "ord_71uW6qnB5CFZlLHCeCNC4qtS" + } + } }, - "name": "tierId", - "in": "path", - "required": true, - "description": "Unique promotion tier ID." - } - ], - "post": { - "operationId": "validate-promotion-tier", - "deprecated": true, - "tags": [ - "VALIDATIONS API" - ], - "summary": "Validate Promotion Tier [Deprecated]", - "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for promotion tier redemption, and we do not recommend using it. The new [Stackable Discounts API](ref:redeem-stacked-discounts) 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. \n\nTo verify whether the promotion tier discount can be applied to an order. This method is designed for server side integration which means that it is accessible only through private keys.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Provide the customer and order context.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/6_req_validate_promotion_tier" + "Using Redemption Metadata": { + "value": { + "customer": { + "source_id": "test-user@email.com" }, - "examples": { - "Using IDs": { - "value": { - "customer": { - "source_id": "test-user@email.io" - }, - "order": { - "id": "ord_71uW6qnB5CFZlLHCeCNC4qtS" - } - } - }, - "Using Redemption Metadata": { - "value": { - "customer": { - "source_id": "test-user@email.com" - }, - "order": { - "amount": 200000, - "items": [ - { - "product_id": "prod_anJ03RZZq74z4v", - "quantity": 2 - }, - { - "sku_id": "sku_0KtP4rvwEECQ2U", - "related_object": "sku", - "quantity": 1 - } - ] - }, - "metadata": { - "store_names": "Store 1 - New York - Broadway" - } + "order": { + "amount": 200000, + "items": [ + { + "product_id": "prod_anJ03RZZq74z4v", + "quantity": 2 + }, + { + "sku_id": "sku_0KtP4rvwEECQ2U", + "related_object": "sku", + "quantity": 1 } - } + ] + }, + "metadata": { + "store_names": "Store 1 - New York - Broadway" } } } - }, - "responses": { - "200": { - "description": "Returns validation result in `valid` key of the promotion tier object. Returns `true` if the promotion tier rules and validation rules are satisfied given the request body parameters. Returns `false` if the data provided in the payload does not meet validation rules or promotion tier requirements.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/6_res_validate_promotion_tier" - }, - "examples": { - "Promotion Valid": { - "value": { - "valid": true, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "tracking_id": "track_OWyBVb1mg1qnieLLNygh19A0Ia7FsJck", - "order": { - "id": "ord_71uW6qnB5CFZlLHCeCNC4qtS", - "source_id": null, - "created_at": "2022-11-17T12:17:55.096Z", - "updated_at": null, - "status": "CREATED", - "amount": 9918200, - "initial_amount": 468200, - "items_discount_amount": 9450000, - "total_discount_amount": 9450000, - "total_amount": 468200, - "items_applied_discount_amount": 9450000, - "total_applied_discount_amount": 9450000, - "items": [ - { - "object": "order_item", - "source_id": "webinar_BF_sweater_pink_sweater", - "related_object": "product", - "quantity": 1, - "amount": 6500, - "price": 6500, - "subtotal_amount": 6500 - }, - { - "object": "order_item", - "source_id": "webinar_BF_pants_navy_sweat_pants", - "related_object": "product", - "quantity": 1, - "amount": 6000, - "price": 6000, - "subtotal_amount": 6000 - }, - { - "object": "order_item", - "source_id": "5h1pp1ng", - "related_object": "product", - "quantity": 1, - "amount": 2000, - "price": 2000, - "subtotal_amount": 2000, - "product": { - "id": "prod_5h1pp1ng", - "source_id": "5h1pp1ng", - "name": "Shipping" - } - }, - { - "object": "order_item", - "source_id": "webinar_BF_pants_gray_sweat_pants", - "related_object": "product", - "quantity": 2, - "amount": 10000, - "price": 5000, - "subtotal_amount": 10000 - }, - { - "object": "order_item", - "source_id": "webinar_BF_sweater_pearl", - "related_object": "product", - "quantity": 2, - "amount": 22000, - "price": 11000, - "subtotal_amount": 22000 - }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1700, - "price": 1700, - "subtotal_amount": 1700, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100 - }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1700 - } - }, - { - "object": "order_item", - "product_id": "prod_0bae32322150fd0546", - "quantity": 2, - "amount": 420000, - "price": 210000, - "subtotal_amount": 420000, - "product": { - "id": "prod_0bae32322150fd0546", - "name": "Samsung Phone", - "price": 210000 - } - }, - { - "object": "order_item", - "product_id": "prod_0bae2dc5a090fd0184", - "sku_id": "sku_0bae3b28f610fd0da1", - "quantity": 45, - "discount_quantity": 45, - "initial_quantity": 0, - "amount": 9450000, - "discount_amount": 9450000, - "initial_amount": 0, - "applied_discount_amount": 9450000, - "price": 210000, - "subtotal_amount": 0, - "product": { - "id": "prod_0bae2dc5a090fd0184", - "source_id": "first_product", - "name": "Samsung Phone 1", - "price": 220000 - }, - "sku": { - "id": "sku_0bae3b28f610fd0da1", - "source_id": "first_product_sku_1", - "sku": "Samsung phone 256GB", - "price": 210000 - } - } - ], - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "id": "promo_ZWkx6R0I1Ts3N9HL4kfTdxOm", - "name": "Add new SKU", - "discount": { - "type": "UNIT", - "effect": "ADD_NEW_ITEMS", - "unit_off": 45, - "unit_type": "sku_0bae3b28f610fd0da1", - "sku": { - "id": "sku_0bae3b28f610fd0da1", - "source_id": "first_product_sku_1", - "sku": "Samsung phone 256GB" - }, - "product": { - "id": "prod_0bae2dc5a090fd0184", - "source_id": "first_product", - "name": "Samsung Phone 1" - } - }, - "campaign": { - "id": "camp_40LC42P5NFbkkD4RWoJ4btks", - "start_date": null, - "expiration_date": null, - "active": true, - "object": "campaign" + } + } + } + }, + "responses": { + "200": { + "description": "Returns validation result in `valid` key of the promotion tier object. Returns `true` if the promotion tier rules and validation rules are satisfied given the request body parameters. Returns `false` if the data provided in the payload does not meet validation rules or promotion tier requirements.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/6_res_validate_promotion_tier" + }, + "examples": { + "Promotion Valid": { + "value": { + "valid": true, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "tracking_id": "track_OWyBVb1mg1qnieLLNygh19A0Ia7FsJck", + "order": { + "id": "ord_71uW6qnB5CFZlLHCeCNC4qtS", + "source_id": null, + "created_at": "2022-11-17T12:17:55.096Z", + "updated_at": null, + "status": "CREATED", + "amount": 9918200, + "initial_amount": 468200, + "items_discount_amount": 9450000, + "total_discount_amount": 9450000, + "total_amount": 468200, + "items_applied_discount_amount": 9450000, + "total_applied_discount_amount": 9450000, + "items": [ + { + "object": "order_item", + "source_id": "webinar_BF_sweater_pink_sweater", + "related_object": "product", + "quantity": 1, + "amount": 6500, + "price": 6500, + "subtotal_amount": 6500 + }, + { + "object": "order_item", + "source_id": "webinar_BF_pants_navy_sweat_pants", + "related_object": "product", + "quantity": 1, + "amount": 6000, + "price": 6000, + "subtotal_amount": 6000 + }, + { + "object": "order_item", + "source_id": "5h1pp1ng", + "related_object": "product", + "quantity": 1, + "amount": 2000, + "price": 2000, + "subtotal_amount": 2000, + "product": { + "id": "prod_5h1pp1ng", + "source_id": "5h1pp1ng", + "name": "Shipping" + } + }, + { + "object": "order_item", + "source_id": "webinar_BF_pants_gray_sweat_pants", + "related_object": "product", + "quantity": 2, + "amount": 10000, + "price": 5000, + "subtotal_amount": 10000 + }, + { + "object": "order_item", + "source_id": "webinar_BF_sweater_pearl", + "related_object": "product", + "quantity": 2, + "amount": 22000, + "price": 11000, + "subtotal_amount": 22000 + }, + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1700, + "price": 1700, + "subtotal_amount": 1700, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100 }, - "hierarchy": 4, + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1700 + } + }, + { + "object": "order_item", + "product_id": "prod_0bae32322150fd0546", + "quantity": 2, + "amount": 420000, + "price": 210000, + "subtotal_amount": 420000, + "product": { + "id": "prod_0bae32322150fd0546", + "name": "Samsung Phone", + "price": 210000 + } + }, + { + "object": "order_item", + "product_id": "prod_0bae2dc5a090fd0184", + "sku_id": "sku_0bae3b28f610fd0da1", + "quantity": 45, + "discount_quantity": 45, + "initial_quantity": 0, + "amount": 9450000, "discount_amount": 9450000, + "initial_amount": 0, "applied_discount_amount": 9450000, - "metadata": {}, - "object": "promotion_tier" - } - }, - "Promotion Invalid with Error Message": { - "value": { - "valid": false, - "reason": "redemption does not match validation rules", - "error": { - "code": 400, - "key": "redemption_rules_violated", - "message": "redemption does not match validation rules", - "details": "Promotion Tier cannot be redeemed because of violated validation rules: val_eqSA1dXOv491", - "request_id": "v-0c034585fd16cf6958" - }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "id": "promo_R50x0A66V6jmPhM7YYOcFZfL", - "name": "Add missing order items", - "banner": "Add Boho Vintage", - "discount": { - "type": "UNIT", - "effect": "ADD_MISSING_ITEMS", - "unit_off": 5, - "unit_type": "prod_0b72b0bd64d198e3ae" - }, - "campaign": { - "id": "camp_40LC42P5NFbkkD4RWoJ4btks", - "start_date": null, - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "hierarchy": 1, - "metadata": { - "has_budget": true - }, - "object": "promotion_tier" + "price": 210000, + "subtotal_amount": 0, + "product": { + "id": "prod_0bae2dc5a090fd0184", + "source_id": "first_product", + "name": "Samsung Phone 1", + "price": 220000 + }, + "sku": { + "id": "sku_0bae3b28f610fd0da1", + "source_id": "first_product_sku_1", + "sku": "Samsung phone 256GB", + "price": 210000 + } } + ], + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "id": "promo_ZWkx6R0I1Ts3N9HL4kfTdxOm", + "name": "Add new SKU", + "discount": { + "type": "UNIT", + "effect": "ADD_NEW_ITEMS", + "unit_off": 45, + "unit_type": "sku_0bae3b28f610fd0da1", + "sku": { + "id": "sku_0bae3b28f610fd0da1", + "source_id": "first_product_sku_1", + "sku": "Samsung phone 256GB" }, - "Promotion Invalid with Custom Message": { - "value": { - "valid": false, - "reason": "Inactive Promotion", - "error": { - "message": "Promotion is inactive this weekend." - }, - "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", - "id": "promo_R50x0A66V6jmPhM7YYOcFZfL", - "name": "Add missing order items", - "banner": "Add Boho Vintage", - "discount": { - "type": "UNIT", - "effect": "ADD_MISSING_ITEMS", - "unit_off": 5, - "unit_type": "prod_0b72b0bd64d198e3ae" - }, - "campaign": { - "id": "camp_40LC42P5NFbkkD4RWoJ4btks", - "start_date": null, - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "hierarchy": 1, - "metadata": { - "has_budget": true - }, - "object": "promotion_tier" - } + "product": { + "id": "prod_0bae2dc5a090fd0184", + "source_id": "first_product", + "name": "Samsung Phone 1" } - } + }, + "campaign": { + "id": "camp_40LC42P5NFbkkD4RWoJ4btks", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "hierarchy": 4, + "discount_amount": 9450000, + "applied_discount_amount": 9450000, + "metadata": {}, + "object": "promotion_tier" + } + }, + "Promotion Invalid with Error Message": { + "value": { + "valid": false, + "reason": "redemption does not match validation rules", + "error": { + "code": 400, + "key": "redemption_rules_violated", + "message": "redemption does not match validation rules", + "details": "Promotion Tier cannot be redeemed because of violated validation rules: val_eqSA1dXOv491", + "request_id": "v-0c034585fd16cf6958" + }, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", + "id": "promo_R50x0A66V6jmPhM7YYOcFZfL", + "name": "Add missing order items", + "banner": "Add Boho Vintage", + "discount": { + "type": "UNIT", + "effect": "ADD_MISSING_ITEMS", + "unit_off": 5, + "unit_type": "prod_0b72b0bd64d198e3ae" + }, + "campaign": { + "id": "camp_40LC42P5NFbkkD4RWoJ4btks", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "hierarchy": 1, + "metadata": { + "has_budget": true + }, + "object": "promotion_tier" + } + }, + "Promotion Invalid with Custom Message": { + "value": { + "valid": false, + "reason": "Inactive Promotion", + "error": { + "message": "Promotion is inactive this weekend." + }, + "tracking_id": "track_OWyBVb1mg1oMY1lADmgwuXCw/qYHp5h0", + "id": "promo_R50x0A66V6jmPhM7YYOcFZfL", + "name": "Add missing order items", + "banner": "Add Boho Vintage", + "discount": { + "type": "UNIT", + "effect": "ADD_MISSING_ITEMS", + "unit_off": 5, + "unit_type": "prod_0b72b0bd64d198e3ae" + }, + "campaign": { + "id": "camp_40LC42P5NFbkkD4RWoJ4btks", + "start_date": null, + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "hierarchy": 1, + "metadata": { + "has_budget": true + }, + "object": "promotion_tier" } } } } } - }, - "/v1/redemption-object": { - "get": { - "operationId": "redemption-object", - "tags": [ - "REDEMPTIONS API" - ], - "summary": "Redemption Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Redemption Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/7_obj_redemption_object" - } - } - } + } + } + } + }, + "/v1/redemption-object": { + "get": { + "operationId": "redemption-object", + "tags": [ + "REDEMPTIONS API" + ], + "summary": "Redemption Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Redemption Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_obj_redemption_object" } } } - }, - "/v1/rollback-redemption-object": { - "get": { - "operationId": "rollback-redemption-object", - "tags": [ - "REDEMPTIONS API" - ], - "summary": "Rollback Redemption Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Rollback Redemption Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/7_obj_rollback_redemption_object_extended" - } - } - } + } + } + } + }, + "/v1/rollback-redemption-object": { + "get": { + "operationId": "rollback-redemption-object", + "tags": [ + "REDEMPTIONS API" + ], + "summary": "Rollback Redemption Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Rollback Redemption Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_obj_rollback_redemption_object_extended" } } } - }, - "/v1/stackable-redemptions-object": { - "get": { - "operationId": "stackable-redemptions-object", - "tags": [ - "STACKABLE DISCOUNTS API" - ], - "summary": "Stackable Redemptions Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Stackable Redemptions Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/19_res_redemptions_POST" - } - } - } + } + } + } + }, + "/v1/stackable-redemptions-object": { + "get": { + "operationId": "stackable-redemptions-object", + "tags": [ + "STACKABLE DISCOUNTS API" + ], + "summary": "Stackable Redemptions Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Stackable Redemptions Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/19_res_redemptions_POST" } } } + } + } + } + }, + "/v1/redemptions": { + "get": { + "operationId": "list-redemptions", + "tags": [ + "REDEMPTIONS API" + ], + "summary": "List Redemptions", + "description": "Returns a list of redemptions previously created. The redemptions are returned in a sorted order, with the most recent redemptions appearing first. The response returns a list of redemptions of all vouchers. \n\n## Filtering results\nThe result can be narrowed according to specified (or default) filters, for example, you can sort redemptions by date:\n`https://api.voucherify.io/v1/redemptions?limit=3&[created_at][before]=2017-09-08T13:52:18.227Z`. A filter based on the object `created_at` field narrows down the results and lists redemptions done before or after a particular date time. You can use the following options: `[created_at][after]`, `[created_at][before]`. A date value must be presented in ISO 8601 format (`2016-11-16T14:14:31Z` or `2016-11-16`). An example: `[created_at][before]=2017-09-08T13:52:18.227Z`.\n\n## Failed Redemptions\n\nA redemption may fail for various reasons. You can figure out an exact reason from the `failure_code`:\n- `resource_not_found` - voucher with given code does not exist\n- `voucher_not_active` - voucher is not active yet (before start date)\n- `voucher_expired` - voucher has already expired (after expiration date)\n- `voucher_disabled` - voucher has been disabled (`active: false`)\n- `quantity_exceeded` - voucher's redemptions limit has been exceeded\n- `gift_amount_exceeded` - gift amount has been exceeded\n- `customer_rules_violated` - customer did not match the segment\n- `order_rules_violated` - order did not match validation rules\n- `invalid_order` - order was specified incorrectly\n- `invalid_amount` - order amount was specified incorrectly\n- `missing_amount` - order amount was not specified\n- `missing_order_items` - order items were not specified\n- `missing_customer` - customer was not specified", + "parameters": [ + { + "$ref": "#/components/parameters/limit" }, - "/v1/redemptions": { - "get": { - "operationId": "list-redemptions", - "tags": [ - "REDEMPTIONS API" - ], - "summary": "List Redemptions", - "description": "Returns a list of redemptions previously created. The redemptions are returned in a sorted order, with the most recent redemptions appearing first. The response returns a list of redemptions of all vouchers. \n\n## Filtering results\nThe result can be narrowed according to specified (or default) filters, for example, you can sort redemptions by date:\n`https://api.voucherify.io/v1/redemptions?limit=3&[created_at][before]=2017-09-08T13:52:18.227Z`. A filter based on the object `created_at` field narrows down the results and lists redemptions done before or after a particular date time. You can use the following options: `[created_at][after]`, `[created_at][before]`. A date value must be presented in ISO 8601 format (`2016-11-16T14:14:31Z` or `2016-11-16`). An example: `[created_at][before]=2017-09-08T13:52:18.227Z`.\n\n## Failed Redemptions\n\nA redemption may fail for various reasons. You can figure out an exact reason from the `failure_code`:\n- `resource_not_found` - voucher with given code does not exist\n- `voucher_not_active` - voucher is not active yet (before start date)\n- `voucher_expired` - voucher has already expired (after expiration date)\n- `voucher_disabled` - voucher has been disabled (`active: false`)\n- `quantity_exceeded` - voucher's redemptions limit has been exceeded\n- `gift_amount_exceeded` - gift amount has been exceeded\n- `customer_rules_violated` - customer did not match the segment\n- `order_rules_violated` - order did not match validation rules\n- `invalid_order` - order was specified incorrectly\n- `invalid_amount` - order amount was specified incorrectly\n- `missing_amount` - order amount was not specified\n- `missing_order_items` - order items were not specified\n- `missing_customer` - customer was not specified", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "result", - "description": "A filter on the list based on the redemption result. Available options are: `SUCCESS`, `FAILURE`. You can provide multiple values by repeating the param." - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "campaign", - "description": "A filter by the campaign **name** that the redemption resources originate from." - }, - { - "schema": { - "type": "string", - "example": "cust_IkrTR674vvQvr9a4rDMiqglY" - }, - "in": "query", - "name": "customer", - "description": "Return redemptions performed by the customer with given `id`." - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "id", - "-id", - "voucher_code", - "-voucher_code", - "tracking_id", - "-tracking_id", - "customer_id", - "-customer_id" - ] - }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "result", + "description": "A filter on the list based on the redemption result. Available options are: `SUCCESS`, `FAILURE`. You can provide multiple values by repeating the param." + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "campaign", + "description": "A filter by the campaign **name** that the redemption resources originate from." + }, + { + "schema": { + "type": "string", + "example": "cust_IkrTR674vvQvr9a4rDMiqglY" + }, + "in": "query", + "name": "customer", + "description": "Return redemptions performed by the customer with given `id`." + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "id", + "-id", + "voucher_code", + "-voucher_code", + "tracking_id", + "-tracking_id", + "customer_id", + "-customer_id" + ] + }, + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." + }, + { + "$ref": "#/components/parameters/created_at" + }, + { + "name": "filters", + "in": "query", + "schema": { + "type": "object", + "properties": { + "voucher_code": { + "type": "object", + "description": "Unique voucher code.", + "style": "deepObject", + "explode": true, + "properties": { + "conditions": { + "$ref": "#/components/schemas/7_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } }, - { - "$ref": "#/components/parameters/created_at" + "related_object_id": { + "type": "object", + "description": "Unique related object ID, i.e. v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk.", + "style": "deepObject", + "explode": true, + "properties": { + "conditions": { + "$ref": "#/components/schemas/7_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } }, - { - "name": "filters", - "in": "query", - "schema": { - "type": "object", - "properties": { - "voucher_code": { - "type": "object", - "description": "Unique voucher code.", - "style": "deepObject", - "explode": true, - "properties": { - "conditions": { - "$ref": "#/components/schemas/7_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "related_object_id": { - "type": "object", - "description": "Unique related object ID, i.e. v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk.", - "style": "deepObject", - "explode": true, - "properties": { - "conditions": { - "$ref": "#/components/schemas/7_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "related_object_parent_id": { - "type": "object", - "description": "Unique related object parent ID, i.e. camp_22noMlhTADb7Fq2UL3vWu3d1.", - "style": "deepObject", - "explode": true, - "properties": { - "conditions": { - "$ref": "#/components/schemas/7_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "parent_redemption_id": { - "type": "object", - "description": "Unique parent redemption ID, i.e. r_0c5952900bcbfd54b6.", - "style": "deepObject", - "explode": true, - "properties": { - "conditions": { - "$ref": "#/components/schemas/7_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "failure_code": { - "type": "object", - "description": "Failure code, i.e. quantity_exceeded.", - "style": "deepObject", - "explode": true, - "properties": { - "conditions": { - "$ref": "#/components/schemas/7_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "result": { - "type": "object", - "description": "Result, i.e. `SUCCESS` or `FAILURE`.", - "style": "deepObject", - "explode": true, - "properties": { - "conditions": { - "$ref": "#/components/schemas/7_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "object": { - "type": "object", - "description": "Specify which type of object to return, i.e. `redemption` or `redemption_rollback`.", - "style": "deepObject", - "explode": true, - "properties": { - "conditions": { - "$ref": "#/components/schemas/7_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "customer_id": { - "type": "object", - "description": "Unique customer ID, i.e. cust_sehkNIi8Uq2qQuRqSr7xn4Zi.", - "style": "deepObject", - "explode": true, - "properties": { - "conditions": { - "$ref": "#/components/schemas/7_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "campaign_name": { - "type": "object", - "description": "Campaign name.", - "style": "deepObject", - "explode": true, - "properties": { - "conditions": { - "$ref": "#/components/schemas/7_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - }, - "user_login": { - "type": "object", - "description": "User login used to login to Voucherify, i.e. name.lastname@email.com", - "style": "deepObject", - "explode": true, - "properties": { - "conditions": { - "$ref": "#/components/schemas/7_filter_conditions_string" - }, - "junction": { - "$ref": "#/components/schemas/16_filter_junction" - } - } - } + "related_object_parent_id": { + "type": "object", + "description": "Unique related object parent ID, i.e. camp_22noMlhTADb7Fq2UL3vWu3d1.", + "style": "deepObject", + "explode": true, + "properties": { + "conditions": { + "$ref": "#/components/schemas/7_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "parent_redemption_id": { + "type": "object", + "description": "Unique parent redemption ID, i.e. r_0c5952900bcbfd54b6.", + "style": "deepObject", + "explode": true, + "properties": { + "conditions": { + "$ref": "#/components/schemas/7_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" } - }, - "description": "Filters for listing responses.", + } + }, + "failure_code": { + "type": "object", + "description": "Failure code, i.e. quantity_exceeded.", "style": "deepObject", - "explode": true - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a list of redemption objects. Each entry in the array is a separate redemption object. If no more redemptions are available, the resulting array will be empty. If you provide a non-existent customer ID, this call returns an empty object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/7_res_list_redemptions" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "redemptions", - "redemptions": [ - { - "id": "r_0c0469eaf705889d99", - "object": "redemption", - "date": "2022-11-18T12:30:32.622Z", - "customer_id": "cust_qBwHpagDOFu71Z3F22UzR80X", - "tracking_id": "track_5DQxXbK0C0pvAaHk7mnulhyMBo7VratI", - "metadata": { - "store_names": "Store 2 - Florida - Miami" - }, - "result": "SUCCESS", - "order": { - "id": "ord_ndw5rQJt12zvZ4upF72a3ljh", - "source_id": null, - "created_at": "2022-11-18T12:30:31.338Z", - "updated_at": null, - "status": "PAID", - "amount": 9680000, - "items_discount_amount": 9450000, - "total_discount_amount": 9450000, - "total_amount": 230000, - "items_applied_discount_amount": 9450000, - "total_applied_discount_amount": 9450000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0bae45ffc7003ffc52", - "quantity": 1, - "amount": 230000, - "price": 230000, - "subtotal_amount": 230000, - "product": { - "id": "prod_0bae45ffc7003ffc52", - "source_id": "second_product", - "name": "Samsung Phone 2", - "price": 230000 - } - }, - { - "object": "order_item", - "product_id": "prod_0bae2dc5a090fd0184", - "sku_id": "sku_0bae3b28f610fd0da1", - "quantity": 45, - "discount_quantity": 45, - "initial_quantity": 0, - "amount": 9450000, - "discount_amount": 9450000, - "initial_amount": 0, - "applied_discount_amount": 9450000, - "price": 210000, - "subtotal_amount": 0, - "product": { - "id": "prod_0bae2dc5a090fd0184", - "source_id": "first_product", - "name": "Samsung Phone 1", - "price": 220000 - }, - "sku": { - "id": "sku_0bae3b28f610fd0da1", - "source_id": "first_product_sku_1", - "sku": "Samsung phone 256GB", - "price": 210000 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_qBwHpagDOFu71Z3F22UzR80X", - "object": "customer" - }, - "customer_id": "cust_qBwHpagDOFu71Z3F22UzR80X", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c0469eaf705889d99": { - "date": "2022-11-18T12:30:31.388Z", - "related_object_type": "promotion_tier", - "related_object_id": "promo_ZWkx6R0I1Ts3N9HL4kfTdxOm", - "related_object_parent_id": "camp_40LC42P5NFbkkD4RWoJ4btks" - } - } - }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_qBwHpagDOFu71Z3F22UzR80X", - "name": "Bob Jones", - "email": "bob.smith@email.com", - "source_id": "pub_source_customer_5_a", - "metadata": { - "lang": "en", - "test": true - }, - "object": "customer" - }, - "related_object_type": "promotion_tier", - "related_object_id": "promo_ZWkx6R0I1Ts3N9HL4kfTdxOm", - "voucher": null, - "promotion_tier": { - "id": "promo_ZWkx6R0I1Ts3N9HL4kfTdxOm", - "campaign": { - "id": "camp_40LC42P5NFbkkD4RWoJ4btks" - } - } - }, - { - "id": "r_0bf9cf0a8b12dc5ba6", - "object": "redemption", - "date": "2022-11-10T06:49:03.835Z", - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "tracking_id": "track_fxEMFisanb4sbl4Z4yCnJyDW013IrRbJmqKByTNHbXE=", - "metadata": {}, - "amount": 200, - "result": "SUCCESS", - "order": { - "id": "ord_jAifScsbOqxgb12hLu7hXrLU", - "source_id": null, - "created_at": "2022-11-10T06:49:02.703Z", - "updated_at": null, - "status": "PAID", - "amount": 4500, - "discount_amount": 4000, - "total_discount_amount": 4000, - "total_amount": 500, - "applied_discount_amount": 4000, - "total_applied_discount_amount": 4000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 3, - "amount": 4500, - "price": 1500, - "subtotal_amount": 4500, - "product": { - "id": "prod_0b72b0bd64d198e3ae", - "source_id": "vase_1", - "name": "Vase - Boho Vintage", - "price": 1500 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "object": "customer" - }, - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0bf9cf0a8b12dc5ba6": { - "date": "2022-11-10T06:49:02.764Z", - "related_object_type": "voucher", - "related_object_id": "v_Xak3ViMbxCH8Lb4ZG0lWwC0goMRBXWB4", - "related_object_parent_id": "camp_fkZ28pe7DUAEmmabofkxHI8N" - } - } - }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "name": "Bobby McDonald", - "email": "bobby.mcdonald@email.com", - "source_id": "bobby.mcdonald@email.com", - "metadata": { - "acquisition_channel": "Facebook", - "customer_life_time_value": 100 - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_Xak3ViMbxCH8Lb4ZG0lWwC0goMRBXWB4", - "voucher": { - "id": "v_Xak3ViMbxCH8Lb4ZG0lWwC0goMRBXWB4", - "code": "LT1-wMPnRhxb", - "campaign": "Loyalty Campaign - Tiers - 1", - "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N" - }, - "reward": { - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "name": "Bobby McDonald", - "email": "bobby.mcdonald@email.com", - "source_id": "bobby.mcdonald@email.com", - "metadata": { - "acquisition_channel": "Facebook", - "customer_life_time_value": 100 - }, - "object": "customer" - }, - "assignment_id": "rewa_nMXB59qGTNYawMT8eP8M4oUp", - "id": "rew_MVXA2kV7lZ1zC057WUaTrvNz", - "object": "reward", - "name": "100 Points = $20", - "created_at": "2022-09-09T06:41:54.496Z", - "updated_at": null, - "parameters": { - "coin": { - "exchange_ratio": 20, - "points_ratio": 100 - } - }, - "type": "COIN" - }, - "loyalty_card": { - "points": 200 - } - }, - { - "id": "rf_0bf9caf744d2dc593a", - "object": "redemption", - "date": "2022-11-10T06:31:15.477Z", - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "tracking_id": "track_fxEMFisanb4sbl4Z4yCnJyDW013IrRbJmqKByTNHbXE=", - "metadata": {}, - "result": "FAILURE", - "failure_code": "loyalty_card_points_exceeded", - "failure_message": "loyalty card points exceeded", - "order": null, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "name": "Bobby McDonald", - "email": "bobby.mcdonald@email.com", - "source_id": "bobby.mcdonald@email.com", - "metadata": { - "acquisition_channel": "Facebook", - "customer_life_time_value": 100 - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_Xak3ViMbxCH8Lb4ZG0lWwC0goMRBXWB4", - "voucher": { - "id": "v_Xak3ViMbxCH8Lb4ZG0lWwC0goMRBXWB4", - "code": "LT1-wMPnRhxb", - "campaign": "Loyalty Campaign - Tiers - 1", - "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N" - } - }, - { - "id": "rf_0bf8c023eb4d4aa4ad", - "object": "redemption", - "date": "2022-11-09T11:05:28.074Z", - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "tracking_id": "track_fxEMFisanb4sbl4Z4yCnJyDW013IrRbJmqKByTNHbXE=", - "metadata": {}, - "result": "FAILURE", - "failure_code": "customer_rules_violated", - "failure_message": "customer does not match validation rules", - "order": null, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "name": "Bob Smith", - "email": "bob.smith@email.com", - "source_id": "bob.smith@email.com", - "metadata": { - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_FGQjOjqasEbbdpnySdCpUoalJio3OHWK", - "voucher": { - "id": "v_FGQjOjqasEbbdpnySdCpUoalJio3OHWK", - "code": "3rqWOTAh", - "campaign_id": null - } - }, - { - "id": "r_0ba9fa02fcd28ed8f1", - "object": "redemption", - "date": "2022-09-09T06:38:20.085Z", - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "tracking_id": "track_fxEMFisanb4sbl4Z4yCnJyDW013IrRbJmqKByTNHbXE=", - "metadata": {}, - "amount": 300, - "result": "SUCCESS", - "order": { - "id": "ord_G9LBb5SOPa36pHdwxUvzkw4P", - "source_id": null, - "created_at": "2022-09-09T06:38:17.984Z", - "updated_at": null, - "status": "PAID", - "amount": 4600, - "items_discount_amount": 300, - "total_discount_amount": 300, - "total_amount": 4300, - "items_applied_discount_amount": 300, - "total_applied_discount_amount": 300, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1600, - "price": 1600, - "subtotal_amount": 1600, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 1600 - }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "price": 1600 - } - }, - { - "object": "order_item", - "product_id": "prod_0a65b3ff8592d7a5b5", - "quantity": 1, - "amount": 3000, - "discount_amount": 300, - "applied_discount_amount": 300, - "price": 3000, - "subtotal_amount": 2700, - "product": { - "id": "prod_0a65b3ff8592d7a5b5", - "name": "Koffee Cup", - "price": 3000 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "object": "customer" - }, - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0ba9fa02fcd28ed8f1": { - "date": "2022-09-09T06:38:18.099Z", - "related_object_type": "voucher", - "related_object_id": "v_KqP2NOSb4dJb1D6UBhcq7ScPZXun0y40", - "related_object_parent_id": "camp_hC2GdqYtOmTT45zfhib62cK1" - } - } - }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "name": "Bob Smith", - "email": "bob.smith@email.com", - "source_id": "bob.smith@email.com", - "metadata": {}, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_KqP2NOSb4dJb1D6UBhcq7ScPZXun0y40", - "voucher": { - "id": "v_KqP2NOSb4dJb1D6UBhcq7ScPZXun0y40", - "code": "vTcguVLE", - "campaign": "SL-Gift", - "campaign_id": "camp_hC2GdqYtOmTT45zfhib62cK1" - }, - "gift": { - "amount": 300 - } - }, - { - "id": "rf_0bf8bfe0808d4aa473", - "object": "redemption", - "date": "2022-11-09T11:04:19.062Z", - "customer_id": null, - "tracking_id": null, - "metadata": {}, - "result": "FAILURE", - "failure_code": "missing_customer", - "failure_message": "Missing customer", - "order": null, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": null, - "related_object_type": "voucher", - "related_object_id": "v_FGQjOjqasEbbdpnySdCpUoalJio3OHWK", - "voucher": { - "id": "v_FGQjOjqasEbbdpnySdCpUoalJio3OHWK", - "code": "3rqWOTAh", - "campaign_id": null - } - } - ], - "total": 6 - } - } - } + "explode": true, + "properties": { + "conditions": { + "$ref": "#/components/schemas/7_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "result": { + "type": "object", + "description": "Result, i.e. `SUCCESS` or `FAILURE`.", + "style": "deepObject", + "explode": true, + "properties": { + "conditions": { + "$ref": "#/components/schemas/7_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "object": { + "type": "object", + "description": "Specify which type of object to return, i.e. `redemption` or `redemption_rollback`.", + "style": "deepObject", + "explode": true, + "properties": { + "conditions": { + "$ref": "#/components/schemas/7_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "customer_id": { + "type": "object", + "description": "Unique customer ID, i.e. cust_sehkNIi8Uq2qQuRqSr7xn4Zi.", + "style": "deepObject", + "explode": true, + "properties": { + "conditions": { + "$ref": "#/components/schemas/7_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "campaign_name": { + "type": "object", + "description": "Campaign name.", + "style": "deepObject", + "explode": true, + "properties": { + "conditions": { + "$ref": "#/components/schemas/7_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" + } + } + }, + "user_login": { + "type": "object", + "description": "User login used to login to Voucherify, i.e. name.lastname@email.com", + "style": "deepObject", + "explode": true, + "properties": { + "conditions": { + "$ref": "#/components/schemas/7_filter_conditions_string" + }, + "junction": { + "$ref": "#/components/schemas/16_filter_junction" } } } } }, - "post": { - "operationId": "redeem-stacked-discounts", - "tags": [ - "STACKABLE DISCOUNTS API" - ], - "summary": "Redeem Stackable Discounts", - "description": "Use this method to redeem up to 5 redeemables in a single API request.\n\n## How API returns calculated discounts and order amounts in the response\n\nIn the table below, you can see the logic the API follows to calculate discounts and amounts:\n\n| **Field** | **Calculation** | **Description** |\n|:---|:---|:---|\n| amount | N/A | This field shows the order amount before applying any discount |\n| total_amount | `total_amount` = `amount` - `total_discount_amount` | This field shows the order amount after applying all the discounts |\n| 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. |\n| items_discount_amount | sum(items, i => i.discount_amount) | This field sums up all product-specific discounts |\n| total_discount_amount | `total_discount_amount` = `discount_amount` + `items_discount_amount` | This field sums up all order-level and all product-specific discounts |\n| applied_discount_amount | N/A | This field shows the order-level discount applied in a particular request |\n| items_applied_discount_amount | sum(items, i => i.applied_discount_amount) | This field sums up all product-specific discounts applied in a particular request |\n| 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 |\n\n\n> 📘 Rollbacks\n>\n> 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](ref:rollback-stacked-redemptions). \n\n\n> 📘 Also available on client-side\n>\n> This method is also accessible through public keys which you can use in client-side​ apps: mobile and web browser apps. Go to the dedicated [endpoint](ref:redeem-stacked-discounts-client-side) to learn more.\n> - Use `X-Client-Application-Id` as the application ID header.\n> - Use `X-Client-Token` as the appliction secret key header.\n> - Use client-side base URL.\n> - Use an `origin` header for your custom domain.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "## Expanded Response\n\nResponses will vary depending on the strings passed in the `options.expand` string array.\n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
                  - Order data with calculated discounts are listed in each child redemption object.
                  - Metadata not included for each discount type. |\n| [\"order\", \"redemption\"] | - Returns redemption object `metadata`.
                  - Order data with calculated discounts are listed in each child redemption object. |\n| [\"redeemable\", \"redemption\"] | - Returns each discount type's `metadata` in each child redemption object.
                  - Returns redemption object `metadata`. |\n| [\"redemption\"] | - Returns redemption object `metadata`. |\n| [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object
                  - Returns redemption object `metadata`.
                  - Returns an expanded `categories` object, showing details about the category. |", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/19_req_redemptions" - }, - "examples": { - "Example": { - "value": { - "customer": { - "source_id": "sample_customer", - "metadata": { - "key": "value" - } - }, - "options": { - "expand": [ - "order", - "redeemable", - "category" - ] - }, - "redeemables": [ - { - "object": "voucher", - "id": "voucher-code" - } - ], - "session": { - "type": "LOCK", - "key": "session_key" + "description": "Filters for listing responses.", + "style": "deepObject", + "explode": true + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of redemption objects. Each entry in the array is a separate redemption object. If no more redemptions are available, the resulting array will be empty. If you provide a non-existent customer ID, this call returns an empty object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_res_list_redemptions" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "redemptions", + "redemptions": [ + { + "id": "r_0c0469eaf705889d99", + "object": "redemption", + "date": "2022-11-18T12:30:32.622Z", + "customer_id": "cust_qBwHpagDOFu71Z3F22UzR80X", + "tracking_id": "track_5DQxXbK0C0pvAaHk7mnulhyMBo7VratI", + "metadata": { + "store_names": "Store 2 - Florida - Miami" }, + "result": "SUCCESS", "order": { - "amount": 55000, + "id": "ord_ndw5rQJt12zvZ4upF72a3ljh", + "source_id": null, + "created_at": "2022-11-18T12:30:31.338Z", + "updated_at": null, "status": "PAID", + "amount": 9680000, + "items_discount_amount": 9450000, + "total_discount_amount": 9450000, + "total_amount": 230000, + "items_applied_discount_amount": 9450000, + "total_applied_discount_amount": 9450000, "items": [ { - "quantity": 2, - "price": 20000, - "source_id": "sample product1", - "related_object": "product", + "object": "order_item", + "product_id": "prod_0bae45ffc7003ffc52", + "quantity": 1, + "amount": 230000, + "price": 230000, + "subtotal_amount": 230000, "product": { - "metadata": { - "key": "value" - } + "id": "prod_0bae45ffc7003ffc52", + "source_id": "second_product", + "name": "Samsung Phone 2", + "price": 230000 } }, { - "quantity": 1, - "price": 15000, - "source_id": "sample product2", - "related_object": "product", + "object": "order_item", + "product_id": "prod_0bae2dc5a090fd0184", + "sku_id": "sku_0bae3b28f610fd0da1", + "quantity": 45, + "discount_quantity": 45, + "initial_quantity": 0, + "amount": 9450000, + "discount_amount": 9450000, + "initial_amount": 0, + "applied_discount_amount": 9450000, + "price": 210000, + "subtotal_amount": 0, "product": { - "metadata": { - "key": "value" - } + "id": "prod_0bae2dc5a090fd0184", + "source_id": "first_product", + "name": "Samsung Phone 1", + "price": 220000 + }, + "sku": { + "id": "sku_0bae3b28f610fd0da1", + "source_id": "first_product_sku_1", + "sku": "Samsung phone 256GB", + "price": 210000 } } ], - "metadata": { - "key": "value" - } - } - } - } - } - } - } - }, - "responses": { - "200": { - "description": "All promo codes and tiers provided in redeemables are redeemed during the request and returned in the API response. As a result, there are child `redemptions` related to redemptions of each redeemable and a `parent_redemption` that presents the final effect of redeeming all redeemables and stores the list of child redemptions. \n\n| Response Parameter | Description |\n|:---|:---|\n| redemptions
                  `array of objects` | This array lists all child redemptions that were executed during the request. Each child redemption returns a redemption object with detailed information on how each discount/code was applied to the order. You can see the effect of each consecutive redemption within the order object of each redemption, specifically the `total_discount_amount` parameter. This is why the sequence in which the discounts were provided in the request body matters. Each subsequent redemption object contains the order object which combines the effect of the previously applied discounts. |\n| parent_redemption
                  `object` | Represents the final effect of all child redemptions executed during the request. |\n| order
                  `object` | Represents order details after all discounts are applied. |", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/19_res_redemptions_POST" - } - } - } - } - } - } - }, - "/v1/redemptions/{redemptionId}": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "redemptionId", - "in": "path", - "required": true, - "description": "ID of previously created redemption." - } - ], - "get": { - "operationId": "get-redemption", - "tags": [ - "REDEMPTIONS API" - ], - "summary": "Get Redemption", - "description": "Return a redemption or redemption rollback object. This object can either be a successfull or failed redemption or redemption rollback.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a redemption object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/7_res_get_redemption" - }, - "examples": { - "Discount Voucher": { - "value": { - "id": "r_0bade27c428db5873e", - "object": "redemption", - "date": "2022-09-12T07:29:28.211Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", "metadata": {}, - "result": "SUCCESS", - "order": { - "id": "ord_ebmAU9uv3dTE2Khqyh7i5ka7", - "source_id": null, - "created_at": "2022-09-12T07:29:26.245Z", - "updated_at": null, - "status": "PAID", - "amount": 22500, - "discount_amount": 300, - "total_discount_amount": 300, - "total_amount": 22200, - "applied_discount_amount": 300, - "total_applied_discount_amount": 300, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b2c36568000039138", - "quantity": 1, - "amount": 22500, - "price": 22500, - "subtotal_amount": 22500, - "product": { - "id": "prod_0b2c36568000039138", - "source_id": "86", - "name": "[Sample] Able Brewing System", - "price": 22500 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0bade27c428db5873e": { - "date": "2022-09-12T07:29:26.282Z", - "related_object_type": "voucher", - "related_object_id": "v_c1yOEjZXOyVIe89VAYiRvL3QimZjXo8h" - } - } - }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "accepts_marketing": false - }, + "id": "cust_qBwHpagDOFu71Z3F22UzR80X", "object": "customer" }, - "related_object_type": "voucher", - "related_object_id": "v_c1yOEjZXOyVIe89VAYiRvL3QimZjXo8h", - "voucher": { - "id": "v_c1yOEjZXOyVIe89VAYiRvL3QimZjXo8h", - "code": "FB-metadata-string", - "campaign": null, - "campaign_id": null, - "category": null, - "categories": [], - "discount": null, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "additional_info": null, - "assets": { - "qr": {}, - "barcode": {} - }, - "updated_at": null, - "object": "voucher" - } - } - }, - "Loyalty Card - Material Reward Product Type": { - "value": { - "id": "r_0c5bf0e6d601c7d7de", - "object": "redemption", - "date": "2023-01-25T12:08:09.503Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": {}, - "amount": 4, - "result": "SUCCESS", - "order": { - "id": "ord_dSOsWkNCRT24lHPkMu8o5QbX", - "source_id": null, - "created_at": "2023-01-25T12:08:07.750Z", - "updated_at": null, - "status": "PAID", - "items": [], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5bf0e6d601c7d7de": { - "date": "2023-01-25T12:08:07.768Z", - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" - } + "customer_id": "cust_qBwHpagDOFu71Z3F22UzR80X", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c0469eaf705889d99": { + "date": "2022-11-18T12:30:31.388Z", + "related_object_type": "promotion_tier", + "related_object_id": "promo_ZWkx6R0I1Ts3N9HL4kfTdxOm", + "related_object_parent_id": "camp_40LC42P5NFbkkD4RWoJ4btks" } + } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_qBwHpagDOFu71Z3F22UzR80X", + "name": "Bob Jones", + "email": "bob.smith@email.com", + "source_id": "pub_source_customer_5_a", + "metadata": { + "lang": "en", + "test": true }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "categories": [], - "discount": null, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "additional_info": null, - "assets": { - "qr": {}, - "barcode": {} - }, - "updated_at": null, - "object": "voucher" - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_LRx3Y1iHFWTt217NVrknkpi5", - "product": { - "id": "prod_0b2c2ddf35150b83bb", - "source_id": "97", - "name": "[Sample] Tiered Wire Basket", - "price": 11995, - "attributes": [], - "metadata": { - "source": "bigcommerce", - "bigcommerce_product_categories": [ - 21, - 23 - ] - }, - "image_url": null, - "created_at": "2022-06-03T13:36:16.084Z", - "updated_at": "2022-06-07T09:10:44.644Z", - "object": "product" - }, - "id": "rew_EPx1hCTpqzF0HW1z9NKckZH4", - "object": "reward", - "name": "Present", - "created_at": "2022-06-13T06:59:01.694Z", - "updated_at": null, - "parameters": { - "product": { - "id": "prod_0b2c2ddf35150b83bb", - "sku_id": null - } - }, - "type": "MATERIAL" - }, - "loyalty_card": { - "points": 4 + "object": "customer" + }, + "related_object_type": "promotion_tier", + "related_object_id": "promo_ZWkx6R0I1Ts3N9HL4kfTdxOm", + "voucher": null, + "promotion_tier": { + "id": "promo_ZWkx6R0I1Ts3N9HL4kfTdxOm", + "campaign": { + "id": "camp_40LC42P5NFbkkD4RWoJ4btks" } } }, - "Loyalty Card - Material Reward SKU Type": { - "value": { - "id": "r_0c5bf18dad48a34392", - "object": "redemption", - "date": "2023-01-25T12:11:00.543Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": {}, - "amount": 6, - "result": "SUCCESS", - "order": { - "id": "ord_dwb6bpqjIlMuXFS71NuHed9S", - "source_id": null, - "created_at": "2023-01-25T12:10:58.598Z", - "updated_at": null, - "status": "PAID", - "items": [], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5bf18dad48a34392": { - "date": "2023-01-25T12:10:58.613Z", - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" - } - } - }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "categories": [], - "discount": null, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "additional_info": null, - "assets": { - "qr": {}, - "barcode": {} - }, - "updated_at": null, - "object": "voucher" - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_gfpRNkOT0pwzF7P5tXWXOs4H", - "product": { - "id": "prod_5h0wc453_2", - "source_id": "jonah-nystrom-bourbon", - "name": "Johan & Nyström - Bourbon", - "price": null, - "attributes": [ - "categories", - "description", - "weight" - ], - "metadata": { - "company": "Johan & Nyström", - "showcase": true - }, - "image_url": null, - "created_at": "2021-12-01T08:00:49.418Z", - "updated_at": null, - "object": "product" - }, - "sku": { - "id": "sku_0a3efc9044dd121803", - "source_id": "jonah-nystrom-bourbon-250g", - "product_id": "prod_5h0wc453_2", - "sku": "250g", - "price": 1750, - "currency": null, - "attributes": { - "categories": "Coffee, Whole Bean", - "description": "Background for this blend comes from the longing for a real dark roasting of high-quality coffee beans. Although the beans are dark roasted, they keep their clear and intense aroma. This coffee has a smoky flavour with a slight hint of sweetness and loads of fruit notes. Thanks to the experience in the dark roasting of coffee, the beans still retain most of their aromas. Its aftertaste is clear and remains for a long time. This coffee is perfect for a Dripper, French Press, Moka coffee maker and the traditional espresso brewing method.", - "weight": 250 - }, - "image_url": null, - "metadata": {}, - "created_at": "2021-12-01T08:00:49.427Z", - "updated_at": null, - "object": "sku" - }, - "id": "rew_SfQCsap5R8UBTVbdMTRx10x8", - "object": "reward", - "name": "Present - SKU", - "created_at": "2023-01-25T12:10:16.060Z", - "updated_at": null, - "parameters": { + { + "id": "r_0bf9cf0a8b12dc5ba6", + "object": "redemption", + "date": "2022-11-10T06:49:03.835Z", + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "tracking_id": "track_fxEMFisanb4sbl4Z4yCnJyDW013IrRbJmqKByTNHbXE=", + "metadata": {}, + "amount": 200, + "result": "SUCCESS", + "order": { + "id": "ord_jAifScsbOqxgb12hLu7hXrLU", + "source_id": null, + "created_at": "2022-11-10T06:49:02.703Z", + "updated_at": null, + "status": "PAID", + "amount": 4500, + "discount_amount": 4000, + "total_discount_amount": 4000, + "total_amount": 500, + "applied_discount_amount": 4000, + "total_applied_discount_amount": 4000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 3, + "amount": 4500, + "price": 1500, + "subtotal_amount": 4500, "product": { - "id": "prod_5h0wc453_2", - "sku_id": "sku_0a3efc9044dd121803" + "id": "prod_0b72b0bd64d198e3ae", + "source_id": "vase_1", + "name": "Vase - Boho Vintage", + "price": 1500 } - }, - "type": "MATERIAL" - }, - "loyalty_card": { - "points": 6 - } - } - }, - "Loyalty Card - Pay with Points": { - "value": { - "id": "r_0b5e402ad54a3afe9c", - "object": "redemption", - "date": "2022-07-12T11:00:26.247Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 5, - "redemption": "r_0b5e402ad50a3afe98", - "result": "SUCCESS", - "order": { - "id": "ord_9akjPYZNskEhKZ4zCZt6TKwq", - "source_id": null, - "created_at": "2022-07-12T11:00:26.224Z", - "amount": 20000, - "discount_amount": 5100, - "total_discount_amount": 5100, - "total_amount": 14900, - "applied_discount_amount": 500, - "total_applied_discount_amount": 500, - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "channel": { - "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", - "channel_type": "API" - }, + } + ], + "metadata": {}, "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "accepts_marketing": false - }, + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", "object": "customer" }, - "related_object_type": "voucher", - "related_object_id": "v_pQZDYaH8LzoOvgh3234DqZQjGJgbPov6", - "voucher": { - "id": "v_pQZDYaH8LzoOvgh3234DqZQjGJgbPov6", - "code": "LOYALTY-CARD-zOR2sV9Q", - "campaign": "Loyalty Program", - "campaign_id": "camp_Hpt5hPTA8kSKRWGxBGw8Y0So", - "category": null, - "categories": [], - "discount": null, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "additional_info": null, - "assets": { - "qr": {}, - "barcode": {} - }, - "updated_at": null, - "object": "voucher" - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "accepts_marketing": false - }, - "object": "customer" - }, - "assignment_id": "rewa_X3jnD5XFxP6GXCzPZUNknDck", - "id": "rew_6rhNwuuWFQJLvTPO34ilg6jq", - "object": "reward", - "name": "Pay with Points", - "created_at": "2022-07-11T08:18:18.205Z", - "updated_at": null, - "parameters": { - "coin": { - "exchange_ratio": 1, - "points_ratio": 1 - } - }, - "type": "COIN" - }, - "loyalty_card": { - "points": 5 + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0bf9cf0a8b12dc5ba6": { + "date": "2022-11-10T06:49:02.764Z", + "related_object_type": "voucher", + "related_object_id": "v_Xak3ViMbxCH8Lb4ZG0lWwC0goMRBXWB4", + "related_object_parent_id": "camp_fkZ28pe7DUAEmmabofkxHI8N" + } } - } - }, - "Loyalty Card - Digital Reward - Discount Voucher": { - "value": { - "id": "r_0c5bf3323008a35032", - "object": "redemption", - "date": "2023-01-25T12:18:10.707Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "name": "Bobby McDonald", + "email": "bobby.mcdonald@email.com", + "source_id": "bobby.mcdonald@email.com", "metadata": { - "redemption_location": { - "city": "Warsaw", - "state": "Polyork" - } - }, - "amount": 2, - "result": "SUCCESS", - "order": { - "id": "ord_dqxr4uzaYWkTZnrSEMoQtCF8", - "source_id": null, - "created_at": "2023-01-25T12:18:09.203Z", - "updated_at": null, - "status": "PAID", - "amount": 2100, - "total_amount": 2100, - "items": [ - { - "object": "order_item", - "product_id": "prod_0bc3bd8a4e072c5275", - "quantity": 3, - "amount": 2100, - "price": 700, - "subtotal_amount": 2100, - "product": { - "id": "prod_0bc3bd8a4e072c5275", - "name": "Bouquet - Romantic Roses", - "price": 700 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5bf3323008a35032": { - "date": "2023-01-25T12:18:09.216Z", - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" - } - } - }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" + "acquisition_channel": "Facebook", + "customer_life_time_value": 100 }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_Xak3ViMbxCH8Lb4ZG0lWwC0goMRBXWB4", + "voucher": { + "id": "v_Xak3ViMbxCH8Lb4ZG0lWwC0goMRBXWB4", + "code": "LT1-wMPnRhxb", + "campaign": "Loyalty Campaign - Tiers - 1", + "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N" + }, + "reward": { "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "name": "Bobby McDonald", + "email": "bobby.mcdonald@email.com", + "source_id": "bobby.mcdonald@email.com", "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" + "acquisition_channel": "Facebook", + "customer_life_time_value": 100 }, "object": "customer" }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "categories": [], - "discount": null, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "additional_info": null, - "assets": { - "qr": {}, - "barcode": {} - }, - "updated_at": null, - "object": "voucher" - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_0ZwLAHgeU9IrI2V1ofYRmW7g", - "voucher": { - "id": "v_4GaEX7clyqMaveT7vHhoyRpsIgxv95Q6", - "code": "HAPPY-ORDER5My", - "campaign": "$20 off the entire order", - "campaign_id": "camp_5h0wc453_4", - "category": null, - "category_id": "cat_0b688929a2476386a6", - "categories": [], - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 2000, - "effect": "APPLY_TO_ORDER" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2022-09-20T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "21ceb848-4869-4dac-ba41-f854bda3a101", - "url": "https://dl.voucherify.io/api/v1/assets/qr/21ceb848-4869-4dac-ba41-f854bda3a101" - }, - "barcode": { - "id": "1dba9cb2-fb28-4c8d-8548-5edb2eb01f5a", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/1dba9cb2-fb28-4c8d-8548-5edb2eb01f5a" - } - }, - "is_referral_code": false, - "created_at": "2023-01-25T12:18:09.256Z", - "updated_at": null, - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/HAPPY-ORDER5My/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/HAPPY-ORDER5My/publications?page=1&limit=10" - }, - "object": "voucher" - }, - "id": "rew_MF4hKh1IKYgJkPjbcFbH94Ho", - "object": "reward", - "name": "Digital Present", - "created_at": "2023-01-25T12:16:44.557Z", - "updated_at": null, - "parameters": { - "campaign": { - "id": "camp_5h0wc453_4", - "type": "DISCOUNT_COUPONS" - } - }, - "type": "CAMPAIGN" - }, - "loyalty_card": { - "points": 2 - } - } - }, - "Loyalty Card - Digital Reward - Credits on Gift Card": { - "value": { - "id": "r_0c5c1435d053202118", - "object": "redemption", - "date": "2023-01-25T14:42:25.206Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": {}, - "amount": 1, - "result": "SUCCESS", - "order": { - "id": "ord_v0r7JfUQgWRpw28UJm9Z5AaH", - "source_id": null, - "created_at": "2023-01-25T14:42:23.637Z", - "updated_at": null, - "status": "PAID", - "amount": 22500, - "total_amount": 22500, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b2c36568000039138", - "quantity": 1, - "amount": 22500, - "price": 22500, - "subtotal_amount": 22500, - "product": { - "id": "prod_0b2c36568000039138", - "source_id": "86", - "name": "[Sample] Able Brewing System", - "price": 22500 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5c1435d053202118": { - "date": "2023-01-25T14:42:23.681Z", - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" - } + "assignment_id": "rewa_nMXB59qGTNYawMT8eP8M4oUp", + "id": "rew_MVXA2kV7lZ1zC057WUaTrvNz", + "object": "reward", + "name": "100 Points = $20", + "created_at": "2022-09-09T06:41:54.496Z", + "updated_at": null, + "parameters": { + "coin": { + "exchange_ratio": 20, + "points_ratio": 100 } }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "categories": [], - "discount": null, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "additional_info": null, - "assets": { - "qr": {}, - "barcode": {} - }, - "updated_at": null, - "object": "voucher" - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_U554pL2BhDIDZOvZ8y9YQ9hA", - "voucher": { - "id": "v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk", - "code": "GIFT-CARD-xwc6X7Tk", - "campaign": "Gift Cards", - "campaign_id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "GIFT_VOUCHER", - "discount": null, - "gift": { - "amount": 55080, - "balance": 44780 - }, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM/aTyHCYfr7kRWb2vv08WIgY/Tv53SJGW+k2keqfsTq/Ohb5shkCN3FTFsaI8gulTp616sEGn/JJoIInIoNkO9Vd1+AfrKiAjmirCmekE6cz2SVCyNAXs=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM%2FaTyHCYfr7kRWb2vv08WIgY%2FTv53SJGW%2Bk2keqfsTq%2FOhb5shkCN3FTFsaI8gulTp616sEGn%2FJJoIInIoNkO9Vd1%2BAfrKiAjmirCmekE6cz2SVCyNAXs%3D" - }, - "barcode": { - "id": "U2FsdGVkX18vWc/qplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO/199U+zicnFNWqg/jF5ZCQW+6jO1q8=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18vWc%2FqplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO%2F199U%2BzicnFNWqg%2FjF5ZCQW%2B6jO1q8%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-07-08T09:44:33.179Z", - "updated_at": "2023-01-11T15:23:02.789Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "redemption": { - "quantity": null, - "redeemed_quantity": 7, - "redeemed_amount": 10300, - "object": "list", - "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/publications?page=1&limit=10" - }, - "object": "voucher" - }, - "id": "rew_6bvM4vnaVdbPVQxYpuN37rhH", - "object": "reward", - "name": "Present Credits on Gift Card", - "created_at": "2023-01-25T14:41:31.858Z", - "updated_at": null, - "parameters": { - "campaign": { - "id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", - "balance": 4000, - "type": "GIFT_VOUCHERS" - } - }, - "type": "CAMPAIGN" - }, - "loyalty_card": { - "points": 1 - } + "type": "COIN" + }, + "loyalty_card": { + "points": 200 } }, - "Loyalty Card - Digital Reward - Points on Loyalty Card": { - "value": { - "id": "r_0c5c226f498f1a93f0", - "object": "redemption", - "date": "2023-01-25T15:44:34.317Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": {}, - "amount": 1, - "result": "SUCCESS", - "order": { - "id": "ord_1fv4ITwpUQra6iDTHFPVfnRR", - "source_id": null, - "created_at": "2023-01-25T15:44:32.494Z", - "updated_at": null, - "status": "PAID", - "amount": 700, - "total_amount": 700, - "items": [ - { - "object": "order_item", - "product_id": "prod_0bc3bd8a4e072c5275", - "quantity": 1, - "amount": 700, - "price": 700, - "subtotal_amount": 700, - "product": { - "id": "prod_0bc3bd8a4e072c5275", - "name": "Bouquet - Romantic Roses", - "price": 700 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5c226f498f1a93f0": { - "date": "2023-01-25T15:44:32.550Z", - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" - } - } - }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "categories": [], - "discount": null, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "additional_info": null, - "assets": { - "qr": {}, - "barcode": {} - }, - "updated_at": null, - "object": "voucher" - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_BpytIepuSekuXXwb9qkLJfCU", - "voucher": { - "id": "v_pQZDYaH8LzoOvgh3234DqZQjGJgbPov6", - "code": "LOYALTY-CARD-zOR2sV9Q", - "campaign": "Loyalty Program", - "campaign_id": "camp_Hpt5hPTA8kSKRWGxBGw8Y0So", - "category": null, - "category_id": null, - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 1000, - "balance": 870 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/THRRj1QegAan0r5U+wRoHuFEA6FR7TrvZm8N+8cK7niF/8uAqFdVYTU1JD0/CdoSXlYqiGgz3PAFOGWFSJt8vkM50fcMtMNLsaudU+YrPDeT2HCB7o0Ts7h1FnbD85+0F7lwrbKmkGW6kub0mjCaRdJYS/axIAq4=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FTHRRj1QegAan0r5U%2BwRoHuFEA6FR7TrvZm8N%2B8cK7niF%2F8uAqFdVYTU1JD0%2FCdoSXlYqiGgz3PAFOGWFSJt8vkM50fcMtMNLsaudU%2BYrPDeT2HCB7o0Ts7h1FnbD85%2B0F7lwrbKmkGW6kub0mjCaRdJYS%2FaxIAq4%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+yREd0zRAfZY9uwtMZsl4eDd8+LeiKGVI5OzOQRpjhtV91IuEe7/SXEW8m4F2Llg2//yieX2zsP3UtWasWxw8ZkHMRSIdxfxzSdSj8ap0dI5xwKW4OE1Q6Sgsb+kZVfCKUHbwXCcd8y5a6xTpVIg97y74Ng1Vg2PY=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2ByREd0zRAfZY9uwtMZsl4eDd8%2BLeiKGVI5OzOQRpjhtV91IuEe7%2FSXEW8m4F2Llg2%2F%2FyieX2zsP3UtWasWxw8ZkHMRSIdxfxzSdSj8ap0dI5xwKW4OE1Q6Sgsb%2BkZVfCKUHbwXCcd8y5a6xTpVIg97y74Ng1Vg2PY%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-07-11T08:19:28.780Z", - "updated_at": "2022-10-01T00:02:05.604Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "redemption": { - "quantity": null, - "redeemed_quantity": 26, - "redeemed_points": 130, - "object": "list", - "url": "/v1/vouchers/LOYALTY-CARD-zOR2sV9Q/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/LOYALTY-CARD-zOR2sV9Q/publications?page=1&limit=10" - }, - "object": "voucher" - }, - "id": "rew_7ZM476Q77dH5KvHk4KzoRNvF", - "object": "reward", - "name": "Present on Loyalty Card", - "created_at": "2023-01-25T15:43:40.716Z", - "updated_at": null, - "parameters": { - "campaign": { - "id": "camp_Hpt5hPTA8kSKRWGxBGw8Y0So", - "balance": 20, - "type": "LOYALTY_PROGRAM" - } - }, - "type": "CAMPAIGN" + { + "id": "rf_0bf9caf744d2dc593a", + "object": "redemption", + "date": "2022-11-10T06:31:15.477Z", + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "tracking_id": "track_fxEMFisanb4sbl4Z4yCnJyDW013IrRbJmqKByTNHbXE=", + "metadata": {}, + "result": "FAILURE", + "failure_code": "loyalty_card_points_exceeded", + "failure_message": "loyalty card points exceeded", + "order": null, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "name": "Bobby McDonald", + "email": "bobby.mcdonald@email.com", + "source_id": "bobby.mcdonald@email.com", + "metadata": { + "acquisition_channel": "Facebook", + "customer_life_time_value": 100 }, - "loyalty_card": { - "points": 1 - } + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_Xak3ViMbxCH8Lb4ZG0lWwC0goMRBXWB4", + "voucher": { + "id": "v_Xak3ViMbxCH8Lb4ZG0lWwC0goMRBXWB4", + "code": "LT1-wMPnRhxb", + "campaign": "Loyalty Campaign - Tiers - 1", + "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N" } }, - "Gift Card": { - "value": { - "id": "r_0b5e7d29ba4fb72ee4", - "object": "redemption", - "date": "2022-07-12T15:26:52.777Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 5000, - "redemption": "r_0b5e7d29ba0fb72ee2", - "result": "SUCCESS", - "order": { - "id": "ord_5iOTjTG4I3Yo2G2bH1qHk66a", - "source_id": null, - "created_at": "2022-07-12T15:26:52.773Z", - "amount": 30200, - "discount_amount": 9530, - "total_discount_amount": 9530, - "total_amount": 20670, - "applied_discount_amount": 5000, - "total_applied_discount_amount": 5000, - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "channel": { - "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", - "channel_type": "API" - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "accepts_marketing": false - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk", - "voucher": { - "id": "v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk", - "code": "GIFT-CARD-xwc6X7Tk", - "campaign": "Gift Cards", - "campaign_id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", - "category": null, - "categories": [], - "discount": null, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "additional_info": null, - "assets": { - "qr": {}, - "barcode": {} - }, - "updated_at": null, - "object": "voucher" + { + "id": "rf_0bf8c023eb4d4aa4ad", + "object": "redemption", + "date": "2022-11-09T11:05:28.074Z", + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "tracking_id": "track_fxEMFisanb4sbl4Z4yCnJyDW013IrRbJmqKByTNHbXE=", + "metadata": {}, + "result": "FAILURE", + "failure_code": "customer_rules_violated", + "failure_message": "customer does not match validation rules", + "order": null, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "name": "Bob Smith", + "email": "bob.smith@email.com", + "source_id": "bob.smith@email.com", + "metadata": { + "acquisition_channel": "Facebook" }, - "gift": { - "amount": 5000 - } + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_FGQjOjqasEbbdpnySdCpUoalJio3OHWK", + "voucher": { + "id": "v_FGQjOjqasEbbdpnySdCpUoalJio3OHWK", + "code": "3rqWOTAh", + "campaign_id": null } }, - "Promotion Tier": { - "value": { - "id": "r_0c5d6689b35320059a", - "object": "redemption", - "date": "2023-01-26T15:20:35.916Z", - "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==", - "metadata": null, - "result": "SUCCESS", - "order": { - "id": "ord_4kVJ1PiXP3TNfik3pM79KZsn", - "source_id": null, - "created_at": "2023-01-26T15:20:34.216Z", - "updated_at": null, - "status": "PAID", - "amount": 200000, - "discount_amount": 80000, - "total_discount_amount": 80000, - "total_amount": 120000, - "applied_discount_amount": 80000, - "total_applied_discount_amount": 80000, - "items": [ - { - "object": "order_item", - "source_id": "apple534", - "related_object": "product", - "product_id": "prod_anJ03RZZq74z4v", - "quantity": 2, - "amount": 100000, - "price": 50000, - "subtotal_amount": 100000, - "product": { - "name": "Apple iPhone 8", - "metadata": { - "shop": "citycenter", - "category": "electronics" - } - }, - "metadata": { - "series": "2022-783CV" - } + { + "id": "r_0ba9fa02fcd28ed8f1", + "object": "redemption", + "date": "2022-09-09T06:38:20.085Z", + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "tracking_id": "track_fxEMFisanb4sbl4Z4yCnJyDW013IrRbJmqKByTNHbXE=", + "metadata": {}, + "amount": 300, + "result": "SUCCESS", + "order": { + "id": "ord_G9LBb5SOPa36pHdwxUvzkw4P", + "source_id": null, + "created_at": "2022-09-09T06:38:17.984Z", + "updated_at": null, + "status": "PAID", + "amount": 4600, + "items_discount_amount": 300, + "total_discount_amount": 300, + "total_amount": 4300, + "items_applied_discount_amount": 300, + "total_applied_discount_amount": 300, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1600, + "price": 1600, + "subtotal_amount": 1600, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 1600 }, - { - "object": "order_item", - "source_id": "apple534-ihd5", - "related_object": "sku", - "sku_id": "sku_0KtP4rvwEECQ2U", - "quantity": 1, - "amount": 100000, - "price": 100000, - "subtotal_amount": 100000, - "sku": { - "sku": "Apple iPad 10 Silver 64GB", - "metadata": { - "category": "electronics" - } - } + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "price": 1600 } - ], - "metadata": {}, - "customer": { - "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "object": "customer" }, - "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5d6689b35320059a": { - "date": "2023-01-26T15:20:34.253Z", - "related_object_type": "promotion_tier", - "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "related_object_parent_id": "camp_w7BUstntAm8jbIDjfM49volj" + { + "object": "order_item", + "product_id": "prod_0a65b3ff8592d7a5b5", + "quantity": 1, + "amount": 3000, + "discount_amount": 300, + "applied_discount_amount": 300, + "price": 3000, + "subtotal_amount": 2700, + "product": { + "id": "prod_0a65b3ff8592d7a5b5", + "name": "Koffee Cup", + "price": 3000 } } - }, - "channel": { - "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", - "channel_type": "API" - }, + ], + "metadata": {}, "customer": { - "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "name": "Annie Lemon", - "email": "annie@lemon.com", - "source_id": "annie@lemon.com", + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", "object": "customer" }, - "related_object_type": "promotion_tier", - "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "voucher": null, - "promotion_tier": { - "id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "action": null, - "campaign": { - "id": "camp_w7BUstntAm8jbIDjfM49volj", - "start_date": null, - "expiration_date": null, - "object": "campaign" - }, - "campaign_id": null, - "summary": { - "redemptions": { - "total_redeemed": 0 - }, - "orders": { - "total_amount": 0, - "total_discount_amount": 0 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": null + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0ba9fa02fcd28ed8f1": { + "date": "2022-09-09T06:38:18.099Z", + "related_object_type": "voucher", + "related_object_id": "v_KqP2NOSb4dJb1D6UBhcq7ScPZXun0y40", + "related_object_parent_id": "camp_hC2GdqYtOmTT45zfhib62cK1" + } } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "name": "Bob Smith", + "email": "bob.smith@email.com", + "source_id": "bob.smith@email.com", + "metadata": {}, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_KqP2NOSb4dJb1D6UBhcq7ScPZXun0y40", + "voucher": { + "id": "v_KqP2NOSb4dJb1D6UBhcq7ScPZXun0y40", + "code": "vTcguVLE", + "campaign": "SL-Gift", + "campaign_id": "camp_hC2GdqYtOmTT45zfhib62cK1" + }, + "gift": { + "amount": 300 } }, - "Stacked Redemption": { - "value": { - "id": "r_0b5e3e2b7f851d0192", - "object": "redemption", - "date": "2022-07-12T10:51:33.098Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "result": "SUCCESS", - "order": { - "id": "ord_qjnno0eUQ1fs0RMjejfbZp7q", - "source_id": null, - "created_at": "2022-07-12T10:51:31.687Z", - "updated_at": null, - "status": "PAID", - "amount": 20000, - "discount_amount": 6100, - "total_discount_amount": 6100, - "total_amount": 13900, - "applied_discount_amount": 6100, - "total_applied_discount_amount": 6100, - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0b5e3e2b7f851d0192": { - "date": "2022-07-12T10:51:31.711Z", - "related_object_type": "redemption", - "related_object_id": "r_0b5e3e2b7f851d0192", - "stacked": [ - "r_0b5e3e2b7f851d0193", - "r_0b5e3e2b7fc51d0194", - "r_0b5e3e2b7fc51d0195", - "r_0b5e3e2b7fc51d0196", - "r_0b5e3e2b7fc51d0197" - ] - } - } - }, - "channel": { - "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", - "channel_type": "API" - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "accepts_marketing": false - }, - "object": "customer" - }, - "related_object_type": "redemption", - "related_object_id": "r_0b5e3e2b7f851d0192", - "voucher": null + { + "id": "rf_0bf8bfe0808d4aa473", + "object": "redemption", + "date": "2022-11-09T11:04:19.062Z", + "customer_id": null, + "tracking_id": null, + "metadata": {}, + "result": "FAILURE", + "failure_code": "missing_customer", + "failure_message": "Missing customer", + "order": null, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": null, + "related_object_type": "voucher", + "related_object_id": "v_FGQjOjqasEbbdpnySdCpUoalJio3OHWK", + "voucher": { + "id": "v_FGQjOjqasEbbdpnySdCpUoalJio3OHWK", + "code": "3rqWOTAh", + "campaign_id": null } - }, - "Failed Voucher": { - "value": { - "id": "rf_0c5bd3c15701c78243", - "object": "redemption", - "date": "2023-01-25T10:00:47.812Z", - "customer_id": "cust_w1aRTTkpzeTGtOauISc8CKUN", - "tracking_id": "track_hr0jh/qNQqZWu7gkCEcVwEg27bNVrn2+", + } + ], + "total": 6 + } + } + } + } + } + } + } + }, + "post": { + "operationId": "redeem-stacked-discounts", + "tags": [ + "STACKABLE DISCOUNTS API" + ], + "summary": "Redeem Stackable Discounts", + "description": "Use this method to redeem up to 5 redeemables in a single API request.\n\n## How API returns calculated discounts and order amounts in the response\n\nIn the table below, you can see the logic the API follows to calculate discounts and amounts:\n\n| **Field** | **Calculation** | **Description** |\n|:---|:---|:---|\n| amount | N/A | This field shows the order amount before applying any discount |\n| total_amount | `total_amount` = `amount` - `total_discount_amount` | This field shows the order amount after applying all the discounts |\n| 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. |\n| items_discount_amount | sum(items, i => i.discount_amount) | This field sums up all product-specific discounts |\n| total_discount_amount | `total_discount_amount` = `discount_amount` + `items_discount_amount` | This field sums up all order-level and all product-specific discounts |\n| applied_discount_amount | N/A | This field shows the order-level discount applied in a particular request |\n| items_applied_discount_amount | sum(items, i => i.applied_discount_amount) | This field sums up all product-specific discounts applied in a particular request |\n| 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 |\n\n\n> 📘 Rollbacks\n>\n> 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](ref:rollback-stacked-redemptions). \n\n\n> 📘 Also available on client-side\n>\n> This method is also accessible through public keys which you can use in client-side​ apps: mobile and web browser apps. Go to the dedicated [endpoint](ref:redeem-stacked-discounts-client-side) to learn more.\n> - Use `X-Client-Application-Id` as the application ID header.\n> - Use `X-Client-Token` as the appliction secret key header.\n> - Use client-side base URL.\n> - Use an `origin` header for your custom domain.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "## Expanded Response\n\nResponses will vary depending on the strings passed in the `options.expand` string array.\n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
                  - Order data with calculated discounts are listed in each child redemption object.
                  - Metadata not included for each discount type. |\n| [\"order\", \"redemption\"] | - Returns redemption object `metadata`.
                  - Order data with calculated discounts are listed in each child redemption object. |\n| [\"redeemable\", \"redemption\"] | - Returns each discount type's `metadata` in each child redemption object.
                  - Returns redemption object `metadata`. |\n| [\"redemption\"] | - Returns redemption object `metadata`. |\n| [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object
                  - Returns redemption object `metadata`.
                  - Returns an expanded `categories` object, showing details about the category. |", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/19_req_redemptions" + }, + "examples": { + "Example": { + "value": { + "customer": { + "source_id": "sample_customer", + "metadata": { + "key": "value" + } + }, + "options": { + "expand": [ + "order", + "redeemable", + "category" + ] + }, + "redeemables": [ + { + "object": "voucher", + "id": "voucher-code" + } + ], + "session": { + "type": "LOCK", + "key": "session_key" + }, + "order": { + "amount": 55000, + "status": "PAID", + "items": [ + { + "quantity": 2, + "price": 20000, + "source_id": "sample product1", + "related_object": "product", + "product": { "metadata": { - "location_id": [], - "redemption_location": { - "city": "Albany", - "state": "New York" - } - }, - "result": "FAILURE", - "failure_code": "voucher_disabled", - "failure_message": "voucher is disabled", - "order": null, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_w1aRTTkpzeTGtOauISc8CKUN", - "name": "Bobby's Friend", - "email": null, - "source_id": "create_order_referrer_1", - "metadata": {}, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_zr4XJD6b6JtldZq9EorHf4jxRbahjkfi", - "voucher": { - "id": "v_zr4XJD6b6JtldZq9EorHf4jxRbahjkfi", - "code": "PROMO-CODE2", - "campaign": null, - "campaign_id": null, - "category": null, - "categories": [], - "discount": null, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "additional_info": null, - "assets": { - "qr": {}, - "barcode": {} - }, - "updated_at": null, - "object": "voucher" + "key": "value" } } }, - "Failed Promotion Tier": { - "value": { - "id": "rf_0c5d6e47050156bfc2", - "object": "redemption", - "date": "2023-01-26T15:54:23.508Z", - "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==", - "metadata": null, - "result": "FAILURE", - "failure_code": "promotion_inactive", - "failure_message": "Inactive Promotion", - "order": null, - "channel": { - "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", - "channel_type": "API" - }, - "customer": { - "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "name": "Annie Lemon", - "email": "annie@lemon.com", - "source_id": "annie@lemon.com", - "metadata": { - "age": 2 - }, - "object": "customer" - }, - "related_object_type": "promotion_tier", - "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "voucher": null, - "promotion_tier": { - "id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "action": null, - "campaign": { - "id": "camp_w7BUstntAm8jbIDjfM49volj", - "start_date": null, - "expiration_date": null, - "object": "campaign" - }, - "campaign_id": null, - "summary": { - "redemptions": { - "total_redeemed": 0 - }, - "orders": { - "total_amount": 0, - "total_discount_amount": 0 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": null + { + "quantity": 1, + "price": 15000, + "source_id": "sample product2", + "related_object": "product", + "product": { + "metadata": { + "key": "value" } } - }, - "Failed Redemption": { - "value": { - "id": "rf_0c5bde8dfc0156f0e3", - "object": "redemption", - "date": "2023-01-25T10:47:58.578Z", - "customer_id": null, - "tracking_id": null, - "metadata": null, - "result": "FAILURE", - "failure_code": "not_found", - "failure_message": "Resource not found", - "order": null, - "channel": { - "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", - "channel_type": "API" - }, - "customer": null, - "related_object_type": "redemption", - "related_object_id": "rf_0c5bde8dfc0156f0e3", - "voucher": null - } } + ], + "metadata": { + "key": "value" } } } } } } - }, - "/v1/vouchers/{code}/redemption": { - "parameters": [ - { - "$ref": "#/components/parameters/code" - } - ], - "get": { - "operationId": "get-voucher-redemptions", - "tags": [ - "REDEMPTIONS API" - ], - "summary": "Get Voucher's Redemptions", - "description": "Retrieve the number of times a voucher was redeemed and each of the redemption details.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + } + }, + "responses": { + "200": { + "description": "All promo codes and tiers provided in redeemables are redeemed during the request and returned in the API response. As a result, there are child `redemptions` related to redemptions of each redeemable and a `parent_redemption` that presents the final effect of redeeming all redeemables and stores the list of child redemptions. \n\n| Response Parameter | Description |\n|:---|:---|\n| redemptions
                  `array of objects` | This array lists all child redemptions that were executed during the request. Each child redemption returns a redemption object with detailed information on how each discount/code was applied to the order. You can see the effect of each consecutive redemption within the order object of each redemption, specifically the `total_discount_amount` parameter. This is why the sequence in which the discounts were provided in the request body matters. Each subsequent redemption object contains the order object which combines the effect of the previously applied discounts. |\n| parent_redemption
                  `object` | Represents the final effect of all child redemptions executed during the request. |\n| order
                  `object` | Represents order details after all discounts are applied. |", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/19_res_redemptions_POST" } - ], - "responses": { - "200": { - "description": "A dictionary with a `redemption_entries` property that contains an array of voucher's redemptions.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/7_res_get_vouchers_redemptions" - }, - "examples": { - "Example": { - "value": { - "quantity": null, - "redeemed_quantity": 6, - "object": "list", - "url": "/v1/vouchers/Test - FB - Vouchers - 9/redemptions?page=1&limit=10", - "data_ref": "redemption_entries", - "total": 6, - "redemption_entries": [ - { - "id": "r_0bc92f81a6801f9bca", - "object": "redemption", - "date": "2022-10-03T12:24:58.008Z", - "customer_id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "tracking_id": "track_fxEMFisanb6bqeHALcTMxy9fmc+1Azdq951CZwGFCweQF8eGLowFHg==", - "metadata": {}, - "result": "SUCCESS", - "order": { - "id": "ord_bhp1EH2SDz7UwkkurPFPLPhi", - "source_id": null, - "created_at": "2022-10-03T12:24:56.179Z", - "updated_at": null, - "status": "PAID", - "amount": 230000, - "discount_amount": 100, - "total_discount_amount": 100, - "total_amount": 229900, - "applied_discount_amount": 100, - "total_applied_discount_amount": 100, - "items": [ - { - "object": "order_item", - "product_id": "prod_0bae45ffc7003ffc52", - "quantity": 1, - "amount": 230000, - "price": 230000, - "subtotal_amount": 230000, - "product": { - "id": "prod_0bae45ffc7003ffc52", - "source_id": "second_product", - "name": "Samsung Phone 2", - "price": 230000 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "object": "customer" - }, - "customer_id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0bc92f81a6801f9bca": { - "date": "2022-10-03T12:24:56.219Z", - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - } - } - }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "name": null, - "email": null, - "source_id": "johnnyy@email.com", - "metadata": {}, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "voucher": { - "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "code": "Test - FB - Vouchers - 9", - "campaign_id": null - } - }, - { - "id": "r_0bc92e6a68050e118c", - "object": "redemption", - "date": "2022-10-03T12:20:11.873Z", - "customer_id": "cust_TzWOhveicr7BI1Qg4bCFrrQQ", - "tracking_id": "track_5DQxXbK0C0pvAaHk7mnulmKhuFqhawWj", - "metadata": {}, - "result": "SUCCESS", - "order": { - "id": "ord_rBsuJYqf4eFZgqj6IxeJgEcN", - "source_id": null, - "created_at": "2022-10-03T12:20:10.222Z", - "updated_at": null, - "status": "PAID", - "amount": 230000, - "discount_amount": 100, - "total_discount_amount": 100, - "total_amount": 229900, - "applied_discount_amount": 100, - "total_applied_discount_amount": 100, - "items": [ - { - "object": "order_item", - "product_id": "prod_0bae45ffc7003ffc52", - "quantity": 1, - "amount": 230000, - "price": 230000, - "subtotal_amount": 230000, - "product": { - "id": "prod_0bae45ffc7003ffc52", - "source_id": "second_product", - "name": "Samsung Phone 2", - "price": 230000 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_TzWOhveicr7BI1Qg4bCFrrQQ", - "object": "customer" - }, - "customer_id": "cust_TzWOhveicr7BI1Qg4bCFrrQQ", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0bc92e6a68050e118c": { - "date": "2022-10-03T12:20:10.272Z", - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - } - } - }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_TzWOhveicr7BI1Qg4bCFrrQQ", - "name": "Bob Jones", - "email": "bob.smith@email.com", - "source_id": "pub_source_customer_4", - "metadata": { - "lang": "en", - "test": true - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "voucher": { - "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "code": "Test - FB - Vouchers - 9", - "campaign_id": null - } - }, - { - "id": "r_0bc92db6e6001f9aa8", - "object": "redemption", - "date": "2022-10-03T12:17:07.780Z", - "customer_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", - "tracking_id": "track_5DQxXbK0C0pvAaHk7mnulmYlx396Pk4X", - "metadata": {}, - "result": "SUCCESS", - "order": { - "id": "ord_JvZbg1LFcXdQ67no5SENGldH", - "source_id": null, - "created_at": "2022-10-03T12:17:06.404Z", - "updated_at": null, - "status": "PAID", - "amount": 230000, - "discount_amount": 1200, - "total_discount_amount": 1200, - "total_amount": 228800, - "applied_discount_amount": 1200, - "total_applied_discount_amount": 1200, - "items": [ - { - "object": "order_item", - "product_id": "prod_0bae45ffc7003ffc52", - "quantity": 1, - "amount": 230000, - "price": 230000, - "subtotal_amount": 230000, - "product": { - "id": "prod_0bae45ffc7003ffc52", - "source_id": "second_product", - "name": "Samsung Phone 2", - "price": 230000 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", - "object": "customer" - }, - "customer_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0bc92db6e6001f9aa8": { - "date": "2022-10-03T12:17:06.456Z", - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - } - } - }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", - "name": "Bob Jones", - "email": "bob.smith@email.com", - "source_id": "pub_source_customer_5", - "metadata": { - "lang": "en", - "test": true - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "voucher": { - "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "code": "Test - FB - Vouchers - 9", - "campaign_id": null - } - }, - { - "id": "r_0bc2dc6404426c0ab3", - "object": "redemption", - "date": "2022-09-28T14:30:56.199Z", - "customer_id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "tracking_id": "track_fxEMFisanb6bqeHALcTMxy9fmc+1Azdq951CZwGFCweQF8eGLowFHg==", - "metadata": {}, - "result": "SUCCESS", - "order": { - "id": "ord_6uuhGraDuXMOpVRTJT251kKW", - "source_id": null, - "created_at": "2022-09-28T14:30:54.681Z", - "updated_at": null, - "status": "PAID", - "amount": 230000, - "discount_amount": 800, - "total_discount_amount": 800, - "total_amount": 229200, - "applied_discount_amount": 800, - "total_applied_discount_amount": 800, - "items": [ - { - "object": "order_item", - "product_id": "prod_0bae45ffc7003ffc52", - "quantity": 1, - "amount": 230000, - "price": 230000, - "subtotal_amount": 230000, - "product": { - "id": "prod_0bae45ffc7003ffc52", - "source_id": "second_product", - "name": "Samsung Phone 2", - "price": 230000 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "object": "customer" - }, - "customer_id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0bc2dc6404426c0ab3": { - "date": "2022-09-28T14:30:54.737Z", - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - } - } - }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", - "name": null, - "email": null, - "source_id": "jonny@email.com", - "metadata": {}, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "voucher": { - "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "code": "Test - FB - Vouchers - 9", - "campaign_id": null - } - }, - { - "id": "r_0bc2d6f0ebc95f1783", - "object": "redemption", - "date": "2022-09-28T14:07:07.516Z", - "customer_id": "cust_H0nXrItO1DNV3UiPIl54HA5o", - "tracking_id": "track_ThofCMTQe4EVIo0zvvOlTor1twaQNd7E", - "metadata": {}, - "result": "SUCCESS", - "order": { - "id": "ord_ZQevc2J2sBegsnp5DwanXHsa", - "source_id": null, - "created_at": "2022-09-28T14:07:06.073Z", - "updated_at": null, - "status": "PAID", - "amount": 230000, - "discount_amount": 0, - "total_discount_amount": 0, - "total_amount": 230000, - "applied_discount_amount": 0, - "total_applied_discount_amount": 0, - "items": [ - { - "object": "order_item", - "product_id": "prod_0bae45ffc7003ffc52", - "quantity": 1, - "amount": 230000, - "price": 230000, - "subtotal_amount": 230000, - "product": { - "id": "prod_0bae45ffc7003ffc52", - "source_id": "second_product", - "name": "Samsung Phone 2", - "price": 230000 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_H0nXrItO1DNV3UiPIl54HA5o", - "object": "customer" - }, - "customer_id": "cust_H0nXrItO1DNV3UiPIl54HA5o", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0bc2d6f0ebc95f1783": { - "date": "2022-09-28T14:07:06.159Z", - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - } - } - }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_H0nXrItO1DNV3UiPIl54HA5o", - "name": "Bob Smith", - "email": "bob.smith.1@email.com", - "source_id": "bob.smith.1@email.com", - "metadata": { - "lang": "en", - "test": false - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "voucher": { - "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "code": "Test - FB - Vouchers - 9", - "campaign_id": null - } - }, - { - "id": "r_0bc2d3c4f7495f159a", - "object": "redemption", - "date": "2022-09-28T13:53:16.057Z", - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "tracking_id": "track_fxEMFisanb4sbl4Z4yCnJyDW013IrRbJmqKByTNHbXE=", - "metadata": {}, - "result": "SUCCESS", - "order": { - "id": "ord_ff6rwr58kmdyuLsi5orplnVW", - "source_id": null, - "created_at": "2022-09-28T13:53:14.604Z", - "updated_at": null, - "status": "PAID", - "amount": 230000, - "discount_amount": 800, - "total_discount_amount": 800, - "total_amount": 229200, - "applied_discount_amount": 800, - "total_applied_discount_amount": 800, - "items": [ - { - "object": "order_item", - "product_id": "prod_0bae45ffc7003ffc52", - "quantity": 1, - "amount": 230000, - "price": 230000, - "subtotal_amount": 230000, - "product": { - "id": "prod_0bae45ffc7003ffc52", - "source_id": "second_product", - "name": "Samsung Phone 2", - "price": 230000 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "object": "customer" - }, - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0bc2d3c4f7495f159a": { - "date": "2022-09-28T13:53:14.717Z", - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" - } - } - }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "name": "John Smith", - "email": "john.smith@email.com", - "source_id": "john.smith@email.com", - "metadata": { - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "voucher": { - "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", - "code": "Test - FB - Vouchers - 9", - "campaign_id": null - } - } + } + } + } + } + } + }, + "/v1/redemptions/{redemptionId}": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "redemptionId", + "in": "path", + "required": true, + "description": "ID of previously created redemption." + } + ], + "get": { + "operationId": "get-redemption", + "tags": [ + "REDEMPTIONS API" + ], + "summary": "Get Redemption", + "description": "Return a redemption or redemption rollback object. This object can either be a successfull or failed redemption or redemption rollback.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a redemption object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_res_get_redemption" + }, + "examples": { + "Discount Voucher": { + "value": { + "id": "r_0bade27c428db5873e", + "object": "redemption", + "date": "2022-09-12T07:29:28.211Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": {}, + "result": "SUCCESS", + "order": { + "id": "ord_ebmAU9uv3dTE2Khqyh7i5ka7", + "source_id": null, + "created_at": "2022-09-12T07:29:26.245Z", + "updated_at": null, + "status": "PAID", + "amount": 22500, + "discount_amount": 300, + "total_discount_amount": 300, + "total_amount": 22200, + "applied_discount_amount": 300, + "total_applied_discount_amount": 300, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b2c36568000039138", + "quantity": 1, + "amount": 22500, + "price": 22500, + "subtotal_amount": 22500, + "product": { + "id": "prod_0b2c36568000039138", + "source_id": "86", + "name": "[Sample] Able Brewing System", + "price": 22500 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0bade27c428db5873e": { + "date": "2022-09-12T07:29:26.282Z", + "related_object_type": "voucher", + "related_object_id": "v_c1yOEjZXOyVIe89VAYiRvL3QimZjXo8h" + } + } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "accepts_marketing": false + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_c1yOEjZXOyVIe89VAYiRvL3QimZjXo8h", + "voucher": { + "id": "v_c1yOEjZXOyVIe89VAYiRvL3QimZjXo8h", + "code": "FB-metadata-string", + "campaign": null, + "campaign_id": null, + "category": null, + "categories": [], + "discount": null, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "additional_info": null, + "assets": { + "qr": {}, + "barcode": {} + }, + "updated_at": null, + "object": "voucher" + } + } + }, + "Loyalty Card - Material Reward Product Type": { + "value": { + "id": "r_0c5bf0e6d601c7d7de", + "object": "redemption", + "date": "2023-01-25T12:08:09.503Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": {}, + "amount": 4, + "result": "SUCCESS", + "order": { + "id": "ord_dSOsWkNCRT24lHPkMu8o5QbX", + "source_id": null, + "created_at": "2023-01-25T12:08:07.750Z", + "updated_at": null, + "status": "PAID", + "items": [], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5bf0e6d601c7d7de": { + "date": "2023-01-25T12:08:07.768Z", + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + } + } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "categories": [], + "discount": null, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "additional_info": null, + "assets": { + "qr": {}, + "barcode": {} + }, + "updated_at": null, + "object": "voucher" + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_LRx3Y1iHFWTt217NVrknkpi5", + "product": { + "id": "prod_0b2c2ddf35150b83bb", + "source_id": "97", + "name": "[Sample] Tiered Wire Basket", + "price": 11995, + "attributes": [], + "metadata": { + "source": "bigcommerce", + "bigcommerce_product_categories": [ + 21, + 23 ] + }, + "image_url": null, + "created_at": "2022-06-03T13:36:16.084Z", + "updated_at": "2022-06-07T09:10:44.644Z", + "object": "product" + }, + "id": "rew_EPx1hCTpqzF0HW1z9NKckZH4", + "object": "reward", + "name": "Present", + "created_at": "2022-06-13T06:59:01.694Z", + "updated_at": null, + "parameters": { + "product": { + "id": "prod_0b2c2ddf35150b83bb", + "sku_id": null + } + }, + "type": "MATERIAL" + }, + "loyalty_card": { + "points": 4 + } + } + }, + "Loyalty Card - Material Reward SKU Type": { + "value": { + "id": "r_0c5bf18dad48a34392", + "object": "redemption", + "date": "2023-01-25T12:11:00.543Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": {}, + "amount": 6, + "result": "SUCCESS", + "order": { + "id": "ord_dwb6bpqjIlMuXFS71NuHed9S", + "source_id": null, + "created_at": "2023-01-25T12:10:58.598Z", + "updated_at": null, + "status": "PAID", + "items": [], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5bf18dad48a34392": { + "date": "2023-01-25T12:10:58.613Z", + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" } } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "categories": [], + "discount": null, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "additional_info": null, + "assets": { + "qr": {}, + "barcode": {} + }, + "updated_at": null, + "object": "voucher" + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_gfpRNkOT0pwzF7P5tXWXOs4H", + "product": { + "id": "prod_5h0wc453_2", + "source_id": "jonah-nystrom-bourbon", + "name": "Johan & Nyström - Bourbon", + "price": null, + "attributes": [ + "categories", + "description", + "weight" + ], + "metadata": { + "company": "Johan & Nyström", + "showcase": true + }, + "image_url": null, + "created_at": "2021-12-01T08:00:49.418Z", + "updated_at": null, + "object": "product" + }, + "sku": { + "id": "sku_0a3efc9044dd121803", + "source_id": "jonah-nystrom-bourbon-250g", + "product_id": "prod_5h0wc453_2", + "sku": "250g", + "price": 1750, + "currency": null, + "attributes": { + "categories": "Coffee, Whole Bean", + "description": "Background for this blend comes from the longing for a real dark roasting of high-quality coffee beans. Although the beans are dark roasted, they keep their clear and intense aroma. This coffee has a smoky flavour with a slight hint of sweetness and loads of fruit notes. Thanks to the experience in the dark roasting of coffee, the beans still retain most of their aromas. Its aftertaste is clear and remains for a long time. This coffee is perfect for a Dripper, French Press, Moka coffee maker and the traditional espresso brewing method.", + "weight": 250 + }, + "image_url": null, + "metadata": {}, + "created_at": "2021-12-01T08:00:49.427Z", + "updated_at": null, + "object": "sku" + }, + "id": "rew_SfQCsap5R8UBTVbdMTRx10x8", + "object": "reward", + "name": "Present - SKU", + "created_at": "2023-01-25T12:10:16.060Z", + "updated_at": null, + "parameters": { + "product": { + "id": "prod_5h0wc453_2", + "sku_id": "sku_0a3efc9044dd121803" + } + }, + "type": "MATERIAL" + }, + "loyalty_card": { + "points": 6 } } - } - } - } - }, - "post": { - "operationId": "redeem-voucher", - "deprecated": true, - "tags": [ - "REDEMPTIONS API" - ], - "summary": "Redeem Voucher [Deprecated]", - "description": "\n> ❗️ Deprecated \n>\n> 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](ref:redeem-stacked-discounts) 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. \n\nTo redeem a voucher, you create a redemption object. It increments the redemption counter and updates the history of the voucher. \n\n## How discounts and order amounts are calculated in the API response?\n\nIn the table below, you can see the logic the API follows to calculate discounts and amounts:\n\n| **Field** | **Calculation** | **Description** |\n|:---|:---|:---|\n| amount | N/A | This field shows the order amount before applying any discount |\n| total_amount | total_amount = amount - total_discount_amount | This field shows the order amount after applying all the discounts |\n| discount_amount | discount_amount = previous_discount_amount + applied_discount_amount | This field sums up all order-level discounts applied to a patricular order |\n| items_discount_amount | sum(items, i => i.discount_amount) | This field sums up all product-specific discounts applied to this order |\n| total_discount_amount | total_discount_amount = discount_amount + items_discount_amount | This field sums up all order-level and all product-specific discounts applied to this order |\n| applied_discount_amount | N/A | This field shows order-level discount applied in a particular request |\n| items_applied_discount_amount | sum(items, i => i.applied_discount_amount) | This field sums up all product-specific discounts applied in a particular request |\n| 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 |\n\n## SDKs \n\nYou can invoke the redemption endpoint with one of the official libraries: \n\n\n[block:html]\n{\n \"html\": \"
                  \\n\\n
                  \\n \\n
                  \\n\\n
                  \\n\\n
                  \\n\\n\\n
                  \\n\\n\\n\\n\\n\\n
                  \\n\\n
                  \\n
                  \\n\\n\"\n}\n[/block]\n\n## Customer tracking\n\nThe redeem operation is a key part of [Customer tracking] (doc:customer-tracking) workflow. There're 3 ways you can identify your end customer in Voucherify within this request. You can either provide a tracking ID (e.g. your customer's login or a generated id), a customer ID (if the customer is already stored in Voucherify) or a full `customer` object in the payload. Note that you can pass and thus store any customer-related metadata. See examples on the right.\n\n\n```json\n\"customer\": {\n \"source_id\": \"alice.morgan\",\n \"name\": \"Alice Morgan\",\n \"email\": \"alice@morgan.com\",\n \"description\": \"\",\n \"metadata\": {\n \"locale\": \"en-GB\",\n \"shoeSize\": 5,\n \"favourite_brands\": [\"Armani\", \"L’Autre Chose\", \"Vicini\"]\n }\n}\n```\n\nIf you already created a customer profile in Voucherify's database, whether it was implicitly by providing it to the redeem function or explicitly by invoking the [Create Customer](ref:create-customer) method, you can identify your customer in redemptions by a generated ID (starting with `cust_`). \n\n\n```json title=Example Customer Identifier [object]\n\"customer\": {\n \"id\": \"cust_C9qJ3xKgZFqkpMw7b21MF2ow\"\n}\n```\n\n```json title=Example Customer Identifier\n{\n \"customer\": \"cust_C9qJ3xKgZFqkpMw7b21MF2ow\"\n}\n```\n\n```json title=Example Customer Identifier by Source ID\n{\n \"customer\": \"alice.morgan\"\n}\n```\n\n\n> 📘 Redemption rollback\n>\n> Do you need to undo a redemption? You can do it with [redemption rollback](ref:rollback-redemption).\n\n## Redemption failures\n\nThere are several reasons why a redemption may fail. You will get the reason in the error key:\n - `resource_not_found` - voucher with given code does not exist\n- `voucher_not_active` - voucher is not active yet (before start date)\n- `voucher_expired` - voucher has already expired (after expiration date)\n- `voucher_disabled` - voucher has been disabled (`active: false`)\n- `quantity_exceeded` - voucher's redemptions limit has been exceeded\n- `gift_amount_exceeded` - gift amount has been exceeded\n- `customer_rules_violated` - customer did not match the segment\n- `order_rules_violated` - order did not match validation rules\n- `invalid_order` - order was specified incorrectly\n- `invalid_amount` - order amount was specified incorrectly\n- `missing_amount` - order amount was not specified\n- `missing_order_items` - order items were not specified\n- `missing_customer` - customer was not specified\n\n## Order object\n\nThe purchase of previously defined products (products are stored in Voucherify) by end customers is handled through the order object. You are obligated to pass the order object in case you use validation rules. You can learn more about the [validation rules structure] (doc:validation-rules). \n\n| **Attributes** | **Description** |\n|:---|:---|\n| amount
                  `integer` | A positive integer representing the total amount for the order. |\n| items
                  `list` | List of items constituting the order. Order items can be defined either by `product_id` or `sku_id`. Along with every item you must define the `quantity`.

                  Child attributes:

                  - `product_id` (*string*) - The ID of the associated product object for this line item.

                  - `sku_id` (*string*) - The ID of the associated variant (sku) object for this line item.

                  - `quantity` (*integer*) - A positive integer representing the number of instances of the item that are included in this order line.

                  - `price` (*integer*) - A positive integer representing the cost of an item.

                  - `amount` (*integer*) - `quantity` * `price` (you should provide it to retrieve `discount_amount` for a particular order item if the discount is applied only to this item learn more |\n\n\n\n\n> 🚧 Order ID\n>\n> If you use the same order id in more than one redemption request, all valid discounts provided in the redemption payload will be applied to the given order. [Read more in this guide] (https://docs.voucherify.io/docs/manage-stackable-discounts).\n\n\n```json title=Example Order\n\"order\": {\n \"amount\": 10000,\n \"items\": [\n {\n \"product_id\": \"prod_Bi7sRr3kwvxH2I\",\n \"quantity\": 1\n }\n ]\n}\n```\n## Gift Vouchers - redeem Gift Card and control redeemed amount\n\nIn Voucherify,you can also create a gift card for customers. Customers then can use gift card credits to fulfill the order. A user can specify how many credits he wants to use from the gift card. The available balance of credits is counted based on policy rules attached to the Gift Voucher definition.\n\nWhen the user wants to define how many gift credits are to be used from the gift card to complete the order, the `credits` property can be assigned the equivalent value in the lowest currency in the request body. The value of credits being applied to the order cannot be higher than the current balance on the gift card.\n\n\n```cURL title=Example Request - control redeemed amount\ncurl -i -X POST \\\n -H \"Content-Type:application/json\" \\\n -H \"X-App-Id:c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token:3266b9f8-e246-4f79-bdf0-833929b1380c\" \\\n -d '{\n \"order\": {\n \"amount\": 2500\n },\n \"gift\": {\n \"credits\": 1500\n }\n }' \\ \n 'https://api.voucherify.io/v1/vouchers/aDm4CRR3/redemption'\n```\n## Loyalty Coins - redeem loyalty card and pay with points\n\nVoucherify offers the possibility to set up a reward type in the Loyalty Program, which allows using loyalty points as gift credits. The available balance of credits is counted based on policy rules attached to the reward definition.\n\nIf a user configures just one reward type of paying in points, in the redemption request, there is no additional information required. Voucherify will automatically select as a proper reward definition and will calculate the discount based on the attached policy. \n\n\n```json title=Example Request\n{\n \"order\": {\n \"amount\": 25000,\n \"items\": [\n {\n \"product_id\": \"test_source_1\",\n \"quantity\": \"1\",\n \"price\": 15000\n },\n {\n \"product_id\": \"test_source_2\",\n \"quantity\": \"1\",\n \"price\": 10000\n }\n ]\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n }\n}\n```\n\n```json title=Example Response\n{\n \"id\": \"r_zv5Qn7cF68RbVX4foKxgwUi1\",\n \"object\": \"redemption\",\n \"date\": \"2020-05-24T13:44:20Z\",\n \"customer_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"amount\": 250,\n \"order\": {\n \"status\": \"PROCESSING\",\n \"items\": [\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_1\",\n \"quantity\": 1,\n \"amount\": 15000,\n \"price\": 15000\n },\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_2\",\n \"quantity\": 1,\n \"amount\": 10000,\n \"price\": 10000\n }\n ],\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"object\": \"customer\",\n \"referrals\": {\n \"campaigns\": [],\n \"total\": 0\n }\n },\n \"amount\": 25000,\n \"object\": \"order\",\n \"id\": \"ord_Tgi2ApelDyl86sm5AYDKCBMZ\",\n \"created_at\": \"2020-05-24T13:44:20Z\",\n \"discount_amount\": 25000\n },\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"reward\": {\n \"assignment_id\": \"rewa_pHilLjHWOD7oNjJZnog3VoEi\",\n \"loyalty_tier_id\": \"ltr_3q5dW6GaRC4QkA1oYmfGy1k1\",\n \"id\": \"rew_3qmzGPWJ7LfLXnPAjmbPacIl\",\n \"name\": \"1 point - 25 cents\",\n \"created_at\": \"2020-05-22T18:39:52Z\",\n \"updated_at\": \"2020-05-23T08:18:55Z\",\n \"parameters\": {\n \"automation_id\": null,\n \"coin\": {\n \"exchange_ratio\": 0.25\n }\n },\n \"type\": \"COIN\",\n \"object\": \"reward\"\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n },\n \"result\": \"SUCCESS\",\n \"tracking_id\": \"track_IWQYtuUE7phYpPzTHD5uwbyvlrO4nqyzipbQQtsHrRw=\",\n \"voucher\": {\n \"id\": \"v_wjgLC2lrQy1urPOdd35JX0RtkcOcQOmb\",\n \"code\": \"Dm1x8MuX\",\n \"campaign\": \"TestLoyalty-GivePoints\",\n \"campaign_id\": \"camp_qVVaC4vpVlof03eBi8qb5gE7\",\n \"category\": null,\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 489,\n \"balance\": 23\n },\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/Dm1x8MuX/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_quantity\": 8,\n \"url\": \"/v1/vouchers/Dm1x8MuX/redemptions?page=1&limit=10\",\n \"redeemed_points\": 466\n },\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX1+9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19NfR0ANlhLM7Df9Ec+xqTh6aTbHakk/Gzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF/BSQTyJx0YSK+HIUG9RGD+9rVhiC7+4WkSKrgAZ+NeqQBIqcespt8WWygXjfkvbyXBSF7Lg==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19NfR0ANlhLM7Df9Ec%2BxqTh6aTbHakk%2FGzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF%2FBSQTyJx0YSK%2BHIUG9RGD%2B9rVhiC7%2B4WkSKrgAZ%2BNeqQBIqcespt8WWygXjfkvbyXBSF7Lg%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"holder_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"updated_at\": \"2020-05-24T13:44:20Z\",\n \"holder\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"object\": \"voucher\",\n \"validation_rules_assignments\": {\n \"data\": [],\n \"object\": \"list\",\n \"total\": 0,\n \"data_ref\": \"data\"\n }\n }\n}\n```\n\nIn case the user wants to define how much he spends in points, it is configurable by property `points` in a request body.\n\n\n```json title=Example Request\n{\n \"reward\": {\n \"points\": 10\n },\n \"order\": {\n \"amount\": 25000,\n \"items\": [\n {\n \"product_id\": \"test_source_1\",\n \"quantity\": \"1\",\n \"price\": 15000\n },\n {\n \"product_id\": \"test_source_2\",\n \"quantity\": \"1\",\n \"price\": 10000\n }\n ]\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n }\n}\n```\n\n```json title=Example Response\n{\n \"id\": \"r_NJIfNYD8uc2lNm3YBAqXr3FF\",\n \"object\": \"redemption\",\n \"date\": \"2020-05-24T16:28:29Z\",\n \"customer_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"amount\": 10,\n \"order\": {\n \"status\": \"PROCESSING\",\n \"items\": [\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_1\",\n \"quantity\": 1,\n \"amount\": 15000,\n \"price\": 15000\n },\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_2\",\n \"quantity\": 1,\n \"amount\": 10000,\n \"price\": 10000\n }\n ],\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"object\": \"customer\",\n \"referrals\": {\n \"campaigns\": [],\n \"total\": 0\n }\n },\n \"amount\": 25000,\n \"object\": \"order\",\n \"id\": \"ord_70kKdXIKCSx5cfglKSpz9aHy\",\n \"created_at\": \"2020-05-24T16:28:29Z\",\n \"discount_amount\": 250\n },\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"reward\": {\n \"assignment_id\": \"rewa_pHilLjHWOD7oNjJZnog3VoEi\",\n \"loyalty_tier_id\": null,\n \"id\": \"rew_3qmzGPWJ7LfLXnPAjmbPacIl\",\n \"name\": \"1 point - 25 cents\",\n \"created_at\": \"2020-05-22T18:39:52Z\",\n \"updated_at\": \"2020-05-24T13:44:26Z\",\n \"parameters\": {\n \"automation_id\": null,\n \"coin\": {\n \"exchange_ratio\": 0.25\n }\n },\n \"type\": \"COIN\",\n \"object\": \"reward\"\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n },\n \"result\": \"SUCCESS\",\n \"tracking_id\": \"track_IWQYtuUE7phYpPzTHD5uwbyvlrO4nqyzipbQQtsHrRw=\",\n \"voucher\": {\n \"id\": \"v_wjgLC2lrQy1urPOdd35JX0RtkcOcQOmb\",\n \"code\": \"Dm1x8MuX\",\n \"campaign\": \"TestLoyalty-GivePoints\",\n \"campaign_id\": \"camp_qVVaC4vpVlof03eBi8qb5gE7\",\n \"category\": null,\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 539,\n \"balance\": 63\n },\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/Dm1x8MuX/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_quantity\": 9,\n \"url\": \"/v1/vouchers/Dm1x8MuX/redemptions?page=1&limit=10\",\n \"redeemed_points\": 476\n },\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX1+9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19NfR0ANlhLM7Df9Ec+xqTh6aTbHakk/Gzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF/BSQTyJx0YSK+HIUG9RGD+9rVhiC7+4WkSKrgAZ+NeqQBIqcespt8WWygXjfkvbyXBSF7Lg==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19NfR0ANlhLM7Df9Ec%2BxqTh6aTbHakk%2FGzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF%2FBSQTyJx0YSK%2BHIUG9RGD%2B9rVhiC7%2B4WkSKrgAZ%2BNeqQBIqcespt8WWygXjfkvbyXBSF7Lg%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"holder_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"updated_at\": \"2020-05-24T16:28:29Z\",\n \"holder\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"object\": \"voucher\",\n \"validation_rules_assignments\": {\n \"data\": [],\n \"object\": \"list\",\n \"total\": 0,\n \"data_ref\": \"data\"\n }\n }\n}\n```\n\nMoreover, it is possible to define many levels of reward in which collected points can be used as gift credits. Per each tier, we can implement different conversion factors. Having many options in the rewards catalog, we will need to select a coins calculation policy (reward ID) that we want to use for calculating a final discount in the redemption request.\n\n\n\n```json title=Example Request\n{\n \"reward\": {\n \"points\": 30,\n \"id\": \"rew_noP2S5H8PEBFT97mennSA531\"\n },\n \"order\": {\n \"amount\": 25000,\n \"items\": [\n {\n \"product_id\": \"test_source_1\",\n \"quantity\": \"1\",\n \"price\": 15000\n },\n {\n \"product_id\": \"test_source_2\",\n \"quantity\": \"1\",\n \"price\": 10000\n }\n ]\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n }\n}\n```\n\n```json title=Example Response\n{\n \"id\": \"r_se17sLon6YX5wMhYVzfQa2dc\",\n \"object\": \"redemption\",\n \"date\": \"2020-05-24T13:41:16Z\",\n \"customer_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"amount\": 10,\n \"order\": {\n \"status\": \"PROCESSING\",\n \"items\": [\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_1\",\n \"quantity\": 1,\n \"amount\": 15000,\n \"price\": 15000\n },\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_2\",\n \"quantity\": 1,\n \"amount\": 10000,\n \"price\": 10000\n }\n ],\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"object\": \"customer\",\n \"referrals\": {\n \"campaigns\": [],\n \"total\": 0\n }\n },\n \"amount\": 25000,\n \"object\": \"order\",\n \"id\": \"ord_EfMmve84JzQIg2MCM3cAvLgF\",\n \"created_at\": \"2020-05-24T13:41:16Z\",\n \"discount_amount\": 25000\n },\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"reward\": {\n \"assignment_id\": \"rewa_g3QQwQfhJrjBYzEa1NJkub7N\",\n \"loyalty_tier_id\": null,\n \"id\": \"rew_noP2S5H8PEBFT97mennSA531\",\n \"name\": \"1 point 25$\",\n \"created_at\": \"2020-05-24T12:57:19Z\",\n \"parameters\": {\n \"automation_id\": null,\n \"coin\": {\n \"exchange_ratio\": 25.0\n }\n },\n \"type\": \"COIN\",\n \"object\": \"reward\"\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n },\n \"result\": \"SUCCESS\",\n \"tracking_id\": \"track_IWQYtuUE7phYpPzTHD5uwbyvlrO4nqyzipbQQtsHrRw=\",\n \"voucher\": {\n \"id\": \"v_wjgLC2lrQy1urPOdd35JX0RtkcOcQOmb\",\n \"code\": \"Dm1x8MuX\",\n \"campaign\": \"TestLoyalty-GivePoints\",\n \"campaign_id\": \"camp_qVVaC4vpVlof03eBi8qb5gE7\",\n \"category\": null,\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 439,\n \"balance\": 223\n },\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/Dm1x8MuX/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_quantity\": 7,\n \"url\": \"/v1/vouchers/Dm1x8MuX/redemptions?page=1&limit=10\",\n \"redeemed_points\": 216\n },\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX1+9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19NfR0ANlhLM7Df9Ec+xqTh6aTbHakk/Gzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF/BSQTyJx0YSK+HIUG9RGD+9rVhiC7+4WkSKrgAZ+NeqQBIqcespt8WWygXjfkvbyXBSF7Lg==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19NfR0ANlhLM7Df9Ec%2BxqTh6aTbHakk%2FGzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF%2FBSQTyJx0YSK%2BHIUG9RGD%2B9rVhiC7%2B4WkSKrgAZ%2BNeqQBIqcespt8WWygXjfkvbyXBSF7Lg%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"holder_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"updated_at\": \"2020-05-24T13:41:16Z\",\n \"holder\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"object\": \"voucher\",\n \"validation_rules_assignments\": {\n \"data\": [],\n \"object\": \"list\",\n \"total\": 0,\n \"data_ref\": \"data\"\n }\n }\n}\n```", - "parameters": [ - { - "schema": { - "type": "string" }, - "in": "query", - "name": "tracking_id", - "description": "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 returnee by [voucher validation](ref:validate-voucher), or a string identifying customer, with the options described below. **Although not all information is required, the extra info helps prevent fraud.**" - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Provide the redemption context in the request body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/7_req_redeem_voucher" + "Loyalty Card - Pay with Points": { + "value": { + "id": "r_0b5e402ad54a3afe9c", + "object": "redemption", + "date": "2022-07-12T11:00:26.247Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 5, + "redemption": "r_0b5e402ad50a3afe98", + "result": "SUCCESS", + "order": { + "id": "ord_9akjPYZNskEhKZ4zCZt6TKwq", + "source_id": null, + "created_at": "2022-07-12T11:00:26.224Z", + "amount": 20000, + "discount_amount": 5100, + "total_discount_amount": 5100, + "total_amount": 14900, + "applied_discount_amount": 500, + "total_applied_discount_amount": 500, + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "channel": { + "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", + "channel_type": "API" + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "accepts_marketing": false + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_pQZDYaH8LzoOvgh3234DqZQjGJgbPov6", + "voucher": { + "id": "v_pQZDYaH8LzoOvgh3234DqZQjGJgbPov6", + "code": "LOYALTY-CARD-zOR2sV9Q", + "campaign": "Loyalty Program", + "campaign_id": "camp_Hpt5hPTA8kSKRWGxBGw8Y0So", + "category": null, + "categories": [], + "discount": null, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "additional_info": null, + "assets": { + "qr": {}, + "barcode": {} + }, + "updated_at": null, + "object": "voucher" + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "accepts_marketing": false + }, + "object": "customer" + }, + "assignment_id": "rewa_X3jnD5XFxP6GXCzPZUNknDck", + "id": "rew_6rhNwuuWFQJLvTPO34ilg6jq", + "object": "reward", + "name": "Pay with Points", + "created_at": "2022-07-11T08:18:18.205Z", + "updated_at": null, + "parameters": { + "coin": { + "exchange_ratio": 1, + "points_ratio": 1 + } + }, + "type": "COIN" + }, + "loyalty_card": { + "points": 5 + } } - } - } - }, - "responses": { - "200": { - "description": "Returns a redemption object if the redeem operation succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/7_res_redeem_voucher" + }, + "Loyalty Card - Digital Reward - Discount Voucher": { + "value": { + "id": "r_0c5bf3323008a35032", + "object": "redemption", + "date": "2023-01-25T12:18:10.707Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": { + "redemption_location": { + "city": "Warsaw", + "state": "Polyork" + } }, - "examples": { - "Gift Voucher": { - "value": { - "id": "r_0c5e8a38730ccec0d5", - "object": "redemption", - "date": "2023-01-27T12:34:57.100Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 2000, - "result": "SUCCESS", - "order": { - "id": "ord_S4BvUj64TlGqVZDOeud7z3rU", - "source_id": null, - "created_at": "2023-01-27T12:34:57.086Z", - "updated_at": null, - "status": "PAID", - "amount": 6000, - "discount_amount": 2000, - "total_discount_amount": 2000, - "total_amount": 4000, - "applied_discount_amount": 2000, - "total_applied_discount_amount": 2000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 3300, - "price": 3000, - "subtotal_amount": 3300 - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 2, - "amount": 3400, - "price": 3000, - "subtotal_amount": 3400 - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5e8a38730ccec0d5": { - "date": "2023-01-27T12:34:57.100Z", - "related_object_type": "voucher", - "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", - "related_object_parent_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6" - } - } - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", - "voucher": { - "id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", - "code": "CODE14", - "campaign": "Gift Card Campaign", - "campaign_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6", - "category": "Second", - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [], - "type": "GIFT_VOUCHER", - "discount": null, - "gift": { - "amount": 2000, - "balance": 0, - "effect": null - }, - "loyalty_card": null, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": "secret-code1", - "metadata": { - "region": "APAC", - "season": "Fall" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+VibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BVibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/GVIi0p5fL5hxAY/ZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd//S4R9AB+60T/x4kSKu3lgfa9KgJmbyrzXm7Ggly06/qph4/asJaZVZIXEba4WJCeHqXCEgg==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FGVIi0p5fL5hxAY%2FZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd%2F%2FS4R9AB%2B60T%2Fx4kSKu3lgfa9KgJmbyrzXm7Ggly06%2Fqph4%2FasJaZVZIXEba4WJCeHqXCEgg%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-23T11:05:42.164Z", - "updated_at": "2023-01-27T12:34:57.102Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": 18, - "redeemed_quantity": 1, - "redeemed_amount": 2000, - "object": "list", - "url": "/v1/vouchers/CODE14/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/CODE14/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - } - }, - "gift": { - "amount": 2000 + "amount": 2, + "result": "SUCCESS", + "order": { + "id": "ord_dqxr4uzaYWkTZnrSEMoQtCF8", + "source_id": null, + "created_at": "2023-01-25T12:18:09.203Z", + "updated_at": null, + "status": "PAID", + "amount": 2100, + "total_amount": 2100, + "items": [ + { + "object": "order_item", + "product_id": "prod_0bc3bd8a4e072c5275", + "quantity": 3, + "amount": 2100, + "price": 700, + "subtotal_amount": 2100, + "product": { + "id": "prod_0bc3bd8a4e072c5275", + "name": "Bouquet - Romantic Roses", + "price": 700 } } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" }, - "Discount Coupon": { - "value": { - "id": "r_0c5e8ef10842da0aad", - "object": "redemption", - "date": "2023-01-27T12:55:34.689Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "result": "SUCCESS", - "order": { - "id": "ord_J5ogV1Gkk2yfxmBEhYIg4O65", - "source_id": null, - "created_at": "2023-01-27T12:55:34.673Z", - "updated_at": null, - "status": "PAID", - "amount": 6000, - "items_discount_amount": 300, - "total_discount_amount": 300, - "total_amount": 5700, - "items_applied_discount_amount": 300, - "total_applied_discount_amount": 300, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 3300, - "discount_amount": 148, - "applied_discount_amount": 148, - "price": 3000, - "subtotal_amount": 3152 - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 2, - "amount": 3400, - "discount_amount": 152, - "applied_discount_amount": 152, - "price": 3000, - "subtotal_amount": 3248 - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5e8ef10842da0aad": { - "date": "2023-01-27T12:55:34.689Z", - "related_object_type": "voucher", - "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u" - } - } - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5bf3323008a35032": { + "date": "2023-01-25T12:18:09.216Z", "related_object_type": "voucher", - "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "voucher": { - "id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "code": "2CpRCE2c", - "campaign": null, - "campaign_id": null, - "category": null, - "category_id": null, - "categories": [], - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 300, - "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" - }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1+ro/6HLsfI9E/rz0QEoYv+rcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz+WQtg4nKpjUS0wcA7AuIbz2zb870YfJO/r5UBS5gCqQ==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bro%2F6HLsfI9E%2Frz0QEoYv%2BrcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz%2BWQtg4nKpjUS0wcA7AuIbz2zb870YfJO%2Fr5UBS5gCqQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3/4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ+aTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3%2F4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ%2BaTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-19T10:06:07.932Z", - "updated_at": "2023-01-27T12:55:34.690Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_HesdqEzt5e9c0T56", - "rule_id": "val_gZft0NKZSUWK", - "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "related_object_type": "voucher", - "object": "validation_rules_assignment" - } - ], - "total": 1 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 2, - "object": "list", - "url": "/v1/vouchers/2CpRCE2c/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/2CpRCE2c/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [ - { - "object": "product", - "id": "prod_0a9f9ab4ab019a42d5", - "source_id": "prod_0a9f9ab4ab019a42d5", - "strict": true, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0a9f9aeddb019a42db", - "source_id": "prod_0a9f9aeddb019a42db", - "strict": true, - "effect": "APPLY_TO_EVERY" - } - ], - "total": 2, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - } + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + } + } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "categories": [], + "discount": null, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "additional_info": null, + "assets": { + "qr": {}, + "barcode": {} + }, + "updated_at": null, + "object": "voucher" + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_0ZwLAHgeU9IrI2V1ofYRmW7g", + "voucher": { + "id": "v_4GaEX7clyqMaveT7vHhoyRpsIgxv95Q6", + "code": "HAPPY-ORDER5My", + "campaign": "$20 off the entire order", + "campaign_id": "camp_5h0wc453_4", + "category": null, + "category_id": "cat_0b688929a2476386a6", + "categories": [], + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 2000, + "effect": "APPLY_TO_ORDER" + }, + "gift": null, + "loyalty_card": null, + "start_date": "2022-09-20T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "21ceb848-4869-4dac-ba41-f854bda3a101", + "url": "https://dl.voucherify.io/api/v1/assets/qr/21ceb848-4869-4dac-ba41-f854bda3a101" + }, + "barcode": { + "id": "1dba9cb2-fb28-4c8d-8548-5edb2eb01f5a", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/1dba9cb2-fb28-4c8d-8548-5edb2eb01f5a" + } + }, + "is_referral_code": false, + "created_at": "2023-01-25T12:18:09.256Z", + "updated_at": null, + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/HAPPY-ORDER5My/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/HAPPY-ORDER5My/publications?page=1&limit=10" + }, + "object": "voucher" + }, + "id": "rew_MF4hKh1IKYgJkPjbcFbH94Ho", + "object": "reward", + "name": "Digital Present", + "created_at": "2023-01-25T12:16:44.557Z", + "updated_at": null, + "parameters": { + "campaign": { + "id": "camp_5h0wc453_4", + "type": "DISCOUNT_COUPONS" + } + }, + "type": "CAMPAIGN" + }, + "loyalty_card": { + "points": 2 + } + } + }, + "Loyalty Card - Digital Reward - Credits on Gift Card": { + "value": { + "id": "r_0c5c1435d053202118", + "object": "redemption", + "date": "2023-01-25T14:42:25.206Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": {}, + "amount": 1, + "result": "SUCCESS", + "order": { + "id": "ord_v0r7JfUQgWRpw28UJm9Z5AaH", + "source_id": null, + "created_at": "2023-01-25T14:42:23.637Z", + "updated_at": null, + "status": "PAID", + "amount": 22500, + "total_amount": 22500, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b2c36568000039138", + "quantity": 1, + "amount": 22500, + "price": 22500, + "subtotal_amount": 22500, + "product": { + "id": "prod_0b2c36568000039138", + "source_id": "86", + "name": "[Sample] Able Brewing System", + "price": 22500 } } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" }, - "Loyalty Card": { - "value": { - "id": "r_0c5e8f2cd78497a372", - "object": "redemption", - "date": "2023-01-27T12:56:35.934Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 300, - "result": "SUCCESS", - "order": { - "id": "ord_MGTimoN4VtSj7iT75bP01FsH", - "source_id": null, - "created_at": "2023-01-27T12:56:35.923Z", - "updated_at": null, - "status": "PAID", - "amount": 6000, - "discount_amount": 6000, - "total_discount_amount": 6000, - "total_amount": 0, - "applied_discount_amount": 6000, - "total_applied_discount_amount": 6000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 3300, - "price": 3000, - "subtotal_amount": 3300 - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 2, - "amount": 3400, - "price": 3000, - "subtotal_amount": 3400 - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5e8f2cd78497a372": { - "date": "2023-01-27T12:56:35.934Z", - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" - } - } - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5c1435d053202118": { + "date": "2023-01-25T14:42:23.681Z", "related_object_type": "voucher", "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 6500, - "balance": 5086 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-11-10T06:28:59.970Z", - "updated_at": "2023-01-27T12:56:35.935Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "holder": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 10, - "redeemed_points": 1414, - "object": "list", - "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - } - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", - "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "object": "reward", - "name": "100 = $20", - "created_at": "2022-11-10T06:28:39.582Z", - "updated_at": null, - "parameters": { - "coin": { - "exchange_ratio": 20, - "points_ratio": 100 - } - }, - "type": "COIN" - }, - "loyalty_card": { - "points": 300 - } + "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" } } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "categories": [], + "discount": null, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "additional_info": null, + "assets": { + "qr": {}, + "barcode": {} + }, + "updated_at": null, + "object": "voucher" + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_U554pL2BhDIDZOvZ8y9YQ9hA", + "voucher": { + "id": "v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk", + "code": "GIFT-CARD-xwc6X7Tk", + "campaign": "Gift Cards", + "campaign_id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "GIFT_VOUCHER", + "discount": null, + "gift": { + "amount": 55080, + "balance": 44780 + }, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM/aTyHCYfr7kRWb2vv08WIgY/Tv53SJGW+k2keqfsTq/Ohb5shkCN3FTFsaI8gulTp616sEGn/JJoIInIoNkO9Vd1+AfrKiAjmirCmekE6cz2SVCyNAXs=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM%2FaTyHCYfr7kRWb2vv08WIgY%2FTv53SJGW%2Bk2keqfsTq%2FOhb5shkCN3FTFsaI8gulTp616sEGn%2FJJoIInIoNkO9Vd1%2BAfrKiAjmirCmekE6cz2SVCyNAXs%3D" + }, + "barcode": { + "id": "U2FsdGVkX18vWc/qplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO/199U+zicnFNWqg/jF5ZCQW+6jO1q8=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18vWc%2FqplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO%2F199U%2BzicnFNWqg%2FjF5ZCQW%2B6jO1q8%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-07-08T09:44:33.179Z", + "updated_at": "2023-01-11T15:23:02.789Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "redemption": { + "quantity": null, + "redeemed_quantity": 7, + "redeemed_amount": 10300, + "object": "list", + "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/publications?page=1&limit=10" + }, + "object": "voucher" + }, + "id": "rew_6bvM4vnaVdbPVQxYpuN37rhH", + "object": "reward", + "name": "Present Credits on Gift Card", + "created_at": "2023-01-25T14:41:31.858Z", + "updated_at": null, + "parameters": { + "campaign": { + "id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", + "balance": 4000, + "type": "GIFT_VOUCHERS" + } + }, + "type": "CAMPAIGN" + }, + "loyalty_card": { + "points": 1 } } - } - }, - "400": { - "description": "Returns an error if something goes wrong. A common source of error is an invalid or expired voucher, or a valid gift voucher with insufficient available balance.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_expanded" - }, - "examples": { - "Voucher disabled": { - "value": { - "code": 400, - "key": "voucher_disabled", - "message": "voucher is disabled", - "details": "AnsvocvP", - "request_id": "v-0c5d710a63c4110ae9", - "resource_id": "rf_0c5d710a87c8a31f86", - "resource_type": "redemption", - "error": { - "message": "The voucher has been disabled and cannot be used." + }, + "Loyalty Card - Digital Reward - Points on Loyalty Card": { + "value": { + "id": "r_0c5c226f498f1a93f0", + "object": "redemption", + "date": "2023-01-25T15:44:34.317Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": {}, + "amount": 1, + "result": "SUCCESS", + "order": { + "id": "ord_1fv4ITwpUQra6iDTHFPVfnRR", + "source_id": null, + "created_at": "2023-01-25T15:44:32.494Z", + "updated_at": null, + "status": "PAID", + "amount": 700, + "total_amount": 700, + "items": [ + { + "object": "order_item", + "product_id": "prod_0bc3bd8a4e072c5275", + "quantity": 1, + "amount": 700, + "price": 700, + "subtotal_amount": 700, + "product": { + "id": "prod_0bc3bd8a4e072c5275", + "name": "Bouquet - Romantic Roses", + "price": 700 } } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" }, - "Invalid Customer": { - "value": { - "code": 400, - "key": "invalid_customer", - "message": "Customer must be a holder of a loyalty card.", - "details": "AnsvocvP", - "request_id": "v-0c5e628bd14411244b", - "resource_id": "rf_0c5e628bf841c7f248", - "resource_type": "redemption", - "error": { - "message": "The customer is invalid." - } + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5c226f498f1a93f0": { + "date": "2023-01-25T15:44:32.550Z", + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" } + } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" }, - "Voucher Inactive": { - "value": { - "code": 400, - "key": "voucher_not_active_now", - "message": "voucher not active now", - "details": "CODE14", - "request_id": "v-0c5e89b9300d820994", - "resource_id": "rf_0c5e89b945d33b9c02", - "resource_type": "redemption", - "error": { - "message": "The voucher is not active in the given timeframe." + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "categories": [], + "discount": null, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "additional_info": null, + "assets": { + "qr": {}, + "barcode": {} + }, + "updated_at": null, + "object": "voucher" + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_BpytIepuSekuXXwb9qkLJfCU", + "voucher": { + "id": "v_pQZDYaH8LzoOvgh3234DqZQjGJgbPov6", + "code": "LOYALTY-CARD-zOR2sV9Q", + "campaign": "Loyalty Program", + "campaign_id": "camp_Hpt5hPTA8kSKRWGxBGw8Y0So", + "category": null, + "category_id": null, + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 1000, + "balance": 870 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/THRRj1QegAan0r5U+wRoHuFEA6FR7TrvZm8N+8cK7niF/8uAqFdVYTU1JD0/CdoSXlYqiGgz3PAFOGWFSJt8vkM50fcMtMNLsaudU+YrPDeT2HCB7o0Ts7h1FnbD85+0F7lwrbKmkGW6kub0mjCaRdJYS/axIAq4=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FTHRRj1QegAan0r5U%2BwRoHuFEA6FR7TrvZm8N%2B8cK7niF%2F8uAqFdVYTU1JD0%2FCdoSXlYqiGgz3PAFOGWFSJt8vkM50fcMtMNLsaudU%2BYrPDeT2HCB7o0Ts7h1FnbD85%2B0F7lwrbKmkGW6kub0mjCaRdJYS%2FaxIAq4%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+yREd0zRAfZY9uwtMZsl4eDd8+LeiKGVI5OzOQRpjhtV91IuEe7/SXEW8m4F2Llg2//yieX2zsP3UtWasWxw8ZkHMRSIdxfxzSdSj8ap0dI5xwKW4OE1Q6Sgsb+kZVfCKUHbwXCcd8y5a6xTpVIg97y74Ng1Vg2PY=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2ByREd0zRAfZY9uwtMZsl4eDd8%2BLeiKGVI5OzOQRpjhtV91IuEe7%2FSXEW8m4F2Llg2%2F%2FyieX2zsP3UtWasWxw8ZkHMRSIdxfxzSdSj8ap0dI5xwKW4OE1Q6Sgsb%2BkZVfCKUHbwXCcd8y5a6xTpVIg97y74Ng1Vg2PY%3D" } + }, + "is_referral_code": false, + "created_at": "2022-07-11T08:19:28.780Z", + "updated_at": "2022-10-01T00:02:05.604Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "redemption": { + "quantity": null, + "redeemed_quantity": 26, + "redeemed_points": 130, + "object": "list", + "url": "/v1/vouchers/LOYALTY-CARD-zOR2sV9Q/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/LOYALTY-CARD-zOR2sV9Q/publications?page=1&limit=10" + }, + "object": "voucher" + }, + "id": "rew_7ZM476Q77dH5KvHk4KzoRNvF", + "object": "reward", + "name": "Present on Loyalty Card", + "created_at": "2023-01-25T15:43:40.716Z", + "updated_at": null, + "parameters": { + "campaign": { + "id": "camp_Hpt5hPTA8kSKRWGxBGw8Y0So", + "balance": 20, + "type": "LOYALTY_PROGRAM" } - } + }, + "type": "CAMPAIGN" + }, + "loyalty_card": { + "points": 1 } } - } - } - } - } - }, - "/client/v1/redeem": { - "post": { - "operationId": "redeem-voucher-client-side", - "deprecated": true, - "tags": [ - "REDEMPTIONS API" - ], - "summary": "Redeem Voucher (client-side) [Deprecated]", - "description": "\n> ❗️ Deprecated \n>\n> 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](ref:redeem-stacked-discounts-client-side) 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. \n\nTo 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). \n\nThe client-side redemption works similar to the server-side [voucher redemption](ref:redeem-voucher) endpoint. The difference lies in the authorization. For the client-side, you can use client-side keys.\n\n\n> 📘 Opt-in \n>\n> By default this feature is disabled. If you want to use it, you will need to enable the function explicitly in **Project Settings**.\n\n\n> ❗️ Security Threat \n>\n> 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.\n\n### Expand Response\nYou may expand the response by adding the following object to your request body. The expanded response will include the category details of the voucher.\n\n```json\n{\n \"options\": {\n \"expand\": [\n \"category\"\n ]\n }\n}\n```", - "parameters": [ - { - "$ref": "#/components/parameters/origin" - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "code", - "description": "Voucher code being redeemed.", - "required": true - }, - { - "schema": { - "type": "string" }, - "in": "query", - "name": "tracking_id", - "description": "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](ref:validate-voucher), or a string identifying customer, with the options described below. Although not all information is required, the extra info helps prevent fraud." - } - ], - "security": [ - { - "X-Client-Application-Id-1": [], - "X-Client-Token-1": [] - } - ], - "requestBody": { - "description": "Provide the redemption context in the request body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/7_req_redeem_voucher" - } - } - } - }, - "responses": { - "200": { - "description": "Returns a redemption object if the redeem operation succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/7_res_redeem_voucher" + "Gift Card": { + "value": { + "id": "r_0b5e7d29ba4fb72ee4", + "object": "redemption", + "date": "2022-07-12T15:26:52.777Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 5000, + "redemption": "r_0b5e7d29ba0fb72ee2", + "result": "SUCCESS", + "order": { + "id": "ord_5iOTjTG4I3Yo2G2bH1qHk66a", + "source_id": null, + "created_at": "2022-07-12T15:26:52.773Z", + "amount": 30200, + "discount_amount": 9530, + "total_discount_amount": 9530, + "total_amount": 20670, + "applied_discount_amount": 5000, + "total_applied_discount_amount": 5000, + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "channel": { + "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", + "channel_type": "API" + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "accepts_marketing": false + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk", + "voucher": { + "id": "v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk", + "code": "GIFT-CARD-xwc6X7Tk", + "campaign": "Gift Cards", + "campaign_id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", + "category": null, + "categories": [], + "discount": null, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "additional_info": null, + "assets": { + "qr": {}, + "barcode": {} + }, + "updated_at": null, + "object": "voucher" }, - "examples": { - "Gift Voucher": { - "value": { - "id": "r_0c5e8a38730ccec0d5", - "object": "redemption", - "date": "2023-01-27T12:34:57.100Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 2000, - "result": "SUCCESS", - "order": { - "id": "ord_S4BvUj64TlGqVZDOeud7z3rU", - "source_id": null, - "created_at": "2023-01-27T12:34:57.086Z", - "updated_at": null, - "status": "PAID", - "amount": 6000, - "discount_amount": 2000, - "total_discount_amount": 2000, - "total_amount": 4000, - "applied_discount_amount": 2000, - "total_applied_discount_amount": 2000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 3300, - "price": 3000, - "subtotal_amount": 3300 - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 2, - "amount": 3400, - "price": 3000, - "subtotal_amount": 3400 - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5e8a38730ccec0d5": { - "date": "2023-01-27T12:34:57.100Z", - "related_object_type": "voucher", - "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", - "related_object_parent_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6" - } - } - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", - "voucher": { - "id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", - "code": "CODE14", - "campaign": "Gift Card Campaign", - "campaign_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6", - "category": "Second", - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [], - "type": "GIFT_VOUCHER", - "discount": null, - "gift": { - "amount": 2000, - "balance": 0, - "effect": null - }, - "loyalty_card": null, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": "secret-code1", + "gift": { + "amount": 5000 + } + } + }, + "Promotion Tier": { + "value": { + "id": "r_0c5d6689b35320059a", + "object": "redemption", + "date": "2023-01-26T15:20:35.916Z", + "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==", + "metadata": null, + "result": "SUCCESS", + "order": { + "id": "ord_4kVJ1PiXP3TNfik3pM79KZsn", + "source_id": null, + "created_at": "2023-01-26T15:20:34.216Z", + "updated_at": null, + "status": "PAID", + "amount": 200000, + "discount_amount": 80000, + "total_discount_amount": 80000, + "total_amount": 120000, + "applied_discount_amount": 80000, + "total_applied_discount_amount": 80000, + "items": [ + { + "object": "order_item", + "source_id": "apple534", + "related_object": "product", + "product_id": "prod_anJ03RZZq74z4v", + "quantity": 2, + "amount": 100000, + "price": 50000, + "subtotal_amount": 100000, + "product": { + "name": "Apple iPhone 8", "metadata": { - "region": "APAC", - "season": "Fall" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+VibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BVibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/GVIi0p5fL5hxAY/ZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd//S4R9AB+60T/x4kSKu3lgfa9KgJmbyrzXm7Ggly06/qph4/asJaZVZIXEba4WJCeHqXCEgg==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FGVIi0p5fL5hxAY%2FZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd%2F%2FS4R9AB%2B60T%2Fx4kSKu3lgfa9KgJmbyrzXm7Ggly06%2Fqph4%2FasJaZVZIXEba4WJCeHqXCEgg%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-23T11:05:42.164Z", - "updated_at": "2023-01-27T12:34:57.102Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": 18, - "redeemed_quantity": 1, - "redeemed_amount": 2000, - "object": "list", - "url": "/v1/vouchers/CODE14/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/CODE14/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" + "shop": "citycenter", + "category": "electronics" } }, - "gift": { - "amount": 2000 + "metadata": { + "series": "2022-783CV" } - } - }, - "Discount Coupon": { - "value": { - "id": "r_0c5e8ef10842da0aad", - "object": "redemption", - "date": "2023-01-27T12:55:34.689Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "result": "SUCCESS", - "order": { - "id": "ord_J5ogV1Gkk2yfxmBEhYIg4O65", - "source_id": null, - "created_at": "2023-01-27T12:55:34.673Z", - "updated_at": null, - "status": "PAID", - "amount": 6000, - "items_discount_amount": 300, - "total_discount_amount": 300, - "total_amount": 5700, - "items_applied_discount_amount": 300, - "total_applied_discount_amount": 300, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 3300, - "discount_amount": 148, - "applied_discount_amount": 148, - "price": 3000, - "subtotal_amount": 3152 - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 2, - "amount": 3400, - "discount_amount": 152, - "applied_discount_amount": 152, - "price": 3000, - "subtotal_amount": 3248 - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5e8ef10842da0aad": { - "date": "2023-01-27T12:55:34.689Z", - "related_object_type": "voucher", - "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u" - } - } - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", + }, + { + "object": "order_item", + "source_id": "apple534-ihd5", + "related_object": "sku", + "sku_id": "sku_0KtP4rvwEECQ2U", + "quantity": 1, + "amount": 100000, + "price": 100000, + "subtotal_amount": 100000, + "sku": { + "sku": "Apple iPad 10 Silver 64GB", "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "voucher": { - "id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "code": "2CpRCE2c", - "campaign": null, - "campaign_id": null, - "category": null, - "category_id": null, - "categories": [], - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 300, - "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" - }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1+ro/6HLsfI9E/rz0QEoYv+rcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz+WQtg4nKpjUS0wcA7AuIbz2zb870YfJO/r5UBS5gCqQ==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bro%2F6HLsfI9E%2Frz0QEoYv%2BrcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz%2BWQtg4nKpjUS0wcA7AuIbz2zb870YfJO%2Fr5UBS5gCqQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3/4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ+aTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3%2F4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ%2BaTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-19T10:06:07.932Z", - "updated_at": "2023-01-27T12:55:34.690Z", - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_HesdqEzt5e9c0T56", - "rule_id": "val_gZft0NKZSUWK", - "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "related_object_type": "voucher", - "object": "validation_rules_assignment" - } - ], - "total": 1 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 2, - "object": "list", - "url": "/v1/vouchers/2CpRCE2c/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/2CpRCE2c/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [ - { - "object": "product", - "id": "prod_0a9f9ab4ab019a42d5", - "source_id": "prod_0a9f9ab4ab019a42d5", - "strict": true, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0a9f9aeddb019a42db", - "source_id": "prod_0a9f9aeddb019a42db", - "strict": true, - "effect": "APPLY_TO_EVERY" - } - ], - "total": 2, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" + "category": "electronics" } } } + ], + "metadata": {}, + "customer": { + "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "object": "customer" }, - "Loyalty Card": { - "value": { - "id": "r_0c5e8f2cd78497a372", - "object": "redemption", - "date": "2023-01-27T12:56:35.934Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 300, - "result": "SUCCESS", - "order": { - "id": "ord_MGTimoN4VtSj7iT75bP01FsH", - "source_id": null, - "created_at": "2023-01-27T12:56:35.923Z", - "updated_at": null, - "status": "PAID", - "amount": 6000, - "discount_amount": 6000, - "total_discount_amount": 6000, - "total_amount": 0, - "applied_discount_amount": 6000, - "total_applied_discount_amount": 6000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 3300, - "price": 3000, - "subtotal_amount": 3300 - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 2, - "amount": 3400, - "price": 3000, - "subtotal_amount": 3400 - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5e8f2cd78497a372": { - "date": "2023-01-27T12:56:35.934Z", - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" - } - } - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 6500, - "balance": 5086 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-11-10T06:28:59.970Z", - "updated_at": "2023-01-27T12:56:35.935Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "holder": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 10, - "redeemed_points": 1414, - "object": "list", - "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - } - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", - "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "object": "reward", - "name": "100 = $20", - "created_at": "2022-11-10T06:28:39.582Z", - "updated_at": null, - "parameters": { - "coin": { - "exchange_ratio": 20, - "points_ratio": 100 - } - }, - "type": "COIN" - }, - "loyalty_card": { - "points": 300 - } + "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5d6689b35320059a": { + "date": "2023-01-26T15:20:34.253Z", + "related_object_type": "promotion_tier", + "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "related_object_parent_id": "camp_w7BUstntAm8jbIDjfM49volj" } } + }, + "channel": { + "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", + "channel_type": "API" + }, + "customer": { + "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "name": "Annie Lemon", + "email": "annie@lemon.com", + "source_id": "annie@lemon.com", + "object": "customer" + }, + "related_object_type": "promotion_tier", + "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "voucher": null, + "promotion_tier": { + "id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "action": null, + "campaign": { + "id": "camp_w7BUstntAm8jbIDjfM49volj", + "start_date": null, + "expiration_date": null, + "object": "campaign" + }, + "campaign_id": null, + "summary": { + "redemptions": { + "total_redeemed": 0 + }, + "orders": { + "total_amount": 0, + "total_discount_amount": 0 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": null } } - } - }, - "400": { - "description": "Returns an error if something goes wrong. A common source of error is an invalid or expired voucher, or a valid gift voucher with insufficient available balance.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_expanded" - }, - "examples": { - "Voucher disabled": { - "value": { - "code": 400, - "key": "voucher_disabled", - "message": "voucher is disabled", - "details": "AnsvocvP", - "request_id": "v-0c5d710a63c4110ae9", - "resource_id": "rf_0c5d710a87c8a31f86", - "resource_type": "redemption", - "error": { - "message": "The voucher has been disabled and cannot be used." - } - } + }, + "Stacked Redemption": { + "value": { + "id": "r_0b5e3e2b7f851d0192", + "object": "redemption", + "date": "2022-07-12T10:51:33.098Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "result": "SUCCESS", + "order": { + "id": "ord_qjnno0eUQ1fs0RMjejfbZp7q", + "source_id": null, + "created_at": "2022-07-12T10:51:31.687Z", + "updated_at": null, + "status": "PAID", + "amount": 20000, + "discount_amount": 6100, + "total_discount_amount": 6100, + "total_amount": 13900, + "applied_discount_amount": 6100, + "total_applied_discount_amount": 6100, + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" }, - "Invalid Customer": { - "value": { - "code": 400, - "key": "invalid_customer", - "message": "Customer must be a holder of a loyalty card.", - "details": "AnsvocvP", - "request_id": "v-0c5e628bd14411244b", - "resource_id": "rf_0c5e628bf841c7f248", - "resource_type": "redemption", - "error": { - "message": "The customer is invalid." - } + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0b5e3e2b7f851d0192": { + "date": "2022-07-12T10:51:31.711Z", + "related_object_type": "redemption", + "related_object_id": "r_0b5e3e2b7f851d0192", + "stacked": [ + "r_0b5e3e2b7f851d0193", + "r_0b5e3e2b7fc51d0194", + "r_0b5e3e2b7fc51d0195", + "r_0b5e3e2b7fc51d0196", + "r_0b5e3e2b7fc51d0197" + ] } + } + }, + "channel": { + "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", + "channel_type": "API" + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "accepts_marketing": false }, - "Voucher Inactive": { - "value": { - "code": 400, - "key": "voucher_not_active_now", - "message": "voucher not active now", - "details": "CODE14", - "request_id": "v-0c5e89b9300d820994", - "resource_id": "rf_0c5e89b945d33b9c02", - "resource_type": "redemption", - "error": { - "message": "The voucher is not active in the given timeframe." - } + "object": "customer" + }, + "related_object_type": "redemption", + "related_object_id": "r_0b5e3e2b7f851d0192", + "voucher": null + } + }, + "Failed Voucher": { + "value": { + "id": "rf_0c5bd3c15701c78243", + "object": "redemption", + "date": "2023-01-25T10:00:47.812Z", + "customer_id": "cust_w1aRTTkpzeTGtOauISc8CKUN", + "tracking_id": "track_hr0jh/qNQqZWu7gkCEcVwEg27bNVrn2+", + "metadata": { + "location_id": [], + "redemption_location": { + "city": "Albany", + "state": "New York" + } + }, + "result": "FAILURE", + "failure_code": "voucher_disabled", + "failure_message": "voucher is disabled", + "order": null, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_w1aRTTkpzeTGtOauISc8CKUN", + "name": "Bobby's Friend", + "email": null, + "source_id": "create_order_referrer_1", + "metadata": {}, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_zr4XJD6b6JtldZq9EorHf4jxRbahjkfi", + "voucher": { + "id": "v_zr4XJD6b6JtldZq9EorHf4jxRbahjkfi", + "code": "PROMO-CODE2", + "campaign": null, + "campaign_id": null, + "category": null, + "categories": [], + "discount": null, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "additional_info": null, + "assets": { + "qr": {}, + "barcode": {} + }, + "updated_at": null, + "object": "voucher" + } + } + }, + "Failed Promotion Tier": { + "value": { + "id": "rf_0c5d6e47050156bfc2", + "object": "redemption", + "date": "2023-01-26T15:54:23.508Z", + "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==", + "metadata": null, + "result": "FAILURE", + "failure_code": "promotion_inactive", + "failure_message": "Inactive Promotion", + "order": null, + "channel": { + "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", + "channel_type": "API" + }, + "customer": { + "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "name": "Annie Lemon", + "email": "annie@lemon.com", + "source_id": "annie@lemon.com", + "metadata": { + "age": 2 + }, + "object": "customer" + }, + "related_object_type": "promotion_tier", + "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "voucher": null, + "promotion_tier": { + "id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "action": null, + "campaign": { + "id": "camp_w7BUstntAm8jbIDjfM49volj", + "start_date": null, + "expiration_date": null, + "object": "campaign" + }, + "campaign_id": null, + "summary": { + "redemptions": { + "total_redeemed": 0 + }, + "orders": { + "total_amount": 0, + "total_discount_amount": 0 } - } + }, + "object": "promotion_tier", + "validation_rule_assignments": null } } + }, + "Failed Redemption": { + "value": { + "id": "rf_0c5bde8dfc0156f0e3", + "object": "redemption", + "date": "2023-01-25T10:47:58.578Z", + "customer_id": null, + "tracking_id": null, + "metadata": null, + "result": "FAILURE", + "failure_code": "not_found", + "failure_message": "Resource not found", + "order": null, + "channel": { + "channel_id": "abcdefg-efgj-ijkl-mnop-qrstuvxyz", + "channel_type": "API" + }, + "customer": null, + "related_object_type": "redemption", + "related_object_id": "rf_0c5bde8dfc0156f0e3", + "voucher": null + } } } } } - }, - "/v1/redemptions/{redemptionId}/rollback": { - "parameters": [ - { + } + } + } + }, + "/v1/vouchers/{code}/redemption": { + "parameters": [ + { + "$ref": "#/components/parameters/code" + } + ], + "get": { + "operationId": "get-voucher-redemptions", + "tags": [ + "REDEMPTIONS API" + ], + "summary": "Get Voucher's Redemptions", + "description": "Retrieve the number of times a voucher was redeemed and each of the redemption details.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "A dictionary with a `redemption_entries` property that contains an array of voucher's redemptions.", + "content": { + "application/json": { "schema": { - "type": "string" - }, - "name": "redemptionId", - "in": "path", - "required": true, - "description": "The original redemption ID to be rolled back (undone)." - } - ], - "post": { - "operationId": "rollback-redemption", - "tags": [ - "REDEMPTIONS API" - ], - "summary": "Rollback Redemption", - "description": "Your business logic may include a case when you need to undo a redemption. You can revert a redemption by calling this API endpoint. \n\n ## Effect \nThe operation \n- creates a rollback entry in voucher's redemption history (`redemption.redemption_entries`) and \n- gives 1 redemption back to the pool (decreases `redeemed_quantity` by 1). \n## Returned funds \nIn case of *gift card vouchers*, this method returns funds back according to the source redemption. In case of *loyalty card vouchers*, this method returns points back according to the source redemption.", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "reason", - "description": "Reason for the rollback." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/7_req_rollback_redemption" - }, - "examples": { - "Promotion": { - "value": { - "customer": { - "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "name": "Annie Lemons", - "email": "annie@lemon.com", - "phone": "+1 933 222 3334", - "birthday": "1900-12-02", - "birthdate": "1900-12-01", - "address": { - "city": "New York", - "state": "NY", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 5", - "country": "United States", - "postal_code": "100012" + "$ref": "#/components/schemas/7_res_get_vouchers_redemptions" + }, + "examples": { + "Example": { + "value": { + "quantity": null, + "redeemed_quantity": 6, + "object": "list", + "url": "/v1/vouchers/Test - FB - Vouchers - 9/redemptions?page=1&limit=10", + "data_ref": "redemption_entries", + "total": 6, + "redemption_entries": [ + { + "id": "r_0bc92f81a6801f9bca", + "object": "redemption", + "date": "2022-10-03T12:24:58.008Z", + "customer_id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "tracking_id": "track_fxEMFisanb6bqeHALcTMxy9fmc+1Azdq951CZwGFCweQF8eGLowFHg==", + "metadata": {}, + "result": "SUCCESS", + "order": { + "id": "ord_bhp1EH2SDz7UwkkurPFPLPhi", + "source_id": null, + "created_at": "2022-10-03T12:24:56.179Z", + "updated_at": null, + "status": "PAID", + "amount": 230000, + "discount_amount": 100, + "total_discount_amount": 100, + "total_amount": 229900, + "applied_discount_amount": 100, + "total_applied_discount_amount": 100, + "items": [ + { + "object": "order_item", + "product_id": "prod_0bae45ffc7003ffc52", + "quantity": 1, + "amount": 230000, + "price": 230000, + "subtotal_amount": 230000, + "product": { + "id": "prod_0bae45ffc7003ffc52", + "source_id": "second_product", + "name": "Samsung Phone 2", + "price": 230000 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "object": "customer" }, - "metadata": { - "age": 23 + "customer_id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0bc92f81a6801f9bca": { + "date": "2022-10-03T12:24:56.219Z", + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + } } }, - "order": { - "source_id": "test_rollback_8" + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" }, - "metadata": { - "location_id": [ - "L2" - ] + "customer": { + "id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "name": null, + "email": null, + "source_id": "johnnyy@email.com", + "metadata": {}, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "voucher": { + "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "code": "Test - FB - Vouchers - 9", + "campaign_id": null } - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns a redemption rollback object indicating the result of the rollback.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/7_res_rollback_redemption" - }, - "examples": { - "Loyalty Card": { - "value": { - "id": "rr_0c5eba630bc4979e70", - "object": "redemption_rollback", - "date": "2023-01-27T16:05:23.631Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": -2, - "redemption": "r_0c5bf3323008a35032", - "reason": "A UI rollback to check for result in API response to listing.", - "result": "SUCCESS", - "order": { - "id": "ord_dqxr4uzaYWkTZnrSEMoQtCF8", - "source_id": null, - "created_at": "2023-01-25T12:18:09.203Z", - "updated_at": "2023-01-27T16:05:23.687Z", - "status": "CANCELED", - "amount": 2100, - "total_amount": 2100, - "items": [ - { - "object": "order_item", - "product_id": "prod_0bc3bd8a4e072c5275", - "quantity": 3, - "amount": 2100, - "price": 700, - "subtotal_amount": 2100, - "product": { - "name": "Bouquet - Romantic Roses", - "price": 700 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5bf3323008a35032": { - "date": "2023-01-25T12:18:09.216Z", - "rollback_id": "rr_0c5eba630bc4979e70", - "rollback_date": "2023-01-27T16:05:23.631Z", - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + }, + { + "id": "r_0bc92e6a68050e118c", + "object": "redemption", + "date": "2022-10-03T12:20:11.873Z", + "customer_id": "cust_TzWOhveicr7BI1Qg4bCFrrQQ", + "tracking_id": "track_5DQxXbK0C0pvAaHk7mnulmKhuFqhawWj", + "metadata": {}, + "result": "SUCCESS", + "order": { + "id": "ord_rBsuJYqf4eFZgqj6IxeJgEcN", + "source_id": null, + "created_at": "2022-10-03T12:20:10.222Z", + "updated_at": null, + "status": "PAID", + "amount": 230000, + "discount_amount": 100, + "total_discount_amount": 100, + "total_amount": 229900, + "applied_discount_amount": 100, + "total_applied_discount_amount": 100, + "items": [ + { + "object": "order_item", + "product_id": "prod_0bae45ffc7003ffc52", + "quantity": 1, + "amount": 230000, + "price": 230000, + "subtotal_amount": 230000, + "product": { + "id": "prod_0bae45ffc7003ffc52", + "source_id": "second_product", + "name": "Samsung Phone 2", + "price": 230000 } } - }, - "channel": { - "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", - "channel_type": "USER" - }, + ], + "metadata": {}, "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, + "id": "cust_TzWOhveicr7BI1Qg4bCFrrQQ", "object": "customer" }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "categories": [], - "discount": null, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "additional_info": null, - "assets": { - "qr": {}, - "barcode": {} - }, - "updated_at": null, - "object": "voucher" + "customer_id": "cust_TzWOhveicr7BI1Qg4bCFrrQQ", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0bc92e6a68050e118c": { + "date": "2022-10-03T12:20:10.272Z", + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + } + } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_TzWOhveicr7BI1Qg4bCFrrQQ", + "name": "Bob Jones", + "email": "bob.smith@email.com", + "source_id": "pub_source_customer_4", + "metadata": { + "lang": "en", + "test": true }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_0ZwLAHgeU9IrI2V1ofYRmW7g", - "voucher": { - "id": "v_4GaEX7clyqMaveT7vHhoyRpsIgxv95Q6", - "code": "HAPPY-ORDER5My", - "campaign": "$20 off the entire order", - "campaign_id": "camp_5h0wc453_4", - "category": null, - "category_id": "cat_0b688929a2476386a6", - "categories": [], - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 2000, - "effect": "APPLY_TO_ORDER" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2022-09-20T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "21ceb848-4869-4dac-ba41-f854bda3a101", - "url": "https://dl.voucherify.io/api/v1/assets/qr/21ceb848-4869-4dac-ba41-f854bda3a101" - }, - "barcode": { - "id": "1dba9cb2-fb28-4c8d-8548-5edb2eb01f5a", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/1dba9cb2-fb28-4c8d-8548-5edb2eb01f5a" - } - }, - "is_referral_code": false, - "created_at": "2023-01-25T12:18:09.256Z", - "updated_at": null, - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/HAPPY-ORDER5My/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/HAPPY-ORDER5My/publications?page=1&limit=10" - }, - "object": "voucher" - }, - "id": "rew_MF4hKh1IKYgJkPjbcFbH94Ho", - "object": "reward", - "name": "Digital Present", - "created_at": "2023-01-25T12:16:44.557Z", - "updated_at": null, - "parameters": { - "campaign": { - "id": "camp_5h0wc453_4", - "type": "DISCOUNT_COUPONS" + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "voucher": { + "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "code": "Test - FB - Vouchers - 9", + "campaign_id": null + } + }, + { + "id": "r_0bc92db6e6001f9aa8", + "object": "redemption", + "date": "2022-10-03T12:17:07.780Z", + "customer_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", + "tracking_id": "track_5DQxXbK0C0pvAaHk7mnulmYlx396Pk4X", + "metadata": {}, + "result": "SUCCESS", + "order": { + "id": "ord_JvZbg1LFcXdQ67no5SENGldH", + "source_id": null, + "created_at": "2022-10-03T12:17:06.404Z", + "updated_at": null, + "status": "PAID", + "amount": 230000, + "discount_amount": 1200, + "total_discount_amount": 1200, + "total_amount": 228800, + "applied_discount_amount": 1200, + "total_applied_discount_amount": 1200, + "items": [ + { + "object": "order_item", + "product_id": "prod_0bae45ffc7003ffc52", + "quantity": 1, + "amount": 230000, + "price": 230000, + "subtotal_amount": 230000, + "product": { + "id": "prod_0bae45ffc7003ffc52", + "source_id": "second_product", + "name": "Samsung Phone 2", + "price": 230000 } - }, - "type": "CAMPAIGN" + } + ], + "metadata": {}, + "customer": { + "id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", + "object": "customer" }, - "loyalty_card": { - "points": -2 + "customer_id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0bc92db6e6001f9aa8": { + "date": "2022-10-03T12:17:06.456Z", + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + } } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_BB6F97yf0XqCe7hxVUV7M4sS", + "name": "Bob Jones", + "email": "bob.smith@email.com", + "source_id": "pub_source_customer_5", + "metadata": { + "lang": "en", + "test": true + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "voucher": { + "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "code": "Test - FB - Vouchers - 9", + "campaign_id": null } }, - "Discount Coupon": { - "value": { - "id": "rr_0c5eb002b40cce9d62", - "object": "redemption_rollback", - "date": "2023-01-27T15:20:03.536Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "redemption": "r_0c5e8ef10842da0aad", - "result": "SUCCESS", - "order": { - "id": "ord_J5ogV1Gkk2yfxmBEhYIg4O65", - "source_id": null, - "created_at": "2023-01-27T12:55:34.673Z", - "updated_at": "2023-01-27T15:20:03.743Z", - "status": "CANCELED", - "amount": 6000, - "total_amount": 6000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 3300, - "price": 3000, - "subtotal_amount": 3300 - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 2, - "amount": 3400, - "price": 3000, - "subtotal_amount": 3400 - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5e8ef10842da0aad": { - "date": "2023-01-27T12:55:34.689Z", - "rollback_id": "rr_0c5eb002b40cce9d62", - "rollback_date": "2023-01-27T15:20:03.536Z", - "related_object_type": "voucher", - "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u" + { + "id": "r_0bc2dc6404426c0ab3", + "object": "redemption", + "date": "2022-09-28T14:30:56.199Z", + "customer_id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "tracking_id": "track_fxEMFisanb6bqeHALcTMxy9fmc+1Azdq951CZwGFCweQF8eGLowFHg==", + "metadata": {}, + "result": "SUCCESS", + "order": { + "id": "ord_6uuhGraDuXMOpVRTJT251kKW", + "source_id": null, + "created_at": "2022-09-28T14:30:54.681Z", + "updated_at": null, + "status": "PAID", + "amount": 230000, + "discount_amount": 800, + "total_discount_amount": 800, + "total_amount": 229200, + "applied_discount_amount": 800, + "total_applied_discount_amount": 800, + "items": [ + { + "object": "order_item", + "product_id": "prod_0bae45ffc7003ffc52", + "quantity": 1, + "amount": 230000, + "price": 230000, + "subtotal_amount": 230000, + "product": { + "id": "prod_0bae45ffc7003ffc52", + "source_id": "second_product", + "name": "Samsung Phone 2", + "price": 230000 } } - }, + ], + "metadata": {}, "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, + "id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", "object": "customer" }, - "related_object_type": "voucher", - "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "voucher": { - "id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "code": "2CpRCE2c", - "campaign": null, - "campaign_id": null, - "category": null, - "category_id": null, - "categories": [], - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 300, - "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" - }, - "gift": null, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1+ro/6HLsfI9E/rz0QEoYv+rcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz+WQtg4nKpjUS0wcA7AuIbz2zb870YfJO/r5UBS5gCqQ==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bro%2F6HLsfI9E%2Frz0QEoYv%2BrcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz%2BWQtg4nKpjUS0wcA7AuIbz2zb870YfJO%2Fr5UBS5gCqQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3/4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ+aTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3%2F4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ%2BaTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-19T10:06:07.932Z", - "updated_at": "2023-01-27T15:20:03.707Z", - "redemption": { - "quantity": null, - "redeemed_quantity": 1, - "object": "list", - "url": "/v1/vouchers/2CpRCE2c/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/2CpRCE2c/publications?page=1&limit=10" - }, - "object": "voucher" + "customer_id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0bc2dc6404426c0ab3": { + "date": "2022-09-28T14:30:54.737Z", + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + } } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_i8t5Tt6eiKG5K79KQlJ0Vs64", + "name": null, + "email": null, + "source_id": "jonny@email.com", + "metadata": {}, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "voucher": { + "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "code": "Test - FB - Vouchers - 9", + "campaign_id": null } - }, - "Gift Card": { - "value": { - "id": "rr_0c5eb099214ccea115", - "object": "redemption_rollback", - "date": "2023-01-27T15:22:37.573Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": -2000, - "redemption": "r_0c5e8a38730ccec0d5", - "result": "SUCCESS", - "order": { - "id": "ord_S4BvUj64TlGqVZDOeud7z3rU", - "source_id": null, - "created_at": "2023-01-27T12:34:57.086Z", - "updated_at": "2023-01-27T15:22:37.628Z", - "status": "CANCELED", - "amount": 6000, - "total_amount": 6000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0a9f9ab4ab019a42d5", - "quantity": 1, - "amount": 3300, - "price": 3000, - "subtotal_amount": 3300 - }, - { - "object": "order_item", - "product_id": "prod_0a9f9aeddb019a42db", - "quantity": 2, - "amount": 3400, - "price": 3000, - "subtotal_amount": 3400 - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c5e8a38730ccec0d5": { - "date": "2023-01-27T12:34:57.100Z", - "rollback_id": "rr_0c5eb099214ccea115", - "rollback_date": "2023-01-27T15:22:37.573Z", - "related_object_type": "voucher", - "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", - "related_object_parent_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6" + }, + { + "id": "r_0bc2d6f0ebc95f1783", + "object": "redemption", + "date": "2022-09-28T14:07:07.516Z", + "customer_id": "cust_H0nXrItO1DNV3UiPIl54HA5o", + "tracking_id": "track_ThofCMTQe4EVIo0zvvOlTor1twaQNd7E", + "metadata": {}, + "result": "SUCCESS", + "order": { + "id": "ord_ZQevc2J2sBegsnp5DwanXHsa", + "source_id": null, + "created_at": "2022-09-28T14:07:06.073Z", + "updated_at": null, + "status": "PAID", + "amount": 230000, + "discount_amount": 0, + "total_discount_amount": 0, + "total_amount": 230000, + "applied_discount_amount": 0, + "total_applied_discount_amount": 0, + "items": [ + { + "object": "order_item", + "product_id": "prod_0bae45ffc7003ffc52", + "quantity": 1, + "amount": 230000, + "price": 230000, + "subtotal_amount": 230000, + "product": { + "id": "prod_0bae45ffc7003ffc52", + "source_id": "second_product", + "name": "Samsung Phone 2", + "price": 230000 } } - }, + ], + "metadata": {}, "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, + "id": "cust_H0nXrItO1DNV3UiPIl54HA5o", "object": "customer" }, - "related_object_type": "voucher", - "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", - "voucher": { - "id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", - "code": "CODE14", - "campaign": "Gift Card Campaign", - "campaign_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6", - "category": "Second", - "category_id": "cat_0bb343dee3cdb5ec0c", - "categories": [], - "type": "GIFT_VOUCHER", - "discount": null, - "gift": { - "amount": 2000, - "balance": 2000, - "effect": null - }, - "loyalty_card": null, - "start_date": "2020-08-16T00:00:00.000Z", - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": "secret-code1", - "metadata": { - "region": "APAC", - "season": "Fall" - }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+VibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BVibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/GVIi0p5fL5hxAY/ZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd//S4R9AB+60T/x4kSKu3lgfa9KgJmbyrzXm7Ggly06/qph4/asJaZVZIXEba4WJCeHqXCEgg==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FGVIi0p5fL5hxAY%2FZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd%2F%2FS4R9AB%2B60T%2Fx4kSKu3lgfa9KgJmbyrzXm7Ggly06%2Fqph4%2FasJaZVZIXEba4WJCeHqXCEgg%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-09-23T11:05:42.164Z", - "updated_at": "2023-01-27T15:22:37.595Z", - "redemption": { - "quantity": 18, - "redeemed_quantity": 0, - "redeemed_amount": 0, - "object": "list", - "url": "/v1/vouchers/CODE14/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 0, - "url": "/v1/vouchers/CODE14/publications?page=1&limit=10" - }, - "object": "voucher" - }, - "gift": { - "amount": -2000 + "customer_id": "cust_H0nXrItO1DNV3UiPIl54HA5o", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0bc2d6f0ebc95f1783": { + "date": "2022-09-28T14:07:06.159Z", + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + } } - } - }, - "Promotion Tier": { - "value": { - "id": "rr_0ca286e96cc03f3e76", - "object": "redemption_rollback", - "date": "2023-03-21T07:57:12.526Z", - "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==", + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_H0nXrItO1DNV3UiPIl54HA5o", + "name": "Bob Smith", + "email": "bob.smith.1@email.com", + "source_id": "bob.smith.1@email.com", "metadata": { - "location_id": [ - "L2" - ] + "lang": "en", + "test": false }, - "redemption": "r_0ca286d222d2f7dc1f", - "reason": "To undo a redemption.", - "result": "SUCCESS", - "order": { - "id": "ord_0FR01SqYIxV4ITzgs1yZjkK6", - "source_id": "test_rollback_8", - "created_at": "2023-03-21T07:56:48.634Z", - "updated_at": "2023-03-21T07:57:12.546Z", - "status": "CANCELED", - "amount": 200000, - "total_amount": 200000, - "items": [ - { - "object": "order_item", - "source_id": "apple534", - "related_object": "product", - "product_id": "prod_anJ03RZZq74z4v", - "quantity": 2, - "amount": 100000, - "price": 50000, - "subtotal_amount": 100000, - "product": { - "id": "prod_0c5d6689b39320059b", - "source_id": "prod_anJ03RZZq74z4v", - "name": "Apple iPhone 8", - "metadata": { - "shop": "citycenter", - "category": "electronics" - } - }, - "metadata": { - "series": "2022-783CV" - } - }, - { - "object": "order_item", - "source_id": "apple534-ihd5", - "related_object": "sku", - "sku_id": "sku_0KtP4rvwEECQ2U", - "quantity": 1, - "amount": 100000, - "price": 100000, - "subtotal_amount": 100000, - "sku": { - "sku": "Apple iPad 10 Silver 64GB", - "metadata": { - "category": "electronics" - } - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "object": "customer" - }, - "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0ca286d222d2f7dc1f": { - "date": "2023-03-21T07:56:48.651Z", - "rollback_id": "rr_0ca286e96cc03f3e76", - "rollback_date": "2023-03-21T07:57:12.526Z", - "related_object_type": "promotion_tier", - "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "related_object_parent_id": "camp_w7BUstntAm8jbIDjfM49volj" + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "voucher": { + "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "code": "Test - FB - Vouchers - 9", + "campaign_id": null + } + }, + { + "id": "r_0bc2d3c4f7495f159a", + "object": "redemption", + "date": "2022-09-28T13:53:16.057Z", + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "tracking_id": "track_fxEMFisanb4sbl4Z4yCnJyDW013IrRbJmqKByTNHbXE=", + "metadata": {}, + "result": "SUCCESS", + "order": { + "id": "ord_ff6rwr58kmdyuLsi5orplnVW", + "source_id": null, + "created_at": "2022-09-28T13:53:14.604Z", + "updated_at": null, + "status": "PAID", + "amount": 230000, + "discount_amount": 800, + "total_discount_amount": 800, + "total_amount": 229200, + "applied_discount_amount": 800, + "total_applied_discount_amount": 800, + "items": [ + { + "object": "order_item", + "product_id": "prod_0bae45ffc7003ffc52", + "quantity": 1, + "amount": 230000, + "price": 230000, + "subtotal_amount": 230000, + "product": { + "id": "prod_0bae45ffc7003ffc52", + "source_id": "second_product", + "name": "Samsung Phone 2", + "price": 230000 } } - }, - "channel": { - "channel_id": "e55f3aaa-b303-421a-b562-ca8529ed341d", - "channel_type": "API" - }, + ], + "metadata": {}, "customer": { - "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "name": "Annie Lemons", - "email": "annie@lemon.com", - "source_id": "annie@lemon.com", - "metadata": { - "age": 23 - }, + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", "object": "customer" }, - "related_object_type": "promotion_tier", - "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "voucher": null, - "promotion_tier": { - "id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "created_at": "2022-09-23T08:31:23.022Z", - "updated_at": "2023-02-01T07:47:57.324Z", - "name": "Percent Discount", - "banner": "Get 40% off", - "action": { - "discount": { - "type": "PERCENT", - "percent_off": 40, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "hierarchy": 2, - "campaign": { - "id": "camp_w7BUstntAm8jbIDjfM49volj", - "start_date": "2019-08-16T00:00:00.000Z", - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "campaign_id": "camp_w7BUstntAm8jbIDjfM49volj", - "active": true, - "start_date": "2022-09-21T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "summary": { - "redemptions": { - "total_redeemed": 5 - }, - "orders": { - "total_amount": 616000, - "total_discount_amount": 246400 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": null, - "category_id": null, - "categories": [] + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0bc2d3c4f7495f159a": { + "date": "2022-09-28T13:53:14.717Z", + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno" + } } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "name": "John Smith", + "email": "john.smith@email.com", + "source_id": "john.smith@email.com", + "metadata": { + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "voucher": { + "id": "v_lfZi4rcEGe0sN9gmnj40bzwK2FH6QUno", + "code": "Test - FB - Vouchers - 9", + "campaign_id": null } } - } + ] } } - }, - "400": { - "description": "Returns an error if the rollback redemption process failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Already rolledback": { - "value": { - "code": 400, - "key": "already_rolled_back", - "message": "Already rolled back", - "details": "Redemption has been already rolled back.", - "request_id": "v-0c5eb3bd81cd7e3a39", - "resource_id": "rrf_0c5eb3bd884497ed05", - "resource_type": "redemption_rollback" + } + } + } + } + } + }, + "post": { + "operationId": "redeem-voucher", + "deprecated": true, + "tags": [ + "REDEMPTIONS API" + ], + "summary": "Redeem Voucher [Deprecated]", + "description": "\n> ❗️ Deprecated \n>\n> 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](ref:redeem-stacked-discounts) 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. \n\nTo redeem a voucher, you create a redemption object. It increments the redemption counter and updates the history of the voucher. \n\n## How discounts and order amounts are calculated in the API response?\n\nIn the table below, you can see the logic the API follows to calculate discounts and amounts:\n\n| **Field** | **Calculation** | **Description** |\n|:---|:---|:---|\n| amount | N/A | This field shows the order amount before applying any discount |\n| total_amount | total_amount = amount - total_discount_amount | This field shows the order amount after applying all the discounts |\n| discount_amount | discount_amount = previous_discount_amount + applied_discount_amount | This field sums up all order-level discounts applied to a patricular order |\n| items_discount_amount | sum(items, i => i.discount_amount) | This field sums up all product-specific discounts applied to this order |\n| total_discount_amount | total_discount_amount = discount_amount + items_discount_amount | This field sums up all order-level and all product-specific discounts applied to this order |\n| applied_discount_amount | N/A | This field shows order-level discount applied in a particular request |\n| items_applied_discount_amount | sum(items, i => i.applied_discount_amount) | This field sums up all product-specific discounts applied in a particular request |\n| 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 |\n\n## SDKs \n\nYou can invoke the redemption endpoint with one of the official libraries: \n\n\n[block:html]\n{\n \"html\": \"
                  \\n\\n
                  \\n \\n
                  \\n\\n
                  \\n\\n
                  \\n\\n\\n
                  \\n\\n\\n\\n\\n\\n
                  \\n\\n
                  \\n
                  \\n\\n\"\n}\n[/block]\n\n## Customer tracking\n\nThe redeem operation is a key part of [Customer tracking] (doc:customer-tracking) workflow. There're 3 ways you can identify your end customer in Voucherify within this request. You can either provide a tracking ID (e.g. your customer's login or a generated id), a customer ID (if the customer is already stored in Voucherify) or a full `customer` object in the payload. Note that you can pass and thus store any customer-related metadata. See examples on the right.\n\n\n```json\n\"customer\": {\n \"source_id\": \"alice.morgan\",\n \"name\": \"Alice Morgan\",\n \"email\": \"alice@morgan.com\",\n \"description\": \"\",\n \"metadata\": {\n \"locale\": \"en-GB\",\n \"shoeSize\": 5,\n \"favourite_brands\": [\"Armani\", \"L’Autre Chose\", \"Vicini\"]\n }\n}\n```\n\nIf you already created a customer profile in Voucherify's database, whether it was implicitly by providing it to the redeem function or explicitly by invoking the [Create Customer](ref:create-customer) method, you can identify your customer in redemptions by a generated ID (starting with `cust_`). \n\n\n```json title=Example Customer Identifier [object]\n\"customer\": {\n \"id\": \"cust_C9qJ3xKgZFqkpMw7b21MF2ow\"\n}\n```\n\n```json title=Example Customer Identifier\n{\n \"customer\": \"cust_C9qJ3xKgZFqkpMw7b21MF2ow\"\n}\n```\n\n```json title=Example Customer Identifier by Source ID\n{\n \"customer\": \"alice.morgan\"\n}\n```\n\n\n> 📘 Redemption rollback\n>\n> Do you need to undo a redemption? You can do it with [redemption rollback](ref:rollback-redemption).\n\n## Redemption failures\n\nThere are several reasons why a redemption may fail. You will get the reason in the error key:\n - `resource_not_found` - voucher with given code does not exist\n- `voucher_not_active` - voucher is not active yet (before start date)\n- `voucher_expired` - voucher has already expired (after expiration date)\n- `voucher_disabled` - voucher has been disabled (`active: false`)\n- `quantity_exceeded` - voucher's redemptions limit has been exceeded\n- `gift_amount_exceeded` - gift amount has been exceeded\n- `customer_rules_violated` - customer did not match the segment\n- `order_rules_violated` - order did not match validation rules\n- `invalid_order` - order was specified incorrectly\n- `invalid_amount` - order amount was specified incorrectly\n- `missing_amount` - order amount was not specified\n- `missing_order_items` - order items were not specified\n- `missing_customer` - customer was not specified\n\n## Order object\n\nThe purchase of previously defined products (products are stored in Voucherify) by end customers is handled through the order object. You are obligated to pass the order object in case you use validation rules. You can learn more about the [validation rules structure] (doc:validation-rules). \n\n| **Attributes** | **Description** |\n|:---|:---|\n| amount
                  `integer` | A positive integer representing the total amount for the order. |\n| items
                  `list` | List of items constituting the order. Order items can be defined either by `product_id` or `sku_id`. Along with every item you must define the `quantity`.

                  Child attributes:

                  - `product_id` (*string*) - The ID of the associated product object for this line item.

                  - `sku_id` (*string*) - The ID of the associated variant (sku) object for this line item.

                  - `quantity` (*integer*) - A positive integer representing the number of instances of the item that are included in this order line.

                  - `price` (*integer*) - A positive integer representing the cost of an item.

                  - `amount` (*integer*) - `quantity` * `price` (you should provide it to retrieve `discount_amount` for a particular order item if the discount is applied only to this item learn more |\n\n\n\n\n> 🚧 Order ID\n>\n> If you use the same order id in more than one redemption request, all valid discounts provided in the redemption payload will be applied to the given order. [Read more in this guide] (https://docs.voucherify.io/docs/manage-stackable-discounts).\n\n\n```json title=Example Order\n\"order\": {\n \"amount\": 10000,\n \"items\": [\n {\n \"product_id\": \"prod_Bi7sRr3kwvxH2I\",\n \"quantity\": 1\n }\n ]\n}\n```\n## Gift Vouchers - redeem Gift Card and control redeemed amount\n\nIn Voucherify,you can also create a gift card for customers. Customers then can use gift card credits to fulfill the order. A user can specify how many credits he wants to use from the gift card. The available balance of credits is counted based on policy rules attached to the Gift Voucher definition.\n\nWhen the user wants to define how many gift credits are to be used from the gift card to complete the order, the `credits` property can be assigned the equivalent value in the lowest currency in the request body. The value of credits being applied to the order cannot be higher than the current balance on the gift card.\n\n\n```cURL title=Example Request - control redeemed amount\ncurl -i -X POST \\\n -H \"Content-Type:application/json\" \\\n -H \"X-App-Id:c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token:3266b9f8-e246-4f79-bdf0-833929b1380c\" \\\n -d '{\n \"order\": {\n \"amount\": 2500\n },\n \"gift\": {\n \"credits\": 1500\n }\n }' \\ \n 'https://api.voucherify.io/v1/vouchers/aDm4CRR3/redemption'\n```\n## Loyalty Coins - redeem loyalty card and pay with points\n\nVoucherify offers the possibility to set up a reward type in the Loyalty Program, which allows using loyalty points as gift credits. The available balance of credits is counted based on policy rules attached to the reward definition.\n\nIf a user configures just one reward type of paying in points, in the redemption request, there is no additional information required. Voucherify will automatically select as a proper reward definition and will calculate the discount based on the attached policy. \n\n\n```json title=Example Request\n{\n \"order\": {\n \"amount\": 25000,\n \"items\": [\n {\n \"product_id\": \"test_source_1\",\n \"quantity\": \"1\",\n \"price\": 15000\n },\n {\n \"product_id\": \"test_source_2\",\n \"quantity\": \"1\",\n \"price\": 10000\n }\n ]\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n }\n}\n```\n\n```json title=Example Response\n{\n \"id\": \"r_zv5Qn7cF68RbVX4foKxgwUi1\",\n \"object\": \"redemption\",\n \"date\": \"2020-05-24T13:44:20Z\",\n \"customer_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"amount\": 250,\n \"order\": {\n \"status\": \"PROCESSING\",\n \"items\": [\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_1\",\n \"quantity\": 1,\n \"amount\": 15000,\n \"price\": 15000\n },\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_2\",\n \"quantity\": 1,\n \"amount\": 10000,\n \"price\": 10000\n }\n ],\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"object\": \"customer\",\n \"referrals\": {\n \"campaigns\": [],\n \"total\": 0\n }\n },\n \"amount\": 25000,\n \"object\": \"order\",\n \"id\": \"ord_Tgi2ApelDyl86sm5AYDKCBMZ\",\n \"created_at\": \"2020-05-24T13:44:20Z\",\n \"discount_amount\": 25000\n },\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"reward\": {\n \"assignment_id\": \"rewa_pHilLjHWOD7oNjJZnog3VoEi\",\n \"loyalty_tier_id\": \"ltr_3q5dW6GaRC4QkA1oYmfGy1k1\",\n \"id\": \"rew_3qmzGPWJ7LfLXnPAjmbPacIl\",\n \"name\": \"1 point - 25 cents\",\n \"created_at\": \"2020-05-22T18:39:52Z\",\n \"updated_at\": \"2020-05-23T08:18:55Z\",\n \"parameters\": {\n \"automation_id\": null,\n \"coin\": {\n \"exchange_ratio\": 0.25\n }\n },\n \"type\": \"COIN\",\n \"object\": \"reward\"\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n },\n \"result\": \"SUCCESS\",\n \"tracking_id\": \"track_IWQYtuUE7phYpPzTHD5uwbyvlrO4nqyzipbQQtsHrRw=\",\n \"voucher\": {\n \"id\": \"v_wjgLC2lrQy1urPOdd35JX0RtkcOcQOmb\",\n \"code\": \"Dm1x8MuX\",\n \"campaign\": \"TestLoyalty-GivePoints\",\n \"campaign_id\": \"camp_qVVaC4vpVlof03eBi8qb5gE7\",\n \"category\": null,\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 489,\n \"balance\": 23\n },\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/Dm1x8MuX/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_quantity\": 8,\n \"url\": \"/v1/vouchers/Dm1x8MuX/redemptions?page=1&limit=10\",\n \"redeemed_points\": 466\n },\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX1+9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19NfR0ANlhLM7Df9Ec+xqTh6aTbHakk/Gzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF/BSQTyJx0YSK+HIUG9RGD+9rVhiC7+4WkSKrgAZ+NeqQBIqcespt8WWygXjfkvbyXBSF7Lg==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19NfR0ANlhLM7Df9Ec%2BxqTh6aTbHakk%2FGzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF%2FBSQTyJx0YSK%2BHIUG9RGD%2B9rVhiC7%2B4WkSKrgAZ%2BNeqQBIqcespt8WWygXjfkvbyXBSF7Lg%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"holder_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"updated_at\": \"2020-05-24T13:44:20Z\",\n \"holder\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"object\": \"voucher\",\n \"validation_rules_assignments\": {\n \"data\": [],\n \"object\": \"list\",\n \"total\": 0,\n \"data_ref\": \"data\"\n }\n }\n}\n```\n\nIn case the user wants to define how much he spends in points, it is configurable by property `points` in a request body.\n\n\n```json title=Example Request\n{\n \"reward\": {\n \"points\": 10\n },\n \"order\": {\n \"amount\": 25000,\n \"items\": [\n {\n \"product_id\": \"test_source_1\",\n \"quantity\": \"1\",\n \"price\": 15000\n },\n {\n \"product_id\": \"test_source_2\",\n \"quantity\": \"1\",\n \"price\": 10000\n }\n ]\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n }\n}\n```\n\n```json title=Example Response\n{\n \"id\": \"r_NJIfNYD8uc2lNm3YBAqXr3FF\",\n \"object\": \"redemption\",\n \"date\": \"2020-05-24T16:28:29Z\",\n \"customer_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"amount\": 10,\n \"order\": {\n \"status\": \"PROCESSING\",\n \"items\": [\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_1\",\n \"quantity\": 1,\n \"amount\": 15000,\n \"price\": 15000\n },\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_2\",\n \"quantity\": 1,\n \"amount\": 10000,\n \"price\": 10000\n }\n ],\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"object\": \"customer\",\n \"referrals\": {\n \"campaigns\": [],\n \"total\": 0\n }\n },\n \"amount\": 25000,\n \"object\": \"order\",\n \"id\": \"ord_70kKdXIKCSx5cfglKSpz9aHy\",\n \"created_at\": \"2020-05-24T16:28:29Z\",\n \"discount_amount\": 250\n },\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"reward\": {\n \"assignment_id\": \"rewa_pHilLjHWOD7oNjJZnog3VoEi\",\n \"loyalty_tier_id\": null,\n \"id\": \"rew_3qmzGPWJ7LfLXnPAjmbPacIl\",\n \"name\": \"1 point - 25 cents\",\n \"created_at\": \"2020-05-22T18:39:52Z\",\n \"updated_at\": \"2020-05-24T13:44:26Z\",\n \"parameters\": {\n \"automation_id\": null,\n \"coin\": {\n \"exchange_ratio\": 0.25\n }\n },\n \"type\": \"COIN\",\n \"object\": \"reward\"\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n },\n \"result\": \"SUCCESS\",\n \"tracking_id\": \"track_IWQYtuUE7phYpPzTHD5uwbyvlrO4nqyzipbQQtsHrRw=\",\n \"voucher\": {\n \"id\": \"v_wjgLC2lrQy1urPOdd35JX0RtkcOcQOmb\",\n \"code\": \"Dm1x8MuX\",\n \"campaign\": \"TestLoyalty-GivePoints\",\n \"campaign_id\": \"camp_qVVaC4vpVlof03eBi8qb5gE7\",\n \"category\": null,\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 539,\n \"balance\": 63\n },\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/Dm1x8MuX/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_quantity\": 9,\n \"url\": \"/v1/vouchers/Dm1x8MuX/redemptions?page=1&limit=10\",\n \"redeemed_points\": 476\n },\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX1+9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19NfR0ANlhLM7Df9Ec+xqTh6aTbHakk/Gzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF/BSQTyJx0YSK+HIUG9RGD+9rVhiC7+4WkSKrgAZ+NeqQBIqcespt8WWygXjfkvbyXBSF7Lg==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19NfR0ANlhLM7Df9Ec%2BxqTh6aTbHakk%2FGzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF%2FBSQTyJx0YSK%2BHIUG9RGD%2B9rVhiC7%2B4WkSKrgAZ%2BNeqQBIqcespt8WWygXjfkvbyXBSF7Lg%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"holder_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"updated_at\": \"2020-05-24T16:28:29Z\",\n \"holder\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"object\": \"voucher\",\n \"validation_rules_assignments\": {\n \"data\": [],\n \"object\": \"list\",\n \"total\": 0,\n \"data_ref\": \"data\"\n }\n }\n}\n```\n\nMoreover, it is possible to define many levels of reward in which collected points can be used as gift credits. Per each tier, we can implement different conversion factors. Having many options in the rewards catalog, we will need to select a coins calculation policy (reward ID) that we want to use for calculating a final discount in the redemption request.\n\n\n\n```json title=Example Request\n{\n \"reward\": {\n \"points\": 30,\n \"id\": \"rew_noP2S5H8PEBFT97mennSA531\"\n },\n \"order\": {\n \"amount\": 25000,\n \"items\": [\n {\n \"product_id\": \"test_source_1\",\n \"quantity\": \"1\",\n \"price\": 15000\n },\n {\n \"product_id\": \"test_source_2\",\n \"quantity\": \"1\",\n \"price\": 10000\n }\n ]\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n }\n}\n```\n\n```json title=Example Response\n{\n \"id\": \"r_se17sLon6YX5wMhYVzfQa2dc\",\n \"object\": \"redemption\",\n \"date\": \"2020-05-24T13:41:16Z\",\n \"customer_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"amount\": 10,\n \"order\": {\n \"status\": \"PROCESSING\",\n \"items\": [\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_1\",\n \"quantity\": 1,\n \"amount\": 15000,\n \"price\": 15000\n },\n {\n \"object\": \"order_item\",\n \"product_id\": \"test_source_2\",\n \"quantity\": 1,\n \"amount\": 10000,\n \"price\": 10000\n }\n ],\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"object\": \"customer\",\n \"referrals\": {\n \"campaigns\": [],\n \"total\": 0\n }\n },\n \"amount\": 25000,\n \"object\": \"order\",\n \"id\": \"ord_EfMmve84JzQIg2MCM3cAvLgF\",\n \"created_at\": \"2020-05-24T13:41:16Z\",\n \"discount_amount\": 25000\n },\n \"customer\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"reward\": {\n \"assignment_id\": \"rewa_g3QQwQfhJrjBYzEa1NJkub7N\",\n \"loyalty_tier_id\": null,\n \"id\": \"rew_noP2S5H8PEBFT97mennSA531\",\n \"name\": \"1 point 25$\",\n \"created_at\": \"2020-05-24T12:57:19Z\",\n \"parameters\": {\n \"automation_id\": null,\n \"coin\": {\n \"exchange_ratio\": 25.0\n }\n },\n \"type\": \"COIN\",\n \"object\": \"reward\"\n },\n \"metadata\": {\n \"category\": \"vip\",\n \"shop\": \"s1\",\n \"location\": \"l1\"\n },\n \"result\": \"SUCCESS\",\n \"tracking_id\": \"track_IWQYtuUE7phYpPzTHD5uwbyvlrO4nqyzipbQQtsHrRw=\",\n \"voucher\": {\n \"id\": \"v_wjgLC2lrQy1urPOdd35JX0RtkcOcQOmb\",\n \"code\": \"Dm1x8MuX\",\n \"campaign\": \"TestLoyalty-GivePoints\",\n \"campaign_id\": \"camp_qVVaC4vpVlof03eBi8qb5gE7\",\n \"category\": null,\n \"type\": \"LOYALTY_CARD\",\n \"discount\": null,\n \"gift\": null,\n \"loyalty_card\": {\n \"points\": 439,\n \"balance\": 223\n },\n \"start_date\": null,\n \"expiration_date\": null,\n \"validity_timeframe\": null,\n \"validity_day_of_week\": null,\n \"publish\": {\n \"object\": \"list\",\n \"count\": 1,\n \"url\": \"/v1/vouchers/Dm1x8MuX/publications?page=1&limit=10\"\n },\n \"redemption\": {\n \"object\": \"list\",\n \"quantity\": null,\n \"redeemed_quantity\": 7,\n \"url\": \"/v1/vouchers/Dm1x8MuX/redemptions?page=1&limit=10\",\n \"redeemed_points\": 216\n },\n \"active\": true,\n \"additional_info\": null,\n \"metadata\": {},\n \"assets\": {\n \"qr\": {\n \"id\": \"U2FsdGVkX1+9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2B9Eo0bLWMZmYK6nQxl3AyR3nqkloGURcpRJcxL3hl5xXSGRYjYdySc9twLaKnYGVXbLtjCGW8FBotl1rTAxLJQm4okoJ385Gd6pc1ty6AnhaHHJjCeLoYYSQCG1EyP9PRxnTihjmsE9g%3D%3D\"\n },\n \"barcode\": {\n \"id\": \"U2FsdGVkX19NfR0ANlhLM7Df9Ec+xqTh6aTbHakk/Gzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF/BSQTyJx0YSK+HIUG9RGD+9rVhiC7+4WkSKrgAZ+NeqQBIqcespt8WWygXjfkvbyXBSF7Lg==\",\n \"url\": \"https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19NfR0ANlhLM7Df9Ec%2BxqTh6aTbHakk%2FGzeh9zTiuj8KUBLswVXkz0gdLVnn1ZtzjCv7oF%2FBSQTyJx0YSK%2BHIUG9RGD%2B9rVhiC7%2B4WkSKrgAZ%2BNeqQBIqcespt8WWygXjfkvbyXBSF7Lg%3D%3D\"\n }\n },\n \"is_referral_code\": false,\n \"holder_id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"updated_at\": \"2020-05-24T13:41:16Z\",\n \"holder\": {\n \"id\": \"cust_lXisxEaEHYKTEVf1YnNS8AUh\",\n \"source_id\": \"tom+Loyalty@email.com\",\n \"name\": \"Tom Loyalty\",\n \"email\": \"tom+Loyalty@email.com\",\n \"metadata\": {},\n \"object\": \"customer\"\n },\n \"object\": \"voucher\",\n \"validation_rules_assignments\": {\n \"data\": [],\n \"object\": \"list\",\n \"total\": 0,\n \"data_ref\": \"data\"\n }\n }\n}\n```", + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "tracking_id", + "description": "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 returnee by [voucher validation](ref:validate-voucher), or a string identifying customer, with the options described below. **Although not all information is required, the extra info helps prevent fraud.**" + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Provide the redemption context in the request body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_req_redeem_voucher" + } + } + } + }, + "responses": { + "200": { + "description": "Returns a redemption object if the redeem operation succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_res_redeem_voucher" + }, + "examples": { + "Gift Voucher": { + "value": { + "id": "r_0c5e8a38730ccec0d5", + "object": "redemption", + "date": "2023-01-27T12:34:57.100Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 2000, + "result": "SUCCESS", + "order": { + "id": "ord_S4BvUj64TlGqVZDOeud7z3rU", + "source_id": null, + "created_at": "2023-01-27T12:34:57.086Z", + "updated_at": null, + "status": "PAID", + "amount": 6000, + "discount_amount": 2000, + "total_discount_amount": 2000, + "total_amount": 4000, + "applied_discount_amount": 2000, + "total_applied_discount_amount": 2000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 3300, + "price": 3000, + "subtotal_amount": 3300 + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 2, + "amount": 3400, + "price": 3000, + "subtotal_amount": 3400 + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5e8a38730ccec0d5": { + "date": "2023-01-27T12:34:57.100Z", + "related_object_type": "voucher", + "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", + "related_object_parent_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6" } + } + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", + "voucher": { + "id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", + "code": "CODE14", + "campaign": "Gift Card Campaign", + "campaign_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6", + "category": "Second", + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [], + "type": "GIFT_VOUCHER", + "discount": null, + "gift": { + "amount": 2000, + "balance": 0, + "effect": null + }, + "loyalty_card": null, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": "secret-code1", + "metadata": { + "region": "APAC", + "season": "Fall" }, - "Invalid Redemption Parent": { - "value": { - "code": 400, - "key": "invalid_redemption_parent", - "message": "Invalid redemption parent", - "details": "You can rollback only a redemption that does not have parent redemption.", - "request_id": "v-0c6382005e03b3bd2f" + "assets": { + "qr": { + "id": "U2FsdGVkX1+VibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BVibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/GVIi0p5fL5hxAY/ZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd//S4R9AB+60T/x4kSKu3lgfa9KgJmbyrzXm7Ggly06/qph4/asJaZVZIXEba4WJCeHqXCEgg==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FGVIi0p5fL5hxAY%2FZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd%2F%2FS4R9AB%2B60T%2Fx4kSKu3lgfa9KgJmbyrzXm7Ggly06%2Fqph4%2FasJaZVZIXEba4WJCeHqXCEgg%3D%3D" } }, - "Invalid Redemption": { - "value": { - "code": 400, - "key": "invalid_redemption", - "message": "Invalid redemption", - "details": "You can rollback only a single redemption. Use different endpoint for stacked redemption.", - "request_id": "v-0c675e5e2e04e31bb3" + "is_referral_code": false, + "created_at": "2022-09-23T11:05:42.164Z", + "updated_at": "2023-01-27T12:34:57.102Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": 18, + "redeemed_quantity": 1, + "redeemed_amount": 2000, + "object": "list", + "url": "/v1/vouchers/CODE14/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/CODE14/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + } + }, + "gift": { + "amount": 2000 + } + } + }, + "Discount Coupon": { + "value": { + "id": "r_0c5e8ef10842da0aad", + "object": "redemption", + "date": "2023-01-27T12:55:34.689Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "result": "SUCCESS", + "order": { + "id": "ord_J5ogV1Gkk2yfxmBEhYIg4O65", + "source_id": null, + "created_at": "2023-01-27T12:55:34.673Z", + "updated_at": null, + "status": "PAID", + "amount": 6000, + "items_discount_amount": 300, + "total_discount_amount": 300, + "total_amount": 5700, + "items_applied_discount_amount": 300, + "total_applied_discount_amount": 300, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 3300, + "discount_amount": 148, + "applied_discount_amount": 148, + "price": 3000, + "subtotal_amount": 3152 + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 2, + "amount": 3400, + "discount_amount": 152, + "applied_discount_amount": 152, + "price": 3000, + "subtotal_amount": 3248 } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" }, - "Invalid Order": { - "value": { - "code": 400, - "key": "invalid_order", - "message": "Invalid order", - "details": "Order is not related with redemption.", - "request_id": "v-0ca2770e3fc4047e25" + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5e8ef10842da0aad": { + "date": "2023-01-27T12:55:34.689Z", + "related_object_type": "voucher", + "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u" } + } + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "voucher": { + "id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "code": "2CpRCE2c", + "campaign": null, + "campaign_id": null, + "category": null, + "category_id": null, + "categories": [], + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 300, + "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" }, - "Invalidate Customer": { - "value": { - "code": 400, - "key": "invalid_customer", - "message": "Invalid customer", - "details": "Customer is not related with redemption.", - "request_id": "v-0ca284851b0404513f" + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1+ro/6HLsfI9E/rz0QEoYv+rcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz+WQtg4nKpjUS0wcA7AuIbz2zb870YfJO/r5UBS5gCqQ==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bro%2F6HLsfI9E%2Frz0QEoYv%2BrcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz%2BWQtg4nKpjUS0wcA7AuIbz2zb870YfJO%2Fr5UBS5gCqQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3/4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ+aTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3%2F4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ%2BaTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw%3D%3D" } + }, + "is_referral_code": false, + "created_at": "2022-09-19T10:06:07.932Z", + "updated_at": "2023-01-27T12:55:34.690Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_HesdqEzt5e9c0T56", + "rule_id": "val_gZft0NKZSUWK", + "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "related_object_type": "voucher", + "object": "validation_rules_assignment" + } + ], + "total": 1 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 2, + "object": "list", + "url": "/v1/vouchers/2CpRCE2c/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/2CpRCE2c/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [ + { + "object": "product", + "id": "prod_0a9f9ab4ab019a42d5", + "source_id": "prod_0a9f9ab4ab019a42d5", + "strict": true, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0a9f9aeddb019a42db", + "source_id": "prod_0a9f9aeddb019a42db", + "strict": true, + "effect": "APPLY_TO_EVERY" + } + ], + "total": 2, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" } } } - } - }, - "404": { - "description": "Returns an error if the rollback redemption process failed.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Cannot find customer": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find customer with id cust_eWgXlBBiY6THFRJwX45Iakv4s", - "request_id": "v-0c5ebc5de80a2cf1a5", - "resource_id": "cust_eWgXlBBiY6THFRJwX45Iakv4s", - "resource_type": "customer" + }, + "Loyalty Card": { + "value": { + "id": "r_0c5e8f2cd78497a372", + "object": "redemption", + "date": "2023-01-27T12:56:35.934Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 300, + "result": "SUCCESS", + "order": { + "id": "ord_MGTimoN4VtSj7iT75bP01FsH", + "source_id": null, + "created_at": "2023-01-27T12:56:35.923Z", + "updated_at": null, + "status": "PAID", + "amount": 6000, + "discount_amount": 6000, + "total_discount_amount": 6000, + "total_amount": 0, + "applied_discount_amount": 6000, + "total_applied_discount_amount": 6000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 3300, + "price": 3000, + "subtotal_amount": 3300 + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 2, + "amount": 3400, + "price": 3000, + "subtotal_amount": 3400 + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5e8f2cd78497a372": { + "date": "2023-01-27T12:56:35.934Z", + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + } + } + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 6500, + "balance": 5086 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" } + }, + "is_referral_code": false, + "created_at": "2022-11-10T06:28:59.970Z", + "updated_at": "2023-01-27T12:56:35.935Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "holder": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 10, + "redeemed_points": 1414, + "object": "list", + "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" } + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", + "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "object": "reward", + "name": "100 = $20", + "created_at": "2022-11-10T06:28:39.582Z", + "updated_at": null, + "parameters": { + "coin": { + "exchange_ratio": 20, + "points_ratio": 100 + } + }, + "type": "COIN" + }, + "loyalty_card": { + "points": 300 } } } @@ -64521,1284 +63141,1367 @@ } } }, - "/v1/promotions/tiers/{promotionTierId}/redemption": { - "parameters": [ - { + "400": { + "description": "Returns an error if something goes wrong. A common source of error is an invalid or expired voucher, or a valid gift voucher with insufficient available balance.", + "content": { + "application/json": { "schema": { - "type": "string" - }, - "name": "promotionTierId", - "in": "path", - "required": true, - "description": "ID of the promotion tier to be redeemed." - } - ], - "post": { - "operationId": "redeem-promotion", - "deprecated": true, - "tags": [ - "REDEMPTIONS API" - ], - "summary": "Redeem Promotion [Deprecated]", - "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for promotion tier redemption, and we do not recommend using it. The new [Stackable Discounts API](ref:redeem-stacked-discounts) 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. \n\nTo redeem a promotion, you create a redemption object passing a context.\n\nYou can retrieve a list of active promotions through the [Validate Promotions](ref:validate-promotions) endpoint. That validation method will return a list of active​ promotion tiers identified by thier IDs. \n\n> 📘 Redemption rollback\n>\n> Do you need to undo a redemption? You can do it with [redemption rollback](ref:rollback-redemption).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Provide the redemption context in the request body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/7_req_redeem_promotion_tier" - }, - "examples": { - "One product one sku": { - "value": { - "customer": { - "source_id": "annie@lemon.com", - "name": "Annie Lemon", - "email": "annie@lemon.com" - }, - "order": { - "amount": 200000, - "items": [ - { - "source_id": "apple534", - "product_id": "prod_anJ03RZZq74z4v", - "related_object": "product", - "quantity": 2, - "price": 50000, - "product": { - "override": true, - "name": "Apple iPhone 8", - "metadata": { - "shop": "citycenter", - "category": "electronics" - } - }, - "metadata": { - "series": "2022-783CV" - } - }, - { - "sku_id": "sku_0KtP4rvwEECQ2U", - "source_id": "apple534-ihd5", - "related_object": "sku", - "quantity": 1, - "price": 100000, - "sku": { - "override": true, - "sku": "Apple iPad 10 Silver 64GB", - "metadata": { - "category": "electronics" - } - } - } - ] - } - } + "$ref": "#/components/schemas/e_error_expanded" + }, + "examples": { + "Voucher disabled": { + "value": { + "code": 400, + "key": "voucher_disabled", + "message": "voucher is disabled", + "details": "AnsvocvP", + "request_id": "v-0c5d710a63c4110ae9", + "resource_id": "rf_0c5d710a87c8a31f86", + "resource_type": "redemption", + "error": { + "message": "The voucher has been disabled and cannot be used." + } + } + }, + "Invalid Customer": { + "value": { + "code": 400, + "key": "invalid_customer", + "message": "Customer must be a holder of a loyalty card.", + "details": "AnsvocvP", + "request_id": "v-0c5e628bd14411244b", + "resource_id": "rf_0c5e628bf841c7f248", + "resource_type": "redemption", + "error": { + "message": "The customer is invalid." + } + } + }, + "Voucher Inactive": { + "value": { + "code": 400, + "key": "voucher_not_active_now", + "message": "voucher not active now", + "details": "CODE14", + "request_id": "v-0c5e89b9300d820994", + "resource_id": "rf_0c5e89b945d33b9c02", + "resource_type": "redemption", + "error": { + "message": "The voucher is not active in the given timeframe." } } } } - }, - "responses": { - "200": { - "description": "Returns a redemption object if the redeem operation succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/7_obj_redemption_object_promotion_tier_extended" - }, - "examples": { - "One product one sku": { - "value": { - "id": "r_0ca2699201c03f121b", - "object": "redemption", - "date": "2023-03-21T05:49:00.807Z", - "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==", - "metadata": null, - "result": "SUCCESS", - "order": { - "id": "ord_IVEF85NZCXmP4S1fGmImSTwH", - "source_id": null, - "created_at": "2023-03-21T05:49:00.772Z", - "updated_at": null, - "status": "PAID", - "amount": 200000, - "discount_amount": 80000, - "total_discount_amount": 80000, - "total_amount": 120000, - "applied_discount_amount": 80000, - "total_applied_discount_amount": 80000, - "items": [ - { - "object": "order_item", - "source_id": "apple534", - "related_object": "product", - "product_id": "prod_anJ03RZZq74z4v", - "quantity": 2, - "amount": 100000, - "price": 50000, - "subtotal_amount": 100000, - "product": { - "id": "prod_0c5d6689b39320059b", - "source_id": "prod_anJ03RZZq74z4v", - "name": "Apple iPhone 8", - "metadata": { - "shop": "citycenter", - "category": "electronics" - } - }, - "metadata": { - "series": "2022-783CV" - } - }, - { - "object": "order_item", - "source_id": "apple534-ihd5", - "related_object": "sku", - "sku_id": "sku_0KtP4rvwEECQ2U", - "quantity": 1, - "amount": 100000, - "price": 100000, - "subtotal_amount": 100000, - "sku": { - "sku": "Apple iPad 10 Silver 64GB", - "metadata": { - "category": "electronics" - } - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "object": "customer" - }, - "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0ca2699201c03f121b": { - "date": "2023-03-21T05:49:00.807Z", - "related_object_type": "promotion_tier", - "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "related_object_parent_id": "camp_w7BUstntAm8jbIDjfM49volj" - } - } - }, - "channel": { - "channel_id": "e55f3aaa-b303-421a-b562-ca8529ed341d", - "channel_type": "API" - }, - "customer": { - "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "name": "Annie Lemon", - "email": "annie@lemon.com", - "source_id": "annie@lemon.com", - "metadata": { - "age": 2 - }, - "object": "customer" - }, - "related_object_type": "promotion_tier", - "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "voucher": null, - "promotion_tier": { - "id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "created_at": "2022-09-23T08:31:23.022Z", - "updated_at": "2023-02-01T07:47:57.324Z", - "name": "Percent Discount", - "banner": "Get 40% off", - "action": { - "discount": { - "type": "PERCENT", - "percent_off": 40, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "hierarchy": 2, - "campaign": { - "id": "camp_w7BUstntAm8jbIDjfM49volj", - "start_date": "2019-08-16T00:00:00.000Z", - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "campaign_id": "camp_w7BUstntAm8jbIDjfM49volj", - "active": true, - "start_date": "2022-09-21T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "summary": { - "redemptions": { - "total_redeemed": 5 - }, - "orders": { - "total_amount": 616000, - "total_discount_amount": 246400 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_z6MvMg2Zf2UABNWN", - "rule_id": "val_q8qUBMOh5qIQ", - "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "related_object_type": "promotion_tier", - "object": "validation_rules_assignment" - } - ], - "total": 1 - }, - "category_id": null, - "categories": [] - } + } + } + } + } + } + }, + "/client/v1/redeem": { + "post": { + "operationId": "redeem-voucher-client-side", + "deprecated": true, + "tags": [ + "REDEMPTIONS API" + ], + "summary": "Redeem Voucher (client-side) [Deprecated]", + "description": "\n> ❗️ Deprecated \n>\n> 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](ref:redeem-stacked-discounts-client-side) 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. \n\nTo 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). \n\nThe client-side redemption works similar to the server-side [voucher redemption](ref:redeem-voucher) endpoint. The difference lies in the authorization. For the client-side, you can use client-side keys.\n\n\n> 📘 Opt-in \n>\n> By default this feature is disabled. If you want to use it, you will need to enable the function explicitly in **Project Settings**.\n\n\n> ❗️ Security Threat \n>\n> 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.\n\n### Expand Response\nYou may expand the response by adding the following object to your request body. The expanded response will include the category details of the voucher.\n\n```json\n{\n \"options\": {\n \"expand\": [\n \"category\"\n ]\n }\n}\n```", + "parameters": [ + { + "$ref": "#/components/parameters/origin" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "code", + "description": "Voucher code being redeemed.", + "required": true + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "tracking_id", + "description": "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](ref:validate-voucher), or a string identifying customer, with the options described below. Although not all information is required, the extra info helps prevent fraud." + } + ], + "security": [ + { + "X-Client-Application-Id-1": [], + "X-Client-Token-1": [] + } + ], + "requestBody": { + "description": "Provide the redemption context in the request body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_req_redeem_voucher" + } + } + } + }, + "responses": { + "200": { + "description": "Returns a redemption object if the redeem operation succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_res_redeem_voucher" + }, + "examples": { + "Gift Voucher": { + "value": { + "id": "r_0c5e8a38730ccec0d5", + "object": "redemption", + "date": "2023-01-27T12:34:57.100Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 2000, + "result": "SUCCESS", + "order": { + "id": "ord_S4BvUj64TlGqVZDOeud7z3rU", + "source_id": null, + "created_at": "2023-01-27T12:34:57.086Z", + "updated_at": null, + "status": "PAID", + "amount": 6000, + "discount_amount": 2000, + "total_discount_amount": 2000, + "total_amount": 4000, + "applied_discount_amount": 2000, + "total_applied_discount_amount": 2000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 3300, + "price": 3000, + "subtotal_amount": 3300 + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 2, + "amount": 3400, + "price": 3000, + "subtotal_amount": 3400 } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" }, - "Example": { - "value": { - "id": "r_0c64c10b8ece60bd91", - "object": "redemption", - "date": "2023-02-01T08:25:22.235Z", - "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==", - "metadata": null, - "result": "SUCCESS", - "order": { - "id": "ord_7n58dbLV2jMG4C14XjEYEbjh", - "source_id": null, - "created_at": "2023-02-01T08:25:22.192Z", - "updated_at": null, - "status": "PAID", - "amount": 200000, - "discount_amount": 80000, - "total_discount_amount": 80000, - "total_amount": 120000, - "applied_discount_amount": 80000, - "total_applied_discount_amount": 80000, - "items": [ - { - "object": "order_item", - "source_id": "apple534", - "related_object": "product", - "product_id": "prod_anJ03RZZq74z4v", - "quantity": 2, - "amount": 100000, - "price": 50000, - "subtotal_amount": 100000, - "product": { - "id": "prod_0c5d6689b39320059b", - "source_id": "prod_anJ03RZZq74z4v", - "name": "Apple iPhone 8", - "metadata": { - "shop": "citycenter", - "category": "electronics" - } - }, - "metadata": { - "series": "2022-783CV" - } - }, - { - "object": "order_item", - "source_id": "apple534-ihd5", - "related_object": "sku", - "sku_id": "sku_0KtP4rvwEECQ2U", - "quantity": 1, - "amount": 100000, - "price": 100000, - "subtotal_amount": 100000, - "sku": { - "sku": "Apple iPad 10 Silver 64GB", - "metadata": { - "category": "electronics" - } - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "object": "customer" - }, - "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c64c10b8ece60bd91": { - "date": "2023-02-01T08:25:22.235Z", - "related_object_type": "promotion_tier", - "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "related_object_parent_id": "camp_w7BUstntAm8jbIDjfM49volj" - } - } - }, - "customer": { - "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", - "name": "Annie Lemon", - "email": "annie@lemon.com", - "source_id": "annie@lemon.com", - "metadata": { - "age": 2 - }, - "object": "customer" - }, - "related_object_type": "promotion_tier", - "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "voucher": null, - "promotion_tier": { - "id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "created_at": "2022-09-23T08:31:23.022Z", - "updated_at": "2023-02-01T07:47:57.324Z", - "name": "Percent Discount", - "banner": "Get 40% off", - "action": { - "discount": { - "type": "PERCENT", - "percent_off": 40, - "effect": "APPLY_TO_ORDER" - } - }, - "metadata": {}, - "hierarchy": 2, - "campaign": { - "id": "camp_w7BUstntAm8jbIDjfM49volj", - "start_date": "2019-08-16T00:00:00.000Z", - "expiration_date": null, - "active": true, - "object": "campaign" - }, - "campaign_id": null, - "active": true, - "start_date": "2022-09-21T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "summary": { - "redemptions": { - "total_redeemed": 3 - }, - "orders": { - "total_amount": 408000, - "total_discount_amount": 163200 - } - }, - "object": "promotion_tier", - "validation_rule_assignments": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_z6MvMg2Zf2UABNWN", - "rule_id": "val_q8qUBMOh5qIQ", - "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "related_object_type": "promotion_tier", - "object": "validation_rules_assignment" - } - ], - "total": 1 - } - } + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5e8a38730ccec0d5": { + "date": "2023-01-27T12:34:57.100Z", + "related_object_type": "voucher", + "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", + "related_object_parent_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6" } } - } - } - } - }, - "400": { - "description": "Returns an error if the promotion tier is inactive.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_expanded" - }, - "examples": { - "Inactive Promotion": { - "value": { - "code": 400, - "key": "promotion_inactive", - "message": "Inactive Promotion", - "details": "Promotion Tier with id: promo_DE1N30D731Tg2F6NoMwNas2W is disabled.", - "request_id": "v-0c64b722160294496b", - "resource_id": "rf_0c64b7223cce60eec6", - "resource_type": "redemption", - "error": { - "message": "The promotion is inactive." - } + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", + "voucher": { + "id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", + "code": "CODE14", + "campaign": "Gift Card Campaign", + "campaign_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6", + "category": "Second", + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [], + "type": "GIFT_VOUCHER", + "discount": null, + "gift": { + "amount": 2000, + "balance": 0, + "effect": null + }, + "loyalty_card": null, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": "secret-code1", + "metadata": { + "region": "APAC", + "season": "Fall" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX1+VibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BVibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/GVIi0p5fL5hxAY/ZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd//S4R9AB+60T/x4kSKu3lgfa9KgJmbyrzXm7Ggly06/qph4/asJaZVZIXEba4WJCeHqXCEgg==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FGVIi0p5fL5hxAY%2FZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd%2F%2FS4R9AB%2B60T%2Fx4kSKu3lgfa9KgJmbyrzXm7Ggly06%2Fqph4%2FasJaZVZIXEba4WJCeHqXCEgg%3D%3D" } + }, + "is_referral_code": false, + "created_at": "2022-09-23T11:05:42.164Z", + "updated_at": "2023-01-27T12:34:57.102Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": 18, + "redeemed_quantity": 1, + "redeemed_amount": 2000, + "object": "list", + "url": "/v1/vouchers/CODE14/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/CODE14/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" } + }, + "gift": { + "amount": 2000 } } - } - } - } - } - }, - "/client/v1/redemptions": { - "post": { - "operationId": "redeem-stacked-discounts-client-side", - "tags": [ - "STACKABLE DISCOUNTS API" - ], - "summary": "Redeem Stackable Discounts (client-side)", - "description": "Use this method to redeem up to 5 redeemables in a single API request. This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications.\n\n## How API returns calculated discounts and order amounts in the response\n\nIn the table below, you can see the logic the API follows to calculate discounts and amounts:\n\n| **Field** | **Calculation** | **Description** |\n|:---|:---|:---|\n| amount | N/A | This field shows the order amount before applying any discount |\n| total_amount | `total_amount` = `amount` - `total_discount_amount` | This field shows the order amount after applying all the discounts |\n| 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. |\n| items_discount_amount | sum(items, i => i.discount_amount) | This field sums up all product-specific discounts |\n| total_discount_amount | `total_discount_amount` = `discount_amount` + `items_discount_amount` | This field sums up all order-level and all product-specific discounts |\n| applied_discount_amount | N/A | This field shows the order-level discount applied in a particular request |\n| items_applied_discount_amount | sum(items, i => i.applied_discount_amount) | This field sums up all product-specific discounts applied in a particular request |\n| 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 |\n\n\n> 📘 Rollbacks\n>\n> 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](ref:rollback-stacked-redemptions).", - "parameters": [ - { - "$ref": "#/components/parameters/origin" - } - ], - "security": [ - { - "X-Client-Application-Id-1": [], - "X-Client-Token-1": [] - } - ], - "requestBody": { - "description": "## Expanded Response\n\nResponses will vary depending on the strings passed in the `options.expand` string array.\n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
                  - Order data with calculated discounts are listed in each child redemption object.
                  - Metadata not included for each discount type. |\n| [\"order\", \"redemption\"] | - Returns redemption object `metadata`.
                  - Order data with calculated discounts are listed in each child redemption object. |\n| [\"redeemable\", \"redemption\"] | - Returns each discount type's `metadata` in each child redemption object.
                  - Returns redemption object `metadata`. |\n| [\"redemption\"] | - Returns redemption object `metadata`. |\n| [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object
                  - Returns redemption object `metadata`.
                  - Returns an expanded `categories` object, showing details about the category. |", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/19_req_redemptions" - }, - "examples": { - "Example": { - "value": { - "customer": { - "source_id": "sample_customer", - "metadata": { - "key": "value" - } + }, + "Discount Coupon": { + "value": { + "id": "r_0c5e8ef10842da0aad", + "object": "redemption", + "date": "2023-01-27T12:55:34.689Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "result": "SUCCESS", + "order": { + "id": "ord_J5ogV1Gkk2yfxmBEhYIg4O65", + "source_id": null, + "created_at": "2023-01-27T12:55:34.673Z", + "updated_at": null, + "status": "PAID", + "amount": 6000, + "items_discount_amount": 300, + "total_discount_amount": 300, + "total_amount": 5700, + "items_applied_discount_amount": 300, + "total_applied_discount_amount": 300, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 3300, + "discount_amount": 148, + "applied_discount_amount": 148, + "price": 3000, + "subtotal_amount": 3152 }, - "options": { - "expand": [ - "order", - "redeemable", - "category" - ] + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 2, + "amount": 3400, + "discount_amount": 152, + "applied_discount_amount": 152, + "price": 3000, + "subtotal_amount": 3248 + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5e8ef10842da0aad": { + "date": "2023-01-27T12:55:34.689Z", + "related_object_type": "voucher", + "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u" + } + } + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "voucher": { + "id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "code": "2CpRCE2c", + "campaign": null, + "campaign_id": null, + "category": null, + "category_id": null, + "categories": [], + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 300, + "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1+ro/6HLsfI9E/rz0QEoYv+rcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz+WQtg4nKpjUS0wcA7AuIbz2zb870YfJO/r5UBS5gCqQ==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bro%2F6HLsfI9E%2Frz0QEoYv%2BrcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz%2BWQtg4nKpjUS0wcA7AuIbz2zb870YfJO%2Fr5UBS5gCqQ%3D%3D" }, - "redeemables": [ + "barcode": { + "id": "U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3/4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ+aTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3%2F4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ%2BaTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-09-19T10:06:07.932Z", + "updated_at": "2023-01-27T12:55:34.690Z", + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_HesdqEzt5e9c0T56", + "rule_id": "val_gZft0NKZSUWK", + "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "related_object_type": "voucher", + "object": "validation_rules_assignment" + } + ], + "total": 1 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 2, + "object": "list", + "url": "/v1/vouchers/2CpRCE2c/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/2CpRCE2c/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [ + { + "object": "product", + "id": "prod_0a9f9ab4ab019a42d5", + "source_id": "prod_0a9f9ab4ab019a42d5", + "strict": true, + "effect": "APPLY_TO_EVERY" + }, { - "object": "voucher", - "id": "voucher-code" + "object": "product", + "id": "prod_0a9f9aeddb019a42db", + "source_id": "prod_0a9f9aeddb019a42db", + "strict": true, + "effect": "APPLY_TO_EVERY" } ], - "session": { - "type": "LOCK", - "key": "session_key" + "total": 2, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + } + } + } + }, + "Loyalty Card": { + "value": { + "id": "r_0c5e8f2cd78497a372", + "object": "redemption", + "date": "2023-01-27T12:56:35.934Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 300, + "result": "SUCCESS", + "order": { + "id": "ord_MGTimoN4VtSj7iT75bP01FsH", + "source_id": null, + "created_at": "2023-01-27T12:56:35.923Z", + "updated_at": null, + "status": "PAID", + "amount": 6000, + "discount_amount": 6000, + "total_discount_amount": 6000, + "total_amount": 0, + "applied_discount_amount": 6000, + "total_applied_discount_amount": 6000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 3300, + "price": 3000, + "subtotal_amount": 3300 }, - "order": { - "amount": 55000, - "status": "PAID", - "items": [ - { - "quantity": 2, - "price": 20000, - "source_id": "sample product1", - "related_object": "product", - "product": { - "metadata": { - "key": "value" - } - } - }, - { - "quantity": 1, - "price": 15000, - "source_id": "sample product2", - "related_object": "product", - "product": { - "metadata": { - "key": "value" - } - } - } + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 2, + "amount": 3400, + "price": 3000, + "subtotal_amount": 3400 + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5e8f2cd78497a372": { + "date": "2023-01-27T12:56:35.934Z", + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + } + } + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 6500, + "balance": 5086 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-11-10T06:28:59.970Z", + "updated_at": "2023-01-27T12:56:35.935Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "holder": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 10, + "redeemed_points": 1414, + "object": "list", + "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + } + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" ], - "metadata": { - "key": "value" - } + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", + "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "object": "reward", + "name": "100 = $20", + "created_at": "2022-11-10T06:28:39.582Z", + "updated_at": null, + "parameters": { + "coin": { + "exchange_ratio": 20, + "points_ratio": 100 } - } + }, + "type": "COIN" + }, + "loyalty_card": { + "points": 300 } } } } - }, - "responses": { - "200": { - "description": "All promo codes and tiers provided in redeemables are redeemed during the request and returned in the API response. As a result, there are child `redemptions` related to redemptions of each redeemable and a `parent_redemption` that presents the final effect of redeeming all redeemables and stores the list of child redemptions. \n\n| Response Parameter | Description |\n|:---|:---|\n| redemptions
                  `array of objects` | This array lists all child redemptions that were executed during the request. Each child redemption returns a redemption object with detailed information on how each discount/code was applied to the order. You can see the effect of each consecutive redemption within the order object of each redemption, specifically the `total_discount_amount` parameter. This is why the sequence in which the discounts were provided in the request body matters. Each subsequent redemption object contains the order object which combines the effect of the previously applied discounts. |\n| parent_redemption
                  `object` | Represents the final effect of all child redemptions executed during the request. |\n| order
                  `object` | Represents order details after all discounts are applied. |", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/19_res_redemptions_POST" + } + } + }, + "400": { + "description": "Returns an error if something goes wrong. A common source of error is an invalid or expired voucher, or a valid gift voucher with insufficient available balance.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_expanded" + }, + "examples": { + "Voucher disabled": { + "value": { + "code": 400, + "key": "voucher_disabled", + "message": "voucher is disabled", + "details": "AnsvocvP", + "request_id": "v-0c5d710a63c4110ae9", + "resource_id": "rf_0c5d710a87c8a31f86", + "resource_type": "redemption", + "error": { + "message": "The voucher has been disabled and cannot be used." + } + } + }, + "Invalid Customer": { + "value": { + "code": 400, + "key": "invalid_customer", + "message": "Customer must be a holder of a loyalty card.", + "details": "AnsvocvP", + "request_id": "v-0c5e628bd14411244b", + "resource_id": "rf_0c5e628bf841c7f248", + "resource_type": "redemption", + "error": { + "message": "The customer is invalid." + } + } + }, + "Voucher Inactive": { + "value": { + "code": 400, + "key": "voucher_not_active_now", + "message": "voucher not active now", + "details": "CODE14", + "request_id": "v-0c5e89b9300d820994", + "resource_id": "rf_0c5e89b945d33b9c02", + "resource_type": "redemption", + "error": { + "message": "The voucher is not active in the given timeframe." } } } } } } + } + } + } + }, + "/v1/redemptions/{redemptionId}/rollback": { + "parameters": [ + { + "schema": { + "type": "string" }, - "/v1/validations": { - "post": { - "operationId": "validate-stacked-discounts", - "tags": [ - "STACKABLE DISCOUNTS API" - ], - "summary": "Validate Stackable Discounts", - "description": "Verify redeemables provided in the request. This method is designed for server side integration which means that it is accessible only through private keys.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "## Expanded Response \n\nResponses will vary depending on the strings passed in the `options.expand` string array. You can customize the response by using one of the following combinations of strings.\n \n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
                  - Order data with calculated discounts are listed in each child redeemable object.
                  - Metadata _not_ included for each discount type. |\n| [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. |\n| [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
                  - Includes `metadata` for each discount type. |\n| [\"category\"] | - Returns an expanded `categories` object, showing details about the category. |", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/19_req_validations" + "name": "redemptionId", + "in": "path", + "required": true, + "description": "The original redemption ID to be rolled back (undone)." + } + ], + "post": { + "operationId": "rollback-redemption", + "tags": [ + "REDEMPTIONS API" + ], + "summary": "Rollback Redemption", + "description": "Your business logic may include a case when you need to undo a redemption. You can revert a redemption by calling this API endpoint. \n\n ## Effect \nThe operation \n- creates a rollback entry in voucher's redemption history (`redemption.redemption_entries`) and \n- gives 1 redemption back to the pool (decreases `redeemed_quantity` by 1). \n## Returned funds \nIn case of *gift card vouchers*, this method returns funds back according to the source redemption. In case of *loyalty card vouchers*, this method returns points back according to the source redemption.", + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "reason", + "description": "Reason for the rollback." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Add information about the original customer and order. Customer data and Redemption metadata can be updated in Voucherify when passing the customer data in the request body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_req_rollback_redemption" + }, + "examples": { + "Promotion": { + "value": { + "customer": { + "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "name": "Annie Lemons", + "email": "annie@lemon.com", + "phone": "+1 933 222 3334", + "birthday": "1900-12-02", + "birthdate": "1900-12-01", + "address": { + "city": "New York", + "state": "NY", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 5", + "country": "United States", + "postal_code": "100012" + }, + "metadata": { + "age": 23 + } }, - "examples": { - "1 Redeemable": { - "value": { - "customer": { - "source_id": "sample_customer", - "metadata": { - "key": "value" + "order": { + "source_id": "test_rollback_8" + }, + "metadata": { + "location_id": [ + "L2" + ] + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a redemption rollback object indicating the result of the rollback.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_res_rollback_redemption" + }, + "examples": { + "Loyalty Card": { + "value": { + "id": "rr_0c5eba630bc4979e70", + "object": "redemption_rollback", + "date": "2023-01-27T16:05:23.631Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": -2, + "redemption": "r_0c5bf3323008a35032", + "reason": "A UI rollback to check for result in API response to listing.", + "result": "SUCCESS", + "order": { + "id": "ord_dqxr4uzaYWkTZnrSEMoQtCF8", + "source_id": null, + "created_at": "2023-01-25T12:18:09.203Z", + "updated_at": "2023-01-27T16:05:23.687Z", + "status": "CANCELED", + "amount": 2100, + "total_amount": 2100, + "items": [ + { + "object": "order_item", + "product_id": "prod_0bc3bd8a4e072c5275", + "quantity": 3, + "amount": 2100, + "price": 700, + "subtotal_amount": 2100, + "product": { + "name": "Bouquet - Romantic Roses", + "price": 700 } + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5bf3323008a35032": { + "date": "2023-01-25T12:18:09.216Z", + "rollback_id": "rr_0c5eba630bc4979e70", + "rollback_date": "2023-01-27T16:05:23.631Z", + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + } + } + }, + "channel": { + "channel_id": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH", + "channel_type": "USER" + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "categories": [], + "discount": null, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "additional_info": null, + "assets": { + "qr": {}, + "barcode": {} + }, + "updated_at": null, + "object": "voucher" + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" }, - "options": { - "expand": [ - "order", - "redeemable", - "category" - ] + "object": "customer" + }, + "assignment_id": "rewa_0ZwLAHgeU9IrI2V1ofYRmW7g", + "voucher": { + "id": "v_4GaEX7clyqMaveT7vHhoyRpsIgxv95Q6", + "code": "HAPPY-ORDER5My", + "campaign": "$20 off the entire order", + "campaign_id": "camp_5h0wc453_4", + "category": null, + "category_id": "cat_0b688929a2476386a6", + "categories": [], + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 2000, + "effect": "APPLY_TO_ORDER" }, - "redeemables": [ - { - "object": "voucher", - "id": "voucher-code" + "gift": null, + "loyalty_card": null, + "start_date": "2022-09-20T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "21ceb848-4869-4dac-ba41-f854bda3a101", + "url": "https://dl.voucherify.io/api/v1/assets/qr/21ceb848-4869-4dac-ba41-f854bda3a101" + }, + "barcode": { + "id": "1dba9cb2-fb28-4c8d-8548-5edb2eb01f5a", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/1dba9cb2-fb28-4c8d-8548-5edb2eb01f5a" } - ], - "session": { - "type": "LOCK" }, - "order": { - "amount": 55000, - "status": "PAID", - "items": [ - { - "quantity": 2, - "price": 20000, - "source_id": "sample product1", - "related_object": "product", - "product": { - "metadata": { - "key": "value" - } - } - }, - { - "quantity": 1, - "price": 15000, - "source_id": "sample product2", - "related_object": "product", - "product": { - "metadata": { - "key": "value" - } - } - } - ], - "metadata": { - "key": "value" - } + "is_referral_code": false, + "created_at": "2023-01-25T12:18:09.256Z", + "updated_at": null, + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/HAPPY-ORDER5My/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/HAPPY-ORDER5My/publications?page=1&limit=10" + }, + "object": "voucher" + }, + "id": "rew_MF4hKh1IKYgJkPjbcFbH94Ho", + "object": "reward", + "name": "Digital Present", + "created_at": "2023-01-25T12:16:44.557Z", + "updated_at": null, + "parameters": { + "campaign": { + "id": "camp_5h0wc453_4", + "type": "DISCOUNT_COUPONS" } - } + }, + "type": "CAMPAIGN" }, - "5 Redeemables": { - "value": { - "customer": { - "source_id": "36_bob" - }, - "options": { - "expand": [ - "order", - "redeemable", - "category" - ] + "loyalty_card": { + "points": -2 + } + } + }, + "Discount Coupon": { + "value": { + "id": "rr_0c5eb002b40cce9d62", + "object": "redemption_rollback", + "date": "2023-01-27T15:20:03.536Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "redemption": "r_0c5e8ef10842da0aad", + "result": "SUCCESS", + "order": { + "id": "ord_J5ogV1Gkk2yfxmBEhYIg4O65", + "source_id": null, + "created_at": "2023-01-27T12:55:34.673Z", + "updated_at": "2023-01-27T15:20:03.743Z", + "status": "CANCELED", + "amount": 6000, + "total_amount": 6000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 3300, + "price": 3000, + "subtotal_amount": 3300 }, - "redeemables": [ - { - "object": "voucher", - "id": "GNcuPKGe" - }, - { - "object": "voucher", - "id": "AnsvocvP", - "reward": { - "id": "rew_EPx1hCTpqzF0HW1z9NKckZH4" - } - }, - { - "object": "voucher", - "id": "M3X8IwW8", - "gift": { - "credits": 100 - } - }, - { - "object": "promotion_tier", - "id": "promo_DE1N30D731Tg2F6NoMwNas2W" - }, - { - "object": "promotion_tier", - "id": "promo_NDHgTg4VnOLYNjk9r7WOmQxf" - } + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 2, + "amount": 3400, + "price": 3000, + "subtotal_amount": 3400 + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5e8ef10842da0aad": { + "date": "2023-01-27T12:55:34.689Z", + "rollback_id": "rr_0c5eb002b40cce9d62", + "rollback_date": "2023-01-27T15:20:03.536Z", + "related_object_type": "voucher", + "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u" + } + } + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" ], - "session": { - "type": "LOCK" + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "voucher": { + "id": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "code": "2CpRCE2c", + "campaign": null, + "campaign_id": null, + "category": null, + "category_id": null, + "categories": [], + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 300, + "effect": "APPLY_TO_ITEMS_PROPORTIONALLY" + }, + "gift": null, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1+ro/6HLsfI9E/rz0QEoYv+rcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz+WQtg4nKpjUS0wcA7AuIbz2zb870YfJO/r5UBS5gCqQ==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2Bro%2F6HLsfI9E%2Frz0QEoYv%2BrcVIEERdbV3gB4104zYyGfpydtSxS1WfpbuiDUfMizQAl1EMzoYsud5XTKBBwUkGkI5IPl84lPz%2BWQtg4nKpjUS0wcA7AuIbz2zb870YfJO%2Fr5UBS5gCqQ%3D%3D" }, - "order": { - "items": [ - { - "sku_id": "sku_0a3efc90375d1217e2", - "quantity": 1 - }, - { - "product_id": "prod_0bc3bd8a4e072c5275", - "quantity": 1 - } - ] + "barcode": { + "id": "U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3/4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ+aTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19SWjP3ZUbFh26gCGb4xm3K95jhzfk1XXlKcYlHPtDTYR3%2F4dYbig4xxRmkgpQLa93Woz9Hq3h4JBQ%2BaTlftkEzL4D4OSAWi1aWlfxVikrJd6TMFLh9mmbmskodjs4MIdOFlluDWyarlw%3D%3D" } - } + }, + "is_referral_code": false, + "created_at": "2022-09-19T10:06:07.932Z", + "updated_at": "2023-01-27T15:20:03.707Z", + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "object": "list", + "url": "/v1/vouchers/2CpRCE2c/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/2CpRCE2c/publications?page=1&limit=10" + }, + "object": "voucher" } } - } - } - }, - "responses": { - "200": { - "description": "All codes and tiers provided in redeemables are validated during the request and the result of their validation is returned in the API response. \n\n| **Response** | **Description** |\n|:---|:---|\n| valid
                  `boolean` | If **all** redeemables can be applied in the given context, the API returns `true`. Otherwise, if at least one redeemable can't be applied, the API returns `false`. |\n| redeemables
                  `array of objects` | The `redeemables` array lists the validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"` |\n| order
                  `object` | The `order` object presents details of the order provided in the request after all discounts are applied. |\n", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/19_res_validations" + }, + "Gift Card": { + "value": { + "id": "rr_0c5eb099214ccea115", + "object": "redemption_rollback", + "date": "2023-01-27T15:22:37.573Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": -2000, + "redemption": "r_0c5e8a38730ccec0d5", + "result": "SUCCESS", + "order": { + "id": "ord_S4BvUj64TlGqVZDOeud7z3rU", + "source_id": null, + "created_at": "2023-01-27T12:34:57.086Z", + "updated_at": "2023-01-27T15:22:37.628Z", + "status": "CANCELED", + "amount": 6000, + "total_amount": 6000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0a9f9ab4ab019a42d5", + "quantity": 1, + "amount": 3300, + "price": 3000, + "subtotal_amount": 3300 + }, + { + "object": "order_item", + "product_id": "prod_0a9f9aeddb019a42db", + "quantity": 2, + "amount": 3400, + "price": 3000, + "subtotal_amount": 3400 + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c5e8a38730ccec0d5": { + "date": "2023-01-27T12:34:57.100Z", + "rollback_id": "rr_0c5eb099214ccea115", + "rollback_date": "2023-01-27T15:22:37.573Z", + "related_object_type": "voucher", + "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", + "related_object_parent_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6" + } + } }, - "examples": { - "False": { - "value": { - "valid": false, - "redeemables": [ - { - "status": "INAPPLICABLE", - "id": "eee33463", - "object": "voucher", - "result": { - "error": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id eee33463", - "request_id": "v-0c6c6e20dc42940f0b", - "resource_id": "eee33463", - "resource_type": "voucher" - } - } - }, - { - "status": "SKIPPED", - "id": "promo_Mwy9XpA0TLctSGriM5kum0qp", - "object": "promotion_tier", - "result": {} - } - ], - "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==" + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", + "voucher": { + "id": "v_UFAc7FTVO0HtJV2hWZls4O7eqHMyn62g", + "code": "CODE14", + "campaign": "Gift Card Campaign", + "campaign_id": "camp_B2Gx83JsSbmvj05MOwxYbNm6", + "category": "Second", + "category_id": "cat_0bb343dee3cdb5ec0c", + "categories": [], + "type": "GIFT_VOUCHER", + "discount": null, + "gift": { + "amount": 2000, + "balance": 2000, + "effect": null + }, + "loyalty_card": null, + "start_date": "2020-08-16T00:00:00.000Z", + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": "secret-code1", + "metadata": { + "region": "APAC", + "season": "Fall" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX1+VibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BVibJ6VGxrSVw5qmdbPMP3aP8HfcngMxtQc9Bm649CK1dK36e8YR820Ct26IkvDemEDzV8ozhB3F2BpazbgvCmhAo2Gvmo2WtwBwPh2ISAPJiXQCHRjwmKiqogjqQaNKWLxwDIBUc2jQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/GVIi0p5fL5hxAY/ZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd//S4R9AB+60T/x4kSKu3lgfa9KgJmbyrzXm7Ggly06/qph4/asJaZVZIXEba4WJCeHqXCEgg==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FGVIi0p5fL5hxAY%2FZBmuAU7nYYS03umjd30dwI5v5ZbpNc3Q5MiYbMuIOIT0H2fUTTwd%2F%2FS4R9AB%2B60T%2Fx4kSKu3lgfa9KgJmbyrzXm7Ggly06%2Fqph4%2FasJaZVZIXEba4WJCeHqXCEgg%3D%3D" } }, - "True - 5 Redeemables": { - "value": { - "valid": true, - "redeemables": [ - { - "status": "APPLICABLE", - "id": "GNcuPKGe", - "object": "voucher", - "order": { - "amount": 2700, - "items_discount_amount": 1700, - "total_discount_amount": 1700, - "total_amount": 1000, - "items_applied_discount_amount": 1700, - "total_applied_discount_amount": 1700, - "items": [ - { - "object": "order_item", - "product_id": "prod_s3C0nDpr0DuC7", - "sku_id": "sku_0a3efc90375d1217e2", - "quantity": 1, - "amount": 2000, - "discount_amount": 1000, - "applied_discount_amount": 1000, - "price": 2000, - "subtotal_amount": 1000, - "product": { - "id": "prod_s3C0nDpr0DuC7", - "source_id": "test_prod_id_2", - "name": "Watchflix" - }, - "sku": { - "id": "sku_0a3efc90375d1217e2", - "source_id": "test_standard_ultra_hd", - "sku": "Premium", - "price": 2000 - } - }, - { - "object": "order_item", - "product_id": "prod_0bc3bd8a4e072c5275", - "quantity": 1, - "amount": 700, - "discount_amount": 700, - "applied_discount_amount": 700, - "price": 700, - "subtotal_amount": 0, - "product": { - "id": "prod_0bc3bd8a4e072c5275", - "name": "Bouquet - Romantic Roses", - "price": 700 - } - } - ], - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "applicable_to": { - "data": [ - { - "object": "products_collection", - "id": "pc_a11pr0dUc75", - "strict": false, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "sku", - "id": "sku_0a3efc90375d1217e2", - "source_id": "test_standard_ultra_hd", - "product_id": "prod_s3C0nDpr0DuC7", - "product_source_id": "test_prod_id_2", - "strict": true, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0bc3bd8a4e072c5275", - "source_id": "prod_0bc3bd8a4e072c5275", - "strict": true, - "effect": "APPLY_TO_EVERY" - } - ], - "total": 3, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "result": { - "discount": { - "type": "AMOUNT", - "effect": "APPLY_TO_ITEMS", - "amount_off": 1000, - "is_dynamic": false - } - }, - "metadata": {}, - "categories": [] - }, - { - "status": "APPLICABLE", - "id": "AnsvocvP", - "object": "voucher", - "order": { - "amount": 2700, - "items_discount_amount": 1700, - "total_discount_amount": 1700, - "total_amount": 1000, - "items": [ - { - "object": "order_item", - "product_id": "prod_s3C0nDpr0DuC7", - "sku_id": "sku_0a3efc90375d1217e2", - "quantity": 1, - "amount": 2000, - "discount_amount": 1000, - "price": 2000, - "subtotal_amount": 1000, - "product": { - "id": "prod_s3C0nDpr0DuC7", - "source_id": "test_prod_id_2", - "name": "Watchflix" - }, - "sku": { - "id": "sku_0a3efc90375d1217e2", - "source_id": "test_standard_ultra_hd", - "sku": "Premium", - "price": 2000 - } - }, - { - "object": "order_item", - "product_id": "prod_0bc3bd8a4e072c5275", - "quantity": 1, - "amount": 700, - "discount_amount": 700, - "price": 700, - "subtotal_amount": 0, - "product": { - "id": "prod_0bc3bd8a4e072c5275", - "name": "Bouquet - Romantic Roses", - "price": 700 - } - } - ], - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "result": { - "loyalty_card": { - "points": 4 - } - }, - "metadata": {}, - "categories": [ - { - "id": "cat_0bb81a481615a37b5e", - "name": "Second", - "hierarchy": 2, - "created_at": "2022-09-20T05:58:01.561Z", - "object": "category" - } - ] - }, - { - "status": "APPLICABLE", - "id": "M3X8IwW8", - "object": "voucher", - "order": { - "amount": 2700, - "discount_amount": 100, - "items_discount_amount": 1700, - "total_discount_amount": 1800, - "total_amount": 900, - "applied_discount_amount": 100, - "total_applied_discount_amount": 100, - "items": [ - { - "object": "order_item", - "product_id": "prod_s3C0nDpr0DuC7", - "sku_id": "sku_0a3efc90375d1217e2", - "quantity": 1, - "amount": 2000, - "discount_amount": 1000, - "price": 2000, - "subtotal_amount": 1000, - "product": { - "id": "prod_s3C0nDpr0DuC7", - "source_id": "test_prod_id_2", - "name": "Watchflix" - }, - "sku": { - "id": "sku_0a3efc90375d1217e2", - "source_id": "test_standard_ultra_hd", - "sku": "Premium", - "price": 2000 - } - }, - { - "object": "order_item", - "product_id": "prod_0bc3bd8a4e072c5275", - "quantity": 1, - "amount": 700, - "discount_amount": 700, - "price": 700, - "subtotal_amount": 0, - "product": { - "id": "prod_0bc3bd8a4e072c5275", - "name": "Bouquet - Romantic Roses", - "price": 700 - } - } - ], - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "result": { - "gift": { - "credits": 100 - } - }, - "metadata": {}, - "categories": [] - }, - { - "status": "APPLICABLE", - "id": "promo_DE1N30D731Tg2F6NoMwNas2W", - "object": "promotion_tier", - "order": { - "amount": 2700, - "discount_amount": 460, - "items_discount_amount": 1700, - "total_discount_amount": 2160, - "total_amount": 540, - "applied_discount_amount": 360, - "total_applied_discount_amount": 360, - "items": [ - { - "object": "order_item", - "product_id": "prod_s3C0nDpr0DuC7", - "sku_id": "sku_0a3efc90375d1217e2", - "quantity": 1, - "amount": 2000, - "discount_amount": 1000, - "price": 2000, - "subtotal_amount": 1000, - "product": { - "id": "prod_s3C0nDpr0DuC7", - "source_id": "test_prod_id_2", - "name": "Watchflix" - }, - "sku": { - "id": "sku_0a3efc90375d1217e2", - "source_id": "test_standard_ultra_hd", - "sku": "Premium", - "price": 2000 - } - }, - { - "object": "order_item", - "product_id": "prod_0bc3bd8a4e072c5275", - "quantity": 1, - "amount": 700, - "discount_amount": 700, - "price": 700, - "subtotal_amount": 0, - "product": { - "id": "prod_0bc3bd8a4e072c5275", - "name": "Bouquet - Romantic Roses", - "price": 700 - } - } - ], - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "applicable_to": { - "data": [ - { - "object": "sku", - "id": "sku_0a3efc90375d1217e2", - "source_id": "test_standard_ultra_hd", - "product_id": "prod_s3C0nDpr0DuC7", - "product_source_id": "test_prod_id_2", - "strict": true, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0bc3bd8a4e072c5275", - "source_id": "prod_0bc3bd8a4e072c5275", - "strict": true, - "effect": "APPLY_TO_EVERY" - } - ], - "total": 2, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [ - { - "object": "product", - "id": "prod_0b2c2ddf35150b83bb", - "source_id": "97", - "strict": false, - "effect": "APPLY_TO_EVERY" - } - ], - "total": 1, - "data_ref": "data", - "object": "list" - }, - "result": { - "discount": { - "type": "PERCENT", - "effect": "APPLY_TO_ORDER", - "percent_off": 40, - "is_dynamic": false - } - }, - "metadata": {} - }, - { - "status": "APPLICABLE", - "id": "promo_NDHgTg4VnOLYNjk9r7WOmQxf", - "object": "promotion_tier", - "order": { - "amount": 2700, - "discount_amount": 490, - "items_discount_amount": 1700, - "total_discount_amount": 2190, - "total_amount": 510, - "applied_discount_amount": 30, - "total_applied_discount_amount": 30, - "items": [ - { - "object": "order_item", - "product_id": "prod_s3C0nDpr0DuC7", - "sku_id": "sku_0a3efc90375d1217e2", - "quantity": 1, - "amount": 2000, - "discount_amount": 1000, - "price": 2000, - "subtotal_amount": 1000, - "product": { - "id": "prod_s3C0nDpr0DuC7", - "source_id": "test_prod_id_2", - "name": "Watchflix" - }, - "sku": { - "id": "sku_0a3efc90375d1217e2", - "source_id": "test_standard_ultra_hd", - "sku": "Premium", - "price": 2000 - } - }, - { - "object": "order_item", - "product_id": "prod_0bc3bd8a4e072c5275", - "quantity": 1, - "amount": 700, - "discount_amount": 700, - "price": 700, - "subtotal_amount": 0, - "product": { - "id": "prod_0bc3bd8a4e072c5275", - "name": "Bouquet - Romantic Roses", - "price": 700 - } - } - ], - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" - }, - "applicable_to": { - "data": [ - { - "object": "sku", - "id": "sku_0a3efc90375d1217e2", - "source_id": "test_standard_ultra_hd", - "product_id": "prod_s3C0nDpr0DuC7", - "product_source_id": "test_prod_id_2", - "strict": true, - "effect": "APPLY_TO_EVERY" - }, - { - "object": "product", - "id": "prod_0bc3bd8a4e072c5275", - "source_id": "prod_0bc3bd8a4e072c5275", - "strict": true, - "effect": "APPLY_TO_EVERY" - } - ], - "total": 2, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [ - { - "object": "product", - "id": "prod_0b2c2ddf35150b83bb", - "source_id": "97", - "strict": false, - "effect": "APPLY_TO_EVERY" - } - ], - "total": 1, - "data_ref": "data", - "object": "list" - }, - "result": { - "discount": { - "type": "AMOUNT", - "effect": "APPLY_TO_ORDER", - "amount_off": 30, - "is_dynamic": false - } - }, - "metadata": {} + "is_referral_code": false, + "created_at": "2022-09-23T11:05:42.164Z", + "updated_at": "2023-01-27T15:22:37.595Z", + "redemption": { + "quantity": 18, + "redeemed_quantity": 0, + "redeemed_amount": 0, + "object": "list", + "url": "/v1/vouchers/CODE14/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 0, + "url": "/v1/vouchers/CODE14/publications?page=1&limit=10" + }, + "object": "voucher" + }, + "gift": { + "amount": -2000 + } + } + }, + "Promotion Tier": { + "value": { + "id": "rr_0ca286e96cc03f3e76", + "object": "redemption_rollback", + "date": "2023-03-21T07:57:12.526Z", + "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==", + "metadata": { + "location_id": [ + "L2" + ] + }, + "redemption": "r_0ca286d222d2f7dc1f", + "reason": "To undo a redemption.", + "result": "SUCCESS", + "order": { + "id": "ord_0FR01SqYIxV4ITzgs1yZjkK6", + "source_id": "test_rollback_8", + "created_at": "2023-03-21T07:56:48.634Z", + "updated_at": "2023-03-21T07:57:12.546Z", + "status": "CANCELED", + "amount": 200000, + "total_amount": 200000, + "items": [ + { + "object": "order_item", + "source_id": "apple534", + "related_object": "product", + "product_id": "prod_anJ03RZZq74z4v", + "quantity": 2, + "amount": 100000, + "price": 50000, + "subtotal_amount": 100000, + "product": { + "id": "prod_0c5d6689b39320059b", + "source_id": "prod_anJ03RZZq74z4v", + "name": "Apple iPhone 8", + "metadata": { + "shop": "citycenter", + "category": "electronics" } - ], - "order": { - "amount": 2700, - "discount_amount": 490, - "items_discount_amount": 1700, - "total_discount_amount": 2190, - "total_amount": 510, - "applied_discount_amount": 490, - "items_applied_discount_amount": 1700, - "total_applied_discount_amount": 2190, - "items": [ - { - "object": "order_item", - "product_id": "prod_s3C0nDpr0DuC7", - "sku_id": "sku_0a3efc90375d1217e2", - "quantity": 1, - "amount": 2000, - "discount_amount": 1000, - "applied_discount_amount": 1000, - "price": 2000, - "subtotal_amount": 1000, - "product": { - "id": "prod_s3C0nDpr0DuC7", - "source_id": "test_prod_id_2", - "name": "Watchflix" - }, - "sku": { - "id": "sku_0a3efc90375d1217e2", - "source_id": "test_standard_ultra_hd", - "sku": "Premium", - "price": 2000 - } - }, - { - "object": "order_item", - "product_id": "prod_0bc3bd8a4e072c5275", - "quantity": 1, - "amount": 700, - "discount_amount": 700, - "applied_discount_amount": 700, - "price": 700, - "subtotal_amount": 0, - "product": { - "id": "prod_0bc3bd8a4e072c5275", - "name": "Bouquet - Romantic Roses", - "price": 700 - } - } - ], - "metadata": {}, - "customer_id": null, - "referrer_id": null, - "object": "order" }, - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "session": { - "key": "ssn_pkJfPcWAgp9WyHpA62Eky8X8SzxpKub2", - "type": "LOCK", - "ttl": 7, - "ttl_unit": "DAYS" + "metadata": { + "series": "2022-783CV" + } + }, + { + "object": "order_item", + "source_id": "apple534-ihd5", + "related_object": "sku", + "sku_id": "sku_0KtP4rvwEECQ2U", + "quantity": 1, + "amount": 100000, + "price": 100000, + "subtotal_amount": 100000, + "sku": { + "sku": "Apple iPad 10 Silver 64GB", + "metadata": { + "category": "electronics" + } } } + ], + "metadata": {}, + "customer": { + "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "object": "customer" + }, + "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0ca286d222d2f7dc1f": { + "date": "2023-03-21T07:56:48.651Z", + "rollback_id": "rr_0ca286e96cc03f3e76", + "rollback_date": "2023-03-21T07:57:12.526Z", + "related_object_type": "promotion_tier", + "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "related_object_parent_id": "camp_w7BUstntAm8jbIDjfM49volj" + } } - } - } - } - }, - "400": { - "description": "Returns an error if the payload is missing an `\"object\"` or `\"id\"` property in the redeemables array, if you add more than one promotion stack or attempt to join stacks with vouchers/promotion tiers.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_400_invalid_payload" }, - "examples": { - "Invalid payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Property .redeemables[1] should have required property 'id'", - "request_id": "v-0b4ff38ab8c8164573" - } + "channel": { + "channel_id": "e55f3aaa-b303-421a-b562-ca8529ed341d", + "channel_type": "API" + }, + "customer": { + "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "name": "Annie Lemons", + "email": "annie@lemon.com", + "source_id": "annie@lemon.com", + "metadata": { + "age": 23 }, - "Duplicated Redeemables": { - "value": { - "code": 400, - "key": "duplicated_redeemables", - "message": "Duplicated redeemables detected", - "details": "Duplicated redeemables detected in one redemption", - "request_id": "v-0b4ffecfb408165300" + "object": "customer" + }, + "related_object_type": "promotion_tier", + "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "voucher": null, + "promotion_tier": { + "id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "created_at": "2022-09-23T08:31:23.022Z", + "updated_at": "2023-02-01T07:47:57.324Z", + "name": "Percent Discount", + "banner": "Get 40% off", + "action": { + "discount": { + "type": "PERCENT", + "percent_off": 40, + "effect": "APPLY_TO_ORDER" } }, - "Invalid Redeemables": { - "value": { - "code": 400, - "key": "invalid_redeemables", - "message": "Invalid redeemables", - "details": "Promotion Stack cannot be use with other redeemables", - "request_id": "v-0b5007812f48165d6b" + "metadata": {}, + "hierarchy": 2, + "campaign": { + "id": "camp_w7BUstntAm8jbIDjfM49volj", + "start_date": "2019-08-16T00:00:00.000Z", + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "campaign_id": "camp_w7BUstntAm8jbIDjfM49volj", + "active": true, + "start_date": "2022-09-21T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "summary": { + "redemptions": { + "total_redeemed": 5 + }, + "orders": { + "total_amount": 616000, + "total_discount_amount": 246400 } - } + }, + "object": "promotion_tier", + "validation_rule_assignments": null, + "category_id": null, + "categories": [] } } } @@ -65806,196 +64509,487 @@ } } }, - "/client/v1/validations": { - "post": { - "operationId": "validate-stacked-discounts-client-side", - "tags": [ - "STACKABLE DISCOUNTS API" - ], - "summary": "Validate Stackable Discounts (client-side)", - "description": "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.", - "parameters": [ - { - "$ref": "#/components/parameters/origin" + "400": { + "description": "Returns an error if the rollback redemption process failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Already rolledback": { + "value": { + "code": 400, + "key": "already_rolled_back", + "message": "Already rolled back", + "details": "Redemption has been already rolled back.", + "request_id": "v-0c5eb3bd81cd7e3a39", + "resource_id": "rrf_0c5eb3bd884497ed05", + "resource_type": "redemption_rollback" + } + }, + "Invalid Redemption Parent": { + "value": { + "code": 400, + "key": "invalid_redemption_parent", + "message": "Invalid redemption parent", + "details": "You can rollback only a redemption that does not have parent redemption.", + "request_id": "v-0c6382005e03b3bd2f" + } + }, + "Invalid Redemption": { + "value": { + "code": 400, + "key": "invalid_redemption", + "message": "Invalid redemption", + "details": "You can rollback only a single redemption. Use different endpoint for stacked redemption.", + "request_id": "v-0c675e5e2e04e31bb3" + } + }, + "Invalid Order": { + "value": { + "code": 400, + "key": "invalid_order", + "message": "Invalid order", + "details": "Order is not related with redemption.", + "request_id": "v-0ca2770e3fc4047e25" + } + }, + "Invalidate Customer": { + "value": { + "code": 400, + "key": "invalid_customer", + "message": "Invalid customer", + "details": "Customer is not related with redemption.", + "request_id": "v-0ca284851b0404513f" + } + } } - ], - "security": [ - { - "X-Client-Application-Id-1": [], - "X-Client-Token-1": [] + } + } + }, + "404": { + "description": "Returns an error if the rollback redemption process failed.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Cannot find customer": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find customer with id cust_eWgXlBBiY6THFRJwX45Iakv4s", + "request_id": "v-0c5ebc5de80a2cf1a5", + "resource_id": "cust_eWgXlBBiY6THFRJwX45Iakv4s", + "resource_type": "customer" + } + } } - ], - "requestBody": { - "description": "## Expanded Response \n\nResponses will vary depending on the strings passed in the `options.expand` string array. You can customize the response by using one of the following combinations of strings. \n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
                  - Order data with calculated discounts are listed in each child redeemable object.
                  - Metadata _not_ included for each discount type. |\n| [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. |\n| [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
                  - Includes `metadata` for each discount type. |\n| [\"category\"] | - Returns an expanded `categories` object, showing details about the category. |", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/19_req_validations" + } + } + } + } + } + }, + "/v1/promotions/tiers/{promotionTierId}/redemption": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "promotionTierId", + "in": "path", + "required": true, + "description": "ID of the promotion tier to be redeemed." + } + ], + "post": { + "operationId": "redeem-promotion", + "deprecated": true, + "tags": [ + "REDEMPTIONS API" + ], + "summary": "Redeem Promotion [Deprecated]", + "description": "\n> ❗️ Deprecated \n>\n> This endpoint represents the deprecated version of the API responsible for promotion tier redemption, and we do not recommend using it. The new [Stackable Discounts API](ref:redeem-stacked-discounts) 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. \n\nTo redeem a promotion, you create a redemption object passing a context.\n\nYou can retrieve a list of active promotions through the [Validate Promotions](ref:validate-promotions) endpoint. That validation method will return a list of active​ promotion tiers identified by thier IDs. \n\n> 📘 Redemption rollback\n>\n> Do you need to undo a redemption? You can do it with [redemption rollback](ref:rollback-redemption).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Provide the redemption context in the request body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_req_redeem_promotion_tier" + }, + "examples": { + "One product one sku": { + "value": { + "customer": { + "source_id": "annie@lemon.com", + "name": "Annie Lemon", + "email": "annie@lemon.com" }, - "examples": { - "1 Redeemable": { - "value": { - "customer": { - "source_id": "sample_customer", + "order": { + "amount": 200000, + "items": [ + { + "source_id": "apple534", + "product_id": "prod_anJ03RZZq74z4v", + "related_object": "product", + "quantity": 2, + "price": 50000, + "product": { + "override": true, + "name": "Apple iPhone 8", "metadata": { - "key": "value" + "shop": "citycenter", + "category": "electronics" } }, - "options": { - "expand": [ - "order", - "redeemable", - "category" - ] - }, - "redeemables": [ - { - "object": "voucher", - "id": "voucher-code" + "metadata": { + "series": "2022-783CV" + } + }, + { + "sku_id": "sku_0KtP4rvwEECQ2U", + "source_id": "apple534-ihd5", + "related_object": "sku", + "quantity": 1, + "price": 100000, + "sku": { + "override": true, + "sku": "Apple iPad 10 Silver 64GB", + "metadata": { + "category": "electronics" } - ], - "session": { - "type": "LOCK" - }, - "order": { - "amount": 55000, - "status": "PAID", - "items": [ - { - "quantity": 2, - "price": 20000, - "source_id": "sample product1", - "related_object": "product", - "product": { - "metadata": { - "key": "value" - } - } - }, - { - "quantity": 1, - "price": 15000, - "source_id": "sample product2", - "related_object": "product", - "product": { - "metadata": { - "key": "value" - } - } + } + } + ] + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a redemption object if the redeem operation succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/7_obj_redemption_object_promotion_tier_extended" + }, + "examples": { + "One product one sku": { + "value": { + "id": "r_0ca2699201c03f121b", + "object": "redemption", + "date": "2023-03-21T05:49:00.807Z", + "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==", + "metadata": null, + "result": "SUCCESS", + "order": { + "id": "ord_IVEF85NZCXmP4S1fGmImSTwH", + "source_id": null, + "created_at": "2023-03-21T05:49:00.772Z", + "updated_at": null, + "status": "PAID", + "amount": 200000, + "discount_amount": 80000, + "total_discount_amount": 80000, + "total_amount": 120000, + "applied_discount_amount": 80000, + "total_applied_discount_amount": 80000, + "items": [ + { + "object": "order_item", + "source_id": "apple534", + "related_object": "product", + "product_id": "prod_anJ03RZZq74z4v", + "quantity": 2, + "amount": 100000, + "price": 50000, + "subtotal_amount": 100000, + "product": { + "id": "prod_0c5d6689b39320059b", + "source_id": "prod_anJ03RZZq74z4v", + "name": "Apple iPhone 8", + "metadata": { + "shop": "citycenter", + "category": "electronics" } - ], + }, "metadata": { - "key": "value" + "series": "2022-783CV" + } + }, + { + "object": "order_item", + "source_id": "apple534-ihd5", + "related_object": "sku", + "sku_id": "sku_0KtP4rvwEECQ2U", + "quantity": 1, + "amount": 100000, + "price": 100000, + "subtotal_amount": 100000, + "sku": { + "sku": "Apple iPad 10 Silver 64GB", + "metadata": { + "category": "electronics" + } } } + ], + "metadata": {}, + "customer": { + "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "object": "customer" + }, + "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0ca2699201c03f121b": { + "date": "2023-03-21T05:49:00.807Z", + "related_object_type": "promotion_tier", + "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "related_object_parent_id": "camp_w7BUstntAm8jbIDjfM49volj" + } } }, - "5 Redeemables": { - "value": { - "customer": { - "source_id": "36_bob" - }, - "options": { - "expand": [ - "order", - "redeemable", - "category" - ] + "channel": { + "channel_id": "e55f3aaa-b303-421a-b562-ca8529ed341d", + "channel_type": "API" + }, + "customer": { + "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "name": "Annie Lemon", + "email": "annie@lemon.com", + "source_id": "annie@lemon.com", + "metadata": { + "age": 2 + }, + "object": "customer" + }, + "related_object_type": "promotion_tier", + "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "voucher": null, + "promotion_tier": { + "id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "created_at": "2022-09-23T08:31:23.022Z", + "updated_at": "2023-02-01T07:47:57.324Z", + "name": "Percent Discount", + "banner": "Get 40% off", + "action": { + "discount": { + "type": "PERCENT", + "percent_off": 40, + "effect": "APPLY_TO_ORDER" + } + }, + "metadata": {}, + "hierarchy": 2, + "campaign": { + "id": "camp_w7BUstntAm8jbIDjfM49volj", + "start_date": "2019-08-16T00:00:00.000Z", + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "campaign_id": "camp_w7BUstntAm8jbIDjfM49volj", + "active": true, + "start_date": "2022-09-21T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "summary": { + "redemptions": { + "total_redeemed": 5 }, - "redeemables": [ - { - "object": "voucher", - "id": "GNcuPKGe" - }, - { - "object": "voucher", - "id": "AnsvocvP", - "reward": { - "id": "rew_EPx1hCTpqzF0HW1z9NKckZH4" - } - }, + "orders": { + "total_amount": 616000, + "total_discount_amount": 246400 + } + }, + "object": "promotion_tier", + "validation_rule_assignments": { + "object": "list", + "data_ref": "data", + "data": [ { - "object": "voucher", - "id": "M3X8IwW8", - "gift": { - "credits": 100 + "id": "asgm_z6MvMg2Zf2UABNWN", + "rule_id": "val_q8qUBMOh5qIQ", + "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "related_object_type": "promotion_tier", + "object": "validation_rules_assignment" + } + ], + "total": 1 + }, + "category_id": null, + "categories": [] + } + } + }, + "Example": { + "value": { + "id": "r_0c64c10b8ece60bd91", + "object": "redemption", + "date": "2023-02-01T08:25:22.235Z", + "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==", + "metadata": null, + "result": "SUCCESS", + "order": { + "id": "ord_7n58dbLV2jMG4C14XjEYEbjh", + "source_id": null, + "created_at": "2023-02-01T08:25:22.192Z", + "updated_at": null, + "status": "PAID", + "amount": 200000, + "discount_amount": 80000, + "total_discount_amount": 80000, + "total_amount": 120000, + "applied_discount_amount": 80000, + "total_applied_discount_amount": 80000, + "items": [ + { + "object": "order_item", + "source_id": "apple534", + "related_object": "product", + "product_id": "prod_anJ03RZZq74z4v", + "quantity": 2, + "amount": 100000, + "price": 50000, + "subtotal_amount": 100000, + "product": { + "id": "prod_0c5d6689b39320059b", + "source_id": "prod_anJ03RZZq74z4v", + "name": "Apple iPhone 8", + "metadata": { + "shop": "citycenter", + "category": "electronics" } }, - { - "object": "promotion_tier", - "id": "promo_DE1N30D731Tg2F6NoMwNas2W" - }, - { - "object": "promotion_tier", - "id": "promo_NDHgTg4VnOLYNjk9r7WOmQxf" + "metadata": { + "series": "2022-783CV" } - ], - "session": { - "type": "LOCK" }, - "order": { - "items": [ - { - "sku_id": "sku_0a3efc90375d1217e2", - "quantity": 1 - }, - { - "product_id": "prod_0bc3bd8a4e072c5275", - "quantity": 1 + { + "object": "order_item", + "source_id": "apple534-ihd5", + "related_object": "sku", + "sku_id": "sku_0KtP4rvwEECQ2U", + "quantity": 1, + "amount": 100000, + "price": 100000, + "subtotal_amount": 100000, + "sku": { + "sku": "Apple iPad 10 Silver 64GB", + "metadata": { + "category": "electronics" } - ] + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "object": "customer" + }, + "customer_id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c64c10b8ece60bd91": { + "date": "2023-02-01T08:25:22.235Z", + "related_object_type": "promotion_tier", + "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "related_object_parent_id": "camp_w7BUstntAm8jbIDjfM49volj" } } - } - } - } - } - }, - "responses": { - "200": { - "description": "All codes and tiers provided in redeemables are validated during the request and the result of their validation is returned in the API response. \n\n| **Response** | **Description** |\n|:---|:---|\n| valid
                  `boolean` | If **all** redeemables can be applied in the given context, the API returns `true`. Otherwise, if at least one redeemable can't be applied, the API returns `false`. |\n| redeemables
                  `array of objects` | The `redeemables` array lists the validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"` |\n| order
                  `object` | The `order` object presents details of the order provided in the request after all discounts are applied. |\n", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/19_res_validations" - } - } - } - }, - "400": { - "description": "Returns an error if the payload is missing an `\"object\"` or `\"id\"` property in the redeemables array, if you add more than one promotion stack or attempt to join stacks with vouchers/promotion tiers.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_400_invalid_payload" }, - "examples": { - "Invalid payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Property .redeemables[1] should have required property 'id'", - "request_id": "v-0b4ff38ab8c8164573" - } + "customer": { + "id": "cust_SolpIN5N4oZbCnrxZ5NHrbVB", + "name": "Annie Lemon", + "email": "annie@lemon.com", + "source_id": "annie@lemon.com", + "metadata": { + "age": 2 }, - "Duplicated Redeemables": { - "value": { - "code": 400, - "key": "duplicated_redeemables", - "message": "Duplicated redeemables detected", - "details": "Duplicated redeemables detected in one redemption", - "request_id": "v-0b4ffecfb408165300" + "object": "customer" + }, + "related_object_type": "promotion_tier", + "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "voucher": null, + "promotion_tier": { + "id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "created_at": "2022-09-23T08:31:23.022Z", + "updated_at": "2023-02-01T07:47:57.324Z", + "name": "Percent Discount", + "banner": "Get 40% off", + "action": { + "discount": { + "type": "PERCENT", + "percent_off": 40, + "effect": "APPLY_TO_ORDER" } }, - "Invalid Redeemables": { - "value": { - "code": 400, - "key": "invalid_redeemables", - "message": "Invalid redeemables", - "details": "Promotion Stack cannot be use with other redeemables", - "request_id": "v-0b5007812f48165d6b" + "metadata": {}, + "hierarchy": 2, + "campaign": { + "id": "camp_w7BUstntAm8jbIDjfM49volj", + "start_date": "2019-08-16T00:00:00.000Z", + "expiration_date": null, + "active": true, + "object": "campaign" + }, + "campaign_id": null, + "active": true, + "start_date": "2022-09-21T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "summary": { + "redemptions": { + "total_redeemed": 3 + }, + "orders": { + "total_amount": 408000, + "total_discount_amount": 163200 } + }, + "object": "promotion_tier", + "validation_rule_assignments": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_z6MvMg2Zf2UABNWN", + "rule_id": "val_q8qUBMOh5qIQ", + "related_object_id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "related_object_type": "promotion_tier", + "object": "validation_rules_assignment" + } + ], + "total": 1 } } } @@ -66004,1465 +64998,1537 @@ } } }, - "/v1/redemptions/{parentRedemptionId}/rollbacks": { - "parameters": [ - { + "400": { + "description": "Returns an error if the promotion tier is inactive.", + "content": { + "application/json": { "schema": { - "type": "string" - }, - "name": "parentRedemptionId", - "in": "path", - "required": true, - "description": "Unique identifier of a parent redemption, e.g. `r_JQfm73zWSJFQxs3bGxweYjgm`." - } - ], - "post": { - "operationId": "rollback-stacked-redemptions", - "tags": [ - "STACKABLE DISCOUNTS API" - ], - "summary": "Rollback Stackable Redemptions", - "description": "Rollback a stackable redemption. When you rollback a stacked redemption, all child redemptions will be rolled back. Provide the parent redemption ID as the path parameter.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns an array with the individual redemption rollback results along with the parent rollback result and related order.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/19_res_redemptions_parentRedemptionId_rollbacks" + "$ref": "#/components/schemas/e_error_expanded" + }, + "examples": { + "Inactive Promotion": { + "value": { + "code": 400, + "key": "promotion_inactive", + "message": "Inactive Promotion", + "details": "Promotion Tier with id: promo_DE1N30D731Tg2F6NoMwNas2W is disabled.", + "request_id": "v-0c64b722160294496b", + "resource_id": "rf_0c64b7223cce60eec6", + "resource_type": "redemption", + "error": { + "message": "The promotion is inactive." } } } - }, - "400": { - "description": "Returns an error indicating that the parent redemption ID is invalid.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Invalid Redemption Parent": { - "value": { - "code": 400, - "key": "invalid_redemption_parent", - "message": "Invalid redemption parent", - "details": "You can rollback only a redemption that does not have parent redemption.", - "request_id": "v-0b56a1cf1e4d69b375" + } + } + } + } + } + } + }, + "/client/v1/redemptions": { + "post": { + "operationId": "redeem-stacked-discounts-client-side", + "tags": [ + "STACKABLE DISCOUNTS API" + ], + "summary": "Redeem Stackable Discounts (client-side)", + "description": "Use this method to redeem up to 5 redeemables in a single API request. This method is accessible through public keys which you can use in client side requests coming from mobile and web browser applications.\n\n## How API returns calculated discounts and order amounts in the response\n\nIn the table below, you can see the logic the API follows to calculate discounts and amounts:\n\n| **Field** | **Calculation** | **Description** |\n|:---|:---|:---|\n| amount | N/A | This field shows the order amount before applying any discount |\n| total_amount | `total_amount` = `amount` - `total_discount_amount` | This field shows the order amount after applying all the discounts |\n| 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. |\n| items_discount_amount | sum(items, i => i.discount_amount) | This field sums up all product-specific discounts |\n| total_discount_amount | `total_discount_amount` = `discount_amount` + `items_discount_amount` | This field sums up all order-level and all product-specific discounts |\n| applied_discount_amount | N/A | This field shows the order-level discount applied in a particular request |\n| items_applied_discount_amount | sum(items, i => i.applied_discount_amount) | This field sums up all product-specific discounts applied in a particular request |\n| 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 |\n\n\n> 📘 Rollbacks\n>\n> 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](ref:rollback-stacked-redemptions).", + "parameters": [ + { + "$ref": "#/components/parameters/origin" + } + ], + "security": [ + { + "X-Client-Application-Id-1": [], + "X-Client-Token-1": [] + } + ], + "requestBody": { + "description": "## Expanded Response\n\nResponses will vary depending on the strings passed in the `options.expand` string array.\n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
                  - Order data with calculated discounts are listed in each child redemption object.
                  - Metadata not included for each discount type. |\n| [\"order\", \"redemption\"] | - Returns redemption object `metadata`.
                  - Order data with calculated discounts are listed in each child redemption object. |\n| [\"redeemable\", \"redemption\"] | - Returns each discount type's `metadata` in each child redemption object.
                  - Returns redemption object `metadata`. |\n| [\"redemption\"] | - Returns redemption object `metadata`. |\n| [\"redeemable\", \"redemption\", \"category\"] | - Returns each discount type's `metadata` in each child redemption object
                  - Returns redemption object `metadata`.
                  - Returns an expanded `categories` object, showing details about the category. |", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/19_req_redemptions" + }, + "examples": { + "Example": { + "value": { + "customer": { + "source_id": "sample_customer", + "metadata": { + "key": "value" + } + }, + "options": { + "expand": [ + "order", + "redeemable", + "category" + ] + }, + "redeemables": [ + { + "object": "voucher", + "id": "voucher-code" + } + ], + "session": { + "type": "LOCK", + "key": "session_key" + }, + "order": { + "amount": 55000, + "status": "PAID", + "items": [ + { + "quantity": 2, + "price": 20000, + "source_id": "sample product1", + "related_object": "product", + "product": { + "metadata": { + "key": "value" + } } }, - "Already rolled back": { - "value": { - "code": 400, - "key": "already_rolled_back", - "message": "Already rolled back", - "details": "Redemption has been already rolled back.", - "request_id": "v-0c67af9544c4e3388f", - "resource_id": "rrf_0c67af954e039be56b", - "resource_type": "redemption_rollback" + { + "quantity": 1, + "price": 15000, + "source_id": "sample product2", + "related_object": "product", + "product": { + "metadata": { + "key": "value" + } } } + ], + "metadata": { + "key": "value" } } } } } } - }, - "/v1/loyalty-campaign-object": { - "get": { - "operationId": "loyalty-campaign-object", - "tags": [ - "LOYALTIES API" - ], - "summary": "Loyalty Campaign Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Loyalty Campaign Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_loyalty_campaign_object" - } - } - } + } + }, + "responses": { + "200": { + "description": "All promo codes and tiers provided in redeemables are redeemed during the request and returned in the API response. As a result, there are child `redemptions` related to redemptions of each redeemable and a `parent_redemption` that presents the final effect of redeeming all redeemables and stores the list of child redemptions. \n\n| Response Parameter | Description |\n|:---|:---|\n| redemptions
                  `array of objects` | This array lists all child redemptions that were executed during the request. Each child redemption returns a redemption object with detailed information on how each discount/code was applied to the order. You can see the effect of each consecutive redemption within the order object of each redemption, specifically the `total_discount_amount` parameter. This is why the sequence in which the discounts were provided in the request body matters. Each subsequent redemption object contains the order object which combines the effect of the previously applied discounts. |\n| parent_redemption
                  `object` | Represents the final effect of all child redemptions executed during the request. |\n| order
                  `object` | Represents order details after all discounts are applied. |", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/19_res_redemptions_POST" } } } - }, - "/v1/loyalty-card-object": { - "get": { - "operationId": "loyalty-card-object", - "tags": [ - "LOYALTIES API" - ], - "summary": "Loyalty Card Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Loyalty Card Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_loyalty_card_object_non_expanded_categories" + } + } + } + }, + "/v1/validations": { + "post": { + "operationId": "validate-stacked-discounts", + "tags": [ + "STACKABLE DISCOUNTS API" + ], + "summary": "Validate Stackable Discounts", + "description": "Verify redeemables provided in the request. This method is designed for server side integration which means that it is accessible only through private keys.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "## Expanded Response \n\nResponses will vary depending on the strings passed in the `options.expand` string array. You can customize the response by using one of the following combinations of strings.\n \n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
                  - Order data with calculated discounts are listed in each child redeemable object.
                  - Metadata _not_ included for each discount type. |\n| [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. |\n| [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
                  - Includes `metadata` for each discount type. |\n| [\"category\"] | - Returns an expanded `categories` object, showing details about the category. |", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/19_req_validations" + }, + "examples": { + "1 Redeemable": { + "value": { + "customer": { + "source_id": "sample_customer", + "metadata": { + "key": "value" } - } - } - } - } - } - }, - "/v1/loyalty-tier-object": { - "get": { - "operationId": "loyalty-tier-object", - "tags": [ - "LOYALTIES API" - ], - "summary": "Loyalty Tier Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Loyalty Tier Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_loyalty_tier_object" + }, + "options": { + "expand": [ + "order", + "redeemable", + "category" + ] + }, + "redeemables": [ + { + "object": "voucher", + "id": "voucher-code" + } + ], + "session": { + "type": "LOCK" + }, + "order": { + "amount": 55000, + "status": "PAID", + "items": [ + { + "quantity": 2, + "price": 20000, + "source_id": "sample product1", + "related_object": "product", + "product": { + "metadata": { + "key": "value" + } + } + }, + { + "quantity": 1, + "price": 15000, + "source_id": "sample product2", + "related_object": "product", + "product": { + "metadata": { + "key": "value" + } + } + } + ], + "metadata": { + "key": "value" } } } - } - } - } - }, - "/v1/earning-object": { - "get": { - "operationId": "earning-rule-object", - "tags": [ - "LOYALTIES API" - ], - "summary": "Earning Rule Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Earning Rule Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_earning_rule_object" + }, + "5 Redeemables": { + "value": { + "customer": { + "source_id": "36_bob" + }, + "options": { + "expand": [ + "order", + "redeemable", + "category" + ] + }, + "redeemables": [ + { + "object": "voucher", + "id": "GNcuPKGe" + }, + { + "object": "voucher", + "id": "AnsvocvP", + "reward": { + "id": "rew_EPx1hCTpqzF0HW1z9NKckZH4" + } + }, + { + "object": "voucher", + "id": "M3X8IwW8", + "gift": { + "credits": 100 + } + }, + { + "object": "promotion_tier", + "id": "promo_DE1N30D731Tg2F6NoMwNas2W" + }, + { + "object": "promotion_tier", + "id": "promo_NDHgTg4VnOLYNjk9r7WOmQxf" } + ], + "session": { + "type": "LOCK" + }, + "order": { + "items": [ + { + "sku_id": "sku_0a3efc90375d1217e2", + "quantity": 1 + }, + { + "product_id": "prod_0bc3bd8a4e072c5275", + "quantity": 1 + } + ] } } } } } - }, - "/v1/loyalties": { - "get": { - "operationId": "list-loyalty-programs", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Loyalty Campaigns", - "description": "Returns a list of your loyalty campaigns.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" + } + }, + "responses": { + "200": { + "description": "All codes and tiers provided in redeemables are validated during the request and the result of their validation is returned in the API response. \n\n| **Response** | **Description** |\n|:---|:---|\n| valid
                  `boolean` | If **all** redeemables can be applied in the given context, the API returns `true`. Otherwise, if at least one redeemable can't be applied, the API returns `false`. |\n| redeemables
                  `array of objects` | The `redeemables` array lists the validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"` |\n| order
                  `object` | The `order` object presents details of the order provided in the request after all discounts are applied. |\n", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/19_res_validations" }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ] + "examples": { + "False": { + "value": { + "valid": false, + "redeemables": [ + { + "status": "INAPPLICABLE", + "id": "eee33463", + "object": "voucher", + "result": { + "error": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id eee33463", + "request_id": "v-0c6c6e20dc42940f0b", + "resource_id": "eee33463", + "resource_type": "voucher" + } + } + }, + { + "status": "SKIPPED", + "id": "promo_Mwy9XpA0TLctSGriM5kum0qp", + "object": "promotion_tier", + "result": {} + } + ], + "tracking_id": "track_VAVW6qltuo1/z+G2GI2LPw==" + } }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary with loyalty program objects. The loyalty campaigns are returned sorted by creation date, with the most recent campaigns appearing first.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_list_loyalty_campaigns" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "campaigns", - "campaigns": [ + "True - 5 Redeemables": { + "value": { + "valid": true, + "redeemables": [ + { + "status": "APPLICABLE", + "id": "GNcuPKGe", + "object": "voucher", + "order": { + "amount": 2700, + "items_discount_amount": 1700, + "total_discount_amount": 1700, + "total_amount": 1000, + "items_applied_discount_amount": 1700, + "total_applied_discount_amount": 1700, + "items": [ { - "id": "camp_eTIsUtuzkRXQT6rsUQqrS5Gw", - "name": "Loyalty Campaign 1", - "campaign_type": "LOYALTY_PROGRAM", - "type": "AUTO_UPDATE", - "voucher": { - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 0 - }, - "redemption": { - "quantity": null - }, - "code_config": { - "length": 8, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "########" - }, - "is_referral_code": false - }, - "auto_join": false, - "join_once": false, - "use_voucher_metadata_schema": true, - "description": "This is a campaign description.", - "vouchers_count": 6, - "active": true, - "metadata": { - "Season": "Fall" + "object": "order_item", + "product_id": "prod_s3C0nDpr0DuC7", + "sku_id": "sku_0a3efc90375d1217e2", + "quantity": 1, + "amount": 2000, + "discount_amount": 1000, + "applied_discount_amount": 1000, + "price": 2000, + "subtotal_amount": 1000, + "product": { + "id": "prod_s3C0nDpr0DuC7", + "source_id": "test_prod_id_2", + "name": "Watchflix" }, - "created_at": "2022-11-21T13:57:03.712Z", - "updated_at": "2022-11-23T09:59:49.581Z", - "creation_status": "DONE", - "vouchers_generation_status": "DONE", - "protected": false, - "category_id": "cat_0b6152ce12414820dc", - "categories": [], - "object": "campaign" + "sku": { + "id": "sku_0a3efc90375d1217e2", + "source_id": "test_standard_ultra_hd", + "sku": "Premium", + "price": 2000 + } }, { - "id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "name": "Loyalty Campaign - Tiers", - "campaign_type": "LOYALTY_PROGRAM", - "type": "AUTO_UPDATE", - "voucher": { - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 0 - }, - "redemption": { - "quantity": null - }, - "code_config": { - "length": 8, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "########", - "prefix": "LT1-", - "initial_count": 1 - }, - "is_referral_code": false, - "start_date": "2022-11-01T00:00:00.000Z" - }, - "auto_join": false, - "join_once": false, - "use_voucher_metadata_schema": true, - "start_date": "2022-11-01T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5, - 6 - ], - "vouchers_count": 3, - "active": true, - "metadata": {}, - "created_at": "2022-11-09T06:26:52.985Z", - "updated_at": "2022-11-10T08:54:46.136Z", - "creation_status": "DONE", - "vouchers_generation_status": "DONE", - "protected": false, - "category_id": "cat_0b8b5a427a0283c854", - "categories": [], - "loyalty_tiers_expiration": { - "qualification_type": "BALANCE", - "start_date": { - "type": "IMMEDIATE" - }, - "expiration_date": { - "type": "CUSTOM", - "extend": "P3M", - "rounding": { - "type": "MONTH", - "strategy": "END" - } - } - }, - "object": "campaign" + "object": "order_item", + "product_id": "prod_0bc3bd8a4e072c5275", + "quantity": 1, + "amount": 700, + "discount_amount": 700, + "applied_discount_amount": 700, + "price": 700, + "subtotal_amount": 0, + "product": { + "id": "prod_0bc3bd8a4e072c5275", + "name": "Bouquet - Romantic Roses", + "price": 700 + } + } + ], + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "applicable_to": { + "data": [ + { + "object": "products_collection", + "id": "pc_a11pr0dUc75", + "strict": false, + "effect": "APPLY_TO_EVERY" }, { - "id": "camp_NwO6D0Z0mpZ1CDc380DnPgrW", - "name": "Loyalty Campaign Example", - "campaign_type": "LOYALTY_PROGRAM", - "type": "STATIC", - "voucher": { - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 0 - }, - "redemption": { - "quantity": null - }, - "code_config": { - "length": 8, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "########", - "initial_count": 1 - }, - "is_referral_code": false, - "start_date": "2021-12-15T00:00:00.000Z", - "expiration_date": "2021-12-31T00:00:00.000Z", - "validity_timeframe": { - "interval": "P1D", - "duration": "PT1H" - } - }, - "auto_join": true, - "join_once": true, - "use_voucher_metadata_schema": true, - "start_date": "2021-12-15T00:00:00.000Z", - "expiration_date": "2021-12-31T00:00:00.000Z", - "validity_timeframe": { - "interval": "P1D", - "duration": "PT1H" + "object": "sku", + "id": "sku_0a3efc90375d1217e2", + "source_id": "test_standard_ultra_hd", + "product_id": "prod_s3C0nDpr0DuC7", + "product_source_id": "test_prod_id_2", + "strict": true, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0bc3bd8a4e072c5275", + "source_id": "prod_0bc3bd8a4e072c5275", + "strict": true, + "effect": "APPLY_TO_EVERY" + } + ], + "total": 3, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "result": { + "discount": { + "type": "AMOUNT", + "effect": "APPLY_TO_ITEMS", + "amount_off": 1000, + "is_dynamic": false + } + }, + "metadata": {}, + "categories": [] + }, + { + "status": "APPLICABLE", + "id": "AnsvocvP", + "object": "voucher", + "order": { + "amount": 2700, + "items_discount_amount": 1700, + "total_discount_amount": 1700, + "total_amount": 1000, + "items": [ + { + "object": "order_item", + "product_id": "prod_s3C0nDpr0DuC7", + "sku_id": "sku_0a3efc90375d1217e2", + "quantity": 1, + "amount": 2000, + "discount_amount": 1000, + "price": 2000, + "subtotal_amount": 1000, + "product": { + "id": "prod_s3C0nDpr0DuC7", + "source_id": "test_prod_id_2", + "name": "Watchflix" }, - "validity_day_of_week": [ - 3, - 4, - 5, - 6 - ], - "activity_duration_after_publishing": "P24D", - "vouchers_count": 0, - "active": false, - "metadata": {}, - "created_at": "2021-12-15T08:02:52.298Z", - "updated_at": "2021-12-15T08:11:43.808Z", - "creation_status": "DRAFT", - "vouchers_generation_status": "DRAFT", - "protected": false, - "category_id": null, - "categories": [], - "object": "campaign" + "sku": { + "id": "sku_0a3efc90375d1217e2", + "source_id": "test_standard_ultra_hd", + "sku": "Premium", + "price": 2000 + } + }, + { + "object": "order_item", + "product_id": "prod_0bc3bd8a4e072c5275", + "quantity": 1, + "amount": 700, + "discount_amount": 700, + "price": 700, + "subtotal_amount": 0, + "product": { + "id": "prod_0bc3bd8a4e072c5275", + "name": "Bouquet - Romantic Roses", + "price": 700 + } } ], - "total": 3 - } - } - } - } - } - } - } - }, - "post": { - "operationId": "create-loyalty-program", - "tags": [ - "LOYALTIES API" - ], - "summary": "Create Loyalty Campaign", - "description": "Creates a batch of [loyalty cards](ref:get-member) aggregated in a single loyalty campaign. It also allows you to define a custom codes pattern. \n\n\n> 📘 Global uniqueness\n> All codes are unique across the whole project. Voucherify won't allow to generate the same codes in any of your campaigns.\n\n\n> 🚧 Asyncronous action!\n>\n> This is an asynchronous action, you can't read or modify a newly created campaign until the code generation is completed. See `creation_status` field in the [loyalty campaign object](ref:get-loyalty-program) description.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the loyalty campaign details.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_create_loyalty_cards" - }, - "examples": { - "Example": { - "value": { - "name": "Loyalty Program 4", - "description": "This is a campaign description.", - "auto_join": true, - "join_once": true, - "use_voucher_metadata_schema": true, - "start_date": "2016-10-26T00:00:00Z", - "expiration_date": "2024-10-26T00:00:00Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "activity_duration_after_publishing": "P24D", - "category_id": "cat_0b6152ce12414820dc", - "vouchers_count": 2, - "voucher": { - "type": "LOYALTY_CARD", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "result": { "loyalty_card": { - "points": 0, - "expiration_rules": { - "period_type": "MONTH", - "period_value": 3, - "rounding_type": "END_OF_QUARTER" - } - }, - "redemption": { - "quantity": 2 - }, - "code_config": { - "pattern": "L-CARD-#######" + "points": 4 } }, - "metadata": { - "test": true - }, - "type": "STATIC", - "loyalty_tiers_expiration": { - "qualification_type": "BALANCE", - "start_date": { - "type": "IMMEDIATE" - }, - "expiration_date": { - "type": "CUSTOM", - "extend": "P3M", - "rounding": { - "type": "MONTH", - "strategy": "END" - } + "metadata": {}, + "categories": [ + { + "id": "cat_0bb81a481615a37b5e", + "name": "Second", + "hierarchy": 2, + "created_at": "2022-09-20T05:58:01.561Z", + "object": "category" } - } - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns a campaign object with its settings but without the loyalty card codes.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_loyalty_campaign_object" - }, - "examples": { - "Example": { - "value": { - "id": "camp_wGlqXtnHddb39DvHuuhvvbxi", - "name": "Loyalty Program 4", - "campaign_type": "LOYALTY_PROGRAM", - "type": "STATIC", - "voucher": { - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 0, - "expiration_rules": { - "period_type": "MONTH", - "period_value": 3, - "rounding_type": "END_OF_QUARTER" + ] + }, + { + "status": "APPLICABLE", + "id": "M3X8IwW8", + "object": "voucher", + "order": { + "amount": 2700, + "discount_amount": 100, + "items_discount_amount": 1700, + "total_discount_amount": 1800, + "total_amount": 900, + "applied_discount_amount": 100, + "total_applied_discount_amount": 100, + "items": [ + { + "object": "order_item", + "product_id": "prod_s3C0nDpr0DuC7", + "sku_id": "sku_0a3efc90375d1217e2", + "quantity": 1, + "amount": 2000, + "discount_amount": 1000, + "price": 2000, + "subtotal_amount": 1000, + "product": { + "id": "prod_s3C0nDpr0DuC7", + "source_id": "test_prod_id_2", + "name": "Watchflix" + }, + "sku": { + "id": "sku_0a3efc90375d1217e2", + "source_id": "test_standard_ultra_hd", + "sku": "Premium", + "price": 2000 } }, - "redemption": { - "quantity": 2 - }, - "code_config": { - "length": 7, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "L-CARD-#######" - }, - "is_referral_code": false, - "start_date": "2016-10-26T00:00:00.000Z", - "expiration_date": "2024-10-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P1D", - "duration": "PT1H" - } - }, - "auto_join": true, - "join_once": true, - "use_voucher_metadata_schema": true, - "description": "This is a campaign description.", - "start_date": "2016-10-26T00:00:00.000Z", - "expiration_date": "2024-10-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P1D", - "duration": "PT1H" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "activity_duration_after_publishing": "P24D", - "vouchers_count": 0, - "active": true, - "metadata": { - "test": true - }, - "created_at": "2022-11-29T13:10:30.848Z", - "category": "New Customers", - "creation_status": "IN_PROGRESS", - "vouchers_generation_status": "IN_PROGRESS", - "protected": false, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "category_id": "cat_0b6152ce12414820dc", - "categories": [ { - "id": "cat_0b6152ce12414820dc", - "name": "New Customers", - "hierarchy": 0, - "created_at": "2022-07-14T20:17:07.657Z", - "object": "category" + "object": "order_item", + "product_id": "prod_0bc3bd8a4e072c5275", + "quantity": 1, + "amount": 700, + "discount_amount": 700, + "price": 700, + "subtotal_amount": 0, + "product": { + "id": "prod_0bc3bd8a4e072c5275", + "name": "Bouquet - Romantic Roses", + "price": 700 + } } ], - "loyalty_tiers_expiration": { - "qualification_type": "BALANCE", - "start_date": { - "type": "IMMEDIATE" + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "result": { + "gift": { + "credits": 100 + } + }, + "metadata": {}, + "categories": [] + }, + { + "status": "APPLICABLE", + "id": "promo_DE1N30D731Tg2F6NoMwNas2W", + "object": "promotion_tier", + "order": { + "amount": 2700, + "discount_amount": 460, + "items_discount_amount": 1700, + "total_discount_amount": 2160, + "total_amount": 540, + "applied_discount_amount": 360, + "total_applied_discount_amount": 360, + "items": [ + { + "object": "order_item", + "product_id": "prod_s3C0nDpr0DuC7", + "sku_id": "sku_0a3efc90375d1217e2", + "quantity": 1, + "amount": 2000, + "discount_amount": 1000, + "price": 2000, + "subtotal_amount": 1000, + "product": { + "id": "prod_s3C0nDpr0DuC7", + "source_id": "test_prod_id_2", + "name": "Watchflix" + }, + "sku": { + "id": "sku_0a3efc90375d1217e2", + "source_id": "test_standard_ultra_hd", + "sku": "Premium", + "price": 2000 + } }, - "expiration_date": { - "type": "CUSTOM", - "extend": "P3M", - "rounding": { - "type": "MONTH", - "strategy": "END" + { + "object": "order_item", + "product_id": "prod_0bc3bd8a4e072c5275", + "quantity": 1, + "amount": 700, + "discount_amount": 700, + "price": 700, + "subtotal_amount": 0, + "product": { + "id": "prod_0bc3bd8a4e072c5275", + "name": "Bouquet - Romantic Roses", + "price": 700 } } - }, - "object": "campaign" - } - } - } - } - } - }, - "409": { - "description": "Returns an error if a loyalty campaign with the same name already exists.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": {} - }, - "examples": { - "Example": { - "value": { - "code": 409, - "key": "duplicate_found", - "message": "Duplicated resource found", - "details": "Duplicated campaign exists with name Loyalty Program 2", - "request_id": "v-0c12951ec58e67577e", - "resource_id": "Loyalty Program 2", - "resource_type": "campaign" - } - } - } - } - } - } - } - } - }, - "/v1/loyalties/{campaignId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_0dJG7cCAjquzcxWmZ634bA0C" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " - } - ], - "get": { - "operationId": "get-loyalty-program", - "tags": [ - "LOYALTIES API" - ], - "summary": "Get Loyalty Campaign", - "description": "Retrieve a specific loyalty campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a loyalty campaign object for a given loyalty campaign ID. ", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_loyalty_campaign_object" - }, - "examples": { - "Example": { - "value": { - "id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "name": "Loyalty Campaign - Tiers - 1", - "campaign_type": "LOYALTY_PROGRAM", - "type": "AUTO_UPDATE", - "voucher": { - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 0 - }, - "redemption": { - "quantity": null - }, - "code_config": { - "length": 8, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "########", - "prefix": "LT1-", - "initial_count": 1 - }, - "is_referral_code": false, - "start_date": "2022-11-01T00:00:00.000Z" - }, - "auto_join": false, - "join_once": false, - "use_voucher_metadata_schema": true, - "start_date": "2022-11-01T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5, - 6 ], - "vouchers_count": 3, - "active": true, "metadata": {}, - "created_at": "2022-11-09T06:26:52.985Z", - "updated_at": "2022-11-10T08:54:46.136Z", - "category": "Eighth", - "creation_status": "DONE", - "vouchers_generation_status": "DONE", - "protected": false, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "category_id": "cat_0b8b5a427a0283c854", - "categories": [ + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "applicable_to": { + "data": [ { - "id": "cat_0b8b5a427a0283c854", - "name": "Eighth", - "hierarchy": 8, - "created_at": "2022-08-16T11:45:54.171Z", - "object": "category" + "object": "sku", + "id": "sku_0a3efc90375d1217e2", + "source_id": "test_standard_ultra_hd", + "product_id": "prod_s3C0nDpr0DuC7", + "product_source_id": "test_prod_id_2", + "strict": true, + "effect": "APPLY_TO_EVERY" + }, + { + "object": "product", + "id": "prod_0bc3bd8a4e072c5275", + "source_id": "prod_0bc3bd8a4e072c5275", + "strict": true, + "effect": "APPLY_TO_EVERY" } ], - "loyalty_tiers_expiration": { - "qualification_type": "BALANCE", - "start_date": { - "type": "IMMEDIATE" - }, - "expiration_date": { - "type": "CUSTOM", - "extend": "P3M", - "rounding": { - "type": "MONTH", - "strategy": "END" - } + "total": 2, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [ + { + "object": "product", + "id": "prod_0b2c2ddf35150b83bb", + "source_id": "97", + "strict": false, + "effect": "APPLY_TO_EVERY" } - }, - "object": "campaign" - } - } - } - } - } - }, - "404": { - "description": "Returns an error if the campaign does not exist or has been deleted.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - } - } - } - } - } - }, - "put": { - "operationId": "update-loyalty-program", - "tags": [ - "LOYALTIES API" - ], - "summary": "Update Loyalty Campaign", - "description": "Updates a loyalty program. \n\nFields other than those specified in the allowed request body payload won't be modified (even if provided they are silently skipped). Any parameters not provided will be left unchanged. \n\nThis method will update the [loyalty cards](ref:get-member) which have not been published or redeemed yet.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the new values for the parameters that you would like to update for the given loyalty campaign.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_update_loyalty_campaign" - }, - "examples": { - "Example": { - "value": { - "description": "This is a campaign description. Updated", - "auto_join": false, - "join_once": false, - "start_date": "2013-10-26T00:00:00Z", - "expiration_date": "2025-10-26T00:00:00Z", - "validity_timeframe": { - "duration": "PT2H", - "interval": "P2D" + ], + "total": 1, + "data_ref": "data", + "object": "list" }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5, - 6 - ], - "activity_duration_after_publishing": "P25D", - "category_id": "cat_0b6152ce12414820dd", - "loyalty_card": { - "points": 1, - "expiration_rules": { - "period_type": "MONTH", - "period_value": 4, - "rounding_type": "END_OF_YEAR" + "result": { + "discount": { + "type": "PERCENT", + "effect": "APPLY_TO_ORDER", + "percent_off": 40, + "is_dynamic": false } }, - "metadata": { - "test": false - }, - "type": "AUTO_UPDATE", - "loyalty_tiers_expiration": { - "qualification_type": "BALANCE", - "start_date": { - "type": "IMMEDIATE" - }, - "expiration_date": { - "type": "CUSTOM", - "extend": "P4M", - "rounding": { - "type": "CUSTOM", - "unit": "MONTH", - "value": 1 - } - } - } - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns the loyalty campaign object if the update succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_loyalty_campaign_object" - }, - "examples": { - "Example": { - "value": { - "id": "camp_wGlqXtnHddb39DvHuuhvvbxi", - "name": "Loyalty Program 4", - "campaign_type": "LOYALTY_PROGRAM", - "type": "AUTO_UPDATE", - "voucher": { - "type": "LOYALTY_CARD", - "loyalty_card": { - "points": 1, - "expiration_rules": { - "period_type": "MONTH", - "period_value": 4, - "rounding_type": "END_OF_YEAR" + "metadata": {} + }, + { + "status": "APPLICABLE", + "id": "promo_NDHgTg4VnOLYNjk9r7WOmQxf", + "object": "promotion_tier", + "order": { + "amount": 2700, + "discount_amount": 490, + "items_discount_amount": 1700, + "total_discount_amount": 2190, + "total_amount": 510, + "applied_discount_amount": 30, + "total_applied_discount_amount": 30, + "items": [ + { + "object": "order_item", + "product_id": "prod_s3C0nDpr0DuC7", + "sku_id": "sku_0a3efc90375d1217e2", + "quantity": 1, + "amount": 2000, + "discount_amount": 1000, + "price": 2000, + "subtotal_amount": 1000, + "product": { + "id": "prod_s3C0nDpr0DuC7", + "source_id": "test_prod_id_2", + "name": "Watchflix" + }, + "sku": { + "id": "sku_0a3efc90375d1217e2", + "source_id": "test_standard_ultra_hd", + "sku": "Premium", + "price": 2000 } }, - "redemption": { - "quantity": 2 - }, - "code_config": { - "length": 7, - "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", - "pattern": "L-CARD-#######" + { + "object": "order_item", + "product_id": "prod_0bc3bd8a4e072c5275", + "quantity": 1, + "amount": 700, + "discount_amount": 700, + "price": 700, + "subtotal_amount": 0, + "product": { + "id": "prod_0bc3bd8a4e072c5275", + "name": "Bouquet - Romantic Roses", + "price": 700 + } + } + ], + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "applicable_to": { + "data": [ + { + "object": "sku", + "id": "sku_0a3efc90375d1217e2", + "source_id": "test_standard_ultra_hd", + "product_id": "prod_s3C0nDpr0DuC7", + "product_source_id": "test_prod_id_2", + "strict": true, + "effect": "APPLY_TO_EVERY" }, - "is_referral_code": false, - "start_date": "2013-10-26T00:00:00.000Z", - "expiration_date": "2025-10-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "PT2H" + { + "object": "product", + "id": "prod_0bc3bd8a4e072c5275", + "source_id": "prod_0bc3bd8a4e072c5275", + "strict": true, + "effect": "APPLY_TO_EVERY" } - }, - "auto_join": false, - "join_once": false, - "use_voucher_metadata_schema": true, - "description": "This is a campaign description. Updated", - "start_date": "2013-10-26T00:00:00.000Z", - "expiration_date": "2025-10-26T00:00:00.000Z", - "validity_timeframe": { - "interval": "P2D", - "duration": "PT2H" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5, - 6 ], - "activity_duration_after_publishing": "P25D", - "vouchers_count": 2, - "active": true, - "metadata": { - "test": false - }, - "created_at": "2022-11-29T13:10:30.848Z", - "updated_at": "2022-11-29T14:08:30.655Z", - "category": "Lorem_Ipsum", - "creation_status": "MODIFYING", - "vouchers_generation_status": "MODIFYING", - "protected": false, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "category_id": "cat_0b6152ce12414820dd", - "categories": [ + "total": 2, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [ { - "id": "cat_0b6152ce12414820dd", - "name": "Lorem_Ipsum", - "hierarchy": 0, - "created_at": "2022-07-14T20:17:07.657Z", - "object": "category" + "object": "product", + "id": "prod_0b2c2ddf35150b83bb", + "source_id": "97", + "strict": false, + "effect": "APPLY_TO_EVERY" } ], - "loyalty_tiers_expiration": { - "qualification_type": "BALANCE", - "start_date": { - "type": "IMMEDIATE" - }, - "expiration_date": { - "type": "CUSTOM", - "extend": "P4M", - "rounding": { - "type": "CUSTOM", - "strategy": "END", - "unit": "MONTH", - "value": 1 - } - } - }, - "object": "campaign" - } + "total": 1, + "data_ref": "data", + "object": "list" + }, + "result": { + "discount": { + "type": "AMOUNT", + "effect": "APPLY_TO_ORDER", + "amount_off": 30, + "is_dynamic": false + } + }, + "metadata": {} } + ], + "order": { + "amount": 2700, + "discount_amount": 490, + "items_discount_amount": 1700, + "total_discount_amount": 2190, + "total_amount": 510, + "applied_discount_amount": 490, + "items_applied_discount_amount": 1700, + "total_applied_discount_amount": 2190, + "items": [ + { + "object": "order_item", + "product_id": "prod_s3C0nDpr0DuC7", + "sku_id": "sku_0a3efc90375d1217e2", + "quantity": 1, + "amount": 2000, + "discount_amount": 1000, + "applied_discount_amount": 1000, + "price": 2000, + "subtotal_amount": 1000, + "product": { + "id": "prod_s3C0nDpr0DuC7", + "source_id": "test_prod_id_2", + "name": "Watchflix" + }, + "sku": { + "id": "sku_0a3efc90375d1217e2", + "source_id": "test_standard_ultra_hd", + "sku": "Premium", + "price": 2000 + } + }, + { + "object": "order_item", + "product_id": "prod_0bc3bd8a4e072c5275", + "quantity": 1, + "amount": 700, + "discount_amount": 700, + "applied_discount_amount": 700, + "price": 700, + "subtotal_amount": 0, + "product": { + "id": "prod_0bc3bd8a4e072c5275", + "name": "Bouquet - Romantic Roses", + "price": 700 + } + } + ], + "metadata": {}, + "customer_id": null, + "referrer_id": null, + "object": "order" + }, + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "session": { + "key": "ssn_pkJfPcWAgp9WyHpA62Eky8X8SzxpKub2", + "type": "LOCK", + "ttl": 7, + "ttl_unit": "DAYS" } } } } } - }, - "delete": { - "operationId": "delete-loyalty-program", - "tags": [ - "LOYALTIES API" - ], - "summary": "Delete Loyalty Campaign", - "description": "This method permanently deletes a loyalty campaign and all related loyalty cards. This action cannot be undone. Also, it immediately removes any redemptions on loyalty cards.", - "parameters": [ - { - "schema": { - "type": "boolean" + } + }, + "400": { + "description": "Returns an error if the payload is missing an `\"object\"` or `\"id\"` property in the redeemables array, if you add more than one promotion stack or attempt to join stacks with vouchers/promotion tiers.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_400_invalid_payload" + }, + "examples": { + "Invalid payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Property .redeemables[1] should have required property 'id'", + "request_id": "v-0b4ff38ab8c8164573" + } }, - "in": "query", - "name": "force", - "description": "If this flag is set to `true`, the campaign and related vouchers will be removed permanently. Going forward, the user will be able to create the next campaign with the same name." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + "Duplicated Redeemables": { + "value": { + "code": 400, + "key": "duplicated_redeemables", + "message": "Duplicated redeemables detected", + "details": "Duplicated redeemables detected in one redemption", + "request_id": "v-0b4ffecfb408165300" + } + }, + "Invalid Redeemables": { + "value": { + "code": 400, + "key": "invalid_redeemables", + "message": "Invalid redeemables", + "details": "Promotion Stack cannot be use with other redeemables", + "request_id": "v-0b5007812f48165d6b" + } + } } - ], - "responses": { - "200": { - "description": "Returns the id of the scheduled asynchronous action, informing you that your request has been accepted and the loyalty campaign will be deleted from the repository asynchronously. To check the deletion status and result, copy the `async_action_id` from the response and pass it using [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" - }, - "examples": { - "Example": { - "value": { - "async_action_id": "aa_0a875d56c805df6601" + } + } + } + } + } + }, + "/client/v1/validations": { + "post": { + "operationId": "validate-stacked-discounts-client-side", + "tags": [ + "STACKABLE DISCOUNTS API" + ], + "summary": "Validate Stackable Discounts (client-side)", + "description": "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.", + "parameters": [ + { + "$ref": "#/components/parameters/origin" + } + ], + "security": [ + { + "X-Client-Application-Id-1": [], + "X-Client-Token-1": [] + } + ], + "requestBody": { + "description": "## Expanded Response \n\nResponses will vary depending on the strings passed in the `options.expand` string array. You can customize the response by using one of the following combinations of strings. \n\n| **Expand Option** | **Response Body** |\n|:---|:---|\n| [\"order\"] | - Same response as fallback response (without an options object).
                  - Order data with calculated discounts are listed in each child redeemable object.
                  - Metadata _not_ included for each discount type. |\n| [\"redeemable\"] | Expands redeemable objects by including `metadata` for each discount type. |\n| [\"order\", \"redeemable\"] | - Order data with calculated discounts are listed in each child redeemable object.
                  - Includes `metadata` for each discount type. |\n| [\"category\"] | - Returns an expanded `categories` object, showing details about the category. |", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/19_req_validations" + }, + "examples": { + "1 Redeemable": { + "value": { + "customer": { + "source_id": "sample_customer", + "metadata": { + "key": "value" + } + }, + "options": { + "expand": [ + "order", + "redeemable", + "category" + ] + }, + "redeemables": [ + { + "object": "voucher", + "id": "voucher-code" + } + ], + "session": { + "type": "LOCK" + }, + "order": { + "amount": 55000, + "status": "PAID", + "items": [ + { + "quantity": 2, + "price": 20000, + "source_id": "sample product1", + "related_object": "product", + "product": { + "metadata": { + "key": "value" + } + } + }, + { + "quantity": 1, + "price": 15000, + "source_id": "sample product2", + "related_object": "product", + "product": { + "metadata": { + "key": "value" + } } } + ], + "metadata": { + "key": "value" } } } }, - "404": { - "description": "Returns an error indicating that the loyalty campaign with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Loyalty Campaign Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id Summer Loyalty Perks", - "request_id": "v-0ae2b0092f50c130c7", - "resource_id": "Summer Loyalty Perks", - "resource_type": "campaign" - } + "5 Redeemables": { + "value": { + "customer": { + "source_id": "36_bob" + }, + "options": { + "expand": [ + "order", + "redeemable", + "category" + ] + }, + "redeemables": [ + { + "object": "voucher", + "id": "GNcuPKGe" + }, + { + "object": "voucher", + "id": "AnsvocvP", + "reward": { + "id": "rew_EPx1hCTpqzF0HW1z9NKckZH4" + } + }, + { + "object": "voucher", + "id": "M3X8IwW8", + "gift": { + "credits": 100 } + }, + { + "object": "promotion_tier", + "id": "promo_DE1N30D731Tg2F6NoMwNas2W" + }, + { + "object": "promotion_tier", + "id": "promo_NDHgTg4VnOLYNjk9r7WOmQxf" } + ], + "session": { + "type": "LOCK" + }, + "order": { + "items": [ + { + "sku_id": "sku_0a3efc90375d1217e2", + "quantity": 1 + }, + { + "product_id": "prod_0bc3bd8a4e072c5275", + "quantity": 1 + } + ] } } } } } - }, - "/v1/loyalties/{campaignId}/members": { - "parameters": [ - { + } + }, + "responses": { + "200": { + "description": "All codes and tiers provided in redeemables are validated during the request and the result of their validation is returned in the API response. \n\n| **Response** | **Description** |\n|:---|:---|\n| valid
                  `boolean` | If **all** redeemables can be applied in the given context, the API returns `true`. Otherwise, if at least one redeemable can't be applied, the API returns `false`. |\n| redeemables
                  `array of objects` | The `redeemables` array lists the validation results of each redeemable. If a redeemable can be applied, the API returns `\"status\": \"APPLICABLE\"` |\n| order
                  `object` | The `order` object presents details of the order provided in the request after all discounts are applied. |\n", + "content": { + "application/json": { "schema": { - "type": "string" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID of the loyalty program." + "$ref": "#/components/schemas/19_res_validations" + } } - ], - "get": { - "operationId": "list-members", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Members", - "description": "Returns a list of your loyalty cards. The loyalty cards are sorted by creation date, with the most recent loyalty cards appearing first.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "$ref": "#/components/parameters/created_at" - }, - { - "$ref": "#/components/parameters/updated_at" + } + }, + "400": { + "description": "Returns an error if the payload is missing an `\"object\"` or `\"id\"` property in the redeemables array, if you add more than one promotion stack or attempt to join stacks with vouchers/promotion tiers.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_400_invalid_payload" }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ] + "examples": { + "Invalid payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Property .redeemables[1] should have required property 'id'", + "request_id": "v-0b4ff38ab8c8164573" + } + }, + "Duplicated Redeemables": { + "value": { + "code": 400, + "key": "duplicated_redeemables", + "message": "Duplicated redeemables detected", + "details": "Duplicated redeemables detected in one redemption", + "request_id": "v-0b4ffecfb408165300" + } }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." + "Invalid Redeemables": { + "value": { + "code": 400, + "key": "invalid_redeemables", + "message": "Invalid redeemables", + "details": "Promotion Stack cannot be use with other redeemables", + "request_id": "v-0b5007812f48165d6b" + } + } } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + } + } + } + } + } + }, + "/v1/redemptions/{parentRedemptionId}/rollbacks": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "parentRedemptionId", + "in": "path", + "required": true, + "description": "Unique identifier of a parent redemption, e.g. `r_JQfm73zWSJFQxs3bGxweYjgm`." + } + ], + "post": { + "operationId": "rollback-stacked-redemptions", + "tags": [ + "STACKABLE DISCOUNTS API" + ], + "summary": "Rollback Stackable Redemptions", + "description": "Rollback a stackable redemption. When you rollback a stacked redemption, all child redemptions will be rolled back. Provide the parent redemption ID as the path parameter.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns an array with the individual redemption rollback results along with the parent rollback result and related order.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/19_res_redemptions_parentRedemptionId_rollbacks" } - ], - "responses": { - "200": { - "description": "Returns a list of loyalty cards within a campaign.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_list_members" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "vouchers", - "vouchers": [ - { - "id": "v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655", - "code": "0PmQ7JQI", - "campaign": "Loyalty Campaign", - "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "category": null, - "category_id": null, - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 0, - "balance": 0 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX19RtPewWeUYb2hiCR6xEhVE3SLdMfCXj3BA/s6uqSwFl2oAKAt9K5dolsdcZcj5Jgaa/YCnKkm63TRuX6OgGJoEggbKMg+wLfCMwBSi4J2v8KXuyqM25wP4r9WAL58Z+z3B1jkALIbjtw==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19RtPewWeUYb2hiCR6xEhVE3SLdMfCXj3BA%2Fs6uqSwFl2oAKAt9K5dolsdcZcj5Jgaa%2FYCnKkm63TRuX6OgGJoEggbKMg%2BwLfCMwBSi4J2v8KXuyqM25wP4r9WAL58Z%2Bz3B1jkALIbjtw%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+hrRfaPMHRRX5aGVz2RpurRBjC2brcHcptPs4Od93qZM51vUXZe4DDzfRbnVrP+BfBtF+pyyQpxCeqbQuB/OuSnP/nzec6n0n/gTb9+XcIYLvvxcbnDbYoVdRFQEbcCxKKo4QzDlqIjQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BhrRfaPMHRRX5aGVz2RpurRBjC2brcHcptPs4Od93qZM51vUXZe4DDzfRbnVrP%2BBfBtF%2BpyyQpxCeqbQuB%2FOuSnP%2Fnzec6n0n%2FgTb9%2BXcIYLvvxcbnDbYoVdRFQEbcCxKKo4QzDlqIjQ%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-04-15T05:48:45.509Z", - "updated_at": "2022-07-01T00:01:57.860Z", - "holder_id": "cust_nk0N1uNQ1YnupAoJGOgvsODC", - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "redeemed_points": 0, - "object": "list", - "url": "/v1/vouchers/0PmQ7JQI/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/0PmQ7JQI/publications?page=1&limit=10" - }, - "object": "voucher" - }, - { - "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", - "code": "MmFAzfDe", - "campaign": "Loyalty Campaign", - "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "category": null, - "category_id": "cat_0b6152ce12414820de", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 13435, - "balance": 13135, - "next_expiration_date": "2022-11-30", - "next_expiration_points": 12 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX184kVdWUO/msrLg1G0MRf/Cs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk/dXm/QEJ/sulXKDlUMWf+MN7TRG5LB+wuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX184kVdWUO%2FmsrLg1G0MRf%2FCs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk%2FdXm%2FQEJ%2FsulXKDlUMWf%2BMN7TRG5LB%2BwuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/RGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW/cXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FRGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW%2FcXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-02-18T14:03:59.954Z", - "updated_at": "2022-11-21T13:49:54.949Z", - "holder_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", - "redemption": { - "quantity": null, - "redeemed_quantity": 1, - "redeemed_points": 300, - "object": "list", - "url": "/v1/vouchers/MmFAzfDe/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/MmFAzfDe/publications?page=1&limit=10" - }, - "object": "voucher" - } - ], - "total": 2 - } - } - } + } + } + }, + "400": { + "description": "Returns an error indicating that the parent redemption ID is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Invalid Redemption Parent": { + "value": { + "code": 400, + "key": "invalid_redemption_parent", + "message": "Invalid redemption parent", + "details": "You can rollback only a redemption that does not have parent redemption.", + "request_id": "v-0b56a1cf1e4d69b375" + } + }, + "Already rolled back": { + "value": { + "code": 400, + "key": "already_rolled_back", + "message": "Already rolled back", + "details": "Redemption has been already rolled back.", + "request_id": "v-0c67af9544c4e3388f", + "resource_id": "rrf_0c67af954e039be56b", + "resource_type": "redemption_rollback" } } } } - }, - "post": { - "operationId": "add-member", - "tags": [ - "LOYALTIES API" - ], - "summary": "Add Member", - "description": "This method assigns a loyalty card to a customer. It selects a [loyalty card](ref:get-voucher) suitable for publication, adds a publish entry, and returns the published voucher. \n\nA voucher is suitable for publication when it's active and hasn't been published yet. \n\n\n> 📘 Auto-update campaign\n>\n> In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use **auto-update** campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + } + } + } + } + }, + "/v1/loyalty-campaign-object": { + "get": { + "operationId": "loyalty-campaign-object", + "tags": [ + "LOYALTIES API" + ], + "summary": "Loyalty Campaign Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Loyalty Campaign Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_loyalty_campaign_object" } - ], - "requestBody": { - "description": "Provide details to whom the loyalty card should be assigned. \n\nYou can choose to either specify the exact loyalty card code that you want to publish from existin (non-assigned) codes, or choose not to specify a voucher code. If you choose not to specify a code in the request paylaod, then the system will choose the next available voucher code available to be assigned to a customer. \n\nYou can also include metadata in the request payload. This metadata will be assigned to the publication object, but will not be returned in the response to this endpoint. To see of publications (assignments of particular codes to customers) and publication metadata, use the [List Publications](ref:list-publications) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_add_member" - }, - "examples": { - "Using source ID": { - "value": { - "customer": "source_customer_1", - "metadata": { - "year": 2022 - }, - "channel": "postman", - "voucher": "KpzbHUY5" - } - }, - "Using unique Voucherify assigned ID": { - "value": { - "customer": "cust_8KQmHxAERpgebYcFhSpZRr37", - "metadata": { - "year": 2022 - }, - "channel": "postman", - "voucher": "KpzbHUY5" - } - }, - "Using source ID in object": { - "value": { - "customer": { - "source_id": "source_customer_1" - }, - "metadata": { - "year": 2022 - }, - "channel": "postman", - "voucher": "KpzbHUY5" - } - }, - "Using unique Voucherify assigned ID in object": { - "value": { - "customer": { - "id": "cust_8KQmHxAERpgebYcFhSpZRr37" + } + } + } + } + } + }, + "/v1/loyalty-card-object": { + "get": { + "operationId": "loyalty-card-object", + "tags": [ + "LOYALTIES API" + ], + "summary": "Loyalty Card Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Loyalty Card Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_loyalty_card_object_non_expanded_categories" + } + } + } + } + } + } + }, + "/v1/loyalty-tier-object": { + "get": { + "operationId": "loyalty-tier-object", + "tags": [ + "LOYALTIES API" + ], + "summary": "Loyalty Tier Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Loyalty Tier Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_loyalty_tier_object" + } + } + } + } + } + } + }, + "/v1/earning-object": { + "get": { + "operationId": "earning-rule-object", + "tags": [ + "LOYALTIES API" + ], + "summary": "Earning Rule Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Earning Rule Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_earning_rule_object" + } + } + } + } + } + } + }, + "/v1/loyalties": { + "get": { + "operationId": "list-loyalty-programs", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Loyalty Campaigns", + "description": "Returns a list of your loyalty campaigns.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + }, + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with loyalty program objects. The loyalty campaigns are returned sorted by creation date, with the most recent campaigns appearing first.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_list_loyalty_campaigns" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "campaigns", + "campaigns": [ + { + "id": "camp_eTIsUtuzkRXQT6rsUQqrS5Gw", + "name": "Loyalty Campaign 1", + "campaign_type": "LOYALTY_PROGRAM", + "type": "AUTO_UPDATE", + "voucher": { + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 0 + }, + "redemption": { + "quantity": null + }, + "code_config": { + "length": 8, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "########" + }, + "is_referral_code": false }, + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": true, + "description": "This is a campaign description.", + "vouchers_count": 6, + "active": true, "metadata": { - "year": 2022 + "Season": "Fall" }, - "channel": "postman", - "voucher": "KpzbHUY5" - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns the voucher object that was published to the customer provided in the request payload.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_loyalty_card_object" - }, - "examples": { - "Loyalty Card": { - "value": { - "id": "v_0TxKw1bm0oZuS5lwA8526vze1OBMV1OH", - "code": "KpzbHUY5", - "campaign": "Loyalty Campaign", - "campaign_id": "camp_eTIsUtuzkRXQT6rsUQqrS5Gw", - "category": "New Customers", - "category_id": "cat_0b6152ce12414820dc", - "categories": [ - { - "id": "cat_0b6152ce12414820dc", - "name": "New Customers", - "hierarchy": 0, - "created_at": "2022-07-14T20:17:07.657Z", - "object": "category" - } - ], + "created_at": "2022-11-21T13:57:03.712Z", + "updated_at": "2022-11-23T09:59:49.581Z", + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "category_id": "cat_0b6152ce12414820dc", + "categories": [], + "object": "campaign" + }, + { + "id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "name": "Loyalty Campaign - Tiers", + "campaign_type": "LOYALTY_PROGRAM", + "type": "AUTO_UPDATE", + "voucher": { "type": "LOYALTY_CARD", - "discount": null, - "gift": null, "loyalty_card": { - "points": 0, - "balance": 0 + "points": 0 }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": { - "Season": "Fall" + "redemption": { + "quantity": null }, - "assets": { - "qr": { - "id": "U2FsdGVkX1+hdZfzUaz448vIsyf7WpvXiDyqFbyw0+P5wMu12w3B5DyYwA7LCSK+Nr7TA7PKGuHOTGxfBieqrhvJo81HiaIJimDOhk+ecEOisMRmHf6XsNckVlyBHmkpBiXWNm8UDwZnXOAG75Usdw==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BhdZfzUaz448vIsyf7WpvXiDyqFbyw0%2BP5wMu12w3B5DyYwA7LCSK%2BNr7TA7PKGuHOTGxfBieqrhvJo81HiaIJimDOhk%2BecEOisMRmHf6XsNckVlyBHmkpBiXWNm8UDwZnXOAG75Usdw%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX19VRXApVvZ9/ArwBd0wNg7s2KZBXrFvPXZdDQyzGj0HbbEIx5TAoXNR9zaE5kzIj9BElzgK82aOMMVnc1sqvr93xw+YeYMnqGqHRZfM78pYC8560Zc3U6IELtxzaJJ0x2uDUe6Dc9XYeg==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19VRXApVvZ9%2FArwBd0wNg7s2KZBXrFvPXZdDQyzGj0HbbEIx5TAoXNR9zaE5kzIj9BElzgK82aOMMVnc1sqvr93xw%2BYeYMnqGqHRZfM78pYC8560Zc3U6IELtxzaJJ0x2uDUe6Dc9XYeg%3D%3D" - } + "code_config": { + "length": 8, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "########", + "prefix": "LT1-", + "initial_count": 1 }, "is_referral_code": false, - "created_at": "2022-11-21T15:48:57.860Z", - "updated_at": "2022-11-21T15:49:36.671Z", - "holder_id": "cust_8KQmHxAERpgebYcFhSpZRr37", + "start_date": "2022-11-01T00:00:00.000Z" + }, + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": true, + "start_date": "2022-11-01T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "vouchers_count": 3, + "active": true, + "metadata": {}, + "created_at": "2022-11-09T06:26:52.985Z", + "updated_at": "2022-11-10T08:54:46.136Z", + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "category_id": "cat_0b8b5a427a0283c854", + "categories": [], + "loyalty_tiers_expiration": { + "qualification_type": "BALANCE", + "start_date": { + "type": "IMMEDIATE" + }, + "expiration_date": { + "type": "CUSTOM", + "extend": "P3M", + "rounding": { + "type": "MONTH", + "strategy": "END" + } + } + }, + "object": "campaign" + }, + { + "id": "camp_NwO6D0Z0mpZ1CDc380DnPgrW", + "name": "Loyalty Campaign Example", + "campaign_type": "LOYALTY_PROGRAM", + "type": "STATIC", + "voucher": { + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 0 + }, "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "redeemed_points": 0, - "object": "list", - "url": "/v1/vouchers/KpzbHUY5/redemptions?page=1&limit=10" + "quantity": null }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/KpzbHUY5/publications?page=1&limit=10" + "code_config": { + "length": 8, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "########", + "initial_count": 1 }, - "object": "voucher" - } - } - } - } - } - }, - "400": { - "description": "Returns an error.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "No Voucher Suitable for Publication": { - "value": { - "code": 400, - "key": "no_voucher_suitable_for_publication", - "message": "Couldn't find any voucher suitable for publication", - "details": "Couldn't create new vouchers for publication", - "request_id": "v-0c086598620e6704dd" - } - }, - "Voucher already published": { - "value": { - "code": 400, - "key": "voucher_already_published", - "message": "Voucher already published", - "details": "Voucher 'v_ZFjKHQD0d56eMkWkrotJaVbiMuXClRuM' has already been published", - "request_id": "v-0c086aaa7dc24ccfe0" - } - } - } - } - } - }, - "404": { - "description": "Returns an error if the voucher code that was specified in the request payload is not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id Loyalty_Card", - "request_id": "v-0c086a26de424ccf2f", - "resource_id": "Loyalty_Card", - "resource_type": "voucher" - } + "is_referral_code": false, + "start_date": "2021-12-15T00:00:00.000Z", + "expiration_date": "2021-12-31T00:00:00.000Z", + "validity_timeframe": { + "interval": "P1D", + "duration": "PT1H" + } + }, + "auto_join": true, + "join_once": true, + "use_voucher_metadata_schema": true, + "start_date": "2021-12-15T00:00:00.000Z", + "expiration_date": "2021-12-31T00:00:00.000Z", + "validity_timeframe": { + "interval": "P1D", + "duration": "PT1H" + }, + "validity_day_of_week": [ + 3, + 4, + 5, + 6 + ], + "activity_duration_after_publishing": "P24D", + "vouchers_count": 0, + "active": false, + "metadata": {}, + "created_at": "2021-12-15T08:02:52.298Z", + "updated_at": "2021-12-15T08:11:43.808Z", + "creation_status": "DRAFT", + "vouchers_generation_status": "DRAFT", + "protected": false, + "category_id": null, + "categories": [], + "object": "campaign" } - } + ], + "total": 3 } } } } } - }, - "/v1/loyalties/{campaignId}/members/{memberId}": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID." + } + } + }, + "post": { + "operationId": "create-loyalty-program", + "tags": [ + "LOYALTIES API" + ], + "summary": "Create Loyalty Campaign", + "description": "Creates a batch of [loyalty cards](ref:get-member) aggregated in a single loyalty campaign. It also allows you to define a custom codes pattern. \n\n\n> 📘 Global uniqueness\n> All codes are unique across the whole project. Voucherify won't allow to generate the same codes in any of your campaigns.\n\n\n> 🚧 Asyncronous action!\n>\n> This is an asynchronous action, you can't read or modify a newly created campaign until the code generation is completed. See `creation_status` field in the [loyalty campaign object](ref:get-loyalty-program) description.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the loyalty campaign details.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_create_loyalty_cards" }, - { - "schema": { - "type": "string" - }, - "name": "memberId", - "in": "path", - "required": true, - "description": "Unique code that identifies the loyalty card." - } - ], - "get": { - "operationId": "get-member-1", - "tags": [ - "LOYALTIES API" - ], - "summary": "Get Member", - "description": "Retrieves the loyalty card with the given member ID (i.e. voucher code).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns loyalty card details.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_loyalty_card_object_non_expanded_categories" - }, - "examples": { - "Loyalty Card": { - "value": { - "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", - "code": "MmFAzfDe", - "campaign": "Loyalty Program", - "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "category": null, - "category_id": "cat_0b6152ce12414820de", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 13435, - "balance": 13135, - "next_expiration_date": "2022-11-30", - "next_expiration_points": 12 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX184kVdWUO/msrLg1G0MRf/Cs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk/dXm/QEJ/sulXKDlUMWf+MN7TRG5LB+wuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX184kVdWUO%2FmsrLg1G0MRf%2FCs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk%2FdXm%2FQEJ%2FsulXKDlUMWf%2BMN7TRG5LB%2BwuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/RGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW/cXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FRGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW%2FcXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-02-18T14:03:59.954Z", - "updated_at": "2022-11-21T13:49:54.949Z", - "holder_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", - "redemption": { - "quantity": null, - "redeemed_quantity": 1, - "redeemed_points": 300, - "object": "list", - "url": "/v1/vouchers/MmFAzfDe/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/MmFAzfDe/publications?page=1&limit=10" - }, - "object": "voucher" - } + "examples": { + "Example": { + "value": { + "name": "Loyalty Program 4", + "description": "This is a campaign description.", + "auto_join": true, + "join_once": true, + "use_voucher_metadata_schema": true, + "start_date": "2016-10-26T00:00:00Z", + "expiration_date": "2024-10-26T00:00:00Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "activity_duration_after_publishing": "P24D", + "category_id": "cat_0b6152ce12414820dc", + "vouchers_count": 2, + "voucher": { + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 0, + "expiration_rules": { + "period_type": "MONTH", + "period_value": 3, + "rounding_type": "END_OF_QUARTER" + } + }, + "redemption": { + "quantity": 2 + }, + "code_config": { + "pattern": "L-CARD-#######" + } + }, + "metadata": { + "test": true + }, + "type": "STATIC", + "loyalty_tiers_expiration": { + "qualification_type": "BALANCE", + "start_date": { + "type": "IMMEDIATE" + }, + "expiration_date": { + "type": "CUSTOM", + "extend": "P3M", + "rounding": { + "type": "MONTH", + "strategy": "END" } } } @@ -67470,1389 +66536,1294 @@ } } } - }, - "/v1/loyalties/members/{memberId}": { - "parameters": [ - { + } + }, + "responses": { + "200": { + "description": "Returns a campaign object with its settings but without the loyalty card codes.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "MmFAzfDe" - }, - "name": "memberId", - "in": "path", - "required": true, - "description": "Unique loyalty card code assigned to a particular customer." - } - ], - "get": { - "operationId": "get-member", - "tags": [ - "LOYALTIES API" - ], - "summary": "Get Member", - "description": "Retrieve loyalty card with the given member ID (i.e. voucher code). \n\n\n> 📘 Alternative endpoint\n> This endpoint is an alternative to this [endpoint](ref:get-member-1). The URL was re-designed to allow you to retrieve loyalty card details without having to provide the `campaignId` as a path parameter.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns loyalty card details.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_loyalty_card_object_non_expanded_categories" - }, - "examples": { - "Loyalty Card": { - "value": { - "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", - "code": "MmFAzfDe", - "campaign": "Loyalty Program", - "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "category": null, - "category_id": "cat_0b6152ce12414820de", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 13435, - "balance": 13135, - "next_expiration_date": "2022-11-30", - "next_expiration_points": 12 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX184kVdWUO/msrLg1G0MRf/Cs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk/dXm/QEJ/sulXKDlUMWf+MN7TRG5LB+wuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX184kVdWUO%2FmsrLg1G0MRf%2FCs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk%2FdXm%2FQEJ%2FsulXKDlUMWf%2BMN7TRG5LB%2BwuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/RGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW/cXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FRGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW%2FcXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-02-18T14:03:59.954Z", - "updated_at": "2022-11-21T13:49:54.949Z", - "holder_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", - "redemption": { - "quantity": null, - "redeemed_quantity": 1, - "redeemed_points": 300, - "object": "list", - "url": "/v1/vouchers/MmFAzfDe/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/MmFAzfDe/publications?page=1&limit=10" - }, - "object": "voucher" + "$ref": "#/components/schemas/8_obj_loyalty_campaign_object" + }, + "examples": { + "Example": { + "value": { + "id": "camp_wGlqXtnHddb39DvHuuhvvbxi", + "name": "Loyalty Program 4", + "campaign_type": "LOYALTY_PROGRAM", + "type": "STATIC", + "voucher": { + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 0, + "expiration_rules": { + "period_type": "MONTH", + "period_value": 3, + "rounding_type": "END_OF_QUARTER" + } + }, + "redemption": { + "quantity": 2 + }, + "code_config": { + "length": 7, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "L-CARD-#######" + }, + "is_referral_code": false, + "start_date": "2016-10-26T00:00:00.000Z", + "expiration_date": "2024-10-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P1D", + "duration": "PT1H" + } + }, + "auto_join": true, + "join_once": true, + "use_voucher_metadata_schema": true, + "description": "This is a campaign description.", + "start_date": "2016-10-26T00:00:00.000Z", + "expiration_date": "2024-10-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P1D", + "duration": "PT1H" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "activity_duration_after_publishing": "P24D", + "vouchers_count": 0, + "active": true, + "metadata": { + "test": true + }, + "created_at": "2022-11-29T13:10:30.848Z", + "category": "New Customers", + "creation_status": "IN_PROGRESS", + "vouchers_generation_status": "IN_PROGRESS", + "protected": false, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "category_id": "cat_0b6152ce12414820dc", + "categories": [ + { + "id": "cat_0b6152ce12414820dc", + "name": "New Customers", + "hierarchy": 0, + "created_at": "2022-07-14T20:17:07.657Z", + "object": "category" + } + ], + "loyalty_tiers_expiration": { + "qualification_type": "BALANCE", + "start_date": { + "type": "IMMEDIATE" + }, + "expiration_date": { + "type": "CUSTOM", + "extend": "P3M", + "rounding": { + "type": "MONTH", + "strategy": "END" } } - } + }, + "object": "campaign" } } } } } }, - "/v1/loyalties/{campaignId}/members/{memberId}/activities": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID." - }, - { + "409": { + "description": "Returns an error if a loyalty campaign with the same name already exists.", + "content": { + "application/json": { "schema": { - "type": "string" + "type": "object", + "properties": {} }, - "name": "memberId", - "in": "path", - "required": true, - "description": "A code that identifies the loyalty card." - } - ], - "get": { - "operationId": "get-member-activities-1", - "tags": [ - "LOYALTIES API" - ], - "summary": "Get Member Activities", - "description": "Retrieves the list of activities for the given member ID related to voucher and customer who is a holder of the voucher.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a list of event objects related to the loyalty card.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_get_member_activities" - } + "examples": { + "Example": { + "value": { + "code": 409, + "key": "duplicate_found", + "message": "Duplicated resource found", + "details": "Duplicated campaign exists with name Loyalty Program 2", + "request_id": "v-0c12951ec58e67577e", + "resource_id": "Loyalty Program 2", + "resource_type": "campaign" } } } } } + } + } + } + }, + "/v1/loyalties/{campaignId}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_0dJG7cCAjquzcxWmZ634bA0C" }, - "/v1/loyalties/members/{memberId}/activities": { - "parameters": [ - { + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " + } + ], + "get": { + "operationId": "get-loyalty-program", + "tags": [ + "LOYALTIES API" + ], + "summary": "Get Loyalty Campaign", + "description": "Retrieve a specific loyalty campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a loyalty campaign object for a given loyalty campaign ID. ", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "MmFAzfDe" - }, - "name": "memberId", - "in": "path", - "required": true, - "description": "Unique loyalty card assigned to a particular customer." - } - ], - "get": { - "operationId": "get-member-activities", - "tags": [ - "LOYALTIES API" - ], - "summary": "Get Member Activities", - "description": "Retrieves a list of activities for the given loyalty card related to the loyalty and customer who is the holder of the loyalty card.\n\n\n> 📘 Alternative endpoint\n> This endpoint is an alternative to this [endpoint](ref:get-member-activities-1). The URL was re-designed to allow you to get member activities without having to provide the `campaignId` as a path parameter.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a list of event objects related to the loyalty card.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_get_member_activities" - } + "$ref": "#/components/schemas/8_obj_loyalty_campaign_object" + }, + "examples": { + "Example": { + "value": { + "id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "name": "Loyalty Campaign - Tiers - 1", + "campaign_type": "LOYALTY_PROGRAM", + "type": "AUTO_UPDATE", + "voucher": { + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 0 + }, + "redemption": { + "quantity": null + }, + "code_config": { + "length": 8, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "########", + "prefix": "LT1-", + "initial_count": 1 + }, + "is_referral_code": false, + "start_date": "2022-11-01T00:00:00.000Z" + }, + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": true, + "start_date": "2022-11-01T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5, + 6 + ], + "vouchers_count": 3, + "active": true, + "metadata": {}, + "created_at": "2022-11-09T06:26:52.985Z", + "updated_at": "2022-11-10T08:54:46.136Z", + "category": "Eighth", + "creation_status": "DONE", + "vouchers_generation_status": "DONE", + "protected": false, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "category_id": "cat_0b8b5a427a0283c854", + "categories": [ + { + "id": "cat_0b8b5a427a0283c854", + "name": "Eighth", + "hierarchy": 8, + "created_at": "2022-08-16T11:45:54.171Z", + "object": "category" + } + ], + "loyalty_tiers_expiration": { + "qualification_type": "BALANCE", + "start_date": { + "type": "IMMEDIATE" + }, + "expiration_date": { + "type": "CUSTOM", + "extend": "P3M", + "rounding": { + "type": "MONTH", + "strategy": "END" + } + } + }, + "object": "campaign" } } } } } }, - "/v1/loyalties/{campaignId}/members/{memberId}/balance": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_7s3uXI44aKfIk5IhmeOPr6ic" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID." - }, - { + "404": { + "description": "Returns an error if the campaign does not exist or has been deleted.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "MmFAzfDe" - }, - "name": "memberId", - "in": "path", - "required": true, - "description": "A code that identifies the loyalty card." - } - ], - "post": { - "operationId": "add-remove-loyalty-card-balance-1", - "tags": [ - "LOYALTIES API" - ], - "summary": "Add or Remove Loyalty Card Balance", - "description": "This method adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + "$ref": "#/components/schemas/e_404_not_found" } - ], - "requestBody": { - "description": "Specify the point adjustment along with the expiration mechanism.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_add_remove_points_balance" + } + } + } + } + }, + "put": { + "operationId": "update-loyalty-program", + "tags": [ + "LOYALTIES API" + ], + "summary": "Update Loyalty Campaign", + "description": "Updates a loyalty program. \n\nFields other than those specified in the allowed request body payload won't be modified (even if provided they are silently skipped). Any parameters not provided will be left unchanged. \n\nThis method will update the [loyalty cards](ref:get-member) which have not been published or redeemed yet.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the new values for the parameters that you would like to update for the given loyalty campaign.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_update_loyalty_campaign" + }, + "examples": { + "Example": { + "value": { + "description": "This is a campaign description. Updated", + "auto_join": false, + "join_once": false, + "start_date": "2013-10-26T00:00:00Z", + "expiration_date": "2025-10-26T00:00:00Z", + "validity_timeframe": { + "duration": "PT2H", + "interval": "P2D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6 + ], + "activity_duration_after_publishing": "P25D", + "category_id": "cat_0b6152ce12414820dd", + "loyalty_card": { + "points": 1, + "expiration_rules": { + "period_type": "MONTH", + "period_value": 4, + "rounding_type": "END_OF_YEAR" + } }, - "examples": { - "Add points": { - "value": { - "points": 100, - "expiration_type": "CUSTOM_DATE", - "expiration_date": "2023-05-30" - } + "metadata": { + "test": false + }, + "type": "AUTO_UPDATE", + "loyalty_tiers_expiration": { + "qualification_type": "BALANCE", + "start_date": { + "type": "IMMEDIATE" }, - "Deduct points": { - "value": { - "points": -100 + "expiration_date": { + "type": "CUSTOM", + "extend": "P4M", + "rounding": { + "type": "CUSTOM", + "unit": "MONTH", + "value": 1 } } } } } - }, - "responses": { - "200": { - "description": "Returns a balance object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_add_remove_points_balance" - }, - "examples": { - "Add balance": { - "value": { - "points": -100, - "total": 13436, - "balance": 13136, - "type": "loyalty_card", - "object": "balance", - "related_object": { - "type": "voucher", - "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF" - } + } + } + } + }, + "responses": { + "200": { + "description": "Returns the loyalty campaign object if the update succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_loyalty_campaign_object" + }, + "examples": { + "Example": { + "value": { + "id": "camp_wGlqXtnHddb39DvHuuhvvbxi", + "name": "Loyalty Program 4", + "campaign_type": "LOYALTY_PROGRAM", + "type": "AUTO_UPDATE", + "voucher": { + "type": "LOYALTY_CARD", + "loyalty_card": { + "points": 1, + "expiration_rules": { + "period_type": "MONTH", + "period_value": 4, + "rounding_type": "END_OF_YEAR" } }, - "Deduct balance": { - "value": { - "points": -100, - "total": 13436, - "balance": 13136, - "type": "loyalty_card", - "object": "balance", - "related_object": { - "type": "voucher", - "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF" - } + "redemption": { + "quantity": 2 + }, + "code_config": { + "length": 7, + "charset": "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", + "pattern": "L-CARD-#######" + }, + "is_referral_code": false, + "start_date": "2013-10-26T00:00:00.000Z", + "expiration_date": "2025-10-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "PT2H" + } + }, + "auto_join": false, + "join_once": false, + "use_voucher_metadata_schema": true, + "description": "This is a campaign description. Updated", + "start_date": "2013-10-26T00:00:00.000Z", + "expiration_date": "2025-10-26T00:00:00.000Z", + "validity_timeframe": { + "interval": "P2D", + "duration": "PT2H" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6 + ], + "activity_duration_after_publishing": "P25D", + "vouchers_count": 2, + "active": true, + "metadata": { + "test": false + }, + "created_at": "2022-11-29T13:10:30.848Z", + "updated_at": "2022-11-29T14:08:30.655Z", + "category": "Lorem_Ipsum", + "creation_status": "MODIFYING", + "vouchers_generation_status": "MODIFYING", + "protected": false, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "category_id": "cat_0b6152ce12414820dd", + "categories": [ + { + "id": "cat_0b6152ce12414820dd", + "name": "Lorem_Ipsum", + "hierarchy": 0, + "created_at": "2022-07-14T20:17:07.657Z", + "object": "category" + } + ], + "loyalty_tiers_expiration": { + "qualification_type": "BALANCE", + "start_date": { + "type": "IMMEDIATE" + }, + "expiration_date": { + "type": "CUSTOM", + "extend": "P4M", + "rounding": { + "type": "CUSTOM", + "strategy": "END", + "unit": "MONTH", + "value": 1 } } - } + }, + "object": "campaign" } } + } + } + } + } + } + }, + "delete": { + "operationId": "delete-loyalty-program", + "tags": [ + "LOYALTIES API" + ], + "summary": "Delete Loyalty Campaign", + "description": "This method permanently deletes a loyalty campaign and all related loyalty cards. This action cannot be undone. Also, it immediately removes any redemptions on loyalty cards.", + "parameters": [ + { + "schema": { + "type": "boolean" + }, + "in": "query", + "name": "force", + "description": "If this flag is set to `true`, the campaign and related vouchers will be removed permanently. Going forward, the user will be able to create the next campaign with the same name." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns the id of the scheduled asynchronous action, informing you that your request has been accepted and the loyalty campaign will be deleted from the repository asynchronously. To check the deletion status and result, copy the `async_action_id` from the response and pass it using [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" }, - "400": { - "description": "Returns an error if the expiration date was defined incorrectly in the request payload.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Invalid expiration date": { - "value": { - "code": 400, - "key": "invalid_expiration_date", - "message": "Invalid Expiration Date", - "details": "Expiration date cannot be set in the past", - "request_id": "v-0c118b1611424ca899" - } - } - } + "examples": { + "Example": { + "value": { + "async_action_id": "aa_0a875d56c805df6601" } } } } } }, - "/v1/loyalties/members/{memberId}/balance": { - "parameters": [ - { + "404": { + "description": "Returns an error indicating that the loyalty campaign with given ID was not found.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "MmFAzfDe" + "$ref": "#/components/schemas/e_404_not_found" }, - "name": "memberId", - "in": "path", - "required": true, - "description": "Unique loyalty card assigned to a particular customer." - } - ], - "post": { - "operationId": "add-remove-loyalty-card-balance", - "tags": [ - "LOYALTIES API" - ], - "summary": "Add or Remove Loyalty Card Balance", - "description": "This method gives adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. \n\n\n> 📘 Alternative endpoint\n> This endpoint is an alternative to this [endpoint](ref:add-remove-loyalty-card-balance-1). The URL was re-designed to allow you to add or remove loyalty card balance without having to provide the `campaignId` as a path parameter.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the point adjustment along with the expiration mechanism.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_add_remove_points_balance" - }, - "examples": { - "Subtract points": { - "value": { - "points": -100 - } - }, - "Add Points": { - "value": { - "points": 100, - "expiration_type": "CUSTOM_DATE", - "expiration_date": "2023-05-30" - } - } + "examples": { + "Loyalty Campaign Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id Summer Loyalty Perks", + "request_id": "v-0ae2b0092f50c130c7", + "resource_id": "Summer Loyalty Perks", + "resource_type": "campaign" } } } - }, - "responses": { - "200": { - "description": "Returns a balance object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_add_remove_points_balance" - }, - "examples": { - "Subtract Points": { - "value": { - "points": 100, - "total": 13436, - "balance": 13136, - "type": "loyalty_card", - "object": "balance", - "related_object": { - "type": "voucher", - "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF" + } + } + } + } + } + }, + "/v1/loyalties/{campaignId}/members": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID of the loyalty program." + } + ], + "get": { + "operationId": "list-members", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Members", + "description": "Returns a list of your loyalty cards. The loyalty cards are sorted by creation date, with the most recent loyalty cards appearing first.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "$ref": "#/components/parameters/created_at" + }, + { + "$ref": "#/components/parameters/updated_at" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + }, + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of loyalty cards within a campaign.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_list_members" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "vouchers", + "vouchers": [ + { + "id": "v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655", + "code": "0PmQ7JQI", + "campaign": "Loyalty Campaign", + "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "category": null, + "category_id": null, + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 0, + "balance": 0 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX19RtPewWeUYb2hiCR6xEhVE3SLdMfCXj3BA/s6uqSwFl2oAKAt9K5dolsdcZcj5Jgaa/YCnKkm63TRuX6OgGJoEggbKMg+wLfCMwBSi4J2v8KXuyqM25wP4r9WAL58Z+z3B1jkALIbjtw==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19RtPewWeUYb2hiCR6xEhVE3SLdMfCXj3BA%2Fs6uqSwFl2oAKAt9K5dolsdcZcj5Jgaa%2FYCnKkm63TRuX6OgGJoEggbKMg%2BwLfCMwBSi4J2v8KXuyqM25wP4r9WAL58Z%2Bz3B1jkALIbjtw%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+hrRfaPMHRRX5aGVz2RpurRBjC2brcHcptPs4Od93qZM51vUXZe4DDzfRbnVrP+BfBtF+pyyQpxCeqbQuB/OuSnP/nzec6n0n/gTb9+XcIYLvvxcbnDbYoVdRFQEbcCxKKo4QzDlqIjQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BhrRfaPMHRRX5aGVz2RpurRBjC2brcHcptPs4Od93qZM51vUXZe4DDzfRbnVrP%2BBfBtF%2BpyyQpxCeqbQuB%2FOuSnP%2Fnzec6n0n%2FgTb9%2BXcIYLvvxcbnDbYoVdRFQEbcCxKKo4QzDlqIjQ%3D%3D" } - } - } - } - } - } - }, - "400": { - "description": "Returns an error if the expiration date was specified incorrectly in the request payload.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Invalid payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Property .expiration_date cannot be recognized as a ISO-8601 compliant date", - "request_id": "v-0c118c6f7c0e6751ab" - } + }, + "is_referral_code": false, + "created_at": "2022-04-15T05:48:45.509Z", + "updated_at": "2022-07-01T00:01:57.860Z", + "holder_id": "cust_nk0N1uNQ1YnupAoJGOgvsODC", + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "redeemed_points": 0, + "object": "list", + "url": "/v1/vouchers/0PmQ7JQI/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/0PmQ7JQI/publications?page=1&limit=10" + }, + "object": "voucher" + }, + { + "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", + "code": "MmFAzfDe", + "campaign": "Loyalty Campaign", + "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "category": null, + "category_id": "cat_0b6152ce12414820de", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 13435, + "balance": 13135, + "next_expiration_date": "2022-11-30", + "next_expiration_points": 12 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX184kVdWUO/msrLg1G0MRf/Cs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk/dXm/QEJ/sulXKDlUMWf+MN7TRG5LB+wuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX184kVdWUO%2FmsrLg1G0MRf%2FCs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk%2FdXm%2FQEJ%2FsulXKDlUMWf%2BMN7TRG5LB%2BwuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/RGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW/cXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FRGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW%2FcXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-02-18T14:03:59.954Z", + "updated_at": "2022-11-21T13:49:54.949Z", + "holder_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "redeemed_points": 300, + "object": "list", + "url": "/v1/vouchers/MmFAzfDe/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/MmFAzfDe/publications?page=1&limit=10" + }, + "object": "voucher" } - } + ], + "total": 2 } } } } } - }, - "/v1/loyalties/{campaignId}/members/{memberId}/transfers": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination)." + } + } + }, + "post": { + "operationId": "add-member", + "tags": [ + "LOYALTIES API" + ], + "summary": "Add Member", + "description": "This method assigns a loyalty card to a customer. It selects a [loyalty card](ref:get-voucher) suitable for publication, adds a publish entry, and returns the published voucher. \n\nA voucher is suitable for publication when it's active and hasn't been published yet. \n\n\n> 📘 Auto-update campaign\n>\n> In case you want to ensure the number of publishable codes increases automatically with the number of customers, you should use **auto-update** campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Provide details to whom the loyalty card should be assigned. \n\nYou can choose to either specify the exact loyalty card code that you want to publish from existin (non-assigned) codes, or choose not to specify a voucher code. If you choose not to specify a code in the request paylaod, then the system will choose the next available voucher code available to be assigned to a customer. \n\nYou can also include metadata in the request payload. This metadata will be assigned to the publication object, but will not be returned in the response to this endpoint. To see of publications (assignments of particular codes to customers) and publication metadata, use the [List Publications](ref:list-publications) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_add_member" }, - { - "schema": { - "type": "string" + "examples": { + "Using source ID": { + "value": { + "customer": "source_customer_1", + "metadata": { + "year": 2022 + }, + "channel": "postman", + "voucher": "KpzbHUY5" + } }, - "name": "memberId", - "in": "path", - "required": true, - "description": "A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination)." - } - ], - "post": { - "operationId": "transfer-points", - "tags": [ - "LOYALTIES API" - ], - "summary": "Transfer Loyalty Points", - "description": "Transfer points between different loyalty cards. You need to provide the campaign ID and the loyalty card ID you want the points to be transferred to as path parameters in the URL. In the request body, you provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_transfer_loyalty_points" + "Using unique Voucherify assigned ID": { + "value": { + "customer": "cust_8KQmHxAERpgebYcFhSpZRr37", + "metadata": { + "year": 2022 }, - "examples": { - "Example": { - "value": [ - { - "code": "0PmQ7JQI", - "points": 1 - }, - { - "code": "kCeufB8i", - "points": 1 - } - ] - } - } + "channel": "postman", + "voucher": "KpzbHUY5" + } + }, + "Using source ID in object": { + "value": { + "customer": { + "source_id": "source_customer_1" + }, + "metadata": { + "year": 2022 + }, + "channel": "postman", + "voucher": "KpzbHUY5" + } + }, + "Using unique Voucherify assigned ID in object": { + "value": { + "customer": { + "id": "cust_8KQmHxAERpgebYcFhSpZRr37" + }, + "metadata": { + "year": 2022 + }, + "channel": "postman", + "voucher": "KpzbHUY5" } } - }, - "responses": { - "200": { - "description": "Returns a loyalty card object for the loaded loyalty card, ie. the one that that points were transferred to from the other cards(s).", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_loyalty_card_object_non_expanded_categories" - }, - "examples": { - "Example": { - "value": { - "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", - "code": "MmFAzfDe", - "campaign": "Proportional Earning Rules", - "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "category": null, - "category_id": "cat_0b6152ce12414820de", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 13441, - "balance": 13141, - "next_expiration_date": "2022-11-30", - "next_expiration_points": 0 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX184kVdWUO/msrLg1G0MRf/Cs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk/dXm/QEJ/sulXKDlUMWf+MN7TRG5LB+wuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX184kVdWUO%2FmsrLg1G0MRf%2FCs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk%2FdXm%2FQEJ%2FsulXKDlUMWf%2BMN7TRG5LB%2BwuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1/RGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW/cXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ==", - "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FRGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW%2FcXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-02-18T14:03:59.954Z", - "updated_at": "2022-11-28T17:58:25.607Z", - "holder_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", - "redemption": { - "quantity": null, - "redeemed_quantity": 1, - "redeemed_points": 300, - "object": "list", - "url": "/v1/vouchers/MmFAzfDe/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/MmFAzfDe/publications?page=1&limit=10" - }, - "object": "voucher" - } + } + } + } + }, + "responses": { + "200": { + "description": "Returns the voucher object that was published to the customer provided in the request payload.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_loyalty_card_object" + }, + "examples": { + "Loyalty Card": { + "value": { + "id": "v_0TxKw1bm0oZuS5lwA8526vze1OBMV1OH", + "code": "KpzbHUY5", + "campaign": "Loyalty Campaign", + "campaign_id": "camp_eTIsUtuzkRXQT6rsUQqrS5Gw", + "category": "New Customers", + "category_id": "cat_0b6152ce12414820dc", + "categories": [ + { + "id": "cat_0b6152ce12414820dc", + "name": "New Customers", + "hierarchy": 0, + "created_at": "2022-07-14T20:17:07.657Z", + "object": "category" } - } + ], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 0, + "balance": 0 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": { + "Season": "Fall" + }, + "assets": { + "qr": { + "id": "U2FsdGVkX1+hdZfzUaz448vIsyf7WpvXiDyqFbyw0+P5wMu12w3B5DyYwA7LCSK+Nr7TA7PKGuHOTGxfBieqrhvJo81HiaIJimDOhk+ecEOisMRmHf6XsNckVlyBHmkpBiXWNm8UDwZnXOAG75Usdw==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2BhdZfzUaz448vIsyf7WpvXiDyqFbyw0%2BP5wMu12w3B5DyYwA7LCSK%2BNr7TA7PKGuHOTGxfBieqrhvJo81HiaIJimDOhk%2BecEOisMRmHf6XsNckVlyBHmkpBiXWNm8UDwZnXOAG75Usdw%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX19VRXApVvZ9/ArwBd0wNg7s2KZBXrFvPXZdDQyzGj0HbbEIx5TAoXNR9zaE5kzIj9BElzgK82aOMMVnc1sqvr93xw+YeYMnqGqHRZfM78pYC8560Zc3U6IELtxzaJJ0x2uDUe6Dc9XYeg==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX19VRXApVvZ9%2FArwBd0wNg7s2KZBXrFvPXZdDQyzGj0HbbEIx5TAoXNR9zaE5kzIj9BElzgK82aOMMVnc1sqvr93xw%2BYeYMnqGqHRZfM78pYC8560Zc3U6IELtxzaJJ0x2uDUe6Dc9XYeg%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-11-21T15:48:57.860Z", + "updated_at": "2022-11-21T15:49:36.671Z", + "holder_id": "cust_8KQmHxAERpgebYcFhSpZRr37", + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "redeemed_points": 0, + "object": "list", + "url": "/v1/vouchers/KpzbHUY5/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/KpzbHUY5/publications?page=1&limit=10" + }, + "object": "voucher" } } } } } }, - "/v1/loyalties/{campaignId}/members/{memberId}/transactions": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return." - }, - { + "400": { + "description": "Returns an error.", + "content": { + "application/json": { "schema": { - "type": "string" + "$ref": "#/components/schemas/e_error_no_translation" }, - "name": "memberId", - "in": "path", - "required": true, - "description": "A unique code identifying the loyalty card that you are looking to retrieve transaction data for." + "examples": { + "No Voucher Suitable for Publication": { + "value": { + "code": 400, + "key": "no_voucher_suitable_for_publication", + "message": "Couldn't find any voucher suitable for publication", + "details": "Couldn't create new vouchers for publication", + "request_id": "v-0c086598620e6704dd" + } + }, + "Voucher already published": { + "value": { + "code": 400, + "key": "voucher_already_published", + "message": "Voucher already published", + "details": "Voucher 'v_ZFjKHQD0d56eMkWkrotJaVbiMuXClRuM' has already been published", + "request_id": "v-0c086aaa7dc24ccfe0" + } + } + } } - ], - "get": { - "operationId": "list-loyalty-card-transactions-1", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Loyalty Card Transactions", - "description": "Retrieve transaction data related to point movements for a specific loyalty card.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" + } + }, + "404": { + "description": "Returns an error if the voucher code that was specified in the request payload is not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" }, - { - "$ref": "#/components/parameters/page" - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id Loyalty_Card", + "request_id": "v-0c086a26de424ccf2f", + "resource_id": "Loyalty_Card", + "resource_type": "voucher" + } + } } - ], - "responses": { - "200": { - "description": "Returns a dictionary of loyalty card transaction objects.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_get_loyalty_card_transactions" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "vtx_0c9dd3c2e392f78613", - "source_id": "20230317_transfer_1", - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": "API", - "reason": "Transferring points to card", - "type": "POINTS_TRANSFER_OUT", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1396, - "object": "balance", - "points": -1, - "balance": 1396, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } - }, - "destination_voucher": { - "id": "v_Wak6xlf5WdR4rIcvJxC2olOopk0boK6t", - "code": "LOYALTY-CARD-A8XVurg", - "type": "LOYALTY_CARD", - "campaign": "Loyalty Campaign - Test Initial Points", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "loyalty_card": { - "points": 1102, - "balance": 1102, - "next_expiration_date": "2023-12-31", - "next_expiration_points": 102 - }, - "is_referral_code": false - } - }, - "related_transaction_id": "vtx_0c9dd3c2e392f78614", - "created_at": "2023-03-17T16:20:33.807Z" - }, - { - "id": "vtx_0c9dd2527696ba081b", - "source_id": "20230317_add_1", - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": null, - "reason": "Adding points to card", - "type": "POINTS_ADDITION", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1397, - "object": "balance", - "points": 100, - "balance": 1397, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-17T16:14:16.524Z" - }, - { - "id": "vtx_0c9dd1ce1d403f4204", - "source_id": "20230317_subtract_1", - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": null, - "reason": "Subtracting points from card", - "type": "POINTS_REMOVAL", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1297, - "object": "balance", - "points": -1, - "balance": 1297, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-17T16:12:00.981Z" - }, - { - "id": "vtx_0c9c21df658d03ce3f", - "source_id": null, - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": "Automation", - "reason": null, - "type": "POINTS_ACCRUAL", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1298, - "object": "balance", - "points": 200, - "balance": 1298, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } - }, - "order": { - "id": "ord_QZEKPzYATFjGoos4DonMg0fd", - "source_id": "s" - }, - "event": { - "id": "evcus_0c9c21def34e3c05bf", - "type": "customer.order.paid" - }, - "earning_rule": { - "id": "ern_2WsCIBEx6Lzf5IAV5IOR7a23", - "source": { - "banner": "Order paid" - } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-16T08:44:52.333Z" - }, - { - "id": "vtx_0c9b09673f8a862a51", - "source_id": null, - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": null, - "reason": null, - "type": "POINTS_REFUND", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1098, - "object": "balance", - "points": 1000, - "balance": 1098, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } - }, - "order": { - "id": "ord_DH2gGDlDWB1hRImf1VVB4EIH", - "source_id": null - }, - "redemption": { - "id": "r_0c9b08fe4b80897849" - }, - "rollback": { - "id": "rr_0c9b0967244a862a33" - }, - "reward": { - "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "name": "100 = $20" - } - }, - "related_transaction_id": null, - "created_at": "2023-03-15T12:19:29.149Z" - }, - { - "id": "vtx_0c9b08fe530089785c", - "source_id": null, - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": null, - "reason": null, - "type": "POINTS_REDEMPTION", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1098, - "object": "balance", - "points": -1000, - "balance": 98, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } - }, - "order": { - "id": "ord_DH2gGDlDWB1hRImf1VVB4EIH", - "source_id": null - }, - "redemption": { - "id": "r_0c9b08fe4b80897849" - }, - "reward": { - "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "name": "100 = $20" - } - }, - "related_transaction_id": null, - "created_at": "2023-03-15T12:17:41.708Z" - }, - { - "id": "vtx_0c9b074afed3b30e4b", - "source_id": "20230309_add_points_1", - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": "voucherify-web-ui", - "reason": "Customer purchased points at kiosk.", - "type": "POINTS_ADDITION", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1098, - "object": "balance", - "points": 100, - "balance": 1098, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-15T12:10:15.917Z" - }, - { - "id": "vtx_0c9b073072408969d1", - "source_id": "20230309_subtract_points_1", - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": "voucherify-web-ui", - "reason": "Customer used points to obtain tickets.", - "type": "POINTS_REMOVAL", - "details": { - "balance": { - "type": "loyalty_card", - "total": 998, - "object": "balance", - "points": -1, - "balance": 998, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-15T12:09:48.735Z" - }, - { - "id": "vtx_0c9afe802593b34b80", - "source_id": null, - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": "API", - "reason": null, - "type": "POINTS_TRANSFER_OUT", - "details": { - "balance": { - "type": "loyalty_card", - "total": 999, - "object": "balance", - "points": -1, - "balance": 999, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } - }, - "destination_voucher": { - "id": "v_Wak6xlf5WdR4rIcvJxC2olOopk0boK6t", - "code": "LOYALTY-CARD-A8XVurg", - "type": "LOYALTY_CARD", - "campaign": "Loyalty Campaign - Test Initial Points", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "loyalty_card": { - "points": 1001, - "balance": 1001, - "next_expiration_date": "2023-12-31", - "next_expiration_points": 1 - }, - "is_referral_code": false - } - }, - "related_transaction_id": "vtx_0c9afe802593b34b81", - "created_at": "2023-03-15T11:31:51.062Z" - } - ], - "has_more": false - } + } + } + } + } + } + }, + "/v1/loyalties/{campaignId}/members/{memberId}": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID." + }, + { + "schema": { + "type": "string" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "Unique code that identifies the loyalty card." + } + ], + "get": { + "operationId": "get-member-1", + "tags": [ + "LOYALTIES API" + ], + "summary": "Get Member", + "description": "Retrieves the loyalty card with the given member ID (i.e. voucher code).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns loyalty card details.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_loyalty_card_object_non_expanded_categories" + }, + "examples": { + "Loyalty Card": { + "value": { + "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", + "code": "MmFAzfDe", + "campaign": "Loyalty Program", + "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "category": null, + "category_id": "cat_0b6152ce12414820de", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 13435, + "balance": 13135, + "next_expiration_date": "2022-11-30", + "next_expiration_points": 12 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX184kVdWUO/msrLg1G0MRf/Cs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk/dXm/QEJ/sulXKDlUMWf+MN7TRG5LB+wuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX184kVdWUO%2FmsrLg1G0MRf%2FCs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk%2FdXm%2FQEJ%2FsulXKDlUMWf%2BMN7TRG5LB%2BwuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/RGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW/cXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FRGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW%2FcXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ%3D%3D" } - } + }, + "is_referral_code": false, + "created_at": "2022-02-18T14:03:59.954Z", + "updated_at": "2022-11-21T13:49:54.949Z", + "holder_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "redeemed_points": 300, + "object": "list", + "url": "/v1/vouchers/MmFAzfDe/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/MmFAzfDe/publications?page=1&limit=10" + }, + "object": "voucher" } } } } } + } + } + } + }, + "/v1/loyalties/members/{memberId}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "MmFAzfDe" }, - "/v1/loyalties/members/{memberId}/transactions": { - "parameters": [ - { + "name": "memberId", + "in": "path", + "required": true, + "description": "Unique loyalty card code assigned to a particular customer." + } + ], + "get": { + "operationId": "get-member", + "tags": [ + "LOYALTIES API" + ], + "summary": "Get Member", + "description": "Retrieve loyalty card with the given member ID (i.e. voucher code). \n\n\n> 📘 Alternative endpoint\n> This endpoint is an alternative to this [endpoint](ref:get-member-1). The URL was re-designed to allow you to retrieve loyalty card details without having to provide the `campaignId` as a path parameter.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns loyalty card details.", + "content": { + "application/json": { "schema": { - "type": "string" - }, - "name": "memberId", - "in": "path", - "required": true, - "description": "A unique code identifying the loyalty card that you are looking to retrieve transaction data for." - } - ], - "get": { - "operationId": "list-loyalty-card-transactions", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Loyalty Card Transactions", - "description": "Retrieve transaction data related to point movements for a specific loyalty card.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary of loyalty card transaction objects.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_get_loyalty_card_transactions" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "vtx_0c9dd3c2e392f78613", - "source_id": "20230317_transfer_1", - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": "API", - "reason": "Transferring points to card", - "type": "POINTS_TRANSFER_OUT", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1396, - "object": "balance", - "points": -1, - "balance": 1396, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } - }, - "destination_voucher": { - "id": "v_Wak6xlf5WdR4rIcvJxC2olOopk0boK6t", - "code": "LOYALTY-CARD-A8XVurg", - "type": "LOYALTY_CARD", - "campaign": "Loyalty Campaign - Test Initial Points", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "loyalty_card": { - "points": 1102, - "balance": 1102, - "next_expiration_date": "2023-12-31", - "next_expiration_points": 102 - }, - "is_referral_code": false - } - }, - "related_transaction_id": "vtx_0c9dd3c2e392f78614", - "created_at": "2023-03-17T16:20:33.807Z" - }, - { - "id": "vtx_0c9dd2527696ba081b", - "source_id": "20230317_add_1", - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": null, - "reason": "Adding points to card", - "type": "POINTS_ADDITION", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1397, - "object": "balance", - "points": 100, - "balance": 1397, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-17T16:14:16.524Z" - }, - { - "id": "vtx_0c9dd1ce1d403f4204", - "source_id": "20230317_subtract_1", - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": null, - "reason": "Subtracting points from card", - "type": "POINTS_REMOVAL", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1297, - "object": "balance", - "points": -1, - "balance": 1297, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-17T16:12:00.981Z" - }, - { - "id": "vtx_0c9c21df658d03ce3f", - "source_id": null, - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": "Automation", - "reason": null, - "type": "POINTS_ACCRUAL", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1298, - "object": "balance", - "points": 200, - "balance": 1298, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } - }, - "order": { - "id": "ord_QZEKPzYATFjGoos4DonMg0fd", - "source_id": "s" - }, - "event": { - "id": "evcus_0c9c21def34e3c05bf", - "type": "customer.order.paid" - }, - "earning_rule": { - "id": "ern_2WsCIBEx6Lzf5IAV5IOR7a23", - "source": { - "banner": "Order paid" - } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-16T08:44:52.333Z" - }, - { - "id": "vtx_0c9b09673f8a862a51", - "source_id": null, - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": null, - "reason": null, - "type": "POINTS_REFUND", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1098, - "object": "balance", - "points": 1000, - "balance": 1098, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } - }, - "order": { - "id": "ord_DH2gGDlDWB1hRImf1VVB4EIH", - "source_id": null - }, - "redemption": { - "id": "r_0c9b08fe4b80897849" - }, - "rollback": { - "id": "rr_0c9b0967244a862a33" - }, - "reward": { - "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "name": "100 = $20" - } - }, - "related_transaction_id": null, - "created_at": "2023-03-15T12:19:29.149Z" - }, - { - "id": "vtx_0c9b08fe530089785c", - "source_id": null, - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": null, - "reason": null, - "type": "POINTS_REDEMPTION", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1098, - "object": "balance", - "points": -1000, - "balance": 98, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } - }, - "order": { - "id": "ord_DH2gGDlDWB1hRImf1VVB4EIH", - "source_id": null - }, - "redemption": { - "id": "r_0c9b08fe4b80897849" - }, - "reward": { - "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "name": "100 = $20" - } - }, - "related_transaction_id": null, - "created_at": "2023-03-15T12:17:41.708Z" - }, - { - "id": "vtx_0c9b074afed3b30e4b", - "source_id": "20230309_add_points_1", - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": "voucherify-web-ui", - "reason": "Customer purchased points at kiosk.", - "type": "POINTS_ADDITION", - "details": { - "balance": { - "type": "loyalty_card", - "total": 1098, - "object": "balance", - "points": 100, - "balance": 1098, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-15T12:10:15.917Z" - }, - { - "id": "vtx_0c9b073072408969d1", - "source_id": "20230309_subtract_points_1", - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": "voucherify-web-ui", - "reason": "Customer used points to obtain tickets.", - "type": "POINTS_REMOVAL", - "details": { - "balance": { - "type": "loyalty_card", - "total": 998, - "object": "balance", - "points": -1, - "balance": 998, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } - } - }, - "related_transaction_id": null, - "created_at": "2023-03-15T12:09:48.735Z" - }, - { - "id": "vtx_0c9afe802593b34b80", - "source_id": null, - "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "source": "API", - "reason": null, - "type": "POINTS_TRANSFER_OUT", - "details": { - "balance": { - "type": "loyalty_card", - "total": 999, - "object": "balance", - "points": -1, - "balance": 999, - "related_object": { - "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", - "type": "voucher" - } - }, - "destination_voucher": { - "id": "v_Wak6xlf5WdR4rIcvJxC2olOopk0boK6t", - "code": "LOYALTY-CARD-A8XVurg", - "type": "LOYALTY_CARD", - "campaign": "Loyalty Campaign - Test Initial Points", - "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", - "loyalty_card": { - "points": 1001, - "balance": 1001, - "next_expiration_date": "2023-12-31", - "next_expiration_points": 1 - }, - "is_referral_code": false - } - }, - "related_transaction_id": "vtx_0c9afe802593b34b81", - "created_at": "2023-03-15T11:31:51.062Z" - } - ], - "has_more": false - } + "$ref": "#/components/schemas/8_obj_loyalty_card_object_non_expanded_categories" + }, + "examples": { + "Loyalty Card": { + "value": { + "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", + "code": "MmFAzfDe", + "campaign": "Loyalty Program", + "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "category": null, + "category_id": "cat_0b6152ce12414820de", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 13435, + "balance": 13135, + "next_expiration_date": "2022-11-30", + "next_expiration_points": 12 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX184kVdWUO/msrLg1G0MRf/Cs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk/dXm/QEJ/sulXKDlUMWf+MN7TRG5LB+wuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX184kVdWUO%2FmsrLg1G0MRf%2FCs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk%2FdXm%2FQEJ%2FsulXKDlUMWf%2BMN7TRG5LB%2BwuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/RGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW/cXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FRGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW%2FcXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ%3D%3D" } - } + }, + "is_referral_code": false, + "created_at": "2022-02-18T14:03:59.954Z", + "updated_at": "2022-11-21T13:49:54.949Z", + "holder_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "redeemed_points": 300, + "object": "list", + "url": "/v1/vouchers/MmFAzfDe/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/MmFAzfDe/publications?page=1&limit=10" + }, + "object": "voucher" } } } } } + } + } + } + }, + "/v1/loyalties/{campaignId}/members/{memberId}/activities": { + "parameters": [ + { + "schema": { + "type": "string" }, - "/v1/loyalties/members/{memberId}/transactions/export": { - "parameters": [ - { + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID." + }, + { + "schema": { + "type": "string" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "A code that identifies the loyalty card." + } + ], + "get": { + "operationId": "get-member-activities-1", + "tags": [ + "LOYALTIES API" + ], + "summary": "Get Member Activities", + "description": "Retrieves the list of activities for the given member ID related to voucher and customer who is a holder of the voucher.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of event objects related to the loyalty card.", + "content": { + "application/json": { "schema": { - "type": "string" - }, - "name": "memberId", - "in": "path", - "required": true, - "description": "A unique code identifying the loyalty card that you are looking to export transaction data for." + "$ref": "#/components/schemas/8_res_get_member_activities" + } } - ], - "post": { - "operationId": "export-loyalty-card-transactions", - "tags": [ - "LOYALTIES API" - ], - "summary": "Export Loyalty Card Transactions", - "description": "Export transactions that are associated with point movements on a loyalty card.\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID assigned by Voucherify. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `POINTS_EXPIRATION`
                  - `POINTS_ADDITION`
                  - `POINTS_REMOVAL`
                  - `POINTS_TRANSFER_OUT`
                  - `POINTS_ACCRUAL`
                  - `POINTS_REFUND`
                  - `POINTS_REDEMPTION` |\n| source_id | Custom source ID of the transaction if one was included originally. | source_id_custom |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The loyalty card balance after the transaction. | |\n| amount | The amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | - `API`
                  - `voucherify-web-ui`
                  - `Automation` |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n| related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + } + } + } + } + }, + "/v1/loyalties/members/{memberId}/activities": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "MmFAzfDe" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "Unique loyalty card assigned to a particular customer." + } + ], + "get": { + "operationId": "get-member-activities", + "tags": [ + "LOYALTIES API" + ], + "summary": "Get Member Activities", + "description": "Retrieves a list of activities for the given loyalty card related to the loyalty and customer who is the holder of the loyalty card.\n\n\n> 📘 Alternative endpoint\n> This endpoint is an alternative to this [endpoint](ref:get-member-activities-1). The URL was re-designed to allow you to get member activities without having to provide the `campaignId` as a path parameter.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of event objects related to the loyalty card.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_get_member_activities" } - ], - "requestBody": { - "description": "Specify the parameters and filters for the transaction export.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_create_loyalty_card_transactions_export" - }, - "examples": { - "Example": { - "value": { - "parameters": { - "order": "-created_at", - "fields": [ - "id", - "type", - "source_id", - "reason", - "balance", - "amount", - "created_at", - "voucher_id", - "campaign_id", - "details", - "related_transaction_id" - ] - } - } - } - } + } + } + } + } + } + }, + "/v1/loyalties/{campaignId}/members/{memberId}/balance": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_7s3uXI44aKfIk5IhmeOPr6ic" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID." + }, + { + "schema": { + "type": "string", + "example": "MmFAzfDe" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "A code that identifies the loyalty card." + } + ], + "post": { + "operationId": "add-remove-loyalty-card-balance-1", + "tags": [ + "LOYALTIES API" + ], + "summary": "Add or Remove Loyalty Card Balance", + "description": "This method adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the point adjustment along with the expiration mechanism.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_add_remove_points_balance" + }, + "examples": { + "Add points": { + "value": { + "points": 100, + "expiration_type": "CUSTOM_DATE", + "expiration_date": "2023-05-30" + } + }, + "Deduct points": { + "value": { + "points": -100 } } - }, - "responses": { - "200": { - "description": "Returns an export object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_export_transactions_object" - }, - "examples": { - "Example": { - "value": { - "id": "exp_8Fwd6Z8NS67ZH314KRtm5xXE", - "object": "export", - "created_at": "2023-03-21T13:50:43.286Z", - "status": "SCHEDULED", - "channel": "API", - "exported_object": "voucher_transactions", - "parameters": { - "order": "-created_at", - "fields": [ - "id", - "type", - "source_id", - "reason", - "balance", - "amount", - "created_at", - "voucher_id", - "campaign_id", - "details", - "related_transaction_id" - ], - "filters": { - "voucher_id": { - "conditions": { - "$in": [ - "LOYALTY-CARD-2IAoDNF" - ] - } - } - } - }, - "result": null, - "user_id": null - } - }, - "No request body": { - "value": { - "id": "exp_ExEE5A6OIK4tssuNswr5O6SU", - "object": "export", - "created_at": "2023-03-21T13:34:57.034Z", - "status": "SCHEDULED", - "channel": "API", - "exported_object": "voucher_transactions", - "parameters": { - "filters": { - "voucher_id": { - "conditions": { - "$in": [ - "HRwc0oHz" - ] - } - } - } - }, - "result": null, - "user_id": null - } - } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a balance object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_add_remove_points_balance" + }, + "examples": { + "Add balance": { + "value": { + "points": -100, + "total": 13436, + "balance": 13136, + "type": "loyalty_card", + "object": "balance", + "related_object": { + "type": "voucher", + "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF" } } - } - }, - "404": { - "description": "Returns an error if the voucher code does not exist or has been deleted.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id IrKORhS", - "request_id": "v-0a96cd820301c0483a", - "resource_id": "IrKORhS", - "resource_type": "voucher" - } - } + }, + "Deduct balance": { + "value": { + "points": -100, + "total": 13436, + "balance": 13136, + "type": "loyalty_card", + "object": "balance", + "related_object": { + "type": "voucher", + "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF" } } } @@ -68860,282 +67831,100 @@ } } }, - "/v1/loyalties/{campaignId}/members/{memberId}/transactions/export": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export." - }, - { + "400": { + "description": "Returns an error if the expiration date was defined incorrectly in the request payload.", + "content": { + "application/json": { "schema": { - "type": "string" + "$ref": "#/components/schemas/e_error_no_translation" }, - "name": "memberId", - "in": "path", - "required": true, - "description": "A unique code identifying the loyalty card that you are looking to export transaction data for." - } - ], - "post": { - "operationId": "export-loyalty-card-transactions-1", - "tags": [ - "LOYALTIES API" - ], - "summary": "Export Loyalty Card Transactions", - "description": "Export transactions that are associated with point movements on a loyalty card.\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID assigned by Voucherify. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `POINTS_EXPIRATION`
                  - `POINTS_ADDITION`
                  - `POINTS_REMOVAL`
                  - `POINTS_TRANSFER_OUT`
                  - `POINTS_ACCRUAL`
                  - `POINTS_REFUND`
                  - `POINTS_REDEMPTION` |\n| source_id | Custom source ID of the transaction if one was included originally. | source_id_custom |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The loyalty card balance after the transaction. | |\n| amount | The amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | - `API`
                  - `voucherify-web-ui`
                  - `Automation` |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n| related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the parameters and filters for the transaction export.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_create_loyalty_card_transactions_export" - }, - "examples": { - "Example": { - "value": { - "parameters": { - "order": "-created_at", - "fields": [ - "id", - "type", - "source_id", - "reason", - "balance", - "amount", - "created_at", - "voucher_id", - "campaign_id", - "details", - "related_transaction_id" - ] - } - } - } + "examples": { + "Invalid expiration date": { + "value": { + "code": 400, + "key": "invalid_expiration_date", + "message": "Invalid Expiration Date", + "details": "Expiration date cannot be set in the past", + "request_id": "v-0c118b1611424ca899" } } } + } + } + } + } + } + }, + "/v1/loyalties/members/{memberId}/balance": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "MmFAzfDe" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "Unique loyalty card assigned to a particular customer." + } + ], + "post": { + "operationId": "add-remove-loyalty-card-balance", + "tags": [ + "LOYALTIES API" + ], + "summary": "Add or Remove Loyalty Card Balance", + "description": "This method gives adds or removes balance to an existing loyalty card. The removal of points will consume the points that expire the soonest. \n\n\n> 📘 Alternative endpoint\n> This endpoint is an alternative to this [endpoint](ref:add-remove-loyalty-card-balance-1). The URL was re-designed to allow you to add or remove loyalty card balance without having to provide the `campaignId` as a path parameter.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the point adjustment along with the expiration mechanism.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_add_remove_points_balance" }, - "responses": { - "200": { - "description": "Returns an export object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_export_transactions_object" - }, - "examples": { - "Example": { - "value": { - "id": "exp_8Fwd6Z8NS67ZH314KRtm5xXE", - "object": "export", - "created_at": "2023-03-21T13:50:43.286Z", - "status": "SCHEDULED", - "channel": "API", - "exported_object": "voucher_transactions", - "parameters": { - "order": "-created_at", - "fields": [ - "id", - "type", - "source_id", - "reason", - "balance", - "amount", - "created_at", - "voucher_id", - "campaign_id", - "details", - "related_transaction_id" - ], - "filters": { - "voucher_id": { - "conditions": { - "$in": [ - "LOYALTY-CARD-2IAoDNF" - ] - } - } - } - }, - "result": null, - "user_id": null - } - }, - "No request body": { - "value": { - "id": "exp_ExEE5A6OIK4tssuNswr5O6SU", - "object": "export", - "created_at": "2023-03-21T13:34:57.034Z", - "status": "SCHEDULED", - "channel": "API", - "exported_object": "voucher_transactions", - "parameters": { - "filters": { - "voucher_id": { - "conditions": { - "$in": [ - "HRwc0oHz" - ] - } - } - } - }, - "result": null, - "user_id": null - } - } - } - } + "examples": { + "Subtract points": { + "value": { + "points": -100 } }, - "404": { - "description": "Returns an error if the voucher code does not exist or has been deleted.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id IrKORhS", - "request_id": "v-0a96cd820301c0483a", - "resource_id": "IrKORhS", - "resource_type": "voucher" - } - } - } - } + "Add Points": { + "value": { + "points": 100, + "expiration_type": "CUSTOM_DATE", + "expiration_date": "2023-05-30" } } } } - }, - "/v1/loyalties/{campaignId}/members/{memberId}/points-expiration": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_7s3uXI44aKfIk5IhmeOPr6ic" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " - }, - { + } + }, + "responses": { + "200": { + "description": "Returns a balance object.", + "content": { + "application/json": { "schema": { - "type": "string" - }, - "name": "memberId", - "in": "path", - "required": true, - "description": "Loyalty card code." - } - ], - "get": { - "operationId": "get-points-expiration", - "tags": [ - "LOYALTIES API" - ], - "summary": "Get Points Expiration", - "description": "Retrieve loyalty point expiration buckets for a given loyalty card. Expired point buckets are not returned in this endpoint. You can use the [Exports API](ref:create-export) to retrieve a list of both `ACTIVE` and `EXPIRED` point buckets.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" + "$ref": "#/components/schemas/8_res_add_remove_points_balance" }, - { - "$ref": "#/components/parameters/page" - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a list of loyalty points expiration buckets along with an expiration date if the points are due to expire. No expiration date parameter is returned if the loyalty points bucket does not expire.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoyaltiesGetPointsExpirationResponseBody" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "lopb_ERSwDxeWTlvWwFrn3AtJxt3s", - "voucher_id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", - "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "bucket": { - "total_points": 2 - }, - "status": "ACTIVE", - "expires_at": "2022-11-25", - "created_at": "2022-11-25T09:10:20.994Z", - "object": "loyalty_points_bucket" - }, - { - "id": "lopb_zdeIBq3EsnPnRSDa7Tyyb6X2", - "voucher_id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", - "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "bucket": { - "total_points": 12 - }, - "status": "ACTIVE", - "expires_at": "2022-11-30", - "created_at": "2022-11-21T13:49:54.949Z", - "object": "loyalty_points_bucket" - }, - { - "id": "lopb_Mg80vhZtqHFItWlJFYZ2rJAS", - "voucher_id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", - "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "bucket": { - "total_points": 0 - }, - "status": "ACTIVE", - "expires_at": "2023-05-30", - "created_at": "2022-06-09T11:07:07.344Z", - "updated_at": "2022-08-30T08:34:45.989Z", - "object": "loyalty_points_bucket" - }, - { - "id": "lopb_dQE1TwyTkHAJDlVCPlqSC0nu", - "voucher_id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", - "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "bucket": { - "total_points": 13124 - }, - "status": "ACTIVE", - "created_at": "2022-02-28T12:13:57.749Z", - "updated_at": "2022-11-25T09:09:51.136Z", - "object": "loyalty_points_bucket" - } - ], - "total": 4 - } - } + "examples": { + "Subtract Points": { + "value": { + "points": 100, + "total": 13436, + "balance": 13136, + "type": "loyalty_card", + "object": "balance", + "related_object": { + "type": "voucher", + "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF" } } } @@ -69143,2621 +67932,3777 @@ } } }, - "/v1/loyalties/{campaignId}/points-expiration/export": { - "parameters": [ - { + "400": { + "description": "Returns an error if the expiration date was specified incorrectly in the request payload.", + "content": { + "application/json": { "schema": { - "type": "string" + "$ref": "#/components/schemas/e_error_no_translation" }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID or name." - } - ], - "post": { - "operationId": "create-points-expiration-export", - "tags": [ - "LOYALTIES API" - ], - "summary": "Create Points Expiration Export", - "description": "Schedule the generation of a points expiration CSV file for a particular campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the data filters, types of data to return and order in which the results should be returned.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_export_points_expirations" - }, - "examples": { - "Specific Vouchers": { - "value": { - "parameters": { - "fields": [ - "id", - "campaign_id", - "voucher_id", - "status", - "expires_at", - "points" - ], - "order": "-expires_at", - "filters": { - "junction": "and", - "voucher_id": { - "conditions": { - "$in": [ - "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", - "v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655" - ] - } - } - } - } - } - }, - "Specific campaign": { - "value": { - "parameters": { - "fields": [ - "id", - "campaign_id", - "voucher_id", - "status", - "expires_at", - "points" - ], - "order": "-expires_at", - "filters": { - "junction": "and", - "campaign_id": { - "conditions": { - "$is": "camp_7s3uXI44aKfIk5IhmeOPr6ic" - } - } - } - } - } - } + "examples": { + "Invalid payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Property .expiration_date cannot be recognized as a ISO-8601 compliant date", + "request_id": "v-0c118c6f7c0e6751ab" } } } + } + } + } + } + } + }, + "/v1/loyalties/{campaignId}/members/{memberId}/transfers": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "A unique identifier of the loyalty campaign containing the voucher to which the loyalty points will be sent (destination)." + }, + { + "schema": { + "type": "string" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "A unique code identifying the loyalty card to which the user wants to transfer loyalty points (destination)." + } + ], + "post": { + "operationId": "transfer-points", + "tags": [ + "LOYALTIES API" + ], + "summary": "Transfer Loyalty Points", + "description": "Transfer points between different loyalty cards. You need to provide the campaign ID and the loyalty card ID you want the points to be transferred to as path parameters in the URL. In the request body, you provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Provide the loyalty cards you want the points to be transferred from and the number of points to transfer from each card.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_transfer_loyalty_points" }, - "responses": { - "200": { - "description": "Returns an object with the export ID of the scheduled generation of CSV file with exported points expirations. You can use either the [Get Export](ref:get-export) endpoint to view the status and obtain the URL of the CSV file or [Download Export](ref:download-export) endpoint to download the CSV file.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_export_object_points_expiration" - }, - "examples": { - "Specific Vouchers": { - "value": { - "id": "exp_zC3eXAFss17XTMzMkkov4KGq", - "object": "export", - "created_at": "2022-11-28T13:00:23.621Z", - "status": "SCHEDULED", - "channel": "API", - "exported_object": "points_expiration", - "parameters": { - "order": "-expires_at", - "fields": [ - "id", - "campaign_id", - "voucher_id", - "status", - "expires_at", - "points" - ], - "filters": { - "junction": "and", - "voucher_id": { - "conditions": { - "$in": [ - "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", - "v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655" - ] - } - } - } - }, - "result": null, - "user_id": null - } - }, - "Specific Campaign": { - "value": { - "id": "exp_kfwVDMsavDHl2vOY6vH9q7P7", - "object": "export", - "created_at": "2022-11-28T16:46:34.148Z", - "status": "SCHEDULED", - "channel": "API", - "exported_object": "points_expiration", - "parameters": { - "order": "-expires_at", - "fields": [ - "id", - "campaign_id", - "voucher_id", - "status", - "expires_at", - "points" - ], - "filters": { - "junction": "and", - "campaign_id": { - "conditions": { - "$is": "camp_7s3uXI44aKfIk5IhmeOPr6ic" - } - } - } - }, - "result": null, - "user_id": null - } - } - } + "examples": { + "Example": { + "value": [ + { + "code": "0PmQ7JQI", + "points": 1 + }, + { + "code": "kCeufB8i", + "points": 1 } - } + ] } } } - }, - "/v1/loyalties/{campaignId}/earning-rules": { - "parameters": [ - { + } + }, + "responses": { + "200": { + "description": "Returns a loyalty card object for the loaded loyalty card, ie. the one that that points were transferred to from the other cards(s).", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "camp_0dJG7cCAjquzcxWmZ634bA0C" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " - } - ], - "get": { - "operationId": "list-earning-rules", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Earning Rules", - "description": "Returns a list of all earning rules within a given campaign.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ] - }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a list of earning rules.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_list_earning_rules" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "ern_HnRXyJHoj3E79r3KUWhgMgtD", - "created_at": "2022-11-10T12:25:12.927Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 100, - "type": "FIXED" - }, - "segment": { - "id": "seg_n3vVcU5t0m3rs4rEPr3C1oU5" - }, - "event": "customer.segment.entered", - "source": { - "banner": "New Customers", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_0gv3v7jQG5U6TtVC8bMEdIap", - "metadata": {} - }, - { - "id": "ern_raVUcdXruvXGuzm682ESrAzt", - "created_at": "2022-11-24T09:03:14.534Z", - "updated_at": "2022-11-25T07:31:42.778Z", - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "points": 20, - "type": "FIXED" - }, - "event": "order.paid", - "source": { - "banner": "Order has been paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-23T00:00:00.000Z", - "expiration_date": "2022-11-30T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_MbEIyLbn7pHyba5Qw5eeb35L", - "metadata": { - "Type": "Order has been paid - Fixed" - } - }, - { - "id": "ern_BmDiQs7T3UHfJQqtI2RfJHFR", - "created_at": "2022-11-24T14:48:36.567Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_AMOUNT", - "order": { - "amount": { - "every": 1000, - "points": 1 - } - } - }, - "event": "order.paid", - "source": { - "banner": "Order paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_IKanVw37J6oFuRrdnryXw8Lz", - "metadata": { - "Type": "Order has been paid - Proportional - 1" - } - }, - { - "id": "ern_jwtacKdEEHoc85QbouRw3CR8", - "created_at": "2022-11-24T15:17:11.539Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_TOTAL_AMOUNT", - "order": { - "total_amount": { - "every": 1100, - "points": 1 - } - } - }, - "event": "order.paid", - "source": { - "banner": "Order has been paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_Y6IWqhz0cHGkKcteU9PS5nmK", - "metadata": { - "Type": "Order has been paid - Proportional - 2" - } - }, - { - "id": "ern_fxVdmtJ4u4rlyoH2hIq7m1PQ", - "created_at": "2022-11-24T15:20:04.392Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_METADATA", - "order": { - "metadata": { - "every": 10, - "points": 2, - "property": "number_of_store_visits" - } - } - }, - "event": "order.paid", - "source": { - "banner": "Order paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_HyowcdKQ0lsQ1rSxV5tyYr2z", - "metadata": { - "Type": "Order has been paid - Proportional - 3 - Metadata" - } - }, - { - "id": "ern_Aop1wTrmPv4yBntDcvXNTCWR", - "created_at": "2022-11-24T15:23:44.514Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_AMOUNT", - "order_items": { - "amount": { - "every": 1000, - "points": 3, - "object": "products_collection", - "id": "pc_75U0dHlr7u75BJodrW1AE3t6" - } - } - }, - "event": "order.paid", - "source": { - "banner": "Order paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_EXRyQ0z0rgtF54PKDGGAF1qg", - "metadata": { - "Type": "Order has been paid - Proportional - 4" - } - }, - { - "id": "ern_4qSQVjfGEH7OmXKMzotS0juY", - "created_at": "2022-11-24T15:44:45.301Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_SUBTOTAL_AMOUNT", - "order_items": { - "subtotal_amount": { - "every": 1000, - "points": 4, - "object": "sku", - "id": "sku_0b7d7dfb090be5c619" - } - } - }, - "event": "order.paid", - "source": { - "banner": "Order paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_ID3xLPXCdnOaveJYWiulcNFW", - "metadata": { - "Type": "Order has been paid - Proportional - 5 - Items" - } - }, - { - "id": "ern_aJyt4wIrXhmfMxvrLoZjBYrP", - "created_at": "2022-11-24T15:56:58.710Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_AMOUNT", - "order_items": { - "amount": { - "every": 10000, - "points": 1, - "object": "product", - "id": "prod_0bae32322150fd0546" - } - } - }, - "event": "order.paid", - "source": { - "banner": "Order paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_EbBqD1SNW70vgDp5icGbWl3e", - "metadata": {} - }, - { - "id": "ern_v4Blmh9hA3gpnjo93cMAgvHr", - "created_at": "2022-11-24T16:19:20.571Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 1, - "points": 5, - "property": "customer_life_time_value" - } - } - }, - "segment": { - "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" - }, - "event": "customer.segment.entered", - "source": { - "banner": "Entered Segment", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_wMMDJ86iHKkznz9x0506e30E", - "metadata": {} - }, - { - "id": "ern_L8dFanPxJzhw0f5voTwPurGP", - "created_at": "2022-11-24T16:27:13.917Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 3, - "type": "FIXED" - }, - "custom_event": { - "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" - }, - "event": "page_view", - "source": { - "banner": "Custom Event", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_9N69OJzGKGhp2mo7SNsnsF5b", - "metadata": { - "Type": "Fixed" - } - }, - { - "id": "ern_ngdugZ2hzg35hGASFF8nDjUO", - "created_at": "2022-11-24T16:41:48.830Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOM_EVENT_METADATA", - "custom_event": { - "metadata": { - "every": 2, - "points": 2, - "property": "volume_number" - } - } - }, - "custom_event": { - "schema_id": "ms_qpRZ3EmRQyszNH6Z52Gkq8au" - }, - "event": "user_subscribed", - "source": { - "banner": "Custom Event", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_v1eTxL7X63B5IkYgRWHK4leh", - "metadata": { - "Type": "Event" - } - }, - { - "id": "ern_afo3Ea760hAKv07JYpycnhiE", - "created_at": "2022-11-24T16:50:12.945Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 3, - "points": 3, - "property": "customer_life_time_value" - } - } - }, - "custom_event": { - "schema_id": "ms_f0r4hcu5T0m3v3nT5ch3ma" - }, - "event": "cart_abandoned", - "source": { - "banner": "Custom Event", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_7ovoKiXx49fe3nnhEbDlp9FP", - "metadata": {} - }, - { - "id": "ern_chdlG14W8Sdcq3d6jJQQgRMT", - "created_at": "2022-11-24T16:51:31.595Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 1, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.joined", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Tier joined - Any", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_W9yMQTz5fgQTgmuu6pTVraBW", - "metadata": { - "Type": "Tier joined - any - fixed" - } - }, - { - "id": "ern_gVo6CHBduFPoh1hctASfXHLT", - "created_at": "2022-11-24T17:01:42.809Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 4, - "points": 4, - "property": "customer_life_time_value" - } - } - }, - "event": "customer.loyalty.tier.joined", - "loyalty_tier": { - "id": "ltr_pudTGWasuIqxdiDM0go31OV1" - }, - "source": { - "banner": "Tier joined", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_wdlEo17wmoqYHGfilbayEUj7", - "metadata": { - "Type": "Tier joined - customer metadata - proportional" - } - }, - { - "id": "ern_66OdCyLADv5IGFoQe18vGUwa", - "created_at": "2022-11-24T17:03:59.414Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 2, - "points": 2, - "property": "customer_life_time_value" - } - } - }, - "event": "customer.loyalty.tier.left", - "loyalty_tier": { - "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2" - }, - "source": { - "banner": "Tier left", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_czm5el1Uz1jeGaO97AYoDNAq", - "metadata": { - "Type": "Tier left" - } - }, - { - "id": "ern_YR3fDfCjAmz9a5D68nk0i4dm", - "created_at": "2022-11-25T07:29:38.961Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 3, - "points": 4, - "property": "customer_life_time_value" - } - } - }, - "event": "customer.loyalty.tier.upgraded", - "loyalty_tier": { - "id": "ltr_30KHciA0UG8B71Fo51GZqwgN" - }, - "source": { - "banner": "Tier upgraded", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_M1OdRH8spk6Fs7yTuPLN2LAv", - "metadata": { - "Type": "Upgraded" - } - }, - { - "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", - "created_at": "2022-11-25T07:31:05.866Z", - "updated_at": "2022-11-25T07:31:43.029Z", - "validation_rule_id": "val_kfmWpfXMI9P1", - "loyalty": { - "points": 1, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.downgraded", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Tier Downgraded", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", - "metadata": { - "Type": "Tier" - } - }, - { - "id": "ern_AdlWO2yt6b6llWsibIdiRXVE", - "created_at": "2022-11-25T07:31:42.767Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 5, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.prolonged", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Prolonged", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_4jH1yq9WJS0oJ8suagCrltyb", - "metadata": {} - } - ], - "total": 18 - } + "$ref": "#/components/schemas/8_obj_loyalty_card_object_non_expanded_categories" + }, + "examples": { + "Example": { + "value": { + "id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", + "code": "MmFAzfDe", + "campaign": "Proportional Earning Rules", + "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "category": null, + "category_id": "cat_0b6152ce12414820de", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 13441, + "balance": 13141, + "next_expiration_date": "2022-11-30", + "next_expiration_points": 0 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX184kVdWUO/msrLg1G0MRf/Cs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk/dXm/QEJ/sulXKDlUMWf+MN7TRG5LB+wuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX184kVdWUO%2FmsrLg1G0MRf%2FCs6QwSN3f6kyWCOTGdijyq8OfUbUpcGx6fjdeIpTf2UilFGNG8aCWVk%2FdXm%2FQEJ%2FsulXKDlUMWf%2BMN7TRG5LB%2BwuzqTy7csDBfRoJn0fURpwU4A6VZZSwBQ%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1/RGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW/cXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ==", + "url": "https://dev.dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2FRGZN9VwvkdI6B26PPZQZWjh33USr5NPMXbHuJVkxsH6TUyW%2FcXen1Lc7gaqik09BGiry0R4QIAP52jnxQuABOsW0HdYfglsLPY7IajGX5rJzZKDKuzioq2vRIPyuE6z03frAod7ptvQ%3D%3D" } - } + }, + "is_referral_code": false, + "created_at": "2022-02-18T14:03:59.954Z", + "updated_at": "2022-11-28T17:58:25.607Z", + "holder_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", + "redemption": { + "quantity": null, + "redeemed_quantity": 1, + "redeemed_points": 300, + "object": "list", + "url": "/v1/vouchers/MmFAzfDe/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/MmFAzfDe/publications?page=1&limit=10" + }, + "object": "voucher" } } } } - }, - "post": { - "operationId": "create-earning-rule", - "tags": [ - "LOYALTIES API" - ], - "summary": "Create Earning Rule", - "description": "Create earning rules for a loyalty campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Customize the request body based on the type of earning rules you would like to create. The request body is an array of objects. The required minimum properties to include in the payload for each object are `event` and `loyalty`. Additionally, if you choose to add a `validity_timeframe`, you must include a `start_date`. Furthermore, an earning rule `event` type: \n\n- `customer.segment.entered` requires a `segment` object\n- a custom event requires a `custom_event` object\n- a `customer.loyalty.tier.joined`, `customer.loyalty.tier.left`, `customer.loyalty.tier.upgraded`, `customer.loyalty.tier.downgraded`, `customer.loyalty.tier.prolonged` requires a `loyalty_tier` object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_create_earning_rules" - }, - "examples": { - "Example": { - "value": [ - { - "event": "order.paid", - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "FIXED", - "points": "5" - }, - "source": { - "banner": "Order paid 5 points." - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Order paid - fixed amount of points" - } - }, - { - "event": "order.paid", - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_AMOUNT", - "order": { - "amount": { - "every": 1, - "points": 1 - } - } - }, - "source": { - "banner": "Order paid - 1 point for 1 dollar spent excluding discounts." - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Order paid- points proportional to order amount" - } - }, - { - "event": "order.paid", - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_TOTAL_AMOUNT", - "order": { - "total_amount": { - "every": 1, - "points": 1 - } - } - }, - "source": { - "banner": "Order paid - 1 point for 1 dollar spent including discounts." - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Order paid- points proportional to order total amount" - } - }, - { - "event": "order.paid", - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_METADATA", - "order": { - "metadata": { - "every": 2, - "points": 1, - "property": "number_of_store_visits" - } - } - }, - "source": { - "banner": "Order paid - 2 points for each store visit." - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Order paid- points proportional to numerical order metadata property " - } - }, - { - "event": "order.paid", - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_AMOUNT", - "order_items": { - "amount": { - "every": 2, - "points": 1, - "object": "product", - "id": "prod_0bae32322150fd0546" - } - } - }, - "source": { - "banner": "Order paid - 2 points for 1 dollar spent on items excluding discounts." - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Order paid- points proportional to order items amount" - } - }, - { - "event": "order.paid", - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_SUBTOTAL_AMOUNT", - "order_items": { - "subtotal_amount": { - "every": 2, - "points": 1, - "object": "products_collection", - "id": "pc_75U0dHlr7u75BJodrW1AE3t6" - } + } + } + } + } + }, + "/v1/loyalties/{campaignId}/members/{memberId}/transactions": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to return." + }, + { + "schema": { + "type": "string" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "A unique code identifying the loyalty card that you are looking to retrieve transaction data for." + } + ], + "get": { + "operationId": "list-loyalty-card-transactions-1", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Loyalty Card Transactions", + "description": "Retrieve transaction data related to point movements for a specific loyalty card.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary of loyalty card transaction objects.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_get_loyalty_card_transactions" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "vtx_0c9dd3c2e392f78613", + "source_id": "20230317_transfer_1", + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": "API", + "reason": "Transferring points to card", + "type": "POINTS_TRANSFER_OUT", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1396, + "object": "balance", + "points": -1, + "balance": 1396, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" } }, - "source": { - "banner": "Order paid - 2 points for every dollar spent on the product collection." - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Order paid- points proportional to order items subtotal amount" + "destination_voucher": { + "id": "v_Wak6xlf5WdR4rIcvJxC2olOopk0boK6t", + "code": "LOYALTY-CARD-A8XVurg", + "type": "LOYALTY_CARD", + "campaign": "Loyalty Campaign - Test Initial Points", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "loyalty_card": { + "points": 1102, + "balance": 1102, + "next_expiration_date": "2023-12-31", + "next_expiration_points": 102 + }, + "is_referral_code": false } - }, - { - "event": "order.paid", - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_QUANTITY", - "order_items": { - "quantity": { - "every": 1, - "points": 1, - "object": "sku", - "id": "sku_0b7d7dfb090be5c619" - } - } - }, - "source": { - "banner": "Order paid - 1 point for every brand phone in your cart." - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Order paid - points proportional to quantity of items in a cart of a product varient." + }, + "related_transaction_id": "vtx_0c9dd3c2e392f78614", + "created_at": "2023-03-17T16:20:33.807Z" + }, + { + "id": "vtx_0c9dd2527696ba081b", + "source_id": "20230317_add_1", + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": null, + "reason": "Adding points to card", + "type": "POINTS_ADDITION", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1397, + "object": "balance", + "points": 100, + "balance": 1397, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } } }, - { - "event": "order.paid", - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 1, - "points": 1, - "property": "customer_life_time_value" - } + "related_transaction_id": null, + "created_at": "2023-03-17T16:14:16.524Z" + }, + { + "id": "vtx_0c9dd1ce1d403f4204", + "source_id": "20230317_subtract_1", + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": null, + "reason": "Subtracting points from card", + "type": "POINTS_REMOVAL", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1297, + "object": "balance", + "points": -1, + "balance": 1297, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" } - }, - "source": { - "banner": "Order paid 1 point for 1 month of being a customer with us." - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Order paid - points proportional to customer metadata property" } }, - { - "event": "customer.segment.entered", - "segment": { - "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" - }, - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 1, - "points": 1, - "property": "customer_life_time_value" - } + "related_transaction_id": null, + "created_at": "2023-03-17T16:12:00.981Z" + }, + { + "id": "vtx_0c9c21df658d03ce3f", + "source_id": null, + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": "Automation", + "reason": null, + "type": "POINTS_ACCRUAL", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1298, + "object": "balance", + "points": 200, + "balance": 1298, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" } }, - "source": { - "banner": "Customer entered birthday segment - 1 point for each month of being a customer with us." + "order": { + "id": "ord_QZEKPzYATFjGoos4DonMg0fd", + "source_id": "s" }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" + "event": { + "id": "evcus_0c9c21def34e3c05bf", + "type": "customer.order.paid" }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Entered segment - points proportional to customer metadata property" + "earning_rule": { + "id": "ern_2WsCIBEx6Lzf5IAV5IOR7a23", + "source": { + "banner": "Order paid" + } } }, - { - "event": "customer.segment.entered", - "segment": { - "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" + "related_transaction_id": null, + "created_at": "2023-03-16T08:44:52.333Z" + }, + { + "id": "vtx_0c9b09673f8a862a51", + "source_id": null, + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": null, + "reason": null, + "type": "POINTS_REFUND", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1098, + "object": "balance", + "points": 1000, + "balance": 1098, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } }, - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "FIXED", - "points": "5" + "order": { + "id": "ord_DH2gGDlDWB1hRImf1VVB4EIH", + "source_id": null }, - "source": { - "banner": "Customer entered birthday segment - 5 points" + "redemption": { + "id": "r_0c9b08fe4b80897849" }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" + "rollback": { + "id": "rr_0c9b0967244a862a33" }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Entered segment - fixed points" + "reward": { + "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "name": "100 = $20" } }, - { - "event": "page_view", - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "points": 3, - "type": "FIXED" + "related_transaction_id": null, + "created_at": "2023-03-15T12:19:29.149Z" + }, + { + "id": "vtx_0c9b08fe530089785c", + "source_id": null, + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": null, + "reason": null, + "type": "POINTS_REDEMPTION", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1098, + "object": "balance", + "points": -1000, + "balance": 98, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } }, - "custom_event": { - "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" + "order": { + "id": "ord_DH2gGDlDWB1hRImf1VVB4EIH", + "source_id": null }, - "source": { - "banner": "See page - 3 points" + "redemption": { + "id": "r_0c9b08fe4b80897849" }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" + "reward": { + "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "name": "100 = $20" + } + }, + "related_transaction_id": null, + "created_at": "2023-03-15T12:17:41.708Z" + }, + { + "id": "vtx_0c9b074afed3b30e4b", + "source_id": "20230309_add_points_1", + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": "voucherify-web-ui", + "reason": "Customer purchased points at kiosk.", + "type": "POINTS_ADDITION", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1098, + "object": "balance", + "points": 100, + "balance": 1098, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-15T12:10:15.917Z" + }, + { + "id": "vtx_0c9b073072408969d1", + "source_id": "20230309_subtract_points_1", + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": "voucherify-web-ui", + "reason": "Customer used points to obtain tickets.", + "type": "POINTS_REMOVAL", + "details": { + "balance": { + "type": "loyalty_card", + "total": 998, + "object": "balance", + "points": -1, + "balance": 998, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-15T12:09:48.735Z" + }, + { + "id": "vtx_0c9afe802593b34b80", + "source_id": null, + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": "API", + "reason": null, + "type": "POINTS_TRANSFER_OUT", + "details": { + "balance": { + "type": "loyalty_card", + "total": 999, + "object": "balance", + "points": -1, + "balance": 999, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Custom Event - fixed points for viewing a page" + "destination_voucher": { + "id": "v_Wak6xlf5WdR4rIcvJxC2olOopk0boK6t", + "code": "LOYALTY-CARD-A8XVurg", + "type": "LOYALTY_CARD", + "campaign": "Loyalty Campaign - Test Initial Points", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "loyalty_card": { + "points": 1001, + "balance": 1001, + "next_expiration_date": "2023-12-31", + "next_expiration_points": 1 + }, + "is_referral_code": false } }, - { - "event": "page_view", - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOM_EVENT_METADATA", - "custom_event": { - "metadata": { - "every": 1, - "points": 2, - "property": "volume_number" - } + "related_transaction_id": "vtx_0c9afe802593b34b81", + "created_at": "2023-03-15T11:31:51.062Z" + } + ], + "has_more": false + } + } + } + } + } + } + } + } + }, + "/v1/loyalties/members/{memberId}/transactions": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "A unique code identifying the loyalty card that you are looking to retrieve transaction data for." + } + ], + "get": { + "operationId": "list-loyalty-card-transactions", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Loyalty Card Transactions", + "description": "Retrieve transaction data related to point movements for a specific loyalty card.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary of loyalty card transaction objects.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_get_loyalty_card_transactions" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "vtx_0c9dd3c2e392f78613", + "source_id": "20230317_transfer_1", + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": "API", + "reason": "Transferring points to card", + "type": "POINTS_TRANSFER_OUT", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1396, + "object": "balance", + "points": -1, + "balance": 1396, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" } }, - "custom_event": { - "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" + "destination_voucher": { + "id": "v_Wak6xlf5WdR4rIcvJxC2olOopk0boK6t", + "code": "LOYALTY-CARD-A8XVurg", + "type": "LOYALTY_CARD", + "campaign": "Loyalty Campaign - Test Initial Points", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "loyalty_card": { + "points": 1102, + "balance": 1102, + "next_expiration_date": "2023-12-31", + "next_expiration_points": 102 + }, + "is_referral_code": false + } + }, + "related_transaction_id": "vtx_0c9dd3c2e392f78614", + "created_at": "2023-03-17T16:20:33.807Z" + }, + { + "id": "vtx_0c9dd2527696ba081b", + "source_id": "20230317_add_1", + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": null, + "reason": "Adding points to card", + "type": "POINTS_ADDITION", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1397, + "object": "balance", + "points": 100, + "balance": 1397, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-17T16:14:16.524Z" + }, + { + "id": "vtx_0c9dd1ce1d403f4204", + "source_id": "20230317_subtract_1", + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": null, + "reason": "Subtracting points from card", + "type": "POINTS_REMOVAL", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1297, + "object": "balance", + "points": -1, + "balance": 1297, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-17T16:12:00.981Z" + }, + { + "id": "vtx_0c9c21df658d03ce3f", + "source_id": null, + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": "Automation", + "reason": null, + "type": "POINTS_ACCRUAL", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1298, + "object": "balance", + "points": 200, + "balance": 1298, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } }, - "source": { - "banner": "See page X - get 2 points multiplied by the page number" + "order": { + "id": "ord_QZEKPzYATFjGoos4DonMg0fd", + "source_id": "s" }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" + "event": { + "id": "evcus_0c9c21def34e3c05bf", + "type": "customer.order.paid" }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Custom Event - proportional points for viewing a page based on custom event metadata" + "earning_rule": { + "id": "ern_2WsCIBEx6Lzf5IAV5IOR7a23", + "source": { + "banner": "Order paid" + } } }, - { - "event": "page_view", - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 1, - "points": 2, - "property": "customer_life_time_value" - } + "related_transaction_id": null, + "created_at": "2023-03-16T08:44:52.333Z" + }, + { + "id": "vtx_0c9b09673f8a862a51", + "source_id": null, + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": null, + "reason": null, + "type": "POINTS_REFUND", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1098, + "object": "balance", + "points": 1000, + "balance": 1098, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" } }, - "custom_event": { - "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" + "order": { + "id": "ord_DH2gGDlDWB1hRImf1VVB4EIH", + "source_id": null }, - "source": { - "banner": "Get 2 points for every month you're a customer for viewing a page" + "redemption": { + "id": "r_0c9b08fe4b80897849" }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" + "rollback": { + "id": "rr_0c9b0967244a862a33" }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Custom Event - proportional points for viewing a page based on customer metadata" + "reward": { + "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "name": "100 = $20" } }, - { - "event": "customer.loyalty.tier.prolonged", - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 1, - "points": 2, - "property": "customer_life_time_value" - } + "related_transaction_id": null, + "created_at": "2023-03-15T12:19:29.149Z" + }, + { + "id": "vtx_0c9b08fe530089785c", + "source_id": null, + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": null, + "reason": null, + "type": "POINTS_REDEMPTION", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1098, + "object": "balance", + "points": -1000, + "balance": 98, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" } }, - "loyalty_tier": { - "id": "ltr_pudTGWasuIqxdiDM0go31OV1" + "order": { + "id": "ord_DH2gGDlDWB1hRImf1VVB4EIH", + "source_id": null }, - "source": { - "banner": "Get 2 points for every month you're a customer when your loyalty tier is prolonged." + "redemption": { + "id": "r_0c9b08fe4b80897849" }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" + "reward": { + "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "name": "100 = $20" + } + }, + "related_transaction_id": null, + "created_at": "2023-03-15T12:17:41.708Z" + }, + { + "id": "vtx_0c9b074afed3b30e4b", + "source_id": "20230309_add_points_1", + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": "voucherify-web-ui", + "reason": "Customer purchased points at kiosk.", + "type": "POINTS_ADDITION", + "details": { + "balance": { + "type": "loyalty_card", + "total": 1098, + "object": "balance", + "points": 100, + "balance": 1098, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-15T12:10:15.917Z" + }, + { + "id": "vtx_0c9b073072408969d1", + "source_id": "20230309_subtract_points_1", + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": "voucherify-web-ui", + "reason": "Customer used points to obtain tickets.", + "type": "POINTS_REMOVAL", + "details": { + "balance": { + "type": "loyalty_card", + "total": 998, + "object": "balance", + "points": -1, + "balance": 998, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } + } + }, + "related_transaction_id": null, + "created_at": "2023-03-15T12:09:48.735Z" + }, + { + "id": "vtx_0c9afe802593b34b80", + "source_id": null, + "voucher_id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "source": "API", + "reason": null, + "type": "POINTS_TRANSFER_OUT", + "details": { + "balance": { + "type": "loyalty_card", + "total": 999, + "object": "balance", + "points": -1, + "balance": 999, + "related_object": { + "id": "v_lWRrcwNm0vqxBaU5nsSMzRRHusCsS4Vl", + "type": "voucher" + } }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "metadata": { - "Type": "Custom Event - proportional points for extending a loyalty tier based on customer metadata." + "destination_voucher": { + "id": "v_Wak6xlf5WdR4rIcvJxC2olOopk0boK6t", + "code": "LOYALTY-CARD-A8XVurg", + "type": "LOYALTY_CARD", + "campaign": "Loyalty Campaign - Test Initial Points", + "campaign_id": "camp_LyAZf94hbZaUbSdKIeAJpjRp", + "loyalty_card": { + "points": 1001, + "balance": 1001, + "next_expiration_date": "2023-12-31", + "next_expiration_points": 1 + }, + "is_referral_code": false + } + }, + "related_transaction_id": "vtx_0c9afe802593b34b81", + "created_at": "2023-03-15T11:31:51.062Z" + } + ], + "has_more": false + } + } + } + } + } + } + } + } + }, + "/v1/loyalties/members/{memberId}/transactions/export": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "A unique code identifying the loyalty card that you are looking to export transaction data for." + } + ], + "post": { + "operationId": "export-loyalty-card-transactions", + "tags": [ + "LOYALTIES API" + ], + "summary": "Export Loyalty Card Transactions", + "description": "Export transactions that are associated with point movements on a loyalty card.\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID assigned by Voucherify. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `POINTS_EXPIRATION`
                  - `POINTS_ADDITION`
                  - `POINTS_REMOVAL`
                  - `POINTS_TRANSFER_OUT`
                  - `POINTS_ACCRUAL`
                  - `POINTS_REFUND`
                  - `POINTS_REDEMPTION` |\n| source_id | Custom source ID of the transaction if one was included originally. | source_id_custom |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The loyalty card balance after the transaction. | |\n| amount | The amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | - `API`
                  - `voucherify-web-ui`
                  - `Automation` |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n| related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the parameters and filters for the transaction export.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_create_loyalty_card_transactions_export" + }, + "examples": { + "Example": { + "value": { + "parameters": { + "order": "-created_at", + "fields": [ + "id", + "type", + "source_id", + "reason", + "balance", + "amount", + "created_at", + "voucher_id", + "campaign_id", + "details", + "related_transaction_id" + ] + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns an export object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_export_transactions_object" + }, + "examples": { + "Example": { + "value": { + "id": "exp_8Fwd6Z8NS67ZH314KRtm5xXE", + "object": "export", + "created_at": "2023-03-21T13:50:43.286Z", + "status": "SCHEDULED", + "channel": "API", + "exported_object": "voucher_transactions", + "parameters": { + "order": "-created_at", + "fields": [ + "id", + "type", + "source_id", + "reason", + "balance", + "amount", + "created_at", + "voucher_id", + "campaign_id", + "details", + "related_transaction_id" + ], + "filters": { + "voucher_id": { + "conditions": { + "$in": [ + "LOYALTY-CARD-2IAoDNF" + ] + } + } + } + }, + "result": null, + "user_id": null + } + }, + "No request body": { + "value": { + "id": "exp_ExEE5A6OIK4tssuNswr5O6SU", + "object": "export", + "created_at": "2023-03-21T13:34:57.034Z", + "status": "SCHEDULED", + "channel": "API", + "exported_object": "voucher_transactions", + "parameters": { + "filters": { + "voucher_id": { + "conditions": { + "$in": [ + "HRwc0oHz" + ] + } + } + } + }, + "result": null, + "user_id": null + } + } + } + } + } + }, + "404": { + "description": "Returns an error if the voucher code does not exist or has been deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id IrKORhS", + "request_id": "v-0a96cd820301c0483a", + "resource_id": "IrKORhS", + "resource_type": "voucher" + } + } + } + } + } + } + } + } + }, + "/v1/loyalties/{campaignId}/members/{memberId}/transactions/export": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "A unique identifier of the loyalty campaign containing the voucher whose transactions you would like to export." + }, + { + "schema": { + "type": "string" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "A unique code identifying the loyalty card that you are looking to export transaction data for." + } + ], + "post": { + "operationId": "export-loyalty-card-transactions-1", + "tags": [ + "LOYALTIES API" + ], + "summary": "Export Loyalty Card Transactions", + "description": "Export transactions that are associated with point movements on a loyalty card.\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID assigned by Voucherify. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `POINTS_EXPIRATION`
                  - `POINTS_ADDITION`
                  - `POINTS_REMOVAL`
                  - `POINTS_TRANSFER_OUT`
                  - `POINTS_ACCRUAL`
                  - `POINTS_REFUND`
                  - `POINTS_REDEMPTION` |\n| source_id | Custom source ID of the transaction if one was included originally. | source_id_custom |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The loyalty card balance after the transaction. | |\n| amount | The amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | - `API`
                  - `voucherify-web-ui`
                  - `Automation` |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n| related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the parameters and filters for the transaction export.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_create_loyalty_card_transactions_export" + }, + "examples": { + "Example": { + "value": { + "parameters": { + "order": "-created_at", + "fields": [ + "id", + "type", + "source_id", + "reason", + "balance", + "amount", + "created_at", + "voucher_id", + "campaign_id", + "details", + "related_transaction_id" + ] + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns an export object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_export_transactions_object" + }, + "examples": { + "Example": { + "value": { + "id": "exp_8Fwd6Z8NS67ZH314KRtm5xXE", + "object": "export", + "created_at": "2023-03-21T13:50:43.286Z", + "status": "SCHEDULED", + "channel": "API", + "exported_object": "voucher_transactions", + "parameters": { + "order": "-created_at", + "fields": [ + "id", + "type", + "source_id", + "reason", + "balance", + "amount", + "created_at", + "voucher_id", + "campaign_id", + "details", + "related_transaction_id" + ], + "filters": { + "voucher_id": { + "conditions": { + "$in": [ + "LOYALTY-CARD-2IAoDNF" + ] + } + } + } + }, + "result": null, + "user_id": null + } + }, + "No request body": { + "value": { + "id": "exp_ExEE5A6OIK4tssuNswr5O6SU", + "object": "export", + "created_at": "2023-03-21T13:34:57.034Z", + "status": "SCHEDULED", + "channel": "API", + "exported_object": "voucher_transactions", + "parameters": { + "filters": { + "voucher_id": { + "conditions": { + "$in": [ + "HRwc0oHz" + ] + } + } + } + }, + "result": null, + "user_id": null + } + } + } + } + } + }, + "404": { + "description": "Returns an error if the voucher code does not exist or has been deleted.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id IrKORhS", + "request_id": "v-0a96cd820301c0483a", + "resource_id": "IrKORhS", + "resource_type": "voucher" + } + } + } + } + } + } + } + } + }, + "/v1/loyalties/{campaignId}/members/{memberId}/points-expiration": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_7s3uXI44aKfIk5IhmeOPr6ic" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " + }, + { + "schema": { + "type": "string" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "Loyalty card code." + } + ], + "get": { + "operationId": "get-points-expiration", + "tags": [ + "LOYALTIES API" + ], + "summary": "Get Points Expiration", + "description": "Retrieve loyalty point expiration buckets for a given loyalty card. Expired point buckets are not returned in this endpoint. You can use the [Exports API](ref:create-export) to retrieve a list of both `ACTIVE` and `EXPIRED` point buckets.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of loyalty points expiration buckets along with an expiration date if the points are due to expire. No expiration date parameter is returned if the loyalty points bucket does not expire.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltiesGetPointsExpirationResponseBody" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "lopb_ERSwDxeWTlvWwFrn3AtJxt3s", + "voucher_id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", + "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "bucket": { + "total_points": 2 + }, + "status": "ACTIVE", + "expires_at": "2022-11-25", + "created_at": "2022-11-25T09:10:20.994Z", + "object": "loyalty_points_bucket" + }, + { + "id": "lopb_zdeIBq3EsnPnRSDa7Tyyb6X2", + "voucher_id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", + "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "bucket": { + "total_points": 12 + }, + "status": "ACTIVE", + "expires_at": "2022-11-30", + "created_at": "2022-11-21T13:49:54.949Z", + "object": "loyalty_points_bucket" + }, + { + "id": "lopb_Mg80vhZtqHFItWlJFYZ2rJAS", + "voucher_id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", + "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "bucket": { + "total_points": 0 + }, + "status": "ACTIVE", + "expires_at": "2023-05-30", + "created_at": "2022-06-09T11:07:07.344Z", + "updated_at": "2022-08-30T08:34:45.989Z", + "object": "loyalty_points_bucket" + }, + { + "id": "lopb_dQE1TwyTkHAJDlVCPlqSC0nu", + "voucher_id": "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", + "campaign_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "bucket": { + "total_points": 13124 + }, + "status": "ACTIVE", + "created_at": "2022-02-28T12:13:57.749Z", + "updated_at": "2022-11-25T09:09:51.136Z", + "object": "loyalty_points_bucket" + } + ], + "total": 4 + } + } + } + } + } + } + } + } + }, + "/v1/loyalties/{campaignId}/points-expiration/export": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID or name." + } + ], + "post": { + "operationId": "create-points-expiration-export", + "tags": [ + "LOYALTIES API" + ], + "summary": "Create Points Expiration Export", + "description": "Schedule the generation of a points expiration CSV file for a particular campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the data filters, types of data to return and order in which the results should be returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_export_points_expirations" + }, + "examples": { + "Specific Vouchers": { + "value": { + "parameters": { + "fields": [ + "id", + "campaign_id", + "voucher_id", + "status", + "expires_at", + "points" + ], + "order": "-expires_at", + "filters": { + "junction": "and", + "voucher_id": { + "conditions": { + "$in": [ + "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", + "v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655" + ] + } + } + } + } + } + }, + "Specific campaign": { + "value": { + "parameters": { + "fields": [ + "id", + "campaign_id", + "voucher_id", + "status", + "expires_at", + "points" + ], + "order": "-expires_at", + "filters": { + "junction": "and", + "campaign_id": { + "conditions": { + "$is": "camp_7s3uXI44aKfIk5IhmeOPr6ic" + } + } + } + } + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns an object with the export ID of the scheduled generation of CSV file with exported points expirations. You can use either the [Get Export](ref:get-export) endpoint to view the status and obtain the URL of the CSV file or [Download Export](ref:download-export) endpoint to download the CSV file.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_export_object_points_expiration" + }, + "examples": { + "Specific Vouchers": { + "value": { + "id": "exp_zC3eXAFss17XTMzMkkov4KGq", + "object": "export", + "created_at": "2022-11-28T13:00:23.621Z", + "status": "SCHEDULED", + "channel": "API", + "exported_object": "points_expiration", + "parameters": { + "order": "-expires_at", + "fields": [ + "id", + "campaign_id", + "voucher_id", + "status", + "expires_at", + "points" + ], + "filters": { + "junction": "and", + "voucher_id": { + "conditions": { + "$in": [ + "v_0aMj6Mdp0i3zuXrd9NnBKboc7746mlgF", + "v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655" + ] } } - ] - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns an array of earning rule objects.", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/8_obj_earning_rule_object" - } - }, - "examples": { - "Example": { - "value": [ - { - "id": "ern_63g6NQgtepfXn2z0QbT2ksLf", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "points": 5, - "type": "FIXED" - }, - "event": "order.paid", - "source": { - "banner": "Order paid 5 points.", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_knM56LS3oygL0Ue0oeSNt4WA", - "metadata": { - "Type": "Order paid - fixed amount of points" - } - }, - { - "id": "ern_Ov5RWerVFubVSjIHOMco34dv", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_AMOUNT", - "order": { - "amount": { - "every": 1, - "points": 1 - } - } - }, - "event": "order.paid", - "source": { - "banner": "Order paid - 1 point for 1 dollar spent excluding discounts.", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_2R4x6pMFVEIPz1Lhz5ZVo33Y", - "metadata": { - "Type": "Order paid- points proportional to order amount" + } + }, + "result": null, + "user_id": null + } + }, + "Specific Campaign": { + "value": { + "id": "exp_kfwVDMsavDHl2vOY6vH9q7P7", + "object": "export", + "created_at": "2022-11-28T16:46:34.148Z", + "status": "SCHEDULED", + "channel": "API", + "exported_object": "points_expiration", + "parameters": { + "order": "-expires_at", + "fields": [ + "id", + "campaign_id", + "voucher_id", + "status", + "expires_at", + "points" + ], + "filters": { + "junction": "and", + "campaign_id": { + "conditions": { + "$is": "camp_7s3uXI44aKfIk5IhmeOPr6ic" + } + } + } + }, + "result": null, + "user_id": null + } + } + } + } + } + } + } + } + }, + "/v1/loyalties/{campaignId}/earning-rules": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_0dJG7cCAjquzcxWmZ634bA0C" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " + } + ], + "get": { + "operationId": "list-earning-rules", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Earning Rules", + "description": "Returns a list of all earning rules within a given campaign.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + }, + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of earning rules.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_list_earning_rules" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "ern_HnRXyJHoj3E79r3KUWhgMgtD", + "created_at": "2022-11-10T12:25:12.927Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 100, + "type": "FIXED" + }, + "segment": { + "id": "seg_n3vVcU5t0m3rs4rEPr3C1oU5" + }, + "event": "customer.segment.entered", + "source": { + "banner": "New Customers", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_0gv3v7jQG5U6TtVC8bMEdIap", + "metadata": {} + }, + { + "id": "ern_raVUcdXruvXGuzm682ESrAzt", + "created_at": "2022-11-24T09:03:14.534Z", + "updated_at": "2022-11-25T07:31:42.778Z", + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "points": 20, + "type": "FIXED" + }, + "event": "order.paid", + "source": { + "banner": "Order has been paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-23T00:00:00.000Z", + "expiration_date": "2022-11-30T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_MbEIyLbn7pHyba5Qw5eeb35L", + "metadata": { + "Type": "Order has been paid - Fixed" + } + }, + { + "id": "ern_BmDiQs7T3UHfJQqtI2RfJHFR", + "created_at": "2022-11-24T14:48:36.567Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_AMOUNT", + "order": { + "amount": { + "every": 1000, + "points": 1 } - }, - { - "id": "ern_5rWPz4arGlTv4FVc1vETeFfe", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_TOTAL_AMOUNT", - "order": { - "total_amount": { - "every": 1, - "points": 1 - } - } - }, - "event": "order.paid", - "source": { - "banner": "Order paid - 1 point for 1 dollar spent including discounts.", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_fXasfs6Eh7P2haZkI33PEumI", - "metadata": { - "Type": "Order paid- points proportional to order total amount" + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_IKanVw37J6oFuRrdnryXw8Lz", + "metadata": { + "Type": "Order has been paid - Proportional - 1" + } + }, + { + "id": "ern_jwtacKdEEHoc85QbouRw3CR8", + "created_at": "2022-11-24T15:17:11.539Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_TOTAL_AMOUNT", + "order": { + "total_amount": { + "every": 1100, + "points": 1 } - }, - { - "id": "ern_Xs3o43dHr1O3RM5ojoeu1l6b", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_METADATA", - "order": { - "metadata": { - "every": 2, - "points": 1, - "property": "number_of_store_visits" - } - } - }, - "event": "order.paid", - "source": { - "banner": "Order paid - 2 points for each store visit.", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_jucMzF25jisrqiG3k6JyyviT", + } + }, + "event": "order.paid", + "source": { + "banner": "Order has been paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_Y6IWqhz0cHGkKcteU9PS5nmK", + "metadata": { + "Type": "Order has been paid - Proportional - 2" + } + }, + { + "id": "ern_fxVdmtJ4u4rlyoH2hIq7m1PQ", + "created_at": "2022-11-24T15:20:04.392Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_METADATA", + "order": { "metadata": { - "Type": "Order paid- points proportional to numerical order metadata property " + "every": 10, + "points": 2, + "property": "number_of_store_visits" } - }, - { - "id": "ern_9CjMBP2V8zgpsHLga4YOQo0A", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_AMOUNT", - "order_items": { - "amount": { - "every": 2, - "points": 1, - "object": "product", - "id": "prod_0bae32322150fd0546" - } - } - }, - "event": "order.paid", - "source": { - "banner": "Order paid - 2 points for 1 dollar spent on items excluding discounts.", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_y60lx7XsW1YdOOOFuDaYjvG4", - "metadata": { - "Type": "Order paid- points proportional to order items amount" + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_HyowcdKQ0lsQ1rSxV5tyYr2z", + "metadata": { + "Type": "Order has been paid - Proportional - 3 - Metadata" + } + }, + { + "id": "ern_Aop1wTrmPv4yBntDcvXNTCWR", + "created_at": "2022-11-24T15:23:44.514Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_AMOUNT", + "order_items": { + "amount": { + "every": 1000, + "points": 3, + "object": "products_collection", + "id": "pc_75U0dHlr7u75BJodrW1AE3t6" } - }, - { - "id": "ern_uI7hRj8PNodK8xWRsn3gpDdG", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_SUBTOTAL_AMOUNT", - "order_items": { - "subtotal_amount": { - "every": 2, - "points": 1, - "object": "products_collection", - "id": "pc_75U0dHlr7u75BJodrW1AE3t6" - } - } - }, - "event": "order.paid", - "source": { - "banner": "Order paid - 2 points for every dollar spent on the product collection.", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_Lk1WROGexXA72FabUWhR1p7X", - "metadata": { - "Type": "Order paid- points proportional to order items subtotal amount" + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_EXRyQ0z0rgtF54PKDGGAF1qg", + "metadata": { + "Type": "Order has been paid - Proportional - 4" + } + }, + { + "id": "ern_4qSQVjfGEH7OmXKMzotS0juY", + "created_at": "2022-11-24T15:44:45.301Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_SUBTOTAL_AMOUNT", + "order_items": { + "subtotal_amount": { + "every": 1000, + "points": 4, + "object": "sku", + "id": "sku_0b7d7dfb090be5c619" } - }, - { - "id": "ern_dL13AmZEO0ToImOY44YUP1ru", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_QUANTITY", - "order_items": { - "quantity": { - "every": 1, - "points": 1, - "object": "sku", - "id": "sku_0b7d7dfb090be5c619" - } - } - }, - "event": "order.paid", - "source": { - "banner": "Order paid - 1 point for every brand phone in your cart.", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_4F9iJG0hmKTiqSsmkfbB8vUF", - "metadata": { - "Type": "Order paid - points proportional to quantity of items in a cart of a product varient." + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_ID3xLPXCdnOaveJYWiulcNFW", + "metadata": { + "Type": "Order has been paid - Proportional - 5 - Items" + } + }, + { + "id": "ern_aJyt4wIrXhmfMxvrLoZjBYrP", + "created_at": "2022-11-24T15:56:58.710Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_AMOUNT", + "order_items": { + "amount": { + "every": 10000, + "points": 1, + "object": "product", + "id": "prod_0bae32322150fd0546" } - }, - { - "id": "ern_ublD9yGhxPrd9ayPAMTc4aOZ", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 1, - "points": 1, - "property": "customer_life_time_value" - } - } - }, - "event": "order.paid", - "source": { - "banner": "Order paid 1 point for 1 month of being a customer with us.", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_raft7C1hVw427OnEobmzhXjD", + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_EbBqD1SNW70vgDp5icGbWl3e", + "metadata": {} + }, + { + "id": "ern_v4Blmh9hA3gpnjo93cMAgvHr", + "created_at": "2022-11-24T16:19:20.571Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { "metadata": { - "Type": "Order paid - points proportional to customer metadata property" + "every": 1, + "points": 5, + "property": "customer_life_time_value" } - }, - { - "id": "ern_6tBwufmR7UNJInhZq8zNRrj5", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 1, - "points": 1, - "property": "customer_life_time_value" - } - } - }, - "segment": { - "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" - }, - "event": "customer.segment.entered", - "source": { - "banner": "Customer entered birthday segment - 1 point for each month of being a customer with us.", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_mQ8SCABGLnrGMBbh8QS6DUpX", + } + }, + "segment": { + "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" + }, + "event": "customer.segment.entered", + "source": { + "banner": "Entered Segment", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_wMMDJ86iHKkznz9x0506e30E", + "metadata": {} + }, + { + "id": "ern_L8dFanPxJzhw0f5voTwPurGP", + "created_at": "2022-11-24T16:27:13.917Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 3, + "type": "FIXED" + }, + "custom_event": { + "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" + }, + "event": "page_view", + "source": { + "banner": "Custom Event", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_9N69OJzGKGhp2mo7SNsnsF5b", + "metadata": { + "Type": "Fixed" + } + }, + { + "id": "ern_ngdugZ2hzg35hGASFF8nDjUO", + "created_at": "2022-11-24T16:41:48.830Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOM_EVENT_METADATA", + "custom_event": { "metadata": { - "Type": "Entered segment - points proportional to customer metadata property" + "every": 2, + "points": 2, + "property": "volume_number" } - }, - { - "id": "ern_yBR0JtdcDyJXgZf30C8KQLPw", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "points": 5, - "type": "FIXED" - }, - "segment": { - "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" - }, - "event": "customer.segment.entered", - "source": { - "banner": "Customer entered birthday segment - 5 points", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_Co7zjgYPIKZ45vcK0jn7qrY8", + } + }, + "custom_event": { + "schema_id": "ms_qpRZ3EmRQyszNH6Z52Gkq8au" + }, + "event": "user_subscribed", + "source": { + "banner": "Custom Event", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_v1eTxL7X63B5IkYgRWHK4leh", + "metadata": { + "Type": "Event" + } + }, + { + "id": "ern_afo3Ea760hAKv07JYpycnhiE", + "created_at": "2022-11-24T16:50:12.945Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { "metadata": { - "Type": "Entered segment - fixed points" - } - }, - { - "id": "ern_Ic2AUznt4cJInIl1wt6n0Fbv", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { + "every": 3, "points": 3, - "type": "FIXED" - }, - "custom_event": { - "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" - }, - "event": "page_view", - "source": { - "banner": "See page - 3 points", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_KWvcBS3bdmJnWD4BTw29eRNT", - "metadata": { - "Type": "Custom Event - fixed points for viewing a page" + "property": "customer_life_time_value" } - }, - { - "id": "ern_4SRj1TY1j8Q617R2Y4qiN1sy", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOM_EVENT_METADATA", - "custom_event": { - "metadata": { - "every": 1, - "points": 2, - "property": "volume_number" - } - } - }, - "custom_event": { - "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" - }, - "event": "page_view", - "source": { - "banner": "See page X - get 2 points multiplied by the page number", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_WWESERcKoTRSbCDal7Hr7H0A", + } + }, + "custom_event": { + "schema_id": "ms_f0r4hcu5T0m3v3nT5ch3ma" + }, + "event": "cart_abandoned", + "source": { + "banner": "Custom Event", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_7ovoKiXx49fe3nnhEbDlp9FP", + "metadata": {} + }, + { + "id": "ern_chdlG14W8Sdcq3d6jJQQgRMT", + "created_at": "2022-11-24T16:51:31.595Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 1, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.joined", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Tier joined - Any", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_W9yMQTz5fgQTgmuu6pTVraBW", + "metadata": { + "Type": "Tier joined - any - fixed" + } + }, + { + "id": "ern_gVo6CHBduFPoh1hctASfXHLT", + "created_at": "2022-11-24T17:01:42.809Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { "metadata": { - "Type": "Custom Event - proportional points for viewing a page based on custom event metadata" + "every": 4, + "points": 4, + "property": "customer_life_time_value" } - }, - { - "id": "ern_WXBa4b5a6N5XZt9A9Nf9dagA", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 1, - "points": 2, - "property": "customer_life_time_value" - } - } - }, - "custom_event": { - "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" - }, - "event": "page_view", - "source": { - "banner": "Get 2 points for every month you're a customer for viewing a page", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_zv3mCOeZOaHCsFMG0yIKu0ax", + } + }, + "event": "customer.loyalty.tier.joined", + "loyalty_tier": { + "id": "ltr_pudTGWasuIqxdiDM0go31OV1" + }, + "source": { + "banner": "Tier joined", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_wdlEo17wmoqYHGfilbayEUj7", + "metadata": { + "Type": "Tier joined - customer metadata - proportional" + } + }, + { + "id": "ern_66OdCyLADv5IGFoQe18vGUwa", + "created_at": "2022-11-24T17:03:59.414Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { "metadata": { - "Type": "Custom Event - proportional points for viewing a page based on customer metadata" + "every": 2, + "points": 2, + "property": "customer_life_time_value" } - }, - { - "id": "ern_DvdegDzcaMUXzf2fayzCqMEV", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": null, - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 1, - "points": 2, - "property": "customer_life_time_value" - } - } - }, - "event": "customer.loyalty.tier.prolonged", - "loyalty_tier": { - "id": "ltr_pudTGWasuIqxdiDM0go31OV1" - }, - "source": { - "banner": "Get 2 points for every month you're a customer when your loyalty tier is prolonged.", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_fpfYyNcpVskgwcrs21kQ91Wx", + } + }, + "event": "customer.loyalty.tier.left", + "loyalty_tier": { + "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2" + }, + "source": { + "banner": "Tier left", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_czm5el1Uz1jeGaO97AYoDNAq", + "metadata": { + "Type": "Tier left" + } + }, + { + "id": "ern_YR3fDfCjAmz9a5D68nk0i4dm", + "created_at": "2022-11-25T07:29:38.961Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { "metadata": { - "Type": "Custom Event - proportional points for extending a loyalty tier based on customer metadata." + "every": 3, + "points": 4, + "property": "customer_life_time_value" } } - ] + }, + "event": "customer.loyalty.tier.upgraded", + "loyalty_tier": { + "id": "ltr_30KHciA0UG8B71Fo51GZqwgN" + }, + "source": { + "banner": "Tier upgraded", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_M1OdRH8spk6Fs7yTuPLN2LAv", + "metadata": { + "Type": "Upgraded" + } + }, + { + "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", + "created_at": "2022-11-25T07:31:05.866Z", + "updated_at": "2022-11-25T07:31:43.029Z", + "validation_rule_id": "val_kfmWpfXMI9P1", + "loyalty": { + "points": 1, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.downgraded", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Tier Downgraded", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", + "metadata": { + "Type": "Tier" + } + }, + { + "id": "ern_AdlWO2yt6b6llWsibIdiRXVE", + "created_at": "2022-11-25T07:31:42.767Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 5, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.prolonged", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Prolonged", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_4jH1yq9WJS0oJ8suagCrltyb", + "metadata": {} + } + ], + "total": 18 + } + } + } + } + } + } + } + }, + "post": { + "operationId": "create-earning-rule", + "tags": [ + "LOYALTIES API" + ], + "summary": "Create Earning Rule", + "description": "Create earning rules for a loyalty campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Customize the request body based on the type of earning rules you would like to create. The request body is an array of objects. The required minimum properties to include in the payload for each object are `event` and `loyalty`. Additionally, if you choose to add a `validity_timeframe`, you must include a `start_date`. Furthermore, an earning rule `event` type: \n\n- `customer.segment.entered` requires a `segment` object\n- a custom event requires a `custom_event` object\n- a `customer.loyalty.tier.joined`, `customer.loyalty.tier.left`, `customer.loyalty.tier.upgraded`, `customer.loyalty.tier.downgraded`, `customer.loyalty.tier.prolonged` requires a `loyalty_tier` object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_create_earning_rules" + }, + "examples": { + "Example": { + "value": [ + { + "event": "order.paid", + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "FIXED", + "points": "5" + }, + "source": { + "banner": "Order paid 5 points." + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Order paid - fixed amount of points" + } + }, + { + "event": "order.paid", + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_AMOUNT", + "order": { + "amount": { + "every": 1, + "points": 1 + } + } + }, + "source": { + "banner": "Order paid - 1 point for 1 dollar spent excluding discounts." + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Order paid- points proportional to order amount" + } + }, + { + "event": "order.paid", + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_TOTAL_AMOUNT", + "order": { + "total_amount": { + "every": 1, + "points": 1 + } + } + }, + "source": { + "banner": "Order paid - 1 point for 1 dollar spent including discounts." + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Order paid- points proportional to order total amount" + } + }, + { + "event": "order.paid", + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_METADATA", + "order": { + "metadata": { + "every": 2, + "points": 1, + "property": "number_of_store_visits" + } + } + }, + "source": { + "banner": "Order paid - 2 points for each store visit." + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Order paid- points proportional to numerical order metadata property " + } + }, + { + "event": "order.paid", + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_AMOUNT", + "order_items": { + "amount": { + "every": 2, + "points": 1, + "object": "product", + "id": "prod_0bae32322150fd0546" + } } + }, + "source": { + "banner": "Order paid - 2 points for 1 dollar spent on items excluding discounts." + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Order paid- points proportional to order items amount" } - } - } - }, - "400": { - "description": "Returns an error if a parameters is defined incorrectly.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_400_missing_param" + }, + { + "event": "order.paid", + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_SUBTOTAL_AMOUNT", + "order_items": { + "subtotal_amount": { + "every": 2, + "points": 1, + "object": "products_collection", + "id": "pc_75U0dHlr7u75BJodrW1AE3t6" + } + } + }, + "source": { + "banner": "Order paid - 2 points for every dollar spent on the product collection." + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" }, - "examples": { - "Example": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Loyalty order rules must contain one of the following properties - 'total_amount'", - "request_id": "v-0c127fa5d4424c8411" + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Order paid- points proportional to order items subtotal amount" + } + }, + { + "event": "order.paid", + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_QUANTITY", + "order_items": { + "quantity": { + "every": 1, + "points": 1, + "object": "sku", + "id": "sku_0b7d7dfb090be5c619" } } + }, + "source": { + "banner": "Order paid - 1 point for every brand phone in your cart." + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Order paid - points proportional to quantity of items in a cart of a product varient." } - } - } - }, - "404": { - "description": "Returns an error if a parameter's value is not found in the respository.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Example": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find loyalty_tier with id ltr_pudTGWasuIqxdiDM0go31OV1", - "request_id": "v-0c12808f33ce673c42", - "resource_id": "ltr_pudTGWasuIqxdiDM0go31OV1", - "resource_type": "loyalty_tier" + }, + { + "event": "order.paid", + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 1, + "points": 1, + "property": "customer_life_time_value" + } + } + }, + "source": { + "banner": "Order paid 1 point for 1 month of being a customer with us." + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Order paid - points proportional to customer metadata property" + } + }, + { + "event": "customer.segment.entered", + "segment": { + "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" + }, + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 1, + "points": 1, + "property": "customer_life_time_value" + } + } + }, + "source": { + "banner": "Customer entered birthday segment - 1 point for each month of being a customer with us." + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Entered segment - points proportional to customer metadata property" + } + }, + { + "event": "customer.segment.entered", + "segment": { + "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" + }, + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "FIXED", + "points": "5" + }, + "source": { + "banner": "Customer entered birthday segment - 5 points" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Entered segment - fixed points" + } + }, + { + "event": "page_view", + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "points": 3, + "type": "FIXED" + }, + "custom_event": { + "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" + }, + "source": { + "banner": "See page - 3 points" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Custom Event - fixed points for viewing a page" + } + }, + { + "event": "page_view", + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOM_EVENT_METADATA", + "custom_event": { + "metadata": { + "every": 1, + "points": 2, + "property": "volume_number" + } + } + }, + "custom_event": { + "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" + }, + "source": { + "banner": "See page X - get 2 points multiplied by the page number" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Custom Event - proportional points for viewing a page based on custom event metadata" + } + }, + { + "event": "page_view", + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 1, + "points": 2, + "property": "customer_life_time_value" + } + } + }, + "custom_event": { + "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" + }, + "source": { + "banner": "Get 2 points for every month you're a customer for viewing a page" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Custom Event - proportional points for viewing a page based on customer metadata" + } + }, + { + "event": "customer.loyalty.tier.prolonged", + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 1, + "points": 2, + "property": "customer_life_time_value" } } + }, + "loyalty_tier": { + "id": "ltr_pudTGWasuIqxdiDM0go31OV1" + }, + "source": { + "banner": "Get 2 points for every month you're a customer when your loyalty tier is prolonged." + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Custom Event - proportional points for extending a loyalty tier based on customer metadata." } } - } + ] } } } - }, - "/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_0dJG7cCAjquzcxWmZ634bA0C" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " - }, - { + } + }, + "responses": { + "200": { + "description": "Returns an array of earning rule objects.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "ern_CFuv1O0IDl8Jgph0ojhMu8bH" + "type": "array", + "items": { + "$ref": "#/components/schemas/8_obj_earning_rule_object" + } }, - "name": "earningRuleId", - "in": "path", - "required": true, - "description": "A unique earning rule ID." - } - ], - "get": { - "operationId": "get-earning-rule", - "tags": [ - "LOYALTIES API" - ], - "summary": "Get Earning Rule", - "description": "Retrieves an earning rule assigned to a campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns an earning rule object with the earning rule details.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoyaltiesGetEarningRuleResponseBody" - }, - "examples": { - "Custom Event": { - "value": { - "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", - "created_at": "2022-02-07T08:19:41.810Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 2, - "type": "FIXED" - }, - "custom_event": { - "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" - }, - "event": "saw_on_facebook", - "source": { - "banner": "Saw on Facebook Timeframe", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-07T08:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "object": "earning_rule", - "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" + "examples": { + "Example": { + "value": [ + { + "id": "ern_63g6NQgtepfXn2z0QbT2ksLf", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "points": 5, + "type": "FIXED" + }, + "event": "order.paid", + "source": { + "banner": "Order paid 5 points.", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_knM56LS3oygL0Ue0oeSNt4WA", + "metadata": { + "Type": "Order paid - fixed amount of points" + } + }, + { + "id": "ern_Ov5RWerVFubVSjIHOMco34dv", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_AMOUNT", + "order": { + "amount": { + "every": 1, + "points": 1 + } } }, - "Order Paid": { - "value": { - "id": "ern_taClaOIiaGNdmdby8xS0lCcy", - "created_at": "2022-02-04T13:27:50.665Z", - "updated_at": "2022-02-07T08:19:44.198Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "event": "order.paid", - "source": { - "banner": "Order paid 1000 points", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 4 - ], - "object": "earning_rule", - "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" + "event": "order.paid", + "source": { + "banner": "Order paid - 1 point for 1 dollar spent excluding discounts.", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_2R4x6pMFVEIPz1Lhz5ZVo33Y", + "metadata": { + "Type": "Order paid- points proportional to order amount" + } + }, + { + "id": "ern_5rWPz4arGlTv4FVc1vETeFfe", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_TOTAL_AMOUNT", + "order": { + "total_amount": { + "every": 1, + "points": 1 + } } }, - "Segment Entered": { - "value": { - "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", - "created_at": "2022-02-04T13:02:52.937Z", - "updated_at": "2022-02-07T08:19:43.291Z", - "validation_rule_id": null, - "loyalty": { - "points": 1000, - "type": "FIXED" - }, - "segment": { - "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" - }, - "event": "customer.segment.entered", - "source": { - "banner": "Entered segment 100 points.", - "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-02-02T13:00:00.000Z", - "expiration_date": "2022-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" + "event": "order.paid", + "source": { + "banner": "Order paid - 1 point for 1 dollar spent including discounts.", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_fXasfs6Eh7P2haZkI33PEumI", + "metadata": { + "Type": "Order paid- points proportional to order total amount" + } + }, + { + "id": "ern_Xs3o43dHr1O3RM5ojoeu1l6b", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_METADATA", + "order": { + "metadata": { + "every": 2, + "points": 1, + "property": "number_of_store_visits" + } } }, - "Loyalty Tier Joined": { - "value": { - "id": "ern_gVo6CHBduFPoh1hctASfXHLT", - "created_at": "2022-11-24T17:01:42.809Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 4, - "points": 4, - "property": "customer_life_time_value" - } - } - }, - "event": "customer.loyalty.tier.joined", - "loyalty_tier": { - "id": "ltr_pudTGWasuIqxdiDM0go31OV1" - }, - "source": { - "banner": "Tier joined", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_wdlEo17wmoqYHGfilbayEUj7", + "event": "order.paid", + "source": { + "banner": "Order paid - 2 points for each store visit.", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_jucMzF25jisrqiG3k6JyyviT", + "metadata": { + "Type": "Order paid- points proportional to numerical order metadata property " + } + }, + { + "id": "ern_9CjMBP2V8zgpsHLga4YOQo0A", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_AMOUNT", + "order_items": { + "amount": { + "every": 2, + "points": 1, + "object": "product", + "id": "prod_0bae32322150fd0546" + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid - 2 points for 1 dollar spent on items excluding discounts.", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_y60lx7XsW1YdOOOFuDaYjvG4", + "metadata": { + "Type": "Order paid- points proportional to order items amount" + } + }, + { + "id": "ern_uI7hRj8PNodK8xWRsn3gpDdG", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_SUBTOTAL_AMOUNT", + "order_items": { + "subtotal_amount": { + "every": 2, + "points": 1, + "object": "products_collection", + "id": "pc_75U0dHlr7u75BJodrW1AE3t6" + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid - 2 points for every dollar spent on the product collection.", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_Lk1WROGexXA72FabUWhR1p7X", + "metadata": { + "Type": "Order paid- points proportional to order items subtotal amount" + } + }, + { + "id": "ern_dL13AmZEO0ToImOY44YUP1ru", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_QUANTITY", + "order_items": { + "quantity": { + "every": 1, + "points": 1, + "object": "sku", + "id": "sku_0b7d7dfb090be5c619" + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid - 1 point for every brand phone in your cart.", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_4F9iJG0hmKTiqSsmkfbB8vUF", + "metadata": { + "Type": "Order paid - points proportional to quantity of items in a cart of a product varient." + } + }, + { + "id": "ern_ublD9yGhxPrd9ayPAMTc4aOZ", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { "metadata": { - "Type": "Tier joined - customer metadata - proportional" + "every": 1, + "points": 1, + "property": "customer_life_time_value" } } }, - "Loyalty Tier Left": { - "value": { - "id": "ern_66OdCyLADv5IGFoQe18vGUwa", - "created_at": "2022-11-24T17:03:59.414Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 2, - "points": 2, - "property": "customer_life_time_value" - } - } - }, - "event": "customer.loyalty.tier.left", - "loyalty_tier": { - "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2" - }, - "source": { - "banner": "Tier left", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_czm5el1Uz1jeGaO97AYoDNAq", + "event": "order.paid", + "source": { + "banner": "Order paid 1 point for 1 month of being a customer with us.", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_raft7C1hVw427OnEobmzhXjD", + "metadata": { + "Type": "Order paid - points proportional to customer metadata property" + } + }, + { + "id": "ern_6tBwufmR7UNJInhZq8zNRrj5", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { "metadata": { - "Type": "Tier left" + "every": 1, + "points": 1, + "property": "customer_life_time_value" } } }, - "Loyalty Tier Upgraded": { - "value": { - "id": "ern_YR3fDfCjAmz9a5D68nk0i4dm", - "created_at": "2022-11-25T07:29:38.961Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 3, - "points": 4, - "property": "customer_life_time_value" - } - } - }, - "event": "customer.loyalty.tier.upgraded", - "loyalty_tier": { - "id": "ltr_30KHciA0UG8B71Fo51GZqwgN" - }, - "source": { - "banner": "Tier upgraded", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_M1OdRH8spk6Fs7yTuPLN2LAv", + "segment": { + "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" + }, + "event": "customer.segment.entered", + "source": { + "banner": "Customer entered birthday segment - 1 point for each month of being a customer with us.", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_mQ8SCABGLnrGMBbh8QS6DUpX", + "metadata": { + "Type": "Entered segment - points proportional to customer metadata property" + } + }, + { + "id": "ern_yBR0JtdcDyJXgZf30C8KQLPw", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "points": 5, + "type": "FIXED" + }, + "segment": { + "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" + }, + "event": "customer.segment.entered", + "source": { + "banner": "Customer entered birthday segment - 5 points", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_Co7zjgYPIKZ45vcK0jn7qrY8", + "metadata": { + "Type": "Entered segment - fixed points" + } + }, + { + "id": "ern_Ic2AUznt4cJInIl1wt6n0Fbv", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "points": 3, + "type": "FIXED" + }, + "custom_event": { + "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" + }, + "event": "page_view", + "source": { + "banner": "See page - 3 points", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_KWvcBS3bdmJnWD4BTw29eRNT", + "metadata": { + "Type": "Custom Event - fixed points for viewing a page" + } + }, + { + "id": "ern_4SRj1TY1j8Q617R2Y4qiN1sy", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOM_EVENT_METADATA", + "custom_event": { "metadata": { - "Type": "Upgraded" + "every": 1, + "points": 2, + "property": "volume_number" } } }, - "Loyalty Tier Downgraded": { - "value": { - "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", - "created_at": "2022-11-25T07:31:05.866Z", - "updated_at": "2022-11-25T07:31:43.029Z", - "validation_rule_id": "val_kfmWpfXMI9P1", - "loyalty": { - "points": 1, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.downgraded", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Tier Downgraded", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", + "custom_event": { + "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" + }, + "event": "page_view", + "source": { + "banner": "See page X - get 2 points multiplied by the page number", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_WWESERcKoTRSbCDal7Hr7H0A", + "metadata": { + "Type": "Custom Event - proportional points for viewing a page based on custom event metadata" + } + }, + { + "id": "ern_WXBa4b5a6N5XZt9A9Nf9dagA", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { "metadata": { - "Type": "Tier" + "every": 1, + "points": 2, + "property": "customer_life_time_value" } } }, - "Loyalty Tier Prolonged": { - "value": { - "id": "ern_AdlWO2yt6b6llWsibIdiRXVE", - "created_at": "2022-11-25T07:31:42.767Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 5, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.prolonged", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Prolonged", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_4jH1yq9WJS0oJ8suagCrltyb", - "metadata": {} + "custom_event": { + "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" + }, + "event": "page_view", + "source": { + "banner": "Get 2 points for every month you're a customer for viewing a page", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_zv3mCOeZOaHCsFMG0yIKu0ax", + "metadata": { + "Type": "Custom Event - proportional points for viewing a page based on customer metadata" + } + }, + { + "id": "ern_DvdegDzcaMUXzf2fayzCqMEV", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": null, + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 1, + "points": 2, + "property": "customer_life_time_value" + } } + }, + "event": "customer.loyalty.tier.prolonged", + "loyalty_tier": { + "id": "ltr_pudTGWasuIqxdiDM0go31OV1" + }, + "source": { + "banner": "Get 2 points for every month you're a customer when your loyalty tier is prolonged.", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_fpfYyNcpVskgwcrs21kQ91Wx", + "metadata": { + "Type": "Custom Event - proportional points for extending a loyalty tier based on customer metadata." } } + ] + } + } + } + } + }, + "400": { + "description": "Returns an error if a parameters is defined incorrectly.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_400_missing_param" + }, + "examples": { + "Example": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Loyalty order rules must contain one of the following properties - 'total_amount'", + "request_id": "v-0c127fa5d4424c8411" } } } } - }, - "put": { - "operationId": "update-earning-rule", - "tags": [ - "LOYALTIES API" - ], - "summary": "Update Earning Rule", - "description": "Update an earning rule definition.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + } + }, + "404": { + "description": "Returns an error if a parameter's value is not found in the respository.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Example": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find loyalty_tier with id ltr_pudTGWasuIqxdiDM0go31OV1", + "request_id": "v-0c12808f33ce673c42", + "resource_id": "ltr_pudTGWasuIqxdiDM0go31OV1", + "resource_type": "loyalty_tier" + } + } } - ], - "requestBody": { - "description": "Specify the parameters that you would like to update for the given earning rule.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_update_earning_rule" - }, - "examples": { - "Example": { - "value": { - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "type": "FIXED", - "points": "5" - }, - "source": { - "banner": "Order paid 5 points." - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], + } + } + } + } + } + }, + "/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_0dJG7cCAjquzcxWmZ634bA0C" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " + }, + { + "schema": { + "type": "string", + "example": "ern_CFuv1O0IDl8Jgph0ojhMu8bH" + }, + "name": "earningRuleId", + "in": "path", + "required": true, + "description": "A unique earning rule ID." + } + ], + "get": { + "operationId": "get-earning-rule", + "tags": [ + "LOYALTIES API" + ], + "summary": "Get Earning Rule", + "description": "Retrieves an earning rule assigned to a campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns an earning rule object with the earning rule details.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltiesGetEarningRuleResponseBody" + }, + "examples": { + "Custom Event": { + "value": { + "id": "ern_abvbD0d7Wv4hgr3fTElLb38G", + "created_at": "2022-02-07T08:19:41.810Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 2, + "type": "FIXED" + }, + "custom_event": { + "schema_id": "ms_7JRYC8jXbezBV8AvGYGA0b5R" + }, + "event": "saw_on_facebook", + "source": { + "banner": "Saw on Facebook Timeframe", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-02-07T08:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "object": "earning_rule", + "automation_id": "auto_WTxNMXGJMS5ZdU9oZip3AzuA" + } + }, + "Order Paid": { + "value": { + "id": "ern_taClaOIiaGNdmdby8xS0lCcy", + "created_at": "2022-02-04T13:27:50.665Z", + "updated_at": "2022-02-07T08:19:44.198Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" + }, + "event": "order.paid", + "source": { + "banner": "Order paid 1000 points", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 4 + ], + "object": "earning_rule", + "automation_id": "auto_RjBuwpeFQZ7TyQ5LP2LFVZYG" + } + }, + "Segment Entered": { + "value": { + "id": "ern_3HlFKLMNIfBme9lcHwnMwXON", + "created_at": "2022-02-04T13:02:52.937Z", + "updated_at": "2022-02-07T08:19:43.291Z", + "validation_rule_id": null, + "loyalty": { + "points": 1000, + "type": "FIXED" + }, + "segment": { + "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt" + }, + "event": "customer.segment.entered", + "source": { + "banner": "Entered segment 100 points.", + "object_id": "camp_Pfja7X91b1GoyH5wnpzCwlP3", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-02-02T13:00:00.000Z", + "expiration_date": "2022-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_39wqQSScJJbvpzAF611jnrh9" + } + }, + "Loyalty Tier Joined": { + "value": { + "id": "ern_gVo6CHBduFPoh1hctASfXHLT", + "created_at": "2022-11-24T17:01:42.809Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { "metadata": { - "Type": "Order paid - fixed amount of points" + "every": 4, + "points": 4, + "property": "customer_life_time_value" } } + }, + "event": "customer.loyalty.tier.joined", + "loyalty_tier": { + "id": "ltr_pudTGWasuIqxdiDM0go31OV1" + }, + "source": { + "banner": "Tier joined", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_wdlEo17wmoqYHGfilbayEUj7", + "metadata": { + "Type": "Tier joined - customer metadata - proportional" } } - } - } - }, - "responses": { - "200": { - "description": "Returns the updated earning rule object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_obj_earning_rule_object" - }, - "examples": { - "Example": { - "value": { - "id": "ern_63g6NQgtepfXn2z0QbT2ksLf", - "created_at": "2022-11-29T11:10:46.523Z", - "updated_at": "2022-11-29T11:30:57.652Z", - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "points": 5, - "type": "FIXED" - }, - "event": "order.paid", - "source": { - "banner": "Order paid 5 points.", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-02T13:00:00.000Z", - "expiration_date": "2023-03-03T14:30:00.000Z", - "validity_timeframe": { - "duration": "PT1H", - "interval": "P1D" - }, - "validity_day_of_week": [ - 0, - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_knM56LS3oygL0Ue0oeSNt4WA", - "metadata": { - "Type": "Order paid - fixed amount of points" - } + }, + "Loyalty Tier Left": { + "value": { + "id": "ern_66OdCyLADv5IGFoQe18vGUwa", + "created_at": "2022-11-24T17:03:59.414Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 2, + "points": 2, + "property": "customer_life_time_value" } } + }, + "event": "customer.loyalty.tier.left", + "loyalty_tier": { + "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2" + }, + "source": { + "banner": "Tier left", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_czm5el1Uz1jeGaO97AYoDNAq", + "metadata": { + "Type": "Tier left" } } - } - } - } - }, - "delete": { - "operationId": "delete-earning-rule", - "tags": [ - "LOYALTIES API" - ], - "summary": "Delete Earning Rule", - "description": "This method deletes an earning rule for a specific loyalty campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." - }, - "404": { - "description": "Returns an error indicating that the loyalty campaign or earning rule with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Earning Rule Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find earning_rule with id ern_10S9ijStRZsf65xd12aydn4f", - "request_id": "v-0ae2bdc5f11027e81a", - "resource_id": "ern_10S9ijStRZsf65xd12aydn4f", - "resource_type": "earning_rule" - } - }, - "Loyalty Campaign Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id Summer Loyalty Campaign", - "request_id": "v-0ae2be04d146b71e50", - "resource_id": "Summer Loyalty Campaign", - "resource_type": "campaign" + }, + "Loyalty Tier Upgraded": { + "value": { + "id": "ern_YR3fDfCjAmz9a5D68nk0i4dm", + "created_at": "2022-11-25T07:29:38.961Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 3, + "points": 4, + "property": "customer_life_time_value" } } + }, + "event": "customer.loyalty.tier.upgraded", + "loyalty_tier": { + "id": "ltr_30KHciA0UG8B71Fo51GZqwgN" + }, + "source": { + "banner": "Tier upgraded", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_M1OdRH8spk6Fs7yTuPLN2LAv", + "metadata": { + "Type": "Upgraded" + } + } + }, + "Loyalty Tier Downgraded": { + "value": { + "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", + "created_at": "2022-11-25T07:31:05.866Z", + "updated_at": "2022-11-25T07:31:43.029Z", + "validation_rule_id": "val_kfmWpfXMI9P1", + "loyalty": { + "points": 1, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.downgraded", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Tier Downgraded", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", + "metadata": { + "Type": "Tier" } } + }, + "Loyalty Tier Prolonged": { + "value": { + "id": "ern_AdlWO2yt6b6llWsibIdiRXVE", + "created_at": "2022-11-25T07:31:42.767Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 5, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.prolonged", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Prolonged", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_4jH1yq9WJS0oJ8suagCrltyb", + "metadata": {} + } } } } } - }, - "/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/enable": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_fkZ28pe7DUAEmmabofkxHI8N" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID or name." + } + } + }, + "put": { + "operationId": "update-earning-rule", + "tags": [ + "LOYALTIES API" + ], + "summary": "Update Earning Rule", + "description": "Update an earning rule definition.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the parameters that you would like to update for the given earning rule.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_update_earning_rule" }, - { - "schema": { - "type": "string", - "example": "ern_A2RArBE30Tkt56utVLrRv7rZ" - }, - "name": "earningRuleId", - "in": "path", - "required": true, - "description": "Unique earning rule ID." - } - ], - "post": { - "operationId": "enable-earning-rule", - "tags": [ - "LOYALTIES API" - ], - "summary": "Enable Earning Rule", - "description": "Enable an earning rule.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns an earning rule object with the `active` parameter set to `true`.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoyaltiesEnableEarningRulesResponseBody" - }, - "examples": { - "Example": { - "value": { - "id": "ern_raVUcdXruvXGuzm682ESrAzt", - "created_at": "2022-11-24T09:03:14.534Z", - "updated_at": "2022-11-25T14:07:39.460Z", - "loyalty": { - "points": 20, - "type": "FIXED" - }, - "event": "order.paid", - "source": { - "banner": "Order has been paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-23T00:00:00.000Z", - "expiration_date": "2022-11-30T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_MbEIyLbn7pHyba5Qw5eeb35L", - "metadata": { - "Type": "Order has been paid - Fixed" - } - } - } - } + "examples": { + "Example": { + "value": { + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "type": "FIXED", + "points": "5" + }, + "source": { + "banner": "Order paid 5 points." + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "metadata": { + "Type": "Order paid - fixed amount of points" } } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns the updated earning rule object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_obj_earning_rule_object" }, - "404": { - "description": "Returns an error if the resource cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Example": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find earning_rule with id ern_raVUcdXruvXGuzm682ESrAz", - "request_id": "v-0c0d849dde0e6737d9", - "resource_id": "ern_raVUcdXruvXGuzm682ESrAz", - "resource_type": "earning_rule" - } - } + "examples": { + "Example": { + "value": { + "id": "ern_63g6NQgtepfXn2z0QbT2ksLf", + "created_at": "2022-11-29T11:10:46.523Z", + "updated_at": "2022-11-29T11:30:57.652Z", + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "points": 5, + "type": "FIXED" + }, + "event": "order.paid", + "source": { + "banner": "Order paid 5 points.", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-02T13:00:00.000Z", + "expiration_date": "2023-03-03T14:30:00.000Z", + "validity_timeframe": { + "duration": "PT1H", + "interval": "P1D" + }, + "validity_day_of_week": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_knM56LS3oygL0Ue0oeSNt4WA", + "metadata": { + "Type": "Order paid - fixed amount of points" } } } } } } + } + } + }, + "delete": { + "operationId": "delete-earning-rule", + "tags": [ + "LOYALTIES API" + ], + "summary": "Delete Earning Rule", + "description": "This method deletes an earning rule for a specific loyalty campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." }, - "/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_fkZ28pe7DUAEmmabofkxHI8N" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID or name." - }, - { + "404": { + "description": "Returns an error indicating that the loyalty campaign or earning rule with given ID was not found.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "ern_A2RArBE30Tkt56utVLrRv7rZ" - }, - "name": "earningRuleId", - "in": "path", - "required": true, - "description": "Unique earning rule ID." - } - ], - "post": { - "operationId": "disable-earning-rule", - "tags": [ - "LOYALTIES API" - ], - "summary": "Disable Earning Rule", - "description": "Disable an earning rule.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns an earning rule object with the `active` parameter set to `false`.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoyaltiesDisableEarningRulesResponseBody" - }, - "examples": { - "Example": { - "value": { - "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", - "created_at": "2022-11-25T07:31:05.866Z", - "updated_at": "2022-11-25T14:12:57.167Z", - "loyalty": { - "points": 1, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.downgraded", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Tier Downgraded", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": false, - "object": "earning_rule", - "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", - "metadata": { - "Type": "Tier" - } - } - } - } + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Earning Rule Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find earning_rule with id ern_10S9ijStRZsf65xd12aydn4f", + "request_id": "v-0ae2bdc5f11027e81a", + "resource_id": "ern_10S9ijStRZsf65xd12aydn4f", + "resource_type": "earning_rule" + } + }, + "Loyalty Campaign Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id Summer Loyalty Campaign", + "request_id": "v-0ae2be04d146b71e50", + "resource_id": "Summer Loyalty Campaign", + "resource_type": "campaign" } } - }, - "404": { - "description": "Returns an error if the resource cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find earning_rule with id ern_A2RArBE30Tkt56utVLrRv7r", - "request_id": "v-0c0d842ed5ce67373f", - "resource_id": "ern_A2RArBE30Tkt56utVLrRv7r", - "resource_type": "earning_rule" - } - } + } + } + } + } + } + } + }, + "/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/enable": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_fkZ28pe7DUAEmmabofkxHI8N" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID or name." + }, + { + "schema": { + "type": "string", + "example": "ern_A2RArBE30Tkt56utVLrRv7rZ" + }, + "name": "earningRuleId", + "in": "path", + "required": true, + "description": "Unique earning rule ID." + } + ], + "post": { + "operationId": "enable-earning-rule", + "tags": [ + "LOYALTIES API" + ], + "summary": "Enable Earning Rule", + "description": "Enable an earning rule.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns an earning rule object with the `active` parameter set to `true`.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltiesEnableEarningRulesResponseBody" + }, + "examples": { + "Example": { + "value": { + "id": "ern_raVUcdXruvXGuzm682ESrAzt", + "created_at": "2022-11-24T09:03:14.534Z", + "updated_at": "2022-11-25T14:07:39.460Z", + "loyalty": { + "points": 20, + "type": "FIXED" + }, + "event": "order.paid", + "source": { + "banner": "Order has been paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-23T00:00:00.000Z", + "expiration_date": "2022-11-30T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_MbEIyLbn7pHyba5Qw5eeb35L", + "metadata": { + "Type": "Order has been paid - Fixed" } } } @@ -71765,239 +71710,101 @@ } } }, - "/v1/loyalties/members/{memberId}/rewards": { - "parameters": [ - { + "404": { + "description": "Returns an error if the resource cannot be found.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "MmFAzfDe" + "$ref": "#/components/schemas/e_404_not_found" }, - "name": "memberId", - "in": "path", - "required": true, - "description": "Unique loyalty card assigned to a particular customer." - } - ], - "get": { - "operationId": "list-member-rewards", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Member Rewards", - "description": "Retrieves the list of rewards that the given customer (identified by `member_id`, which is a loyalty card assigned to a particular customer) **can get in exchange for loyalty points**. \n\nYou can use the `affordable_only` parameter to limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). \n\nPlease note that rewards that are disabled (i.e. set to `Not Available` in the Dashboard) for a given loyalty tier reward mapping will not be returned in this endpoint.", - "parameters": [ - { - "in": "query", - "name": "affordable_only", - "description": "Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to `true` to return rewards which the customer can actually afford.", - "schema": { - "type": "boolean" + "examples": { + "Example": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find earning_rule with id ern_raVUcdXruvXGuzm682ESrAz", + "request_id": "v-0c0d849dde0e6737d9", + "resource_id": "ern_raVUcdXruvXGuzm682ESrAz", + "resource_type": "earning_rule" + } } } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a list of rewards for the given `member_id`. Returns a filtered list if the query parameter `affordable_only` is set to `true`.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_list_member_rewards" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "reward": { - "id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", - "name": "Material Reward", - "type": "MATERIAL", - "parameters": { - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619" - } - }, - "stock": 4, - "redeemed": 1, - "attributes": { - "description": "Get a Comic Book in Archie's series." - }, - "created_at": "2022-08-17T07:46:18.619169+00:00", - "updated_at": "2022-08-17T08:13:48.30747+00:00", - "metadata": {}, - "object": "reward" - }, - "assignment": { - "id": "rewa_pJYQBXSitK2OVPK3XMXZK76X", - "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", - "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 39 - } - }, - "created_at": "2022-08-24T11:40:22.418972+00:00", - "updated_at": "2022-08-24T13:23:50.409121+00:00", - "object": "reward_assignment" - }, - "object": "loyalty_reward" - }, - { - "reward": { - "id": "rew_31M6Za6zkMRfhxYJz4aDo11h", - "name": "Pay with Points", - "type": "COIN", - "parameters": { - "coin": { - "exchange_ratio": 1, - "points_ratio": 1 - } - }, - "stock": null, - "redeemed": null, - "attributes": {}, - "created_at": "2022-06-23T11:06:06.222736+00:00", - "updated_at": null, - "metadata": null, - "object": "reward" - }, - "assignment": { - "id": "rewa_wrVYAfXWolq52gnl15dumPCq", - "reward_id": "rew_31M6Za6zkMRfhxYJz4aDo11h", - "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", - "related_object_type": "campaign", - "created_at": "2022-08-11T14:13:34.581194+00:00", - "updated_at": null, - "object": "reward_assignment" - }, - "object": "loyalty_reward" - }, - { - "reward": { - "id": "rew_Jhq0ecLGSx8eF4pFdlhFr9P6", - "name": "20% discount", - "type": "CAMPAIGN", - "parameters": { - "campaign": { - "id": "camp_4B1jDE63pCeSij3HU7gx3gPT", - "type": "DISCOUNT_COUPONS" - } - }, - "stock": null, - "redeemed": null, - "attributes": {}, - "created_at": "2022-08-11T09:52:39.032699+00:00", - "updated_at": null, - "metadata": {}, - "object": "reward" - }, - "assignment": { - "id": "rewa_nFREw86qh1LiqGPRygahNh8Z", - "reward_id": "rew_Jhq0ecLGSx8eF4pFdlhFr9P6", - "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 100 - } - }, - "created_at": "2022-08-11T14:13:34.581194+00:00", - "updated_at": null, - "object": "reward_assignment" - }, - "object": "loyalty_reward" - }, - { - "reward": { - "id": "rew_Dev2yQLodRV33UKPKHTUQWk1", - "name": "Get a product", - "type": "MATERIAL", - "parameters": { - "product": { - "id": "prod_0b2ac1dab28985cb1e", - "sku_id": null - } - }, - "stock": 1, - "redeemed": 1, - "attributes": { - "description": "Product" - }, - "created_at": "2022-06-13T10:43:15.929621+00:00", - "updated_at": "2022-08-11T15:59:30.820937+00:00", - "metadata": null, - "object": "reward" - }, - "assignment": { - "id": "rewa_SV4gMgPXTXDrsoTyqhY1B2ut", - "reward_id": "rew_Dev2yQLodRV33UKPKHTUQWk1", - "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 4000 - } - }, - "created_at": "2022-08-11T14:13:34.581194+00:00", - "updated_at": null, - "object": "reward_assignment" - }, - "object": "loyalty_reward" - }, - { - "reward": { - "id": "rew_oQEYtUNYcVe2IdBEUBdLfkCD", - "name": "Get a comic book", - "type": "MATERIAL", - "parameters": { - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "sku_id": null - } - }, - "stock": 1, - "redeemed": 2, - "attributes": { - "image_url": "https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_fPH9ohe0pZf4EiIt295sk9Ob.png", - "description": "Archie's Series" - }, - "created_at": "2022-08-11T14:35:44.694611+00:00", - "updated_at": "2022-08-17T07:52:56.965366+00:00", - "metadata": { - "Type": "GR-2" - }, - "object": "reward" - }, - "assignment": { - "id": "rewa_7HHH6TjN7Q9WDr5ZePeZUg5p", - "reward_id": "rew_oQEYtUNYcVe2IdBEUBdLfkCD", - "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 10 - } - }, - "created_at": "2022-08-11T15:44:12.789086+00:00", - "updated_at": null, - "object": "reward_assignment" - }, - "object": "loyalty_reward" - } - ], - "total": 5 - } - } + } + } + } + } + } + }, + "/v1/loyalties/{campaignId}/earning-rules/{earningRuleId}/disable": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_fkZ28pe7DUAEmmabofkxHI8N" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID or name." + }, + { + "schema": { + "type": "string", + "example": "ern_A2RArBE30Tkt56utVLrRv7rZ" + }, + "name": "earningRuleId", + "in": "path", + "required": true, + "description": "Unique earning rule ID." + } + ], + "post": { + "operationId": "disable-earning-rule", + "tags": [ + "LOYALTIES API" + ], + "summary": "Disable Earning Rule", + "description": "Disable an earning rule.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns an earning rule object with the `active` parameter set to `false`.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltiesDisableEarningRulesResponseBody" + }, + "examples": { + "Example": { + "value": { + "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", + "created_at": "2022-11-25T07:31:05.866Z", + "updated_at": "2022-11-25T14:12:57.167Z", + "loyalty": { + "points": 1, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.downgraded", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Tier Downgraded", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": false, + "object": "earning_rule", + "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", + "metadata": { + "Type": "Tier" } } } @@ -72005,76 +71812,121 @@ } } }, - "/v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " - }, - { + "404": { + "description": "Returns an error if the resource cannot be found.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "rewa_hzc19a5NLyIr2bVL3UB1w0B3" + "$ref": "#/components/schemas/e_404_not_found" }, - "name": "assignmentId", - "in": "path", - "required": true, - "description": "Unique reward assignment ID." - } - ], - "get": { - "operationId": "get-reward-details", - "tags": [ - "LOYALTIES API" - ], - "summary": "Get Reward Details", - "description": "Get reward details in the context of a loyalty campaign and reward assignment ID.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find earning_rule with id ern_A2RArBE30Tkt56utVLrRv7r", + "request_id": "v-0c0d842ed5ce67373f", + "resource_id": "ern_A2RArBE30Tkt56utVLrRv7r", + "resource_type": "earning_rule" + } + } } - ], - "responses": { - "200": { - "description": "Returns reward details in the context of a loyalty *campaign* and reward assignment ID.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoyaltiesGetRewardDetailsResponseBody" - }, - "examples": { - "Material": { - "value": { - "id": "rew_Dev2yQLodRV33UKPKHTUQWk1", - "name": "Get a product", + } + } + } + } + } + }, + "/v1/loyalties/members/{memberId}/rewards": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "MmFAzfDe" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "Unique loyalty card assigned to a particular customer." + } + ], + "get": { + "operationId": "list-member-rewards", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Member Rewards", + "description": "Retrieves the list of rewards that the given customer (identified by `member_id`, which is a loyalty card assigned to a particular customer) **can get in exchange for loyalty points**. \n\nYou can use the `affordable_only` parameter to limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). \n\nPlease note that rewards that are disabled (i.e. set to `Not Available` in the Dashboard) for a given loyalty tier reward mapping will not be returned in this endpoint.", + "parameters": [ + { + "in": "query", + "name": "affordable_only", + "description": "Limit the results to rewards that the customer can actually afford (only rewards whose price in points is not higher than the loyalty points balance on a loyalty card). Set this flag to `true` to return rewards which the customer can actually afford.", + "schema": { + "type": "boolean" + } + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of rewards for the given `member_id`. Returns a filtered list if the query parameter `affordable_only` is set to `true`.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_list_member_rewards" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "reward": { + "id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", + "name": "Material Reward", "type": "MATERIAL", "parameters": { "product": { - "id": "prod_0b2ac1dab28985cb1e", - "sku_id": null + "id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619" } }, - "stock": "1", - "redeemed": "1", + "stock": 4, + "redeemed": 1, "attributes": { - "description": "Product" + "description": "Get a Comic Book in Archie's series." }, - "created_at": "2022-06-13T10:43:15.929Z", - "updated_at": "2022-08-11T15:59:30.820Z", - "metadata": null, + "created_at": "2022-08-17T07:46:18.619169+00:00", + "updated_at": "2022-08-17T08:13:48.30747+00:00", + "metadata": {}, "object": "reward" - } + }, + "assignment": { + "id": "rewa_pJYQBXSitK2OVPK3XMXZK76X", + "reward_id": "rew_C7wS9eHFDN4CIbXI5PpLSkGY", + "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 39 + } + }, + "created_at": "2022-08-24T11:40:22.418972+00:00", + "updated_at": "2022-08-24T13:23:50.409121+00:00", + "object": "reward_assignment" + }, + "object": "loyalty_reward" }, - "Pay with Points": { - "value": { + { + "reward": { "id": "rew_31M6Za6zkMRfhxYJz4aDo11h", "name": "Pay with Points", "type": "COIN", @@ -72087,14 +71939,24 @@ "stock": null, "redeemed": null, "attributes": {}, - "created_at": "2022-06-23T11:06:06.222Z", + "created_at": "2022-06-23T11:06:06.222736+00:00", "updated_at": null, "metadata": null, "object": "reward" - } + }, + "assignment": { + "id": "rewa_wrVYAfXWolq52gnl15dumPCq", + "reward_id": "rew_31M6Za6zkMRfhxYJz4aDo11h", + "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", + "related_object_type": "campaign", + "created_at": "2022-08-11T14:13:34.581194+00:00", + "updated_at": null, + "object": "reward_assignment" + }, + "object": "loyalty_reward" }, - "Discount Coupon": { - "value": { + { + "reward": { "id": "rew_Jhq0ecLGSx8eF4pFdlhFr9P6", "name": "20% discount", "type": "CAMPAIGN", @@ -72107,2504 +71969,2335 @@ "stock": null, "redeemed": null, "attributes": {}, - "created_at": "2022-08-11T09:52:39.032Z", + "created_at": "2022-08-11T09:52:39.032699+00:00", "updated_at": null, "metadata": {}, "object": "reward" - } - } - } - } - } - } - } - } - }, - "/v1/loyalties/{campaignId}/reward-assignments": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " - } - ], - "get": { - "operationId": "list-reward-assignments-1", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Reward Assignments", - "description": "Returns reward assignments from a given loyalty campaign.\n\n> 📘 Alternative endpoint\n>\n> This endpoint is an alternative to this [endpoint](ref:list-reward-assignments-2). The URL was re-designed to be more ontextual to the type of data returned in the response.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "schema": { - "type": "string", - "example": "rewa_m9hEAu10KsPcLhGXiHG85aY0" - }, - "in": "query", - "name": "assignmentId", - "description": "A unique reward assignment ID." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary with reward assignment objects.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_list_reward_assignments" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "rewa_2EPffrq151ArmjR7j3CumxGE", - "reward_id": "rew_6uCtsIjgcuzi4NW43mKZQWd5", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 18 - } - }, - "created_at": "2022-06-22T11:02:19.564Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_75e6oBjYfIKUDbM4Dsgg6xAU", - "reward_id": "rew_gI4GYbXMeHAJUAIiZCad5LaS", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 25 - } - }, - "created_at": "2022-06-22T11:00:49.034Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_dJ5nFBpmL8DVhmY1j4zYYOqF", - "reward_id": "rew_VSi5rNvb67bn2tqkNwVBBP7u", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 100 - } - }, - "created_at": "2022-06-22T10:57:24.051Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_874iVl5bHrZFr2FSsG9ilKzF", - "reward_id": "rew_QQ73sIywuMoEj6L8K6ft2Mn7", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", - "related_object_type": "campaign", - "created_at": "2022-06-22T10:47:55.934Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_GgSlEk4bnR09lMMts6CgR6aV", - "reward_id": "rew_URQeO2fgbjxHnulgYVguuidX", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 9 - } - }, - "created_at": "2022-06-22T10:21:53.109Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_i6VcsXr3ovJ2JCpZk9k1JOj1", - "reward_id": "rew_YNr7tRr9TPAiFEJBZBAsuKCq", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", - "related_object_type": "campaign", - "created_at": "2022-06-22T10:18:27.684Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_YjTw2InYSVx1nA88brDASS9e", - "reward_id": "rew_BUfchmIo7pOR8GrZMw0vVL08", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 30 - } - }, - "created_at": "2022-06-22T09:58:12.133Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_1gJ6VyYQI0IcnEvhArbr9XFH", - "reward_id": "rew_injbwG52POgfpSogTlQl4hA6", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 10 - } - }, - "created_at": "2022-06-13T11:56:49.185Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_gb6U5byuRh12EvdiL46P4Cxy", - "reward_id": "rew_NQB7WbdQLBrFQW1DZmBNcLvH", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 100 - } - }, - "created_at": "2022-06-13T11:50:23.429Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_hfyF9IGez9i3z5a3Uwlkcg7S", - "reward_id": "rew_87ItIc9P5Bky10eS7vEm7Dc7", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 20 - } - }, - "created_at": "2022-06-13T11:20:43.961Z", - "updated_at": null, - "object": "reward_assignment" - } - ], - "total": 12 - } - } - } - } - } - } - } - } - }, - "/v1/loyalties/{campaignId}/rewards": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " - } - ], - "get": { - "operationId": "list-reward-assignments-2", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Reward Assignments", - "description": "Returns active rewards from a given loyalty campaign.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "schema": { - "type": "string", - "example": "rewa_m9hEAu10KsPcLhGXiHG85aY0" - }, - "in": "query", - "name": "assignment_id", - "description": "A unique reward assignment ID." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary with reward assignment objects.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_list_reward_assignments" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "rewa_6VSWcXjfm5PuZlfeuZxl5JZT", - "reward_id": "rew_pjJKIZgjIopIPZyibEAt7oPk", - "related_object_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "related_object_type": "campaign", - "created_at": "2022-08-30T08:24:32.171Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_7gFZsNg8oiry63FtzML0N52R", - "reward_id": "rew_BUfchmIo7pOR8GrZMw0vVL08", - "related_object_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 3000000 - } - }, - "created_at": "2022-05-13T11:14:58.146Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_eAGhQSY4FS4T3q4zMkiarHoN", - "reward_id": "rew_nIy4gHpQHle2c3pNMwuj7G6j", - "related_object_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 100 - } - }, - "created_at": "2022-02-28T11:56:55.241Z", - "updated_at": null, - "object": "reward_assignment" - } - ], - "total": 3 - } - } - } - } - } - } - } - }, - "post": { - "operationId": "create-reward-assignment-1", - "tags": [ - "LOYALTIES API" - ], - "summary": "Create Reward Assignment", - "description": "Add rewards to a loyalty campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a list of reward assignment objects.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_create_reward_assignment" - }, - "examples": { - "Example": { - "value": [ - { - "id": "rewa_Iw9VopmlLm0topBG17ZH1gp5", - "reward_id": "rew_wg2pvCr5LDhCq4uVQZ9LhuZm", - "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 2 - } - }, - "created_at": "2022-11-28T18:54:19.747Z", - "updated_at": null, - "object": "reward_assignment" - }, - { - "id": "rewa_tAFZ7cHiTwZyOg1QaWHt6yYv", - "reward_id": "rew_z35ffKoH0tCcck8EL56p6SIs", - "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 2 - } - }, - "created_at": "2022-11-28T18:54:19.747Z", - "updated_at": null, - "object": "reward_assignment" - } - ] - } - } - } - } - }, - "409": { - "description": "Returns an error if there's a reward assignment created for the given reward.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" - }, - "examples": { - "Example": { - "value": { - "code": 409, - "key": "duplicate_found", - "message": "Duplicated resource found", - "details": "Duplicated reward_assignment exists with id rewa_50O40FgyojhUiZAs3vDQbKiC", - "request_id": "v-0c11a10ed2ce676da9", - "resource_id": "rewa_50O40FgyojhUiZAs3vDQbKiC", - "resource_type": "reward_assignment" - } - } - } - } - } - } - }, - "requestBody": { - "description": "Define the cost of the rewards in loyalty points.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_create_reward_assignment" - }, - "examples": { - "Example": { - "value": [ - { - "reward": "rew_wg2pvCr5LDhCq4uVQZ9LhuZm", - "parameters": { - "loyalty": { - "points": 2 - } - } }, - { - "reward": "rew_z35ffKoH0tCcck8EL56p6SIs", + "assignment": { + "id": "rewa_nFREw86qh1LiqGPRygahNh8Z", + "reward_id": "rew_Jhq0ecLGSx8eF4pFdlhFr9P6", + "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", + "related_object_type": "campaign", "parameters": { "loyalty": { - "points": 2 + "points": 100 } - } - } - ] - } - } - } - } - } - } - }, - "/v1/loyalties/{campaignId}/reward-assignments/{assignmentId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " - }, - { - "schema": { - "type": "string", - "example": "rewa_hzc19a5NLyIr2bVL3UB1w0B3" - }, - "name": "assignmentId", - "in": "path", - "required": true, - "description": "Unique reward assignment ID." - } - ], - "get": { - "operationId": "get-reward-assignment-1", - "tags": [ - "LOYALTIES API" - ], - "summary": "Get Reward Assignment", - "description": "Retrieve specific reward assignment.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns specific reward assignment.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoyaltiesGetRewardAssignmentResponseBody" - }, - "examples": { - "Example": { - "value": { - "id": "rewa_1gJ6VyYQI0IcnEvhArbr9XFH", - "reward_id": "rew_injbwG52POgfpSogTlQl4hA6", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + }, + "created_at": "2022-08-11T14:13:34.581194+00:00", + "updated_at": null, + "object": "reward_assignment" + }, + "object": "loyalty_reward" + }, + { + "reward": { + "id": "rew_Dev2yQLodRV33UKPKHTUQWk1", + "name": "Get a product", + "type": "MATERIAL", + "parameters": { + "product": { + "id": "prod_0b2ac1dab28985cb1e", + "sku_id": null + } + }, + "stock": 1, + "redeemed": 1, + "attributes": { + "description": "Product" + }, + "created_at": "2022-06-13T10:43:15.929621+00:00", + "updated_at": "2022-08-11T15:59:30.820937+00:00", + "metadata": null, + "object": "reward" + }, + "assignment": { + "id": "rewa_SV4gMgPXTXDrsoTyqhY1B2ut", + "reward_id": "rew_Dev2yQLodRV33UKPKHTUQWk1", + "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", "related_object_type": "campaign", "parameters": { "loyalty": { - "points": 10 + "points": 4000 } }, - "created_at": "2022-06-13T11:56:49.185Z", + "created_at": "2022-08-11T14:13:34.581194+00:00", "updated_at": null, "object": "reward_assignment" - } - } - } - } - } - } - } - } - }, - "/v1/loyalties/{campaignId}/rewards/{assignmentId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_0dJG7cCAjquzcxWmZ634bA0C" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " - }, - { - "schema": { - "type": "string", - "example": "rewa_1gJ6VyYQI0IcnEvhArbr9XFH" - }, - "name": "assignmentId", - "in": "path", - "required": true, - "description": "A unique reward assignment ID." - } - ], - "get": { - "operationId": "get-reward-assignment-2", - "tags": [ - "LOYALTIES API" - ], - "summary": "Get Reward Assignment", - "description": "Retrieve specific reward assignment.\n\n> 📘 Alternative endpoint\n>\n> This endpoint is an alternative to this [endpoint](ref:get-reward-assignment-2). ", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns specific reward assignment.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" - }, - "examples": { - "Example": { - "value": { - "id": "rewa_1gJ6VyYQI0IcnEvhArbr9XFH", - "reward_id": "rew_injbwG52POgfpSogTlQl4hA6", - "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + }, + "object": "loyalty_reward" + }, + { + "reward": { + "id": "rew_oQEYtUNYcVe2IdBEUBdLfkCD", + "name": "Get a comic book", + "type": "MATERIAL", + "parameters": { + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "sku_id": null + } + }, + "stock": 1, + "redeemed": 2, + "attributes": { + "image_url": "https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_fPH9ohe0pZf4EiIt295sk9Ob.png", + "description": "Archie's Series" + }, + "created_at": "2022-08-11T14:35:44.694611+00:00", + "updated_at": "2022-08-17T07:52:56.965366+00:00", + "metadata": { + "Type": "GR-2" + }, + "object": "reward" + }, + "assignment": { + "id": "rewa_7HHH6TjN7Q9WDr5ZePeZUg5p", + "reward_id": "rew_oQEYtUNYcVe2IdBEUBdLfkCD", + "related_object_id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", "related_object_type": "campaign", "parameters": { "loyalty": { "points": 10 } }, - "created_at": "2022-06-13T11:56:49.185Z", + "created_at": "2022-08-11T15:44:12.789086+00:00", "updated_at": null, "object": "reward_assignment" - } - } - } - } - } - }, - "404": { - "description": "Returns an error if the reward assignment cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find reward_assignment with id rewa_1gJ6VyYQI0IcnEvhArbr9XFH", - "request_id": "v-0c0be6ee648e67609b", - "resource_id": "rewa_1gJ6VyYQI0IcnEvhArbr9XFH", - "resource_type": "reward_assignment" - } + }, + "object": "loyalty_reward" } - } + ], + "total": 5 } } } } - }, - "put": { - "operationId": "update-reward-assignment-1", - "tags": [ - "LOYALTIES API" - ], - "summary": "Update Reward Assignment", - "description": "Updates rewards parameters, i.e. the points cost for the specific reward.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a reward assignment with an updated points value.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/4_obj_reward_assignment_object" - }, - "examples": { - "Example": { - "value": { - "id": "rewa_Iw9VopmlLm0topBG17ZH1gp5", - "reward_id": "rew_wg2pvCr5LDhCq4uVQZ9LhuZm", - "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 3 - } - }, - "created_at": "2022-11-28T18:54:19.747Z", - "updated_at": "2022-11-28T19:27:40.604Z", - "object": "reward_assignment" - } + } + } + } + } + }, + "/v1/loyalties/{campaignId}/reward-assignments/{assignmentId}/reward": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " + }, + { + "schema": { + "type": "string", + "example": "rewa_hzc19a5NLyIr2bVL3UB1w0B3" + }, + "name": "assignmentId", + "in": "path", + "required": true, + "description": "Unique reward assignment ID." + } + ], + "get": { + "operationId": "get-reward-details", + "tags": [ + "LOYALTIES API" + ], + "summary": "Get Reward Details", + "description": "Get reward details in the context of a loyalty campaign and reward assignment ID.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns reward details in the context of a loyalty *campaign* and reward assignment ID.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltiesGetRewardDetailsResponseBody" + }, + "examples": { + "Material": { + "value": { + "id": "rew_Dev2yQLodRV33UKPKHTUQWk1", + "name": "Get a product", + "type": "MATERIAL", + "parameters": { + "product": { + "id": "prod_0b2ac1dab28985cb1e", + "sku_id": null } - } + }, + "stock": "1", + "redeemed": "1", + "attributes": { + "description": "Product" + }, + "created_at": "2022-06-13T10:43:15.929Z", + "updated_at": "2022-08-11T15:59:30.820Z", + "metadata": null, + "object": "reward" } - } - } - }, - "requestBody": { - "description": "Update the points cost for the reward assignment.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_update_reward_assignment" - }, - "examples": { - "Example": { - "value": { - "parameters": { - "loyalty": { - "points": 3 - } - } - } - } + }, + "Pay with Points": { + "value": { + "id": "rew_31M6Za6zkMRfhxYJz4aDo11h", + "name": "Pay with Points", + "type": "COIN", + "parameters": { + "coin": { + "exchange_ratio": 1, + "points_ratio": 1 + } + }, + "stock": null, + "redeemed": null, + "attributes": {}, + "created_at": "2022-06-23T11:06:06.222Z", + "updated_at": null, + "metadata": null, + "object": "reward" } - } - } - } - }, - "delete": { - "operationId": "delete-reward-assignment-1", - "tags": [ - "LOYALTIES API" - ], - "summary": "Delete Reward Assignment", - "description": "This method deletes a reward assignment for a particular loyalty campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." - }, - "404": { - "description": "Returns an error indicating that the loyalty campaign or reward assignment with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Reward Assignment Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find reward_assignment with id rewa_0b4hqJpVFssxXXrq56Ddtyo", - "request_id": "v-0ae2b69e0cd0c1364f", - "resource_id": "rewa_0b4hqJpVFssxXXrq56Ddtyo", - "resource_type": "reward_assignment" - } - }, - "Loyalty Campaign Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id Loyalty Summer Campaign", - "request_id": "v-0ae2b71e57d027e263", - "resource_id": "Loyalty Summer Campaign", - "resource_type": "campaign" - } + }, + "Discount Coupon": { + "value": { + "id": "rew_Jhq0ecLGSx8eF4pFdlhFr9P6", + "name": "20% discount", + "type": "CAMPAIGN", + "parameters": { + "campaign": { + "id": "camp_4B1jDE63pCeSij3HU7gx3gPT", + "type": "DISCOUNT_COUPONS" } - } + }, + "stock": null, + "redeemed": null, + "attributes": {}, + "created_at": "2022-08-11T09:52:39.032Z", + "updated_at": null, + "metadata": {}, + "object": "reward" } } } } } + } + } + } + }, + "/v1/loyalties/{campaignId}/reward-assignments": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" }, - "/v1/loyalties/{campaignId}/members/{memberId}/redemption": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID." - }, - { + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " + } + ], + "get": { + "operationId": "list-reward-assignments-1", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Reward Assignments", + "description": "Returns reward assignments from a given loyalty campaign.\n\n> 📘 Alternative endpoint\n>\n> This endpoint is an alternative to this [endpoint](ref:list-reward-assignments-2). The URL was re-designed to be more ontextual to the type of data returned in the response.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "example": "rewa_m9hEAu10KsPcLhGXiHG85aY0" + }, + "in": "query", + "name": "assignmentId", + "description": "A unique reward assignment ID." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with reward assignment objects.", + "content": { + "application/json": { "schema": { - "type": "string" - }, - "name": "memberId", - "in": "path", - "required": true, - "description": "A code that identifies the loyalty card." - } - ], - "post": { - "operationId": "redeem-reward-1", - "tags": [ - "LOYALTIES API" - ], - "summary": "Redeem Reward", - "description": "Exchange points from a loyalty card for a specified reward. This API method returns an assigned award in the response. It means that if a requesting customer gets a coupon code with a discount for the next order, that discount code will be visible in response as part of the reward object definition.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a redemption object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_redeem_reward" - }, - "examples": { - "Redeem Reward that adds points to a loyalty card": { - "value": { - "id": "r_0c6b3abbfe8e60a9dd", - "object": "redemption", - "date": "2023-02-06T09:07:55.514Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 1, - "result": "SUCCESS", - "order": null, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 8000, - "balance": 6887 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-11-10T06:28:59.970Z", - "updated_at": "2023-02-06T09:07:55.515Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "holder": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 9, - "redeemed_points": 1113, - "object": "list", - "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - } - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_BpytIepuSekuXXwb9qkLJfCU", - "voucher": { - "id": "v_pQZDYaH8LzoOvgh3234DqZQjGJgbPov6", - "code": "LOYALTY-CARD-zOR2sV9Q", - "campaign": "Loyalty Program", - "campaign_id": "camp_Hpt5hPTA8kSKRWGxBGw8Y0So", - "category": null, - "category_id": null, - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 1020, - "balance": 890 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/THRRj1QegAan0r5U+wRoHuFEA6FR7TrvZm8N+8cK7niF/8uAqFdVYTU1JD0/CdoSXlYqiGgz3PAFOGWFSJt8vkM50fcMtMNLsaudU+YrPDeT2HCB7o0Ts7h1FnbD85+0F7lwrbKmkGW6kub0mjCaRdJYS/axIAq4=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FTHRRj1QegAan0r5U%2BwRoHuFEA6FR7TrvZm8N%2B8cK7niF%2F8uAqFdVYTU1JD0%2FCdoSXlYqiGgz3PAFOGWFSJt8vkM50fcMtMNLsaudU%2BYrPDeT2HCB7o0Ts7h1FnbD85%2B0F7lwrbKmkGW6kub0mjCaRdJYS%2FaxIAq4%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+yREd0zRAfZY9uwtMZsl4eDd8+LeiKGVI5OzOQRpjhtV91IuEe7/SXEW8m4F2Llg2//yieX2zsP3UtWasWxw8ZkHMRSIdxfxzSdSj8ap0dI5xwKW4OE1Q6Sgsb+kZVfCKUHbwXCcd8y5a6xTpVIg97y74Ng1Vg2PY=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2ByREd0zRAfZY9uwtMZsl4eDd8%2BLeiKGVI5OzOQRpjhtV91IuEe7%2FSXEW8m4F2Llg2%2F%2FyieX2zsP3UtWasWxw8ZkHMRSIdxfxzSdSj8ap0dI5xwKW4OE1Q6Sgsb%2BkZVfCKUHbwXCcd8y5a6xTpVIg97y74Ng1Vg2PY%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-07-11T08:19:28.780Z", - "updated_at": "2023-01-25T15:44:33.500Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "redemption": { - "quantity": null, - "redeemed_quantity": 26, - "redeemed_points": 130, - "object": "list", - "url": "/v1/vouchers/LOYALTY-CARD-zOR2sV9Q/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/LOYALTY-CARD-zOR2sV9Q/publications?page=1&limit=10" - }, - "object": "voucher" - }, - "id": "rew_7ZM476Q77dH5KvHk4KzoRNvF", - "object": "reward", - "name": "Present on Loyalty Card", - "created_at": "2023-01-25T15:43:40.716Z", - "updated_at": null, - "parameters": { - "campaign": { - "id": "camp_Hpt5hPTA8kSKRWGxBGw8Y0So", - "balance": 20, - "type": "LOYALTY_PROGRAM" - } - }, - "type": "CAMPAIGN" - }, - "loyalty_card": { - "points": 1 + "$ref": "#/components/schemas/8_res_list_reward_assignments" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "rewa_2EPffrq151ArmjR7j3CumxGE", + "reward_id": "rew_6uCtsIjgcuzi4NW43mKZQWd5", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 18 } - } + }, + "created_at": "2022-06-22T11:02:19.564Z", + "updated_at": null, + "object": "reward_assignment" }, - "Redeem Reward that adds credits to a gift card": { - "value": { - "id": "r_0c6b3bedf3478a0167", - "object": "redemption", - "date": "2023-02-06T09:13:08.813Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 1, - "result": "SUCCESS", - "order": null, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 8000, - "balance": 6886 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-11-10T06:28:59.970Z", - "updated_at": "2023-02-06T09:13:08.814Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "holder": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 10, - "redeemed_points": 1114, - "object": "list", - "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - } - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_U554pL2BhDIDZOvZ8y9YQ9hA", - "voucher": { - "id": "v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk", - "code": "GIFT-CARD-xwc6X7Tk", - "campaign": "Gift Cards", - "campaign_id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "GIFT_VOUCHER", - "discount": null, - "gift": { - "amount": 59080, - "balance": 48780 - }, - "loyalty_card": null, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM/aTyHCYfr7kRWb2vv08WIgY/Tv53SJGW+k2keqfsTq/Ohb5shkCN3FTFsaI8gulTp616sEGn/JJoIInIoNkO9Vd1+AfrKiAjmirCmekE6cz2SVCyNAXs=", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM%2FaTyHCYfr7kRWb2vv08WIgY%2FTv53SJGW%2Bk2keqfsTq%2FOhb5shkCN3FTFsaI8gulTp616sEGn%2FJJoIInIoNkO9Vd1%2BAfrKiAjmirCmekE6cz2SVCyNAXs%3D" - }, - "barcode": { - "id": "U2FsdGVkX18vWc/qplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO/199U+zicnFNWqg/jF5ZCQW+6jO1q8=", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18vWc%2FqplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO%2F199U%2BzicnFNWqg%2FjF5ZCQW%2B6jO1q8%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-07-08T09:44:33.179Z", - "updated_at": "2023-01-25T14:42:25.214Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "redemption": { - "quantity": null, - "redeemed_quantity": 7, - "redeemed_amount": 10300, - "object": "list", - "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/publications?page=1&limit=10" - }, - "object": "voucher" - }, - "id": "rew_6bvM4vnaVdbPVQxYpuN37rhH", - "object": "reward", - "name": "Present Credits on Gift Card", - "created_at": "2023-01-25T14:41:31.858Z", - "updated_at": null, - "parameters": { - "campaign": { - "id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", - "balance": 4000, - "type": "GIFT_VOUCHERS" - } - }, - "type": "CAMPAIGN" - }, - "loyalty_card": { - "points": 1 + { + "id": "rewa_75e6oBjYfIKUDbM4Dsgg6xAU", + "reward_id": "rew_gI4GYbXMeHAJUAIiZCad5LaS", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 25 } - } + }, + "created_at": "2022-06-22T11:00:49.034Z", + "updated_at": null, + "object": "reward_assignment" }, - "Redeem Reward that gives a discount coupon": { - "value": { - "id": "r_0c6b3ca77e0e60b534", - "object": "redemption", - "date": "2023-02-06T09:16:18.808Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 2, - "result": "SUCCESS", - "order": null, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 8000, - "balance": 6884 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-11-10T06:28:59.970Z", - "updated_at": "2023-02-06T09:16:18.809Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "holder": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 11, - "redeemed_points": 1116, - "object": "list", - "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - } - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_0ZwLAHgeU9IrI2V1ofYRmW7g", - "voucher": { - "id": "v_a3Ba1neDwPa3rBE0HkDd0C7CbiehBulo", - "code": "HAPPY-ORDERctb", - "campaign": "$20 off the entire order", - "campaign_id": "camp_5h0wc453_4", - "category": null, - "category_id": "cat_0b688929a2476386a6", - "categories": [], - "type": "DISCOUNT_VOUCHER", - "discount": { - "type": "AMOUNT", - "amount_off": 2000, - "effect": "APPLY_TO_ORDER" - }, - "gift": null, - "loyalty_card": null, - "start_date": "2022-09-20T00:00:00.000Z", - "expiration_date": "2022-09-30T00:00:00.000Z", - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "7d646e7d-9b5a-40b6-a44e-6bae848e108e", - "url": "https://dl.voucherify.io/api/v1/assets/qr/7d646e7d-9b5a-40b6-a44e-6bae848e108e" - }, - "barcode": { - "id": "dfb3e48d-ce4f-4187-a114-483feb4ca88d", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/dfb3e48d-ce4f-4187-a114-483feb4ca88d" - } - }, - "is_referral_code": false, - "created_at": "2023-02-06T09:16:18.845Z", - "updated_at": null, - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "redemption": { - "quantity": null, - "redeemed_quantity": 0, - "object": "list", - "url": "/v1/vouchers/HAPPY-ORDERctb/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/HAPPY-ORDERctb/publications?page=1&limit=10" - }, - "object": "voucher" - }, - "id": "rew_MF4hKh1IKYgJkPjbcFbH94Ho", - "object": "reward", - "name": "Digital Present", - "created_at": "2023-01-25T12:16:44.557Z", - "updated_at": null, - "parameters": { - "campaign": { - "id": "camp_5h0wc453_4", - "type": "DISCOUNT_COUPONS" - } - }, - "type": "CAMPAIGN" - }, - "loyalty_card": { - "points": 2 + { + "id": "rewa_dJ5nFBpmL8DVhmY1j4zYYOqF", + "reward_id": "rew_VSi5rNvb67bn2tqkNwVBBP7u", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 100 } - } + }, + "created_at": "2022-06-22T10:57:24.051Z", + "updated_at": null, + "object": "reward_assignment" }, - "Redeem a Material reward of a SKU type": { - "value": { - "id": "r_0c6b3d1357878a0813", - "object": "redemption", - "date": "2023-02-06T09:18:09.246Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 6, - "result": "SUCCESS", - "order": null, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 8000, - "balance": 6878 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-11-10T06:28:59.970Z", - "updated_at": "2023-02-06T09:18:09.247Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "holder": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 12, - "redeemed_points": 1122, - "object": "list", - "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - } - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_gfpRNkOT0pwzF7P5tXWXOs4H", - "product": { - "id": "prod_5h0wc453_2", - "source_id": "jonah-nystrom-bourbon", - "name": "Johan & Nyström - Bourbon", - "price": null, - "attributes": [ - "categories", - "description", - "weight" - ], - "metadata": { - "company": "Johan & Nyström", - "showcase": true - }, - "image_url": null, - "created_at": "2021-12-01T08:00:49.418Z", - "updated_at": null, - "object": "product" - }, - "sku": { - "id": "sku_0a3efc9044dd121803", - "source_id": "jonah-nystrom-bourbon-250g", - "product_id": "prod_5h0wc453_2", - "sku": "250g", - "price": 1750, - "currency": null, - "attributes": { - "categories": "Coffee, Whole Bean", - "description": "Background for this blend comes from the longing for a real dark roasting of high-quality coffee beans. Although the beans are dark roasted, they keep their clear and intense aroma. This coffee has a smoky flavour with a slight hint of sweetness and loads of fruit notes. Thanks to the experience in the dark roasting of coffee, the beans still retain most of their aromas. Its aftertaste is clear and remains for a long time. This coffee is perfect for a Dripper, French Press, Moka coffee maker and the traditional espresso brewing method.", - "weight": 250 - }, - "image_url": null, - "metadata": {}, - "created_at": "2021-12-01T08:00:49.427Z", - "updated_at": null, - "object": "sku" - }, - "id": "rew_SfQCsap5R8UBTVbdMTRx10x8", - "object": "reward", - "name": "Present - SKU", - "created_at": "2023-01-25T12:10:16.060Z", - "updated_at": "2023-01-25T12:10:59.662Z", - "parameters": { - "product": { - "id": "prod_5h0wc453_2", - "sku_id": "sku_0a3efc9044dd121803" - } - }, - "type": "MATERIAL" - }, - "loyalty_card": { - "points": 6 + { + "id": "rewa_874iVl5bHrZFr2FSsG9ilKzF", + "reward_id": "rew_QQ73sIywuMoEj6L8K6ft2Mn7", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "created_at": "2022-06-22T10:47:55.934Z", + "updated_at": null, + "object": "reward_assignment" + }, + { + "id": "rewa_GgSlEk4bnR09lMMts6CgR6aV", + "reward_id": "rew_URQeO2fgbjxHnulgYVguuidX", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 9 } - } + }, + "created_at": "2022-06-22T10:21:53.109Z", + "updated_at": null, + "object": "reward_assignment" }, - "Redeem a Material Reward of a Product Type": { - "value": { - "id": "r_0c6b3d8c35546f8673", - "object": "redemption", - "date": "2023-02-06T09:20:13.013Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 4, - "result": "SUCCESS", - "order": null, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@voucherify.io", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 8000, - "balance": 6874 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-11-10T06:28:59.970Z", - "updated_at": "2023-02-06T09:20:13.014Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "holder": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 13, - "redeemed_points": 1126, - "object": "list", - "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - } - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@voucherify.io", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_LRx3Y1iHFWTt217NVrknkpi5", - "product": { - "id": "prod_0b2c2ddf35150b83bb", - "source_id": "97", - "name": "[Sample] Tiered Wire Basket", - "price": 11995, - "attributes": [], - "metadata": { - "source": "bigcommerce", - "bigcommerce_product_categories": [ - 21, - 23 - ] - }, - "image_url": null, - "created_at": "2022-06-03T13:36:16.084Z", - "updated_at": "2022-06-07T09:10:44.644Z", - "object": "product" - }, - "id": "rew_EPx1hCTpqzF0HW1z9NKckZH4", - "object": "reward", - "name": "Present", - "created_at": "2022-06-13T06:59:01.694Z", - "updated_at": "2023-02-03T15:04:14.102Z", - "parameters": { - "product": { - "id": "prod_0b2c2ddf35150b83bb", - "sku_id": null - } - }, - "type": "MATERIAL" - }, - "loyalty_card": { - "points": 4 + { + "id": "rewa_i6VcsXr3ovJ2JCpZk9k1JOj1", + "reward_id": "rew_YNr7tRr9TPAiFEJBZBAsuKCq", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "created_at": "2022-06-22T10:18:27.684Z", + "updated_at": null, + "object": "reward_assignment" + }, + { + "id": "rewa_YjTw2InYSVx1nA88brDASS9e", + "reward_id": "rew_BUfchmIo7pOR8GrZMw0vVL08", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 30 } - } + }, + "created_at": "2022-06-22T09:58:12.133Z", + "updated_at": null, + "object": "reward_assignment" }, - "Redeem Pay with Points Reward": { - "value": { - "id": "r_0c6b4142ecc78a21d0", - "object": "redemption", - "date": "2023-02-06T09:36:26.547Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 2300, - "result": "SUCCESS", - "order": { - "id": "ord_QBnrJlVWA2EEiZoKOptFROnp", - "source_id": null, - "created_at": "2023-02-06T09:36:26.503Z", - "updated_at": null, - "status": "PAID", - "amount": 45000, - "discount_amount": 45000, - "total_discount_amount": 45000, - "total_amount": 0, - "applied_discount_amount": 45000, - "total_applied_discount_amount": 45000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0c5d6689b39320059b", - "quantity": 1, - "product": { - "id": "prod_0c5d6689b39320059b", - "source_id": "prod_anJ03RZZq74z4v", - "name": "Apple iPhone 8" - } - }, - { - "object": "order_item", - "product_id": "prod_0b2c36568000039138", - "quantity": 2, - "amount": 45000, - "price": 22500, - "subtotal_amount": 45000, - "product": { - "id": "prod_0b2c36568000039138", - "source_id": "86", - "name": "[Sample] Able Brewing System", - "price": 22500 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c6b4142ecc78a21d0": { - "date": "2023-02-06T09:36:26.547Z", - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" - } - } - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 8000, - "balance": 4574 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-11-10T06:28:59.970Z", - "updated_at": "2023-02-06T09:36:26.548Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "holder": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 14, - "redeemed_points": 3426, - "object": "list", - "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - } - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", - "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "object": "reward", - "name": "100 = $20", - "created_at": "2022-11-10T06:28:39.582Z", - "updated_at": null, - "parameters": { - "coin": { - "exchange_ratio": 20, - "points_ratio": 100 - } - }, - "type": "COIN" - }, - "loyalty_card": { - "points": 2300 + { + "id": "rewa_1gJ6VyYQI0IcnEvhArbr9XFH", + "reward_id": "rew_injbwG52POgfpSogTlQl4hA6", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 10 + } + }, + "created_at": "2022-06-13T11:56:49.185Z", + "updated_at": null, + "object": "reward_assignment" + }, + { + "id": "rewa_gb6U5byuRh12EvdiL46P4Cxy", + "reward_id": "rew_NQB7WbdQLBrFQW1DZmBNcLvH", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 100 + } + }, + "created_at": "2022-06-13T11:50:23.429Z", + "updated_at": null, + "object": "reward_assignment" + }, + { + "id": "rewa_hfyF9IGez9i3z5a3Uwlkcg7S", + "reward_id": "rew_87ItIc9P5Bky10eS7vEm7Dc7", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 20 + } + }, + "created_at": "2022-06-13T11:20:43.961Z", + "updated_at": null, + "object": "reward_assignment" + } + ], + "total": 12 + } + } + } + } + } + } + } + } + }, + "/v1/loyalties/{campaignId}/rewards": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " + } + ], + "get": { + "operationId": "list-reward-assignments-2", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Reward Assignments", + "description": "Returns active rewards from a given loyalty campaign.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "example": "rewa_m9hEAu10KsPcLhGXiHG85aY0" + }, + "in": "query", + "name": "assignment_id", + "description": "A unique reward assignment ID." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with reward assignment objects.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_list_reward_assignments" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "rewa_6VSWcXjfm5PuZlfeuZxl5JZT", + "reward_id": "rew_pjJKIZgjIopIPZyibEAt7oPk", + "related_object_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "related_object_type": "campaign", + "created_at": "2022-08-30T08:24:32.171Z", + "updated_at": null, + "object": "reward_assignment" + }, + { + "id": "rewa_7gFZsNg8oiry63FtzML0N52R", + "reward_id": "rew_BUfchmIo7pOR8GrZMw0vVL08", + "related_object_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 3000000 } - } + }, + "created_at": "2022-05-13T11:14:58.146Z", + "updated_at": null, + "object": "reward_assignment" }, - "Redeem Pay with Points Reward with a specific amount of points": { - "value": { - "id": "r_0c6b423368146fa4bb", - "object": "redemption", - "date": "2023-02-06T09:40:32.800Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 100, - "result": "SUCCESS", - "order": { - "id": "ord_1L67XS8EYDDp5A4B3k62G2tr", - "source_id": null, - "created_at": "2023-02-06T09:40:32.784Z", - "updated_at": null, - "status": "PAID", - "amount": 45000, - "discount_amount": 2000, - "total_discount_amount": 2000, - "total_amount": 43000, - "applied_discount_amount": 2000, - "total_applied_discount_amount": 2000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0c5d6689b39320059b", - "quantity": 1, - "product": { - "id": "prod_0c5d6689b39320059b", - "source_id": "prod_anJ03RZZq74z4v", - "name": "Apple iPhone 8" - } - }, - { - "object": "order_item", - "product_id": "prod_0b2c36568000039138", - "quantity": 2, - "amount": 45000, - "price": 22500, - "subtotal_amount": 45000, - "product": { - "id": "prod_0b2c36568000039138", - "source_id": "86", - "name": "[Sample] Able Brewing System", - "price": 22500 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c6b423368146fa4bb": { - "date": "2023-02-06T09:40:32.800Z", - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" - } - } - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 8500, - "balance": 4974 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-11-10T06:28:59.970Z", - "updated_at": "2023-02-06T09:40:32.801Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "holder": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 15, - "redeemed_points": 3526, - "object": "list", - "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - } - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", - "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "object": "reward", - "name": "100 = $20", - "created_at": "2022-11-10T06:28:39.582Z", - "updated_at": null, - "parameters": { - "coin": { - "exchange_ratio": 20, - "points_ratio": 100 - } - }, - "type": "COIN" - }, - "loyalty_card": { + { + "id": "rewa_eAGhQSY4FS4T3q4zMkiarHoN", + "reward_id": "rew_nIy4gHpQHle2c3pNMwuj7G6j", + "related_object_id": "camp_7s3uXI44aKfIk5IhmeOPr6ic", + "related_object_type": "campaign", + "parameters": { + "loyalty": { "points": 100 } - } + }, + "created_at": "2022-02-28T11:56:55.241Z", + "updated_at": null, + "object": "reward_assignment" } - } + ], + "total": 3 } } + } + } + } + } + } + }, + "post": { + "operationId": "create-reward-assignment-1", + "tags": [ + "LOYALTIES API" + ], + "summary": "Create Reward Assignment", + "description": "Add rewards to a loyalty campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of reward assignment objects.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_create_reward_assignment" }, - "404": { - "description": "Returns an error if the campaign was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Campaign Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find campaign with id :campaignId", - "request_id": "v-0c6b39288084e3435a", - "resource_id": ":campaignId", - "resource_type": "campaign" + "examples": { + "Example": { + "value": [ + { + "id": "rewa_Iw9VopmlLm0topBG17ZH1gp5", + "reward_id": "rew_wg2pvCr5LDhCq4uVQZ9LhuZm", + "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 2 } - } + }, + "created_at": "2022-11-28T18:54:19.747Z", + "updated_at": null, + "object": "reward_assignment" + }, + { + "id": "rewa_tAFZ7cHiTwZyOg1QaWHt6yYv", + "reward_id": "rew_z35ffKoH0tCcck8EL56p6SIs", + "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 2 + } + }, + "created_at": "2022-11-28T18:54:19.747Z", + "updated_at": null, + "object": "reward_assignment" } + ] + } + } + } + } + }, + "409": { + "description": "Returns an error if there's a reward assignment created for the given reward.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_409_duplicate_found" + }, + "examples": { + "Example": { + "value": { + "code": 409, + "key": "duplicate_found", + "message": "Duplicated resource found", + "details": "Duplicated reward_assignment exists with id rewa_50O40FgyojhUiZAs3vDQbKiC", + "request_id": "v-0c11a10ed2ce676da9", + "resource_id": "rewa_50O40FgyojhUiZAs3vDQbKiC", + "resource_type": "reward_assignment" } } } + } + } + } + }, + "requestBody": { + "description": "Define the cost of the rewards in loyalty points.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_create_reward_assignment" }, - "requestBody": { - "description": "Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_redeem_reward" + "examples": { + "Example": { + "value": [ + { + "reward": "rew_wg2pvCr5LDhCq4uVQZ9LhuZm", + "parameters": { + "loyalty": { + "points": 2 + } + } }, - "examples": { - "Pay with Points": { - "value": { - "reward": { - "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "points": 100 - }, - "order": { - "items": [ - { - "product_id": "prod_0c5d6689b39320059b", - "quantity": "1" - }, - { - "product_id": "prod_0b2c36568000039138", - "quantity": "2" - } - ] - } + { + "reward": "rew_z35ffKoH0tCcck8EL56p6SIs", + "parameters": { + "loyalty": { + "points": 2 } } } + ] + } + } + } + } + } + } + }, + "/v1/loyalties/{campaignId}/reward-assignments/{assignmentId}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " + }, + { + "schema": { + "type": "string", + "example": "rewa_hzc19a5NLyIr2bVL3UB1w0B3" + }, + "name": "assignmentId", + "in": "path", + "required": true, + "description": "Unique reward assignment ID." + } + ], + "get": { + "operationId": "get-reward-assignment-1", + "tags": [ + "LOYALTIES API" + ], + "summary": "Get Reward Assignment", + "description": "Retrieve specific reward assignment.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns specific reward assignment.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltiesGetRewardAssignmentResponseBody" + }, + "examples": { + "Example": { + "value": { + "id": "rewa_1gJ6VyYQI0IcnEvhArbr9XFH", + "reward_id": "rew_injbwG52POgfpSogTlQl4hA6", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 10 + } + }, + "created_at": "2022-06-13T11:56:49.185Z", + "updated_at": null, + "object": "reward_assignment" + } } } } } + } + } + } + }, + "/v1/loyalties/{campaignId}/rewards/{assignmentId}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_0dJG7cCAjquzcxWmZ634bA0C" }, - "/v1/loyalties/members/{memberId}/redemption": { - "parameters": [ - { + "name": "campaignId", + "in": "path", + "required": true, + "description": "The campaign ID or name of the loyalty campaign. You can either pass the campaign ID, which was assigned by Voucherify, or the `name` of the campaign as the path parameter value, e.g., `Loyalty%20Campaign`. " + }, + { + "schema": { + "type": "string", + "example": "rewa_1gJ6VyYQI0IcnEvhArbr9XFH" + }, + "name": "assignmentId", + "in": "path", + "required": true, + "description": "A unique reward assignment ID." + } + ], + "get": { + "operationId": "get-reward-assignment-2", + "tags": [ + "LOYALTIES API" + ], + "summary": "Get Reward Assignment", + "description": "Retrieve specific reward assignment.\n\n> 📘 Alternative endpoint\n>\n> This endpoint is an alternative to this [endpoint](ref:get-reward-assignment-2). ", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns specific reward assignment.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "MmFAzfDe" + "$ref": "#/components/schemas/4_obj_reward_assignment_object" }, - "name": "memberId", - "in": "path", - "required": true, - "description": "Unique loyalty card assigned to a particular customer." + "examples": { + "Example": { + "value": { + "id": "rewa_1gJ6VyYQI0IcnEvhArbr9XFH", + "reward_id": "rew_injbwG52POgfpSogTlQl4hA6", + "related_object_id": "camp_Vr97XXNOnFEUIMFymKK99FAA", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 10 + } + }, + "created_at": "2022-06-13T11:56:49.185Z", + "updated_at": null, + "object": "reward_assignment" + } + } + } } - ], - "post": { - "operationId": "redeem-reward", - "tags": [ - "LOYALTIES API" - ], - "summary": "Redeem Reward", - "description": "\n> 📘 Alternative endpoint\n>\n> This endpoint is an alternative to this [endpoint](ref:redeem-reward-1). The URL was re-designed to allow you to redeem a reward without having to provide the `campaignId` as a path parameter.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + } + }, + "404": { + "description": "Returns an error if the reward assignment cannot be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find reward_assignment with id rewa_1gJ6VyYQI0IcnEvhArbr9XFH", + "request_id": "v-0c0be6ee648e67609b", + "resource_id": "rewa_1gJ6VyYQI0IcnEvhArbr9XFH", + "resource_type": "reward_assignment" + } + } } - ], - "responses": { - "200": { - "description": "Returns a redemption object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_redeem_reward" - }, - "examples": { - "Redeem Pay with Points Reward with a specific number of Points": { - "value": { - "id": "r_0c6b4bf721439bf02b", - "object": "redemption", - "date": "2023-02-06T10:23:12.517Z", - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", - "metadata": null, - "amount": 100, - "result": "SUCCESS", - "order": { - "id": "ord_71Ayjxq2gFV80v3OP3qrxh37", - "source_id": null, - "created_at": "2023-02-06T10:23:12.485Z", - "updated_at": null, - "status": "PAID", - "amount": 45000, - "discount_amount": 2000, - "total_discount_amount": 2000, - "total_amount": 43000, - "applied_discount_amount": 2000, - "total_applied_discount_amount": 2000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0c5d6689b39320059b", - "quantity": 1, - "product": { - "id": "prod_0c5d6689b39320059b", - "source_id": "prod_anJ03RZZq74z4v", - "name": "Apple iPhone 8" - } - }, - { - "object": "order_item", - "product_id": "prod_0b2c36568000039138", - "quantity": 2, - "amount": 45000, - "price": 22500, - "subtotal_amount": 45000, - "product": { - "id": "prod_0b2c36568000039138", - "source_id": "86", - "name": "[Sample] Able Brewing System", - "price": 22500 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "object": "customer" - }, - "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0c6b4bf721439bf02b": { - "date": "2023-02-06T10:23:12.517Z", - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" - } - } - }, - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "related_object_type": "voucher", - "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "voucher": { - "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", - "code": "AnsvocvP", - "campaign": "Loyalty Campaign - Test Points", - "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", - "category": null, - "category_id": "cat_0bb81a481615a37b5e", - "categories": [], - "type": "LOYALTY_CARD", - "discount": null, - "gift": null, - "loyalty_card": { - "points": 9000, - "balance": 5374 - }, - "start_date": null, - "expiration_date": null, - "validity_timeframe": null, - "validity_day_of_week": null, - "active": true, - "additional_info": null, - "metadata": {}, - "assets": { - "qr": { - "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", - "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" - }, - "barcode": { - "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", - "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" - } - }, - "is_referral_code": false, - "created_at": "2022-11-10T06:28:59.970Z", - "updated_at": "2023-02-06T10:23:12.517Z", - "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "holder": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "validation_rules_assignments": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - }, - "redemption": { - "quantity": null, - "redeemed_quantity": 16, - "redeemed_points": 3626, - "object": "list", - "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" - }, - "publish": { - "object": "list", - "count": 1, - "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" - }, - "object": "voucher", - "applicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - }, - "inapplicable_to": { - "data": [], - "total": 0, - "data_ref": "data", - "object": "list" - } - }, - "reward": { - "customer": { - "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", - "name": "Bob Jones", - "email": "bob.jones@email.com", - "source_id": "36_bob", - "metadata": { - "age": 26, - "favorite_brands": [ - "Nike", - "Adidas", - "Reebok" - ], - "accepts_marketing": false, - "acquisition_channel": "Facebook" - }, - "object": "customer" - }, - "assignment_id": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", - "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "object": "reward", - "name": "100 = $20", - "created_at": "2022-11-10T06:28:39.582Z", - "updated_at": null, - "parameters": { - "coin": { - "exchange_ratio": 20, - "points_ratio": 100 - } - }, - "type": "COIN" - }, - "loyalty_card": { - "points": 100 + } + } + } + } + }, + "put": { + "operationId": "update-reward-assignment-1", + "tags": [ + "LOYALTIES API" + ], + "summary": "Update Reward Assignment", + "description": "Updates rewards parameters, i.e. the points cost for the specific reward.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a reward assignment with an updated points value.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/4_obj_reward_assignment_object" + }, + "examples": { + "Example": { + "value": { + "id": "rewa_Iw9VopmlLm0topBG17ZH1gp5", + "reward_id": "rew_wg2pvCr5LDhCq4uVQZ9LhuZm", + "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 3 + } + }, + "created_at": "2022-11-28T18:54:19.747Z", + "updated_at": "2022-11-28T19:27:40.604Z", + "object": "reward_assignment" + } + } + } + } + } + } + }, + "requestBody": { + "description": "Update the points cost for the reward assignment.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_update_reward_assignment" + }, + "examples": { + "Example": { + "value": { + "parameters": { + "loyalty": { + "points": 3 + } + } + } + } + } + } + } + } + }, + "delete": { + "operationId": "delete-reward-assignment-1", + "tags": [ + "LOYALTIES API" + ], + "summary": "Delete Reward Assignment", + "description": "This method deletes a reward assignment for a particular loyalty campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." + }, + "404": { + "description": "Returns an error indicating that the loyalty campaign or reward assignment with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Reward Assignment Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find reward_assignment with id rewa_0b4hqJpVFssxXXrq56Ddtyo", + "request_id": "v-0ae2b69e0cd0c1364f", + "resource_id": "rewa_0b4hqJpVFssxXXrq56Ddtyo", + "resource_type": "reward_assignment" + } + }, + "Loyalty Campaign Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id Loyalty Summer Campaign", + "request_id": "v-0ae2b71e57d027e263", + "resource_id": "Loyalty Summer Campaign", + "resource_type": "campaign" + } + } + } + } + } + } + } + } + }, + "/v1/loyalties/{campaignId}/members/{memberId}/redemption": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID." + }, + { + "schema": { + "type": "string" + }, + "name": "memberId", + "in": "path", + "required": true, + "description": "A code that identifies the loyalty card." + } + ], + "post": { + "operationId": "redeem-reward-1", + "tags": [ + "LOYALTIES API" + ], + "summary": "Redeem Reward", + "description": "Exchange points from a loyalty card for a specified reward. This API method returns an assigned award in the response. It means that if a requesting customer gets a coupon code with a discount for the next order, that discount code will be visible in response as part of the reward object definition.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a redemption object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_redeem_reward" + }, + "examples": { + "Redeem Reward that adds points to a loyalty card": { + "value": { + "id": "r_0c6b3abbfe8e60a9dd", + "object": "redemption", + "date": "2023-02-06T09:07:55.514Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 1, + "result": "SUCCESS", + "order": null, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 8000, + "balance": 6887 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-11-10T06:28:59.970Z", + "updated_at": "2023-02-06T09:07:55.515Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "holder": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 9, + "redeemed_points": 1113, + "object": "list", + "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + } + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_BpytIepuSekuXXwb9qkLJfCU", + "voucher": { + "id": "v_pQZDYaH8LzoOvgh3234DqZQjGJgbPov6", + "code": "LOYALTY-CARD-zOR2sV9Q", + "campaign": "Loyalty Program", + "campaign_id": "camp_Hpt5hPTA8kSKRWGxBGw8Y0So", + "category": null, + "category_id": null, + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 1020, + "balance": 890 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/THRRj1QegAan0r5U+wRoHuFEA6FR7TrvZm8N+8cK7niF/8uAqFdVYTU1JD0/CdoSXlYqiGgz3PAFOGWFSJt8vkM50fcMtMNLsaudU+YrPDeT2HCB7o0Ts7h1FnbD85+0F7lwrbKmkGW6kub0mjCaRdJYS/axIAq4=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FTHRRj1QegAan0r5U%2BwRoHuFEA6FR7TrvZm8N%2B8cK7niF%2F8uAqFdVYTU1JD0%2FCdoSXlYqiGgz3PAFOGWFSJt8vkM50fcMtMNLsaudU%2BYrPDeT2HCB7o0Ts7h1FnbD85%2B0F7lwrbKmkGW6kub0mjCaRdJYS%2FaxIAq4%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+yREd0zRAfZY9uwtMZsl4eDd8+LeiKGVI5OzOQRpjhtV91IuEe7/SXEW8m4F2Llg2//yieX2zsP3UtWasWxw8ZkHMRSIdxfxzSdSj8ap0dI5xwKW4OE1Q6Sgsb+kZVfCKUHbwXCcd8y5a6xTpVIg97y74Ng1Vg2PY=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2ByREd0zRAfZY9uwtMZsl4eDd8%2BLeiKGVI5OzOQRpjhtV91IuEe7%2FSXEW8m4F2Llg2%2F%2FyieX2zsP3UtWasWxw8ZkHMRSIdxfxzSdSj8ap0dI5xwKW4OE1Q6Sgsb%2BkZVfCKUHbwXCcd8y5a6xTpVIg97y74Ng1Vg2PY%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-07-11T08:19:28.780Z", + "updated_at": "2023-01-25T15:44:33.500Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "redemption": { + "quantity": null, + "redeemed_quantity": 26, + "redeemed_points": 130, + "object": "list", + "url": "/v1/vouchers/LOYALTY-CARD-zOR2sV9Q/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/LOYALTY-CARD-zOR2sV9Q/publications?page=1&limit=10" + }, + "object": "voucher" + }, + "id": "rew_7ZM476Q77dH5KvHk4KzoRNvF", + "object": "reward", + "name": "Present on Loyalty Card", + "created_at": "2023-01-25T15:43:40.716Z", + "updated_at": null, + "parameters": { + "campaign": { + "id": "camp_Hpt5hPTA8kSKRWGxBGw8Y0So", + "balance": 20, + "type": "LOYALTY_PROGRAM" + } + }, + "type": "CAMPAIGN" + }, + "loyalty_card": { + "points": 1 + } + } + }, + "Redeem Reward that adds credits to a gift card": { + "value": { + "id": "r_0c6b3bedf3478a0167", + "object": "redemption", + "date": "2023-02-06T09:13:08.813Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 1, + "result": "SUCCESS", + "order": null, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 8000, + "balance": 6886 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-11-10T06:28:59.970Z", + "updated_at": "2023-02-06T09:13:08.814Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "holder": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 10, + "redeemed_points": 1114, + "object": "list", + "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + } + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_U554pL2BhDIDZOvZ8y9YQ9hA", + "voucher": { + "id": "v_hS8JFl8S6lNcd1L69wLIoXgTio7eWEgk", + "code": "GIFT-CARD-xwc6X7Tk", + "campaign": "Gift Cards", + "campaign_id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "GIFT_VOUCHER", + "discount": null, + "gift": { + "amount": 59080, + "balance": 48780 + }, + "loyalty_card": null, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM/aTyHCYfr7kRWb2vv08WIgY/Tv53SJGW+k2keqfsTq/Ohb5shkCN3FTFsaI8gulTp616sEGn/JJoIInIoNkO9Vd1+AfrKiAjmirCmekE6cz2SVCyNAXs=", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX19SdT2kQZokSFsMRa5NmGvsHunHReeb4gF9b5LtLA4rCTM%2FaTyHCYfr7kRWb2vv08WIgY%2FTv53SJGW%2Bk2keqfsTq%2FOhb5shkCN3FTFsaI8gulTp616sEGn%2FJJoIInIoNkO9Vd1%2BAfrKiAjmirCmekE6cz2SVCyNAXs%3D" + }, + "barcode": { + "id": "U2FsdGVkX18vWc/qplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO/199U+zicnFNWqg/jF5ZCQW+6jO1q8=", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX18vWc%2FqplwajJz4RIIy2wDUcAXVo1KEmyXx2IJy44xxHg608po3RizU9OYOzKelOAEjXFf7E4BS5Q01s4dds8Du70LGAp3idYMKAaXIjMTcFjMNczNO6ULK7r4eDx2Np8jvO%2F199U%2BzicnFNWqg%2FjF5ZCQW%2B6jO1q8%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-07-08T09:44:33.179Z", + "updated_at": "2023-01-25T14:42:25.214Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "redemption": { + "quantity": null, + "redeemed_quantity": 7, + "redeemed_amount": 10300, + "object": "list", + "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/GIFT-CARD-xwc6X7Tk/publications?page=1&limit=10" + }, + "object": "voucher" + }, + "id": "rew_6bvM4vnaVdbPVQxYpuN37rhH", + "object": "reward", + "name": "Present Credits on Gift Card", + "created_at": "2023-01-25T14:41:31.858Z", + "updated_at": null, + "parameters": { + "campaign": { + "id": "camp_kdxp3vf1clQ9CFs1jpqv3tZe", + "balance": 4000, + "type": "GIFT_VOUCHERS" + } + }, + "type": "CAMPAIGN" + }, + "loyalty_card": { + "points": 1 + } + } + }, + "Redeem Reward that gives a discount coupon": { + "value": { + "id": "r_0c6b3ca77e0e60b534", + "object": "redemption", + "date": "2023-02-06T09:16:18.808Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 2, + "result": "SUCCESS", + "order": null, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 8000, + "balance": 6884 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-11-10T06:28:59.970Z", + "updated_at": "2023-02-06T09:16:18.809Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "holder": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 11, + "redeemed_points": 1116, + "object": "list", + "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + } + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_0ZwLAHgeU9IrI2V1ofYRmW7g", + "voucher": { + "id": "v_a3Ba1neDwPa3rBE0HkDd0C7CbiehBulo", + "code": "HAPPY-ORDERctb", + "campaign": "$20 off the entire order", + "campaign_id": "camp_5h0wc453_4", + "category": null, + "category_id": "cat_0b688929a2476386a6", + "categories": [], + "type": "DISCOUNT_VOUCHER", + "discount": { + "type": "AMOUNT", + "amount_off": 2000, + "effect": "APPLY_TO_ORDER" + }, + "gift": null, + "loyalty_card": null, + "start_date": "2022-09-20T00:00:00.000Z", + "expiration_date": "2022-09-30T00:00:00.000Z", + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "7d646e7d-9b5a-40b6-a44e-6bae848e108e", + "url": "https://dl.voucherify.io/api/v1/assets/qr/7d646e7d-9b5a-40b6-a44e-6bae848e108e" + }, + "barcode": { + "id": "dfb3e48d-ce4f-4187-a114-483feb4ca88d", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/dfb3e48d-ce4f-4187-a114-483feb4ca88d" + } + }, + "is_referral_code": false, + "created_at": "2023-02-06T09:16:18.845Z", + "updated_at": null, + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "redemption": { + "quantity": null, + "redeemed_quantity": 0, + "object": "list", + "url": "/v1/vouchers/HAPPY-ORDERctb/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/HAPPY-ORDERctb/publications?page=1&limit=10" + }, + "object": "voucher" + }, + "id": "rew_MF4hKh1IKYgJkPjbcFbH94Ho", + "object": "reward", + "name": "Digital Present", + "created_at": "2023-01-25T12:16:44.557Z", + "updated_at": null, + "parameters": { + "campaign": { + "id": "camp_5h0wc453_4", + "type": "DISCOUNT_COUPONS" + } + }, + "type": "CAMPAIGN" + }, + "loyalty_card": { + "points": 2 + } + } + }, + "Redeem a Material reward of a SKU type": { + "value": { + "id": "r_0c6b3d1357878a0813", + "object": "redemption", + "date": "2023-02-06T09:18:09.246Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 6, + "result": "SUCCESS", + "order": null, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 8000, + "balance": 6878 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-11-10T06:28:59.970Z", + "updated_at": "2023-02-06T09:18:09.247Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "holder": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 12, + "redeemed_points": 1122, + "object": "list", + "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + } + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_gfpRNkOT0pwzF7P5tXWXOs4H", + "product": { + "id": "prod_5h0wc453_2", + "source_id": "jonah-nystrom-bourbon", + "name": "Johan & Nyström - Bourbon", + "price": null, + "attributes": [ + "categories", + "description", + "weight" + ], + "metadata": { + "company": "Johan & Nyström", + "showcase": true + }, + "image_url": null, + "created_at": "2021-12-01T08:00:49.418Z", + "updated_at": null, + "object": "product" + }, + "sku": { + "id": "sku_0a3efc9044dd121803", + "source_id": "jonah-nystrom-bourbon-250g", + "product_id": "prod_5h0wc453_2", + "sku": "250g", + "price": 1750, + "currency": null, + "attributes": { + "categories": "Coffee, Whole Bean", + "description": "Background for this blend comes from the longing for a real dark roasting of high-quality coffee beans. Although the beans are dark roasted, they keep their clear and intense aroma. This coffee has a smoky flavour with a slight hint of sweetness and loads of fruit notes. Thanks to the experience in the dark roasting of coffee, the beans still retain most of their aromas. Its aftertaste is clear and remains for a long time. This coffee is perfect for a Dripper, French Press, Moka coffee maker and the traditional espresso brewing method.", + "weight": 250 + }, + "image_url": null, + "metadata": {}, + "created_at": "2021-12-01T08:00:49.427Z", + "updated_at": null, + "object": "sku" + }, + "id": "rew_SfQCsap5R8UBTVbdMTRx10x8", + "object": "reward", + "name": "Present - SKU", + "created_at": "2023-01-25T12:10:16.060Z", + "updated_at": "2023-01-25T12:10:59.662Z", + "parameters": { + "product": { + "id": "prod_5h0wc453_2", + "sku_id": "sku_0a3efc9044dd121803" + } + }, + "type": "MATERIAL" + }, + "loyalty_card": { + "points": 6 + } + } + }, + "Redeem a Material Reward of a Product Type": { + "value": { + "id": "r_0c6b3d8c35546f8673", + "object": "redemption", + "date": "2023-02-06T09:20:13.013Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 4, + "result": "SUCCESS", + "order": null, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@voucherify.io", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 8000, + "balance": 6874 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-11-10T06:28:59.970Z", + "updated_at": "2023-02-06T09:20:13.014Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "holder": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 13, + "redeemed_points": 1126, + "object": "list", + "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + } + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@voucherify.io", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_LRx3Y1iHFWTt217NVrknkpi5", + "product": { + "id": "prod_0b2c2ddf35150b83bb", + "source_id": "97", + "name": "[Sample] Tiered Wire Basket", + "price": 11995, + "attributes": [], + "metadata": { + "source": "bigcommerce", + "bigcommerce_product_categories": [ + 21, + 23 + ] + }, + "image_url": null, + "created_at": "2022-06-03T13:36:16.084Z", + "updated_at": "2022-06-07T09:10:44.644Z", + "object": "product" + }, + "id": "rew_EPx1hCTpqzF0HW1z9NKckZH4", + "object": "reward", + "name": "Present", + "created_at": "2022-06-13T06:59:01.694Z", + "updated_at": "2023-02-03T15:04:14.102Z", + "parameters": { + "product": { + "id": "prod_0b2c2ddf35150b83bb", + "sku_id": null + } + }, + "type": "MATERIAL" + }, + "loyalty_card": { + "points": 4 + } + } + }, + "Redeem Pay with Points Reward": { + "value": { + "id": "r_0c6b4142ecc78a21d0", + "object": "redemption", + "date": "2023-02-06T09:36:26.547Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 2300, + "result": "SUCCESS", + "order": { + "id": "ord_QBnrJlVWA2EEiZoKOptFROnp", + "source_id": null, + "created_at": "2023-02-06T09:36:26.503Z", + "updated_at": null, + "status": "PAID", + "amount": 45000, + "discount_amount": 45000, + "total_discount_amount": 45000, + "total_amount": 0, + "applied_discount_amount": 45000, + "total_applied_discount_amount": 45000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0c5d6689b39320059b", + "quantity": 1, + "product": { + "id": "prod_0c5d6689b39320059b", + "source_id": "prod_anJ03RZZq74z4v", + "name": "Apple iPhone 8" + } + }, + { + "object": "order_item", + "product_id": "prod_0b2c36568000039138", + "quantity": 2, + "amount": 45000, + "price": 22500, + "subtotal_amount": 45000, + "product": { + "id": "prod_0b2c36568000039138", + "source_id": "86", + "name": "[Sample] Able Brewing System", + "price": 22500 } } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c6b4142ecc78a21d0": { + "date": "2023-02-06T09:36:26.547Z", + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + } + } + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 8000, + "balance": 4574 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" + } + }, + "is_referral_code": false, + "created_at": "2022-11-10T06:28:59.970Z", + "updated_at": "2023-02-06T09:36:26.548Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "holder": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 14, + "redeemed_points": 3426, + "object": "list", + "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" } + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", + "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "object": "reward", + "name": "100 = $20", + "created_at": "2022-11-10T06:28:39.582Z", + "updated_at": null, + "parameters": { + "coin": { + "exchange_ratio": 20, + "points_ratio": 100 + } + }, + "type": "COIN" + }, + "loyalty_card": { + "points": 2300 } } - } - }, - "400": { - "description": "Returns an error indicating that a reward is missing.", - "content": { - "application/json": { - "schema": { - "oneOf": [ - { - "$ref": "#/components/schemas/e_400_missing_reward" - }, + }, + "Redeem Pay with Points Reward with a specific amount of points": { + "value": { + "id": "r_0c6b423368146fa4bb", + "object": "redemption", + "date": "2023-02-06T09:40:32.800Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 100, + "result": "SUCCESS", + "order": { + "id": "ord_1L67XS8EYDDp5A4B3k62G2tr", + "source_id": null, + "created_at": "2023-02-06T09:40:32.784Z", + "updated_at": null, + "status": "PAID", + "amount": 45000, + "discount_amount": 2000, + "total_discount_amount": 2000, + "total_amount": 43000, + "applied_discount_amount": 2000, + "total_applied_discount_amount": 2000, + "items": [ { - "$ref": "#/components/schemas/e_400_missing_order" + "object": "order_item", + "product_id": "prod_0c5d6689b39320059b", + "quantity": 1, + "product": { + "id": "prod_0c5d6689b39320059b", + "source_id": "prod_anJ03RZZq74z4v", + "name": "Apple iPhone 8" + } }, { - "$ref": "#/components/schemas/e_400_loyalty_card_points_exceeded" + "object": "order_item", + "product_id": "prod_0b2c36568000039138", + "quantity": 2, + "amount": 45000, + "price": 22500, + "subtotal_amount": 45000, + "product": { + "id": "prod_0b2c36568000039138", + "source_id": "86", + "name": "[Sample] Able Brewing System", + "price": 22500 + } } - ] - } - } - } - }, - "404": { - "description": "Returns an error indicating a resource was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Member Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find voucher with id :memberId", - "request_id": "v-0c6b4b525d8e40cf3e", - "resource_id": ":memberId", - "resource_type": "voucher" + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c6b423368146fa4bb": { + "date": "2023-02-06T09:40:32.800Z", + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" } } - } - } - } - } - }, - "requestBody": { - "description": "Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_req_redeem_reward" - }, - "examples": { - "Pay with Points": { - "value": { - "reward": { - "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", - "points": 100 + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 8500, + "balance": 4974 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" }, - "order": { - "items": [ - { - "product_id": "prod_0c5d6689b39320059b", - "quantity": "1" - }, - { - "product_id": "prod_0b2c36568000039138", - "quantity": "2" - } - ] + "barcode": { + "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" } + }, + "is_referral_code": false, + "created_at": "2022-11-10T06:28:59.970Z", + "updated_at": "2023-02-06T09:40:32.801Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "holder": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 15, + "redeemed_points": 3526, + "object": "list", + "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" } + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", + "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "object": "reward", + "name": "100 = $20", + "created_at": "2022-11-10T06:28:39.582Z", + "updated_at": null, + "parameters": { + "coin": { + "exchange_ratio": 20, + "points_ratio": 100 + } + }, + "type": "COIN" + }, + "loyalty_card": { + "points": 100 } } } @@ -74612,314 +74305,301 @@ } } }, - "/v1/loyalties/{campaignId}/tiers": { - "parameters": [ - { + "404": { + "description": "Returns an error if the campaign was not found.", + "content": { + "application/json": { "schema": { - "type": "string" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique loyalty campaign ID or name." - } - ], - "get": { - "operationId": "list-loyalty-tiers", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Loyalty Tiers", - "description": "Retrieve a list of loyalty tiers which were added to the loyalty program.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" + "$ref": "#/components/schemas/e_404_not_found" }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ] - }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a list of loyalty tier objects.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoyaltiesListTiersResponseBody" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "ltr_30KHciA0UG8B71Fo51GZqwgN", - "name": "Bottom", - "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "metadata": {}, - "created_at": "2022-11-10T12:20:52.755Z", - "updated_at": "2022-11-25T11:27:58.616Z", - "earning_rules": { - "ern_95aq3JaE5A8xzHjoJPYNRqXZ": { - "type": "MULTIPLY", - "multiplier": 1 - }, - "ern_raVUcdXruvXGuzm682ESrAzt": { - "type": "CUSTOM", - "points": 5 - } - }, - "rewards": { - "rewa_t88DnSdNnE0IzQX6gqH3jHGQ": { - "type": "MULTIPLY", - "multiplier": 4 - } - }, - "config": { - "points": { - "from": 1, - "to": 249 - } - }, - "points": { - "from": 1, - "to": 249 - }, - "object": "loyalty_tier" - }, - { - "id": "ltr_pudTGWasuIqxdiDM0go31OV1", - "name": "Middle", - "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "metadata": {}, - "created_at": "2022-11-10T12:20:52.755Z", - "updated_at": "2022-11-25T11:27:58.579Z", - "earning_rules": { - "ern_95aq3JaE5A8xzHjoJPYNRqXZ": { - "type": "MULTIPLY", - "multiplier": 2 - } - }, - "rewards": {}, - "config": { - "points": { - "from": 250, - "to": 499 - } - }, - "points": { - "from": 250, - "to": 499 - }, - "object": "loyalty_tier" - }, - { - "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2", - "name": "Tier 1 - Top", - "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "metadata": { - "has_funds": true - }, - "created_at": "2022-11-09T06:26:54.797Z", - "updated_at": "2022-11-25T11:27:58.578Z", - "earning_rules": { - "ern_95aq3JaE5A8xzHjoJPYNRqXZ": { - "type": "MULTIPLY", - "multiplier": 3 - }, - "ern_AdlWO2yt6b6llWsibIdiRXVE": { - "type": "MULTIPLY", - "multiplier": 5 - }, - "ern_HnRXyJHoj3E79r3KUWhgMgtD": { - "type": "MULTIPLY", - "multiplier": 3 - }, - "ern_raVUcdXruvXGuzm682ESrAzt": { - "type": "CUSTOM", - "points": 200 - } - }, - "rewards": { - "rewa_Or6gWZ5ASuGkBLjOf0IyiD4k": { - "type": "CUSTOM", - "points": 300 - } - }, - "config": { - "points": { - "from": 500, - "to": 1000 - } - }, - "points": { - "from": 500, - "to": 1000 - }, - "object": "loyalty_tier" - } - ], - "total": 3 - } - } - } + "examples": { + "Campaign Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find campaign with id :campaignId", + "request_id": "v-0c6b39288084e3435a", + "resource_id": ":campaignId", + "resource_type": "campaign" } } } } - }, - "post": { - "operationId": "create-loyalty-tiers", - "tags": [ - "LOYALTIES API" - ], - "summary": "Create loyalty tiers", - "description": "Creates loyalty tiers for desired campaign.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns created loyalty tiers.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoyaltiesCreateTiersResponseBody" - } - } - } - } + } + } + }, + "requestBody": { + "description": "Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_redeem_reward" }, - "requestBody": { - "description": "Provide tier definitions you want to add to existing loyalty campaign.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoyaltiesCreateTiersRequestBody" + "examples": { + "Pay with Points": { + "value": { + "reward": { + "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "points": 100 + }, + "order": { + "items": [ + { + "product_id": "prod_0c5d6689b39320059b", + "quantity": "1" + }, + { + "product_id": "prod_0b2c36568000039138", + "quantity": "2" + } + ] } } } } } + } + } + } + }, + "/v1/loyalties/members/{memberId}/redemption": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "MmFAzfDe" }, - "/v1/loyalties/{campaignId}/tiers/{tierId}": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_fkZ28pe7DUAEmmabofkxHI8N" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique loyalty campaign ID or name." - }, - { + "name": "memberId", + "in": "path", + "required": true, + "description": "Unique loyalty card assigned to a particular customer." + } + ], + "post": { + "operationId": "redeem-reward", + "tags": [ + "LOYALTIES API" + ], + "summary": "Redeem Reward", + "description": "\n> 📘 Alternative endpoint\n>\n> This endpoint is an alternative to this [endpoint](ref:redeem-reward-1). The URL was re-designed to allow you to redeem a reward without having to provide the `campaignId` as a path parameter.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a redemption object.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "ltr_30KHciA0UG8B71Fo51GZqwgN" - }, - "name": "tierId", - "in": "path", - "required": true, - "description": "Unique loyalty tier ID." - } - ], - "get": { - "operationId": "get-loyalty-tier", - "tags": [ - "LOYALTIES API" - ], - "summary": "Get Loyalty Tier", - "description": "Retrieve a loyalty tier from a loyalty campaign by the loyalty tier ID.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a loyalty tier object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoyaltyTier" - }, - "examples": { - "Example": { - "value": { - "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2", - "name": "Tier 1 - Top", - "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "metadata": { - "has_funds": true - }, - "created_at": "2022-11-09T06:26:54.797Z", - "updated_at": "2022-11-25T11:27:58.578Z", - "earning_rules": { - "ern_95aq3JaE5A8xzHjoJPYNRqXZ": { - "type": "MULTIPLY", - "multiplier": 3 - }, - "ern_AdlWO2yt6b6llWsibIdiRXVE": { - "type": "MULTIPLY", - "multiplier": 5 - }, - "ern_HnRXyJHoj3E79r3KUWhgMgtD": { - "type": "MULTIPLY", - "multiplier": 3 - }, - "ern_raVUcdXruvXGuzm682ESrAzt": { - "type": "CUSTOM", - "points": 200 - } - }, - "rewards": { - "rewa_Or6gWZ5ASuGkBLjOf0IyiD4k": { - "type": "CUSTOM", - "points": 300 - } - }, - "config": { - "points": { - "from": 500, - "to": 1000 - } - }, - "points": { - "from": 500, - "to": 1000 - }, - "object": "loyalty_tier" + "$ref": "#/components/schemas/8_res_redeem_reward" + }, + "examples": { + "Redeem Pay with Points Reward with a specific number of Points": { + "value": { + "id": "r_0c6b4bf721439bf02b", + "object": "redemption", + "date": "2023-02-06T10:23:12.517Z", + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "tracking_id": "track_9B0kB92+bJa8a+PegaWREw==", + "metadata": null, + "amount": 100, + "result": "SUCCESS", + "order": { + "id": "ord_71Ayjxq2gFV80v3OP3qrxh37", + "source_id": null, + "created_at": "2023-02-06T10:23:12.485Z", + "updated_at": null, + "status": "PAID", + "amount": 45000, + "discount_amount": 2000, + "total_discount_amount": 2000, + "total_amount": 43000, + "applied_discount_amount": 2000, + "total_applied_discount_amount": 2000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0c5d6689b39320059b", + "quantity": 1, + "product": { + "id": "prod_0c5d6689b39320059b", + "source_id": "prod_anJ03RZZq74z4v", + "name": "Apple iPhone 8" + } + }, + { + "object": "order_item", + "product_id": "prod_0b2c36568000039138", + "quantity": 2, + "amount": 45000, + "price": 22500, + "subtotal_amount": 45000, + "product": { + "id": "prod_0b2c36568000039138", + "source_id": "86", + "name": "[Sample] Able Brewing System", + "price": 22500 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "object": "customer" + }, + "customer_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0c6b4bf721439bf02b": { + "date": "2023-02-06T10:23:12.517Z", + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "related_object_parent_id": "camp_22noMlhTADb7Fq2UL3vWu3d1" + } + } + }, + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "related_object_type": "voucher", + "related_object_id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "voucher": { + "id": "v_u3dRiZ0XHqX5Euhy5ezB5UQ5Sf85VXFP", + "code": "AnsvocvP", + "campaign": "Loyalty Campaign - Test Points", + "campaign_id": "camp_22noMlhTADb7Fq2UL3vWu3d1", + "category": null, + "category_id": "cat_0bb81a481615a37b5e", + "categories": [], + "type": "LOYALTY_CARD", + "discount": null, + "gift": null, + "loyalty_card": { + "points": 9000, + "balance": 5374 + }, + "start_date": null, + "expiration_date": null, + "validity_timeframe": null, + "validity_day_of_week": null, + "active": true, + "additional_info": null, + "metadata": {}, + "assets": { + "qr": { + "id": "U2FsdGVkX1/Au841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm+d2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO+qL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w==", + "url": "https://dl.voucherify.io/api/v1/assets/qr/U2FsdGVkX1%2FAu841M0T7UjYYRxYTzCRbNdZW6jW5YRNcV9PgblvN2MD5hdRuZfBRHEAm%2Bd2pvzc2FOVHFkuh9BQoaIq4KVyvy0FvkWtKkMLe4zO%2BqL4ocNUIbaRMSLeY6Xiz4hjxKNq918oLyGrp9w%3D%3D" + }, + "barcode": { + "id": "U2FsdGVkX1+xG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA/8H4gu04dxO/hrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY+8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw==", + "url": "https://dl.voucherify.io/api/v1/assets/barcode/U2FsdGVkX1%2BxG42zWo9nivfp6tg5jNuFCYOIFtw7iwas8kcA%2F8H4gu04dxO%2FhrbD41gFvxDhCuTSnIKwIPg9dEXzOvh8qy9VWN0UwDc6PL7lfNQuY%2B8Os7dqVsyNhoRned9pBo1uO6V4pjNu1gRTrw%3D%3D" } + }, + "is_referral_code": false, + "created_at": "2022-11-10T06:28:59.970Z", + "updated_at": "2023-02-06T10:23:12.517Z", + "holder_id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "holder": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "validation_rules_assignments": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 + }, + "redemption": { + "quantity": null, + "redeemed_quantity": 16, + "redeemed_points": 3626, + "object": "list", + "url": "/v1/vouchers/AnsvocvP/redemptions?page=1&limit=10" + }, + "publish": { + "object": "list", + "count": 1, + "url": "/v1/vouchers/AnsvocvP/publications?page=1&limit=10" + }, + "object": "voucher", + "applicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" + }, + "inapplicable_to": { + "data": [], + "total": 0, + "data_ref": "data", + "object": "list" } + }, + "reward": { + "customer": { + "id": "cust_eWgXlBBiY6THFRJwX45Iakv4", + "name": "Bob Jones", + "email": "bob.jones@email.com", + "source_id": "36_bob", + "metadata": { + "age": 26, + "favorite_brands": [ + "Nike", + "Adidas", + "Reebok" + ], + "accepts_marketing": false, + "acquisition_channel": "Facebook" + }, + "object": "customer" + }, + "assignment_id": "rewa_YAIuU7AY6LNJVlUbRxSbNgiD", + "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "object": "reward", + "name": "100 = $20", + "created_at": "2022-11-10T06:28:39.582Z", + "updated_at": null, + "parameters": { + "coin": { + "exchange_ratio": 20, + "points_ratio": 100 + } + }, + "type": "COIN" + }, + "loyalty_card": { + "points": 100 } } } @@ -74927,3977 +74607,4303 @@ } } }, - "/v1/loyalties/members/{memberId}/tiers": { - "parameters": [ - { + "400": { + "description": "Returns an error indicating that a reward is missing.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "MmFAzfDe" - }, - "name": "memberId", - "in": "path", - "required": true, - "description": "Unique loyalty card assigned to a particular customer." + "oneOf": [ + { + "$ref": "#/components/schemas/e_400_missing_reward" + }, + { + "$ref": "#/components/schemas/e_400_missing_order" + }, + { + "$ref": "#/components/schemas/e_400_loyalty_card_points_exceeded" + } + ] + } } - ], - "get": { - "operationId": "get-member-loyalty-tier", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Member's Loyalty Tiers", - "description": "Retrieve member tiers using the loyalty card ID.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + } + }, + "404": { + "description": "Returns an error indicating a resource was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Member Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find voucher with id :memberId", + "request_id": "v-0c6b4b525d8e40cf3e", + "resource_id": ":memberId", + "resource_type": "voucher" + } + } } - ], - "responses": { - "200": { - "description": "Returns a data array containing the member's loyalty tiers.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoyaltiesListMemberLoyaltyTiersResponseBody" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2", - "name": "Tier 1 - Top", - "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "metadata": { - "has_funds": true - }, - "created_at": "2022-11-09T06:26:54.797Z", - "updated_at": "2022-11-25T11:27:58.578Z", - "earning_rules": { - "ern_95aq3JaE5A8xzHjoJPYNRqXZ": { - "type": "MULTIPLY", - "multiplier": 3 - }, - "ern_AdlWO2yt6b6llWsibIdiRXVE": { - "type": "MULTIPLY", - "multiplier": 5 - }, - "ern_HnRXyJHoj3E79r3KUWhgMgtD": { - "type": "MULTIPLY", - "multiplier": 3 - }, - "ern_raVUcdXruvXGuzm682ESrAzt": { - "type": "CUSTOM", - "points": 200 - } - }, - "rewards": { - "rewa_Or6gWZ5ASuGkBLjOf0IyiD4k": { - "type": "CUSTOM", - "points": 300 - } - }, - "config": { - "points": { - "from": 500, - "to": 1000 - } - }, - "points": { - "from": 500, - "to": 1000 - }, - "expiration": { - "customer_id": "cust_qBwHpagDOFu71Z3F22UzR80X", - "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "tier_id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2", - "start_date": "2022-11-10", - "expiration_date": "2023-02-28", - "created_at": "2022-11-09T11:26:26.719Z", - "updated_at": "2022-11-10T08:54:47.200Z" - }, - "object": "loyalty_tier" - } - ], - "total": 1 - } + } + } + } + }, + "requestBody": { + "description": "Specify the reward to be redeemed. In case of a pay with points reward, specify the order and the number of points to be applied to the order. Please note that if you do not specify the amount of points, the application will default to applying the number of points to pay for the remainder of the order. If the limit of available points on the card is reached, then only the available points on the card will be applied to the order.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_req_redeem_reward" + }, + "examples": { + "Pay with Points": { + "value": { + "reward": { + "id": "rew_INt3fGH3n7xIr3ZQcq4kkUZ1", + "points": 100 + }, + "order": { + "items": [ + { + "product_id": "prod_0c5d6689b39320059b", + "quantity": "1" + }, + { + "product_id": "prod_0b2c36568000039138", + "quantity": "2" } - } + ] } } } } } + } + } + } + }, + "/v1/loyalties/{campaignId}/tiers": { + "parameters": [ + { + "schema": { + "type": "string" }, - "/v1/loyalties/{campaignId}/tiers/{tierId}/earning-rules": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID or name." - }, - { + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique loyalty campaign ID or name." + } + ], + "get": { + "operationId": "list-loyalty-tiers", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Loyalty Tiers", + "description": "Retrieve a list of loyalty tiers which were added to the loyalty program.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + }, + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash - preceding a sorting option means sorting in a descending order." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of loyalty tier objects.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "ltr_mtWowJBBhVYnY8oXaLJ2tUnk" - }, - "name": "tierId", - "in": "path", - "required": true, - "description": "Unique tier ID." - } - ], - "get": { - "operationId": "list-loyalty-tier-earning-rules", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Loyalty Tier Earning Rules", - "description": "Retrieve available earning rules for a given tier and the calculation method for earning points.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a list of earning rules for a given tier. The object for each earning rule also contains information about how the points are calculated; this includes mapping. If a specific multiplier was used to calculate points for a given tier, then the `loyalty.points` parameter will account for this calculation.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoyaltiesListLoyaltyTierEarningRulesResponseBody" - }, - "examples": { - "example-1": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "ern_95aq3JaE5A8xzHjoJPYNRqXZ", - "created_at": "2022-11-09T06:26:54.332Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 1, - "points": 300, - "property": "customer_life_time_value" - } - } - }, - "event": "customer.loyalty.tier.joined", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Tier Joined", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_bfi69WIbztany4iX6prkKbGN", - "metadata": { - "Type": "Joined Any" - } - }, - { - "id": "ern_HnRXyJHoj3E79r3KUWhgMgtD", - "created_at": "2022-11-10T12:25:12.927Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 300, - "type": "FIXED" - }, - "segment": { - "id": "seg_n3vVcU5t0m3rs4rEPr3C1oU5" - }, - "event": "customer.segment.entered", - "source": { - "banner": "New Customers", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_0gv3v7jQG5U6TtVC8bMEdIap", - "metadata": {} - }, - { - "id": "ern_raVUcdXruvXGuzm682ESrAzt", - "created_at": "2022-11-24T09:03:14.534Z", - "updated_at": "2022-11-25T09:48:26.284Z", - "validation_rule_id": "val_7SxpdhPeBngA", - "loyalty": { - "points": 20, - "type": "FIXED" - }, - "event": "order.paid", - "source": { - "banner": "Order has been paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "start_date": "2022-11-23T00:00:00.000Z", - "expiration_date": "2022-11-30T00:00:00.000Z", - "validity_day_of_week": [ - 1, - 2, - 3, - 4, - 5 - ], - "object": "earning_rule", - "automation_id": "auto_MbEIyLbn7pHyba5Qw5eeb35L", - "metadata": { - "Type": "Order has been paid - Fixed" - } - }, - { - "id": "ern_BmDiQs7T3UHfJQqtI2RfJHFR", - "created_at": "2022-11-24T14:48:36.567Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_AMOUNT", - "order": { - "amount": { - "every": 1000, - "points": 1 - } - } - }, - "event": "order.paid", - "source": { - "banner": "Order paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_IKanVw37J6oFuRrdnryXw8Lz", - "metadata": { - "Type": "Order has been paid - Proportional - 1" - } - }, - { - "id": "ern_jwtacKdEEHoc85QbouRw3CR8", - "created_at": "2022-11-24T15:17:11.539Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_TOTAL_AMOUNT", - "order": { - "total_amount": { - "every": 1100, - "points": 1 - } - } - }, - "event": "order.paid", - "source": { - "banner": "Order has been paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_Y6IWqhz0cHGkKcteU9PS5nmK", - "metadata": { - "Type": "Order has been paid - Proportional - 2" - } - }, - { - "id": "ern_fxVdmtJ4u4rlyoH2hIq7m1PQ", - "created_at": "2022-11-24T15:20:04.392Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_METADATA", - "order": { - "metadata": { - "every": 10, - "points": 2, - "property": "number_of_store_visits" - } - } - }, - "event": "order.paid", - "source": { - "banner": "Order paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_HyowcdKQ0lsQ1rSxV5tyYr2z", - "metadata": { - "Type": "Order has been paid - Proportional - 3 - Metadata" - } - }, - { - "id": "ern_Aop1wTrmPv4yBntDcvXNTCWR", - "created_at": "2022-11-24T15:23:44.514Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_AMOUNT", - "order_items": { - "amount": { - "every": 1000, - "points": 3, - "object": "products_collection", - "id": "pc_75U0dHlr7u75BJodrW1AE3t6" - } - } - }, - "event": "order.paid", - "source": { - "banner": "Order paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_EXRyQ0z0rgtF54PKDGGAF1qg", - "metadata": { - "Type": "Order has been paid - Proportional - 4" - } - }, - { - "id": "ern_4qSQVjfGEH7OmXKMzotS0juY", - "created_at": "2022-11-24T15:44:45.301Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_SUBTOTAL_AMOUNT", - "order_items": { - "subtotal_amount": { - "every": 1000, - "points": 4, - "object": "sku", - "id": "sku_0b7d7dfb090be5c619" - } - } - }, - "event": "order.paid", - "source": { - "banner": "Order paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_ID3xLPXCdnOaveJYWiulcNFW", - "metadata": { - "Type": "Order has been paid - Proportional - 5 - Items" - } - }, - { - "id": "ern_aJyt4wIrXhmfMxvrLoZjBYrP", - "created_at": "2022-11-24T15:56:58.710Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "ORDER_ITEMS_AMOUNT", - "order_items": { - "amount": { - "every": 10000, - "points": 1, - "object": "product", - "id": "prod_0bae32322150fd0546" - } - } - }, - "event": "order.paid", - "source": { - "banner": "Order paid", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_EbBqD1SNW70vgDp5icGbWl3e", - "metadata": {} - }, - { - "id": "ern_v4Blmh9hA3gpnjo93cMAgvHr", - "created_at": "2022-11-24T16:19:20.571Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 1, - "points": 5, - "property": "customer_life_time_value" - } - } - }, - "segment": { - "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" - }, - "event": "customer.segment.entered", - "source": { - "banner": "Entered Segment", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_wMMDJ86iHKkznz9x0506e30E", - "metadata": {} - }, - { - "id": "ern_L8dFanPxJzhw0f5voTwPurGP", - "created_at": "2022-11-24T16:27:13.917Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 3, - "type": "FIXED" - }, - "custom_event": { - "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" - }, - "event": "page_view", - "source": { - "banner": "Custom Event", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_9N69OJzGKGhp2mo7SNsnsF5b", - "metadata": { - "Type": "Fixed" - } - }, - { - "id": "ern_ngdugZ2hzg35hGASFF8nDjUO", - "created_at": "2022-11-24T16:41:48.830Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOM_EVENT_METADATA", - "custom_event": { - "metadata": { - "every": 2, - "points": 2, - "property": "volume_number" - } - } - }, - "custom_event": { - "schema_id": "ms_qpRZ3EmRQyszNH6Z52Gkq8au" - }, - "event": "user_subscribed", - "source": { - "banner": "Custom Event", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_v1eTxL7X63B5IkYgRWHK4leh", - "metadata": { - "Type": "Event" - } - }, - { - "id": "ern_afo3Ea760hAKv07JYpycnhiE", - "created_at": "2022-11-24T16:50:12.945Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 3, - "points": 3, - "property": "customer_life_time_value" - } - } - }, - "custom_event": { - "schema_id": "ms_f0r4hcu5T0m3v3nT5ch3ma" - }, - "event": "cart_abandoned", - "source": { - "banner": "Custom Event", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_7ovoKiXx49fe3nnhEbDlp9FP", - "metadata": {} - }, - { - "id": "ern_chdlG14W8Sdcq3d6jJQQgRMT", - "created_at": "2022-11-24T16:51:31.595Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 1, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.joined", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Tier joined - Any", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_W9yMQTz5fgQTgmuu6pTVraBW", - "metadata": { - "Type": "Tier joined - any - fixed" - } - }, - { - "id": "ern_gVo6CHBduFPoh1hctASfXHLT", - "created_at": "2022-11-24T17:01:42.809Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 4, - "points": 4, - "property": "customer_life_time_value" - } - } - }, - "event": "customer.loyalty.tier.joined", - "loyalty_tier": { - "id": "ltr_pudTGWasuIqxdiDM0go31OV1" - }, - "source": { - "banner": "Tier joined", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_wdlEo17wmoqYHGfilbayEUj7", - "metadata": { - "Type": "Tier joined - customer metadata - proportional" - } - }, - { - "id": "ern_66OdCyLADv5IGFoQe18vGUwa", - "created_at": "2022-11-24T17:03:59.414Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 2, - "points": 2, - "property": "customer_life_time_value" - } - } - }, - "event": "customer.loyalty.tier.left", - "loyalty_tier": { - "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2" - }, - "source": { - "banner": "Tier left", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_czm5el1Uz1jeGaO97AYoDNAq", - "metadata": { - "Type": "Tier left" - } - }, - { - "id": "ern_YR3fDfCjAmz9a5D68nk0i4dm", - "created_at": "2022-11-25T07:29:38.961Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "type": "PROPORTIONAL", - "calculation_type": "CUSTOMER_METADATA", - "customer": { - "metadata": { - "every": 3, - "points": 4, - "property": "customer_life_time_value" - } - } - }, - "event": "customer.loyalty.tier.upgraded", - "loyalty_tier": { - "id": "ltr_30KHciA0UG8B71Fo51GZqwgN" - }, - "source": { - "banner": "Tier upgraded", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_M1OdRH8spk6Fs7yTuPLN2LAv", - "metadata": { - "Type": "Upgraded" - } - }, - { - "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", - "created_at": "2022-11-25T07:31:05.866Z", - "updated_at": "2022-11-25T09:48:26.506Z", - "validation_rule_id": "val_kfmWpfXMI9P1", - "loyalty": { - "points": 1, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.downgraded", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Tier Downgraded", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", - "metadata": { - "Type": "Tier" - } - }, - { - "id": "ern_AdlWO2yt6b6llWsibIdiRXVE", - "created_at": "2022-11-25T07:31:42.767Z", - "updated_at": null, - "validation_rule_id": null, - "loyalty": { - "points": 25, - "type": "FIXED" - }, - "event": "customer.loyalty.tier.prolonged", - "loyalty_tier": { - "id": "__ANY__" - }, - "source": { - "banner": "Prolonged", - "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "object_type": "campaign" - }, - "active": true, - "object": "earning_rule", - "automation_id": "auto_4jH1yq9WJS0oJ8suagCrltyb", - "metadata": {} - } - ], - "total": 19 - } + "$ref": "#/components/schemas/LoyaltiesListTiersResponseBody" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "ltr_30KHciA0UG8B71Fo51GZqwgN", + "name": "Bottom", + "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "metadata": {}, + "created_at": "2022-11-10T12:20:52.755Z", + "updated_at": "2022-11-25T11:27:58.616Z", + "earning_rules": { + "ern_95aq3JaE5A8xzHjoJPYNRqXZ": { + "type": "MULTIPLY", + "multiplier": 1 + }, + "ern_raVUcdXruvXGuzm682ESrAzt": { + "type": "CUSTOM", + "points": 5 + } + }, + "rewards": { + "rewa_t88DnSdNnE0IzQX6gqH3jHGQ": { + "type": "MULTIPLY", + "multiplier": 4 + } + }, + "config": { + "points": { + "from": 1, + "to": 249 + } + }, + "points": { + "from": 1, + "to": 249 + }, + "object": "loyalty_tier" + }, + { + "id": "ltr_pudTGWasuIqxdiDM0go31OV1", + "name": "Middle", + "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "metadata": {}, + "created_at": "2022-11-10T12:20:52.755Z", + "updated_at": "2022-11-25T11:27:58.579Z", + "earning_rules": { + "ern_95aq3JaE5A8xzHjoJPYNRqXZ": { + "type": "MULTIPLY", + "multiplier": 2 + } + }, + "rewards": {}, + "config": { + "points": { + "from": 250, + "to": 499 + } + }, + "points": { + "from": 250, + "to": 499 + }, + "object": "loyalty_tier" + }, + { + "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2", + "name": "Tier 1 - Top", + "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "metadata": { + "has_funds": true + }, + "created_at": "2022-11-09T06:26:54.797Z", + "updated_at": "2022-11-25T11:27:58.578Z", + "earning_rules": { + "ern_95aq3JaE5A8xzHjoJPYNRqXZ": { + "type": "MULTIPLY", + "multiplier": 3 + }, + "ern_AdlWO2yt6b6llWsibIdiRXVE": { + "type": "MULTIPLY", + "multiplier": 5 + }, + "ern_HnRXyJHoj3E79r3KUWhgMgtD": { + "type": "MULTIPLY", + "multiplier": 3 + }, + "ern_raVUcdXruvXGuzm682ESrAzt": { + "type": "CUSTOM", + "points": 200 + } + }, + "rewards": { + "rewa_Or6gWZ5ASuGkBLjOf0IyiD4k": { + "type": "CUSTOM", + "points": 300 + } + }, + "config": { + "points": { + "from": 500, + "to": 1000 + } + }, + "points": { + "from": 500, + "to": 1000 + }, + "object": "loyalty_tier" } - } + ], + "total": 3 } } } } } - }, - "/v1/loyalties/{campaignId}/tiers/{tierId}/rewards": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" - }, - "name": "campaignId", - "in": "path", - "required": true, - "description": "Unique campaign ID or name." - }, - { + } + } + }, + "post": { + "operationId": "create-loyalty-tiers", + "tags": [ + "LOYALTIES API" + ], + "summary": "Create loyalty tiers", + "description": "Creates loyalty tiers for desired campaign.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns created loyalty tiers.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "ltr_mtWowJBBhVYnY8oXaLJ2tUnk" - }, - "name": "tierId", - "in": "path", - "required": true, - "description": "Unique tier ID." - } - ], - "get": { - "operationId": "list-loyalty-tier-rewards", - "tags": [ - "LOYALTIES API" - ], - "summary": "List Loyalty Tier Rewards", - "description": "Get available rewards for a given tier.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + "$ref": "#/components/schemas/LoyaltiesCreateTiersResponseBody" } - ], - "responses": { - "200": { - "description": "Returns a dictionary of loyalty tier reward objects.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/8_res_list_loyalty_tier_rewards" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "reward": { - "id": "rew_QuWYsBNB2G3fikffjnl0G3gH", - "name": "API - Testing", - "type": "CAMPAIGN", - "parameters": { - "campaign": { - "id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", - "balance": 500, - "type": "LOYALTY_PROGRAM" - } - }, - "stock": null, - "redeemed": null, - "created_at": "2022-08-25T09:32:04.579424+00:00", - "updated_at": "2022-08-25T09:33:46.680639+00:00", - "metadata": { - "Type": "Second campaign" - }, - "object": "reward" - }, - "assignment": { - "id": "rewa_3Z2sP0bmqcL0ggU28GvFeHU3", - "reward_id": "rew_QuWYsBNB2G3fikffjnl0G3gH", - "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 40 - } - }, - "created_at": "2022-11-23T22:11:58.759092+00:00", - "updated_at": null, - "object": "reward_assignment" - }, - "object": "loyalty_tier_reward" - }, - { - "reward": { - "id": "rew_XoDgmQ2HZX7qPM6aIEuslObo", - "name": "Material", - "type": "MATERIAL", - "parameters": { - "product": { - "id": "prod_0b15f6b9f650c16990", - "sku_id": "sku_0b1621b319d248b79f" - } - }, - "stock": 2, - "redeemed": 1, - "attributes": { - "image_url": "https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_fPH9ohe0pZf4EiIt295sk9Ob.png", - "description": "Archie's Series" - }, - "created_at": "2022-08-29T06:02:36.753873+00:00", - "updated_at": "2022-11-08T08:01:26.883166+00:00", - "metadata": { - "Type": "Material" - }, - "object": "reward" - }, - "assignment": { - "id": "rewa_Or6gWZ5ASuGkBLjOf0IyiD4k", - "reward_id": "rew_XoDgmQ2HZX7qPM6aIEuslObo", - "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "related_object_type": "campaign", - "parameters": { - "loyalty": { - "points": 30 - } - }, - "created_at": "2022-11-23T22:11:58.759092+00:00", - "updated_at": null, - "object": "reward_assignment" - }, - "object": "loyalty_tier_reward" - }, - { - "reward": { - "id": "rew_MVXA2kV7lZ1zC057WUaTrvNz", - "name": "100 Points = $20", - "type": "COIN", - "parameters": { - "coin": { - "exchange_ratio": 20, - "points_ratio": 100 - } - }, - "stock": null, - "redeemed": null, - "attributes": {}, - "created_at": "2022-09-09T06:41:54.496035+00:00", - "updated_at": null, - "metadata": {}, - "object": "reward" - }, - "assignment": { - "id": "rewa_nMXB59qGTNYawMT8eP8M4oUp", - "reward_id": "rew_MVXA2kV7lZ1zC057WUaTrvNz", - "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", - "related_object_type": "campaign", - "created_at": "2022-11-09T11:01:21.065681+00:00", - "updated_at": null, - "object": "reward_assignment" - }, - "object": "loyalty_tier_reward" - } - ], - "total": 3 - } + } + } + } + }, + "requestBody": { + "description": "Provide tier definitions you want to add to existing loyalty campaign.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltiesCreateTiersRequestBody" + } + } + } + } + } + }, + "/v1/loyalties/{campaignId}/tiers/{tierId}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_fkZ28pe7DUAEmmabofkxHI8N" + }, + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique loyalty campaign ID or name." + }, + { + "schema": { + "type": "string", + "example": "ltr_30KHciA0UG8B71Fo51GZqwgN" + }, + "name": "tierId", + "in": "path", + "required": true, + "description": "Unique loyalty tier ID." + } + ], + "get": { + "operationId": "get-loyalty-tier", + "tags": [ + "LOYALTIES API" + ], + "summary": "Get Loyalty Tier", + "description": "Retrieve a loyalty tier from a loyalty campaign by the loyalty tier ID.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a loyalty tier object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltyTier" + }, + "examples": { + "Example": { + "value": { + "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2", + "name": "Tier 1 - Top", + "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "metadata": { + "has_funds": true + }, + "created_at": "2022-11-09T06:26:54.797Z", + "updated_at": "2022-11-25T11:27:58.578Z", + "earning_rules": { + "ern_95aq3JaE5A8xzHjoJPYNRqXZ": { + "type": "MULTIPLY", + "multiplier": 3 + }, + "ern_AdlWO2yt6b6llWsibIdiRXVE": { + "type": "MULTIPLY", + "multiplier": 5 + }, + "ern_HnRXyJHoj3E79r3KUWhgMgtD": { + "type": "MULTIPLY", + "multiplier": 3 + }, + "ern_raVUcdXruvXGuzm682ESrAzt": { + "type": "CUSTOM", + "points": 200 } - } + }, + "rewards": { + "rewa_Or6gWZ5ASuGkBLjOf0IyiD4k": { + "type": "CUSTOM", + "points": 300 + } + }, + "config": { + "points": { + "from": 500, + "to": 1000 + } + }, + "points": { + "from": 500, + "to": 1000 + }, + "object": "loyalty_tier" } } } } } + } + } + } + }, + "/v1/loyalties/members/{memberId}/tiers": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "MmFAzfDe" }, - "/v1/customer-object": { - "get": { - "operationId": "customer-object", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Customer Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Customer Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/9_obj_customer_object" - } + "name": "memberId", + "in": "path", + "required": true, + "description": "Unique loyalty card assigned to a particular customer." + } + ], + "get": { + "operationId": "get-member-loyalty-tier", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Member's Loyalty Tiers", + "description": "Retrieve member tiers using the loyalty card ID.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a data array containing the member's loyalty tiers.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltiesListMemberLoyaltyTiersResponseBody" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2", + "name": "Tier 1 - Top", + "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "metadata": { + "has_funds": true + }, + "created_at": "2022-11-09T06:26:54.797Z", + "updated_at": "2022-11-25T11:27:58.578Z", + "earning_rules": { + "ern_95aq3JaE5A8xzHjoJPYNRqXZ": { + "type": "MULTIPLY", + "multiplier": 3 + }, + "ern_AdlWO2yt6b6llWsibIdiRXVE": { + "type": "MULTIPLY", + "multiplier": 5 + }, + "ern_HnRXyJHoj3E79r3KUWhgMgtD": { + "type": "MULTIPLY", + "multiplier": 3 + }, + "ern_raVUcdXruvXGuzm682ESrAzt": { + "type": "CUSTOM", + "points": 200 + } + }, + "rewards": { + "rewa_Or6gWZ5ASuGkBLjOf0IyiD4k": { + "type": "CUSTOM", + "points": 300 + } + }, + "config": { + "points": { + "from": 500, + "to": 1000 + } + }, + "points": { + "from": 500, + "to": 1000 + }, + "expiration": { + "customer_id": "cust_qBwHpagDOFu71Z3F22UzR80X", + "campaign_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "tier_id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2", + "start_date": "2022-11-10", + "expiration_date": "2023-02-28", + "created_at": "2022-11-09T11:26:26.719Z", + "updated_at": "2022-11-10T08:54:47.200Z" + }, + "object": "loyalty_tier" + } + ], + "total": 1 } } } } } + } + } + } + }, + "/v1/loyalties/{campaignId}/tiers/{tierId}/earning-rules": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" }, - "/v1/customer-activity-object": { - "get": { - "operationId": "customer-activity-object", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Customer Activity Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Customer Activity Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/9_obj_customer_activity_object" - } + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID or name." + }, + { + "schema": { + "type": "string", + "example": "ltr_mtWowJBBhVYnY8oXaLJ2tUnk" + }, + "name": "tierId", + "in": "path", + "required": true, + "description": "Unique tier ID." + } + ], + "get": { + "operationId": "list-loyalty-tier-earning-rules", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Loyalty Tier Earning Rules", + "description": "Retrieve available earning rules for a given tier and the calculation method for earning points.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of earning rules for a given tier. The object for each earning rule also contains information about how the points are calculated; this includes mapping. If a specific multiplier was used to calculate points for a given tier, then the `loyalty.points` parameter will account for this calculation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LoyaltiesListLoyaltyTierEarningRulesResponseBody" + }, + "examples": { + "example-1": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "ern_95aq3JaE5A8xzHjoJPYNRqXZ", + "created_at": "2022-11-09T06:26:54.332Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 1, + "points": 300, + "property": "customer_life_time_value" + } + } + }, + "event": "customer.loyalty.tier.joined", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Tier Joined", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_bfi69WIbztany4iX6prkKbGN", + "metadata": { + "Type": "Joined Any" + } + }, + { + "id": "ern_HnRXyJHoj3E79r3KUWhgMgtD", + "created_at": "2022-11-10T12:25:12.927Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 300, + "type": "FIXED" + }, + "segment": { + "id": "seg_n3vVcU5t0m3rs4rEPr3C1oU5" + }, + "event": "customer.segment.entered", + "source": { + "banner": "New Customers", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_0gv3v7jQG5U6TtVC8bMEdIap", + "metadata": {} + }, + { + "id": "ern_raVUcdXruvXGuzm682ESrAzt", + "created_at": "2022-11-24T09:03:14.534Z", + "updated_at": "2022-11-25T09:48:26.284Z", + "validation_rule_id": "val_7SxpdhPeBngA", + "loyalty": { + "points": 20, + "type": "FIXED" + }, + "event": "order.paid", + "source": { + "banner": "Order has been paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "start_date": "2022-11-23T00:00:00.000Z", + "expiration_date": "2022-11-30T00:00:00.000Z", + "validity_day_of_week": [ + 1, + 2, + 3, + 4, + 5 + ], + "object": "earning_rule", + "automation_id": "auto_MbEIyLbn7pHyba5Qw5eeb35L", + "metadata": { + "Type": "Order has been paid - Fixed" + } + }, + { + "id": "ern_BmDiQs7T3UHfJQqtI2RfJHFR", + "created_at": "2022-11-24T14:48:36.567Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_AMOUNT", + "order": { + "amount": { + "every": 1000, + "points": 1 + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_IKanVw37J6oFuRrdnryXw8Lz", + "metadata": { + "Type": "Order has been paid - Proportional - 1" + } + }, + { + "id": "ern_jwtacKdEEHoc85QbouRw3CR8", + "created_at": "2022-11-24T15:17:11.539Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_TOTAL_AMOUNT", + "order": { + "total_amount": { + "every": 1100, + "points": 1 + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order has been paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_Y6IWqhz0cHGkKcteU9PS5nmK", + "metadata": { + "Type": "Order has been paid - Proportional - 2" + } + }, + { + "id": "ern_fxVdmtJ4u4rlyoH2hIq7m1PQ", + "created_at": "2022-11-24T15:20:04.392Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_METADATA", + "order": { + "metadata": { + "every": 10, + "points": 2, + "property": "number_of_store_visits" + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_HyowcdKQ0lsQ1rSxV5tyYr2z", + "metadata": { + "Type": "Order has been paid - Proportional - 3 - Metadata" + } + }, + { + "id": "ern_Aop1wTrmPv4yBntDcvXNTCWR", + "created_at": "2022-11-24T15:23:44.514Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_AMOUNT", + "order_items": { + "amount": { + "every": 1000, + "points": 3, + "object": "products_collection", + "id": "pc_75U0dHlr7u75BJodrW1AE3t6" + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_EXRyQ0z0rgtF54PKDGGAF1qg", + "metadata": { + "Type": "Order has been paid - Proportional - 4" + } + }, + { + "id": "ern_4qSQVjfGEH7OmXKMzotS0juY", + "created_at": "2022-11-24T15:44:45.301Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_SUBTOTAL_AMOUNT", + "order_items": { + "subtotal_amount": { + "every": 1000, + "points": 4, + "object": "sku", + "id": "sku_0b7d7dfb090be5c619" + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_ID3xLPXCdnOaveJYWiulcNFW", + "metadata": { + "Type": "Order has been paid - Proportional - 5 - Items" + } + }, + { + "id": "ern_aJyt4wIrXhmfMxvrLoZjBYrP", + "created_at": "2022-11-24T15:56:58.710Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "ORDER_ITEMS_AMOUNT", + "order_items": { + "amount": { + "every": 10000, + "points": 1, + "object": "product", + "id": "prod_0bae32322150fd0546" + } + } + }, + "event": "order.paid", + "source": { + "banner": "Order paid", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_EbBqD1SNW70vgDp5icGbWl3e", + "metadata": {} + }, + { + "id": "ern_v4Blmh9hA3gpnjo93cMAgvHr", + "created_at": "2022-11-24T16:19:20.571Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 1, + "points": 5, + "property": "customer_life_time_value" + } + } + }, + "segment": { + "id": "seg_OlE7DmfzMI5pHyD5VAv512r1" + }, + "event": "customer.segment.entered", + "source": { + "banner": "Entered Segment", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_wMMDJ86iHKkznz9x0506e30E", + "metadata": {} + }, + { + "id": "ern_L8dFanPxJzhw0f5voTwPurGP", + "created_at": "2022-11-24T16:27:13.917Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 3, + "type": "FIXED" + }, + "custom_event": { + "schema_id": "ms_gn4Qe4xsFPf7orCArCiNVY13" + }, + "event": "page_view", + "source": { + "banner": "Custom Event", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_9N69OJzGKGhp2mo7SNsnsF5b", + "metadata": { + "Type": "Fixed" + } + }, + { + "id": "ern_ngdugZ2hzg35hGASFF8nDjUO", + "created_at": "2022-11-24T16:41:48.830Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOM_EVENT_METADATA", + "custom_event": { + "metadata": { + "every": 2, + "points": 2, + "property": "volume_number" + } + } + }, + "custom_event": { + "schema_id": "ms_qpRZ3EmRQyszNH6Z52Gkq8au" + }, + "event": "user_subscribed", + "source": { + "banner": "Custom Event", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_v1eTxL7X63B5IkYgRWHK4leh", + "metadata": { + "Type": "Event" + } + }, + { + "id": "ern_afo3Ea760hAKv07JYpycnhiE", + "created_at": "2022-11-24T16:50:12.945Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 3, + "points": 3, + "property": "customer_life_time_value" + } + } + }, + "custom_event": { + "schema_id": "ms_f0r4hcu5T0m3v3nT5ch3ma" + }, + "event": "cart_abandoned", + "source": { + "banner": "Custom Event", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_7ovoKiXx49fe3nnhEbDlp9FP", + "metadata": {} + }, + { + "id": "ern_chdlG14W8Sdcq3d6jJQQgRMT", + "created_at": "2022-11-24T16:51:31.595Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 1, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.joined", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Tier joined - Any", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_W9yMQTz5fgQTgmuu6pTVraBW", + "metadata": { + "Type": "Tier joined - any - fixed" + } + }, + { + "id": "ern_gVo6CHBduFPoh1hctASfXHLT", + "created_at": "2022-11-24T17:01:42.809Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 4, + "points": 4, + "property": "customer_life_time_value" + } + } + }, + "event": "customer.loyalty.tier.joined", + "loyalty_tier": { + "id": "ltr_pudTGWasuIqxdiDM0go31OV1" + }, + "source": { + "banner": "Tier joined", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_wdlEo17wmoqYHGfilbayEUj7", + "metadata": { + "Type": "Tier joined - customer metadata - proportional" + } + }, + { + "id": "ern_66OdCyLADv5IGFoQe18vGUwa", + "created_at": "2022-11-24T17:03:59.414Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 2, + "points": 2, + "property": "customer_life_time_value" + } + } + }, + "event": "customer.loyalty.tier.left", + "loyalty_tier": { + "id": "ltr_7rVIPlPzdSFwpnbCcUXgwzH2" + }, + "source": { + "banner": "Tier left", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_czm5el1Uz1jeGaO97AYoDNAq", + "metadata": { + "Type": "Tier left" + } + }, + { + "id": "ern_YR3fDfCjAmz9a5D68nk0i4dm", + "created_at": "2022-11-25T07:29:38.961Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "type": "PROPORTIONAL", + "calculation_type": "CUSTOMER_METADATA", + "customer": { + "metadata": { + "every": 3, + "points": 4, + "property": "customer_life_time_value" + } + } + }, + "event": "customer.loyalty.tier.upgraded", + "loyalty_tier": { + "id": "ltr_30KHciA0UG8B71Fo51GZqwgN" + }, + "source": { + "banner": "Tier upgraded", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_M1OdRH8spk6Fs7yTuPLN2LAv", + "metadata": { + "Type": "Upgraded" + } + }, + { + "id": "ern_A2RArBE30Tkt56utVLrRv7rZ", + "created_at": "2022-11-25T07:31:05.866Z", + "updated_at": "2022-11-25T09:48:26.506Z", + "validation_rule_id": "val_kfmWpfXMI9P1", + "loyalty": { + "points": 1, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.downgraded", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Tier Downgraded", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_TMVZtCNMBgZm0KcPJ7otiHZW", + "metadata": { + "Type": "Tier" + } + }, + { + "id": "ern_AdlWO2yt6b6llWsibIdiRXVE", + "created_at": "2022-11-25T07:31:42.767Z", + "updated_at": null, + "validation_rule_id": null, + "loyalty": { + "points": 25, + "type": "FIXED" + }, + "event": "customer.loyalty.tier.prolonged", + "loyalty_tier": { + "id": "__ANY__" + }, + "source": { + "banner": "Prolonged", + "object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "object_type": "campaign" + }, + "active": true, + "object": "earning_rule", + "automation_id": "auto_4jH1yq9WJS0oJ8suagCrltyb", + "metadata": {} + } + ], + "total": 19 } } } } } + } + } + } + }, + "/v1/loyalties/{campaignId}/tiers/{tierId}/rewards": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "camp_pqZjuhG6Mgtp4GD0zD7b8hA3" }, - "/v1/customers": { - "get": { - "operationId": "list-customers", - "tags": [ - "CUSTOMERS API" - ], - "summary": "List Customers", - "description": "Returns a list of customers.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "email", - "description": "Limit the customers to the ones that have this specific email address." - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "description": "Limit the customers to the ones that are located in the specified city.", - "name": "city" - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "description": "Filter customers by the name property.", - "name": "name" - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at", - "source_id", - "-source_id" - ] - }, - "in": "query", - "name": "order", - "description": "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." - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "starting_after", - "description": "A cursor for use in pagination. This is a date-time value that defines your place in the list based on `created_at` property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at `2020-05-24T13:43:09.024Z`, your subsequent call can include `starting_after=2020-05-24T13:43:09.024Z` in order to fetch the next page of the list. \n\n| **Option** | **Format** | **Sorting** |\n|:---|:---|:---|\n| Return customers **before** a specific creation date | - set `starting_after` parameter to the breakpoint date | Sorting order is **descending**; the most recent dates first and least recent dates last. |\n| Return customers **after** a specific create or update date | - include the `order` parameter set to `created_at` or `updated_at`
                  - set `starting_after` to the breakpoint date | Sorting order is **ascending**; the least recent dates first and the most recent dates last. |\n" - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary with customer objects. The customers are returned sorted by creation date, with the most recent customers appearing first.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/9_res_list_customers" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "customers", - "customers": [ - { - "id": "cust_CSnYd37MXmrbS19XCrghjBsv", - "source_id": "source_123", - "name": "Bob Smith", - "description": "A frequent customer", - "email": "bob.smith@email.com", - "phone": "+1 933 222 3333", - "birthdate": "2022-01-01", - "address": { - "city": "New York", - "state": "NY", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 5", - "country": "United States", - "postal_code": "10001" - }, - "summary": { - "redemptions": { - "total_redeemed": 1, - "total_failed": 0, - "total_succeeded": 1, - "total_rolled_back": 0, - "total_rollback_failed": 0, - "total_rollback_succeeded": 0, - "gift": { - "redeemed_amount": 0, - "amount_to_go": 0 - }, - "loyalty_card": { - "redeemed_points": 0, - "points_to_go": 4200 - } - }, - "orders": { - "total_amount": 1600, - "total_count": 1, - "average_amount": 1600, - "last_order_amount": 1600, - "last_order_date": "2022-08-30T10:17:39.220Z" - } - }, - "loyalty": { - "points": 2200, - "referred_customers": 0, - "campaigns": { - "Christmas Campaign": { - "points": 1000, - "referred_customers": 0 - }, - "Fall Campaign": { - "points": 75, - "referred_customers": 0 - }, - "Winter Campaign": { - "points": 75, - "referred_customers": 0 - }, - "Summer Campaign": { - "points": 50, - "referred_customers": 0 - }, - "Spring Campaign": { - "points": 1000, - "referred_customers": 0 - } - } - }, - "referrals": { - "total": 1, - "campaigns": [ - { - "campaign_id": "camp_rRsfatlwN7unSeUIJDCYedal", - "referrer_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", - "related_object_id": "r_0b9d4c5121d64dd01d", - "related_object_type": "redemption", - "date": "2022-08-30T10:17:41.089Z" - } - ] - }, - "metadata": { - "lang": "en", - "test": true - }, - "system_metadata": {}, - "created_at": "2022-08-30T06:32:07.380Z", - "updated_at": "2022-08-30T10:17:58.049Z", - "object": "customer" - }, - { - "id": "cust_X0hU04x7FeisPnD5lctZcQkI", - "source_id": "jane.smith@email.com", - "name": "Jane Smith", - "description": "A nice customer", - "email": "jane.smith@email.com", - "phone": "+1 933 222 3333", - "birthdate": "2022-01-02", - "address": { - "city": "New Yorke", - "state": "NY", - "line_1": "123 Main Ste.", - "line_2": "APT 3 BLG 4e", - "country": "United Statese", - "postal_code": "10001e" - }, - "summary": { - "redemptions": { - "total_redeemed": 4, - "total_failed": 0, - "total_succeeded": 4, - "total_rolled_back": 1, - "total_rollback_failed": 0, - "total_rollback_succeeded": 1, - "gift": { - "redeemed_amount": 0, - "amount_to_go": 0 - }, - "loyalty_card": { - "redeemed_points": 0, - "points_to_go": 15549 - } - }, - "orders": { - "total_amount": 210000, - "total_count": 3, - "average_amount": 70000, - "last_order_amount": 70000, - "last_order_date": "2022-08-30T11:51:08.029Z" - } - }, - "loyalty": { - "points": 15399, - "referred_customers": 0, - "campaigns": { - "Christmas Campaign": { - "points": 7000, - "referred_customers": 0 - }, - "Fall Campaign": { - "points": 2299, - "referred_customers": 0 - }, - "Winter Campaign": { - "points": 25, - "referred_customers": 0 - }, - "Summer Campaign": { - "points": 75, - "referred_customers": 0 - }, - "Spring Campaign": { - "points": 6000, - "referred_customers": 0 - } - } - }, - "referrals": { - "total": 2, - "campaigns": [ - { - "campaign_id": "camp_rRsfatlwN7unSeUIJDCYedal", - "referrer_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", - "related_object_id": "r_0b9d4cc4aa164dd073", - "related_object_type": "redemption", - "date": "2022-08-30T10:19:39.196Z" - }, - { - "campaign_id": "camp_YDsFdX8TgFtT0RUuKEFyhqs3", - "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", - "related_object_id": "r_0b9d61b6484ead0324", - "related_object_type": "redemption", - "date": "2022-08-30T11:51:10.445Z" - } - ] - }, - "metadata": { - "lang": "en", - "test": false - }, - "system_metadata": {}, - "created_at": "2022-08-09T09:50:53.620Z", - "updated_at": "2022-08-30T11:51:24.327Z", - "object": "customer" + "name": "campaignId", + "in": "path", + "required": true, + "description": "Unique campaign ID or name." + }, + { + "schema": { + "type": "string", + "example": "ltr_mtWowJBBhVYnY8oXaLJ2tUnk" + }, + "name": "tierId", + "in": "path", + "required": true, + "description": "Unique tier ID." + } + ], + "get": { + "operationId": "list-loyalty-tier-rewards", + "tags": [ + "LOYALTIES API" + ], + "summary": "List Loyalty Tier Rewards", + "description": "Get available rewards for a given tier.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary of loyalty tier reward objects.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/8_res_list_loyalty_tier_rewards" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "reward": { + "id": "rew_QuWYsBNB2G3fikffjnl0G3gH", + "name": "API - Testing", + "type": "CAMPAIGN", + "parameters": { + "campaign": { + "id": "camp_jcErmtGAOmHUAy0oUgkwKnPZ", + "balance": 500, + "type": "LOYALTY_PROGRAM" } - ], - "total": 2 - } + }, + "stock": null, + "redeemed": null, + "created_at": "2022-08-25T09:32:04.579424+00:00", + "updated_at": "2022-08-25T09:33:46.680639+00:00", + "metadata": { + "Type": "Second campaign" + }, + "object": "reward" + }, + "assignment": { + "id": "rewa_3Z2sP0bmqcL0ggU28GvFeHU3", + "reward_id": "rew_QuWYsBNB2G3fikffjnl0G3gH", + "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 40 + } + }, + "created_at": "2022-11-23T22:11:58.759092+00:00", + "updated_at": null, + "object": "reward_assignment" + }, + "object": "loyalty_tier_reward" + }, + { + "reward": { + "id": "rew_XoDgmQ2HZX7qPM6aIEuslObo", + "name": "Material", + "type": "MATERIAL", + "parameters": { + "product": { + "id": "prod_0b15f6b9f650c16990", + "sku_id": "sku_0b1621b319d248b79f" + } + }, + "stock": 2, + "redeemed": 1, + "attributes": { + "image_url": "https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_fPH9ohe0pZf4EiIt295sk9Ob.png", + "description": "Archie's Series" + }, + "created_at": "2022-08-29T06:02:36.753873+00:00", + "updated_at": "2022-11-08T08:01:26.883166+00:00", + "metadata": { + "Type": "Material" + }, + "object": "reward" + }, + "assignment": { + "id": "rewa_Or6gWZ5ASuGkBLjOf0IyiD4k", + "reward_id": "rew_XoDgmQ2HZX7qPM6aIEuslObo", + "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "related_object_type": "campaign", + "parameters": { + "loyalty": { + "points": 30 + } + }, + "created_at": "2022-11-23T22:11:58.759092+00:00", + "updated_at": null, + "object": "reward_assignment" + }, + "object": "loyalty_tier_reward" + }, + { + "reward": { + "id": "rew_MVXA2kV7lZ1zC057WUaTrvNz", + "name": "100 Points = $20", + "type": "COIN", + "parameters": { + "coin": { + "exchange_ratio": 20, + "points_ratio": 100 + } + }, + "stock": null, + "redeemed": null, + "attributes": {}, + "created_at": "2022-09-09T06:41:54.496035+00:00", + "updated_at": null, + "metadata": {}, + "object": "reward" + }, + "assignment": { + "id": "rewa_nMXB59qGTNYawMT8eP8M4oUp", + "reward_id": "rew_MVXA2kV7lZ1zC057WUaTrvNz", + "related_object_id": "camp_fkZ28pe7DUAEmmabofkxHI8N", + "related_object_type": "campaign", + "created_at": "2022-11-09T11:01:21.065681+00:00", + "updated_at": null, + "object": "reward_assignment" + }, + "object": "loyalty_tier_reward" } - } + ], + "total": 3 } } } } - }, - "post": { - "operationId": "create-customer", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Create Customer", - "description": "Creates a customer object.\n\n\n\n> 📘 Upsert Mode\n>\n> If you pass a `source_id` that already exists in the customer database, Voucherify will return a related customer object with updated fields.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + } + } + } + } + }, + "/v1/customer-object": { + "get": { + "operationId": "customer-object", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Customer Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Customer Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/9_obj_customer_object" } - ], - "requestBody": { - "description": "Create a customer with specified parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/9_req_create_customer" - }, - "examples": { - "Example": { - "value": { + } + } + } + } + } + }, + "/v1/customer-activity-object": { + "get": { + "operationId": "customer-activity-object", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Customer Activity Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Customer Activity Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/9_obj_customer_activity_object" + } + } + } + } + } + } + }, + "/v1/customers": { + "get": { + "operationId": "list-customers", + "tags": [ + "CUSTOMERS API" + ], + "summary": "List Customers", + "description": "Returns a list of customers.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "email", + "description": "Limit the customers to the ones that have this specific email address." + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "description": "Limit the customers to the ones that are located in the specified city.", + "name": "city" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "description": "Filter customers by the name property.", + "name": "name" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at", + "source_id", + "-source_id" + ] + }, + "in": "query", + "name": "order", + "description": "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." + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "starting_after", + "description": "A cursor for use in pagination. This is a date-time value that defines your place in the list based on `created_at` property from the customer object. For instance, if you make a list request and receive 100 objects, ending with an object created at `2020-05-24T13:43:09.024Z`, your subsequent call can include `starting_after=2020-05-24T13:43:09.024Z` in order to fetch the next page of the list. \n\n| **Option** | **Format** | **Sorting** |\n|:---|:---|:---|\n| Return customers **before** a specific creation date | - set `starting_after` parameter to the breakpoint date | Sorting order is **descending**; the most recent dates first and least recent dates last. |\n| Return customers **after** a specific create or update date | - include the `order` parameter set to `created_at` or `updated_at`
                  - set `starting_after` to the breakpoint date | Sorting order is **ascending**; the least recent dates first and the most recent dates last. |\n" + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with customer objects. The customers are returned sorted by creation date, with the most recent customers appearing first.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/9_res_list_customers" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "customers", + "customers": [ + { + "id": "cust_CSnYd37MXmrbS19XCrghjBsv", "source_id": "source_123", "name": "Bob Smith", "description": "A frequent customer", "email": "bob.smith@email.com", "phone": "+1 933 222 3333", + "birthdate": "2022-01-01", "address": { "city": "New York", - "country": "United States", + "state": "NY", "line_1": "123 Main St.", - "line_2": "APT 3 BLG 4", - "postal_code": "10001", - "state": "NY" + "line_2": "APT 3 BLG 5", + "country": "United States", + "postal_code": "10001" + }, + "summary": { + "redemptions": { + "total_redeemed": 1, + "total_failed": 0, + "total_succeeded": 1, + "total_rolled_back": 0, + "total_rollback_failed": 0, + "total_rollback_succeeded": 0, + "gift": { + "redeemed_amount": 0, + "amount_to_go": 0 + }, + "loyalty_card": { + "redeemed_points": 0, + "points_to_go": 4200 + } + }, + "orders": { + "total_amount": 1600, + "total_count": 1, + "average_amount": 1600, + "last_order_amount": 1600, + "last_order_date": "2022-08-30T10:17:39.220Z" + } + }, + "loyalty": { + "points": 2200, + "referred_customers": 0, + "campaigns": { + "Christmas Campaign": { + "points": 1000, + "referred_customers": 0 + }, + "Fall Campaign": { + "points": 75, + "referred_customers": 0 + }, + "Winter Campaign": { + "points": 75, + "referred_customers": 0 + }, + "Summer Campaign": { + "points": 50, + "referred_customers": 0 + }, + "Spring Campaign": { + "points": 1000, + "referred_customers": 0 + } + } + }, + "referrals": { + "total": 1, + "campaigns": [ + { + "campaign_id": "camp_rRsfatlwN7unSeUIJDCYedal", + "referrer_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", + "related_object_id": "r_0b9d4c5121d64dd01d", + "related_object_type": "redemption", + "date": "2022-08-30T10:17:41.089Z" + } + ] }, "metadata": { "lang": "en", "test": true }, - "birthdate": "2022-01-01" + "system_metadata": {}, + "created_at": "2022-08-30T06:32:07.380Z", + "updated_at": "2022-08-30T10:17:58.049Z", + "object": "customer" + }, + { + "id": "cust_X0hU04x7FeisPnD5lctZcQkI", + "source_id": "jane.smith@email.com", + "name": "Jane Smith", + "description": "A nice customer", + "email": "jane.smith@email.com", + "phone": "+1 933 222 3333", + "birthdate": "2022-01-02", + "address": { + "city": "New Yorke", + "state": "NY", + "line_1": "123 Main Ste.", + "line_2": "APT 3 BLG 4e", + "country": "United Statese", + "postal_code": "10001e" + }, + "summary": { + "redemptions": { + "total_redeemed": 4, + "total_failed": 0, + "total_succeeded": 4, + "total_rolled_back": 1, + "total_rollback_failed": 0, + "total_rollback_succeeded": 1, + "gift": { + "redeemed_amount": 0, + "amount_to_go": 0 + }, + "loyalty_card": { + "redeemed_points": 0, + "points_to_go": 15549 + } + }, + "orders": { + "total_amount": 210000, + "total_count": 3, + "average_amount": 70000, + "last_order_amount": 70000, + "last_order_date": "2022-08-30T11:51:08.029Z" + } + }, + "loyalty": { + "points": 15399, + "referred_customers": 0, + "campaigns": { + "Christmas Campaign": { + "points": 7000, + "referred_customers": 0 + }, + "Fall Campaign": { + "points": 2299, + "referred_customers": 0 + }, + "Winter Campaign": { + "points": 25, + "referred_customers": 0 + }, + "Summer Campaign": { + "points": 75, + "referred_customers": 0 + }, + "Spring Campaign": { + "points": 6000, + "referred_customers": 0 + } + } + }, + "referrals": { + "total": 2, + "campaigns": [ + { + "campaign_id": "camp_rRsfatlwN7unSeUIJDCYedal", + "referrer_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Zi", + "related_object_id": "r_0b9d4cc4aa164dd073", + "related_object_type": "redemption", + "date": "2022-08-30T10:19:39.196Z" + }, + { + "campaign_id": "camp_YDsFdX8TgFtT0RUuKEFyhqs3", + "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", + "related_object_id": "r_0b9d61b6484ead0324", + "related_object_type": "redemption", + "date": "2022-08-30T11:51:10.445Z" + } + ] + }, + "metadata": { + "lang": "en", + "test": false + }, + "system_metadata": {}, + "created_at": "2022-08-09T09:50:53.620Z", + "updated_at": "2022-08-30T11:51:24.327Z", + "object": "customer" } - } + ], + "total": 2 } } } + } + } + } + } + }, + "post": { + "operationId": "create-customer", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Create Customer", + "description": "Creates a customer object.\n\n\n\n> 📘 Upsert Mode\n>\n> If you pass a `source_id` that already exists in the customer database, Voucherify will return a related customer object with updated fields.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Create a customer with specified parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/9_req_create_customer" }, - "responses": { - "200": { - "description": "Returns a customer object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/9_obj_customer_object" - }, - "examples": { - "Example": { - "value": { - "id": "cust_CSnYd37MXmrbS19XCrghjBsv", - "source_id": "source_123", - "name": "Bob Smith", - "description": "A frequent customer", - "email": "bob.smith@email.com", - "phone": "+1 933 222 3333", - "birthdate": "2022-01-01", - "address": { - "city": "New York", - "state": "NY", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 4", - "country": "United States", - "postal_code": "10001" - }, - "summary": { - "redemptions": { - "total_redeemed": 0, - "total_failed": 0, - "total_succeeded": 0, - "total_rolled_back": 0, - "total_rollback_failed": 0, - "total_rollback_succeeded": 0, - "gift": { - "redeemed_amount": 0, - "amount_to_go": 0 - }, - "loyalty_card": { - "redeemed_points": 0, - "points_to_go": 0 - } - }, - "orders": { - "total_amount": 0, - "total_count": 0, - "average_amount": 0, - "last_order_amount": 0 - } - }, - "loyalty": { - "points": 0, - "referred_customers": 0, - "campaigns": {} - }, - "referrals": { - "total": 0, - "campaigns": [] - }, - "metadata": { - "lang": "en", - "test": true - }, - "system_metadata": {}, - "created_at": "2022-08-30T06:32:07.380Z", - "object": "customer" + "examples": { + "Example": { + "value": { + "source_id": "source_123", + "name": "Bob Smith", + "description": "A frequent customer", + "email": "bob.smith@email.com", + "phone": "+1 933 222 3333", + "address": { + "city": "New York", + "country": "United States", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 4", + "postal_code": "10001", + "state": "NY" + }, + "metadata": { + "lang": "en", + "test": true + }, + "birthdate": "2022-01-01" + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a customer object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/9_obj_customer_object" + }, + "examples": { + "Example": { + "value": { + "id": "cust_CSnYd37MXmrbS19XCrghjBsv", + "source_id": "source_123", + "name": "Bob Smith", + "description": "A frequent customer", + "email": "bob.smith@email.com", + "phone": "+1 933 222 3333", + "birthdate": "2022-01-01", + "address": { + "city": "New York", + "state": "NY", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 4", + "country": "United States", + "postal_code": "10001" + }, + "summary": { + "redemptions": { + "total_redeemed": 0, + "total_failed": 0, + "total_succeeded": 0, + "total_rolled_back": 0, + "total_rollback_failed": 0, + "total_rollback_succeeded": 0, + "gift": { + "redeemed_amount": 0, + "amount_to_go": 0 + }, + "loyalty_card": { + "redeemed_points": 0, + "points_to_go": 0 } + }, + "orders": { + "total_amount": 0, + "total_count": 0, + "average_amount": 0, + "last_order_amount": 0 } - } + }, + "loyalty": { + "points": 0, + "referred_customers": 0, + "campaigns": {} + }, + "referrals": { + "total": 0, + "campaigns": [] + }, + "metadata": { + "lang": "en", + "test": true + }, + "system_metadata": {}, + "created_at": "2022-08-30T06:32:07.380Z", + "object": "customer" } } } } } + } + } + } + }, + "/v1/customers/{customerId}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "cust_J1CDUdbqn5Exva8ASWk1Fq0j" }, - "/v1/customers/{customerId}": { - "parameters": [ - { + "name": "customerId", + "in": "path", + "required": true, + "description": "A Voucherify customer ID or `source_id`." + } + ], + "get": { + "operationId": "get-customer", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Get Customer", + "description": "Retrieve customer details.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a customer object if a valid identifier was provided.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "cust_J1CDUdbqn5Exva8ASWk1Fq0j" + "$ref": "#/components/schemas/9_obj_customer_object" }, - "name": "customerId", - "in": "path", - "required": true, - "description": "A Voucherify customer ID or `source_id`." - } - ], - "get": { - "operationId": "get-customer", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Get Customer", - "description": "Retrieve customer details.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a customer object if a valid identifier was provided.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/9_obj_customer_object" - }, - "examples": { - "Example": { - "value": { - "id": "cust_T849EgzNVVmn5icJ2FAkT2rO", - "source_id": "alice.morgan@email.com", - "name": "Alice Morgan", - "email": "alice.morgan@email.com", - "address": null, - "summary": { - "redemptions": { - "total_redeemed": 2, - "total_failed": 0, - "total_succeeded": 2, - "total_rolled_back": 0, - "total_rollback_failed": 0, - "total_rollback_succeeded": 0, - "gift": { - "redeemed_amount": 0, - "amount_to_go": 0 - }, - "loyalty_card": { - "redeemed_points": 0, - "points_to_go": 3303 - } - }, - "orders": { - "total_amount": 203900, - "total_count": 2, - "average_amount": 101950, - "last_order_amount": 3900, - "last_order_date": "2022-07-26T14:59:52.814Z" - } - }, - "loyalty": { - "points": 3303, - "referred_customers": 0, - "campaigns": { - "Summer Campaign": { - "points": 3303, - "referred_customers": 0 - } - } - }, - "referrals": { - "total": 0, - "campaigns": [] - }, - "system_metadata": {}, - "created_at": "2022-02-07T08:28:23.644Z", - "updated_at": "2022-07-26T14:59:59.806Z", - "assets": { - "cockpit_url": "https://www.url.com" - }, - "object": "customer" + "examples": { + "Example": { + "value": { + "id": "cust_T849EgzNVVmn5icJ2FAkT2rO", + "source_id": "alice.morgan@email.com", + "name": "Alice Morgan", + "email": "alice.morgan@email.com", + "address": null, + "summary": { + "redemptions": { + "total_redeemed": 2, + "total_failed": 0, + "total_succeeded": 2, + "total_rolled_back": 0, + "total_rollback_failed": 0, + "total_rollback_succeeded": 0, + "gift": { + "redeemed_amount": 0, + "amount_to_go": 0 + }, + "loyalty_card": { + "redeemed_points": 0, + "points_to_go": 3303 } + }, + "orders": { + "total_amount": 203900, + "total_count": 2, + "average_amount": 101950, + "last_order_amount": 3900, + "last_order_date": "2022-07-26T14:59:52.814Z" } - } - } - } - }, - "404": { - "description": "Not Found. When requesting the ID of a customer that has been deleted or does not exist in the system, the resource will not be returned.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find customer with id cust_sehkNIi8Uq2qQuRqSr7xn4Z", - "request_id": "v-0b4c590350857970df", - "resource_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Z", - "resource_type": "customer" + }, + "loyalty": { + "points": 3303, + "referred_customers": 0, + "campaigns": { + "Summer Campaign": { + "points": 3303, + "referred_customers": 0 } } - } + }, + "referrals": { + "total": 0, + "campaigns": [] + }, + "system_metadata": {}, + "created_at": "2022-02-07T08:28:23.644Z", + "updated_at": "2022-07-26T14:59:59.806Z", + "assets": { + "cockpit_url": "https://www.url.com" + }, + "object": "customer" } } } } - }, - "delete": { - "operationId": "delete-customer", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Delete Customer", - "description": "This method deletes a customer.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." - }, - "404": { - "description": "Returns an error indicating that the customer with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Customer Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find customer with id cust_7pm0hh0yemiydeFsdYXZlr1", - "request_id": "v-0ae398fd9ac683dc84", - "resource_id": "cust_7pm0hh0yemiydeFsdYXZlr1", - "resource_type": "customer" - } - } - } + } + }, + "404": { + "description": "Not Found. When requesting the ID of a customer that has been deleted or does not exist in the system, the resource will not be returned.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find customer with id cust_sehkNIi8Uq2qQuRqSr7xn4Z", + "request_id": "v-0b4c590350857970df", + "resource_id": "cust_sehkNIi8Uq2qQuRqSr7xn4Z", + "resource_type": "customer" } } } } - }, - "put": { - "operationId": "update-customer", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Update Customer", - "description": "Updates the specified customer by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the parameters to be updated.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/9_req_update_customer" - }, - "examples": { - "Example": { - "value": { - "name": "Alice McDonald", - "email": "alice.mdconald@email.com", - "description": "Updating customer data", - "phone": "+1 (132) 222-2222", - "address": { - "city": "New York", - "country": "United States", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 4", - "postal_code": "10001", - "state": "NY" - }, - "metadata": { - "lang": "en", - "test": true - }, - "birthdate": "2022-01-01", - "birthday": "2022-01-02" - } - } + } + } + } + }, + "delete": { + "operationId": "delete-customer", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Delete Customer", + "description": "This method deletes a customer.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." + }, + "404": { + "description": "Returns an error indicating that the customer with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Customer Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find customer with id cust_7pm0hh0yemiydeFsdYXZlr1", + "request_id": "v-0ae398fd9ac683dc84", + "resource_id": "cust_7pm0hh0yemiydeFsdYXZlr1", + "resource_type": "customer" } } } + } + } + } + } + }, + "put": { + "operationId": "update-customer", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Update Customer", + "description": "Updates the specified customer by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the parameters to be updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/9_req_update_customer" }, - "responses": { - "200": { - "description": "Returns a customer object if updates were successful.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/9_obj_customer_object" - }, - "examples": { - "Example": { - "value": { - "id": "cust_T849EgzNVVmn5icJ2FAkT2rO", - "source_id": "alice@morgan.com", - "name": "Alice McDonald", - "description": "Updating customer data", - "email": "alice.mdconald@email.com", - "phone": "+1 (132) 222-2222", - "birthday": "2022-01-02", - "birthdate": "2022-01-01", - "address": { - "city": "New York", - "state": "NY", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 4", - "country": "United States", - "postal_code": "10001" - }, - "summary": { - "redemptions": { - "total_redeemed": 2, - "total_failed": 0, - "total_succeeded": 2, - "total_rolled_back": 0, - "total_rollback_failed": 0, - "total_rollback_succeeded": 0, - "gift": { - "redeemed_amount": 0, - "amount_to_go": 0 - }, - "loyalty_card": { - "redeemed_points": 0, - "points_to_go": 4428 - } - }, - "orders": { - "total_amount": 203900, - "total_count": 2, - "average_amount": 101950, - "last_order_amount": 3900, - "last_order_date": "2022-07-26T14:59:52.814Z" - } - }, - "loyalty": { - "points": 3403, - "referred_customers": 0, - "campaigns": { - "Summer Campaign": { - "points": 0, - "referred_customers": 0 - }, - "Spring Campaign": { - "points": 50, - "referred_customers": 0 - }, - "Fall Campaign": { - "points": 50, - "referred_customers": 0 - }, - "Winter Campaign": { - "points": 3303, - "referred_customers": 0 - } - } - }, - "referrals": { - "total": 0, - "campaigns": [] - }, - "metadata": { - "lang": "en", - "test": true - }, - "system_metadata": {}, - "created_at": "2022-02-07T08:28:23.644Z", - "updated_at": "2022-08-31T09:58:30.475Z", - "object": "customer" - } - } - } - } - } - }, - "404": { - "description": "Returns an error indicating that a customer with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Example": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find customer with id alice2@morgan.com", - "request_id": "v-0b9e924dd243bf26e2", - "resource_id": "alice2@morgan.com", - "resource_type": "customer" - } - } - } - } + "examples": { + "Example": { + "value": { + "name": "Alice McDonald", + "email": "alice.mdconald@email.com", + "description": "Updating customer data", + "phone": "+1 (132) 222-2222", + "address": { + "city": "New York", + "country": "United States", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 4", + "postal_code": "10001", + "state": "NY" + }, + "metadata": { + "lang": "en", + "test": true + }, + "birthdate": "2022-01-01", + "birthday": "2022-01-02" } } } } - }, - "/v1/customers/{customerId}/permanent-deletion": { - "parameters": [ - { + } + }, + "responses": { + "200": { + "description": "Returns a customer object if updates were successful.", + "content": { + "application/json": { "schema": { - "type": "string" + "$ref": "#/components/schemas/9_obj_customer_object" }, - "name": "customerId", - "in": "path", - "required": true, - "description": "A Voucherify customer ID or `source_id`." - } - ], - "post": { - "operationId": "delete-customer-permanently", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Delete Customer Permanently", - "description": "The organization user can remove consumer data permanently from the Voucherify system by using this API method. It d​eletes all customer data and connected resources. It makes the customer profile forgotten by Voucherify.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a permanent deletion object and status of the deletion.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/customers_permanent_deletion_response_body" - }, - "examples": { - "Example": { - "value": { - "id": "del_7k3buMvBsJuXiLRmdh1WZvZs", - "created_at": "2022-09-02T17:50:29.302Z", - "related_object_id": "cust_XI8sPLvznzVpNI1BMIWGcUJa", - "related_object": "customer", - "status": "DONE", - "data_json": { - "events": 16, - "customer_events": 28, - "daily_events": 0, - "segments": 0, - "orders": 9, - "order_events": 5, - "customer": 1 - }, - "object": "pernament_deletion" + "examples": { + "Example": { + "value": { + "id": "cust_T849EgzNVVmn5icJ2FAkT2rO", + "source_id": "alice@morgan.com", + "name": "Alice McDonald", + "description": "Updating customer data", + "email": "alice.mdconald@email.com", + "phone": "+1 (132) 222-2222", + "birthday": "2022-01-02", + "birthdate": "2022-01-01", + "address": { + "city": "New York", + "state": "NY", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 4", + "country": "United States", + "postal_code": "10001" + }, + "summary": { + "redemptions": { + "total_redeemed": 2, + "total_failed": 0, + "total_succeeded": 2, + "total_rolled_back": 0, + "total_rollback_failed": 0, + "total_rollback_succeeded": 0, + "gift": { + "redeemed_amount": 0, + "amount_to_go": 0 + }, + "loyalty_card": { + "redeemed_points": 0, + "points_to_go": 4428 } + }, + "orders": { + "total_amount": 203900, + "total_count": 2, + "average_amount": 101950, + "last_order_amount": 3900, + "last_order_date": "2022-07-26T14:59:52.814Z" } - } - } - } - }, - "404": { - "description": "Returns an error indicating that a customer with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find customer with id cust_W8n9I8pJDXlM69j49iKJeYp", - "request_id": "v-0b4c62635a154e96f1", - "resource_id": "cust_W8n9I8pJDXlM69j49iKJeYp", - "resource_type": "customer" + }, + "loyalty": { + "points": 3403, + "referred_customers": 0, + "campaigns": { + "Summer Campaign": { + "points": 0, + "referred_customers": 0 + }, + "Spring Campaign": { + "points": 50, + "referred_customers": 0 + }, + "Fall Campaign": { + "points": 50, + "referred_customers": 0 + }, + "Winter Campaign": { + "points": 3303, + "referred_customers": 0 } } - } + }, + "referrals": { + "total": 0, + "campaigns": [] + }, + "metadata": { + "lang": "en", + "test": true + }, + "system_metadata": {}, + "created_at": "2022-02-07T08:28:23.644Z", + "updated_at": "2022-08-31T09:58:30.475Z", + "object": "customer" } } } } } }, - "/v1/customers/importCSV": { - "post": { - "operationId": "import-customers-using-csv", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Import and Update Customers using CSV", - "description": "This API method lets you import or update customer data. To get a proper and valid response, please send a CSV file with data separated by commas. \n\n## Request Example\n\n```cURL\ncurl -X POST \\\n https://api.voucherify.io/v1/customers/importCSV \\\n -F file=@/path/to/customers.csv \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\"\n```\n## CSV File Format\n\nThe CSV file has to include headers in the first line. All properties which cannot be mapped to standard customer fields will be added to the metadata object.\n\n\n> 📘 Standard customer fields mapping\n>\n> **No spaces allowed in field names** \n> Name, Email, Phone, Birthdate, Source_id, Address_line_1, Address_line_2, Address_Postal_Code, Address_City, Address_State, Address_Country, Description, Metadata_name_1, Metadata_name_2\n\n## Update Customers using CSV\n\nIf you would like to update customer's data, you can do it using the CSV file with new data. However, remember to include a `source_id` in your CSV file to manage the update successfully.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "The file path is stored in the form `file` header.", - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/a_req_importCSV" - }, - "examples": {} + "404": { + "description": "Returns an error indicating that a customer with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Example": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find customer with id alice2@morgan.com", + "request_id": "v-0b9e924dd243bf26e2", + "resource_id": "alice2@morgan.com", + "resource_type": "customer" + } } } - }, - "responses": { - "202": { - "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and customers will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" + } + } + } + } + } + }, + "/v1/customers/{customerId}/permanent-deletion": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "customerId", + "in": "path", + "required": true, + "description": "A Voucherify customer ID or `source_id`." + } + ], + "post": { + "operationId": "delete-customer-permanently", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Delete Customer Permanently", + "description": "The organization user can remove consumer data permanently from the Voucherify system by using this API method. It d​eletes all customer data and connected resources. It makes the customer profile forgotten by Voucherify.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a permanent deletion object and status of the deletion.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/customers_permanent_deletion_response_body" + }, + "examples": { + "Example": { + "value": { + "id": "del_7k3buMvBsJuXiLRmdh1WZvZs", + "created_at": "2022-09-02T17:50:29.302Z", + "related_object_id": "cust_XI8sPLvznzVpNI1BMIWGcUJa", + "related_object": "customer", + "status": "DONE", + "data_json": { + "events": 16, + "customer_events": 28, + "daily_events": 0, + "segments": 0, + "orders": 9, + "order_events": 5, + "customer": 1 }, - "examples": { - "Example": { - "value": { - "async_action_id": "aa_0a875d56c805df6601" - } - } - } + "object": "pernament_deletion" } } } } } }, - "/v1/customers/bulk/async": { - "post": { - "operationId": "update-customers-in-bulk", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Update Customers in bulk", - "description": "Update several customers in one asynchronous operation. \n\nIn one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. \n\nIf a requested customer object is not found, then an **upsert** occurs. This is reflected in the [Get Async Action](ref:get-async-action) endpoint as follows: \n\n\n```json\n{\n \"found\": false,\n \"updated\": true\n}\n```\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the customer fields that you would like to update in each customer object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/customers_update_in_bulk_request_body" - }, - "examples": { - "Example": { - "value": [ - { - "source_id": "John.Smith@email.com", - "name": "John Smith", - "email": "john.smith@email.com", - "description": "Updating customer data", - "phone": "+1 (132) 222-2222", - "address": { - "city": "New York", - "country": "United States", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 4", - "postal_code": "10001", - "state": "NY" - }, - "metadata": { - "lang": "en", - "test": true - }, - "birthday": "2022-04-04" - }, - { - "source_id": "Jane.Smith@email.com", - "name": "Jane Smith", - "email": "Jane.Smith@email.com", - "description": "Updating customer data", - "phone": "+1 (132) 222-2222", - "address": { - "city": "New York", - "country": "United States", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 4", - "postal_code": "10001", - "state": "NY" - }, - "metadata": { - "lang": "en", - "test": true - }, - "birthday": "2022-03-03" - }, - { - "source_id": "Sally.Smith@email.com", - "name": "Sally Smith", - "email": "Sally.Smith@email.com", - "description": "Updating customer data", - "phone": "+1 (132) 222-2222", - "address": { - "city": "New York", - "country": "United States", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 4", - "postal_code": "10001", - "state": "NY" - }, - "metadata": { - "lang": "en", - "test": true - }, - "birthdate": "2022-02-02" - } - ] - } + "404": { + "description": "Returns an error indicating that a customer with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find customer with id cust_W8n9I8pJDXlM69j49iKJeYp", + "request_id": "v-0b4c62635a154e96f1", + "resource_id": "cust_W8n9I8pJDXlM69j49iKJeYp", + "resource_type": "customer" } } } + } + } + } + } + } + }, + "/v1/customers/importCSV": { + "post": { + "operationId": "import-customers-using-csv", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Import and Update Customers using CSV", + "description": "This API method lets you import or update customer data. To get a proper and valid response, please send a CSV file with data separated by commas. \n\n## Request Example\n\n```cURL\ncurl -X POST \\\n https://api.voucherify.io/v1/customers/importCSV \\\n -F file=@/path/to/customers.csv \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\"\n```\n## CSV File Format\n\nThe CSV file has to include headers in the first line. All properties which cannot be mapped to standard customer fields will be added to the metadata object.\n\n\n> 📘 Standard customer fields mapping\n>\n> **No spaces allowed in field names** \n> Name, Email, Phone, Birthdate, Source_id, Address_line_1, Address_line_2, Address_Postal_Code, Address_City, Address_State, Address_Country, Description, Metadata_name_1, Metadata_name_2\n\n## Update Customers using CSV\n\nIf you would like to update customer's data, you can do it using the CSV file with new data. However, remember to include a `source_id` in your CSV file to manage the update successfully.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "The file path is stored in the form `file` header.", + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/a_req_importCSV" }, - "responses": { - "202": { - "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and customers will be updated in the repository asynchronously. To check the update status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" - } + "examples": {} + } + } + }, + "responses": { + "202": { + "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and customers will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" + }, + "examples": { + "Example": { + "value": { + "async_action_id": "aa_0a875d56c805df6601" } } - }, - "400": { - "description": "Returns an error if metadata fields are incorrect data type or a customer's source ID is missing in the request body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" + } + } + } + } + } + } + }, + "/v1/customers/bulk/async": { + "post": { + "operationId": "update-customers-in-bulk", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Update Customers in bulk", + "description": "Update several customers in one asynchronous operation. \n\nIn one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. \n\nIf a requested customer object is not found, then an **upsert** occurs. This is reflected in the [Get Async Action](ref:get-async-action) endpoint as follows: \n\n\n```json\n{\n \"found\": false,\n \"updated\": true\n}\n```\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the customer fields that you would like to update in each customer object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/customers_update_in_bulk_request_body" + }, + "examples": { + "Example": { + "value": [ + { + "source_id": "John.Smith@email.com", + "name": "John Smith", + "email": "john.smith@email.com", + "description": "Updating customer data", + "phone": "+1 (132) 222-2222", + "address": { + "city": "New York", + "country": "United States", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 4", + "postal_code": "10001", + "state": "NY" }, - "examples": { - "Metadata validation failed": { - "value": { - "code": 400, - "key": "metadata_validation_failed", - "message": "Metadata validation failed", - "details": "acquisition_channel: must be a string, property is required, must be equal to one of Facebook,Twitter,Website (actual value is 'true')", - "request_id": "v-0afb29d91094432cea" - } - }, - "Invalid payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Payload should have required property 'source_id'", - "request_id": "v-0ba51a2f5ec3bf76de" - } - } - } + "metadata": { + "lang": "en", + "test": true + }, + "birthday": "2022-04-04" + }, + { + "source_id": "Jane.Smith@email.com", + "name": "Jane Smith", + "email": "Jane.Smith@email.com", + "description": "Updating customer data", + "phone": "+1 (132) 222-2222", + "address": { + "city": "New York", + "country": "United States", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 4", + "postal_code": "10001", + "state": "NY" + }, + "metadata": { + "lang": "en", + "test": true + }, + "birthday": "2022-03-03" + }, + { + "source_id": "Sally.Smith@email.com", + "name": "Sally Smith", + "email": "Sally.Smith@email.com", + "description": "Updating customer data", + "phone": "+1 (132) 222-2222", + "address": { + "city": "New York", + "country": "United States", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 4", + "postal_code": "10001", + "state": "NY" + }, + "metadata": { + "lang": "en", + "test": true + }, + "birthdate": "2022-02-02" } - } + ] + } + } + } + } + }, + "responses": { + "202": { + "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and customers will be updated in the repository asynchronously. To check the update status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" + } + } + } + }, + "400": { + "description": "Returns an error if metadata fields are incorrect data type or a customer's source ID is missing in the request body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" }, - "429": { - "description": "Too Many Requests", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "code": { - "type": "string", - "default": 429 - }, - "message": { - "type": "string", - "default": "Too many requests hit the API too quickly." - } - } - } + "examples": { + "Metadata validation failed": { + "value": { + "code": 400, + "key": "metadata_validation_failed", + "message": "Metadata validation failed", + "details": "acquisition_channel: must be a string, property is required, must be equal to one of Facebook,Twitter,Website (actual value is 'true')", + "request_id": "v-0afb29d91094432cea" + } + }, + "Invalid payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Payload should have required property 'source_id'", + "request_id": "v-0ba51a2f5ec3bf76de" } } } } } }, - "/v1/customers/metadata/async": { - "post": { - "operationId": "update-customers-metadata-in-bulk", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Update Customers' Metadata in bulk", - "description": "Update several customers metadata properties in one asynchronous operation. \n\nIn one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. \n\nIf a requested customer object is not found, then an **upsert** occurs. This is reflected in the [Get Async Action](ref:get-async-action) endpoint as follows: \n\n\n```json\n{\n \"found\": false,\n \"updated\": true\n}\n```\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "List the `source_ids` of the customer's you would like to update along with the metadata key value pairs.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/customers_update_metadata_in_bulk_request_body" + "429": { + "description": "Too Many Requests", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "default": 429 }, - "examples": { - "Example": { - "value": { - "source_ids": [ - "source_123", - "source_456" - ], - "metadata": { - "lang": "en", - "test": false - } - } - } + "message": { + "type": "string", + "default": "Too many requests hit the API too quickly." } } } + } + } + } + } + } + }, + "/v1/customers/metadata/async": { + "post": { + "operationId": "update-customers-metadata-in-bulk", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Update Customers' Metadata in bulk", + "description": "Update several customers metadata properties in one asynchronous operation. \n\nIn one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. \n\nIf a requested customer object is not found, then an **upsert** occurs. This is reflected in the [Get Async Action](ref:get-async-action) endpoint as follows: \n\n\n```json\n{\n \"found\": false,\n \"updated\": true\n}\n```\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "List the `source_ids` of the customer's you would like to update along with the metadata key value pairs.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/customers_update_metadata_in_bulk_request_body" }, - "responses": { - "202": { - "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and customers will be updated in the repository asynchronously. To check the update status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" - }, - "examples": { - "Example": { - "value": { - "async_action_id": "aa_0a875d56c805df6601" - } - } - } + "examples": { + "Example": { + "value": { + "source_ids": [ + "source_123", + "source_456" + ], + "metadata": { + "lang": "en", + "test": false } } + } + } + } + } + }, + "responses": { + "202": { + "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and customers will be updated in the repository asynchronously. To check the update status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" }, - "400": { - "description": "An error will be returned when submitting a request with no source IDs or missing metadata.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Not enough source IDs": { - "value": { - "code": 400, - "key": "not_enough_source_ids", - "message": "Not enough source_ids", - "details": "Specify at least 1 source_id", - "request_id": "v-0ba50abf2843bf6585" - } - }, - "Invalid Payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Payload should have required property 'metadata'", - "request_id": "v-0ba50c720789984b5c" - } - } - } + "examples": { + "Example": { + "value": { + "async_action_id": "aa_0a875d56c805df6601" } } } } } }, - "/v1/customers/{customerId}/consents": { - "parameters": [ - { + "400": { + "description": "An error will be returned when submitting a request with no source IDs or missing metadata.", + "content": { + "application/json": { "schema": { - "type": "string" + "$ref": "#/components/schemas/e_error_no_translation" }, - "name": "customerId", - "in": "path", - "required": true, - "description": "A Voucherify unique customer identifier or source ID." - } - ], - "put": { - "operationId": "update-customers-consents", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Update Customer's consents", - "description": "Update marketing permissions for the specified customer.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "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. \n\n#### Examples\n\n\n```json\n{\n \"cnst_aIdUulAh0SCsOCaS3005y7yS\": true,\n \"cnst_aIdUulAhwewqaS31213fdsfds\": false\n}\n```\n\nOpt-out from all communication:\n\n\n```json\n{\n \"unsubscribed\": true\n}\n```", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/9_req_update_customers_consents" - }, - "examples": { - "Example": { - "value": { - "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I": true, - "cnst_VCmucIvAsmDYw2PPAok6bcYy": false - } - }, - "Opt-out of all": { - "value": { - "unsubscribed": true - } - } + "examples": { + "Not enough source IDs": { + "value": { + "code": 400, + "key": "not_enough_source_ids", + "message": "Not enough source_ids", + "details": "Specify at least 1 source_id", + "request_id": "v-0ba50abf2843bf6585" + } + }, + "Invalid Payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Payload should have required property 'metadata'", + "request_id": "v-0ba50c720789984b5c" } } } + } + } + } + } + } + }, + "/v1/customers/{customerId}/consents": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "customerId", + "in": "path", + "required": true, + "description": "A Voucherify unique customer identifier or source ID." + } + ], + "put": { + "operationId": "update-customers-consents", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Update Customer's consents", + "description": "Update marketing permissions for the specified customer.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "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. \n\n#### Examples\n\n\n```json\n{\n \"cnst_aIdUulAh0SCsOCaS3005y7yS\": true,\n \"cnst_aIdUulAhwewqaS31213fdsfds\": false\n}\n```\n\nOpt-out from all communication:\n\n\n```json\n{\n \"unsubscribed\": true\n}\n```", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/9_req_update_customers_consents" }, - "responses": { - "204": { - "description": "Returns no content if the consents were updated successfully." + "examples": { + "Example": { + "value": { + "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I": true, + "cnst_VCmucIvAsmDYw2PPAok6bcYy": false + } }, - "400": { - "description": "Returns an error if the payload is empty.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Example": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "The payload cannot be empty", - "request_id": "v-0ba675252cc3bf6b03" - } - } - } - } + "Opt-out of all": { + "value": { + "unsubscribed": true } } } } + } + }, + "responses": { + "204": { + "description": "Returns no content if the consents were updated successfully." }, - "/client/v1/customers/{customerId}/consents#": { - "parameters": [ - { + "400": { + "description": "Returns an error if the payload is empty.", + "content": { + "application/json": { "schema": { - "type": "string" + "$ref": "#/components/schemas/e_error_no_translation" }, - "name": "customerId", - "in": "path", - "required": true, - "description": "A Voucherify customer identifier or `source_id`" - } - ], - "put": { - "operationId": "update-customers-consents-client-side", - "tags": [ - "CUSTOMERS API" - ], - "summary": "Update Customer's consents (client-side)", - "description": "Update marketing permissions for the specified customer.", - "parameters": [], - "security": [ - { - "X-Client-Application-Id-1": [], - "X-Client-Token-1": [] - } - ], - "requestBody": { - "description": "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. \n\n#### Examples\n\n\n```json\n{\n \"cnst_aIdUulAh0SCsOCaS3005y7yS\": true,\n \"cnst_aIdUulAhwewqaS31213fdsfds\": false\n}\n```\n\nOpt-out from all communication:\n\n\n```json\n{\n \"unsubscribed\": true\n}\n```", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/9_req_update_customers_consents" - }, - "examples": { - "Example": { - "value": { - "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I": true, - "cnst_VCmucIvAsmDYw2PPAok6bcYy": false - } - }, - "Opt-out of all": { - "value": { - "unsubscribed": true - } - } + "examples": { + "Example": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "The payload cannot be empty", + "request_id": "v-0ba675252cc3bf6b03" } } } + } + } + } + } + } + }, + "/client/v1/customers/{customerId}/consents#": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "customerId", + "in": "path", + "required": true, + "description": "A Voucherify customer identifier or `source_id`" + } + ], + "put": { + "operationId": "update-customers-consents-client-side", + "tags": [ + "CUSTOMERS API" + ], + "summary": "Update Customer's consents (client-side)", + "description": "Update marketing permissions for the specified customer.", + "parameters": [], + "security": [ + { + "X-Client-Application-Id-1": [], + "X-Client-Token-1": [] + } + ], + "requestBody": { + "description": "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. \n\n#### Examples\n\n\n```json\n{\n \"cnst_aIdUulAh0SCsOCaS3005y7yS\": true,\n \"cnst_aIdUulAhwewqaS31213fdsfds\": false\n}\n```\n\nOpt-out from all communication:\n\n\n```json\n{\n \"unsubscribed\": true\n}\n```", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/9_req_update_customers_consents" }, - "responses": { - "204": { - "description": "Returns no content if the consents were updated successfully." + "examples": { + "Example": { + "value": { + "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I": true, + "cnst_VCmucIvAsmDYw2PPAok6bcYy": false + } }, - "400": { - "description": "Returns an error if the payload is empty.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Example": { - "value": {} - } - } - } + "Opt-out of all": { + "value": { + "unsubscribed": true } } } } + } + }, + "responses": { + "204": { + "description": "Returns no content if the consents were updated successfully." }, - "/v1/customers/{customerId}/activities": { - "parameters": [ - { + "400": { + "description": "Returns an error if the payload is empty.", + "content": { + "application/json": { "schema": { - "type": "string" - }, - "name": "customerId", - "in": "path", - "required": true, - "description": "A Voucherify customer ID or source ID of the customer who performed the activities." - } - ], - "get": { - "operationId": "list-customer-activities", - "tags": [ - "CUSTOMERS API" - ], - "summary": "List Customer Activities", - "description": "Retrieve customer activities.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/order" - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "starting_after", - "description": "A cursor for use in pagination. `starting_after` is a date-time value that defines your place in the list based on `created_at` property from the activity object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after=2020-05-24T13:43:09.024Z in order to fetch the next page of the list." - }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "starting_after_id", - "description": "By applying this filter value, you will get events starting after an event with the given ID." - }, - { - "schema": { - "enum": [ - "DISCOUNT_COUPONS", - "REFERRAL_PROGRAM", - "GIFT_VOUCHERS", - "PROMOTION", - "LOYALTY_PROGRAM" - ], - "type": "string" - }, - "in": "query", - "name": "campaign_type", - "description": "Through this parameter you can control a type of campaign by which Voucherify will filter related customer's activity. API will return only records related to that given type. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM" + "$ref": "#/components/schemas/e_error_no_translation" }, - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "campaign_id", - "description": "By applying this parameter you request only events related to specific campaign identified by its ID." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary with customer activities.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/9_res_list_customer_activities" - } - } + "examples": { + "Example": { + "value": {} } } } } + } + } + } + }, + "/v1/customers/{customerId}/activities": { + "parameters": [ + { + "schema": { + "type": "string" }, - "/v1/customers/{customerId}/segments": { - "parameters": [ - { - "schema": { - "type": "string", - "example": "cust_aSeH6JH52DPjYLC1G475Ii0N" - }, - "name": "customerId", - "in": "path", - "required": true, - "description": "Unique identifier of a customer represented by an internal customer ID or customer source ID." - } - ], - "get": { - "operationId": "list-customer-segments", - "tags": [ - "CUSTOMERS API" + "name": "customerId", + "in": "path", + "required": true, + "description": "A Voucherify customer ID or source ID of the customer who performed the activities." + } + ], + "get": { + "operationId": "list-customer-activities", + "tags": [ + "CUSTOMERS API" + ], + "summary": "List Customer Activities", + "description": "Retrieve customer activities.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/order" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "starting_after", + "description": "A cursor for use in pagination. `starting_after` is a date-time value that defines your place in the list based on `created_at` property from the activity object. For instance, if you make a list request and receive 100 objects, ending with an object created at 2020-05-24T13:43:09.024Z, your subsequent call can include starting_after=2020-05-24T13:43:09.024Z in order to fetch the next page of the list." + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "starting_after_id", + "description": "By applying this filter value, you will get events starting after an event with the given ID." + }, + { + "schema": { + "enum": [ + "DISCOUNT_COUPONS", + "REFERRAL_PROGRAM", + "GIFT_VOUCHERS", + "PROMOTION", + "LOYALTY_PROGRAM" ], - "summary": "List Customer's Segments", - "description": "Returns the list of segments IDs to which the customer belongs to. \n\nIf you pass a `customerId` which is not stored and recognized by Voucherify as an existing customer in the system, the response will generate a list of segments that the customer would potentialy qualify for if they were to become a customer tracked in the system.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + "type": "string" + }, + "in": "query", + "name": "campaign_type", + "description": "Through this parameter you can control a type of campaign by which Voucherify will filter related customer's activity. API will return only records related to that given type. Allowed values: DISCOUNT_COUPONS, REFERRAL_PROGRAM, GIFT_VOUCHERS, PROMOTION, LOYALTY_PROGRAM" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "campaign_id", + "description": "By applying this parameter you request only events related to specific campaign identified by its ID." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with customer activities.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/9_res_list_customer_activities" } - ], - "responses": { - "200": { - "description": "The method returns segment(s) to which the given customer belongs to.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/14_res_customers_customerId_segments" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "seg_DNAOhUtJffvX0f57ajLMFBYR", - "name": "area code not 123", - "object": "segment" - }, - { - "id": "seg_IPIYx96l92Op0Sy5MOaImhgw", - "name": "not bob.smith@email.com", - "object": "segment" - }, - { - "id": "seg_1wc52c5z6r1kQ81brO8j9Hk2", - "name": "Birthday After Dec 31", - "object": "segment" - }, - { - "id": "seg_ZEbbT4mq1ePpM9PzR02lcww2", - "name": "Start with S", - "object": "segment" - }, - { - "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt", - "name": "Loyalty Card", - "object": "segment" - } - ], - "total": 5 - } + } + } + } + } + } + }, + "/v1/customers/{customerId}/segments": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "cust_aSeH6JH52DPjYLC1G475Ii0N" + }, + "name": "customerId", + "in": "path", + "required": true, + "description": "Unique identifier of a customer represented by an internal customer ID or customer source ID." + } + ], + "get": { + "operationId": "list-customer-segments", + "tags": [ + "CUSTOMERS API" + ], + "summary": "List Customer's Segments", + "description": "Returns the list of segments IDs to which the customer belongs to. \n\nIf you pass a `customerId` which is not stored and recognized by Voucherify as an existing customer in the system, the response will generate a list of segments that the customer would potentialy qualify for if they were to become a customer tracked in the system.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "The method returns segment(s) to which the given customer belongs to.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/14_res_customers_customerId_segments" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "seg_DNAOhUtJffvX0f57ajLMFBYR", + "name": "area code not 123", + "object": "segment" + }, + { + "id": "seg_IPIYx96l92Op0Sy5MOaImhgw", + "name": "not bob.smith@email.com", + "object": "segment" + }, + { + "id": "seg_1wc52c5z6r1kQ81brO8j9Hk2", + "name": "Birthday After Dec 31", + "object": "segment" + }, + { + "id": "seg_ZEbbT4mq1ePpM9PzR02lcww2", + "name": "Start with S", + "object": "segment" + }, + { + "id": "seg_WJv55MbzQwnr56ttJ2xUrSgt", + "name": "Loyalty Card", + "object": "segment" } - } + ], + "total": 5 } } } } } - }, - "/v1/order-object": { - "get": { - "operationId": "order-object", - "tags": [ - "ORDERS API" - ], - "summary": "Order Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Order Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/10_obj_order_object" - } - } - } + } + } + } + }, + "/v1/order-object": { + "get": { + "operationId": "order-object", + "tags": [ + "ORDERS API" + ], + "summary": "Order Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Order Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/10_obj_order_object" } } } + } + } + } + }, + "/v1/orders": { + "get": { + "operationId": "list-orders", + "tags": [ + "ORDERS API" + ], + "summary": "List Orders", + "description": "Returns a list of orders.\n\n", + "parameters": [ + { + "$ref": "#/components/parameters/limit" }, - "/v1/orders": { - "get": { - "operationId": "list-orders", - "tags": [ - "ORDERS API" - ], - "summary": "List Orders", - "description": "Returns a list of orders.\n\n", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ] - }, - "in": "query", - "name": "order", - "description": "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." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "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.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/10_res_list_orders" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "orders", - "orders": [ - { - "id": "ord_v5vupdacgud1CwUSyKqSlHuk", - "source_id": null, - "created_at": "2022-09-09T07:44:41.594Z", - "updated_at": "2022-09-09T07:44:42.331Z", - "status": "PAID", - "amount": 2700, - "discount_amount": 1243, - "items_discount_amount": 270, - "total_discount_amount": 1513, - "total_amount": 1187, - "items": [ - { - "object": "order_item", - "source_id": "prod_5h1pp1ng", - "related_object": "product", - "quantity": 1, - "amount": 700, - "discount_amount": 70, - "price": 700, - "subtotal_amount": 630, - "product": { - "name": "Shipping" - } - }, - { - "object": "order_item", - "source_id": "roses_1", - "related_object": "product", - "quantity": 1, - "amount": 500, - "discount_amount": 50, - "price": 500, - "subtotal_amount": 450, - "product": { - "name": "Bouquet - Romantic Roses", - "price": 500 - } - }, - { - "object": "order_item", - "source_id": "vase_1", - "related_object": "product", - "quantity": 1, - "amount": 1500, - "discount_amount": 150, - "price": 1500, - "subtotal_amount": 1350, - "product": { - "name": "Vase - Boho Vintage", - "price": 1500 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "object": "customer" - }, - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0baa093537528ef645": { - "date": "2022-09-09T07:44:41.695Z", - "related_object_type": "redemption", - "related_object_id": "r_0baa093537528ef645", - "stacked": [ - "r_0baa093537528ef646", - "r_0baa093537528ef647", - "r_0baa093537528ef648" - ] - } - } - }, - { - "id": "ord_3JkWC6jG0JgyRf5lO3r4IyU1", - "source_id": null, - "created_at": "2022-09-09T07:04:22.597Z", - "updated_at": "2022-09-09T07:04:23.743Z", - "status": "PAID", - "amount": 73100, - "items_discount_amount": 7310, - "total_discount_amount": 7310, - "total_amount": 65790, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 70000, - "discount_amount": 7000, - "price": 70000, - "subtotal_amount": 63000, - "product": { - "name": "Apple iPhone 12", - "price": 70000 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1600, - "discount_amount": 160, - "price": 1600, - "subtotal_amount": 1440, - "product": { - "name": "Comic Books1", - "price": 1600 - }, - "sku": { - "sku": "Comics1", - "price": 1600 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 1, - "amount": 1500, - "discount_amount": 150, - "price": 1500, - "subtotal_amount": 1350, - "product": { - "name": "Vase - Boho Vintage", - "price": 1500 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "object": "customer" - }, - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0ba9fffae90e1b2495": { - "date": "2022-09-09T07:04:22.692Z", - "related_object_type": "voucher", - "related_object_id": "v_24rljiUfdLNC9poBf0BPNmoh2txzFkLs" - } - } - }, - { - "id": "ord_HwdbziIPvUZJkIC7z74FKmPv", - "source_id": null, - "created_at": "2022-09-09T06:47:14.195Z", - "updated_at": "2022-09-09T06:47:15.369Z", - "status": "PAID", - "amount": 71600, - "discount_amount": 7160, - "total_discount_amount": 7160, - "total_amount": 64440, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1600, - "price": 1600, - "subtotal_amount": 1600, - "product": { - "name": "Comic Books1", - "price": 1600 - }, - "sku": { - "sku": "Comics1", - "price": 1600 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 70000, - "price": 70000, - "subtotal_amount": 70000, - "product": { - "name": "Apple iPhone 12", - "price": 70000 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "object": "customer" - }, - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0ba9fc0eb00e1b2230": { - "date": "2022-09-09T06:47:14.369Z", - "related_object_type": "voucher", - "related_object_id": "v_3vEprqa6tbzfhFtpjr4mDlkNchXepW7s" - } - } - }, - { - "id": "ord_HRluwFS2seoILUkXxWML0D7Z", - "source_id": null, - "created_at": "2022-09-09T06:44:27.383Z", - "updated_at": "2022-09-09T06:44:28.252Z", - "status": "PAID", - "amount": 71600, - "discount_amount": 100, - "total_discount_amount": 100, - "total_amount": 71500, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1600, - "price": 1600, - "subtotal_amount": 1600, - "product": { - "name": "Comic Books1", - "price": 1600 - }, - "sku": { - "sku": "Comics1", - "price": 1600 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 70000, - "price": 70000, - "subtotal_amount": 70000, - "product": { - "name": "Apple iPhone 12", - "price": 70000 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "object": "customer" - }, - "referrer": { - "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", - "object": "customer" - }, - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", - "object": "order", - "redemptions": { - "r_0ba9fb6bb7928ed9ec": { - "date": "2022-09-09T06:44:27.486Z", - "related_object_type": "voucher", - "related_object_id": "v_vhHuiEmZSchWHtE0xKm0HM7PFCR9cNkA", - "related_object_parent_id": "camp_rRsfatlwN7unSeUIJDCYedal" - } - } - }, - { - "id": "ord_Qg5utCohAZ3tafYvc1O4C80r", - "source_id": null, - "created_at": "2022-09-09T06:42:34.083Z", - "updated_at": "2022-09-09T06:42:35.169Z", - "status": "PAID", - "amount": 70000, - "discount_amount": 4000, - "total_discount_amount": 4000, - "total_amount": 66000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 70000, - "price": 70000, - "subtotal_amount": 70000, - "product": { - "name": "Apple iPhone 12", - "price": 70000 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "object": "customer" - }, - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0ba9fafd11d28ed999": { - "date": "2022-09-09T06:42:34.183Z", - "related_object_type": "voucher", - "related_object_id": "v_RaMaTT7F0Q47BetdGcFxsyqwo1aZGzJs", - "related_object_parent_id": "camp_hg7ajfHh6DcE1xa18mw3SdF6" - } - } + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + }, + "in": "query", + "name": "order", + "description": "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." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "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.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/10_res_list_orders" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "orders", + "orders": [ + { + "id": "ord_v5vupdacgud1CwUSyKqSlHuk", + "source_id": null, + "created_at": "2022-09-09T07:44:41.594Z", + "updated_at": "2022-09-09T07:44:42.331Z", + "status": "PAID", + "amount": 2700, + "discount_amount": 1243, + "items_discount_amount": 270, + "total_discount_amount": 1513, + "total_amount": 1187, + "items": [ + { + "object": "order_item", + "source_id": "prod_5h1pp1ng", + "related_object": "product", + "quantity": 1, + "amount": 700, + "discount_amount": 70, + "price": 700, + "subtotal_amount": 630, + "product": { + "name": "Shipping" + } + }, + { + "object": "order_item", + "source_id": "roses_1", + "related_object": "product", + "quantity": 1, + "amount": 500, + "discount_amount": 50, + "price": 500, + "subtotal_amount": 450, + "product": { + "name": "Bouquet - Romantic Roses", + "price": 500 + } + }, + { + "object": "order_item", + "source_id": "vase_1", + "related_object": "product", + "quantity": 1, + "amount": 1500, + "discount_amount": 150, + "price": 1500, + "subtotal_amount": 1350, + "product": { + "name": "Vase - Boho Vintage", + "price": 1500 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "object": "customer" + }, + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0baa093537528ef645": { + "date": "2022-09-09T07:44:41.695Z", + "related_object_type": "redemption", + "related_object_id": "r_0baa093537528ef645", + "stacked": [ + "r_0baa093537528ef646", + "r_0baa093537528ef647", + "r_0baa093537528ef648" + ] + } + } + }, + { + "id": "ord_3JkWC6jG0JgyRf5lO3r4IyU1", + "source_id": null, + "created_at": "2022-09-09T07:04:22.597Z", + "updated_at": "2022-09-09T07:04:23.743Z", + "status": "PAID", + "amount": 73100, + "items_discount_amount": 7310, + "total_discount_amount": 7310, + "total_amount": 65790, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 70000, + "discount_amount": 7000, + "price": 70000, + "subtotal_amount": 63000, + "product": { + "name": "Apple iPhone 12", + "price": 70000 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1600, + "discount_amount": 160, + "price": 1600, + "subtotal_amount": 1440, + "product": { + "name": "Comic Books1", + "price": 1600 }, - { - "id": "ord_G9LBb5SOPa36pHdwxUvzkw4P", - "source_id": null, - "created_at": "2022-09-09T06:38:17.984Z", - "updated_at": "2022-09-09T06:38:19.064Z", - "status": "PAID", - "amount": 4600, - "items_discount_amount": 300, - "total_discount_amount": 300, - "total_amount": 4300, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1600, - "price": 1600, - "subtotal_amount": 1600, - "product": { - "name": "Comic Books1", - "price": 1600 - }, - "sku": { - "sku": "Comics1", - "price": 1600 - } - }, - { - "object": "order_item", - "product_id": "prod_0a65b3ff8592d7a5b5", - "quantity": 1, - "amount": 3000, - "discount_amount": 300, - "price": 3000, - "subtotal_amount": 2700, - "product": { - "name": "Koffee Cup", - "price": 3000 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "object": "customer" - }, - "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0ba9fa02fcd28ed8f1": { - "date": "2022-09-09T06:38:18.099Z", - "related_object_type": "voucher", - "related_object_id": "v_KqP2NOSb4dJb1D6UBhcq7ScPZXun0y40", - "related_object_parent_id": "camp_hC2GdqYtOmTT45zfhib62cK1" - } - } + "sku": { + "sku": "Comics1", + "price": 1600 + } + }, + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 1, + "amount": 1500, + "discount_amount": 150, + "price": 1500, + "subtotal_amount": 1350, + "product": { + "name": "Vase - Boho Vintage", + "price": 1500 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "object": "customer" + }, + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0ba9fffae90e1b2495": { + "date": "2022-09-09T07:04:22.692Z", + "related_object_type": "voucher", + "related_object_id": "v_24rljiUfdLNC9poBf0BPNmoh2txzFkLs" + } + } + }, + { + "id": "ord_HwdbziIPvUZJkIC7z74FKmPv", + "source_id": null, + "created_at": "2022-09-09T06:47:14.195Z", + "updated_at": "2022-09-09T06:47:15.369Z", + "status": "PAID", + "amount": 71600, + "discount_amount": 7160, + "total_discount_amount": 7160, + "total_amount": 64440, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1600, + "price": 1600, + "subtotal_amount": 1600, + "product": { + "name": "Comic Books1", + "price": 1600 }, - { - "id": "ord_N3YBowDTZs0UH2hHoMZLbUDN", - "source_id": null, - "created_at": "2022-09-09T06:18:31.459Z", - "updated_at": "2022-09-09T06:18:31.624Z", - "status": "PAID", - "amount": 71600, - "discount_amount": 7160, - "total_discount_amount": 7160, - "total_amount": 64440, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 70000, - "price": 70000, - "subtotal_amount": 70000, - "product": { - "name": "Apple iPhone 12", - "price": 70000 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 1, - "amount": 1600, - "price": 1600, - "subtotal_amount": 1600, - "product": { - "name": "Comic Books1", - "price": 1600 - }, - "sku": { - "sku": "Comics1", - "price": 1600 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", - "object": "customer" - }, - "customer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0ba9f57c37128ed639": { - "date": "2022-09-09T06:18:31.516Z", - "related_object_type": "promotion_tier", - "related_object_id": "promo_CQonGnrsFAdEJfJQ3oKB3a8G", - "related_object_parent_id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0" - } - } + "sku": { + "sku": "Comics1", + "price": 1600 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 70000, + "price": 70000, + "subtotal_amount": 70000, + "product": { + "name": "Apple iPhone 12", + "price": 70000 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "object": "customer" + }, + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0ba9fc0eb00e1b2230": { + "date": "2022-09-09T06:47:14.369Z", + "related_object_type": "voucher", + "related_object_id": "v_3vEprqa6tbzfhFtpjr4mDlkNchXepW7s" + } + } + }, + { + "id": "ord_HRluwFS2seoILUkXxWML0D7Z", + "source_id": null, + "created_at": "2022-09-09T06:44:27.383Z", + "updated_at": "2022-09-09T06:44:28.252Z", + "status": "PAID", + "amount": 71600, + "discount_amount": 100, + "total_discount_amount": 100, + "total_amount": 71500, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1600, + "price": 1600, + "subtotal_amount": 1600, + "product": { + "name": "Comic Books1", + "price": 1600 }, - { - "id": "ord_3R6vsxRZRkND8rpe0rAn9Agc", - "source_id": null, - "created_at": "2022-09-05T08:13:13.720Z", - "updated_at": "2022-09-05T08:13:14.498Z", - "status": "PAID", - "amount": 74000, - "items_discount_amount": 1500, - "total_discount_amount": 1500, - "total_amount": 72500, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 1, - "amount": 70000, - "price": 70000, - "subtotal_amount": 70000, - "product": { - "name": "Apple iPhone 12", - "price": 70000 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 2, - "amount": 3000, - "discount_amount": 500, - "price": 1500, - "subtotal_amount": 2500, - "product": { - "name": "Vase - Boho Vintage", - "price": 1500 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b00ffed198e344", - "quantity": 2, - "amount": 1000, - "discount_amount": 1000, - "price": 500, - "subtotal_amount": 0, - "product": { - "name": "Bouquet - Romantic Roses", - "price": 500 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_CSnYd37MXmrbS19XCrghjBsv", - "object": "customer" - }, - "customer_id": "cust_CSnYd37MXmrbS19XCrghjBsv", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0ba4e961444579711a": { - "date": "2022-09-05T08:13:13.873Z", - "related_object_type": "voucher", - "related_object_id": "v_hwySVBBk6YmMD4GzZHJzke1Fxo3QO7kP", - "related_object_parent_id": "camp_Uji5a53s5wRSUHqznncTkhHh" - } - } + "sku": { + "sku": "Comics1", + "price": 1600 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 70000, + "price": 70000, + "subtotal_amount": 70000, + "product": { + "name": "Apple iPhone 12", + "price": 70000 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "object": "customer" + }, + "referrer": { + "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", + "object": "customer" + }, + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", + "object": "order", + "redemptions": { + "r_0ba9fb6bb7928ed9ec": { + "date": "2022-09-09T06:44:27.486Z", + "related_object_type": "voucher", + "related_object_id": "v_vhHuiEmZSchWHtE0xKm0HM7PFCR9cNkA", + "related_object_parent_id": "camp_rRsfatlwN7unSeUIJDCYedal" + } + } + }, + { + "id": "ord_Qg5utCohAZ3tafYvc1O4C80r", + "source_id": null, + "created_at": "2022-09-09T06:42:34.083Z", + "updated_at": "2022-09-09T06:42:35.169Z", + "status": "PAID", + "amount": 70000, + "discount_amount": 4000, + "total_discount_amount": 4000, + "total_amount": 66000, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 70000, + "price": 70000, + "subtotal_amount": 70000, + "product": { + "name": "Apple iPhone 12", + "price": 70000 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "object": "customer" + }, + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0ba9fafd11d28ed999": { + "date": "2022-09-09T06:42:34.183Z", + "related_object_type": "voucher", + "related_object_id": "v_RaMaTT7F0Q47BetdGcFxsyqwo1aZGzJs", + "related_object_parent_id": "camp_hg7ajfHh6DcE1xa18mw3SdF6" + } + } + }, + { + "id": "ord_G9LBb5SOPa36pHdwxUvzkw4P", + "source_id": null, + "created_at": "2022-09-09T06:38:17.984Z", + "updated_at": "2022-09-09T06:38:19.064Z", + "status": "PAID", + "amount": 4600, + "items_discount_amount": 300, + "total_discount_amount": 300, + "total_amount": 4300, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1600, + "price": 1600, + "subtotal_amount": 1600, + "product": { + "name": "Comic Books1", + "price": 1600 }, - { - "id": "ord_7bqlkoHyEJCQuxVZpKfZYNeA", - "source_id": null, - "created_at": "2022-09-02T17:12:13.213Z", - "updated_at": "2022-09-02T17:12:13.969Z", - "status": "PAID", - "amount": 292400, - "items_discount_amount": 900, - "total_discount_amount": 900, - "total_amount": 291500, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 4, - "amount": 6400, - "price": 1600, - "subtotal_amount": 6400, - "product": { - "name": "Comic Books1", - "price": 1600 - }, - "sku": { - "sku": "Comics1", - "price": 1600 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 4, - "amount": 6000, - "price": 1500, - "subtotal_amount": 6000, - "product": { - "name": "Vase - Boho Vintage", - "price": 1500 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 4, - "amount": 280000, - "discount_amount": 900, - "price": 70000, - "subtotal_amount": 279100, - "product": { - "name": "Apple iPhone 12", - "price": 70000 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_CSnYd37MXmrbS19XCrghjBsv", - "object": "customer" - }, - "customer_id": "cust_CSnYd37MXmrbS19XCrghjBsv", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0ba187f9bb45792c13": { - "date": "2022-09-02T17:12:13.293Z", - "related_object_type": "voucher", - "related_object_id": "v_pg6DhwhmeZASoSoJ15PdzMT9MhsPjYuc", - "related_object_parent_id": "camp_W8DJVd8J0btqXT6FBwn7BSkC" - } - } + "sku": { + "sku": "Comics1", + "price": 1600 + } + }, + { + "object": "order_item", + "product_id": "prod_0a65b3ff8592d7a5b5", + "quantity": 1, + "amount": 3000, + "discount_amount": 300, + "price": 3000, + "subtotal_amount": 2700, + "product": { + "name": "Koffee Cup", + "price": 3000 + } + } + ], + "metadata": {}, + "customer": { + "id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "object": "customer" + }, + "customer_id": "cust_tAED42tFhLM9v7GmZUaklJFd", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0ba9fa02fcd28ed8f1": { + "date": "2022-09-09T06:38:18.099Z", + "related_object_type": "voucher", + "related_object_id": "v_KqP2NOSb4dJb1D6UBhcq7ScPZXun0y40", + "related_object_parent_id": "camp_hC2GdqYtOmTT45zfhib62cK1" + } + } + }, + { + "id": "ord_N3YBowDTZs0UH2hHoMZLbUDN", + "source_id": null, + "created_at": "2022-09-09T06:18:31.459Z", + "updated_at": "2022-09-09T06:18:31.624Z", + "status": "PAID", + "amount": 71600, + "discount_amount": 7160, + "total_discount_amount": 7160, + "total_amount": 64440, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 70000, + "price": 70000, + "subtotal_amount": 70000, + "product": { + "name": "Apple iPhone 12", + "price": 70000 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 1, + "amount": 1600, + "price": 1600, + "subtotal_amount": 1600, + "product": { + "name": "Comic Books1", + "price": 1600 }, - { - "id": "ord_7HwbJiHmS07O7FsVAtjJcuRS", - "source_id": null, - "created_at": "2022-09-02T17:08:37.794Z", - "updated_at": "2022-09-02T17:08:38.879Z", - "status": "PAID", - "amount": 223900, - "items_discount_amount": 900, - "total_discount_amount": 900, - "total_amount": 223000, - "items": [ - { - "object": "order_item", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku_id": "sku_0b7d7dfb090be5c619", - "quantity": 4, - "amount": 6400, - "discount_amount": 300, - "price": 1600, - "subtotal_amount": 6100, - "product": { - "name": "Comic Books1", - "price": 1600 - }, - "sku": { - "sku": "Comics1", - "price": 1600 - } - }, - { - "object": "order_item", - "product_id": "prod_0b7d7c4e814be5c502", - "quantity": 3, - "amount": 210000, - "discount_amount": 300, - "price": 70000, - "subtotal_amount": 209700, - "product": { - "name": "Apple iPhone 12", - "price": 70000 - } - }, - { - "object": "order_item", - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 5, - "amount": 7500, - "discount_amount": 300, - "price": 1500, - "subtotal_amount": 7200, - "product": { - "name": "Vase - Boho Vintage", - "price": 1500 - } - } - ], - "metadata": {}, - "customer": { - "id": "cust_CSnYd37MXmrbS19XCrghjBsv", - "object": "customer" - }, - "customer_id": "cust_CSnYd37MXmrbS19XCrghjBsv", - "referrer_id": null, - "object": "order", - "redemptions": { - "r_0ba1872762c5792b73": { - "date": "2022-09-02T17:08:37.899Z", - "related_object_type": "voucher", - "related_object_id": "v_yQydppWWJpSUuGNEWJ4I2upFGY2Ma4IY", - "related_object_parent_id": "camp_A5L21BD4cJii28882owYBqTV" - } - } + "sku": { + "sku": "Comics1", + "price": 1600 } - ], - "total": 441 + } + ], + "metadata": {}, + "customer": { + "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", + "object": "customer" + }, + "customer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0ba9f57c37128ed639": { + "date": "2022-09-09T06:18:31.516Z", + "related_object_type": "promotion_tier", + "related_object_id": "promo_CQonGnrsFAdEJfJQ3oKB3a8G", + "related_object_parent_id": "camp_SGq39XXJ47vm7Xys3D0NLgQ0" + } } - } - } - } - } - } - } - }, - "post": { - "operationId": "create-order", - "tags": [ - "ORDERS API" - ], - "summary": "Create Order", - "description": "Creates an order object and triggers an order creation event. ", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the order parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/10_req_create_order" - }, - "examples": { - "Example": { - "value": { - "amount": 20000, + }, + { + "id": "ord_3R6vsxRZRkND8rpe0rAn9Agc", + "source_id": null, + "created_at": "2022-09-05T08:13:13.720Z", + "updated_at": "2022-09-05T08:13:14.498Z", + "status": "PAID", + "amount": 74000, + "items_discount_amount": 1500, + "total_discount_amount": 1500, + "total_amount": 72500, + "items": [ + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 1, + "amount": 70000, + "price": 70000, + "subtotal_amount": 70000, + "product": { + "name": "Apple iPhone 12", + "price": 70000 + } + }, + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 2, + "amount": 3000, + "discount_amount": 500, + "price": 1500, + "subtotal_amount": 2500, + "product": { + "name": "Vase - Boho Vintage", + "price": 1500 + } + }, + { + "object": "order_item", + "product_id": "prod_0b72b00ffed198e344", + "quantity": 2, + "amount": 1000, + "discount_amount": 1000, + "price": 500, + "subtotal_amount": 0, + "product": { + "name": "Bouquet - Romantic Roses", + "price": 500 + } + } + ], + "metadata": {}, "customer": { - "source_id": "sample_customer" + "id": "cust_CSnYd37MXmrbS19XCrghjBsv", + "object": "customer" }, + "customer_id": "cust_CSnYd37MXmrbS19XCrghjBsv", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0ba4e961444579711a": { + "date": "2022-09-05T08:13:13.873Z", + "related_object_type": "voucher", + "related_object_id": "v_hwySVBBk6YmMD4GzZHJzke1Fxo3QO7kP", + "related_object_parent_id": "camp_Uji5a53s5wRSUHqznncTkhHh" + } + } + }, + { + "id": "ord_7bqlkoHyEJCQuxVZpKfZYNeA", + "source_id": null, + "created_at": "2022-09-02T17:12:13.213Z", + "updated_at": "2022-09-02T17:12:13.969Z", "status": "PAID", + "amount": 292400, + "items_discount_amount": 900, + "total_discount_amount": 900, + "total_amount": 291500, "items": [ { - "quantity": 1, - "price": 20000, - "source_id": "sample product1", - "related_object": "product", + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 4, + "amount": 6400, + "price": 1600, + "subtotal_amount": 6400, "product": { - "metadata": { - "key": "value" - } + "name": "Comic Books1", + "price": 1600 + }, + "sku": { + "sku": "Comics1", + "price": 1600 } - } - ] - } - }, - "Example 2": { - "value": { - "source_id": "new", - "status": "FULFILLED", - "metadata": { - "location_id": [ - "L1", - "L2" - ], - "payment_mean": [ - "paypal", - "credit-card" - ] - }, - "customer": { - "source_id": "bob.smith.1@email.com", - "name": "Bob Smith", - "description": "A nice customer", - "email": "bob.smith.1@email.com", - "phone": "+1 933 222 3333", - "address": { - "city": "New York", - "country": "United Statese", - "line_1": "123 Main St", - "line_2": "APT 3 BLG 4", - "postal_code": "10001", - "state": "NY" - }, - "metadata": { - "lang": "en", - "test": false - }, - "birthdate": "2022-01-02" - }, - "referrer": { - "source_id": "jane.smith@email.com", - "name": "Jane Smith", - "description": "A really nice customer", - "email": "jane.smith@email.com", - "phone": "+1 933 222 3334", - "address": { - "city": "New York", - "country": "United States", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 4", - "postal_code": "10001", - "state": "NY" }, - "metadata": { - "lang": "en", - "test": false + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 4, + "amount": 6000, + "price": 1500, + "subtotal_amount": 6000, + "product": { + "name": "Vase - Boho Vintage", + "price": 1500 + } }, - "birthday": "2022-03-03" - }, - "items": [ { - "source_id": "prod_1", - "related_object": "product", - "quantity": 2, + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 4, + "amount": 280000, + "discount_amount": 900, + "price": 70000, + "subtotal_amount": 279100, "product": { "name": "Apple iPhone 12", - "price": 60000, - "metadata": { - "color": [ - "purple" - ], - "vendor": "mall" - }, - "override": true + "price": 70000 } - }, + } + ], + "metadata": {}, + "customer": { + "id": "cust_CSnYd37MXmrbS19XCrghjBsv", + "object": "customer" + }, + "customer_id": "cust_CSnYd37MXmrbS19XCrghjBsv", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0ba187f9bb45792c13": { + "date": "2022-09-02T17:12:13.293Z", + "related_object_type": "voucher", + "related_object_id": "v_pg6DhwhmeZASoSoJ15PdzMT9MhsPjYuc", + "related_object_parent_id": "camp_W8DJVd8J0btqXT6FBwn7BSkC" + } + } + }, + { + "id": "ord_7HwbJiHmS07O7FsVAtjJcuRS", + "source_id": null, + "created_at": "2022-09-02T17:08:37.794Z", + "updated_at": "2022-09-02T17:08:38.879Z", + "status": "PAID", + "amount": 223900, + "items_discount_amount": 900, + "total_discount_amount": 900, + "total_amount": 223000, + "items": [ { - "source_id": "ComicBook_1", - "related_object": "sku", - "quantity": 1, + "object": "order_item", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku_id": "sku_0b7d7dfb090be5c619", + "quantity": 4, + "amount": 6400, + "discount_amount": 300, + "price": 1600, + "subtotal_amount": 6100, "product": { - "source_id": "Books", "name": "Comic Books1", - "price": 2100, - "metadata": { - "color": [ - "silver" - ], - "vendor": "Bookstore1" - }, - "override": true + "price": 1600 }, "sku": { "sku": "Comics1", - "source_id": "ComicBook_1", - "price": 1700, - "metadata": { - "color": [ - "golden" - ], - "vendor": "islands" - }, - "override": true + "price": 1600 + } + }, + { + "object": "order_item", + "product_id": "prod_0b7d7c4e814be5c502", + "quantity": 3, + "amount": 210000, + "discount_amount": 300, + "price": 70000, + "subtotal_amount": 209700, + "product": { + "name": "Apple iPhone 12", + "price": 70000 + } + }, + { + "object": "order_item", + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 5, + "amount": 7500, + "discount_amount": 300, + "price": 1500, + "subtotal_amount": 7200, + "product": { + "name": "Vase - Boho Vintage", + "price": 1500 } } - ] + ], + "metadata": {}, + "customer": { + "id": "cust_CSnYd37MXmrbS19XCrghjBsv", + "object": "customer" + }, + "customer_id": "cust_CSnYd37MXmrbS19XCrghjBsv", + "referrer_id": null, + "object": "order", + "redemptions": { + "r_0ba1872762c5792b73": { + "date": "2022-09-02T17:08:37.899Z", + "related_object_type": "voucher", + "related_object_id": "v_yQydppWWJpSUuGNEWJ4I2upFGY2Ma4IY", + "related_object_parent_id": "camp_A5L21BD4cJii28882owYBqTV" + } + } } - } + ], + "total": 441 } } } + } + } + } + } + }, + "post": { + "operationId": "create-order", + "tags": [ + "ORDERS API" + ], + "summary": "Create Order", + "description": "Creates an order object and triggers an order creation event. ", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the order parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/10_req_create_order" }, - "responses": { - "200": { - "description": "Returns an order object if the operation succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/10_obj_order_object_no_discount_calculations" + "examples": { + "Example": { + "value": { + "amount": 20000, + "customer": { + "source_id": "sample_customer" + }, + "status": "PAID", + "items": [ + { + "quantity": 1, + "price": 20000, + "source_id": "sample product1", + "related_object": "product", + "product": { + "metadata": { + "key": "value" + } + } + } + ] + } + }, + "Example 2": { + "value": { + "source_id": "new", + "status": "FULFILLED", + "metadata": { + "location_id": [ + "L1", + "L2" + ], + "payment_mean": [ + "paypal", + "credit-card" + ] + }, + "customer": { + "source_id": "bob.smith.1@email.com", + "name": "Bob Smith", + "description": "A nice customer", + "email": "bob.smith.1@email.com", + "phone": "+1 933 222 3333", + "address": { + "city": "New York", + "country": "United Statese", + "line_1": "123 Main St", + "line_2": "APT 3 BLG 4", + "postal_code": "10001", + "state": "NY" }, - "examples": { - "Example": { - "value": { - "id": "ord_cRKOEXiBOj0EZKF7g9n6l0eH", - "source_id": "new", - "created_at": "2022-09-09T09:20:01.660Z", - "updated_at": "2022-09-09T09:24:43.604Z", - "status": "FULFILLED", - "amount": 121700, - "total_amount": 121700, - "items": [ - { - "object": "order_item", - "source_id": "prod_1", - "related_object": "product", - "quantity": 2, - "amount": 120000, - "price": 60000, - "subtotal_amount": 120000, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "metadata": { - "color": [ - "purple" - ], - "vendor": "mall" - }, - "price": 60000 - } - }, - { - "object": "order_item", - "source_id": "ComicBook_1", - "related_object": "sku", - "product_id": "prod_0b7d7dfb05cbe5c616", - "quantity": 1, - "amount": 1700, - "price": 1700, - "subtotal_amount": 1700, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "metadata": { - "color": [ - "silver" - ], - "vendor": "Bookstore1" - }, - "price": 2100 - }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "metadata": { - "color": [ - "golden" - ], - "vendor": "islands" - }, - "price": 1700 - } - } + "metadata": { + "lang": "en", + "test": false + }, + "birthdate": "2022-01-02" + }, + "referrer": { + "source_id": "jane.smith@email.com", + "name": "Jane Smith", + "description": "A really nice customer", + "email": "jane.smith@email.com", + "phone": "+1 933 222 3334", + "address": { + "city": "New York", + "country": "United States", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 4", + "postal_code": "10001", + "state": "NY" + }, + "metadata": { + "lang": "en", + "test": false + }, + "birthday": "2022-03-03" + }, + "items": [ + { + "source_id": "prod_1", + "related_object": "product", + "quantity": 2, + "product": { + "name": "Apple iPhone 12", + "price": 60000, + "metadata": { + "color": [ + "purple" + ], + "vendor": "mall" + }, + "override": true + } + }, + { + "source_id": "ComicBook_1", + "related_object": "sku", + "quantity": 1, + "product": { + "source_id": "Books", + "name": "Comic Books1", + "price": 2100, + "metadata": { + "color": [ + "silver" + ], + "vendor": "Bookstore1" + }, + "override": true + }, + "sku": { + "sku": "Comics1", + "source_id": "ComicBook_1", + "price": 1700, + "metadata": { + "color": [ + "golden" ], + "vendor": "islands" + }, + "override": true + } + } + ] + } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns an order object if the operation succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/10_obj_order_object_no_discount_calculations" + }, + "examples": { + "Example": { + "value": { + "id": "ord_cRKOEXiBOj0EZKF7g9n6l0eH", + "source_id": "new", + "created_at": "2022-09-09T09:20:01.660Z", + "updated_at": "2022-09-09T09:24:43.604Z", + "status": "FULFILLED", + "amount": 121700, + "total_amount": 121700, + "items": [ + { + "object": "order_item", + "source_id": "prod_1", + "related_object": "product", + "quantity": 2, + "amount": 120000, + "price": 60000, + "subtotal_amount": 120000, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", "metadata": { - "location_id": [ - "L1", - "L2" + "color": [ + "purple" ], - "payment_mean": [ - "paypal", - "credit-card" - ] + "vendor": "mall" }, - "customer": { - "id": "cust_H0nXrItO1DNV3UiPIl54HA5o", - "object": "customer" + "price": 60000 + } + }, + { + "object": "order_item", + "source_id": "ComicBook_1", + "related_object": "sku", + "product_id": "prod_0b7d7dfb05cbe5c616", + "quantity": 1, + "amount": 1700, + "price": 1700, + "subtotal_amount": 1700, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "metadata": { + "color": [ + "silver" + ], + "vendor": "Bookstore1" }, - "referrer": { - "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", - "object": "customer" + "price": 2100 + }, + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", + "metadata": { + "color": [ + "golden" + ], + "vendor": "islands" }, - "customer_id": "cust_H0nXrItO1DNV3UiPIl54HA5o", - "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", - "object": "order" + "price": 1700 } } - } + ], + "metadata": { + "location_id": [ + "L1", + "L2" + ], + "payment_mean": [ + "paypal", + "credit-card" + ] + }, + "customer": { + "id": "cust_H0nXrItO1DNV3UiPIl54HA5o", + "object": "customer" + }, + "referrer": { + "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", + "object": "customer" + }, + "customer_id": "cust_H0nXrItO1DNV3UiPIl54HA5o", + "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", + "object": "order" } } } } } + } + } + } + }, + "/v1/orders/{orderId}": { + "parameters": [ + { + "schema": { + "type": "string" }, - "/v1/orders/{orderId}": { - "parameters": [ - { + "name": "orderId", + "in": "path", + "required": true, + "description": "Unique Voucherify order ID or order source ID." + } + ], + "get": { + "operationId": "get-order", + "tags": [ + "ORDERS API" + ], + "summary": "Get Order", + "description": "Retrieve an order.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns an order object if a valid identifier was provided. ", + "content": { + "application/json": { "schema": { - "type": "string" - }, - "name": "orderId", - "in": "path", - "required": true, - "description": "Unique Voucherify order ID or order source ID." - } - ], - "get": { - "operationId": "get-order", - "tags": [ - "ORDERS API" - ], - "summary": "Get Order", - "description": "Retrieve an order.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + "$ref": "#/components/schemas/10_obj_order_object" } - ], - "responses": { - "200": { - "description": "Returns an order object if a valid identifier was provided. ", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/10_obj_order_object" - } - } - } + } + } + }, + "404": { + "description": "Returns an error when requesting an order that has been deleted or cannot be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" }, - "404": { - "description": "Returns an error when requesting an order that has been deleted or cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find order with id ord_nIcO2s8iD4Xh5E9IGDQ57Ax", - "request_id": "v-0baa1ad023d0656a84", - "resource_id": "ord_nIcO2s8iD4Xh5E9IGDQ57Ax", - "resource_type": "order" - } - } - } + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find order with id ord_nIcO2s8iD4Xh5E9IGDQ57Ax", + "request_id": "v-0baa1ad023d0656a84", + "resource_id": "ord_nIcO2s8iD4Xh5E9IGDQ57Ax", + "resource_type": "order" } } } } - }, - "put": { - "operationId": "update-order", - "tags": [ - "ORDERS API" - ], - "summary": "Update Order", - "description": "Updates the specified order by setting the values of the parameters passed in the request body. Any parameters not provided will be left unchanged.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the parameters of the order that are to be updated.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/10_req_update_order" - }, - "examples": { - "Example": { - "value": { - "status": "CANCELED" - } - } - } - } - } + } + } + } + }, + "put": { + "operationId": "update-order", + "tags": [ + "ORDERS API" + ], + "summary": "Update Order", + "description": "Updates the specified order by setting the values of the parameters passed in the request body. Any parameters not provided will be left unchanged.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the parameters of the order that are to be updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/10_req_update_order" }, - "responses": { - "200": { - "description": "Returns the order object if the update succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/10_obj_order_object" - }, - "examples": { - "Example": { - "value": { - "id": "ord_cRKOEXiBOj0EZKF7g9n6l0eH", - "source_id": "new", - "created_at": "2022-09-09T09:20:01.660Z", - "updated_at": "2022-09-09T09:41:00.881Z", - "status": "CANCELED", - "amount": 121700, - "total_amount": 121700, - "items": [ - { - "object": "order_item", - "source_id": "prod_1", - "related_object": "product", - "quantity": 2, - "amount": 120000, - "price": 60000, - "subtotal_amount": 120000, - "product": { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "metadata": { - "color": [ - "purple" - ], - "vendor": "mall" - }, - "price": 60000 - } - }, - { - "object": "order_item", - "source_id": "ComicBook_1", - "related_object": "sku", - "product_id": "prod_0b7d7dfb05cbe5c616", - "quantity": 1, - "amount": 1700, - "price": 1700, - "subtotal_amount": 1700, - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "metadata": { - "color": [ - "silver" - ], - "vendor": "Bookstore1" - }, - "price": 2100 - }, - "sku": { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "sku": "Comics1", - "metadata": { - "color": [ - "golden" - ], - "vendor": "islands" - }, - "price": 1700 - } - } - ], - "metadata": { - "location_id": [ - "L1", - "L2" - ], - "payment_mean": [ - "paypal", - "credit-card" - ] - }, - "customer": { - "id": "cust_H0nXrItO1DNV3UiPIl54HA5o", - "object": "customer" - }, - "referrer": { - "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", - "object": "customer" - }, - "customer_id": "cust_H0nXrItO1DNV3UiPIl54HA5o", - "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", - "object": "order" - } - } - } - } + "examples": { + "Example": { + "value": { + "status": "CANCELED" } } } } - }, - "/v1/orders/import": { - "post": { - "operationId": "import-orders", - "tags": [ - "ORDERS API" - ], - "summary": "Import Orders", - "description": "\n\n> 🚧 Historical orders\n>\n> This endpoint should only be used to import historical orders into Voucherify. For on-going synchronization, the [create order](ref:create-order) and [update order](ref:update-order) endpoints should be used. This is critical because this endpoint does not store events or launch distributions.\n\n## Limitations\n\n### Import volume\n\nThere 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. \n\n### Maximum count of orders in single import\n\nThere is a `2000` limit but we might decide to change it to a lower / higher value at any given time depending if we find this value is too high or too low with time.\n\n## Notifications\n\nThere are no notifications on the Dashboard because this import is launched via the API.\n\n## Triggered actions\n \nIf you import orders with customers, then a logic will be scheduled responsible for placing these customers into segments and refreshing the segment's summary. Consequently, this update will trigger \n- **customers entering into segments** \n- **distributions** based on any rules tied to customer entering segment(s)\n- **earning rules** based on the customer entering segment(s)\n\n## What is not triggered\n\n1. No webhooks are triggered during the import of orders - for both orders and upserted products / skus. \n\n2. 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. \n\n3. No events are created during the import of orders - for both orders and upserted products / skus. In other words you won't 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 won't see the Product created events listed, etc. \n\n4. Earning rules based on Order Paid won't be triggered.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "The request body is sent in the form of an array of order objects.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/10_req_orders_import" - }, - "examples": { - "Example": { - "value": [ - { - "source_id": "orderImport14", - "status": "PAID", + } + }, + "responses": { + "200": { + "description": "Returns the order object if the update succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/10_obj_order_object" + }, + "examples": { + "Example": { + "value": { + "id": "ord_cRKOEXiBOj0EZKF7g9n6l0eH", + "source_id": "new", + "created_at": "2022-09-09T09:20:01.660Z", + "updated_at": "2022-09-09T09:41:00.881Z", + "status": "CANCELED", + "amount": 121700, + "total_amount": 121700, + "items": [ + { + "object": "order_item", + "source_id": "prod_1", + "related_object": "product", + "quantity": 2, + "amount": 120000, + "price": 60000, + "subtotal_amount": 120000, + "product": { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", "metadata": { - "location_id": [ - "L1", - "L2" + "color": [ + "purple" ], - "payment_mean": [ - "paypal", - "credit-card" - ] - }, - "customer": { - "source_id": "bob2.smith@email.com", - "name": "Bob Smith", - "description": "A nice customer", - "email": "bob.smith@email.com", - "phone": "+1 933 222 3333", - "address": { - "city": "New York", - "country": "United States", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 4", - "postal_code": "10001", - "state": "NY" - }, - "metadata": { - "lang": "en", - "test": true - }, - "birthdate": "2022-01-01" - }, - "referrer": { - "source_id": "jane.smith@email.com", - "name": "Jane Smith", - "description": "A really nice customer", - "email": "jane.smith@email.com", - "phone": "+1 933 222 3334", - "address": { - "city": "New York", - "country": "United States", - "line_1": "123 Main St.", - "line_2": "APT 3 BLG 4", - "postal_code": "10001", - "state": "NY" - }, - "metadata": { - "lang": "en", - "test": false - }, - "birthday": "2022-03-03" + "vendor": "mall" }, - "items": [ - { - "source_id": "prod_1", - "related_object": "product", - "quantity": 2, - "product": { - "name": "Apple iPhone 12", - "price": 70000, - "metadata": { - "color": [ - "silver" - ], - "vendor": "mall" - }, - "override": true - } - }, - { - "source_id": "ComicBook_1", - "related_object": "sku", - "quantity": 1, - "product": { - "source_id": "Books", - "name": "Comic Books1", - "price": 1600, - "metadata": { - "color": [ - "silver" - ], - "vendor": "Bookstore1" - }, - "override": true - }, - "sku": { - "sku": "Comics1", - "source_id": "ComicBook_1", - "price": 1600, - "metadata": { - "color": [ - "golden" - ], - "vendor": "islands" - }, - "override": true - } - } - ] - }, - { - "source_id": "orderImport15", - "status": "PAID", + "price": 60000 + } + }, + { + "object": "order_item", + "source_id": "ComicBook_1", + "related_object": "sku", + "product_id": "prod_0b7d7dfb05cbe5c616", + "quantity": 1, + "amount": 1700, + "price": 1700, + "subtotal_amount": 1700, + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", "metadata": { - "location_id": [ - "L3" + "color": [ + "silver" ], - "payment_mean": [ - "wire-transfer" - ] + "vendor": "Bookstore1" }, - "customer": { - "source_id": "bob2.smith@email.com" - }, - "referrer": { - "source_id": "jane.smith@email.com" - }, - "items": [ - { - "source_id": "ComicBook_1", - "quantity": 4, - "related_object": "sku", - "sku": { - "source_id": "ComicBook_1" - } - }, - { - "source_id": "vase_1", - "quantity": 1, - "related_object": "product", - "product": { - "source_id": "vase_1" - } - } - ] + "price": 2100 }, - { - "source_id": "orderImport16", - "status": "FULFILLED", + "sku": { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "sku": "Comics1", "metadata": { - "location_id": [ - "L3" + "color": [ + "golden" ], - "payment_mean": [ - "wire-transfer" - ] - }, - "customer": { - "id": "cust_LMY4ZylSdUYB1J4tzqNcl5VV" - }, - "referrer": { - "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" + "vendor": "islands" }, - "items": [ - { - "product_id": "prod_0b72b0bd64d198e3ae", - "quantity": 2 - }, - { - "sku_id": "sku_0b1621b319d248b79f", - "quantity": 2 - } - ] - }, - { - "source_id": "orderImport17", - "status": "CANCELED", - "amount": 7000, - "metadata": { - "location_id": [ - "L3" - ], - "payment_mean": [ - "wire-transfer" - ] - } - }, - { - "source_id": "orderImport18", - "status": "CREATED", + "price": 1700 + } + } + ], + "metadata": { + "location_id": [ + "L1", + "L2" + ], + "payment_mean": [ + "paypal", + "credit-card" + ] + }, + "customer": { + "id": "cust_H0nXrItO1DNV3UiPIl54HA5o", + "object": "customer" + }, + "referrer": { + "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", + "object": "customer" + }, + "customer_id": "cust_H0nXrItO1DNV3UiPIl54HA5o", + "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv", + "object": "order" + } + } + } + } + } + } + } + } + }, + "/v1/orders/import": { + "post": { + "operationId": "import-orders", + "tags": [ + "ORDERS API" + ], + "summary": "Import Orders", + "description": "\n\n> 🚧 Historical orders\n>\n> This endpoint should only be used to import historical orders into Voucherify. For on-going synchronization, the [create order](ref:create-order) and [update order](ref:update-order) endpoints should be used. This is critical because this endpoint does not store events or launch distributions.\n\n## Limitations\n\n### Import volume\n\nThere 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. \n\n### Maximum count of orders in single import\n\nThere is a `2000` limit but we might decide to change it to a lower / higher value at any given time depending if we find this value is too high or too low with time.\n\n## Notifications\n\nThere are no notifications on the Dashboard because this import is launched via the API.\n\n## Triggered actions\n \nIf you import orders with customers, then a logic will be scheduled responsible for placing these customers into segments and refreshing the segment's summary. Consequently, this update will trigger \n- **customers entering into segments** \n- **distributions** based on any rules tied to customer entering segment(s)\n- **earning rules** based on the customer entering segment(s)\n\n## What is not triggered\n\n1. No webhooks are triggered during the import of orders - for both orders and upserted products / skus. \n\n2. 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. \n\n3. No events are created during the import of orders - for both orders and upserted products / skus. In other words you won't 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 won't see the Product created events listed, etc. \n\n4. Earning rules based on Order Paid won't be triggered.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "The request body is sent in the form of an array of order objects.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/10_req_orders_import" + }, + "examples": { + "Example": { + "value": [ + { + "source_id": "orderImport14", + "status": "PAID", + "metadata": { + "location_id": [ + "L1", + "L2" + ], + "payment_mean": [ + "paypal", + "credit-card" + ] + }, + "customer": { + "source_id": "bob2.smith@email.com", + "name": "Bob Smith", + "description": "A nice customer", + "email": "bob.smith@email.com", + "phone": "+1 933 222 3333", + "address": { + "city": "New York", + "country": "United States", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 4", + "postal_code": "10001", + "state": "NY" + }, + "metadata": { + "lang": "en", + "test": true + }, + "birthdate": "2022-01-01" + }, + "referrer": { + "source_id": "jane.smith@email.com", + "name": "Jane Smith", + "description": "A really nice customer", + "email": "jane.smith@email.com", + "phone": "+1 933 222 3334", + "address": { + "city": "New York", + "country": "United States", + "line_1": "123 Main St.", + "line_2": "APT 3 BLG 4", + "postal_code": "10001", + "state": "NY" + }, + "metadata": { + "lang": "en", + "test": false + }, + "birthday": "2022-03-03" + }, + "items": [ + { + "source_id": "prod_1", + "related_object": "product", + "quantity": 2, + "product": { + "name": "Apple iPhone 12", + "price": 70000, "metadata": { - "location_id": [ - "L3" + "color": [ + "silver" ], - "payment_mean": [ - "wire-transfer" - ] + "vendor": "mall" }, - "items": [ - { - "source_id": "ComicBook_1", - "amount": 900, - "related_object": "sku" - }, - { - "source_id": "vase_1", - "amount": 2000, - "related_object": "product" - } - ] - }, - { - "source_id": "orderImport19", - "status": "CREATED", + "override": true + } + }, + { + "source_id": "ComicBook_1", + "related_object": "sku", + "quantity": 1, + "product": { + "source_id": "Books", + "name": "Comic Books1", + "price": 1600, "metadata": { - "location_id": [ - "L3" + "color": [ + "silver" ], - "payment_mean": [ - "wire-transfer" - ] + "vendor": "Bookstore1" }, - "items": [ - { - "amount": 900 - }, - { - "amount": 2000 - } - ] + "override": true }, - { - "source_id": "orderImport20", - "status": "CREATED", + "sku": { + "sku": "Comics1", + "source_id": "ComicBook_1", + "price": 1600, "metadata": { - "location_id": [ - "L3" + "color": [ + "golden" ], - "payment_mean": [ - "wire-transfer" - ] + "vendor": "islands" }, - "items": [ - { - "price": 900, - "quantity": 2 - }, - { - "price": 2000, - "quantity": 3 - } - ] + "override": true } + } + ] + }, + { + "source_id": "orderImport15", + "status": "PAID", + "metadata": { + "location_id": [ + "L3" + ], + "payment_mean": [ + "wire-transfer" ] - } - } - } - } - }, - "responses": { - "200": { - "description": "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](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" }, - "examples": { - "Example": { - "value": { - "async_action_id": "aa_0a875d56c805df6601" + "customer": { + "source_id": "bob2.smith@email.com" + }, + "referrer": { + "source_id": "jane.smith@email.com" + }, + "items": [ + { + "source_id": "ComicBook_1", + "quantity": 4, + "related_object": "sku", + "sku": { + "source_id": "ComicBook_1" + } + }, + { + "source_id": "vase_1", + "quantity": 1, + "related_object": "product", + "product": { + "source_id": "vase_1" } } - } - } - } - }, - "400": { - "description": "Returns an error if the payload is invalid.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" + ] + }, + { + "source_id": "orderImport16", + "status": "FULFILLED", + "metadata": { + "location_id": [ + "L3" + ], + "payment_mean": [ + "wire-transfer" + ] }, - "examples": { - "Invalid Payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Property .items[0].initial_quantity cannot be lower than 1", - "request_id": "v-0c5561d945cb0f0fb5" - } + "customer": { + "id": "cust_LMY4ZylSdUYB1J4tzqNcl5VV" + }, + "referrer": { + "id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" + }, + "items": [ + { + "product_id": "prod_0b72b0bd64d198e3ae", + "quantity": 2 + }, + { + "sku_id": "sku_0b1621b319d248b79f", + "quantity": 2 } + ] + }, + { + "source_id": "orderImport17", + "status": "CANCELED", + "amount": 7000, + "metadata": { + "location_id": [ + "L3" + ], + "payment_mean": [ + "wire-transfer" + ] } + }, + { + "source_id": "orderImport18", + "status": "CREATED", + "metadata": { + "location_id": [ + "L3" + ], + "payment_mean": [ + "wire-transfer" + ] + }, + "items": [ + { + "source_id": "ComicBook_1", + "amount": 900, + "related_object": "sku" + }, + { + "source_id": "vase_1", + "amount": 2000, + "related_object": "product" + } + ] + }, + { + "source_id": "orderImport19", + "status": "CREATED", + "metadata": { + "location_id": [ + "L3" + ], + "payment_mean": [ + "wire-transfer" + ] + }, + "items": [ + { + "amount": 900 + }, + { + "amount": 2000 + } + ] + }, + { + "source_id": "orderImport20", + "status": "CREATED", + "metadata": { + "location_id": [ + "L3" + ], + "payment_mean": [ + "wire-transfer" + ] + }, + "items": [ + { + "price": 900, + "quantity": 2 + }, + { + "price": 2000, + "quantity": 3 + } + ] + } + ] + } + } + } + } + }, + "responses": { + "200": { + "description": "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](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" + }, + "examples": { + "Example": { + "value": { + "async_action_id": "aa_0a875d56c805df6601" } } } } } }, - "/v1/orders/export": { - "post": { - "operationId": "create-order-export", - "tags": [ - "ORDERS API" - ], - "summary": "Create Orders Export", - "description": "Creates a downloadable CSV file containing a list of orders.\n\nThe 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.\n\nThe available filters are all [order object](ref:get-order) attributes. Additionally, any metadata defined in the metadata schema can be exported.\n\nPassing an empty JSON will generate a file containing three default fields: `id`, `source_id`, and `status`.\n\nThe 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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique order ID. | ord_A69RIxEdRsPuC6i8gFGVHUft |\n| source_id | Unique order source ID. | 8638 |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the order was created. | 2022-03-09T09:16:32.521Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the order was last updated. | 2022-03-09T09:16:33.331Z |\n| status | Order status. | `PAID`, `CREATED`, `FULFILLED`, `CANCELED` |\n| amount | Total amount of order items. | 7700 |\n| discount_amount | Represents total amount of the discount applied to whole cart. | 500 |\n| items_discount_amount | Represents total amount of the discount applied to order line items. | 100 |\n| total_discount_amount | All discounts applied to the order including discounts applied to particular order line items and discounts applied to the whole cart. | 600 |\n| total_amount | Total order amount after applying all discounts. | 7100 |\n| customer_id | Customer unique ID. | cust_2G4fUQdCXUqp35nXNleav7bO |\n| referrer_id | Referrer unique ID. | cust_IkrTR674vvQvr9a4rDMiqglY |\n| metadata | Returns all order metadata. | Response will include all order metadata. |\n| metadata.X | Where X is the name of a particular order metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Order. |", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify which order parameters you would like to export.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/10_req_create_order_export" - }, - "examples": { - "Using fields": { - "value": { - "parameters": { - "fields": [ - "id", - "source_id", - "status", - "created_at", - "updated_at", - "amount", - "discount_amount", - "items_discount_amount", - "total_discount_amount", - "total_amount", - "customer_id", - "referrer_id", - "metadata.payment_mean" - ] - } - } - }, - "Using fields and filters": { - "value": { - "parameters": { - "fields": [ - "id", - "source_id", - "status", - "created_at", - "updated_at", - "amount", - "discount_amount", - "items_discount_amount", - "total_discount_amount", - "total_amount", - "customer_id", - "referrer_id", - "metadata.payment_mean" - ], - "order": "-updated_at", - "filters": { - "discount_amount": { - "conditions": { - "$more_than": 100000 - } - } - } - } - } - } + "400": { + "description": "Returns an error if the payload is invalid.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Invalid Payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Property .items[0].initial_quantity cannot be lower than 1", + "request_id": "v-0c5561d945cb0f0fb5" } } } + } + } + } + } + } + }, + "/v1/orders/export": { + "post": { + "operationId": "create-order-export", + "tags": [ + "ORDERS API" + ], + "summary": "Create Orders Export", + "description": "Creates a downloadable CSV file containing a list of orders.\n\nThe 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.\n\nThe available filters are all [order object](ref:get-order) attributes. Additionally, any metadata defined in the metadata schema can be exported.\n\nPassing an empty JSON will generate a file containing three default fields: `id`, `source_id`, and `status`.\n\nThe 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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique order ID. | ord_A69RIxEdRsPuC6i8gFGVHUft |\n| source_id | Unique order source ID. | 8638 |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the order was created. | 2022-03-09T09:16:32.521Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the order was last updated. | 2022-03-09T09:16:33.331Z |\n| status | Order status. | `PAID`, `CREATED`, `FULFILLED`, `CANCELED` |\n| amount | Total amount of order items. | 7700 |\n| discount_amount | Represents total amount of the discount applied to whole cart. | 500 |\n| items_discount_amount | Represents total amount of the discount applied to order line items. | 100 |\n| total_discount_amount | All discounts applied to the order including discounts applied to particular order line items and discounts applied to the whole cart. | 600 |\n| total_amount | Total order amount after applying all discounts. | 7100 |\n| customer_id | Customer unique ID. | cust_2G4fUQdCXUqp35nXNleav7bO |\n| referrer_id | Referrer unique ID. | cust_IkrTR674vvQvr9a4rDMiqglY |\n| metadata | Returns all order metadata. | Response will include all order metadata. |\n| metadata.X | Where X is the name of a particular order metadata property. | The returned value will depend on the type of data defined in the Dashboard > Project Settings > Metdata Schemas > Order. |", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify which order parameters you would like to export.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/10_req_create_order_export" }, - "responses": { - "200": { - "description": "Returns the `id` of the export object and `status` of the file generation process. The `id` is used in the [Get Export](ref:get-export) method to generate the url for the downloadable CSV file or in the [Download Export](ref:download-export) method to return the contents of the CSV file. The status indicates whether the file has been scheduled for creation.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/16_obj_export_object" - }, - "examples": { - "Example": { - "value": { - "id": "exp_pT2Y1mgYsAgRAqsWTGf7PQX7", - "object": "export", - "created_at": "2022-09-09T10:45:52.362Z", - "status": "SCHEDULED", - "channel": "API", - "exported_object": "order", - "parameters": { - "fields": [ - "id", - "source_id", - "status", - "created_at", - "updated_at", - "amount", - "discount_amount", - "items_discount_amount", - "total_discount_amount", - "total_amount", - "customer_id", - "referrer_id", - "metadata.payment_mean" - ] - }, - "result": null, - "user_id": null - } - } - } + "examples": { + "Using fields": { + "value": { + "parameters": { + "fields": [ + "id", + "source_id", + "status", + "created_at", + "updated_at", + "amount", + "discount_amount", + "items_discount_amount", + "total_discount_amount", + "total_amount", + "customer_id", + "referrer_id", + "metadata.payment_mean" + ] } } }, - "400": { - "description": "Returns an error if the request payload is specified incorrectly.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Invalid payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Property .parameters.filters should match either `filters[${field}][conditions][${condition}][${index}]` or `filters[${field}][conditions][${condition}]` format and condition must be one of: $in, $not_in, $in_location, $not_in_location, $is, $is_days_ago, $is_days_in_future, $is_not, $has_value, $is_unknown, $contains, $not_contain, $starts_with, $ends_with, $more_than, $less_than, $more_than_ago, $less_than_ago, $more_than_future, $less_than_future, $more_than_equal, $less_than_equal, $after, $before, $count, $count_less, $count_more, $today, $tomorrow, $yesterday, $this_week, $last_week, $next_week, $this_month, $last_month, $next_month, $this_year, $next_year, $last_year, $is_day_of_month, $is_day, $is_month, $is_year, $today_md, $tomorrow_md, $yesterday_md, $this_week_md, $last_week_md, $next_week_md, $this_month_md, $last_month_md, $next_month_md, $is_days_ago_md, $is_more_days_ago_md, $is_less_days_ago_md, $is_days_in_future_md, $is_more_days_in_future_md, $is_less_days_in_future_md, $is_years_ago, $active, $failed, $in_progress, $expired, $before_start, $enabled, $disabled, $redeemed, $redeemable", - "request_id": "v-0c52e783650ae585b2" + "Using fields and filters": { + "value": { + "parameters": { + "fields": [ + "id", + "source_id", + "status", + "created_at", + "updated_at", + "amount", + "discount_amount", + "items_discount_amount", + "total_discount_amount", + "total_amount", + "customer_id", + "referrer_id", + "metadata.payment_mean" + ], + "order": "-updated_at", + "filters": { + "discount_amount": { + "conditions": { + "$more_than": 100000 } } } @@ -78906,3591 +78912,3468 @@ } } } - }, - "/v1/product-object": { - "get": { - "operationId": "product-object", - "tags": [ - "PRODUCTS API" - ], - "summary": "Product Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Product Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_obj_product_object" - } + } + }, + "responses": { + "200": { + "description": "Returns the `id` of the export object and `status` of the file generation process. The `id` is used in the [Get Export](ref:get-export) method to generate the url for the downloadable CSV file or in the [Download Export](ref:download-export) method to return the contents of the CSV file. The status indicates whether the file has been scheduled for creation.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/16_obj_export_object" + }, + "examples": { + "Example": { + "value": { + "id": "exp_pT2Y1mgYsAgRAqsWTGf7PQX7", + "object": "export", + "created_at": "2022-09-09T10:45:52.362Z", + "status": "SCHEDULED", + "channel": "API", + "exported_object": "order", + "parameters": { + "fields": [ + "id", + "source_id", + "status", + "created_at", + "updated_at", + "amount", + "discount_amount", + "items_discount_amount", + "total_discount_amount", + "total_amount", + "customer_id", + "referrer_id", + "metadata.payment_mean" + ] + }, + "result": null, + "user_id": null } } } } } }, - "/v1/sku-object": { - "get": { - "operationId": "sku-object", - "tags": [ - "PRODUCTS API" - ], - "summary": "SKU Object", - "description": "Data model description", - "responses": { - "200": { - "description": "SKU Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_obj_sku_object" - } + "400": { + "description": "Returns an error if the request payload is specified incorrectly.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Invalid payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Property .parameters.filters should match either `filters[${field}][conditions][${condition}][${index}]` or `filters[${field}][conditions][${condition}]` format and condition must be one of: $in, $not_in, $in_location, $not_in_location, $is, $is_days_ago, $is_days_in_future, $is_not, $has_value, $is_unknown, $contains, $not_contain, $starts_with, $ends_with, $more_than, $less_than, $more_than_ago, $less_than_ago, $more_than_future, $less_than_future, $more_than_equal, $less_than_equal, $after, $before, $count, $count_less, $count_more, $today, $tomorrow, $yesterday, $this_week, $last_week, $next_week, $this_month, $last_month, $next_month, $this_year, $next_year, $last_year, $is_day_of_month, $is_day, $is_month, $is_year, $today_md, $tomorrow_md, $yesterday_md, $this_week_md, $last_week_md, $next_week_md, $this_month_md, $last_month_md, $next_month_md, $is_days_ago_md, $is_more_days_ago_md, $is_less_days_ago_md, $is_days_in_future_md, $is_more_days_in_future_md, $is_less_days_in_future_md, $is_years_ago, $active, $failed, $in_progress, $expired, $before_start, $enabled, $disabled, $redeemed, $redeemable", + "request_id": "v-0c52e783650ae585b2" } } } } } - }, - "/v1/products": { - "get": { - "operationId": "list-products", - "tags": [ - "PRODUCTS API" - ], - "summary": "List Products", - "description": "Retrieve a list of products.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ] - }, - "in": "query", - "name": "order", - "description": "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." + } + } + } + }, + "/v1/product-object": { + "get": { + "operationId": "product-object", + "tags": [ + "PRODUCTS API" + ], + "summary": "Product Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Product Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_obj_product_object" } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + } + } + } + } + } + }, + "/v1/sku-object": { + "get": { + "operationId": "sku-object", + "tags": [ + "PRODUCTS API" + ], + "summary": "SKU Object", + "description": "Data model description", + "responses": { + "200": { + "description": "SKU Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_obj_sku_object" } - ], - "responses": { - "200": { - "description": "Returns a dictionary with product objects. The products are returned sorted by creation date by default, with the most recent products appearing last, unless you specify another sequence using the `order` query parameter.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_res_list_products" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "products", - "products": [ + } + } + } + } + } + }, + "/v1/products": { + "get": { + "operationId": "list-products", + "tags": [ + "PRODUCTS API" + ], + "summary": "List Products", + "description": "Retrieve a list of products.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + }, + "in": "query", + "name": "order", + "description": "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." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with product objects. The products are returned sorted by creation date by default, with the most recent products appearing last, unless you specify another sequence using the `order` query parameter.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_res_list_products" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "products", + "products": [ + { + "id": "prod_f1r5Tpr0DuC7", + "source_id": "test_prod_id_1", + "name": "Apple iPhone 8", + "price": null, + "attributes": [ + "color", + "memory" + ], + "metadata": { + "test": true, + "vendor": "Cortland" + }, + "image_url": null, + "created_at": "2021-12-03T06:33:46.101Z", + "updated_at": null, + "object": "product", + "skus": { + "data": [ { - "id": "prod_f1r5Tpr0DuC7", - "source_id": "test_prod_id_1", - "name": "Apple iPhone 8", + "id": "sku_0a417bd1d9952f9d6f", + "source_id": "test_iphone_8_silver_256gb", + "product_id": "prod_f1r5Tpr0DuC7", + "sku": "iPhone 8 Silver 256GB", "price": null, - "attributes": [ - "color", - "memory" - ], - "metadata": { - "test": true, - "vendor": "Cortland" + "currency": null, + "attributes": { + "color": "silver", + "memory": "256" }, "image_url": null, - "created_at": "2021-12-03T06:33:46.101Z", + "metadata": {}, + "created_at": "2021-12-03T06:33:46.599097+00:00", "updated_at": null, - "object": "product", - "skus": { - "data": [ - { - "id": "sku_0a417bd1d9952f9d6f", - "source_id": "test_iphone_8_silver_256gb", - "product_id": "prod_f1r5Tpr0DuC7", - "sku": "iPhone 8 Silver 256GB", - "price": null, - "currency": null, - "attributes": { - "color": "silver", - "memory": "256" - }, - "image_url": null, - "metadata": {}, - "created_at": "2021-12-03T06:33:46.599097+00:00", - "updated_at": null, - "object": "sku" - }, - { - "id": "sku_0a417bd1d9952f9d6e", - "source_id": "test_iphone_8_silver_64gb", - "product_id": "prod_f1r5Tpr0DuC7", - "sku": "iPhone 8 Silver 64GB", - "price": null, - "currency": null, - "attributes": { - "color": "silver", - "memory": "64" - }, - "image_url": null, - "metadata": {}, - "created_at": "2021-12-03T06:33:46.598595+00:00", - "updated_at": null, - "object": "sku" - } - ], - "total": 2 - } + "object": "sku" }, { - "id": "prod_0ac67e1bb8072eec48", - "source_id": "test_volleyball", - "name": "VolleyBall", - "price": 1100, - "attributes": [], + "id": "sku_0a417bd1d9952f9d6e", + "source_id": "test_iphone_8_silver_64gb", + "product_id": "prod_f1r5Tpr0DuC7", + "sku": "iPhone 8 Silver 64GB", + "price": null, + "currency": null, + "attributes": { + "color": "silver", + "memory": "64" + }, + "image_url": null, + "metadata": {}, + "created_at": "2021-12-03T06:33:46.598595+00:00", + "updated_at": null, + "object": "sku" + } + ], + "total": 2 + } + }, + { + "id": "prod_0ac67e1bb8072eec48", + "source_id": "test_volleyball", + "name": "VolleyBall", + "price": 1100, + "attributes": [], + "metadata": { + "color": [ + "white" + ], + "label": true, + "origin": "PL" + }, + "image_url": null, + "created_at": "2022-03-16T14:01:45.459Z", + "updated_at": "2022-04-26T12:51:35.500Z", + "object": "product", + "skus": { + "data": [ + { + "id": "sku_0ac768973f5c4ea0d0", + "source_id": "test_volleyball_pl", + "product_id": "prod_0ac67e1bb8072eec48", + "sku": "PL", + "price": 500, + "currency": "USD", + "attributes": {}, + "image_url": null, "metadata": { "color": [ - "white" - ], - "label": true, - "origin": "PL" + "red" + ] }, + "created_at": "2022-03-17T07:06:13.629918+00:00", + "updated_at": null, + "object": "sku" + }, + { + "id": "sku_0ac7689713072e1df6", + "source_id": "test_volleyball_us", + "product_id": "prod_0ac67e1bb8072eec48", + "sku": "US", + "price": 1500, + "currency": "USD", + "attributes": {}, "image_url": null, - "created_at": "2022-03-16T14:01:45.459Z", - "updated_at": "2022-04-26T12:51:35.500Z", - "object": "product", - "skus": { - "data": [ - { - "id": "sku_0ac768973f5c4ea0d0", - "source_id": "test_volleyball_pl", - "product_id": "prod_0ac67e1bb8072eec48", - "sku": "PL", - "price": 500, - "currency": "USD", - "attributes": {}, - "image_url": null, - "metadata": { - "color": [ - "red" - ] - }, - "created_at": "2022-03-17T07:06:13.629918+00:00", - "updated_at": null, - "object": "sku" - }, - { - "id": "sku_0ac7689713072e1df6", - "source_id": "test_volleyball_us", - "product_id": "prod_0ac67e1bb8072eec48", - "sku": "US", - "price": 1500, - "currency": "USD", - "attributes": {}, - "image_url": null, - "metadata": { - "color": [ - "yellow" - ] - }, - "created_at": "2022-03-17T07:06:13.452532+00:00", - "updated_at": null, - "object": "sku" - } - ], - "total": 2 - } + "metadata": { + "color": [ + "yellow" + ] + }, + "created_at": "2022-03-17T07:06:13.452532+00:00", + "updated_at": null, + "object": "sku" } ], "total": 2 } } - } + ], + "total": 2 } } } } - }, - "post": { - "operationId": "create-product", - "tags": [ - "PRODUCTS API" - ], - "summary": "Create Product", - "description": "Creates a product object.\n\n\n\n> 🚧 Upsert Mode\n>\n> If you pass a `source_id` that already exists in the product database, Voucherify will return a related product object with updated fields.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the product parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_req_create_product" + } + } + } + }, + "post": { + "operationId": "create-product", + "tags": [ + "PRODUCTS API" + ], + "summary": "Create Product", + "description": "Creates a product object.\n\n\n\n> 🚧 Upsert Mode\n>\n> If you pass a `source_id` that already exists in the product database, Voucherify will return a related product object with updated fields.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the product parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_req_create_product" + }, + "examples": { + "Example": { + "value": { + "source_id": "first_product", + "name": "Samsung Phone", + "price": 200000, + "attributes": [ + "color", + "memory", + "processor" + ], + "metadata": { + "test": true, + "vendor": "Online Store" }, - "examples": { - "Example": { - "value": { - "source_id": "first_product", - "name": "Samsung Phone", - "price": 200000, - "attributes": [ - "color", - "memory", - "processor" - ], - "metadata": { - "test": true, - "vendor": "Online Store" - }, - "image_url": "https://www.website.com/image.png" - } - } - } + "image_url": "https://www.website.com/image.png" } } - }, - "responses": { - "200": { - "description": "Returns a product object if the operation succeeded.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_obj_product_object" + } + } + } + }, + "responses": { + "200": { + "description": "Returns a product object if the operation succeeded.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_obj_product_object" + }, + "examples": { + "Example": { + "value": { + "id": "prod_0bae2dc5a090fd0184", + "source_id": "first_product", + "name": "Samsung Phone", + "price": 200000, + "attributes": [ + "color", + "memory", + "processor" + ], + "metadata": { + "test": true, + "vendor": "Online Store" }, - "examples": { - "Example": { - "value": { - "id": "prod_0bae2dc5a090fd0184", - "source_id": "first_product", - "name": "Samsung Phone", - "price": 200000, - "attributes": [ - "color", - "memory", - "processor" - ], - "metadata": { - "test": true, - "vendor": "Online Store" - }, - "image_url": "https://www.website.com/image.png", - "created_at": "2022-09-12T12:58:22.232Z", - "updated_at": "2022-09-12T12:59:55.890Z", - "object": "product" - } - } - } + "image_url": "https://www.website.com/image.png", + "created_at": "2022-09-12T12:58:22.232Z", + "updated_at": "2022-09-12T12:59:55.890Z", + "object": "product" } } } } } + } + } + } + }, + "/v1/products/{productId}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "prod_f1r5Tpr0DuC7" }, - "/v1/products/{productId}": { - "parameters": [ - { + "name": "productId", + "in": "path", + "required": true, + "description": "A Voucherify product ID or source ID." + } + ], + "get": { + "operationId": "get-product", + "tags": [ + "PRODUCTS API" + ], + "summary": "Get Product", + "description": "Retrieve product details.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a product object if a valid identifier was provided.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "prod_f1r5Tpr0DuC7" - }, - "name": "productId", - "in": "path", - "required": true, - "description": "A Voucherify product ID or source ID." - } - ], - "get": { - "operationId": "get-product", - "tags": [ - "PRODUCTS API" - ], - "summary": "Get Product", - "description": "Retrieve product details.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a product object if a valid identifier was provided.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_obj_product_object" - }, - "examples": { - "Example": { - "value": { - "id": "prod_f1r5Tpr0DuC7", - "source_id": "test_prod_id_1", - "name": "Apple iPhone 8", + "$ref": "#/components/schemas/11_obj_product_object" + }, + "examples": { + "Example": { + "value": { + "id": "prod_f1r5Tpr0DuC7", + "source_id": "test_prod_id_1", + "name": "Apple iPhone 8", + "price": null, + "attributes": [ + "color", + "memory" + ], + "metadata": { + "test": true, + "vendor": "Cortland" + }, + "image_url": null, + "created_at": "2021-12-03T06:33:46.101Z", + "updated_at": null, + "object": "product", + "skus": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "sku_0a417bd1d9952f9d6f", + "source_id": "test_iphone_8_silver_256gb", + "product_id": "prod_f1r5Tpr0DuC7", + "sku": "iPhone 8 Silver 256GB", "price": null, - "attributes": [ - "color", - "memory" - ], - "metadata": { - "test": true, - "vendor": "Cortland" + "currency": null, + "attributes": { + "color": "silver", + "memory": "256" }, "image_url": null, - "created_at": "2021-12-03T06:33:46.101Z", + "metadata": {}, + "created_at": "2021-12-03T06:33:46.599097+00:00", "updated_at": null, - "object": "product", - "skus": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "sku_0a417bd1d9952f9d6f", - "source_id": "test_iphone_8_silver_256gb", - "product_id": "prod_f1r5Tpr0DuC7", - "sku": "iPhone 8 Silver 256GB", - "price": null, - "currency": null, - "attributes": { - "color": "silver", - "memory": "256" - }, - "image_url": null, - "metadata": {}, - "created_at": "2021-12-03T06:33:46.599097+00:00", - "updated_at": null, - "object": "sku" - }, - { - "id": "sku_0a417bd1d9952f9d6e", - "source_id": "test_iphone_8_silver_64gb", - "product_id": "prod_f1r5Tpr0DuC7", - "sku": "iPhone 8 Silver 64GB", - "price": null, - "currency": null, - "attributes": { - "color": "silver", - "memory": "64" - }, - "image_url": null, - "metadata": {}, - "created_at": "2021-12-03T06:33:46.598595+00:00", - "updated_at": null, - "object": "sku" - } - ], - "total": 2 - } + "object": "sku" + }, + { + "id": "sku_0a417bd1d9952f9d6e", + "source_id": "test_iphone_8_silver_64gb", + "product_id": "prod_f1r5Tpr0DuC7", + "sku": "iPhone 8 Silver 64GB", + "price": null, + "currency": null, + "attributes": { + "color": "silver", + "memory": "64" + }, + "image_url": null, + "metadata": {}, + "created_at": "2021-12-03T06:33:46.598595+00:00", + "updated_at": null, + "object": "sku" } - } + ], + "total": 2 } } } + } + } + } + }, + "404": { + "description": "Returns an error when requesting a product that has been deleted or cannot be found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" }, - "404": { - "description": "Returns an error when requesting a product that has been deleted or cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find product with id test_prod_id_", - "request_id": "v-0bae1d3caf478da111", - "resource_id": "test_prod_id_", - "resource_type": "product" - } - } - } + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find product with id test_prod_id_", + "request_id": "v-0bae1d3caf478da111", + "resource_id": "test_prod_id_", + "resource_type": "product" } } } } - }, - "put": { - "operationId": "update-product", - "tags": [ - "PRODUCTS API" - ], - "summary": "Update Product", - "description": "Updates the specified product by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the parameters of the product that are to be updated.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_req_update_product" - }, - "examples": { - "Example": { - "value": { - "price": 210000 - } - } - } + } + } + } + }, + "put": { + "operationId": "update-product", + "tags": [ + "PRODUCTS API" + ], + "summary": "Update Product", + "description": "Updates the specified product by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the parameters of the product that are to be updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_req_update_product" + }, + "examples": { + "Example": { + "value": { + "price": 210000 } } - }, - "responses": { - "200": { - "description": "Returns an updated product object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_obj_product_object_truncated" + } + } + } + }, + "responses": { + "200": { + "description": "Returns an updated product object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_obj_product_object_truncated" + }, + "examples": { + "Example": { + "value": { + "id": "prod_0bae2dc5a090fd0184", + "source_id": "first_product", + "name": "Samsung Phone", + "price": 210000, + "attributes": [ + "color", + "memory", + "processor" + ], + "metadata": { + "test": false, + "vendor": "Online Stores" }, - "examples": { - "Example": { - "value": { - "id": "prod_0bae2dc5a090fd0184", - "source_id": "first_product", - "name": "Samsung Phone", - "price": 210000, - "attributes": [ - "color", - "memory", - "processor" - ], - "metadata": { - "test": false, - "vendor": "Online Stores" - }, - "image_url": "https://www.website.com/image.png", - "created_at": "2022-09-12T12:58:22.232Z", - "updated_at": "2022-09-12T13:33:48.904Z", - "object": "product" - } - } - } + "image_url": "https://www.website.com/image.png", + "created_at": "2022-09-12T12:58:22.232Z", + "updated_at": "2022-09-12T13:33:48.904Z", + "object": "product" } } } } + } + } + } + }, + "delete": { + "operationId": "delete-product", + "tags": [ + "PRODUCTS API" + ], + "summary": "Delete Product", + "description": "This method deletes a product.", + "parameters": [ + { + "schema": { + "type": "string" }, - "delete": { - "operationId": "delete-product", - "tags": [ - "PRODUCTS API" - ], - "summary": "Delete Product", - "description": "This method deletes a product.", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "force", - "description": "If this flag is set to `true`, the product will be removed permanently. Going forward, the user will be able to create another product with exactly the same `source_id`." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." - }, - "404": { - "description": "Returns an error indicating that the product with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Product Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find product with id prod_0a4934c50ddc5dbae", - "request_id": "v-0ae39cd7de8683dfd8", - "resource_id": "prod_0a4934c50ddc5dbae", - "resource_type": "product" - } - } - } + "in": "query", + "name": "force", + "description": "If this flag is set to `true`, the product will be removed permanently. Going forward, the user will be able to create another product with exactly the same `source_id`." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." + }, + "404": { + "description": "Returns an error indicating that the product with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Product Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find product with id prod_0a4934c50ddc5dbae", + "request_id": "v-0ae39cd7de8683dfd8", + "resource_id": "prod_0a4934c50ddc5dbae", + "resource_type": "product" } } } } } - }, - "/v1/products/bulk/async": { - "post": { - "operationId": "update-products-in-bulk", - "tags": [ - "PRODUCTS API" - ], - "summary": "Update Products in bulk", - "description": "Update several products in one asynchronous operation. \n\nIn one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. If a requested product object is not found, then an **upsert** occurs. This is reflected in the [Get Async Action](ref:get-async-action) endpoint as follows: \n\n\n```json\n{\n \"found\": false,\n \"updated\": true\n}\n```\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Create an array of product objects, each with the parameters which you want to update.", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/11_req_update_product_bulk" - } - }, - "examples": { - "Example": { - "value": [ - { - "source_id": "first_product", - "name": "Samsung Phone 1", - "price": 220000, - "attributes": [ - "color", - "memory", - "processor" - ], - "metadata": { - "test": true, - "vendor": "Online Store - 3" - }, - "image_url": "https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_Z2qvs2KFnQyo2Ohz4uhsjGtf.png" - }, - { - "source_id": "second_product", - "name": "Samsung Phone 2", - "price": 230000, - "attributes": [ - "color", - "memory", - "processor" - ], - "metadata": { - "test": true, - "vendor": "Online Store - 4" - }, - "image_url": "https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_Z2qvs2KFnQyo2Ohz4uhsjGtf.png" - } - ] - } - } - } + } + } + } + }, + "/v1/products/bulk/async": { + "post": { + "operationId": "update-products-in-bulk", + "tags": [ + "PRODUCTS API" + ], + "summary": "Update Products in bulk", + "description": "Update several products in one asynchronous operation. \n\nIn one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. If a requested product object is not found, then an **upsert** occurs. This is reflected in the [Get Async Action](ref:get-async-action) endpoint as follows: \n\n\n```json\n{\n \"found\": false,\n \"updated\": true\n}\n```\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Create an array of product objects, each with the parameters which you want to update.", + "content": { + "application/json": { + "schema": { + "type": "array", + "items": { + "$ref": "#/components/schemas/11_req_update_product_bulk" } }, - "responses": { - "202": { - "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and updates will be added to the repository asynchronously. To check the update status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" + "examples": { + "Example": { + "value": [ + { + "source_id": "first_product", + "name": "Samsung Phone 1", + "price": 220000, + "attributes": [ + "color", + "memory", + "processor" + ], + "metadata": { + "test": true, + "vendor": "Online Store - 3" }, - "examples": { - "Example": { - "value": { - "async_action_id": "aa_0a875d56c805df6601" - } - } - } + "image_url": "https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_Z2qvs2KFnQyo2Ohz4uhsjGtf.png" + }, + { + "source_id": "second_product", + "name": "Samsung Phone 2", + "price": 230000, + "attributes": [ + "color", + "memory", + "processor" + ], + "metadata": { + "test": true, + "vendor": "Online Store - 4" + }, + "image_url": "https://voucherify-uploads.s3.amazonaws.com/org_2qt8DYlM/img_Z2qvs2KFnQyo2Ohz4uhsjGtf.png" } - } + ] + } + } + } + } + }, + "responses": { + "202": { + "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and updates will be added to the repository asynchronously. To check the update status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" }, - "400": { - "description": "Returns an error if the required parameters are not included in the request body.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Example": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Payload should have required property 'source_id'", - "request_id": "v-0bae44e063cca61aff" - } - } - } + "examples": { + "Example": { + "value": { + "async_action_id": "aa_0a875d56c805df6601" } } } } } }, - "/v1/products/metadata/async": { - "post": { - "operationId": "update-products-metadata-in-bulk", - "tags": [ - "PRODUCTS API" - ], - "summary": "Update Products' Metadata in bulk", - "description": "Update several product metadata properties in one asynchronous operation. \n\nIn one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. If a requested product object is not found, then an **upsert** occurs. This is reflected in the [Get Async Action](ref:get-async-action) endpoint as follows: \n\n\n```json\n{\n \"found\": false,\n \"updated\": true\n}\n```\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the list of product source IDs and the metadata key value pairs to be udpated for these products.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_req_update_products_metadata_in_bulk" - }, - "examples": { - "Example": { - "value": { - "source_ids": [ - "123-567-3433", - "test_volleyball" - ], - "metadata": { - "label": true, - "origin": "PL" - } - } - } + "400": { + "description": "Returns an error if the required parameters are not included in the request body.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Example": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Payload should have required property 'source_id'", + "request_id": "v-0bae44e063cca61aff" } } } + } + } + } + } + } + }, + "/v1/products/metadata/async": { + "post": { + "operationId": "update-products-metadata-in-bulk", + "tags": [ + "PRODUCTS API" + ], + "summary": "Update Products' Metadata in bulk", + "description": "Update several product metadata properties in one asynchronous operation. \n\nIn one request, it is possible to update a maximum of **100** records. In the response body, you get a unique async action identifier. If a requested product object is not found, then an **upsert** occurs. This is reflected in the [Get Async Action](ref:get-async-action) endpoint as follows: \n\n\n```json\n{\n \"found\": false,\n \"updated\": true\n}\n```\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the list of product source IDs and the metadata key value pairs to be udpated for these products.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_req_update_products_metadata_in_bulk" }, - "responses": { - "202": { - "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and updates will be added to the repository asynchronously. To check the update status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" - }, - "examples": { - "Example": { - "value": { - "async_action_id": "aa_0a875d56c805df6601" - } - } - } + "examples": { + "Example": { + "value": { + "source_ids": [ + "123-567-3433", + "test_volleyball" + ], + "metadata": { + "label": true, + "origin": "PL" } } + } + } + } + } + }, + "responses": { + "202": { + "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and updates will be added to the repository asynchronously. To check the update status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" }, - "400": { - "description": "Returns an error if the request parameters are not provided.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Not enough source IDs": { - "value": { - "code": 400, - "key": "not_enough_source_ids", - "message": "Not enough source_ids", - "details": "Specify at least 1 ID in source_ids.", - "request_id": "v-0bae421d05078dcdb4" - } - }, - "Invalid Payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Payload should have required property 'metadata'", - "request_id": "v-0bae428dab8ca61825" - } - } - } + "examples": { + "Example": { + "value": { + "async_action_id": "aa_0a875d56c805df6601" } } } } } }, - "/v1/skus/{skuId}": { - "parameters": [ - { + "400": { + "description": "Returns an error if the request parameters are not provided.", + "content": { + "application/json": { "schema": { - "type": "string" + "$ref": "#/components/schemas/e_error_no_translation" }, - "name": "skuId", - "in": "path", - "required": true, - "description": "A Voucherify SKU identifier or SKU source ID." - } - ], - "get": { - "operationId": "get-sku", - "tags": [ - "PRODUCTS API" - ], - "summary": "Get SKU", - "description": "Retrieve details of a SKU.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns requested SKU object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_obj_sku_object" - }, - "examples": { - "Example": { - "value": { - "id": "sku_0b1621b2f25248b79c", - "source_id": "sku_source_id_1", - "product_id": "prod_0b15f6b9f650c16990", - "sku": "Extra Small Blue Shirt", - "price": 1300, - "currency": "USD", - "attributes": { - "size": "XS", - "color": "blue", - "ranking": 1 - }, - "image_url": "", - "metadata": {}, - "created_at": "2022-05-17T10:36:30.057Z", - "updated_at": "2022-07-01T05:34:16.822Z", - "object": "sku" - } - } - } + "examples": { + "Not enough source IDs": { + "value": { + "code": 400, + "key": "not_enough_source_ids", + "message": "Not enough source_ids", + "details": "Specify at least 1 ID in source_ids.", + "request_id": "v-0bae421d05078dcdb4" } - } - }, - "404": { - "description": "Returns an error indicating that the sku with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find sku with id sku_0b1621b319d248b79", - "request_id": "v-0b4fe3ddc55646d01d", - "resource_id": "sku_0b1621b319d248b79", - "resource_type": "sku" - } - } - } + }, + "Invalid Payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Payload should have required property 'metadata'", + "request_id": "v-0bae428dab8ca61825" } } } } } + } + } + } + }, + "/v1/skus/{skuId}": { + "parameters": [ + { + "schema": { + "type": "string" }, - "/v1/products/{productId}/skus": { - "parameters": [ - { + "name": "skuId", + "in": "path", + "required": true, + "description": "A Voucherify SKU identifier or SKU source ID." + } + ], + "get": { + "operationId": "get-sku", + "tags": [ + "PRODUCTS API" + ], + "summary": "Get SKU", + "description": "Retrieve details of a SKU.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns requested SKU object.", + "content": { + "application/json": { "schema": { - "type": "string" - }, - "name": "productId", - "in": "path", - "description": "A Voucherify [product](ref:get-product) ID or product source ID.", - "required": true - } - ], - "get": { - "operationId": "list-skus-in-product", - "tags": [ - "PRODUCTS API" - ], - "summary": "List SKUs in Product", - "description": "Retrieve all SKUs for a given product.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" + "$ref": "#/components/schemas/11_obj_sku_object" }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ] - }, - "in": "query", - "name": "order", - "description": "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." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary of SKUs.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_res_products_productId_skus" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "skus", - "skus": [ - { - "id": "sku_0b1621b2f25248b79c", - "source_id": "sku_source_id_1", - "product_id": "prod_0b15f6b9f650c16990", - "sku": "Extra Small Blue Shirt", - "price": 1300, - "currency": "USD", - "attributes": { - "size": "XS", - "color": "blue", - "ranking": 1 - }, - "image_url": "", - "metadata": {}, - "created_at": "2022-05-17T10:36:30.057Z", - "updated_at": "2022-07-01T05:34:16.822Z", - "object": "sku" - }, - { - "id": "sku_0b1621b3181248b79d", - "source_id": "sku_source_id_3", - "product_id": "prod_0b15f6b9f650c16990", - "sku": "Medium Yellow Shirt", - "price": 1450, - "currency": "USD", - "attributes": { - "size": "M", - "color": "yellow", - "ranking": 3 - }, - "image_url": "", - "metadata": {}, - "created_at": "2022-05-17T10:36:30.180Z", - "updated_at": "2022-07-01T05:34:16.842Z", - "object": "sku" - }, - { - "id": "sku_0b1621b3199248b79e", - "source_id": "sku_source_id_2", - "product_id": "prod_0b15f6b9f650c16990", - "sku": "Small Red Shirt", - "price": 1400, - "currency": "USD", - "attributes": { - "size": "S", - "color": "red", - "ranking": 2 - }, - "image_url": "", - "metadata": {}, - "created_at": "2022-05-17T10:36:30.183Z", - "updated_at": "2022-07-01T05:34:16.927Z", - "object": "sku" - }, - { - "id": "sku_0b1621b319d248b79f", - "source_id": "sku_source_id_4", - "product_id": "prod_0b15f6b9f650c16990", - "sku": "Large Pink Shirt -", - "price": 1700, - "currency": "USD", - "attributes": { - "size": "L", - "color": "pink", - "ranking": 4 - }, - "image_url": "", - "metadata": {}, - "created_at": "2022-05-17T10:36:30.187Z", - "updated_at": "2022-07-05T08:47:50.680Z", - "object": "sku" - } - ], - "total": 4 - } - } - } + "examples": { + "Example": { + "value": { + "id": "sku_0b1621b2f25248b79c", + "source_id": "sku_source_id_1", + "product_id": "prod_0b15f6b9f650c16990", + "sku": "Extra Small Blue Shirt", + "price": 1300, + "currency": "USD", + "attributes": { + "size": "XS", + "color": "blue", + "ranking": 1 + }, + "image_url": "", + "metadata": {}, + "created_at": "2022-05-17T10:36:30.057Z", + "updated_at": "2022-07-01T05:34:16.822Z", + "object": "sku" } } + } + } + } + }, + "404": { + "description": "Returns an error indicating that the sku with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" }, - "404": { - "description": "Returns an error when requesting a product that has been deleted or cannot be found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Example": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find product with id prod_0b15f6b9f650c6990", - "request_id": "v-0bae223075878da708", - "resource_id": "prod_0b15f6b9f650c6990", - "resource_type": "product" - } - } - } + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find sku with id sku_0b1621b319d248b79", + "request_id": "v-0b4fe3ddc55646d01d", + "resource_id": "sku_0b1621b319d248b79", + "resource_type": "sku" } } } } + } + } + } + } + }, + "/v1/products/{productId}/skus": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "productId", + "in": "path", + "description": "A Voucherify [product](ref:get-product) ID or product source ID.", + "required": true + } + ], + "get": { + "operationId": "list-skus-in-product", + "tags": [ + "PRODUCTS API" + ], + "summary": "List SKUs in Product", + "description": "Retrieve all SKUs for a given product.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] }, - "post": { - "operationId": "create-sku", - "tags": [ - "PRODUCTS API" - ], - "summary": "Create SKU", - "description": "This method adds product varients to a [created product](ref:create-product).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the SKU parameters to be created.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_req_create_sku" - }, - "examples": { - "Example": { - "value": { - "source_id": "first_product_sku_1", - "sku": "Samsung phone 256GB", + "in": "query", + "name": "order", + "description": "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." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary of SKUs.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_res_products_productId_skus" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "skus", + "skus": [ + { + "id": "sku_0b1621b2f25248b79c", + "source_id": "sku_source_id_1", + "product_id": "prod_0b15f6b9f650c16990", + "sku": "Extra Small Blue Shirt", "price": 1300, "currency": "USD", "attributes": { - "color": "vintage-black", - "memory": "256", - "processor": "Intel" + "size": "XS", + "color": "blue", + "ranking": 1 }, - "image_url": "https://www.website.com/image.png", - "metadata": { - "imported": true - } - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns the created SKU object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_obj_sku_object" - }, - "examples": { - "Example": { - "value": { - "id": "sku_0bae3b28f610fd0da1", - "source_id": "first_product_sku_1", - "product_id": "prod_0bae2dc5a090fd0184", - "sku": "Samsung phone 256GB", - "price": 1300, - "currency": "USD", - "attributes": { - "color": "vintage-black", - "memory": "256", - "processor": "Intel" - }, - "image_url": "https://www.website.com/image.png", - "metadata": { - "imported": true - }, - "created_at": "2022-09-12T13:56:51.828Z", - "updated_at": null, - "object": "sku" - } + "image_url": "", + "metadata": {}, + "created_at": "2022-05-17T10:36:30.057Z", + "updated_at": "2022-07-01T05:34:16.822Z", + "object": "sku" + }, + { + "id": "sku_0b1621b3181248b79d", + "source_id": "sku_source_id_3", + "product_id": "prod_0b15f6b9f650c16990", + "sku": "Medium Yellow Shirt", + "price": 1450, + "currency": "USD", + "attributes": { + "size": "M", + "color": "yellow", + "ranking": 3 + }, + "image_url": "", + "metadata": {}, + "created_at": "2022-05-17T10:36:30.180Z", + "updated_at": "2022-07-01T05:34:16.842Z", + "object": "sku" + }, + { + "id": "sku_0b1621b3199248b79e", + "source_id": "sku_source_id_2", + "product_id": "prod_0b15f6b9f650c16990", + "sku": "Small Red Shirt", + "price": 1400, + "currency": "USD", + "attributes": { + "size": "S", + "color": "red", + "ranking": 2 + }, + "image_url": "", + "metadata": {}, + "created_at": "2022-05-17T10:36:30.183Z", + "updated_at": "2022-07-01T05:34:16.927Z", + "object": "sku" + }, + { + "id": "sku_0b1621b319d248b79f", + "source_id": "sku_source_id_4", + "product_id": "prod_0b15f6b9f650c16990", + "sku": "Large Pink Shirt -", + "price": 1700, + "currency": "USD", + "attributes": { + "size": "L", + "color": "pink", + "ranking": 4 + }, + "image_url": "", + "metadata": {}, + "created_at": "2022-05-17T10:36:30.187Z", + "updated_at": "2022-07-05T08:47:50.680Z", + "object": "sku" } - } + ], + "total": 4 } } } } } }, - "/v1/products/{productId}/skus/{skuId}": { - "parameters": [ - { + "404": { + "description": "Returns an error when requesting a product that has been deleted or cannot be found.", + "content": { + "application/json": { "schema": { - "type": "string" - }, - "name": "productId", - "in": "path", - "required": true, - "description": "A unique Voucherify [product](ref:get-product) ID or product source ID." - }, - { - "schema": { - "type": "string" + "$ref": "#/components/schemas/e_404_not_found" }, - "name": "skuId", - "in": "path", - "required": true, - "description": "A Voucherify [SKU ID](ref:get-sku) or SKU source ID." - } - ], - "put": { - "operationId": "update-sku", - "tags": [ - "PRODUCTS API" - ], - "summary": "Update SKU", - "description": "Updates the specified SKU by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged.\n\nFields other than the ones listed in the request body schema won't be modified. Even if provided, they will be silently skipped.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the parameters to be updated.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_req_update_sku" - }, - "examples": { - "Example": { - "value": { - "price": 210000, - "currency": "PLN" - } - } + "examples": { + "Example": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find product with id prod_0b15f6b9f650c6990", + "request_id": "v-0bae223075878da708", + "resource_id": "prod_0b15f6b9f650c6990", + "resource_type": "product" } } } + } + } + } + } + }, + "post": { + "operationId": "create-sku", + "tags": [ + "PRODUCTS API" + ], + "summary": "Create SKU", + "description": "This method adds product varients to a [created product](ref:create-product).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the SKU parameters to be created.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_req_create_sku" }, - "responses": { - "200": { - "description": "Returns the SKU object with the updated parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/11_obj_sku_object" - }, - "examples": { - "Example": { - "value": { - "id": "sku_0bae3b28f610fd0da1", - "source_id": "first_product_sku_1", - "product_id": "prod_0bae2dc5a090fd0184", - "sku": "Samsung phone 256GB", - "price": 210000, - "currency": "PLN", - "attributes": { - "color": "vintage-black", - "memory": "256", - "processor": "Intel" - }, - "image_url": "https://www.website.com/image.png", - "metadata": { - "imported": true - }, - "created_at": "2022-09-12T13:56:51.828Z", - "updated_at": "2022-09-12T14:09:40.859Z", - "object": "sku" - } - } - } + "examples": { + "Example": { + "value": { + "source_id": "first_product_sku_1", + "sku": "Samsung phone 256GB", + "price": 1300, + "currency": "USD", + "attributes": { + "color": "vintage-black", + "memory": "256", + "processor": "Intel" + }, + "image_url": "https://www.website.com/image.png", + "metadata": { + "imported": true } } } } - }, - "delete": { - "operationId": "delete-sku", - "tags": [ - "PRODUCTS API" - ], - "summary": "Delete SKU", - "description": "This method deletes a product SKU.", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "force", - "description": "If this flag is set to `true`, the SKU will be removed permanently. Going forward, the user will be able to create another SKU with exactly the same `source_id`." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." - }, - "404": { - "description": "Returns an error indicating that the product or sku with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Product Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find product with id 123-567-343", - "request_id": "v-0ae3a0d26fd40ecd11", - "resource_id": "123-567-343", - "resource_type": "product" - } - }, - "SKU Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find sku with id sku_0ae3a06b20019ba8f", - "request_id": "v-0ae3a1534d940ecd81", - "resource_id": "sku_0ae3a06b20019ba8f", - "resource_type": "sku" - } - } - } + } + } + }, + "responses": { + "200": { + "description": "Returns the created SKU object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_obj_sku_object" + }, + "examples": { + "Example": { + "value": { + "id": "sku_0bae3b28f610fd0da1", + "source_id": "first_product_sku_1", + "product_id": "prod_0bae2dc5a090fd0184", + "sku": "Samsung phone 256GB", + "price": 1300, + "currency": "USD", + "attributes": { + "color": "vintage-black", + "memory": "256", + "processor": "Intel" + }, + "image_url": "https://www.website.com/image.png", + "metadata": { + "imported": true + }, + "created_at": "2022-09-12T13:56:51.828Z", + "updated_at": null, + "object": "sku" } } } } } + } + } + } + }, + "/v1/products/{productId}/skus/{skuId}": { + "parameters": [ + { + "schema": { + "type": "string" }, - "/v1/products/importCSV": { - "post": { - "operationId": "import-products-using-csv", - "tags": [ - "PRODUCTS API" - ], - "summary": "Import Products using CSV", - "description": "Import products into the repository using a CSV file. \n\nCurl Example\n\n```cURL\ncurl -X POST \\\n https://api.voucherify.io/v1/products/importCSV \\\n -F file=@/path/to/products.csv \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\"\n```\n\nThe CSV file has to include headers in the first line.\n\n\n\n> 📘 Standard product fields mapping\n>\n> - Create a **comma separated value (CSV) file** or download our CSV import template. You can find an example template [here](https://s3.amazonaws.com/helpscout.net/docs/assets/5902f1c12c7d3a057f88a36d/attachments/627b82ed68d51e779443f550/Import_products_template.csv).\n> - Supported CSV file headers: `name,source_id,price,attributes,image_url,Metadata_property_name`\n> - **Name** is a **required** field. The remaining fields in the CSV template are optional.\n> - Override/Update products' **names** in Voucherify using this method. Data will be updated for each product included in the CSV file whose **source_id** matches a source ID in Voucherify. No other data can be updated other than the product name.\n> - Note that dates and date-time attributes need to be provided in compliance with the **ISO 8601 norms**. For example, 2022-03-11T09:00:00.000Z or 2022-03-11\n> - `YYYY-MM-DD`\n> - `YYYY-MM-DDTHH`\n> - `YYYY-MM-DDTHH:mm`\n> - `YYYY-MM-DDTHH:mm:ss`\n> - `YYYY-MM-DDTHH:mm:ssZ`\n> - `YYYY-MM-DDTHH:mm:ssZ`\n> - `YYYY-MM-DDTHH:mm:ss.SSSZ`\n> - Columns that can't be mapped to standard fields, will be mapped to **Custom attributes** and added as **products' metadata**. There is no limit on the number of custom attributes that you can import as metadata. \n> - To provide the proper data type, you need to add all custom attributes to the metadata schema **before importing the file**. Read more [here](https://support.voucherify.io/article/99-schema-validation-metadata#add-metadata).\n> - **Product attributes** (not custom attributes) need to be separated by a comma and enclosed in double quotes, i.e \"attribute1,attribute2\".\n> - Headers with metadata names **can't contain white-space characters**.\n> - If you import metadata defined in the schema as **arrays (multiple)**, you need to separate each value using a comma, for example: \n> - array of strings: \"subscribed,premium\" \n> - array of numbers: \"123,234\". \n> - array of dates: \"2000-01-01,2000-01-02\"\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "The file path is stored in the form `file` header.", - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/a_req_importCSV" - } - } - } + "name": "productId", + "in": "path", + "required": true, + "description": "A unique Voucherify [product](ref:get-product) ID or product source ID." + }, + { + "schema": { + "type": "string" + }, + "name": "skuId", + "in": "path", + "required": true, + "description": "A Voucherify [SKU ID](ref:get-sku) or SKU source ID." + } + ], + "put": { + "operationId": "update-sku", + "tags": [ + "PRODUCTS API" + ], + "summary": "Update SKU", + "description": "Updates the specified SKU by setting the values of the parameters passed in the request body. Any parameters not provided in the payload will be left unchanged.\n\nFields other than the ones listed in the request body schema won't be modified. Even if provided, they will be silently skipped.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the parameters to be updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_req_update_sku" }, - "responses": { - "200": { - "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and products will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" - }, - "examples": { - "Async Action": { - "value": { - "async_action_id": "aa_0a875d56c805df6601" - } - } - } - } + "examples": { + "Example": { + "value": { + "price": 210000, + "currency": "PLN" } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns the SKU object with the updated parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/11_obj_sku_object" }, - "400": { - "description": "Returns an invalid payload error. You may receive this error if you have incorrectly or have not specified the content type as `multipart/form-data` in the headers.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" + "examples": { + "Example": { + "value": { + "id": "sku_0bae3b28f610fd0da1", + "source_id": "first_product_sku_1", + "product_id": "prod_0bae2dc5a090fd0184", + "sku": "Samsung phone 256GB", + "price": 210000, + "currency": "PLN", + "attributes": { + "color": "vintage-black", + "memory": "256", + "processor": "Intel" + }, + "image_url": "https://www.website.com/image.png", + "metadata": { + "imported": true }, - "examples": { - "Invalid payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Payload should have required property 'file'", - "request_id": "v-0c4c46bbad0136789f" - } - } - } + "created_at": "2022-09-12T13:56:51.828Z", + "updated_at": "2022-09-12T14:09:40.859Z", + "object": "sku" } } } } } + } + } + }, + "delete": { + "operationId": "delete-sku", + "tags": [ + "PRODUCTS API" + ], + "summary": "Delete SKU", + "description": "This method deletes a product SKU.", + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "force", + "description": "If this flag is set to `true`, the SKU will be removed permanently. Going forward, the user will be able to create another SKU with exactly the same `source_id`." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." }, - "/v1/skus/importCSV": { - "post": { - "operationId": "import-skus-using-csv", - "tags": [ - "PRODUCTS API" - ], - "summary": "Import SKUs using CSV", - "description": "Import SKUs into the repository using a CSV file.\n\nThe CSV file has to include headers in the first line. All properties which cannot be mapped to standard SKU fields will be added to the metadata object. You can find an example template [here](https://s3.amazonaws.com/helpscout.net/docs/assets/5902f1c12c7d3a057f88a36d/attachments/627b98d08c9b585083488a4c/Import_SKUS_template.csv). \n\nCurl Example\n\n```cURL\ncurl -X POST \\\n https://api.voucherify.io/v1/skus/importCSV \\\n -F file=@/path/to/skus.csv \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\"\n```\n> 🚧 Import sequence\n>\n> First import products using the [dedicated endpoint](ref:import-products-using-csv), then import SKUs using this endpoint to properly match SKUs to products.\n\n\n\n> 📘 Standard SKU fields mapping\n>\n> - **Required** fields are source_id and product_id.\n> - Supported CSV file headers: `product_id,sku,source_id,price,image_url,attributes`\n> - SKU **source_id**'s must be unique in the entire product catalog, no duplicates allowed.\n> - SKU attributes need to be in the form of a stringy-fied json, i.e.`\"{'color':'blue'}\"`. These attributes must be defined in the **product** beforehand in order for you to be able to import them to the SKU.\n> - You can use this method to update the following parameters in bulk: **sku** and the sku **price**.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "The file path is stored in the form `file` header.", - "content": { - "multipart/form-data": { - "schema": { - "$ref": "#/components/schemas/a_req_importCSV" + "404": { + "description": "Returns an error indicating that the product or sku with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Product Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find product with id 123-567-343", + "request_id": "v-0ae3a0d26fd40ecd11", + "resource_id": "123-567-343", + "resource_type": "product" + } + }, + "SKU Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find sku with id sku_0ae3a06b20019ba8f", + "request_id": "v-0ae3a1534d940ecd81", + "resource_id": "sku_0ae3a06b20019ba8f", + "resource_type": "sku" } } } - }, - "responses": { - "200": { - "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and SKUs will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/a_res_async_actions" - }, - "examples": { - "Async Action": { - "value": { - "async_action_id": "aa_0a875d56c805df6601" - } - } - } + } + } + } + } + } + }, + "/v1/products/importCSV": { + "post": { + "operationId": "import-products-using-csv", + "tags": [ + "PRODUCTS API" + ], + "summary": "Import Products using CSV", + "description": "Import products into the repository using a CSV file. \n\nCurl Example\n\n```cURL\ncurl -X POST \\\n https://api.voucherify.io/v1/products/importCSV \\\n -F file=@/path/to/products.csv \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\"\n```\n\nThe CSV file has to include headers in the first line.\n\n\n\n> 📘 Standard product fields mapping\n>\n> - Create a **comma separated value (CSV) file** or download our CSV import template. You can find an example template [here](https://s3.amazonaws.com/helpscout.net/docs/assets/5902f1c12c7d3a057f88a36d/attachments/627b82ed68d51e779443f550/Import_products_template.csv).\n> - Supported CSV file headers: `name,source_id,price,attributes,image_url,Metadata_property_name`\n> - **Name** is a **required** field. The remaining fields in the CSV template are optional.\n> - Override/Update products' **names** in Voucherify using this method. Data will be updated for each product included in the CSV file whose **source_id** matches a source ID in Voucherify. No other data can be updated other than the product name.\n> - Note that dates and date-time attributes need to be provided in compliance with the **ISO 8601 norms**. For example, 2022-03-11T09:00:00.000Z or 2022-03-11\n> - `YYYY-MM-DD`\n> - `YYYY-MM-DDTHH`\n> - `YYYY-MM-DDTHH:mm`\n> - `YYYY-MM-DDTHH:mm:ss`\n> - `YYYY-MM-DDTHH:mm:ssZ`\n> - `YYYY-MM-DDTHH:mm:ssZ`\n> - `YYYY-MM-DDTHH:mm:ss.SSSZ`\n> - Columns that can't be mapped to standard fields, will be mapped to **Custom attributes** and added as **products' metadata**. There is no limit on the number of custom attributes that you can import as metadata. \n> - To provide the proper data type, you need to add all custom attributes to the metadata schema **before importing the file**. Read more [here](https://support.voucherify.io/article/99-schema-validation-metadata#add-metadata).\n> - **Product attributes** (not custom attributes) need to be separated by a comma and enclosed in double quotes, i.e \"attribute1,attribute2\".\n> - Headers with metadata names **can't contain white-space characters**.\n> - If you import metadata defined in the schema as **arrays (multiple)**, you need to separate each value using a comma, for example: \n> - array of strings: \"subscribed,premium\" \n> - array of numbers: \"123,234\". \n> - array of dates: \"2000-01-01,2000-01-02\"\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "The file path is stored in the form `file` header.", + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/a_req_importCSV" + } + } + } + }, + "responses": { + "200": { + "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and products will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" + }, + "examples": { + "Async Action": { + "value": { + "async_action_id": "aa_0a875d56c805df6601" } } } } } }, - "/v1/product-collection-object": { - "get": { - "operationId": "product-collection-object", - "tags": [ - "PRODUCT COLLECTIONS API" - ], - "summary": "Product Collection Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Product Collection Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/product_collections_collection_item" - } + "400": { + "description": "Returns an invalid payload error. You may receive this error if you have incorrectly or have not specified the content type as `multipart/form-data` in the headers.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Invalid payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Payload should have required property 'file'", + "request_id": "v-0c4c46bbad0136789f" } } } } } - }, - "/v1/product-collections": { - "get": { - "operationId": "list-product-collections", - "tags": [ - "PRODUCT COLLECTIONS API" - ], - "summary": "List Product Collections", - "description": "This method returns a list of product collections.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" + } + } + } + }, + "/v1/skus/importCSV": { + "post": { + "operationId": "import-skus-using-csv", + "tags": [ + "PRODUCTS API" + ], + "summary": "Import SKUs using CSV", + "description": "Import SKUs into the repository using a CSV file.\n\nThe CSV file has to include headers in the first line. All properties which cannot be mapped to standard SKU fields will be added to the metadata object. You can find an example template [here](https://s3.amazonaws.com/helpscout.net/docs/assets/5902f1c12c7d3a057f88a36d/attachments/627b98d08c9b585083488a4c/Import_SKUS_template.csv). \n\nCurl Example\n\n```cURL\ncurl -X POST \\\n https://api.voucherify.io/v1/skus/importCSV \\\n -F file=@/path/to/skus.csv \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\"\n```\n> 🚧 Import sequence\n>\n> First import products using the [dedicated endpoint](ref:import-products-using-csv), then import SKUs using this endpoint to properly match SKUs to products.\n\n\n\n> 📘 Standard SKU fields mapping\n>\n> - **Required** fields are source_id and product_id.\n> - Supported CSV file headers: `product_id,sku,source_id,price,image_url,attributes`\n> - SKU **source_id**'s must be unique in the entire product catalog, no duplicates allowed.\n> - SKU attributes need to be in the form of a stringy-fied json, i.e.`\"{'color':'blue'}\"`. These attributes must be defined in the **product** beforehand in order for you to be able to import them to the SKU.\n> - You can use this method to update the following parameters in bulk: **sku** and the sku **price**.\n\nThis API request starts a process that affects Voucherify data in bulk. \n\nIn 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. \n\nThe result will return the async ID. You can verify the status of your request via this [API request](ref:get-async-action).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "The file path is stored in the form `file` header.", + "content": { + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/a_req_importCSV" + } + } + } + }, + "responses": { + "200": { + "description": "Returns ID of the scheduled async action. The response informs you that your request has been accepted and SKUs will be added to the repository asynchronously. To check the import status and result, copy the `async_action_id` from the response and pass it using the [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/a_res_async_actions" }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at" - ] - }, - "in": "query", - "name": "order", - "description": "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." + "examples": { + "Async Action": { + "value": { + "async_action_id": "aa_0a875d56c805df6601" + } + } } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + } + } + } + } + } + }, + "/v1/product-collection-object": { + "get": { + "operationId": "product-collection-object", + "tags": [ + "PRODUCT COLLECTIONS API" + ], + "summary": "Product Collection Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Product Collection Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/product_collections_collection_item" } - ], - "responses": { - "200": { - "description": "Returns a dictionary containing a list of product collections and details about each product collection.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/product_collections_list_response_body" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "pc_Dj1qSH7bho4SVh7aSDKjU174", - "name": "Products in Poland", - "type": "AUTO_UPDATE", - "filter": { - "junction": "and", - "metadata.product_location": { - "conditions": { - "$in_location": [ - "loc_RcYz537sV07e1t5aG5tIH9FD" - ] - } - } - }, - "created_at": "2022-07-14T16:12:26.377Z", - "object": "products_collection" - }, - { - "id": "pc_FJdBpaQyvK6Gcdul4D2HRChI", - "name": "Price less than 10", - "type": "AUTO_UPDATE", - "filter": { - "junction": "and", - "price": { - "conditions": { - "$less_than": [ - 1000 - ] - } - } - }, - "created_at": "2022-03-17T07:11:25.406Z", - "object": "products_collection" - }, - { - "id": "pc_4ndRXAsTOzwSdHcQcxf489uU", - "name": "Color is brown", - "type": "AUTO_UPDATE", - "filter": { - "junction": "and", - "metadata.color": { - "conditions": { - "$is": [ - "brown" - ] - } - } - }, - "created_at": "2022-03-16T14:27:49.612Z", - "object": "products_collection" - }, - { - "id": "pc_BxofAP7pyM9FO7M6iaIzIouy", - "name": "Color not brown", - "type": "AUTO_UPDATE", - "filter": { - "junction": "and", - "metadata.color": { - "conditions": { - "$is_not": [ - "brown" - ] - } - } - }, - "created_at": "2022-03-16T13:49:05.697Z", - "object": "products_collection" - }, - { - "id": "pc_uHpM9ipEQH2yEpm3D8aohkBM", - "name": "Price less than 20", - "type": "AUTO_UPDATE", - "filter": { - "junction": "and", - "price": { - "conditions": { - "$less_than": [ - 2000 - ] - } - } - }, - "created_at": "2022-03-16T13:46:01.102Z", - "object": "products_collection" - }, - { - "id": "pc_ZgM25PcZAMp6qItKJRtR2mEi", - "name": "Name starts with S", - "type": "AUTO_UPDATE", - "filter": { - "junction": "and", - "name": { - "conditions": { - "$starts_with": [ - "S" - ] - } - } - }, - "created_at": "2022-03-16T13:42:35.917Z", - "object": "products_collection" - }, - { - "id": "pc_41V4DiQQO8YGqj0J2oZD57j4", - "name": "Ends with baby", - "type": "AUTO_UPDATE", - "filter": { - "junction": "and", - "source_id": { - "conditions": { - "$ends_with": [ - "baby" - ] - } - } - }, - "created_at": "2022-03-14T12:50:19.885Z", - "object": "products_collection" - }, - { - "id": "pc_0cRX5wAFt1R1R5Ir6WdTowui", - "name": "C start", - "type": "AUTO_UPDATE", - "filter": { - "junction": "and", - "name": { - "conditions": { - "$starts_with": [ - "C" - ] - } - } - }, - "created_at": "2022-03-14T12:18:15.588Z", - "object": "products_collection" - }, - { - "id": "pc_bQ2p9TycbEhd3YzwFCR3JQYA", - "name": "Shirts", - "type": "STATIC", - "products": [ - { - "id": "prod_0a9f9aeddb019a42db", - "object": "product" - }, - { - "id": "prod_0a9f9ab4ab019a42d5", - "object": "product" - } - ], - "created_at": "2022-02-28T11:42:12.484Z", - "object": "products_collection" + } + } + } + } + } + }, + "/v1/product-collections": { + "get": { + "operationId": "list-product-collections", + "tags": [ + "PRODUCT COLLECTIONS API" + ], + "summary": "List Product Collections", + "description": "This method returns a list of product collections.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at" + ] + }, + "in": "query", + "name": "order", + "description": "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." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary containing a list of product collections and details about each product collection.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/product_collections_list_response_body" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "pc_Dj1qSH7bho4SVh7aSDKjU174", + "name": "Products in Poland", + "type": "AUTO_UPDATE", + "filter": { + "junction": "and", + "metadata.product_location": { + "conditions": { + "$in_location": [ + "loc_RcYz537sV07e1t5aG5tIH9FD" + ] } - ], - "total": 9 - } + } + }, + "created_at": "2022-07-14T16:12:26.377Z", + "object": "products_collection" + }, + { + "id": "pc_FJdBpaQyvK6Gcdul4D2HRChI", + "name": "Price less than 10", + "type": "AUTO_UPDATE", + "filter": { + "junction": "and", + "price": { + "conditions": { + "$less_than": [ + 1000 + ] + } + } + }, + "created_at": "2022-03-17T07:11:25.406Z", + "object": "products_collection" + }, + { + "id": "pc_4ndRXAsTOzwSdHcQcxf489uU", + "name": "Color is brown", + "type": "AUTO_UPDATE", + "filter": { + "junction": "and", + "metadata.color": { + "conditions": { + "$is": [ + "brown" + ] + } + } + }, + "created_at": "2022-03-16T14:27:49.612Z", + "object": "products_collection" + }, + { + "id": "pc_BxofAP7pyM9FO7M6iaIzIouy", + "name": "Color not brown", + "type": "AUTO_UPDATE", + "filter": { + "junction": "and", + "metadata.color": { + "conditions": { + "$is_not": [ + "brown" + ] + } + } + }, + "created_at": "2022-03-16T13:49:05.697Z", + "object": "products_collection" + }, + { + "id": "pc_uHpM9ipEQH2yEpm3D8aohkBM", + "name": "Price less than 20", + "type": "AUTO_UPDATE", + "filter": { + "junction": "and", + "price": { + "conditions": { + "$less_than": [ + 2000 + ] + } + } + }, + "created_at": "2022-03-16T13:46:01.102Z", + "object": "products_collection" + }, + { + "id": "pc_ZgM25PcZAMp6qItKJRtR2mEi", + "name": "Name starts with S", + "type": "AUTO_UPDATE", + "filter": { + "junction": "and", + "name": { + "conditions": { + "$starts_with": [ + "S" + ] + } + } + }, + "created_at": "2022-03-16T13:42:35.917Z", + "object": "products_collection" + }, + { + "id": "pc_41V4DiQQO8YGqj0J2oZD57j4", + "name": "Ends with baby", + "type": "AUTO_UPDATE", + "filter": { + "junction": "and", + "source_id": { + "conditions": { + "$ends_with": [ + "baby" + ] + } + } + }, + "created_at": "2022-03-14T12:50:19.885Z", + "object": "products_collection" + }, + { + "id": "pc_0cRX5wAFt1R1R5Ir6WdTowui", + "name": "C start", + "type": "AUTO_UPDATE", + "filter": { + "junction": "and", + "name": { + "conditions": { + "$starts_with": [ + "C" + ] + } + } + }, + "created_at": "2022-03-14T12:18:15.588Z", + "object": "products_collection" + }, + { + "id": "pc_bQ2p9TycbEhd3YzwFCR3JQYA", + "name": "Shirts", + "type": "STATIC", + "products": [ + { + "id": "prod_0a9f9aeddb019a42db", + "object": "product" + }, + { + "id": "prod_0a9f9ab4ab019a42d5", + "object": "product" + } + ], + "created_at": "2022-02-28T11:42:12.484Z", + "object": "products_collection" } - } + ], + "total": 9 } } } } - }, - "post": { - "operationId": "create-product-collection", - "tags": [ - "PRODUCT COLLECTIONS API" - ], - "summary": "Create Product Collection", - "description": "This method creates a new product collection.", - "responses": { - "200": { - "description": "Returns information about the newly created collection, as well as an array containing the products.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/product_collections_collection_item" - } - } - } - } - }, - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "parameters": [], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/product_collections_create_request_body" - } - } + } + } + } + }, + "post": { + "operationId": "create-product-collection", + "tags": [ + "PRODUCT COLLECTIONS API" + ], + "summary": "Create Product Collection", + "description": "This method creates a new product collection.", + "responses": { + "200": { + "description": "Returns information about the newly created collection, as well as an array containing the products.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/product_collections_collection_item" } } } + } + }, + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/product_collections_create_request_body" + } + } + } + } + } + }, + "/v1/product-collections/{productCollectionId}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "pc_41V4DiQQO8YGqj0J2oZD57j4" }, - "/v1/product-collections/{productCollectionId}": { - "parameters": [ - { + "name": "productCollectionId", + "in": "path", + "required": true, + "description": "A unique product collection ID." + } + ], + "get": { + "operationId": "get-product-collection", + "tags": [ + "PRODUCT COLLECTIONS API" + ], + "summary": "Get Product Collection", + "description": "Retrieves the product collection.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a products collection object if a valid identifier was provided in the path.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "pc_41V4DiQQO8YGqj0J2oZD57j4" - }, - "name": "productCollectionId", - "in": "path", - "required": true, - "description": "A unique product collection ID." - } - ], - "get": { - "operationId": "get-product-collection", - "tags": [ - "PRODUCT COLLECTIONS API" - ], - "summary": "Get Product Collection", - "description": "Retrieves the product collection.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a products collection object if a valid identifier was provided in the path.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/product_collections_get_response_body", - "description": "Returns a products collection object if a valid identifier was provided in the path." - }, - "examples": { - "Dynamic": { - "value": { - "id": "pc_Dj1qSH7bho4SVh7aSDKjU174", - "name": "Products in Poland", - "type": "AUTO_UPDATE", - "filter": { - "junction": "and", - "metadata.product_location": { - "conditions": { - "$in_location": [ - "loc_RcYz537sV07e1t5aG5tIH9FD" - ] - } - } - }, - "created_at": "2022-07-14T16:12:26.377Z", - "object": "products_collection" - } - }, - "Static": { - "value": { - "id": "pc_bQ2p9TycbEhd3YzwFCR3JQYA", - "name": "Shirts", - "type": "STATIC", - "products": [ - { - "id": "prod_0a9f9aeddb019a42db", - "object": "product" - }, - { - "id": "prod_0a9f9ab4ab019a42d5", - "object": "product" - } - ], - "created_at": "2022-02-28T11:42:12.484Z", - "object": "products_collection" + "$ref": "#/components/schemas/product_collections_get_response_body", + "description": "Returns a products collection object if a valid identifier was provided in the path." + }, + "examples": { + "Dynamic": { + "value": { + "id": "pc_Dj1qSH7bho4SVh7aSDKjU174", + "name": "Products in Poland", + "type": "AUTO_UPDATE", + "filter": { + "junction": "and", + "metadata.product_location": { + "conditions": { + "$in_location": [ + "loc_RcYz537sV07e1t5aG5tIH9FD" + ] } } - } + }, + "created_at": "2022-07-14T16:12:26.377Z", + "object": "products_collection" } - } - }, - "404": { - "description": "Returns an error when requesting a product collection that has been deleted or does not exist.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find products_collection with id pc_41V4DiQQO8YGqj0J2oZD57j", - "request_id": "v-0b4ec2530e9646cb15", - "resource_id": "pc_41V4DiQQO8YGqj0J2oZD57j", - "resource_type": "products_collection" - } + }, + "Static": { + "value": { + "id": "pc_bQ2p9TycbEhd3YzwFCR3JQYA", + "name": "Shirts", + "type": "STATIC", + "products": [ + { + "id": "prod_0a9f9aeddb019a42db", + "object": "product" + }, + { + "id": "prod_0a9f9ab4ab019a42d5", + "object": "product" } - } + ], + "created_at": "2022-02-28T11:42:12.484Z", + "object": "products_collection" } } } } - }, - "delete": { - "operationId": "delete-product-collection", - "tags": [ - "PRODUCT COLLECTIONS API" - ], - "summary": "Delete Product Collection", - "description": "This method deletes a product collection.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." - }, - "400": { - "description": "Returns an error indicating that the product collection with given ID is in use by other resources.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_400_resource_in_use" - }, - "examples": { - "Product Colllection In Use": { - "value": { - "code": 400, - "key": "resource_in_use", - "message": "Resource in use", - "details": "Resource products_collection with id pc_41V4DiQQO8YGqj0J2oZD57j4 is in use by validation_ruless with ids [val_9TB89AjZeVEJ]", - "request_id": "v-0ae3a63aff940ed1b2", - "related_object_ids": [ - "val_9TB89AjZeVEJ" - ], - "related_object_type": "validation_rules" - } - } - } - } - } + } + }, + "404": { + "description": "Returns an error when requesting a product collection that has been deleted or does not exist.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" }, - "404": { - "description": "Returns an error indicating that the product collection with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Product Collection Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find products_collection with id pc_41V4DiQQO8YGqj0J2oZD57j", - "request_id": "v-0ae3a49261d027b870", - "resource_id": "pc_41V4DiQQO8YGqj0J2oZD57j", - "resource_type": "products_collection" - } - } - } + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find products_collection with id pc_41V4DiQQO8YGqj0J2oZD57j", + "request_id": "v-0b4ec2530e9646cb15", + "resource_id": "pc_41V4DiQQO8YGqj0J2oZD57j", + "resource_type": "products_collection" } } } } } + } + } + }, + "delete": { + "operationId": "delete-product-collection", + "tags": [ + "PRODUCT COLLECTIONS API" + ], + "summary": "Delete Product Collection", + "description": "This method deletes a product collection.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." }, - "/v1/product-collections/{productCollectionId}/products": { - "parameters": [ - { + "400": { + "description": "Returns an error indicating that the product collection with given ID is in use by other resources.", + "content": { + "application/json": { "schema": { - "type": "string" - }, - "name": "productCollectionId", - "in": "path", - "required": true, - "description": "Unique product collection ID." - } - ], - "get": { - "operationId": "list-products-in-collection", - "tags": [ - "PRODUCT COLLECTIONS API" - ], - "summary": "List Products in Collection", - "description": "Retrieves list of products from a products collection; works for both dynamic and static product collections.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary of products and/or SKUs grouped in the collection with each product's/SKU's details.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/product_collections_list_products_response_body" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "prod_0bae45ffc7003ffc52", - "source_id": "second_product", - "name": "Samsung Phone 2", - "price": 230000, - "attributes": [ - "color", - "memory", - "processor" - ], - "metadata": { - "test": true, - "vendor": "Online Store - 4" - }, - "image_url": "https://www.images.com/image4.png", - "created_at": "2022-09-12T14:44:13.212Z", - "updated_at": null, - "object": "product" - }, - { - "id": "sku_0bae3b28f610fd0da1", - "source_id": "first_product_sku_1", - "product_id": "prod_0bae2dc5a090fd0184", - "sku": "Samsung phone 256GB", - "price": 210000, - "attributes": { - "color": "vintage-black", - "memory": "256", - "processor": "Intel" - }, - "image_url": "https://www.website.com/image.png", - "metadata": { - "test": false, - "vendor": "Online Stores", - "imported": true - }, - "created_at": "2022-09-12T13:56:51.828Z", - "updated_at": "2022-09-12T14:09:40.859Z", - "object": "sku", - "product": { - "id": "prod_0bae2dc5a090fd0184", - "source_id": "first_product", - "name": "Samsung Phone", - "price": null, - "attributes": [], - "metadata": {}, - "object": "product" - } - }, - { - "id": "prod_0bae2dc5a090fd0184", - "source_id": "first_product", - "name": "Samsung Phone 1", - "price": 220000, - "attributes": [ - "color", - "memory", - "processor" - ], - "metadata": { - "test": true, - "vendor": "Online Store - 3" - }, - "image_url": "https://www.images.com/image2.png", - "created_at": "2022-09-12T12:58:22.232Z", - "updated_at": "2022-09-12T14:44:13.208Z", - "object": "product" - }, - { - "id": "sku_0b7d7dfb090be5c619", - "source_id": "ComicBook_1", - "product_id": "prod_0b7d7dfb05cbe5c616", - "sku": "Comics1", - "price": 1700, - "attributes": {}, - "image_url": null, - "metadata": { - "color": [ - "golden" - ], - "vendor": "islands" - }, - "created_at": "2022-08-05T17:23:14.084Z", - "updated_at": "2022-09-09T09:24:43.806Z", - "object": "sku", - "product": { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": null, - "attributes": [], - "metadata": {}, - "object": "product" - } - }, - { - "id": "prod_0b7d7dfb05cbe5c616", - "source_id": "Books", - "name": "Comic Books1", - "price": 2100, - "attributes": [], - "metadata": { - "color": [ - "silver" - ], - "vendor": "Bookstore1" - }, - "image_url": "https://www.images.com/image1.png", - "created_at": "2022-08-05T17:23:14.071Z", - "updated_at": "2022-09-09T09:24:43.728Z", - "object": "product" - }, - { - "id": "prod_0b7d7c4e814be5c502", - "source_id": "prod_1", - "name": "Apple iPhone 12", - "price": 60000, - "attributes": [], - "metadata": { - "color": [ - "purple" - ], - "vendor": "mall" - }, - "image_url": null, - "created_at": "2022-08-05T17:15:55.270Z", - "updated_at": "2022-09-09T09:24:43.704Z", - "object": "product" - } - ], - "total": 6 - } - } - } - } - } - }, - "404": { - "description": "Returns an error when requesting a product collection that has been deleted or does not exist.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find products_collection with id pc_M5XgaWPx3Sl4v26atA15zFj", - "request_id": "v-0b4ec6429e5646d089", - "resource_id": "pc_M5XgaWPx3Sl4v26atA15zFj", - "resource_type": "products_collection" - } - } - } + "$ref": "#/components/schemas/e_400_resource_in_use" + }, + "examples": { + "Product Colllection In Use": { + "value": { + "code": 400, + "key": "resource_in_use", + "message": "Resource in use", + "details": "Resource products_collection with id pc_41V4DiQQO8YGqj0J2oZD57j4 is in use by validation_ruless with ids [val_9TB89AjZeVEJ]", + "request_id": "v-0ae3a63aff940ed1b2", + "related_object_ids": [ + "val_9TB89AjZeVEJ" + ], + "related_object_type": "validation_rules" } } } } } }, - "/v1/validation-rule-object": { - "get": { - "operationId": "validation-rule-object", - "tags": [ - "VALIDATION RULES API" - ], - "summary": "Validation Rule Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Validation Rule Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/13_obj_validation_rule_object" - } + "404": { + "description": "Returns an error indicating that the product collection with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Product Collection Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find products_collection with id pc_41V4DiQQO8YGqj0J2oZD57j", + "request_id": "v-0ae3a49261d027b870", + "resource_id": "pc_41V4DiQQO8YGqj0J2oZD57j", + "resource_type": "products_collection" } } } } } + } + } + } + }, + "/v1/product-collections/{productCollectionId}/products": { + "parameters": [ + { + "schema": { + "type": "string" }, - "/v1/validation-rule-assignment-object": { - "get": { - "operationId": "validation-rule-assignment-object", - "tags": [ - "VALIDATION RULES API" - ], - "summary": "Validation Rule Assignment Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Validation Rule Assignment Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/13_obj_validation_rule_assignment_object" - } + "name": "productCollectionId", + "in": "path", + "required": true, + "description": "Unique product collection ID." + } + ], + "get": { + "operationId": "list-products-in-collection", + "tags": [ + "PRODUCT COLLECTIONS API" + ], + "summary": "List Products in Collection", + "description": "Retrieves list of products from a products collection; works for both dynamic and static product collections.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary of products and/or SKUs grouped in the collection with each product's/SKU's details.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/product_collections_list_products_response_body" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "prod_0bae45ffc7003ffc52", + "source_id": "second_product", + "name": "Samsung Phone 2", + "price": 230000, + "attributes": [ + "color", + "memory", + "processor" + ], + "metadata": { + "test": true, + "vendor": "Online Store - 4" + }, + "image_url": "https://www.images.com/image4.png", + "created_at": "2022-09-12T14:44:13.212Z", + "updated_at": null, + "object": "product" + }, + { + "id": "sku_0bae3b28f610fd0da1", + "source_id": "first_product_sku_1", + "product_id": "prod_0bae2dc5a090fd0184", + "sku": "Samsung phone 256GB", + "price": 210000, + "attributes": { + "color": "vintage-black", + "memory": "256", + "processor": "Intel" + }, + "image_url": "https://www.website.com/image.png", + "metadata": { + "test": false, + "vendor": "Online Stores", + "imported": true + }, + "created_at": "2022-09-12T13:56:51.828Z", + "updated_at": "2022-09-12T14:09:40.859Z", + "object": "sku", + "product": { + "id": "prod_0bae2dc5a090fd0184", + "source_id": "first_product", + "name": "Samsung Phone", + "price": null, + "attributes": [], + "metadata": {}, + "object": "product" + } + }, + { + "id": "prod_0bae2dc5a090fd0184", + "source_id": "first_product", + "name": "Samsung Phone 1", + "price": 220000, + "attributes": [ + "color", + "memory", + "processor" + ], + "metadata": { + "test": true, + "vendor": "Online Store - 3" + }, + "image_url": "https://www.images.com/image2.png", + "created_at": "2022-09-12T12:58:22.232Z", + "updated_at": "2022-09-12T14:44:13.208Z", + "object": "product" + }, + { + "id": "sku_0b7d7dfb090be5c619", + "source_id": "ComicBook_1", + "product_id": "prod_0b7d7dfb05cbe5c616", + "sku": "Comics1", + "price": 1700, + "attributes": {}, + "image_url": null, + "metadata": { + "color": [ + "golden" + ], + "vendor": "islands" + }, + "created_at": "2022-08-05T17:23:14.084Z", + "updated_at": "2022-09-09T09:24:43.806Z", + "object": "sku", + "product": { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": null, + "attributes": [], + "metadata": {}, + "object": "product" + } + }, + { + "id": "prod_0b7d7dfb05cbe5c616", + "source_id": "Books", + "name": "Comic Books1", + "price": 2100, + "attributes": [], + "metadata": { + "color": [ + "silver" + ], + "vendor": "Bookstore1" + }, + "image_url": "https://www.images.com/image1.png", + "created_at": "2022-08-05T17:23:14.071Z", + "updated_at": "2022-09-09T09:24:43.728Z", + "object": "product" + }, + { + "id": "prod_0b7d7c4e814be5c502", + "source_id": "prod_1", + "name": "Apple iPhone 12", + "price": 60000, + "attributes": [], + "metadata": { + "color": [ + "purple" + ], + "vendor": "mall" + }, + "image_url": null, + "created_at": "2022-08-05T17:15:55.270Z", + "updated_at": "2022-09-09T09:24:43.704Z", + "object": "product" + } + ], + "total": 6 } } } } } }, - "/v1/validation-rules": { - "get": { - "operationId": "list-validation-rules", - "tags": [ - "VALIDATION RULES API" - ], - "summary": "List Validation Rules", - "description": "Retrieve validation rules.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" + "404": { + "description": "Returns an error when requesting a product collection that has been deleted or does not exist.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at", - "name", - "-name" - ] - }, - "in": "query", - "name": "order", - "description": "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." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary of validation rules.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/13_res_list_validation_rules" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "val_auLlxlfTR9Ps", - "name": "Customer in Segment", - "rules": { - "1": { - "name": "customer.segment", - "rules": {}, - "property": null, - "conditions": { - "$is": [ - "seg_18tD3HR0h8ymPC07rBMLryk3" - ] - } - }, - "logic": "1" - }, - "applicable_to": { - "excluded": [], - "included": [], - "included_all": false - }, - "created_at": "2021-12-10T11:08:16.499Z", - "updated_at": "2021-12-10T12:01:41.665Z", - "type": "advanced", - "context_type": "earning_rule.order.paid", - "assignments_count": 1, - "object": "validation_rules" - }, - { - "id": "val_AvIe1WWuBXre", - "name": "Order Volume - Price of Any Item - = 1500 USD", - "rules": { - "1": { - "name": "order.items.price_any", - "rules": {}, - "property": null, - "conditions": { - "$is": [ - 150000 - ] - } - }, - "logic": "1" - }, - "applicable_to": { - "excluded": [], - "included": [], - "included_all": false - }, - "created_at": "2021-12-13T06:54:06.864Z", - "type": "advanced", - "context_type": "reward_assignment.pay_with_points", - "object": "validation_rules" - }, - { - "id": "val_aZhPe4tQYMgr", - "name": "Business Validation Rule - excluded", - "rules": { - "logic": "" - }, - "applicable_to": { - "excluded": [ - { - "object": "products_collection", - "id": "pc_7fVU2RxybhR66YxC7r7BKKRh", - "source_id": null - }, - { - "object": "sku", - "id": "sku_0bae3b28f610fd0da1", - "source_id": "first_product_sku_1" - } - ], - "included": [], - "included_all": true - }, - "created_at": "2022-09-13T14:38:33.710Z", - "type": "basic", - "context_type": "campaign.discount_coupons.discount.apply_to_items_by_quantity", - "assignments_count": 1, - "object": "validation_rules" - }, - { - "id": "val_bbJCAXAWtYX0", - "name": "Business Validation Rule - Test - Discount Effect - Amount - Items - each unit of matched product", - "rules": { - "logic": "" - }, - "applicable_to": { - "excluded": [], - "included": [ - { - "object": "products_collection", - "id": "pc_a11pr0dUc75", - "source_id": null, - "effect": "APPLY_TO_EVERY", - "quantity_limit": 1 - } - ], - "included_all": false - }, - "created_at": "2022-09-02T17:04:23.814Z", - "type": "basic", - "context_type": "campaign.discount_coupons.discount.apply_to_items_by_quantity", - "assignments_count": 1, - "object": "validation_rules" - }, - { - "id": "val_BkV21MUJGaiT", - "name": "Order Volume - Total Amount More than 100", - "rules": { - "1": { - "name": "order.amount", - "rules": {}, - "property": null, - "conditions": { - "$more_than": [ - 10000 - ] - } - }, - "logic": "1" - }, - "applicable_to": { - "excluded": [], - "included": [], - "included_all": false - }, - "created_at": "2021-12-10T14:01:10.750Z", - "type": "advanced", - "context_type": "reward_assignment.pay_with_points", - "object": "validation_rules" - }, - { - "id": "val_BTQg027UGl0v", - "name": "Business Validation Rule - Get some $ off", - "rules": { - "logic": "" - }, - "applicable_to": { - "excluded": [], - "included": [ - { - "object": "product", - "id": "prod_0a41dd45dc85fcab40", - "source_id": "10474", - "strict": false - } - ], - "included_all": false - }, - "created_at": "2021-12-07T06:58:23.759Z", - "updated_at": "2021-12-22T08:11:18.773Z", - "type": "advanced", - "context_type": "campaign.discount_coupons.discount.apply_to_items", - "assignments_count": 1, - "object": "validation_rules" - } - ], - "total": 6 - } - } - } + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find products_collection with id pc_M5XgaWPx3Sl4v26atA15zFj", + "request_id": "v-0b4ec6429e5646d089", + "resource_id": "pc_M5XgaWPx3Sl4v26atA15zFj", + "resource_type": "products_collection" } } } } - }, - "post": { - "operationId": "create-validation-rules", - "tags": [ - "VALIDATION RULES API" - ], - "summary": "Create Validation Rules", - "description": "Create validation rules.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + } + } + } + } + }, + "/v1/validation-rule-object": { + "get": { + "operationId": "validation-rule-object", + "tags": [ + "VALIDATION RULES API" + ], + "summary": "Validation Rule Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Validation Rule Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/13_obj_validation_rule_object" } - ], - "requestBody": { - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/13_req_create_validation_rule" - }, - "examples": { - "Example": { - "value": { - "name": "Set of Validation Rules", - "error": { - "message": "Your order does not meet at least one of the required criteria." + } + } + } + } + } + }, + "/v1/validation-rule-assignment-object": { + "get": { + "operationId": "validation-rule-assignment-object", + "tags": [ + "VALIDATION RULES API" + ], + "summary": "Validation Rule Assignment Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Validation Rule Assignment Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/13_obj_validation_rule_assignment_object" + } + } + } + } + } + } + }, + "/v1/validation-rules": { + "get": { + "operationId": "list-validation-rules", + "tags": [ + "VALIDATION RULES API" + ], + "summary": "List Validation Rules", + "description": "Retrieve validation rules.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at", + "name", + "-name" + ] + }, + "in": "query", + "name": "order", + "description": "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." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary of validation rules.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/13_res_list_validation_rules" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "val_auLlxlfTR9Ps", + "name": "Customer in Segment", + "rules": { + "1": { + "name": "customer.segment", + "rules": {}, + "property": null, + "conditions": { + "$is": [ + "seg_18tD3HR0h8ymPC07rBMLryk3" + ] + } + }, + "logic": "1" + }, + "applicable_to": { + "excluded": [], + "included": [], + "included_all": false + }, + "created_at": "2021-12-10T11:08:16.499Z", + "updated_at": "2021-12-10T12:01:41.665Z", + "type": "advanced", + "context_type": "earning_rule.order.paid", + "assignments_count": 1, + "object": "validation_rules" + }, + { + "id": "val_AvIe1WWuBXre", + "name": "Order Volume - Price of Any Item - = 1500 USD", + "rules": { + "1": { + "name": "order.items.price_any", + "rules": {}, + "property": null, + "conditions": { + "$is": [ + 150000 + ] + } + }, + "logic": "1" + }, + "applicable_to": { + "excluded": [], + "included": [], + "included_all": false + }, + "created_at": "2021-12-13T06:54:06.864Z", + "type": "advanced", + "context_type": "reward_assignment.pay_with_points", + "object": "validation_rules" + }, + { + "id": "val_aZhPe4tQYMgr", + "name": "Business Validation Rule - excluded", + "rules": { + "logic": "" }, "applicable_to": { - "included_all": false, "excluded": [ { - "object": "product", - "id": "prod_0bae45ffc7003ffc52", - "source_id": "second_product", - "strict": false, - "effect": "APPLY_TO_EVERY" + "object": "products_collection", + "id": "pc_7fVU2RxybhR66YxC7r7BKKRh", + "source_id": null + }, + { + "object": "sku", + "id": "sku_0bae3b28f610fd0da1", + "source_id": "first_product_sku_1" } ], + "included": [], + "included_all": true + }, + "created_at": "2022-09-13T14:38:33.710Z", + "type": "basic", + "context_type": "campaign.discount_coupons.discount.apply_to_items_by_quantity", + "assignments_count": 1, + "object": "validation_rules" + }, + { + "id": "val_bbJCAXAWtYX0", + "name": "Business Validation Rule - Test - Discount Effect - Amount - Items - each unit of matched product", + "rules": { + "logic": "" + }, + "applicable_to": { + "excluded": [], "included": [ - { - "object": "product", - "id": "prod_0b72b00ffed198e344", - "source_id": null, - "effect": "APPLY_TO_MOST_EXPENSIVE", - "quantity_limit": 1 - }, { "object": "products_collection", - "id": "pc_4ndRXAsTOzwSdHcQcxf489uU", + "id": "pc_a11pr0dUc75", "source_id": null, "effect": "APPLY_TO_EVERY", - "quantity_limit": 5 + "quantity_limit": 1 } - ] + ], + "included_all": false }, + "created_at": "2022-09-02T17:04:23.814Z", + "type": "basic", + "context_type": "campaign.discount_coupons.discount.apply_to_items_by_quantity", + "assignments_count": 1, + "object": "validation_rules" + }, + { + "id": "val_BkV21MUJGaiT", + "name": "Order Volume - Total Amount More than 100", "rules": { "1": { - "name": "order.metadata", - "property": "location", - "rules": {}, - "conditions": { - "$is": [ - "Santorini" - ] - }, - "error": { - "message": "Your order must be placed at one of our Santorini shops." - } - }, - "2": { - "name": "custom_event.metadata", - "property": "test", + "name": "order.amount", "rules": {}, + "property": null, "conditions": { - "$greater_than_or_equal": [ - 1 + "$more_than": [ + 10000 ] } }, - "3": { - "name": "order.items.every", - "rules": { - "1": { - "name": "order.items.metadata", - "property": "test", - "rules": {}, - "conditions": { - "$greater_than_or_equal": [ - 1 - ] - } - } - }, - "conditions": { - "$is": [ - { - "id": "", - "effect": "APPLY_TO_EVERY", - "object": "product", - "source_id": "" - } - ] + "logic": "1" + }, + "applicable_to": { + "excluded": [], + "included": [], + "included_all": false + }, + "created_at": "2021-12-10T14:01:10.750Z", + "type": "advanced", + "context_type": "reward_assignment.pay_with_points", + "object": "validation_rules" + }, + { + "id": "val_BTQg027UGl0v", + "name": "Business Validation Rule - Get some $ off", + "rules": { + "logic": "" + }, + "applicable_to": { + "excluded": [], + "included": [ + { + "object": "product", + "id": "prod_0a41dd45dc85fcab40", + "source_id": "10474", + "strict": false } - }, - "logic": "1 or 2" - } + ], + "included_all": false + }, + "created_at": "2021-12-07T06:58:23.759Z", + "updated_at": "2021-12-22T08:11:18.773Z", + "type": "advanced", + "context_type": "campaign.discount_coupons.discount.apply_to_items", + "assignments_count": 1, + "object": "validation_rules" } - } + ], + "total": 6 } } - }, - "description": "Specify the validation rules parameters." + } + } + } + } + } + }, + "post": { + "operationId": "create-validation-rules", + "tags": [ + "VALIDATION RULES API" + ], + "summary": "Create Validation Rules", + "description": "Create validation rules.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/13_req_create_validation_rule" }, - "responses": { - "200": { - "description": "Returns a validation rule object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/13_obj_validation_rule_object" + "examples": { + "Example": { + "value": { + "name": "Set of Validation Rules", + "error": { + "message": "Your order does not meet at least one of the required criteria." + }, + "applicable_to": { + "included_all": false, + "excluded": [ + { + "object": "product", + "id": "prod_0bae45ffc7003ffc52", + "source_id": "second_product", + "strict": false, + "effect": "APPLY_TO_EVERY" + } + ], + "included": [ + { + "object": "product", + "id": "prod_0b72b00ffed198e344", + "source_id": null, + "effect": "APPLY_TO_MOST_EXPENSIVE", + "quantity_limit": 1 + }, + { + "object": "products_collection", + "id": "pc_4ndRXAsTOzwSdHcQcxf489uU", + "source_id": null, + "effect": "APPLY_TO_EVERY", + "quantity_limit": 5 + } + ] + }, + "rules": { + "1": { + "name": "order.metadata", + "property": "location", + "rules": {}, + "conditions": { + "$is": [ + "Santorini" + ] + }, + "error": { + "message": "Your order must be placed at one of our Santorini shops." + } }, - "examples": { - "Example": { - "value": { - "id": "val_eR1c41hu0vUU", - "name": "Business Validation Rule", - "rules": { - "1": { - "name": "string", - "property": "string", - "conditions": { - "$one_of_voucherify_conditions": [ - "string" - ] - }, - "rules": { - "1": { - "name": "string", - "property": "string", - "conditions": {}, - "rules": {} - }, - "logic": "string" - }, - "error": { - "message": "string" - } - }, - "logic": "(1 and 2) and (3)" - }, - "error": { - "message": "string" - }, - "applicable_to": { - "excluded": [ - { - "object": "product", - "id": "string", - "source_id": "string", - "strict": true, - "effect": "APPLY_TO_EVERY" - } - ], - "included": [ - { - "object": "product", - "id": "string", - "source_id": "string", - "strict": true, - "effect": "APPLY_TO_EVERY", - "quantity_limit": 0 - } - ], - "included_all": true - }, - "created_at": "2022-03-23T07:44:00.444Z", - "updated_at": "2022-04-26T08:35:54.960Z", - "type": "basic", - "context_type": "earning_rule.order.paid", - "object": "validation_rules" + "2": { + "name": "custom_event.metadata", + "property": "test", + "rules": {}, + "conditions": { + "$greater_than_or_equal": [ + 1 + ] + } + }, + "3": { + "name": "order.items.every", + "rules": { + "1": { + "name": "order.items.metadata", + "property": "test", + "rules": {}, + "conditions": { + "$greater_than_or_equal": [ + 1 + ] + } } + }, + "conditions": { + "$is": [ + { + "id": "", + "effect": "APPLY_TO_EVERY", + "object": "product", + "source_id": "" + } + ] } - } + }, + "logic": "1 or 2" } } + } + } + } + }, + "description": "Specify the validation rules parameters." + }, + "responses": { + "200": { + "description": "Returns a validation rule object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/13_obj_validation_rule_object" }, - "400": { - "description": "Returns an error if the request parameters were not specified correctly.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_400_invalid_validation_rules" + "examples": { + "Example": { + "value": { + "id": "val_eR1c41hu0vUU", + "name": "Business Validation Rule", + "rules": { + "1": { + "name": "string", + "property": "string", + "conditions": { + "$one_of_voucherify_conditions": [ + "string" + ] + }, + "rules": { + "1": { + "name": "string", + "property": "string", + "conditions": {}, + "rules": {} + }, + "logic": "string" + }, + "error": { + "message": "string" + } + }, + "logic": "(1 and 2) and (3)" }, - "examples": { - "Invalid Validation Rules": { - "value": { - "code": 400, - "key": "invalid_validation_rules", - "message": "Invalid Validation Rule Definition", - "details": "Rule 'custom_event.metadata' must have a 'property'" + "error": { + "message": "string" + }, + "applicable_to": { + "excluded": [ + { + "object": "product", + "id": "string", + "source_id": "string", + "strict": true, + "effect": "APPLY_TO_EVERY" } - } - } + ], + "included": [ + { + "object": "product", + "id": "string", + "source_id": "string", + "strict": true, + "effect": "APPLY_TO_EVERY", + "quantity_limit": 0 + } + ], + "included_all": true + }, + "created_at": "2022-03-23T07:44:00.444Z", + "updated_at": "2022-04-26T08:35:54.960Z", + "type": "basic", + "context_type": "earning_rule.order.paid", + "object": "validation_rules" } } } } } }, - "/v1/validation-rules/{validationRuleId}": { - "parameters": [ - { + "400": { + "description": "Returns an error if the request parameters were not specified correctly.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "val_TU4de3EP4dlL" + "$ref": "#/components/schemas/e_400_invalid_validation_rules" }, - "name": "validationRuleId", - "in": "path", - "required": true, - "description": "A unique validation rule ID." + "examples": { + "Invalid Validation Rules": { + "value": { + "code": 400, + "key": "invalid_validation_rules", + "message": "Invalid Validation Rule Definition", + "details": "Rule 'custom_event.metadata' must have a 'property'" + } + } + } } - ], - "get": { - "operationId": "get-validation-rule", - "tags": [ - "VALIDATION RULES API" - ], - "summary": "Get Validation Rule", - "description": "Retrieve the details of a validation rule.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + } + } + } + } + }, + "/v1/validation-rules/{validationRuleId}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "val_TU4de3EP4dlL" + }, + "name": "validationRuleId", + "in": "path", + "required": true, + "description": "A unique validation rule ID." + } + ], + "get": { + "operationId": "get-validation-rule", + "tags": [ + "VALIDATION RULES API" + ], + "summary": "Get Validation Rule", + "description": "Retrieve the details of a validation rule.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns the validation rule object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/13_obj_validation_rule_object" + }, + "examples": { + "Example": { + "value": { + "id": "val_TU4de3EP4dlL", + "name": "Order is less than $40", + "rules": { + "1": { + "name": "order.amount", + "property": null, + "conditions": { + "$less_than": [ + 4000 + ] + }, + "rules": {} + }, + "logic": "1" + }, + "applicable_to": { + "excluded": [], + "included": [], + "included_all": false + }, + "created_at": "2022-08-11T16:42:13.630Z", + "type": "advanced", + "context_type": "reward_assignment.pay_with_points", + "object": "validation_rules" + } + } } - ], - "responses": { - "200": { - "description": "Returns the validation rule object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/13_obj_validation_rule_object" - }, - "examples": { - "Example": { - "value": { - "id": "val_TU4de3EP4dlL", - "name": "Order is less than $40", - "rules": { - "1": { - "name": "order.amount", - "property": null, - "conditions": { - "$less_than": [ - 4000 - ] - }, - "rules": {} - }, - "logic": "1" - }, - "applicable_to": { - "excluded": [], - "included": [], - "included_all": false - }, - "created_at": "2022-08-11T16:42:13.630Z", - "type": "advanced", - "context_type": "reward_assignment.pay_with_points", - "object": "validation_rules" + } + } + } + } + }, + "put": { + "operationId": "update-validation-rule", + "tags": [ + "VALIDATION RULES API" + ], + "summary": "Update Validation Rule", + "description": "Update validation rule parameters.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the parameters to be updated.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/13_req_create_validation_rule" + }, + "examples": { + "Example": { + "value": { + "name": "Set of Validation Rules Updated", + "error": { + "message": "Your orders do not meet at least one of the required criteria." + }, + "applicable_to": { + "included_all": false, + "excluded": [ + { + "object": "product", + "id": "prod_0bae45ffc7003ffccc", + "source_id": "second_product", + "strict": false, + "effect": "APPLY_TO_EVERY" + } + ], + "included": [ + { + "object": "product", + "id": "prod_0b72b00ffed198e333", + "source_id": null, + "effect": "APPLY_TO_CHEAPEST", + "quantity_limit": 1 + }, + { + "object": "products_collection", + "id": "pc_4ndRXAsTOzwSdHcQcxf489uU", + "source_id": null, + "effect": "APPLY_TO_EVERY", + "quantity_limit": 5 + } + ] + }, + "rules": { + "1": { + "name": "order.metadata", + "property": "place", + "rules": {}, + "conditions": { + "$is": [ + "Santorini" + ] + }, + "error": { + "message": "Your order must be placed at one of our Santorini shops on the beach." + } + }, + "2": { + "name": "custom_event.metadata", + "property": "lining", + "rules": {}, + "conditions": { + "$greater_than_or_equal": [ + 1 + ] + } + }, + "3": { + "name": "order.items.every", + "rules": { + "1": { + "name": "order.items.metadata", + "property": "test", + "rules": {}, + "conditions": { + "$greater_than_or_equal": [ + 1 + ] + } } + }, + "conditions": { + "$is": [ + { + "id": "", + "effect": "APPLY_TO_EVERY", + "object": "product", + "source_id": "" + } + ] } - } + }, + "logic": "1 and 2" } } } } - }, - "put": { - "operationId": "update-validation-rule", - "tags": [ - "VALIDATION RULES API" - ], - "summary": "Update Validation Rule", - "description": "Update validation rule parameters.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the parameters to be updated.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/13_req_create_validation_rule" - }, - "examples": { - "Example": { - "value": { - "name": "Set of Validation Rules Updated", + } + } + }, + "responses": { + "200": { + "description": "Returns the validation rule object with the updated parameters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/13_obj_validation_rule_object" + }, + "examples": { + "Example": { + "value": { + "id": "val_VZ91fqqtoVmw", + "name": "Set of Validation Rules Updated", + "rules": { + "1": { + "name": "order.metadata", + "property": "place", + "conditions": { + "$is": [ + "Santorini" + ] + }, + "rules": {}, "error": { - "message": "Your orders do not meet at least one of the required criteria." + "message": "Your order must be placed at one of our Santorini shops on the beach." + } + }, + "2": { + "name": "custom_event.metadata", + "property": "lining", + "conditions": { + "$greater_than_or_equal": [ + 1 + ] }, - "applicable_to": { - "included_all": false, - "excluded": [ - { - "object": "product", - "id": "prod_0bae45ffc7003ffccc", - "source_id": "second_product", - "strict": false, - "effect": "APPLY_TO_EVERY" - } - ], - "included": [ - { - "object": "product", - "id": "prod_0b72b00ffed198e333", - "source_id": null, - "effect": "APPLY_TO_CHEAPEST", - "quantity_limit": 1 - }, + "rules": {} + }, + "3": { + "name": "order.items.every", + "conditions": { + "$is": [ { - "object": "products_collection", - "id": "pc_4ndRXAsTOzwSdHcQcxf489uU", - "source_id": null, + "id": "", "effect": "APPLY_TO_EVERY", - "quantity_limit": 5 + "object": "product", + "source_id": "" } ] }, "rules": { "1": { - "name": "order.metadata", - "property": "place", - "rules": {}, - "conditions": { - "$is": [ - "Santorini" - ] - }, - "error": { - "message": "Your order must be placed at one of our Santorini shops on the beach." - } - }, - "2": { - "name": "custom_event.metadata", - "property": "lining", - "rules": {}, + "name": "order.items.metadata", + "property": "test", "conditions": { "$greater_than_or_equal": [ 1 ] - } - }, - "3": { - "name": "order.items.every", - "rules": { - "1": { - "name": "order.items.metadata", - "property": "test", - "rules": {}, - "conditions": { - "$greater_than_or_equal": [ - 1 - ] - } - } }, - "conditions": { - "$is": [ - { - "id": "", - "effect": "APPLY_TO_EVERY", - "object": "product", - "source_id": "" - } - ] - } - }, - "logic": "1 and 2" + "rules": {} + } } - } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns the validation rule object with the updated parameters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/13_obj_validation_rule_object" + }, + "logic": "1 and 2" }, - "examples": { - "Example": { - "value": { - "id": "val_VZ91fqqtoVmw", - "name": "Set of Validation Rules Updated", - "rules": { - "1": { - "name": "order.metadata", - "property": "place", - "conditions": { - "$is": [ - "Santorini" - ] - }, - "rules": {}, - "error": { - "message": "Your order must be placed at one of our Santorini shops on the beach." - } - }, - "2": { - "name": "custom_event.metadata", - "property": "lining", - "conditions": { - "$greater_than_or_equal": [ - 1 - ] - }, - "rules": {} - }, - "3": { - "name": "order.items.every", - "conditions": { - "$is": [ - { - "id": "", - "effect": "APPLY_TO_EVERY", - "object": "product", - "source_id": "" - } - ] - }, - "rules": { - "1": { - "name": "order.items.metadata", - "property": "test", - "conditions": { - "$greater_than_or_equal": [ - 1 - ] - }, - "rules": {} - } - } - }, - "logic": "1 and 2" - }, - "error": { - "message": "Your orders do not meet at least one of the required criteria." - }, - "applicable_to": { - "excluded": [ - { - "object": "product", - "id": "prod_0bae45ffc7003ffccc", - "source_id": "second_product", - "strict": false, - "effect": "APPLY_TO_EVERY" - } - ], - "included": [ - { - "object": "product", - "id": "prod_0b72b00ffed198e333", - "source_id": null, - "strict": false, - "effect": "APPLY_TO_CHEAPEST", - "quantity_limit": 1 - }, - { - "object": "products_collection", - "id": "pc_4ndRXAsTOzwSdHcQcxf489uU", - "source_id": null, - "strict": false, - "effect": "APPLY_TO_EVERY", - "quantity_limit": 5 - } - ], - "included_all": false - }, - "created_at": "2022-09-14T05:54:51.099Z", - "updated_at": "2022-09-14T06:06:32.855Z", - "type": "complex", - "context_type": "global", - "object": "validation_rules" + "error": { + "message": "Your orders do not meet at least one of the required criteria." + }, + "applicable_to": { + "excluded": [ + { + "object": "product", + "id": "prod_0bae45ffc7003ffccc", + "source_id": "second_product", + "strict": false, + "effect": "APPLY_TO_EVERY" } - } - } - } - } - } - } - }, - "delete": { - "operationId": "delete-validation-rules", - "tags": [ - "VALIDATION RULES API" - ], - "summary": "Delete Validation Rule", - "description": "This method deletes a validation rule.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." - }, - "404": { - "description": "Returns an error indicating that the validation rule with the given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Validation Rule Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find validation_rules with id val_TGN3rqZ8vEm", - "request_id": "v-0ae3b3436346b778be", - "resource_id": "val_TGN3rqZ8vEm", - "resource_type": "validation_rules" + ], + "included": [ + { + "object": "product", + "id": "prod_0b72b00ffed198e333", + "source_id": null, + "strict": false, + "effect": "APPLY_TO_CHEAPEST", + "quantity_limit": 1 + }, + { + "object": "products_collection", + "id": "pc_4ndRXAsTOzwSdHcQcxf489uU", + "source_id": null, + "strict": false, + "effect": "APPLY_TO_EVERY", + "quantity_limit": 5 } - } - } + ], + "included_all": false + }, + "created_at": "2022-09-14T05:54:51.099Z", + "updated_at": "2022-09-14T06:06:32.855Z", + "type": "complex", + "context_type": "global", + "object": "validation_rules" } } } } } + } + } + }, + "delete": { + "operationId": "delete-validation-rules", + "tags": [ + "VALIDATION RULES API" + ], + "summary": "Delete Validation Rule", + "description": "This method deletes a validation rule.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." }, - "/v1/validation-rules-assignments": { - "get": { - "operationId": "list-validation-rules-assignments", - "tags": [ - "VALIDATION RULES API" - ], - "summary": "List Validation Rules' Assignment(s)", - "description": "List all validation rules' assignments or filter the results using the related object ID or the validation rule ID query parameters. \n\n## How to retrieve specific validaiton rule assignments(s)\n\n### Related object ID\n\nTo find an assignment for a particular resource, you can use the ID of the object to which the validation rule was assigned. This could be, for example, an ID of a: voucher, campaign, distribution, reward assignment, earning rule, promotion tier. \n\n\n\n```curl\ncurl -X GET \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\" \\\n -H \"Content-Type: application/json\" \\\n https://api.voucherify.io/v1/validation-rules-assignments?related_object_id=promo_kJliy076IuJYtuYWSHE9fSuT\n```\n\n```json\n{\n \"object\": \"list\",\n \"data_ref\": \"data\",\n \"data\": [\n {\n \"id\": \"asgm_tZaqxeO8gP4q91jG\",\n \"rule_id\": \"val_WB6ETAiFztw5\",\n \"related_object_id\": \"promo_kJliy076IuJYtuYWSHE9fSuT\",\n \"related_object_type\": \"promotion_tier\",\n \"created_at\": \"2022-08-10T10:30:39.986Z\",\n \"object\": \"validation_rules_assignment\"\n }\n ],\n \"total\": 1\n}\n```\n\n### Validation rule ID\n\nYou can use the validation rule ID to find assignment(s) for a specific validation rule.\n\n\n\n```curl\ncurl -X GET \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\" \\\n -H \"Content-Type: application/json\" \\\n https://api.voucherify.io/v1/validation-rules-assignments?rule=val_ZEZmA9oit8aU\n```\n\n```json\n{\n \"object\": \"list\",\n \"data_ref\": \"data\",\n \"data\": [\n {\n \"id\": \"asgm_vef0G6d9Al0rABxq\",\n \"rule_id\": \"val_ZEZmA9oit8aU\",\n \"related_object_id\": \"camp_rRsfatlwN7unSeUIJDCYedal\",\n \"related_object_type\": \"campaign\",\n \"created_at\": \"2022-06-29T11:43:52.953Z\",\n \"object\": \"validation_rules_assignment\"\n },\n {\n \"id\": \"asgm_sFV4wEFvldwIvgfb\",\n \"rule_id\": \"val_ZEZmA9oit8aU\",\n \"related_object_id\": \"distr_9QKI02wqgjWyvZXeQkFEPmkkYe\",\n \"related_object_type\": \"distribution\",\n \"created_at\": \"2022-06-29T11:41:07.680Z\",\n \"object\": \"validation_rules_assignment\"\n },\n {\n \"id\": \"asgm_69Qifyv6UZynFIIQ\",\n \"rule_id\": \"val_ZEZmA9oit8aU\",\n \"related_object_id\": \"promo_g83qUzYZpfX0OMAFOVoQuOYG\",\n \"related_object_type\": \"promotion_tier\",\n \"created_at\": \"2022-06-29T11:29:41.906Z\",\n \"object\": \"validation_rules_assignment\"\n }\n ],\n \"total\": 3\n}\n```\n", - "parameters": [ - { - "schema": { - "type": "string" - }, - "in": "query", - "name": "related_object_id", - "description": "The resource ID to which the validation rule was assigned; this could be, for example, a resource ID of a voucher, campaign, earning rule, reward assignment, promotion tier, or distribution." - }, - { - "schema": { - "type": "string", - "example": "val_30Qo2rclFi4T" - }, - "in": "query", - "name": "rule", - "description": "Validation rule ID." - }, - { - "$ref": "#/components/parameters/page" - }, - { - "$ref": "#/components/parameters/limit" + "404": { + "description": "Returns an error indicating that the validation rule with the given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" }, - { - "schema": { - "type": "string" - }, - "in": "query", - "description": "Sorts the results using one of the filtering options: `-created_at`, `created_at`, where the dash `-` preceding a sorting option means sorting in a descending order.", - "name": "order" - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary with a data property that contains an array of validation rule assignments. Each entry in the array is a separate object. If no more validation rule assignments are available, the resulting array will be empty. The result can be narrowed down according to default filters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/13_res_validation-rules_validationRuleId_assignments" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_2S7Xm4dab4UvYAgm", - "rule_id": "val_5ix74ru7e", - "related_object_id": "camp_YDsFdX8TgFtT0RUuKEFyhqs3", - "related_object_type": "campaign", - "created_at": "2022-02-08T10:49:30.534Z", - "object": "validation_rules_assignment" - }, - { - "id": "asgm_sFV4wEFvldwIvgfb", - "rule_id": "val_ZEZmA9oit8aU", - "related_object_id": "distr_9QKI02wqgjWyvZXeQkFEPmkkYe", - "related_object_type": "distribution", - "created_at": "2022-06-29T11:41:07.680Z", - "object": "validation_rules_assignment" - }, - { - "id": "asgm_8xelF5R4zB8ue168", - "rule_id": "val_ggDODO6fakMs", - "related_object_id": "ern_xrRuGEV7EW0X8wtMaze3HOfw", - "related_object_type": "earning_rule", - "created_at": "2022-02-28T12:25:56.783Z", - "object": "validation_rules_assignment" - }, - { - "id": "asgm_tZaqxeO8gP4q91jG", - "rule_id": "val_WB6ETAiFztw5", - "related_object_id": "promo_kJliy076IuJYtuYWSHE9fSuT", - "related_object_type": "promotion_tier", - "created_at": "2022-08-10T10:30:39.986Z", - "object": "validation_rules_assignment" - }, - { - "id": "asgm_xTMHiyPGSz3rp5m2", - "rule_id": "val_2AxnWmW2ra6X", - "related_object_id": "rewa_m9hEAu10KsPcLhGXiHG85aY0", - "related_object_type": "reward_assignment", - "created_at": "2021-12-10T11:38:35.922Z", - "object": "validation_rules_assignment" - }, - { - "id": "asgm_DhlDn54JwqVFJzR6", - "rule_id": "val_eR1c41hu0vUU", - "related_object_id": "v_XuF7icVlUcVpHsSY9nG7n7yJa5wx27Va", - "related_object_type": "voucher", - "created_at": "2022-03-23T07:50:31.068Z", - "object": "validation_rules_assignment" - } - ], - "total": 6 - } - }, - "No Assignments": { - "value": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - } - } - } + "examples": { + "Validation Rule Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find validation_rules with id val_TGN3rqZ8vEm", + "request_id": "v-0ae3b3436346b778be", + "resource_id": "val_TGN3rqZ8vEm", + "resource_type": "validation_rules" } } } } } + } + } + } + }, + "/v1/validation-rules-assignments": { + "get": { + "operationId": "list-validation-rules-assignments", + "tags": [ + "VALIDATION RULES API" + ], + "summary": "List Validation Rules' Assignment(s)", + "description": "List all validation rules' assignments or filter the results using the related object ID or the validation rule ID query parameters. \n\n## How to retrieve specific validaiton rule assignments(s)\n\n### Related object ID\n\nTo find an assignment for a particular resource, you can use the ID of the object to which the validation rule was assigned. This could be, for example, an ID of a: voucher, campaign, distribution, reward assignment, earning rule, promotion tier. \n\n\n\n```curl\ncurl -X GET \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\" \\\n -H \"Content-Type: application/json\" \\\n https://api.voucherify.io/v1/validation-rules-assignments?related_object_id=promo_kJliy076IuJYtuYWSHE9fSuT\n```\n\n```json\n{\n \"object\": \"list\",\n \"data_ref\": \"data\",\n \"data\": [\n {\n \"id\": \"asgm_tZaqxeO8gP4q91jG\",\n \"rule_id\": \"val_WB6ETAiFztw5\",\n \"related_object_id\": \"promo_kJliy076IuJYtuYWSHE9fSuT\",\n \"related_object_type\": \"promotion_tier\",\n \"created_at\": \"2022-08-10T10:30:39.986Z\",\n \"object\": \"validation_rules_assignment\"\n }\n ],\n \"total\": 1\n}\n```\n\n### Validation rule ID\n\nYou can use the validation rule ID to find assignment(s) for a specific validation rule.\n\n\n\n```curl\ncurl -X GET \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\" \\\n -H \"Content-Type: application/json\" \\\n https://api.voucherify.io/v1/validation-rules-assignments?rule=val_ZEZmA9oit8aU\n```\n\n```json\n{\n \"object\": \"list\",\n \"data_ref\": \"data\",\n \"data\": [\n {\n \"id\": \"asgm_vef0G6d9Al0rABxq\",\n \"rule_id\": \"val_ZEZmA9oit8aU\",\n \"related_object_id\": \"camp_rRsfatlwN7unSeUIJDCYedal\",\n \"related_object_type\": \"campaign\",\n \"created_at\": \"2022-06-29T11:43:52.953Z\",\n \"object\": \"validation_rules_assignment\"\n },\n {\n \"id\": \"asgm_sFV4wEFvldwIvgfb\",\n \"rule_id\": \"val_ZEZmA9oit8aU\",\n \"related_object_id\": \"distr_9QKI02wqgjWyvZXeQkFEPmkkYe\",\n \"related_object_type\": \"distribution\",\n \"created_at\": \"2022-06-29T11:41:07.680Z\",\n \"object\": \"validation_rules_assignment\"\n },\n {\n \"id\": \"asgm_69Qifyv6UZynFIIQ\",\n \"rule_id\": \"val_ZEZmA9oit8aU\",\n \"related_object_id\": \"promo_g83qUzYZpfX0OMAFOVoQuOYG\",\n \"related_object_type\": \"promotion_tier\",\n \"created_at\": \"2022-06-29T11:29:41.906Z\",\n \"object\": \"validation_rules_assignment\"\n }\n ],\n \"total\": 3\n}\n```\n", + "parameters": [ + { + "schema": { + "type": "string" + }, + "in": "query", + "name": "related_object_id", + "description": "The resource ID to which the validation rule was assigned; this could be, for example, a resource ID of a voucher, campaign, earning rule, reward assignment, promotion tier, or distribution." }, - "/v1/validation-rules/{validationRuleId}/assignments": { - "parameters": [ - { + { + "schema": { + "type": "string", + "example": "val_30Qo2rclFi4T" + }, + "in": "query", + "name": "rule", + "description": "Validation rule ID." + }, + { + "$ref": "#/components/parameters/page" + }, + { + "$ref": "#/components/parameters/limit" + }, + { + "schema": { + "type": "string" + }, + "in": "query", + "description": "Sorts the results using one of the filtering options: `-created_at`, `created_at`, where the dash `-` preceding a sorting option means sorting in a descending order.", + "name": "order" + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary with a data property that contains an array of validation rule assignments. Each entry in the array is a separate object. If no more validation rule assignments are available, the resulting array will be empty. The result can be narrowed down according to default filters.", + "content": { + "application/json": { "schema": { - "type": "string" - }, - "name": "validationRuleId", - "in": "path", - "required": true, - "description": "Unique validation rule ID." - } - ], - "get": { - "operationId": "list-validation-rule-assignments", - "tags": [ - "VALIDATION RULES API" - ], - "summary": "List Validation Rule Assignments", - "description": "Retrieve validation rule assignments for a specific validation rule.", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" + "$ref": "#/components/schemas/13_res_validation-rules_validationRuleId_assignments" }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at" - ] - }, - "in": "query", - "name": "order", - "description": "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." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary of validation rule assignments. If the validation rule ID provided in the path parameter cannot be found, the endpoint will return an empty `data` array and a total of `0`.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/13_res_validation-rules_validationRuleId_assignments" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "asgm_74F7QZoYbUoljwQO", - "rule_id": "val_4j7DCRm2IS59", - "related_object_id": "v_MBOEmHelKwvykVZ8JcT4TE5Kla5IMJyc", - "related_object_type": "voucher", - "created_at": "2022-02-17T09:05:34.642Z", - "object": "validation_rules_assignment" - }, - { - "id": "asgm_zzLBm8mIzGQStXl9", - "rule_id": "val_4j7DCRm2IS59", - "related_object_id": "v_JtWunK6jUo7X2qOFj0SyRHq4p9tgENlT", - "related_object_type": "voucher", - "created_at": "2022-02-17T08:18:15.085Z", - "object": "validation_rules_assignment" - }, - { - "id": "asgm_JztMAws0e0Qx2Xy6", - "rule_id": "val_4j7DCRm2IS59", - "related_object_id": "camp_kjja4moiVB7hQKPGOT61026Z", - "related_object_type": "campaign", - "created_at": "2022-02-15T13:26:34.807Z", - "object": "validation_rules_assignment" - } - ], - "total": 3 - } + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_2S7Xm4dab4UvYAgm", + "rule_id": "val_5ix74ru7e", + "related_object_id": "camp_YDsFdX8TgFtT0RUuKEFyhqs3", + "related_object_type": "campaign", + "created_at": "2022-02-08T10:49:30.534Z", + "object": "validation_rules_assignment" }, - "No Assignments": { - "value": { - "object": "list", - "data_ref": "data", - "data": [], - "total": 0 - } + { + "id": "asgm_sFV4wEFvldwIvgfb", + "rule_id": "val_ZEZmA9oit8aU", + "related_object_id": "distr_9QKI02wqgjWyvZXeQkFEPmkkYe", + "related_object_type": "distribution", + "created_at": "2022-06-29T11:41:07.680Z", + "object": "validation_rules_assignment" + }, + { + "id": "asgm_8xelF5R4zB8ue168", + "rule_id": "val_ggDODO6fakMs", + "related_object_id": "ern_xrRuGEV7EW0X8wtMaze3HOfw", + "related_object_type": "earning_rule", + "created_at": "2022-02-28T12:25:56.783Z", + "object": "validation_rules_assignment" + }, + { + "id": "asgm_tZaqxeO8gP4q91jG", + "rule_id": "val_WB6ETAiFztw5", + "related_object_id": "promo_kJliy076IuJYtuYWSHE9fSuT", + "related_object_type": "promotion_tier", + "created_at": "2022-08-10T10:30:39.986Z", + "object": "validation_rules_assignment" + }, + { + "id": "asgm_xTMHiyPGSz3rp5m2", + "rule_id": "val_2AxnWmW2ra6X", + "related_object_id": "rewa_m9hEAu10KsPcLhGXiHG85aY0", + "related_object_type": "reward_assignment", + "created_at": "2021-12-10T11:38:35.922Z", + "object": "validation_rules_assignment" + }, + { + "id": "asgm_DhlDn54JwqVFJzR6", + "rule_id": "val_eR1c41hu0vUU", + "related_object_id": "v_XuF7icVlUcVpHsSY9nG7n7yJa5wx27Va", + "related_object_type": "voucher", + "created_at": "2022-03-23T07:50:31.068Z", + "object": "validation_rules_assignment" } - } + ], + "total": 6 + } + }, + "No Assignments": { + "value": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 } } } } + } + } + } + } + }, + "/v1/validation-rules/{validationRuleId}/assignments": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "validationRuleId", + "in": "path", + "required": true, + "description": "Unique validation rule ID." + } + ], + "get": { + "operationId": "list-validation-rule-assignments", + "tags": [ + "VALIDATION RULES API" + ], + "summary": "List Validation Rule Assignments", + "description": "Retrieve validation rule assignments for a specific validation rule.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at" + ] }, - "post": { - "operationId": "create-validation-rule-assignment", - "tags": [ - "VALIDATION RULES API" - ], - "summary": "Create Validation Rules Assignments", - "description": "Assign validation rule to either one of the following objects: voucher, campaign, promotion tier, earning rule, reward, distribution.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the resource that you would like to assign the validation rule to.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/13_req_create_validation_rule_assignments" - }, - "examples": { - "Voucher": { - "value": { - "voucher": "v_ssR6vhswwh5odSloN2Vc3O60w7aea018" - } - }, - "Campaign": { - "value": { - "campaign": "camp_Rv9EuIrkT08YEORb2pUMGSUo" - } - }, - "Distribution": { - "value": { - "distribution": "distr_2nUIekYnS9L1Vm1I55vmC7kSvd" + "in": "query", + "name": "order", + "description": "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." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary of validation rule assignments. If the validation rule ID provided in the path parameter cannot be found, the endpoint will return an empty `data` array and a total of `0`.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/13_res_validation-rules_validationRuleId_assignments" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "asgm_74F7QZoYbUoljwQO", + "rule_id": "val_4j7DCRm2IS59", + "related_object_id": "v_MBOEmHelKwvykVZ8JcT4TE5Kla5IMJyc", + "related_object_type": "voucher", + "created_at": "2022-02-17T09:05:34.642Z", + "object": "validation_rules_assignment" + }, + { + "id": "asgm_zzLBm8mIzGQStXl9", + "rule_id": "val_4j7DCRm2IS59", + "related_object_id": "v_JtWunK6jUo7X2qOFj0SyRHq4p9tgENlT", + "related_object_type": "voucher", + "created_at": "2022-02-17T08:18:15.085Z", + "object": "validation_rules_assignment" + }, + { + "id": "asgm_JztMAws0e0Qx2Xy6", + "rule_id": "val_4j7DCRm2IS59", + "related_object_id": "camp_kjja4moiVB7hQKPGOT61026Z", + "related_object_type": "campaign", + "created_at": "2022-02-15T13:26:34.807Z", + "object": "validation_rules_assignment" } - } + ], + "total": 3 + } + }, + "No Assignments": { + "value": { + "object": "list", + "data_ref": "data", + "data": [], + "total": 0 } } } + } + } + } + } + }, + "post": { + "operationId": "create-validation-rule-assignment", + "tags": [ + "VALIDATION RULES API" + ], + "summary": "Create Validation Rules Assignments", + "description": "Assign validation rule to either one of the following objects: voucher, campaign, promotion tier, earning rule, reward, distribution.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the resource that you would like to assign the validation rule to.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/13_req_create_validation_rule_assignments" }, - "responses": { - "200": { - "description": "Returns a validation rules assignment object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/13_obj_validation_rule_assignment_object" - }, - "examples": { - "Example": { - "value": { - "id": "asgm_kPPiNW3smQLRMWiF", - "rule_id": "val_ZEZmA9oit8aU", - "related_object_id": "camp_Rv9EuIrkT08YEORb2pUMGSUo", - "related_object_type": "campaign", - "created_at": "2022-09-14T07:06:49.557Z", - "object": "validation_rules_assignment" - } - } - } - } + "examples": { + "Voucher": { + "value": { + "voucher": "v_ssR6vhswwh5odSloN2Vc3O60w7aea018" } }, - "409": { - "description": "Returns an error if an duplicate assignment is found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_409_duplicate_found" - }, - "examples": { - "Duplicate": { - "value": { - "code": 409, - "key": "duplicate_found", - "message": "Duplicated resource found", - "details": "Duplicated validation_rules_assignment exists with id asgm_ixJEwQbUv8hfPlhO", - "request_id": "v-0bb06fd1c3478dcb47", - "resource_id": "asgm_ixJEwQbUv8hfPlhO", - "resource_type": "validation_rules_assignment" - } - } - } - } + "Campaign": { + "value": { + "campaign": "camp_Rv9EuIrkT08YEORb2pUMGSUo" + } + }, + "Distribution": { + "value": { + "distribution": "distr_2nUIekYnS9L1Vm1I55vmC7kSvd" } } } } - }, - "/v1/validation-rules/{validationRuleId}/assignments/{assignmentId}": { - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "validationRuleId", - "in": "path", - "required": true, - "description": "A unique validation rule ID." - }, - { + } + }, + "responses": { + "200": { + "description": "Returns a validation rules assignment object.", + "content": { + "application/json": { "schema": { - "type": "string" + "$ref": "#/components/schemas/13_obj_validation_rule_assignment_object" }, - "name": "assignmentId", - "in": "path", - "required": true, - "description": "A unique validation rule assignment ID." - } - ], - "delete": { - "operationId": "delete-validation-rule-assignment", - "tags": [ - "VALIDATION RULES API" - ], - "summary": "Delete Validation Rule Assignment", - "description": "This method deletes a validation rule assignment.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." - }, - "404": { - "description": "Returns an error indicating that the validation rule or validation rule assignment with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Validation Rule Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find validation_rules with id val_4j7DCRm2IS5", - "request_id": "v-0ae3b84bac0683f697", - "resource_id": "val_4j7DCRm2IS5", - "resource_type": "validation_rules" - } - }, - "Validation Rule Assignment Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find validation_rules_assignment with id asgm_tDN7MJNayjrf1wy", - "request_id": "v-0ae3b87eeb9027c916", - "resource_id": "asgm_tDN7MJNayjrf1wy", - "resource_type": "validation_rules_assignment" - } - } - } + "examples": { + "Example": { + "value": { + "id": "asgm_kPPiNW3smQLRMWiF", + "rule_id": "val_ZEZmA9oit8aU", + "related_object_id": "camp_Rv9EuIrkT08YEORb2pUMGSUo", + "related_object_type": "campaign", + "created_at": "2022-09-14T07:06:49.557Z", + "object": "validation_rules_assignment" } } } } } }, - "/v1/segments/{segmentId}": { - "parameters": [ - { + "409": { + "description": "Returns an error if an duplicate assignment is found.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "seg_DNAOhUtJffvX0f57ajLMFBYR" - }, - "name": "segmentId", - "in": "path", - "required": true, - "description": "A unique customer segment ID." - } - ], - "get": { - "operationId": "get-segment", - "tags": [ - "SEGMENTS API" - ], - "summary": "Get Segment", - "description": "Retrieves the segment with given segment ID.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns segment object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/14_obj_segment_object" - }, - "examples": { - "Tier Segment": { - "value": { - "id": "seg_Mv5w1b2FIEbiCCO5ioT8TfI2", - "name": "Tiers 2 - Senior", - "created_at": "2022-06-09T13:21:26.656Z", - "type": "auto-update", - "filter": { - "junction": "and", - "loyalty_points.campaigns.Tiers 2.points": { - "conditions": { - "$more_than_equal": [ - 41 - ] - } - } - }, - "initial_sync_status": "DONE", - "object": "segment" - } - } - } - } - } + "$ref": "#/components/schemas/e_409_duplicate_found" }, - "404": { - "description": "Returns an error when requesting a segment that has been deleted or does not exist.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find segment with id seg_Mv5w1b2FIEbiCCO5ioT8TfI", - "request_id": "v-0b4d7a37a105797650", - "resource_id": "seg_Mv5w1b2FIEbiCCO5ioT8TfI", - "resource_type": "segment" - } - } - } - } - } - } - } - }, - "delete": { - "operationId": "delete-segment", - "tags": [ - "SEGMENTS API" - ], - "summary": "Delete Segment", - "description": "This method deletes a customer segment.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." - }, - "404": { - "description": "Returns an error indicating that the customer segment with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Customer Segment Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find segment with id seg_DNAOhUtJffvX0f57ajLMFBY", - "request_id": "v-0ae3bb40409027cb63", - "resource_id": "seg_DNAOhUtJffvX0f57ajLMFBY", - "resource_type": "segment" - } - } - } + "examples": { + "Duplicate": { + "value": { + "code": 409, + "key": "duplicate_found", + "message": "Duplicated resource found", + "details": "Duplicated validation_rules_assignment exists with id asgm_ixJEwQbUv8hfPlhO", + "request_id": "v-0bb06fd1c3478dcb47", + "resource_id": "asgm_ixJEwQbUv8hfPlhO", + "resource_type": "validation_rules_assignment" } } } } } + } + } + } + }, + "/v1/validation-rules/{validationRuleId}/assignments/{assignmentId}": { + "parameters": [ + { + "schema": { + "type": "string" }, - "/v1/customer-segment-object": { - "get": { - "operationId": "customer-segment-object", - "tags": [ - "SEGMENTS API" - ], - "summary": "Customer Segment Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Customer Segment Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/14_obj_segment_object" - } + "name": "validationRuleId", + "in": "path", + "required": true, + "description": "A unique validation rule ID." + }, + { + "schema": { + "type": "string" + }, + "name": "assignmentId", + "in": "path", + "required": true, + "description": "A unique validation rule assignment ID." + } + ], + "delete": { + "operationId": "delete-validation-rule-assignment", + "tags": [ + "VALIDATION RULES API" + ], + "summary": "Delete Validation Rule Assignment", + "description": "This method deletes a validation rule assignment.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." + }, + "404": { + "description": "Returns an error indicating that the validation rule or validation rule assignment with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Validation Rule Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find validation_rules with id val_4j7DCRm2IS5", + "request_id": "v-0ae3b84bac0683f697", + "resource_id": "val_4j7DCRm2IS5", + "resource_type": "validation_rules" + } + }, + "Validation Rule Assignment Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find validation_rules_assignment with id asgm_tDN7MJNayjrf1wy", + "request_id": "v-0ae3b87eeb9027c916", + "resource_id": "asgm_tDN7MJNayjrf1wy", + "resource_type": "validation_rules_assignment" } } } } } + } + } + } + }, + "/v1/segments/{segmentId}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "seg_DNAOhUtJffvX0f57ajLMFBYR" }, - "/v1/segments": { - "post": { - "operationId": "create-segment", - "tags": [ - "SEGMENTS API" - ], - "summary": "Create Segment", - "description": "Create a customer segment.\n\n> 🚧 Limit on Static Segments\n>\n> There is a cap on the number of customers that you can assign to a static segment: **20,000**. If you would like to create a bigger segment, then you can use the unlimited auto-update segment instead and use some customer metadata to build this segment.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the boundary conditions for the customer segment.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/14_req_create_segment" - }, - "examples": { - "Static Segment": { - "value": { - "name": "Customers in a new Segment", - "type": "static", - "customers": [ - "cust_iajsExT2QB4sGWzABY85WRqV", - "cust_sehkNIi8Uq2qQuRqSr7xn4Zi" - ] - } - }, - "Dynamic": { - "value": { - "name": "Customers in a new Dynamic Segment", - "type": "auto-update", - "filter": { - "junction": "and", - "created_at": { - "conditions": { - "$after": [ - "2021-12-01T00:00:00.000Z" - ] - } - } + "name": "segmentId", + "in": "path", + "required": true, + "description": "A unique customer segment ID." + } + ], + "get": { + "operationId": "get-segment", + "tags": [ + "SEGMENTS API" + ], + "summary": "Get Segment", + "description": "Retrieves the segment with given segment ID.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns segment object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/14_obj_segment_object" + }, + "examples": { + "Tier Segment": { + "value": { + "id": "seg_Mv5w1b2FIEbiCCO5ioT8TfI2", + "name": "Tiers 2 - Senior", + "created_at": "2022-06-09T13:21:26.656Z", + "type": "auto-update", + "filter": { + "junction": "and", + "loyalty_points.campaigns.Tiers 2.points": { + "conditions": { + "$more_than_equal": [ + 41 + ] } } - } - } - } - } - }, - "responses": { - "200": { - "description": "Returns a customer segment object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/14_obj_segment_object" }, - "examples": { - "Static": { - "value": { - "id": "seg_vC8iOSCqUG02EsPzsHynLv8i", - "name": "Customers in a new Segment", - "created_at": "2022-09-13T08:57:15.801Z", - "type": "static", - "filter": null, - "initial_sync_status": "DONE", - "object": "segment" - } - }, - "Dynamic": { - "value": { - "id": "seg_nZULMFHhVWIFm9vQ0dytg83Q", - "name": "Customers in a new Dynamic Segment", - "created_at": "2022-09-13T09:03:32.764Z", - "type": "auto-update", - "filter": { - "junction": "and", - "created_at": { - "conditions": { - "$after": [ - "2021-12-01T00:00:00.000Z" - ] - } - } - }, - "initial_sync_status": "IN_PROGRESS", - "object": "segment" - } - } - } + "initial_sync_status": "DONE", + "object": "segment" } } } } } }, - "/v1/custom-event-object": { - "get": { - "operationId": "custom-event-object", - "tags": [ - "EVENTS API" - ], - "summary": "Custom Event Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Custom Event Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/15_req_track_custom_event" - } + "404": { + "description": "Returns an error when requesting a segment that has been deleted or does not exist.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find segment with id seg_Mv5w1b2FIEbiCCO5ioT8TfI", + "request_id": "v-0b4d7a37a105797650", + "resource_id": "seg_Mv5w1b2FIEbiCCO5ioT8TfI", + "resource_type": "segment" } } } } } + } + } + }, + "delete": { + "operationId": "delete-segment", + "tags": [ + "SEGMENTS API" + ], + "summary": "Delete Segment", + "description": "This method deletes a customer segment.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." }, - "/v1/events": { - "post": { - "operationId": "track-custom-event", - "tags": [ - "EVENTS API" - ], - "summary": "Track Custom Event", - "description": "To track a custom event, you create an event object. \n\nThe 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.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the details of the custom event.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/15_req_track_custom_event" - }, - "examples": { - "Example": { - "value": { - "event": "event-name", - "customer": { - "source_id": "referee-source_id" - }, - "referral": { - "code": "voucher-code", - "referrer_id": "referrer-source_id" - } - } - }, - "Referral triggered by custom event": { - "value": { - "event": "user_subscribed", - "customer": { - "source_id": "source_customer_event" - }, - "referral": { - "code": "46jL0kYI", - "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" - }, - "metadata": { - "login": "bob", - "pricing_plan": "PP1", - "volume_number": 4 - } - } - }, - "Earning rule triggered by custom event": { - "value": { - "event": "cart_abandoned", - "customer": { - "source_id": "source_customer_event" - }, - "loyalty": { - "code": "6CB4KDAu" - }, - "metadata": { - "date": "2022-12-01", - "flag": true, - "text": "Cart abandoned event", - "date_time": "2022-12-01T09:24:33.061Z", - "number": 1 - } - } - } + "404": { + "description": "Returns an error indicating that the customer segment with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Customer Segment Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find segment with id seg_DNAOhUtJffvX0f57ajLMFBY", + "request_id": "v-0ae3bb40409027cb63", + "resource_id": "seg_DNAOhUtJffvX0f57ajLMFBY", + "resource_type": "segment" } } } + } + } + } + } + } + }, + "/v1/customer-segment-object": { + "get": { + "operationId": "customer-segment-object", + "tags": [ + "SEGMENTS API" + ], + "summary": "Customer Segment Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Customer Segment Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/14_obj_segment_object" + } + } + } + } + } + } + }, + "/v1/segments": { + "post": { + "operationId": "create-segment", + "tags": [ + "SEGMENTS API" + ], + "summary": "Create Segment", + "description": "Create a customer segment.\n\n> 🚧 Limit on Static Segments\n>\n> There is a cap on the number of customers that you can assign to a static segment: **20,000**. If you would like to create a bigger segment, then you can use the unlimited auto-update segment instead and use some customer metadata to build this segment.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the boundary conditions for the customer segment.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/14_req_create_segment" }, - "responses": { - "200": { - "description": "Returns the event type if the event was received by the application.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/15_res_track_custom_event" - }, - "examples": { - "Example": { - "value": { - "object": "event", - "type": "cart_abandoned", - "customer": {}, - "referral": null, - "loyalty": null - } - } - } - } + "examples": { + "Static Segment": { + "value": { + "name": "Customers in a new Segment", + "type": "static", + "customers": [ + "cust_iajsExT2QB4sGWzABY85WRqV", + "cust_sehkNIi8Uq2qQuRqSr7xn4Zi" + ] } }, - "400": { - "description": "Returns an error if the request payload is incomplete.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Invalid payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Property .referral should have required property 'code'", - "request_id": "v-0c15694e0e022146dd" - } + "Dynamic": { + "value": { + "name": "Customers in a new Dynamic Segment", + "type": "auto-update", + "filter": { + "junction": "and", + "created_at": { + "conditions": { + "$after": [ + "2021-12-01T00:00:00.000Z" + ] } } } @@ -82498,3321 +82381,3508 @@ } } } - }, - "/client/v1/events": { - "post": { - "operationId": "track-custom-event-client-side", - "tags": [ - "EVENTS API" - ], - "summary": "Track Custom Event (client-side)", - "description": "To track a custom event, you create an event object. \n\nThe 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.", - "parameters": [ - { - "$ref": "#/components/parameters/origin" - } - ], - "security": [ - { - "X-Client-Application-Id-1": [], - "X-Client-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the details of the custom event.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/15_req_track_custom_event" - }, - "examples": { - "Referral triggered by custom event": { - "value": { - "event": "user_subscribed", - "customer": { - "source_id": "source_customer_event" - }, - "referral": { - "code": "46jL0kYI", - "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" - }, - "metadata": { - "login": "bob", - "pricing_plan": "PP1", - "volume_number": 4 + } + }, + "responses": { + "200": { + "description": "Returns a customer segment object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/14_obj_segment_object" + }, + "examples": { + "Static": { + "value": { + "id": "seg_vC8iOSCqUG02EsPzsHynLv8i", + "name": "Customers in a new Segment", + "created_at": "2022-09-13T08:57:15.801Z", + "type": "static", + "filter": null, + "initial_sync_status": "DONE", + "object": "segment" + } + }, + "Dynamic": { + "value": { + "id": "seg_nZULMFHhVWIFm9vQ0dytg83Q", + "name": "Customers in a new Dynamic Segment", + "created_at": "2022-09-13T09:03:32.764Z", + "type": "auto-update", + "filter": { + "junction": "and", + "created_at": { + "conditions": { + "$after": [ + "2021-12-01T00:00:00.000Z" + ] } } }, - "Earning rule triggered by custom event": { - "value": { - "event": "cart_abandoned", - "customer": { - "source_id": "source_customer_event" - }, - "loyalty": { - "code": "6CB4KDAu" - }, - "metadata": { - "date": "2022-12-01", - "flag": true, - "text": "Cart abandoned event", - "date_time": "2022-12-01T09:24:33.061Z", - "number": 1 - } - } - } + "initial_sync_status": "IN_PROGRESS", + "object": "segment" } } } + } + } + } + } + } + }, + "/v1/custom-event-object": { + "get": { + "operationId": "custom-event-object", + "tags": [ + "EVENTS API" + ], + "summary": "Custom Event Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Custom Event Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/15_req_track_custom_event" + } + } + } + } + } + } + }, + "/v1/events": { + "post": { + "operationId": "track-custom-event", + "tags": [ + "EVENTS API" + ], + "summary": "Track Custom Event", + "description": "To track a custom event, you create an event object. \n\nThe 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.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the details of the custom event.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/15_req_track_custom_event" }, - "responses": { - "200": { - "description": "Returns the event type if the event was received by the application.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/15_res_track_custom_event" - }, - "examples": { - "Example": { - "value": { - "object": "event", - "type": "cart_abandoned", - "customer": {}, - "referral": null, - "loyalty": null - } - } - } + "examples": { + "Example": { + "value": { + "event": "event-name", + "customer": { + "source_id": "referee-source_id" + }, + "referral": { + "code": "voucher-code", + "referrer_id": "referrer-source_id" } } }, - "400": { - "description": "Returns an error if the request payload is incomplete.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" - }, - "examples": { - "Invalid payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Property .referral should have required property 'code'", - "request_id": "v-0c15694e0e022146dd" - } - } - } + "Referral triggered by custom event": { + "value": { + "event": "user_subscribed", + "customer": { + "source_id": "source_customer_event" + }, + "referral": { + "code": "46jL0kYI", + "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" + }, + "metadata": { + "login": "bob", + "pricing_plan": "PP1", + "volume_number": 4 + } + } + }, + "Earning rule triggered by custom event": { + "value": { + "event": "cart_abandoned", + "customer": { + "source_id": "source_customer_event" + }, + "loyalty": { + "code": "6CB4KDAu" + }, + "metadata": { + "date": "2022-12-01", + "flag": true, + "text": "Cart abandoned event", + "date_time": "2022-12-01T09:24:33.061Z", + "number": 1 } } } } } - }, - "/v1/consents-object": { - "get": { - "operationId": "consents-object", - "tags": [ - "CONSENTS API" - ], - "summary": "Consents Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Consents Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/18_res_list_consents_GET" - } + } + }, + "responses": { + "200": { + "description": "Returns the event type if the event was received by the application.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/15_res_track_custom_event" + }, + "examples": { + "Example": { + "value": { + "object": "event", + "type": "cart_abandoned", + "customer": {}, + "referral": null, + "loyalty": null } } } } } }, - "/v1/consents": { - "get": { - "operationId": "list-consents", - "tags": [ - "CONSENTS API" - ], - "summary": "List Consents", - "description": "List the Marketing Permission definitions within the project along with opt-in consents.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns marketing permission groups and opt-in consents.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/18_res_list_consents_GET" - }, - "examples": { - "Marketing Permissions Groups and Consents": { - "value": { - "groups": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "cnstgr_3c7Z3rcOLv51bsXlRtTZPYj8", - "name": "Consent group", - "description": "Consent group", - "consents": [ - "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", - "cnst_VCmucIvAsmDYw2PPAok6bcYy" - ], - "created_at": "2022-04-13T09:12:47.743Z", - "updated_at": "2022-04-13T09:45:46.616Z", - "object": "consent_group" - }, - { - "id": "cnstgr_EAIakTj5lNG2ZpiQEauGqBlY", - "name": "Consent group 2", - "description": "Consent group 2", - "consents": [ - "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", - "cnst_VCmucIvAsmDYw2PPAok6bcYy" - ], - "created_at": "2022-04-13T10:03:46.564Z", - "updated_at": null, - "object": "consent_group" - } - ], - "total": 2 - }, - "consents": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", - "name": "Consent", - "description": "Consent for marketing", - "category": "New", - "created_at": "2022-04-13T09:11:27.037Z", - "updated_at": null, - "object": "consent" - }, - { - "id": "cnst_VCmucIvAsmDYw2PPAok6bcYy", - "name": "Consent 2", - "description": "Consent 2", - "category": "Trial", - "created_at": "2022-04-13T09:45:37.597Z", - "updated_at": null, - "object": "consent" - } - ], - "total": 2 - } - } - } - } + "400": { + "description": "Returns an error if the request payload is incomplete.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Invalid payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Property .referral should have required property 'code'", + "request_id": "v-0c15694e0e022146dd" } } } } } - }, - "/client/v1/consents#": { - "get": { - "operationId": "list-consents-client-side", - "tags": [ - "CONSENTS API" - ], - "summary": "List Consents (client-side)", - "description": "List the Marketing Permission definitions within the project along with opt-in consents.", - "parameters": [ - { - "$ref": "#/components/parameters/origin" - } - ], - "security": [ - { - "X-Client-Application-Id-1": [], - "X-Client-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns marketing permission groups and opt-in consents.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/18_res_list_consents_GET" - }, - "examples": { - "Marketing Permissions Groups and Consents": { - "value": { - "groups": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "cnstgr_3c7Z3rcOLv51bsXlRtTZPYj8", - "name": "Consent group", - "description": "Consent group", - "consents": [ - "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", - "cnst_VCmucIvAsmDYw2PPAok6bcYy" - ], - "created_at": "2022-04-13T09:12:47.743Z", - "updated_at": "2022-04-13T09:45:46.616Z", - "object": "consent_group" - }, - { - "id": "cnstgr_EAIakTj5lNG2ZpiQEauGqBlY", - "name": "Consent group 2", - "description": "Consent group 2", - "consents": [ - "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", - "cnst_VCmucIvAsmDYw2PPAok6bcYy" - ], - "created_at": "2022-04-13T10:03:46.564Z", - "updated_at": null, - "object": "consent_group" - } - ], - "total": 2 - }, - "consents": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", - "name": "Consent", - "description": "Consent for marketing", - "category": "New", - "created_at": "2022-04-13T09:11:27.037Z", - "updated_at": null, - "object": "consent" - }, - { - "id": "cnst_VCmucIvAsmDYw2PPAok6bcYy", - "name": "Consent 2", - "description": "Consent 2", - "category": "Trial", - "created_at": "2022-04-13T09:45:37.597Z", - "updated_at": null, - "object": "consent" - } - ], - "total": 2 - } - } - } - } + } + } + } + }, + "/client/v1/events": { + "post": { + "operationId": "track-custom-event-client-side", + "tags": [ + "EVENTS API" + ], + "summary": "Track Custom Event (client-side)", + "description": "To track a custom event, you create an event object. \n\nThe 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.", + "parameters": [ + { + "$ref": "#/components/parameters/origin" + } + ], + "security": [ + { + "X-Client-Application-Id-1": [], + "X-Client-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the details of the custom event.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/15_req_track_custom_event" + }, + "examples": { + "Referral triggered by custom event": { + "value": { + "event": "user_subscribed", + "customer": { + "source_id": "source_customer_event" + }, + "referral": { + "code": "46jL0kYI", + "referrer_id": "cust_Vzck5i8U3OhcEUFY6MKhN9Rv" + }, + "metadata": { + "login": "bob", + "pricing_plan": "PP1", + "volume_number": 4 + } + } + }, + "Earning rule triggered by custom event": { + "value": { + "event": "cart_abandoned", + "customer": { + "source_id": "source_customer_event" + }, + "loyalty": { + "code": "6CB4KDAu" + }, + "metadata": { + "date": "2022-12-01", + "flag": true, + "text": "Cart abandoned event", + "date_time": "2022-12-01T09:24:33.061Z", + "number": 1 } } } } } - }, - "/v1/async-action-object": { - "get": { - "operationId": "async-action-object", - "tags": [ - "ASYNC ACTIONS API" - ], - "summary": "Async Action Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Async Action Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/17_obj_async_action_object" - } + } + }, + "responses": { + "200": { + "description": "Returns the event type if the event was received by the application.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/15_res_track_custom_event" + }, + "examples": { + "Example": { + "value": { + "object": "event", + "type": "cart_abandoned", + "customer": {}, + "referral": null, + "loyalty": null } } } } } }, - "/v1/async-actions": { - "get": { - "operationId": "list-async-actions", - "tags": [ - "ASYNC ACTIONS API" - ], - "summary": "List Async Actions", - "description": "Track asynchronous operations scheduled in your project. \n\nThe table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import).\n\n| **Types by Context** | **Endpoint** |\n|:---|:---|\n| **CAMPAIGN** | |\n| CAMPAIGN.VOUCHERS_IMPORT | **POST** [/campaigns/{campaignId}/import](ref:import-vouchers-to-campaign) |\n| CAMPAIGN.VOUCHERS_IMPORT_CSV | **POST** [/campaigns/{campaignId}/importCSV](ref:import-vouchers-to-campaign-using-csv) |\n| CAMPAIGN.VOUCHERS_UPDATE | **PUT** [/campaigns/{campaignId}](ref:update-campaign) |\n| CAMPAIGN.VOUCHERS_DELETE | **DELETE** [/campaigns/{campaignId}](ref:delete-campaign) |\n| CAMPAIGN.VOUCHERS_GENERATE |
                  • **POST** [/campaigns](ref:create-campaign): asynchronous for campaigns with more than 1 voucher, synchronous for campaign with 1 voucher
                  • **POST** [/campaigns/{campaignId}/vouchers](ref:add-vouchers-to-campaign)
                    • |\n| **CUSTOMERS** | |\n| CUSTOMERS.IMPORT_CSV | **POST** [/customers/importCSV](ref:import-customers-using-csv) |\n| CUSTOMERS.BULK_UPDATE | **POST** [/customers/bulk/async](ref:update-customers-in-bulk) |\n| CUSTOMERS.METADATA_UPDATE | **POST** [/customers/metadata/async](ref:update-customers-metadata-in-bulk) |\n| **PRODUCTS** | |\n| PRODUCTS.BULK_UPDATE | **POST** [/products/bulk/async](ref:update-products-in-bulk)
                      |\n| PRODUCTS.METADATA_UPDATE | **POST** [/products/metadata/async](ref:update-products-metadata-in-bulk) |\n| PRODUCTS.IMPORT_CSV | **POST** [/products/importCSV](ref:import-products-using-csv) |\n| SKUS.IMPORT_CSV | **POST** [/skus/importCSV](ref:import-skus-using-csv) |\n| **VOUCHERS** | |\n| VOUCHERS.IMPORT | **POST** [/vouchers/import](ref:import-vouchers) |\n| VOUCHERS.IMPORT_CSV | **POST** [/vouchers/importCSV](ref:import-vouchers-using-csv) |\n| VOUCHERS.BULK_UPDATE | **POST** [/vouchers/bulk/async](ref:update-vouchers-in-bulk)
                      |\n| VOUCHERS.METADATA_UPDATE | **POST** [/vouchers/metadata/async](ref:update-vouchers-metadata-in-bulk) | \n| **ORDERS** | |\n| ORDERS.IMPORT | **POST** [/orders/import](ref:import-orders) |\n| **METADATA KEY PURGE** | |\n| CAMPAIGNS.METADATA_KEY_PURGE
                      CUSTOMERS.METADATA_KEY_PURGE
                      PRODUCTS.METADATA_KEY_PURGE
                      VOUCHERS.METADATA_KEY_PURGE
                      ORDERS.METADATA_KEY_PURGE | No API endpoint equivalent. You can perform this action through the Dashboard. See Dashboard documentation: Dashboard > [Project Settings](https://support.voucherify.io/article/99-schema-validation-metadata#maintenance) |", - "parameters": [ - { - "schema": { - "type": "integer" - }, - "in": "query", - "name": "limit", - "description": "Limit the number of asynchronous actions that the API returns in the response." + "400": { + "description": "Returns an error if the request payload is incomplete.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" }, - { - "schema": { - "type": "string", - "example": "2021-09-08T13:52:18.227Z", - "format": "date-time" - }, - "in": "query", - "name": "end_date", - "description": "Limits results to actions scheduled before the `end_date`. The date format needs to be consistent with ISO 8601 format (`2016-11-16T14:14:31Z` or `2016-11-16`). " + "examples": { + "Invalid payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Property .referral should have required property 'code'", + "request_id": "v-0c15694e0e022146dd" + } + } } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + } + } + } + } + } + }, + "/v1/consents-object": { + "get": { + "operationId": "consents-object", + "tags": [ + "CONSENTS API" + ], + "summary": "Consents Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Consents Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/18_res_list_consents_GET" } - ], - "responses": { - "200": { - "description": "Returns a list of all scheduled asynchronous actions and detailed information for each scheduled action. Note that a status `DONE`doesn't include the result of the completed action. If you need more information about the result, use the ID of the respective async action to call the [Get Async Action](ref:get-async-action) endpoint.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/17_res_list_async_actions_GET" - }, - "examples": { - "List Async Actions": { - "value": { - "object": "list", - "data_ref": "async_actions", - "async_actions": [ - { - "id": "aa_0ba518c55290c6fd62", - "type": "CUSTOMERS.BULK_UPDATE", - "status": "DONE", - "created_at": "2022-09-05T11:40:17.098Z", - "updated_at": "2022-09-05T11:40:17.887Z", - "request_id": "v-0ba518c52bc99858f0", - "progress": 100, - "object": "async_action" - }, - { - "id": "aa_0ba50a7ff4d3574568", - "type": "CUSTOMERS.METADATA_UPDATE", - "status": "DONE", - "created_at": "2022-09-05T10:37:56.051Z", - "updated_at": "2022-09-05T10:37:56.862Z", - "request_id": "v-0ba50a7feb49984902", - "progress": 100, - "object": "async_action" - } - ] + } + } + } + } + } + }, + "/v1/consents": { + "get": { + "operationId": "list-consents", + "tags": [ + "CONSENTS API" + ], + "summary": "List Consents", + "description": "List the Marketing Permission definitions within the project along with opt-in consents.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns marketing permission groups and opt-in consents.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/18_res_list_consents_GET" + }, + "examples": { + "Marketing Permissions Groups and Consents": { + "value": { + "groups": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "cnstgr_3c7Z3rcOLv51bsXlRtTZPYj8", + "name": "Consent group", + "description": "Consent group", + "consents": [ + "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", + "cnst_VCmucIvAsmDYw2PPAok6bcYy" + ], + "created_at": "2022-04-13T09:12:47.743Z", + "updated_at": "2022-04-13T09:45:46.616Z", + "object": "consent_group" + }, + { + "id": "cnstgr_EAIakTj5lNG2ZpiQEauGqBlY", + "name": "Consent group 2", + "description": "Consent group 2", + "consents": [ + "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", + "cnst_VCmucIvAsmDYw2PPAok6bcYy" + ], + "created_at": "2022-04-13T10:03:46.564Z", + "updated_at": null, + "object": "consent_group" } - } - } - } - } - }, - "400": { - "description": "Returns an error if incorrect query parameters were provided.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_error_no_translation" + ], + "total": 2 }, - "examples": { - "Invalid Query Parameters": { - "value": { - "code": 400, - "key": "invalid_query_params", - "message": "Invalid query params", - "details": "Property .end_date cannot be recognized as a ISO-8601 compliant date", - "request_id": "v-0c54493e444b0f61a6" + "consents": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", + "name": "Consent", + "description": "Consent for marketing", + "category": "New", + "created_at": "2022-04-13T09:11:27.037Z", + "updated_at": null, + "object": "consent" + }, + { + "id": "cnst_VCmucIvAsmDYw2PPAok6bcYy", + "name": "Consent 2", + "description": "Consent 2", + "category": "Trial", + "created_at": "2022-04-13T09:45:37.597Z", + "updated_at": null, + "object": "consent" } - } + ], + "total": 2 } } } } } } - }, - "/v1/async-actions/{asyncActionId}": { - "parameters": [ - { + } + } + } + }, + "/client/v1/consents#": { + "get": { + "operationId": "list-consents-client-side", + "tags": [ + "CONSENTS API" + ], + "summary": "List Consents (client-side)", + "description": "List the Marketing Permission definitions within the project along with opt-in consents.", + "parameters": [ + { + "$ref": "#/components/parameters/origin" + } + ], + "security": [ + { + "X-Client-Application-Id-1": [], + "X-Client-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns marketing permission groups and opt-in consents.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "aa_0afb3d009a55814a48" - }, - "name": "asyncActionId", - "in": "path", - "required": true, - "description": "Unique ID of the asynchronous operation." - } - ], - "get": { - "operationId": "get-async-action", - "tags": [ - "ASYNC ACTIONS API" - ], - "summary": "Get Async Action", - "description": "Check the result of a scheduled asynchronous operation. \n\nThe table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import).\n\n| **Types by Context** | **Endpoint** |\n|:---|:---|\n| **CAMPAIGN** | |\n| CAMPAIGN.VOUCHERS_IMPORT | **POST** [/campaigns/{campaignId}/import](ref:import-vouchers-to-campaign) |\n| CAMPAIGN.VOUCHERS_IMPORT_CSV | **POST** [/campaigns/{campaignId}/importCSV](ref:import-vouchers-to-campaign-using-csv) |\n| CAMPAIGN.VOUCHERS_UPDATE | **PUT** [/campaigns/{campaignId}](ref:update-campaign) |\n| CAMPAIGN.VOUCHERS_DELETE | **DELETE** [/campaigns/{campaignId}](ref:delete-campaign) |\n| CAMPAIGN.VOUCHERS_GENERATE |
                      • **POST** [/campaigns](ref:create-campaign): asynchronous for campaigns with more than 1 voucher, synchronous for campaign with 1 voucher
                      • **POST** [/campaigns/{campaignId}/vouchers](ref:add-vouchers-to-campaign)
                        • |\n| **CUSTOMERS** | |\n| CUSTOMERS.IMPORT_CSV | **POST** [/customers/importCSV](ref:import-customers-using-csv) |\n| CUSTOMERS.BULK_UPDATE | **POST** [/customers/bulk/async](ref:update-customers-in-bulk) |\n| CUSTOMERS.METADATA_UPDATE | **POST** [/customers/metadata/async](ref:update-customers-metadata-in-bulk) |\n| **PRODUCTS** | |\n| PRODUCTS.BULK_UPDATE | **POST** [/products/bulk/async](ref:update-products-in-bulk)
                          |\n| PRODUCTS.METADATA_UPDATE | **POST** [/products/metadata/async](ref:update-products-metadata-in-bulk) |\n| PRODUCTS.IMPORT_CSV | **POST** [/products/importCSV](ref:import-products-using-csv) |\n| SKUS.IMPORT_CSV | **POST** [/skus/importCSV](ref:import-skus-using-csv) |\n| **VOUCHERS** | |\n| VOUCHERS.IMPORT | **POST** [/vouchers/import](ref:import-vouchers) |\n| VOUCHERS.IMPORT_CSV | **POST** [/vouchers/importCSV](ref:import-vouchers-using-csv) |\n| VOUCHERS.BULK_UPDATE | **POST** [/vouchers/bulk/async](ref:update-vouchers-in-bulk)
                          |\n| VOUCHERS.METADATA_UPDATE | **POST** [/vouchers/metadata/async](ref:update-vouchers-metadata-in-bulk) | \n| **ORDERS** | |\n| ORDERS.IMPORT | **POST** [/orders/import](ref:import-orders) |\n| **METADATA KEY PURGE** | |\n| CAMPAIGNS.METADATA_KEY_PURGE
                          CUSTOMERS.METADATA_KEY_PURGE
                          PRODUCTS.METADATA_KEY_PURGE
                          VOUCHERS.METADATA_KEY_PURGE
                          ORDERS.METADATA_KEY_PURGE | No API endpoint equivalent. You can perform this action through the Dashboard. See Dashboard documentation: Dashboard > [Project Settings](https://support.voucherify.io/article/99-schema-validation-metadata#maintenance) |", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns detailed information about the async action result.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/17_obj_async_action_object" - }, - "examples": { - "CAMPAIGN.VOUCHERS_IMPORT": { - "value": { - "id": "aa_0af9b22296cf473a10", - "type": "CAMPAIGN.VOUCHERS_IMPORT", - "status": "DONE", - "result": { - "message": "0 voucher(s) imported successfully, 3 failed.", - "failed": [ - { - "code": "CODE9", - "reason": "unit: must be a number, property is required (actual value is 'EUR')" - }, - { - "code": "CODE8", - "reason": "unit: must be a number, property is required (actual value is 'EUR')" - }, - { - "code": "CODE7", - "reason": "unit: must be a number, property is required (actual value is 'EUR')" - } - ], - "done_count": 0, - "failed_count": 3 - }, - "created_at": "2023-01-20T07:23:43.289Z", - "updated_at": "2023-01-20T07:23:44.044Z", - "request_id": "v-0c553fdb325688d510", - "progress": 100, - "processing_time": 755, - "object": "async_action" - } - }, - "CAMPAIGN.VOUCHERS_IMPORT_CSV": { - "value": { - "id": "aa_0c5543f00797b6113f", - "type": "CUSTOMERS.IMPORT_CSV", - "status": "DONE", - "result": { - "message": "0 customer(s) imported successfully, 2 failed.", - "failed": [ - { - "source_id": "test-user@voucherify.io", - "row": 1, - "reason": "acquisition_channel: must be a string, property is required, must be equal to one of Facebook,Twitter,Website (actual value is 'snap')" - }, - { - "source_id": "", - "row": 2, - "reason": "acquisition_channel: must be a string, property is required, must be equal to one of Facebook,Twitter,Website (actual value is 'insta')" - } - ], - "done_count": 0, - "failed_count": 2 - }, - "created_at": "2023-01-20T07:41:33.086Z", - "updated_at": "2023-01-20T07:41:33.216Z", - "request_id": "v-0c5543eff2cb0f547f", - "progress": 100, - "processing_time": 130, - "object": "async_action" - } - }, - "CAMPAIGN.VOUCHERS_DELETE": { - "value": { - "id": "aa_0c553853d957b67bd4", - "type": "CAMPAIGN.VOUCHERS_DELETE", - "status": "DONE", - "result": { - "message": "Deleted 2 vouchers.", - "done_count": 2 - }, - "created_at": "2023-01-20T06:50:49.573Z", - "updated_at": "2023-01-20T06:50:50.053Z", - "request_id": "v-0c553853b5c418c826", - "progress": 100, - "processing_time": 480, - "object": "async_action" - } - }, - "CAMPAIGN.VOUCHERS_UPDATE": { - "value": { - "id": "aa_0c5440c25c0e5728d0", - "type": "CAMPAIGN.VOUCHERS_UPDATE", - "status": "DONE", - "result": { - "message": "Updated 1 vouchers.", - "done_count": 1 - }, - "created_at": "2023-01-19T12:49:11.024Z", - "updated_at": "2023-01-19T12:49:11.852Z", - "request_id": "v-0c5440c24304189e44", - "progress": 100, - "processing_time": 828, - "object": "async_action" - } - }, - "CAMPAIGN.VOUCHERS_GENERATE": { - "value": { - "id": "aa_0c54441d14d7b60014", - "type": "CAMPAIGN.VOUCHERS_GENERATE", - "status": "DONE", - "result": { - "message": "Generated 2 vouchers.", - "done_count": 2 - }, - "created_at": "2023-01-19T13:03:50.355Z", - "updated_at": "2023-01-19T13:03:51.030Z", - "request_id": "v-0c54441d0e4418b647", - "progress": 100, - "processing_time": 675, - "object": "async_action" - } - }, - "CAMPAIGNS.METADATA_KEY_PURGE": { - "value": { - "id": "aa_0c554b22664a0eb5fc", - "type": "CAMPAIGNS.METADATA_KEY_PURGE", - "status": "DONE", - "result": { - "message": "Updated 0 campaigns.", - "done_count": 0 - }, - "created_at": "2023-01-20T08:12:59.673Z", - "updated_at": "2023-01-20T08:13:00.638Z", - "request_id": "w-0c554b225f8a0eb5fb", - "progress": 100, - "processing_time": 965, - "object": "async_action" - } - }, - "CUSTOMERS.IMPORT_CSV": { - "value": { - "id": "aa_0c5543f00797b6113f", - "type": "CUSTOMERS.IMPORT_CSV", - "status": "DONE", - "result": { - "message": "0 customer(s) imported successfully, 2 failed.", - "failed": [ - { - "source_id": "test-user@voucherify.io", - "row": 1, - "reason": "acquisition_channel: must be a string, property is required, must be equal to one of Facebook,Twitter,Website (actual value is 'snap')" - }, - { - "source_id": "", - "row": 2, - "reason": "acquisition_channel: must be a string, property is required, must be equal to one of Facebook,Twitter,Website (actual value is 'insta')" - } - ], - "done_count": 0, - "failed_count": 2 - }, - "created_at": "2023-01-20T07:41:33.086Z", - "updated_at": "2023-01-20T07:41:33.216Z", - "request_id": "v-0c5543eff2cb0f547f", - "progress": 100, - "processing_time": 130, - "object": "async_action" - } - }, - "CUSTOMERS.BULK_UPDATE": { - "value": { - "id": "aa_0c5547cc5e17b617b6", - "type": "CUSTOMERS.BULK_UPDATE", - "status": "DONE", - "result": { - "results": [ - { - "source_id": "source_id_1", - "updated": true, - "found": true - }, - { - "source_id": "source_id_2", - "updated": true, - "found": true - }, - { - "source_id": "source_id_3", - "updated": true, - "found": true - } - ], - "done_count": 3 - }, - "created_at": "2023-01-20T07:58:25.144Z", - "updated_at": "2023-01-20T07:58:25.869Z", - "request_id": "v-0c5547cc4d8b0f5be4", - "progress": 100, - "processing_time": 725, - "object": "async_action" - } - }, - "CUSTOMERS.METADATA_UPDATE": { - "value": { - "id": "aa_0c554a92030e576181", - "type": "CUSTOMERS.METADATA_UPDATE", - "status": "DONE", - "result": { - "results": [ - { - "source_id": "source_1", - "updated": true, - "found": true - }, - { - "source_id": "source_2", - "updated": true, - "found": true - } - ], - "done_count": 2 - }, - "created_at": "2023-01-20T08:10:31.821Z", - "updated_at": "2023-01-20T08:10:32.564Z", - "request_id": "v-0c554a91fb4b0f61a2", - "progress": 100, - "processing_time": 743, - "object": "async_action" - } - }, - "CUSTOMERS.METADATA_KEY_PURGE": { - "value": { - "id": "aa_0c5551f2ab0a0ebf0e", - "type": "CUSTOMERS.METADATA_KEY_PURGE", - "status": "DONE", - "result": { - "message": "Updated 0 customers.", - "done_count": 0 - }, - "created_at": "2023-01-20T08:42:45.804Z", - "updated_at": "2023-01-20T08:42:46.079Z", - "request_id": "w-0c5551f2a38a0ebf0d", - "progress": 100, - "processing_time": 275, - "object": "async_action" - } - }, - "PRODUCTS.BULK_UPDATE": { - "value": { - "id": "aa_0c5553f0f457b6328e", - "type": "PRODUCTS.BULK_UPDATE", - "status": "DONE", - "result": { - "results": [ - { - "source_id": "first_product", - "updated": false, - "found": true - }, - { - "source_id": "second_product", - "updated": false, - "found": true - } - ], - "done_count": 2 - }, - "created_at": "2023-01-20T08:51:28.337Z", - "updated_at": "2023-01-20T08:51:28.439Z", - "request_id": "v-0c5553f0e94b0f7502", - "progress": 100, - "processing_time": 102, - "object": "async_action" - } - }, - "PRODUCTS.METADATA_UPDATE": { - "value": { - "id": "aa_0c5554869b97b633b4", - "type": "PRODUCTS.METADATA_UPDATE", - "status": "DONE", - "result": { - "results": [ - { - "source_id": "123-567-3433", - "updated": false, - "found": true - }, - { - "source_id": "test_volleyball", - "updated": false, - "found": true - } - ], - "done_count": 2 - }, - "created_at": "2023-01-20T08:54:01.582Z", - "updated_at": "2023-01-20T08:54:02.436Z", - "request_id": "v-0c55548694c418f9dd", - "progress": 100, - "processing_time": 854, - "object": "async_action" - } - }, - "PRODUCTS.METADATA_KEY_PURGE": { - "value": { - "id": "aa_0c5552d997ca0ec03a", - "type": "PRODUCTS.METADATA_KEY_PURGE", - "status": "DONE", - "result": { - "message": "Updated 2 products.", - "done_count": 2 - }, - "created_at": "2023-01-20T08:46:42.271Z", - "updated_at": "2023-01-20T08:46:43.240Z", - "request_id": "w-0c5552d98e8a0ec039", - "progress": 100, - "processing_time": 969, - "object": "async_action" - } - }, - "VOUCHERS.IMPORT": { - "value": { - "id": "aa_0c5559be44d7b63c06", - "type": "VOUCHERS.IMPORT", - "status": "DONE", - "result": { - "message": "0 voucher(s) imported successfully, 3 failed.", - "failed": [ - { - "code": "PROMO-CODE31", - "reason": "unit: must be a number, must be equal to one of 1,2 (actual value is 'EUR')" - }, - { - "code": "PROMO-CODE21", - "reason": "unit: must be a number, must be equal to one of 1,2 (actual value is 'EUR')" - }, - { - "code": "GIFT-CARD-100-1", - "reason": "unit: must be a number, must be equal to one of 1,2 (actual value is 'EUR')" - } - ], - "done_count": 0, - "failed_count": 3 - }, - "created_at": "2023-01-20T09:16:49.299Z", - "updated_at": "2023-01-20T09:16:50.238Z", - "request_id": "v-0c5559be25c418824a", - "progress": 100, - "processing_time": 939, - "object": "async_action" - } - }, - "VOUCHERS.IMPORT_CSV": { - "value": { - "id": "aa_0c555db3d697b643e1", - "type": "VOUCHERS.IMPORT_CSV", - "status": "DONE", - "result": { - "message": "0 voucher(s) imported successfully, 2 failed.", - "failed": [ - { - "code": "FALL2023", - "row": 1, - "reason": "Voucher Type is required" - }, - { - "code": "FALL2024", - "row": 2, - "reason": "Voucher Type is required" - } - ], - "done_count": 0, - "failed_count": 2 - }, - "created_at": "2023-01-20T09:34:07.194Z", - "updated_at": "2023-01-20T09:34:07.367Z", - "request_id": "v-0c555db3ba8b0f0767", - "progress": 100, - "processing_time": 173, - "object": "async_action" - } - }, - "VOUCHERS.BULK_UPDATE": { - "value": { - "id": "aa_0c555e8115d7b64504", - "type": "VOUCHERS.BULK_UPDATE", - "status": "DONE", - "result": { - "results": [ - { - "code": "PROMO-CODE81019", - "updated": false, - "found": false - }, - { - "code": "PROMO-CODE7264786", - "updated": false, - "found": false - } - ], - "done_count": 2 - }, - "created_at": "2023-01-20T09:37:37.367Z", - "updated_at": "2023-01-20T09:37:37.520Z", - "request_id": "v-0c555e810904188aa4", - "progress": 100, - "processing_time": 153, - "object": "async_action" - } - }, - "VOUCHERS.METADATA_UPDATE": { - "value": { - "id": "aa_0c555ed40857b6463a", - "type": "VOUCHERS.METADATA_UPDATE", - "status": "DONE", - "result": { - "results": [ - { - "code": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", - "updated": false, - "found": false - }, - { - "code": "LOYALTY-CARD-xLPbpbXR", - "updated": false, - "found": false - } - ], - "done_count": 2 - }, - "created_at": "2023-01-20T09:39:02.305Z", - "updated_at": "2023-01-20T09:39:02.640Z", - "request_id": "v-0c555ed40084188b55", - "progress": 100, - "processing_time": 335, - "object": "async_action" - } - }, - "VOUCHERS.METADATA_KEY_PURGE": { - "value": { - "id": "aa_0c55534bd64a0ec0e0", - "type": "VOUCHERS.METADATA_KEY_PURGE", - "status": "DONE", - "result": { - "message": "Updated 9 vouchers.", - "done_count": 9 - }, - "created_at": "2023-01-20T08:48:39.257Z", - "updated_at": "2023-01-20T08:48:40.503Z", - "request_id": "w-0c55534bcfca0ec0df", - "progress": 100, - "processing_time": 1246, - "object": "async_action" - } - }, - "SKUS.IMPORT_CSV": { - "value": { - "id": "aa_0c5558728d0e577e67", - "type": "SKUS.IMPORT_CSV", - "status": "DONE", - "result": { - "message": "4 sku(s) imported successfully, 0 failed.", - "failed": [], - "done_count": 4, - "failed_count": 0 - }, - "created_at": "2023-01-20T09:11:09.620Z", - "updated_at": "2023-01-20T09:11:10.270Z", - "request_id": "v-0c5558726f0b0f7d82", - "progress": 100, - "processing_time": 650, - "object": "async_action" - } - }, - "PRODUCTS.IMPORT_CSV": { - "value": { - "id": "aa_0c55578e914e577cf1", - "type": "PRODUCTS.IMPORT_CSV", - "status": "DONE", - "result": { - "message": "1 product(s) imported successfully, 1 failed.", - "failed": [ - { - "row": 1, - "reason": "vendor: must be a string, property is required, must be equal to one of Vendor 1,Vendor 2 (actual value is 'Vendor 3')" - } - ], - "done_count": 1, - "failed_count": 1 - }, - "created_at": "2023-01-20T09:07:16.165Z", - "updated_at": "2023-01-20T09:07:17.025Z", - "request_id": "v-0c55578e7a0418fef5", - "progress": 100, - "processing_time": 860, - "object": "async_action" - } - }, - "ORDERS.METADATA_KEY_PURGE": { - "value": { - "id": "aa_0c555fda50472c83a8", - "type": "ORDERS.METADATA_KEY_PURGE", - "status": "DONE", - "result": { - "message": "Updated 1 orders.", - "done_count": 1 - }, - "created_at": "2023-01-20T09:43:30.881Z", - "updated_at": "2023-01-20T09:43:31.217Z", - "request_id": "w-0c555fda45c72c83a7", - "progress": 100, - "processing_time": 336, - "object": "async_action" - } - }, - "ORDERS.IMPORT": { - "value": { - "id": "aa_0c5564b67d0e571534", - "type": "ORDERS.IMPORT", - "status": "DONE", - "result": { - "message": "1 order(s) imported successfully, 1 failed.", - "failed": [ - { - "source_id": null, - "reason": "Internal error" - } - ], - "done_count": 1, - "failed_count": 1 - }, - "created_at": "2023-01-20T10:04:44.916Z", - "updated_at": "2023-01-20T10:04:46.102Z", - "request_id": "v-0c5564b6688b0f155d", - "progress": 100, - "processing_time": 1186, - "object": "async_action" + "$ref": "#/components/schemas/18_res_list_consents_GET" + }, + "examples": { + "Marketing Permissions Groups and Consents": { + "value": { + "groups": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "cnstgr_3c7Z3rcOLv51bsXlRtTZPYj8", + "name": "Consent group", + "description": "Consent group", + "consents": [ + "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", + "cnst_VCmucIvAsmDYw2PPAok6bcYy" + ], + "created_at": "2022-04-13T09:12:47.743Z", + "updated_at": "2022-04-13T09:45:46.616Z", + "object": "consent_group" + }, + { + "id": "cnstgr_EAIakTj5lNG2ZpiQEauGqBlY", + "name": "Consent group 2", + "description": "Consent group 2", + "consents": [ + "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", + "cnst_VCmucIvAsmDYw2PPAok6bcYy" + ], + "created_at": "2022-04-13T10:03:46.564Z", + "updated_at": null, + "object": "consent_group" } - } - } - } - } - }, - "404": { - "description": "Returns an error indicating that the async action with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Async-Action-Not-Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find async_action with id aa_0aeb82bd55d5beffb", - "request_id": "v-0aeb88df54c82af560", - "resource_id": "aa_0aeb82bd55d5beffb", - "resource_type": "async_action" + ], + "total": 2 + }, + "consents": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "cnst_6jQ5XcUOLnj5L7ImQAdBsJ1I", + "name": "Consent", + "description": "Consent for marketing", + "category": "New", + "created_at": "2022-04-13T09:11:27.037Z", + "updated_at": null, + "object": "consent" + }, + { + "id": "cnst_VCmucIvAsmDYw2PPAok6bcYy", + "name": "Consent 2", + "description": "Consent 2", + "category": "Trial", + "created_at": "2022-04-13T09:45:37.597Z", + "updated_at": null, + "object": "consent" } - } + ], + "total": 2 } } } } } } + } + } + } + }, + "/v1/async-action-object": { + "get": { + "operationId": "async-action-object", + "tags": [ + "ASYNC ACTIONS API" + ], + "summary": "Async Action Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Async Action Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/17_obj_async_action_object" + } + } + } + } + } + } + }, + "/v1/async-actions": { + "get": { + "operationId": "list-async-actions", + "tags": [ + "ASYNC ACTIONS API" + ], + "summary": "List Async Actions", + "description": "Track asynchronous operations scheduled in your project. \n\nThe table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import).\n\n| **Types by Context** | **Endpoint** |\n|:---|:---|\n| **CAMPAIGN** | |\n| CAMPAIGN.VOUCHERS_IMPORT | **POST** [/campaigns/{campaignId}/import](ref:import-vouchers-to-campaign) |\n| CAMPAIGN.VOUCHERS_IMPORT_CSV | **POST** [/campaigns/{campaignId}/importCSV](ref:import-vouchers-to-campaign-using-csv) |\n| CAMPAIGN.VOUCHERS_UPDATE | **PUT** [/campaigns/{campaignId}](ref:update-campaign) |\n| CAMPAIGN.VOUCHERS_DELETE | **DELETE** [/campaigns/{campaignId}](ref:delete-campaign) |\n| CAMPAIGN.VOUCHERS_GENERATE |
                          • **POST** [/campaigns](ref:create-campaign): asynchronous for campaigns with more than 1 voucher, synchronous for campaign with 1 voucher
                          • **POST** [/campaigns/{campaignId}/vouchers](ref:add-vouchers-to-campaign)
                            • |\n| **CUSTOMERS** | |\n| CUSTOMERS.IMPORT_CSV | **POST** [/customers/importCSV](ref:import-customers-using-csv) |\n| CUSTOMERS.BULK_UPDATE | **POST** [/customers/bulk/async](ref:update-customers-in-bulk) |\n| CUSTOMERS.METADATA_UPDATE | **POST** [/customers/metadata/async](ref:update-customers-metadata-in-bulk) |\n| **PRODUCTS** | |\n| PRODUCTS.BULK_UPDATE | **POST** [/products/bulk/async](ref:update-products-in-bulk)
                              |\n| PRODUCTS.METADATA_UPDATE | **POST** [/products/metadata/async](ref:update-products-metadata-in-bulk) |\n| PRODUCTS.IMPORT_CSV | **POST** [/products/importCSV](ref:import-products-using-csv) |\n| SKUS.IMPORT_CSV | **POST** [/skus/importCSV](ref:import-skus-using-csv) |\n| **VOUCHERS** | |\n| VOUCHERS.IMPORT | **POST** [/vouchers/import](ref:import-vouchers) |\n| VOUCHERS.IMPORT_CSV | **POST** [/vouchers/importCSV](ref:import-vouchers-using-csv) |\n| VOUCHERS.BULK_UPDATE | **POST** [/vouchers/bulk/async](ref:update-vouchers-in-bulk)
                              |\n| VOUCHERS.METADATA_UPDATE | **POST** [/vouchers/metadata/async](ref:update-vouchers-metadata-in-bulk) | \n| **ORDERS** | |\n| ORDERS.IMPORT | **POST** [/orders/import](ref:import-orders) |\n| **METADATA KEY PURGE** | |\n| CAMPAIGNS.METADATA_KEY_PURGE
                              CUSTOMERS.METADATA_KEY_PURGE
                              PRODUCTS.METADATA_KEY_PURGE
                              VOUCHERS.METADATA_KEY_PURGE
                              ORDERS.METADATA_KEY_PURGE | No API endpoint equivalent. You can perform this action through the Dashboard. See Dashboard documentation: Dashboard > [Project Settings](https://support.voucherify.io/article/99-schema-validation-metadata#maintenance) |", + "parameters": [ + { + "schema": { + "type": "integer" + }, + "in": "query", + "name": "limit", + "description": "Limit the number of asynchronous actions that the API returns in the response." }, - "/v1/export-object": { - "get": { - "operationId": "export-object", - "tags": [ - "EXPORTS API" - ], - "summary": "Export Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Export Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/16_obj_export_object" - } + { + "schema": { + "type": "string", + "example": "2021-09-08T13:52:18.227Z", + "format": "date-time" + }, + "in": "query", + "name": "end_date", + "description": "Limits results to actions scheduled before the `end_date`. The date format needs to be consistent with ISO 8601 format (`2016-11-16T14:14:31Z` or `2016-11-16`). " + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a list of all scheduled asynchronous actions and detailed information for each scheduled action. Note that a status `DONE`doesn't include the result of the completed action. If you need more information about the result, use the ID of the respective async action to call the [Get Async Action](ref:get-async-action) endpoint.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/17_res_list_async_actions_GET" + }, + "examples": { + "List Async Actions": { + "value": { + "object": "list", + "data_ref": "async_actions", + "async_actions": [ + { + "id": "aa_0ba518c55290c6fd62", + "type": "CUSTOMERS.BULK_UPDATE", + "status": "DONE", + "created_at": "2022-09-05T11:40:17.098Z", + "updated_at": "2022-09-05T11:40:17.887Z", + "request_id": "v-0ba518c52bc99858f0", + "progress": 100, + "object": "async_action" + }, + { + "id": "aa_0ba50a7ff4d3574568", + "type": "CUSTOMERS.METADATA_UPDATE", + "status": "DONE", + "created_at": "2022-09-05T10:37:56.051Z", + "updated_at": "2022-09-05T10:37:56.862Z", + "request_id": "v-0ba50a7feb49984902", + "progress": 100, + "object": "async_action" + } + ] } } } } } }, - "/v1/exports": { - "post": { - "operationId": "create-export", - "tags": [ - "EXPORTS API" - ], - "summary": "Create Export", - "description": "Create export object. The export can be any of the following types: `voucher`, `redemption`, `publication`, `customer`, `order`, `points_expiration`, or `voucher_transactions`. \n\n## Defaults\n\nIf you only specify the object type in the request body without specifying the fields, the API will return the following fields per export object:\n\n| **Export Object** | **Default fields returned** |\n|:---|:---|\n| order | `id`, `source_id`, `status` |\n| voucher | `code`, `voucher_type`, `value`, `discount_type` |\n| publication | `code`, `customer_id`, `date`, `channel` |\n| redemption | `id`, `object`, `voucher_code`, `customer_id`, `date`, `result` |\n| customer | `name`, `source_id` |\n| points_expiration | `id`, `campaign_id`, `voucher_id`, `status`, `expires_at`, `points` |\n| voucher_transactions | `id`, `type`, `source_id`, `status`, `reason`, `source`, `balance`, `amount`, `created_at` |\n\n\n## Fetching particular data sets\n\nUsing the `parameters` body parameter, you can narrow down which fields to export and how to filter the results. The fields are an array of strings containing the data that you would like to export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:\n\n## Orders \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique order ID. | ord_A69RIxEdRsPuC6i8gFGVHUft |\n| source_id | Unique order source ID. | 8638 |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the order was created. | 2022-03-09T09:16:32.521Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the order was last updated. | 2022-03-09T09:16:33.331Z |\n| status | Order status. | `PAID`, `CREATED`, `FULFILLED`, `CANCELED` |\n| amount | Total amount of order items. | 7700 |\n| discount_amount | Represents total amount of the discount applied to whole cart. | 500 |\n| items_discount_amount | Represents total amount of the discount applied to order line items. | 100 |\n| total_discount_amount | All discounts applied to the order including discounts applied to particular order line items and discounts applied to the whole cart. | 600 |\n| total_amount | Total order amount after applying all discounts. | 7100 |\n| customer_id | Customer unique ID. | cust_2G4fUQdCXUqp35nXNleav7bO |\n| referrer_id | Referrer unique ID. | cust_IkrTR674vvQvr9a4rDMiqglY |\n| metadata | Order metadata; expressed as metadata.X, where X is the name of the custom metadata property. | 1 |\n\n## Vouchers \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique voucher ID. | v_HSnGD2vNIHYighTQxwcB4dtVAv8VOmZD |\n| code | Unique voucher code. | WELCOME100 |\n| voucher_type | Type of voucher. | `DISCOUNT_VOUCHER`, `GIFT_VOUCHER`, `LOYALTY_CARD` |\n| value | Value of voucher. | `DISCOUNT_VOUCHER` : amount, percent, unit
                              `GIFT_VOUCHER`: amount left to spend
                              `LOYALTY_CARD`: available usable points |\n| discount_type | The type of discount for a `DISCOUNT_VOUCHER`. | `AMOUNT`, `PERCENT`, `UNIT`, `FIXED` |\n| campaign | Unique campaign name. | Summer Discounts 20% off |\n| category | Tag defining the category that this voucher belongs to. | |\n| start_date | Start date defines when the code starts to be active. Activation timestamp in ISO 8601 format. Voucher is _inactive_ before this date. | 2020-12-10T23:00:00.000Z |\n| expiration_date | Expiration date defines when the code expires. Expiration timestamp in ISO 8601 format. Voucher is _inactive_ after this date. | 2023-12-31T23:00:00.000Z |\n| gift_balance | Amount left to spend. | 1000 |\n| loyalty_balance | Available usable points. | 2000 |\n| redemption_quantity | Maximum number of times a voucher can be redeemed. | 2 |\n| redemption_count | Total redemptions. | 59 |\n| active | Boolean indicating whether the voucher is available for use. | `true`, `false` |\n| qr_code | URL to QR representation of encrypted code. | |\n| bar_code | URL to barcode representation of encrypted code. | |\n| metadata | Custom voucher metadata. | |\n| is_referral_code | Boolean indicating whether the voucher is a referral code. | `true`, `false` |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the voucher was created. | 2022-04-14T09:55:46.814Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the voucher was last updated. | 2022-04-14T10:02:18.036Z |\n| validity_timeframe_interval | Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an interval of `P2D` will be active every other day. | P2D |\n| validity_timeframe_duration | Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a duration of `PT1H` will be valid for a duration of one hour. | PT1H |\n| validity_day_of_week | Array corresponding to the particular days of the week in which the voucher is valid. | \"1,2,3,4,5\" |\n| discount_amount_limit | For `PERCENT` discount type, this is the maximum threshold allowed to be deducted. | 50 |\n| campaign_id | Parent campaign ID. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| additional_info | An optional field to keep any extra textual information about the code such as a code description and details. | |\n| customer_id | Unique customer ID of the assigned owner to whom the voucher was published. | cust_7iUa6ICKyU6gH40dBU25kQU1 |\n| discount_unit_type | For `UNIT` discount type, either a shipping or product ID for a `UNIT` discount with one product. | prod_5h1pp1ng, prod_0a9f9aeddb019a42db |\n| discount_unit_effect | `UNIT` discount effect. | `ADD_MANY_ITEMS`, `ADD_MISSING_ITEMS`,`ADD_NEW_ITEMS` |\n| customer_source_id | Unique customer source id of the assigned owner to whom the voucher was published. | name.lastname@email.com |\n\n\n## Publications\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| voucher_code | Unique voucher code. | WELCOME100 |\n| customer_id | Customer unique ID. | cust_7iUa6ICKyU6gH40dBU25kQU1 |\n| customer_source_id | Unique customer source id of the assigned owner to whom the voucher was published. | name.lastname@email.com |\n| date | Timestamp in ISO 8601 format representing the date and time when the voucher was published. | 2022-04-28T10:19:30.792Z |\n| channel | Publication channel. | voucherify-website |\n| campaign | Unique campaign name. | Summer Discounts 20% off |\n| is_winner | | |\n| metadata | Custom publication metadata. | |\n\n## Redemptions\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique redemption ID. | r_0acf3a6dae00e679c8, rf_0acf3a495740e679b8 |\n| object | Object being exported; by default `redemption`. | redemption |\n| date | Timestamp in ISO 8601 format representing the date and time when the voucher was redeemed. | 2022-03-23T08:52:24.867Z |\n| voucher_code | Unique voucher code redeemed. | WELCOME100 |\n| campaign | Parent campaign name of voucher if applicable. | Summer Discounts 20% off |\n| promotion_tier_id | | promo_Mwy9XpA0TLctSGriM5kum0qp |\n| customer_id | Unique customer ID of redeeming customer. | cust_nk0N1uNQ1YnupAoJGOgvsODC |\n| customer_source_id | Unique source ID of redeeming customer. | name.lastname@email.com |\n| customer_name | Customer name. | John Smith |\n| tracking_id | | track_Pw6r3ejnml43kIwNS4Zj09KZ67xOfLUy |\n| order_amount | Total order amount before applying all discounts. | 1000 |\n| gift_amount | Gift credits used for redemption. | 10 |\n| loyalty_points | | 12 |\n| result | Tells you whether the redemption succeeded. | `SUCCESS`, `FAILURE` |\n| failure_code | Internal Voucherify code for reason why redemption failed. | invalid_customer |\n| failure_message | A human-readable message providing a short description explaining why the redemption failed. | Customer must be a holder of a loyalty card. |\n| metadata | Custom redemption metadata. | |\n\n## Customers\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| name | Customer name. | John Smith |\n| id | Unique customer ID. | cust_J1CDUdbqn5Exva8ASWk1Fq0j |\n| description | An arbitrary string that you can attach to a customer object. | Customer requesting to be added to VIP tier. |\n| email | Customer's email. | name.lastname@email.com |\n| source_id | Unique custom customer identifier. | name.lastname@email.com |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the customer was created. | 2022-02-03T13:10:11.928Z |\n| address_city | City | Houston |\n| address_state | State | TX |\n| address_line_1 | First line of customer's address. | 72738 Main St |\n| address_line_2 | Second line of customer's address. | Bld 2, Apt 4 |\n| address_country | Country | United States of America |\n| address_postal_code | Postal code (ZIP code) | 77042-4143 |\n| redemptions_total_redeemed | Total customer redemptions. | 5 |\n| redemptions_total_failed | Total customer failed redemptions. | 2 |\n| redemptions_total_succeeded | Total customer succeeded redemptions. | 3 |\n| redemptions_total_rolled_back | Total customer redemptions that were rolled back. | 3 |\n| redemptions_total_rollback_failed | Total customer redemptions that were unsuccessfully rolled back. | 2 |\n| redemptions_total_rollback_succeeded | Total customer redemptions that were successfully rolled back. | 1 |\n| orders_total_amount | Total sum of order amounts over customer lifetime. Value is multiplied by 100 to precisely represent 2 decimal places. | 10000 (represents $100) |\n| orders_total_count | Total number of customer orders. | 2 |\n| orders_average_amount | Average amount spent on orders. Value is multiplied by 100 to precisely represent 2 decimal places. | 5000 (represents $50) |\n| orders_last_order_amount | How much did the customer spend on their last order. Value is multiplied by 100 to precisely represent 2 decimal places. | 5000 (represents $50) |\n| orders_last_order_date | When was the last customer order; timestamp in ISO 8601 format representing the date and time. | 2022-02-03T13:17:30.630Z |\n| loyalty_points | Sum of customer's loyalty points to go across all loyalty cards. | 2000 |\n| loyalty_referred_customers | How many customers were referred by this customer. | 3 |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the customer was updated. | 2022-02-14T14:10:14.305Z |\n| phone | Customer's phone number. | +1 (294) 752-1846 |\n| birthday | Customer's birthday. | 2022-01-01 |\n| metadata | Customer metadata. | All metadata fields defined in Metadata Schema for the Customer object. |\n| birthdate | Customer's birthdate. | 2022-01-01 |\n\n## Points Expirations\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n |\n| campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 |\n| status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` |\n| expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 |\n| points | Number of points. | 1000 |\n\n ## Gift Card Transactions\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
                              - `CREDITS_ADDITION`
                              - `CREDITS_REFUND`
                              - `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n\n ## Loyalty Card Transactions\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID assigned by Voucherify. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `POINTS_EXPIRATION`
                              - `POINTS_ADDITION`
                              - `POINTS_REMOVAL`
                              - `POINTS_TRANSFER_OUT`
                              - `POINTS_ACCRUAL`
                              - `POINTS_REFUND`
                              - `POINTS_REDEMPTION` |\n| source_id | Custom source ID of the transaction if one was included originally. | source_id_custom |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The loyalty card balance after the transaction. | |\n| amount | The amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | - `API`
                              - `voucherify-web-ui`
                              - `Automation` |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n| related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the details of the export that you would like to create.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/16_req_create_export_POST" + "400": { + "description": "Returns an error if incorrect query parameters were provided.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_error_no_translation" + }, + "examples": { + "Invalid Query Parameters": { + "value": { + "code": 400, + "key": "invalid_query_params", + "message": "Invalid query params", + "details": "Property .end_date cannot be recognized as a ISO-8601 compliant date", + "request_id": "v-0c54493e444b0f61a6" } } } - }, - "responses": { - "200": { - "description": "Returns export object and URL of CSV file.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/16_obj_export_object" - } - } - } + } + } + } + } + } + }, + "/v1/async-actions/{asyncActionId}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "aa_0afb3d009a55814a48" + }, + "name": "asyncActionId", + "in": "path", + "required": true, + "description": "Unique ID of the asynchronous operation." + } + ], + "get": { + "operationId": "get-async-action", + "tags": [ + "ASYNC ACTIONS API" + ], + "summary": "Get Async Action", + "description": "Check the result of a scheduled asynchronous operation. \n\nThe table below lists the possible types of async actions. The types are different for each endpoint generating the async action. If you would like to learn more about importing data into Voucherify, read more [here](https://support.voucherify.io/article/574-data-import).\n\n| **Types by Context** | **Endpoint** |\n|:---|:---|\n| **CAMPAIGN** | |\n| CAMPAIGN.VOUCHERS_IMPORT | **POST** [/campaigns/{campaignId}/import](ref:import-vouchers-to-campaign) |\n| CAMPAIGN.VOUCHERS_IMPORT_CSV | **POST** [/campaigns/{campaignId}/importCSV](ref:import-vouchers-to-campaign-using-csv) |\n| CAMPAIGN.VOUCHERS_UPDATE | **PUT** [/campaigns/{campaignId}](ref:update-campaign) |\n| CAMPAIGN.VOUCHERS_DELETE | **DELETE** [/campaigns/{campaignId}](ref:delete-campaign) |\n| CAMPAIGN.VOUCHERS_GENERATE |
                              • **POST** [/campaigns](ref:create-campaign): asynchronous for campaigns with more than 1 voucher, synchronous for campaign with 1 voucher
                              • **POST** [/campaigns/{campaignId}/vouchers](ref:add-vouchers-to-campaign)
                                • |\n| **CUSTOMERS** | |\n| CUSTOMERS.IMPORT_CSV | **POST** [/customers/importCSV](ref:import-customers-using-csv) |\n| CUSTOMERS.BULK_UPDATE | **POST** [/customers/bulk/async](ref:update-customers-in-bulk) |\n| CUSTOMERS.METADATA_UPDATE | **POST** [/customers/metadata/async](ref:update-customers-metadata-in-bulk) |\n| **PRODUCTS** | |\n| PRODUCTS.BULK_UPDATE | **POST** [/products/bulk/async](ref:update-products-in-bulk)
                                  |\n| PRODUCTS.METADATA_UPDATE | **POST** [/products/metadata/async](ref:update-products-metadata-in-bulk) |\n| PRODUCTS.IMPORT_CSV | **POST** [/products/importCSV](ref:import-products-using-csv) |\n| SKUS.IMPORT_CSV | **POST** [/skus/importCSV](ref:import-skus-using-csv) |\n| **VOUCHERS** | |\n| VOUCHERS.IMPORT | **POST** [/vouchers/import](ref:import-vouchers) |\n| VOUCHERS.IMPORT_CSV | **POST** [/vouchers/importCSV](ref:import-vouchers-using-csv) |\n| VOUCHERS.BULK_UPDATE | **POST** [/vouchers/bulk/async](ref:update-vouchers-in-bulk)
                                  |\n| VOUCHERS.METADATA_UPDATE | **POST** [/vouchers/metadata/async](ref:update-vouchers-metadata-in-bulk) | \n| **ORDERS** | |\n| ORDERS.IMPORT | **POST** [/orders/import](ref:import-orders) |\n| **METADATA KEY PURGE** | |\n| CAMPAIGNS.METADATA_KEY_PURGE
                                  CUSTOMERS.METADATA_KEY_PURGE
                                  PRODUCTS.METADATA_KEY_PURGE
                                  VOUCHERS.METADATA_KEY_PURGE
                                  ORDERS.METADATA_KEY_PURGE | No API endpoint equivalent. You can perform this action through the Dashboard. See Dashboard documentation: Dashboard > [Project Settings](https://support.voucherify.io/article/99-schema-validation-metadata#maintenance) |", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns detailed information about the async action result.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/17_obj_async_action_object" }, - "400": { - "description": "Returns an error if an invalid payload is provided.", - "content": { - "application/json": { - "schema": { - "anyOf": [ + "examples": { + "CAMPAIGN.VOUCHERS_IMPORT": { + "value": { + "id": "aa_0af9b22296cf473a10", + "type": "CAMPAIGN.VOUCHERS_IMPORT", + "status": "DONE", + "result": { + "message": "0 voucher(s) imported successfully, 3 failed.", + "failed": [ + { + "code": "CODE9", + "reason": "unit: must be a number, property is required (actual value is 'EUR')" + }, { - "$ref": "#/components/schemas/e_400_invalid_payload" + "code": "CODE8", + "reason": "unit: must be a number, property is required (actual value is 'EUR')" }, { - "$ref": "#/components/schemas/e_400_invalid_export_fields" + "code": "CODE7", + "reason": "unit: must be a number, property is required (actual value is 'EUR')" } - ] + ], + "done_count": 0, + "failed_count": 3 + }, + "created_at": "2023-01-20T07:23:43.289Z", + "updated_at": "2023-01-20T07:23:44.044Z", + "request_id": "v-0c553fdb325688d510", + "progress": 100, + "processing_time": 755, + "object": "async_action" + } + }, + "CAMPAIGN.VOUCHERS_IMPORT_CSV": { + "value": { + "id": "aa_0c5543f00797b6113f", + "type": "CUSTOMERS.IMPORT_CSV", + "status": "DONE", + "result": { + "message": "0 customer(s) imported successfully, 2 failed.", + "failed": [ + { + "source_id": "test-user@voucherify.io", + "row": 1, + "reason": "acquisition_channel: must be a string, property is required, must be equal to one of Facebook,Twitter,Website (actual value is 'snap')" + }, + { + "source_id": "", + "row": 2, + "reason": "acquisition_channel: must be a string, property is required, must be equal to one of Facebook,Twitter,Website (actual value is 'insta')" + } + ], + "done_count": 0, + "failed_count": 2 + }, + "created_at": "2023-01-20T07:41:33.086Z", + "updated_at": "2023-01-20T07:41:33.216Z", + "request_id": "v-0c5543eff2cb0f547f", + "progress": 100, + "processing_time": 130, + "object": "async_action" + } + }, + "CAMPAIGN.VOUCHERS_DELETE": { + "value": { + "id": "aa_0c553853d957b67bd4", + "type": "CAMPAIGN.VOUCHERS_DELETE", + "status": "DONE", + "result": { + "message": "Deleted 2 vouchers.", + "done_count": 2 + }, + "created_at": "2023-01-20T06:50:49.573Z", + "updated_at": "2023-01-20T06:50:50.053Z", + "request_id": "v-0c553853b5c418c826", + "progress": 100, + "processing_time": 480, + "object": "async_action" + } + }, + "CAMPAIGN.VOUCHERS_UPDATE": { + "value": { + "id": "aa_0c5440c25c0e5728d0", + "type": "CAMPAIGN.VOUCHERS_UPDATE", + "status": "DONE", + "result": { + "message": "Updated 1 vouchers.", + "done_count": 1 + }, + "created_at": "2023-01-19T12:49:11.024Z", + "updated_at": "2023-01-19T12:49:11.852Z", + "request_id": "v-0c5440c24304189e44", + "progress": 100, + "processing_time": 828, + "object": "async_action" + } + }, + "CAMPAIGN.VOUCHERS_GENERATE": { + "value": { + "id": "aa_0c54441d14d7b60014", + "type": "CAMPAIGN.VOUCHERS_GENERATE", + "status": "DONE", + "result": { + "message": "Generated 2 vouchers.", + "done_count": 2 + }, + "created_at": "2023-01-19T13:03:50.355Z", + "updated_at": "2023-01-19T13:03:51.030Z", + "request_id": "v-0c54441d0e4418b647", + "progress": 100, + "processing_time": 675, + "object": "async_action" + } + }, + "CAMPAIGNS.METADATA_KEY_PURGE": { + "value": { + "id": "aa_0c554b22664a0eb5fc", + "type": "CAMPAIGNS.METADATA_KEY_PURGE", + "status": "DONE", + "result": { + "message": "Updated 0 campaigns.", + "done_count": 0 + }, + "created_at": "2023-01-20T08:12:59.673Z", + "updated_at": "2023-01-20T08:13:00.638Z", + "request_id": "w-0c554b225f8a0eb5fb", + "progress": 100, + "processing_time": 965, + "object": "async_action" + } + }, + "CUSTOMERS.IMPORT_CSV": { + "value": { + "id": "aa_0c5543f00797b6113f", + "type": "CUSTOMERS.IMPORT_CSV", + "status": "DONE", + "result": { + "message": "0 customer(s) imported successfully, 2 failed.", + "failed": [ + { + "source_id": "test-user@voucherify.io", + "row": 1, + "reason": "acquisition_channel: must be a string, property is required, must be equal to one of Facebook,Twitter,Website (actual value is 'snap')" + }, + { + "source_id": "", + "row": 2, + "reason": "acquisition_channel: must be a string, property is required, must be equal to one of Facebook,Twitter,Website (actual value is 'insta')" + } + ], + "done_count": 0, + "failed_count": 2 + }, + "created_at": "2023-01-20T07:41:33.086Z", + "updated_at": "2023-01-20T07:41:33.216Z", + "request_id": "v-0c5543eff2cb0f547f", + "progress": 100, + "processing_time": 130, + "object": "async_action" + } + }, + "CUSTOMERS.BULK_UPDATE": { + "value": { + "id": "aa_0c5547cc5e17b617b6", + "type": "CUSTOMERS.BULK_UPDATE", + "status": "DONE", + "result": { + "results": [ + { + "source_id": "source_id_1", + "updated": true, + "found": true + }, + { + "source_id": "source_id_2", + "updated": true, + "found": true + }, + { + "source_id": "source_id_3", + "updated": true, + "found": true + } + ], + "done_count": 3 + }, + "created_at": "2023-01-20T07:58:25.144Z", + "updated_at": "2023-01-20T07:58:25.869Z", + "request_id": "v-0c5547cc4d8b0f5be4", + "progress": 100, + "processing_time": 725, + "object": "async_action" + } + }, + "CUSTOMERS.METADATA_UPDATE": { + "value": { + "id": "aa_0c554a92030e576181", + "type": "CUSTOMERS.METADATA_UPDATE", + "status": "DONE", + "result": { + "results": [ + { + "source_id": "source_1", + "updated": true, + "found": true + }, + { + "source_id": "source_2", + "updated": true, + "found": true + } + ], + "done_count": 2 }, - "examples": { - "Invalid Export Fields": { - "value": { - "code": 400, - "key": "invalid_export_fields", - "message": "Invalid Export", - "details": "Unsupported field used. Allowed fields: id, object, date, voucher_code, campaign, promotion_tier_id, customer_id, customer_source_id, customer_name, tracking_id, order_amount, gift_amount, loyalty_points, result, failure_code, failure_message, metadata", - "request_id": "v-0afdb603910a1a14e0" + "created_at": "2023-01-20T08:10:31.821Z", + "updated_at": "2023-01-20T08:10:32.564Z", + "request_id": "v-0c554a91fb4b0f61a2", + "progress": 100, + "processing_time": 743, + "object": "async_action" + } + }, + "CUSTOMERS.METADATA_KEY_PURGE": { + "value": { + "id": "aa_0c5551f2ab0a0ebf0e", + "type": "CUSTOMERS.METADATA_KEY_PURGE", + "status": "DONE", + "result": { + "message": "Updated 0 customers.", + "done_count": 0 + }, + "created_at": "2023-01-20T08:42:45.804Z", + "updated_at": "2023-01-20T08:42:46.079Z", + "request_id": "w-0c5551f2a38a0ebf0d", + "progress": 100, + "processing_time": 275, + "object": "async_action" + } + }, + "PRODUCTS.BULK_UPDATE": { + "value": { + "id": "aa_0c5553f0f457b6328e", + "type": "PRODUCTS.BULK_UPDATE", + "status": "DONE", + "result": { + "results": [ + { + "source_id": "first_product", + "updated": false, + "found": true + }, + { + "source_id": "second_product", + "updated": false, + "found": true } - }, - "Invalid Payload": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Property .exported_object should be equal to one of the allowed values [ voucher, redemption, customer, publication, order, points_expiration ]", - "request_id": "v-0afdb5bd68d20bdb81" + ], + "done_count": 2 + }, + "created_at": "2023-01-20T08:51:28.337Z", + "updated_at": "2023-01-20T08:51:28.439Z", + "request_id": "v-0c5553f0e94b0f7502", + "progress": 100, + "processing_time": 102, + "object": "async_action" + } + }, + "PRODUCTS.METADATA_UPDATE": { + "value": { + "id": "aa_0c5554869b97b633b4", + "type": "PRODUCTS.METADATA_UPDATE", + "status": "DONE", + "result": { + "results": [ + { + "source_id": "123-567-3433", + "updated": false, + "found": true + }, + { + "source_id": "test_volleyball", + "updated": false, + "found": true } - } - } + ], + "done_count": 2 + }, + "created_at": "2023-01-20T08:54:01.582Z", + "updated_at": "2023-01-20T08:54:02.436Z", + "request_id": "v-0c55548694c418f9dd", + "progress": 100, + "processing_time": 854, + "object": "async_action" } - } - } - } - }, - "get": { - "operationId": "list-exports", - "tags": [ - "EXPORTS API" - ], - "summary": "List Exports", - "description": "List all exports. ", - "parameters": [ - { - "$ref": "#/components/parameters/limit" - }, - { - "$ref": "#/components/parameters/page" - }, - { - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "status", - "-status" - ] }, - "in": "query", - "name": "order", - "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "A dictionary with an exports property that contains an array of exports. Each entry in the array is a separate export object. The list will return the following types of exported objects: `voucher`, `redemption`, `publication`, `customer`, `order`, `points_expiration`, or `voucher_transactions`. \n\nThe `channel` parameter in the response body returns the channel that was used to generate the particular export. The `user_id` identifies the specific user who initiated the export through the Voucherify Dashboard; this `user_id` is returned when the channel value is `WEBSITE`.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/16_res_list_exports" - }, - "examples": { - "List Exports": { - "value": { - "object": "list", - "data_ref": "exports", - "exports": [ - { - "id": "exp_323UOPsH42twhJVaDZXf4UNo", - "object": "export", - "created_at": "2022-08-04T09:11:25.208Z", - "status": "DONE", - "channel": "API", - "exported_object": "order", - "parameters": { - "order": "-created_at", - "fields": [ - "id", - "source_id", - "status" - ], - "filters": { - "junction": "and" - } - }, - "result": { - "url": "https://download.voucherify.io/v1/exports/exp_323UOPsH42twhJVaDZXf4UNo?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnQiOiJzYW11ZWwuamFuaWtAdm91Y2hlcmlmeS5pbyIsImV4cG9ydElkIjoiZXhwXzMyM1VPUHNINDJ0d2hKVmFEWlhmNFVObyIsImlhdCI6MTY1OTYwNDI4NiwiZXhwIjoxNjU5NjA1MTg2fQ.IgFnKagyoQ7_O2tGswZxpegUMtllSbzMfPMX-_89W7o" - }, - "user_id": null - }, - { - "id": "exp_sPQR0na2gU0pIVUKIz4wdQI9", - "object": "export", - "created_at": "2022-05-02T06:44:03.186Z", - "status": "DONE", - "channel": "API", - "exported_object": "voucher", - "parameters": { - "order": "-created_at", - "fields": [ - "id", - "code", - "voucher_type", - "value" - ], - "filters": { - "junction": "and" - } - }, - "result": { - "url": "https://download.voucherify.io/v1/exports/exp_sPQR0na2gU0pIVUKIz4wdQI9?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnQiOiJzYW11ZWwuamFuaWtAdm91Y2hlcmlmeS5pbyIsImV4cG9ydElkIjoiZXhwX3NQUVIwbmEyZ1UwcElWVUtJejR3ZFFJOSIsImlhdCI6MTY1MTQ3Mzg0NCwiZXhwIjoxNjUxNDc0NzQ0fQ.yNIQHcHMO-HSKYejtgNjRVh3cRa_JqnmhBXdnAX2vHQ" - }, - "user_id": null - }, - { - "id": "exp_CGnCVltmWjI9V1pGlnunw2Nf", - "object": "export", - "created_at": "2022-01-13T09:03:18.293Z", - "status": "DONE", - "channel": "API", - "exported_object": "customer", - "parameters": { - "order": "", - "fields": [ - "name", - "id", - "email", - "source_id", - "created_at" - ], - "filters": { - "junction": "and" - }, - "response_format": "CSV" - }, - "result": { - "url": "https://download.voucherify.io/v1/exports/exp_CGnCVltmWjI9V1pGlnunw2Nf?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ" - }, - "user_id": null - } - ], - "total": 3 + "PRODUCTS.METADATA_KEY_PURGE": { + "value": { + "id": "aa_0c5552d997ca0ec03a", + "type": "PRODUCTS.METADATA_KEY_PURGE", + "status": "DONE", + "result": { + "message": "Updated 2 products.", + "done_count": 2 + }, + "created_at": "2023-01-20T08:46:42.271Z", + "updated_at": "2023-01-20T08:46:43.240Z", + "request_id": "w-0c5552d98e8a0ec039", + "progress": 100, + "processing_time": 969, + "object": "async_action" + } + }, + "VOUCHERS.IMPORT": { + "value": { + "id": "aa_0c5559be44d7b63c06", + "type": "VOUCHERS.IMPORT", + "status": "DONE", + "result": { + "message": "0 voucher(s) imported successfully, 3 failed.", + "failed": [ + { + "code": "PROMO-CODE31", + "reason": "unit: must be a number, must be equal to one of 1,2 (actual value is 'EUR')" + }, + { + "code": "PROMO-CODE21", + "reason": "unit: must be a number, must be equal to one of 1,2 (actual value is 'EUR')" + }, + { + "code": "GIFT-CARD-100-1", + "reason": "unit: must be a number, must be equal to one of 1,2 (actual value is 'EUR')" } - } - } + ], + "done_count": 0, + "failed_count": 3 + }, + "created_at": "2023-01-20T09:16:49.299Z", + "updated_at": "2023-01-20T09:16:50.238Z", + "request_id": "v-0c5559be25c418824a", + "progress": 100, + "processing_time": 939, + "object": "async_action" + } + }, + "VOUCHERS.IMPORT_CSV": { + "value": { + "id": "aa_0c555db3d697b643e1", + "type": "VOUCHERS.IMPORT_CSV", + "status": "DONE", + "result": { + "message": "0 voucher(s) imported successfully, 2 failed.", + "failed": [ + { + "code": "FALL2023", + "row": 1, + "reason": "Voucher Type is required" + }, + { + "code": "FALL2024", + "row": 2, + "reason": "Voucher Type is required" + } + ], + "done_count": 0, + "failed_count": 2 + }, + "created_at": "2023-01-20T09:34:07.194Z", + "updated_at": "2023-01-20T09:34:07.367Z", + "request_id": "v-0c555db3ba8b0f0767", + "progress": 100, + "processing_time": 173, + "object": "async_action" + } + }, + "VOUCHERS.BULK_UPDATE": { + "value": { + "id": "aa_0c555e8115d7b64504", + "type": "VOUCHERS.BULK_UPDATE", + "status": "DONE", + "result": { + "results": [ + { + "code": "PROMO-CODE81019", + "updated": false, + "found": false + }, + { + "code": "PROMO-CODE7264786", + "updated": false, + "found": false + } + ], + "done_count": 2 + }, + "created_at": "2023-01-20T09:37:37.367Z", + "updated_at": "2023-01-20T09:37:37.520Z", + "request_id": "v-0c555e810904188aa4", + "progress": 100, + "processing_time": 153, + "object": "async_action" + } + }, + "VOUCHERS.METADATA_UPDATE": { + "value": { + "id": "aa_0c555ed40857b6463a", + "type": "VOUCHERS.METADATA_UPDATE", + "status": "DONE", + "result": { + "results": [ + { + "code": "v_TzD19aeNiqGc9LWciMWknyEZT8IW7u4u", + "updated": false, + "found": false + }, + { + "code": "LOYALTY-CARD-xLPbpbXR", + "updated": false, + "found": false + } + ], + "done_count": 2 + }, + "created_at": "2023-01-20T09:39:02.305Z", + "updated_at": "2023-01-20T09:39:02.640Z", + "request_id": "v-0c555ed40084188b55", + "progress": 100, + "processing_time": 335, + "object": "async_action" + } + }, + "VOUCHERS.METADATA_KEY_PURGE": { + "value": { + "id": "aa_0c55534bd64a0ec0e0", + "type": "VOUCHERS.METADATA_KEY_PURGE", + "status": "DONE", + "result": { + "message": "Updated 9 vouchers.", + "done_count": 9 + }, + "created_at": "2023-01-20T08:48:39.257Z", + "updated_at": "2023-01-20T08:48:40.503Z", + "request_id": "w-0c55534bcfca0ec0df", + "progress": 100, + "processing_time": 1246, + "object": "async_action" + } + }, + "SKUS.IMPORT_CSV": { + "value": { + "id": "aa_0c5558728d0e577e67", + "type": "SKUS.IMPORT_CSV", + "status": "DONE", + "result": { + "message": "4 sku(s) imported successfully, 0 failed.", + "failed": [], + "done_count": 4, + "failed_count": 0 + }, + "created_at": "2023-01-20T09:11:09.620Z", + "updated_at": "2023-01-20T09:11:10.270Z", + "request_id": "v-0c5558726f0b0f7d82", + "progress": 100, + "processing_time": 650, + "object": "async_action" + } + }, + "PRODUCTS.IMPORT_CSV": { + "value": { + "id": "aa_0c55578e914e577cf1", + "type": "PRODUCTS.IMPORT_CSV", + "status": "DONE", + "result": { + "message": "1 product(s) imported successfully, 1 failed.", + "failed": [ + { + "row": 1, + "reason": "vendor: must be a string, property is required, must be equal to one of Vendor 1,Vendor 2 (actual value is 'Vendor 3')" + } + ], + "done_count": 1, + "failed_count": 1 + }, + "created_at": "2023-01-20T09:07:16.165Z", + "updated_at": "2023-01-20T09:07:17.025Z", + "request_id": "v-0c55578e7a0418fef5", + "progress": 100, + "processing_time": 860, + "object": "async_action" + } + }, + "ORDERS.METADATA_KEY_PURGE": { + "value": { + "id": "aa_0c555fda50472c83a8", + "type": "ORDERS.METADATA_KEY_PURGE", + "status": "DONE", + "result": { + "message": "Updated 1 orders.", + "done_count": 1 + }, + "created_at": "2023-01-20T09:43:30.881Z", + "updated_at": "2023-01-20T09:43:31.217Z", + "request_id": "w-0c555fda45c72c83a7", + "progress": 100, + "processing_time": 336, + "object": "async_action" + } + }, + "ORDERS.IMPORT": { + "value": { + "id": "aa_0c5564b67d0e571534", + "type": "ORDERS.IMPORT", + "status": "DONE", + "result": { + "message": "1 order(s) imported successfully, 1 failed.", + "failed": [ + { + "source_id": null, + "reason": "Internal error" + } + ], + "done_count": 1, + "failed_count": 1 + }, + "created_at": "2023-01-20T10:04:44.916Z", + "updated_at": "2023-01-20T10:04:46.102Z", + "request_id": "v-0c5564b6688b0f155d", + "progress": 100, + "processing_time": 1186, + "object": "async_action" } } } } } }, - "/v1/exports/{exportId}": { - "parameters": [ - { + "404": { + "description": "Returns an error indicating that the async action with given ID was not found.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "exp_2bYLdY2lQ2886wmYIHyeBWUZ" + "$ref": "#/components/schemas/e_404_not_found" }, - "name": "exportId", - "in": "path", - "required": true, - "description": "Unique export object ID of previously created export. This object can be a: `voucher`, `redemption`, `publication`, `customer`, `order`, `points_expiration`, or `voucher_transactions`." + "examples": { + "Async-Action-Not-Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find async_action with id aa_0aeb82bd55d5beffb", + "request_id": "v-0aeb88df54c82af560", + "resource_id": "aa_0aeb82bd55d5beffb", + "resource_type": "async_action" + } + } + } } - ], - "get": { - "operationId": "get-export", - "tags": [ - "EXPORTS API" - ], - "summary": "Get Export", - "description": "Retrieves the URL of the downloadable file, which was generated via the [Create Export](ref:create-export) method.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + } + } + } + } + }, + "/v1/export-object": { + "get": { + "operationId": "export-object", + "tags": [ + "EXPORTS API" + ], + "summary": "Export Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Export Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/16_obj_export_object" } - ], - "responses": { - "200": { - "description": "Returns the export object if a valid identifier was provided in the path.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/16_obj_export_object" - }, - "examples": { - "Get Export": { - "value": { - "id": "exp_CGnCVltmWjI9V1pGlnunw2Nf", - "object": "export", - "created_at": "2022-01-13T09:03:18.293Z", - "status": "DONE", - "channel": "API", - "exported_object": "customer", - "parameters": { - "order": "", - "fields": [ - "name", - "id", - "email", - "source_id", - "created_at" - ], - "filters": { - "junction": "and" - }, - "response_format": "CSV" - }, - "result": { - "url": "https://download.voucherify.io/v1/exports/exp_CGnCVltmWjI9V1pGlnunw2Nf?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ" - }, - "user_id": null - } - } - } + } + } + } + } + } + }, + "/v1/exports": { + "post": { + "operationId": "create-export", + "tags": [ + "EXPORTS API" + ], + "summary": "Create Export", + "description": "Create export object. The export can be any of the following types: `voucher`, `redemption`, `publication`, `customer`, `order`, `points_expiration`, or `voucher_transactions`. \n\n## Defaults\n\nIf you only specify the object type in the request body without specifying the fields, the API will return the following fields per export object:\n\n| **Export Object** | **Default fields returned** |\n|:---|:---|\n| order | `id`, `source_id`, `status` |\n| voucher | `code`, `voucher_type`, `value`, `discount_type` |\n| publication | `code`, `customer_id`, `date`, `channel` |\n| redemption | `id`, `object`, `voucher_code`, `customer_id`, `date`, `result` |\n| customer | `name`, `source_id` |\n| points_expiration | `id`, `campaign_id`, `voucher_id`, `status`, `expires_at`, `points` |\n| voucher_transactions | `id`, `type`, `source_id`, `status`, `reason`, `source`, `balance`, `amount`, `created_at` |\n\n\n## Fetching particular data sets\n\nUsing the `parameters` body parameter, you can narrow down which fields to export and how to filter the results. The fields are an array of strings containing the data that you would like to export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:\n\n## Orders \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique order ID. | ord_A69RIxEdRsPuC6i8gFGVHUft |\n| source_id | Unique order source ID. | 8638 |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the order was created. | 2022-03-09T09:16:32.521Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the order was last updated. | 2022-03-09T09:16:33.331Z |\n| status | Order status. | `PAID`, `CREATED`, `FULFILLED`, `CANCELED` |\n| amount | Total amount of order items. | 7700 |\n| discount_amount | Represents total amount of the discount applied to whole cart. | 500 |\n| items_discount_amount | Represents total amount of the discount applied to order line items. | 100 |\n| total_discount_amount | All discounts applied to the order including discounts applied to particular order line items and discounts applied to the whole cart. | 600 |\n| total_amount | Total order amount after applying all discounts. | 7100 |\n| customer_id | Customer unique ID. | cust_2G4fUQdCXUqp35nXNleav7bO |\n| referrer_id | Referrer unique ID. | cust_IkrTR674vvQvr9a4rDMiqglY |\n| metadata | Order metadata; expressed as metadata.X, where X is the name of the custom metadata property. | 1 |\n\n## Vouchers \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique voucher ID. | v_HSnGD2vNIHYighTQxwcB4dtVAv8VOmZD |\n| code | Unique voucher code. | WELCOME100 |\n| voucher_type | Type of voucher. | `DISCOUNT_VOUCHER`, `GIFT_VOUCHER`, `LOYALTY_CARD` |\n| value | Value of voucher. | `DISCOUNT_VOUCHER` : amount, percent, unit
                                  `GIFT_VOUCHER`: amount left to spend
                                  `LOYALTY_CARD`: available usable points |\n| discount_type | The type of discount for a `DISCOUNT_VOUCHER`. | `AMOUNT`, `PERCENT`, `UNIT`, `FIXED` |\n| campaign | Unique campaign name. | Summer Discounts 20% off |\n| category | Tag defining the category that this voucher belongs to. | |\n| start_date | Start date defines when the code starts to be active. Activation timestamp in ISO 8601 format. Voucher is _inactive_ before this date. | 2020-12-10T23:00:00.000Z |\n| expiration_date | Expiration date defines when the code expires. Expiration timestamp in ISO 8601 format. Voucher is _inactive_ after this date. | 2023-12-31T23:00:00.000Z |\n| gift_balance | Amount left to spend. | 1000 |\n| loyalty_balance | Available usable points. | 2000 |\n| redemption_quantity | Maximum number of times a voucher can be redeemed. | 2 |\n| redemption_count | Total redemptions. | 59 |\n| active | Boolean indicating whether the voucher is available for use. | `true`, `false` |\n| qr_code | URL to QR representation of encrypted code. | |\n| bar_code | URL to barcode representation of encrypted code. | |\n| metadata | Custom voucher metadata. | |\n| is_referral_code | Boolean indicating whether the voucher is a referral code. | `true`, `false` |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the voucher was created. | 2022-04-14T09:55:46.814Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the voucher was last updated. | 2022-04-14T10:02:18.036Z |\n| validity_timeframe_interval | Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an interval of `P2D` will be active every other day. | P2D |\n| validity_timeframe_duration | Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a duration of `PT1H` will be valid for a duration of one hour. | PT1H |\n| validity_day_of_week | Array corresponding to the particular days of the week in which the voucher is valid. | \"1,2,3,4,5\" |\n| discount_amount_limit | For `PERCENT` discount type, this is the maximum threshold allowed to be deducted. | 50 |\n| campaign_id | Parent campaign ID. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| additional_info | An optional field to keep any extra textual information about the code such as a code description and details. | |\n| customer_id | Unique customer ID of the assigned owner to whom the voucher was published. | cust_7iUa6ICKyU6gH40dBU25kQU1 |\n| discount_unit_type | For `UNIT` discount type, either a shipping or product ID for a `UNIT` discount with one product. | prod_5h1pp1ng, prod_0a9f9aeddb019a42db |\n| discount_unit_effect | `UNIT` discount effect. | `ADD_MANY_ITEMS`, `ADD_MISSING_ITEMS`,`ADD_NEW_ITEMS` |\n| customer_source_id | Unique customer source id of the assigned owner to whom the voucher was published. | name.lastname@email.com |\n\n\n## Publications\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| voucher_code | Unique voucher code. | WELCOME100 |\n| customer_id | Customer unique ID. | cust_7iUa6ICKyU6gH40dBU25kQU1 |\n| customer_source_id | Unique customer source id of the assigned owner to whom the voucher was published. | name.lastname@email.com |\n| date | Timestamp in ISO 8601 format representing the date and time when the voucher was published. | 2022-04-28T10:19:30.792Z |\n| channel | Publication channel. | voucherify-website |\n| campaign | Unique campaign name. | Summer Discounts 20% off |\n| is_winner | | |\n| metadata | Custom publication metadata. | |\n\n## Redemptions\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique redemption ID. | r_0acf3a6dae00e679c8, rf_0acf3a495740e679b8 |\n| object | Object being exported; by default `redemption`. | redemption |\n| date | Timestamp in ISO 8601 format representing the date and time when the voucher was redeemed. | 2022-03-23T08:52:24.867Z |\n| voucher_code | Unique voucher code redeemed. | WELCOME100 |\n| campaign | Parent campaign name of voucher if applicable. | Summer Discounts 20% off |\n| promotion_tier_id | | promo_Mwy9XpA0TLctSGriM5kum0qp |\n| customer_id | Unique customer ID of redeeming customer. | cust_nk0N1uNQ1YnupAoJGOgvsODC |\n| customer_source_id | Unique source ID of redeeming customer. | name.lastname@email.com |\n| customer_name | Customer name. | John Smith |\n| tracking_id | | track_Pw6r3ejnml43kIwNS4Zj09KZ67xOfLUy |\n| order_amount | Total order amount before applying all discounts. | 1000 |\n| gift_amount | Gift credits used for redemption. | 10 |\n| loyalty_points | | 12 |\n| result | Tells you whether the redemption succeeded. | `SUCCESS`, `FAILURE` |\n| failure_code | Internal Voucherify code for reason why redemption failed. | invalid_customer |\n| failure_message | A human-readable message providing a short description explaining why the redemption failed. | Customer must be a holder of a loyalty card. |\n| metadata | Custom redemption metadata. | |\n\n## Customers\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| name | Customer name. | John Smith |\n| id | Unique customer ID. | cust_J1CDUdbqn5Exva8ASWk1Fq0j |\n| description | An arbitrary string that you can attach to a customer object. | Customer requesting to be added to VIP tier. |\n| email | Customer's email. | name.lastname@email.com |\n| source_id | Unique custom customer identifier. | name.lastname@email.com |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the customer was created. | 2022-02-03T13:10:11.928Z |\n| address_city | City | Houston |\n| address_state | State | TX |\n| address_line_1 | First line of customer's address. | 72738 Main St |\n| address_line_2 | Second line of customer's address. | Bld 2, Apt 4 |\n| address_country | Country | United States of America |\n| address_postal_code | Postal code (ZIP code) | 77042-4143 |\n| redemptions_total_redeemed | Total customer redemptions. | 5 |\n| redemptions_total_failed | Total customer failed redemptions. | 2 |\n| redemptions_total_succeeded | Total customer succeeded redemptions. | 3 |\n| redemptions_total_rolled_back | Total customer redemptions that were rolled back. | 3 |\n| redemptions_total_rollback_failed | Total customer redemptions that were unsuccessfully rolled back. | 2 |\n| redemptions_total_rollback_succeeded | Total customer redemptions that were successfully rolled back. | 1 |\n| orders_total_amount | Total sum of order amounts over customer lifetime. Value is multiplied by 100 to precisely represent 2 decimal places. | 10000 (represents $100) |\n| orders_total_count | Total number of customer orders. | 2 |\n| orders_average_amount | Average amount spent on orders. Value is multiplied by 100 to precisely represent 2 decimal places. | 5000 (represents $50) |\n| orders_last_order_amount | How much did the customer spend on their last order. Value is multiplied by 100 to precisely represent 2 decimal places. | 5000 (represents $50) |\n| orders_last_order_date | When was the last customer order; timestamp in ISO 8601 format representing the date and time. | 2022-02-03T13:17:30.630Z |\n| loyalty_points | Sum of customer's loyalty points to go across all loyalty cards. | 2000 |\n| loyalty_referred_customers | How many customers were referred by this customer. | 3 |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the customer was updated. | 2022-02-14T14:10:14.305Z |\n| phone | Customer's phone number. | +1 (294) 752-1846 |\n| birthday | Customer's birthday. | 2022-01-01 |\n| metadata | Customer metadata. | All metadata fields defined in Metadata Schema for the Customer object. |\n| birthdate | Customer's birthdate. | 2022-01-01 |\n\n## Points Expirations\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n |\n| campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 |\n| status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` |\n| expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 |\n| points | Number of points. | 1000 |\n\n ## Gift Card Transactions\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
                                  - `CREDITS_ADDITION`
                                  - `CREDITS_REFUND`
                                  - `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n\n ## Loyalty Card Transactions\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID assigned by Voucherify. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `POINTS_EXPIRATION`
                                  - `POINTS_ADDITION`
                                  - `POINTS_REMOVAL`
                                  - `POINTS_TRANSFER_OUT`
                                  - `POINTS_ACCRUAL`
                                  - `POINTS_REFUND`
                                  - `POINTS_REDEMPTION` |\n| source_id | Custom source ID of the transaction if one was included originally. | source_id_custom |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The loyalty card balance after the transaction. | |\n| amount | The amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | - `API`
                                  - `voucherify-web-ui`
                                  - `Automation` |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n| related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the details of the export that you would like to create.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/16_req_create_export_POST" + } + } + } + }, + "responses": { + "200": { + "description": "Returns export object and URL of CSV file.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/16_obj_export_object" + } + } + } + }, + "400": { + "description": "Returns an error if an invalid payload is provided.", + "content": { + "application/json": { + "schema": { + "anyOf": [ + { + "$ref": "#/components/schemas/e_400_invalid_payload" + }, + { + "$ref": "#/components/schemas/e_400_invalid_export_fields" } - } + ] }, - "404": { - "description": "Returns an error indicating that the export with given ID was not found if an incorrect ID is provided in the path.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find export with id exp_8fNoLwgVPuhoxNzVsr50kq0", - "request_id": "v-0b029305af4524cf42", - "resource_id": "exp_8fNoLwgVPuhoxNzVsr50kq0", - "resource_type": "export" - } - } - } + "examples": { + "Invalid Export Fields": { + "value": { + "code": 400, + "key": "invalid_export_fields", + "message": "Invalid Export", + "details": "Unsupported field used. Allowed fields: id, object, date, voucher_code, campaign, promotion_tier_id, customer_id, customer_source_id, customer_name, tracking_id, order_amount, gift_amount, loyalty_points, result, failure_code, failure_message, metadata", + "request_id": "v-0afdb603910a1a14e0" + } + }, + "Invalid Payload": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Property .exported_object should be equal to one of the allowed values [ voucher, redemption, customer, publication, order, points_expiration ]", + "request_id": "v-0afdb5bd68d20bdb81" } } } } + } + } + } + }, + "get": { + "operationId": "list-exports", + "tags": [ + "EXPORTS API" + ], + "summary": "List Exports", + "description": "List all exports. ", + "parameters": [ + { + "$ref": "#/components/parameters/limit" + }, + { + "$ref": "#/components/parameters/page" + }, + { + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "status", + "-status" + ] }, - "delete": { - "operationId": "delete-export", - "tags": [ - "EXPORTS API" - ], - "summary": "Delete Export", - "description": "This method deletes a previously created export object.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "Returns no content if deletion is successful." - }, - "404": { - "description": "Returns an error indicating that the export with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Export Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find export with id exp_2bYLdY2lQ2886wmYIHyeBWUZ", - "request_id": "v-0ae2a97a399027d719", - "resource_id": "exp_2bYLdY2lQ2886wmYIHyeBWUZ", - "resource_type": "export" - } + "in": "query", + "name": "order", + "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "A dictionary with an exports property that contains an array of exports. Each entry in the array is a separate export object. The list will return the following types of exported objects: `voucher`, `redemption`, `publication`, `customer`, `order`, `points_expiration`, or `voucher_transactions`. \n\nThe `channel` parameter in the response body returns the channel that was used to generate the particular export. The `user_id` identifies the specific user who initiated the export through the Voucherify Dashboard; this `user_id` is returned when the channel value is `WEBSITE`.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/16_res_list_exports" + }, + "examples": { + "List Exports": { + "value": { + "object": "list", + "data_ref": "exports", + "exports": [ + { + "id": "exp_323UOPsH42twhJVaDZXf4UNo", + "object": "export", + "created_at": "2022-08-04T09:11:25.208Z", + "status": "DONE", + "channel": "API", + "exported_object": "order", + "parameters": { + "order": "-created_at", + "fields": [ + "id", + "source_id", + "status" + ], + "filters": { + "junction": "and" + } + }, + "result": { + "url": "https://download.voucherify.io/v1/exports/exp_323UOPsH42twhJVaDZXf4UNo?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnQiOiJzYW11ZWwuamFuaWtAdm91Y2hlcmlmeS5pbyIsImV4cG9ydElkIjoiZXhwXzMyM1VPUHNINDJ0d2hKVmFEWlhmNFVObyIsImlhdCI6MTY1OTYwNDI4NiwiZXhwIjoxNjU5NjA1MTg2fQ.IgFnKagyoQ7_O2tGswZxpegUMtllSbzMfPMX-_89W7o" + }, + "user_id": null + }, + { + "id": "exp_sPQR0na2gU0pIVUKIz4wdQI9", + "object": "export", + "created_at": "2022-05-02T06:44:03.186Z", + "status": "DONE", + "channel": "API", + "exported_object": "voucher", + "parameters": { + "order": "-created_at", + "fields": [ + "id", + "code", + "voucher_type", + "value" + ], + "filters": { + "junction": "and" + } + }, + "result": { + "url": "https://download.voucherify.io/v1/exports/exp_sPQR0na2gU0pIVUKIz4wdQI9?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnQiOiJzYW11ZWwuamFuaWtAdm91Y2hlcmlmeS5pbyIsImV4cG9ydElkIjoiZXhwX3NQUVIwbmEyZ1UwcElWVUtJejR3ZFFJOSIsImlhdCI6MTY1MTQ3Mzg0NCwiZXhwIjoxNjUxNDc0NzQ0fQ.yNIQHcHMO-HSKYejtgNjRVh3cRa_JqnmhBXdnAX2vHQ" + }, + "user_id": null + }, + { + "id": "exp_CGnCVltmWjI9V1pGlnunw2Nf", + "object": "export", + "created_at": "2022-01-13T09:03:18.293Z", + "status": "DONE", + "channel": "API", + "exported_object": "customer", + "parameters": { + "order": "", + "fields": [ + "name", + "id", + "email", + "source_id", + "created_at" + ], + "filters": { + "junction": "and" + }, + "response_format": "CSV" + }, + "result": { + "url": "https://download.voucherify.io/v1/exports/exp_CGnCVltmWjI9V1pGlnunw2Nf?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ" + }, + "user_id": null } - } + ], + "total": 3 } } } } } + } + } + } + }, + "/v1/exports/{exportId}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "exp_2bYLdY2lQ2886wmYIHyeBWUZ" }, - "/v1/exports/{export_Id}": { - "parameters": [ - { + "name": "exportId", + "in": "path", + "required": true, + "description": "Unique export object ID of previously created export. This object can be a: `voucher`, `redemption`, `publication`, `customer`, `order`, `points_expiration`, or `voucher_transactions`." + } + ], + "get": { + "operationId": "get-export", + "tags": [ + "EXPORTS API" + ], + "summary": "Get Export", + "description": "Retrieves the URL of the downloadable file, which was generated via the [Create Export](ref:create-export) method.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns the export object if a valid identifier was provided in the path.", + "content": { + "application/json": { "schema": { - "type": "string", - "example": "exp_ex6zq0x0EEa9S0N68QcqhxcQ" - }, - "name": "export_Id", - "in": "path", - "required": true, - "description": "Unique export object ID." - } - ], - "get": { - "operationId": "download-export", - "tags": [ - "EXPORTS API" - ], - "summary": "Download Export", - "description": "Download the contents of the exported CSV file. \n\n\n\n> 📘 Important notes\n>\n> **Base URL:** \n> - `https://download.voucherify.io` (Europe) \n> - `https://us1.download.voucherify.io` (US) \n> - `https://as1.download.voucherify.io` (Asia) \n>\n> **Token:** Can be found within the `result` parameter of the [Get Export](ref:get-export) method response.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [], - "Download-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns contents of CSV file.", - "content": { - "text/plain": { - "schema": { - "type": "string" + "$ref": "#/components/schemas/16_obj_export_object" + }, + "examples": { + "Get Export": { + "value": { + "id": "exp_CGnCVltmWjI9V1pGlnunw2Nf", + "object": "export", + "created_at": "2022-01-13T09:03:18.293Z", + "status": "DONE", + "channel": "API", + "exported_object": "customer", + "parameters": { + "order": "", + "fields": [ + "name", + "id", + "email", + "source_id", + "created_at" + ], + "filters": { + "junction": "and" + }, + "response_format": "CSV" }, - "examples": { - "CSV file contents": { - "value": "ID,Code,Voucher Type,Value v_mKNYXWf5168jyW3EvwnAf73d7vnTiXaa,iuCvt3BT,GIFT_VOUCHER,2000.00 v_xb5KuIw90ViUY7NrNbDZzf1JwFmyTUi0,M3X8IwW8,GIFT_VOUCHER,2000.00 v_flCSHFGOfjxuM582jhriJTWQuetb2xHX,6vpzmKaC,GIFT_VOUCHER,2050.00 v_YtzZG4UJaWm9DNCY3AvIqVbc7Dt5WToU,lRvBOUPl,LOYALTY_CARD,0" - } - } + "result": { + "url": "https://download.voucherify.io/v1/exports/exp_CGnCVltmWjI9V1pGlnunw2Nf?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ" + }, + "user_id": null } } + } + } + } + }, + "404": { + "description": "Returns an error indicating that the export with given ID was not found if an incorrect ID is provided in the path.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" }, - "401": { - "description": "Returns an error if an invalid token was provided.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "code": { - "type": "string", - "default": 401, - "description": "Error's HTTP status code." - }, - "message": { - "type": "string", - "default": "Unauthorized", - "description": "A human-readable message providing a short description about the error." - }, - "key": { - "type": "string", - "default": "unauthorized", - "description": "Short string describing the kind of error which occurred." - } - } - }, - "examples": { - "Unauthorized": { - "value": { - "code": 401, - "message": "Unauthorized", - "key": "unauthorized" - } - } - } + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find export with id exp_8fNoLwgVPuhoxNzVsr50kq0", + "request_id": "v-0b029305af4524cf42", + "resource_id": "exp_8fNoLwgVPuhoxNzVsr50kq0", + "resource_type": "export" } } } } } + } + } + }, + "delete": { + "operationId": "delete-export", + "tags": [ + "EXPORTS API" + ], + "summary": "Delete Export", + "description": "This method deletes a previously created export object.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "Returns no content if deletion is successful." }, - "/v1/category-object": { - "get": { - "operationId": "category-object", - "tags": [ - "CATEGORIES API" - ], - "summary": "Category Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Category Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/20_obj_category_object" - } + "404": { + "description": "Returns an error indicating that the export with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Export Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find export with id exp_2bYLdY2lQ2886wmYIHyeBWUZ", + "request_id": "v-0ae2a97a399027d719", + "resource_id": "exp_2bYLdY2lQ2886wmYIHyeBWUZ", + "resource_type": "export" } } } } } + } + } + } + }, + "/v1/exports/{export_Id}": { + "parameters": [ + { + "schema": { + "type": "string", + "example": "exp_ex6zq0x0EEa9S0N68QcqhxcQ" }, - "/v1/categories": { - "get": { - "operationId": "list-categories", - "tags": [ - "CATEGORIES API" - ], - "summary": "List Categories", - "description": "List all categories.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + "name": "export_Id", + "in": "path", + "required": true, + "description": "Unique export object ID." + } + ], + "get": { + "operationId": "download-export", + "tags": [ + "EXPORTS API" + ], + "summary": "Download Export", + "description": "Download the contents of the exported CSV file. \n\n\n\n> 📘 Important notes\n>\n> **Base URL:** \n> - `https://download.voucherify.io` (Europe) \n> - `https://us1.download.voucherify.io` (US) \n> - `https://as1.download.voucherify.io` (Asia) \n>\n> **Token:** Can be found within the `result` parameter of the [Get Export](ref:get-export) method response.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [], + "Download-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns contents of CSV file.", + "content": { + "text/plain": { + "schema": { + "type": "string" + }, + "examples": { + "CSV file contents": { + "value": "ID,Code,Voucher Type,Value v_mKNYXWf5168jyW3EvwnAf73d7vnTiXaa,iuCvt3BT,GIFT_VOUCHER,2000.00 v_xb5KuIw90ViUY7NrNbDZzf1JwFmyTUi0,M3X8IwW8,GIFT_VOUCHER,2000.00 v_flCSHFGOfjxuM582jhriJTWQuetb2xHX,6vpzmKaC,GIFT_VOUCHER,2050.00 v_YtzZG4UJaWm9DNCY3AvIqVbc7Dt5WToU,lRvBOUPl,LOYALTY_CARD,0" + } } - ], - "responses": { - "200": { - "description": "Returns a dictionary of category objects.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/20_res_list_categories" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "cat_0b5f49fb31c3bf6ab0", - "name": "Sixth", - "hierarchy": 6, - "created_at": "2022-07-13T06:21:36.852Z", - "object": "category" - }, - { - "id": "cat_0b5f49e6e1ce5bd2ba", - "name": "Fifth", - "hierarchy": 5, - "created_at": "2022-07-13T06:21:16.039Z", - "object": "category" - }, - { - "id": "cat_0b5f49deafce5bd2b5", - "name": "Fourth", - "hierarchy": 4, - "created_at": "2022-07-13T06:21:07.662Z", - "object": "category" - }, - { - "id": "cat_0b5f49d45c43bf6a99", - "name": "Third", - "hierarchy": 3, - "created_at": "2022-07-13T06:20:57.094Z", - "object": "category" - }, - { - "id": "cat_0b5f3f9881ce5bccb6", - "name": "Second", - "hierarchy": 2, - "created_at": "2022-07-13T05:36:14.355Z", - "object": "category" - }, - { - "id": "cat_0b53bc388dc2f108ba", - "name": "First", - "hierarchy": 1, - "created_at": "2022-07-04T06:58:57.734Z", - "object": "category" - } - ], - "total": 6 - } - } - } + } + } + }, + "401": { + "description": "Returns an error if an invalid token was provided.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "code": { + "type": "string", + "default": 401, + "description": "Error's HTTP status code." + }, + "message": { + "type": "string", + "default": "Unauthorized", + "description": "A human-readable message providing a short description about the error." + }, + "key": { + "type": "string", + "default": "unauthorized", + "description": "Short string describing the kind of error which occurred." + } + } + }, + "examples": { + "Unauthorized": { + "value": { + "code": 401, + "message": "Unauthorized", + "key": "unauthorized" } } } } - }, - "post": { - "operationId": "create-category", - "tags": [ - "CATEGORIES API" - ], - "summary": "Create Category", - "description": "Create category with a specific name and hierarchy.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + } + } + } + } + }, + "/v1/category-object": { + "get": { + "operationId": "category-object", + "tags": [ + "CATEGORIES API" + ], + "summary": "Category Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Category Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/20_obj_category_object" } - ], - "requestBody": { - "description": "Specify the details of the category that you would like to create.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/20_req_create_category" - }, - "examples": { - "Example": { - "value": { - "name": "Eighth", - "hierarchy": 8 + } + } + } + } + } + }, + "/v1/categories": { + "get": { + "operationId": "list-categories", + "tags": [ + "CATEGORIES API" + ], + "summary": "List Categories", + "description": "List all categories.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary of category objects.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/20_res_list_categories" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "cat_0b5f49fb31c3bf6ab0", + "name": "Sixth", + "hierarchy": 6, + "created_at": "2022-07-13T06:21:36.852Z", + "object": "category" + }, + { + "id": "cat_0b5f49e6e1ce5bd2ba", + "name": "Fifth", + "hierarchy": 5, + "created_at": "2022-07-13T06:21:16.039Z", + "object": "category" + }, + { + "id": "cat_0b5f49deafce5bd2b5", + "name": "Fourth", + "hierarchy": 4, + "created_at": "2022-07-13T06:21:07.662Z", + "object": "category" + }, + { + "id": "cat_0b5f49d45c43bf6a99", + "name": "Third", + "hierarchy": 3, + "created_at": "2022-07-13T06:20:57.094Z", + "object": "category" + }, + { + "id": "cat_0b5f3f9881ce5bccb6", + "name": "Second", + "hierarchy": 2, + "created_at": "2022-07-13T05:36:14.355Z", + "object": "category" + }, + { + "id": "cat_0b53bc388dc2f108ba", + "name": "First", + "hierarchy": 1, + "created_at": "2022-07-04T06:58:57.734Z", + "object": "category" } - } + ], + "total": 6 } } } + } + } + } + } + }, + "post": { + "operationId": "create-category", + "tags": [ + "CATEGORIES API" + ], + "summary": "Create Category", + "description": "Create category with a specific name and hierarchy.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the details of the category that you would like to create.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/20_req_create_category" }, - "responses": { - "200": { - "description": "Returns a newly created category object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/20_res_create_category" - }, - "examples": { - "Example": { - "value": { - "id": "cat_0b8b5a427a0283c854", - "name": "Eighth", - "hierarchy": 8, - "created_at": "2022-08-16T11:45:54.171Z", - "object": "category" - } - } - } - } + "examples": { + "Example": { + "value": { + "name": "Eighth", + "hierarchy": 8 } - }, - "400": { - "description": "Returns an error if the payload is incomplete.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_400_invalid_payload" - }, - "examples": { - "Missing name": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Payload should have required property 'name'", - "request_id": "v-0b8b5b960990210b25" - } - }, - "Missing hierarchy": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Payload should have required property 'hierarchy'", - "request_id": "v-0b8b5bf9d9c6824a2f" - } - } - } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a newly created category object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/20_res_create_category" + }, + "examples": { + "Example": { + "value": { + "id": "cat_0b8b5a427a0283c854", + "name": "Eighth", + "hierarchy": 8, + "created_at": "2022-08-16T11:45:54.171Z", + "object": "category" } } } } } }, - "/v1/categories/{categoryId}": { - "parameters": [ - { + "400": { + "description": "Returns an error if the payload is incomplete.", + "content": { + "application/json": { "schema": { - "type": "string" + "$ref": "#/components/schemas/e_400_invalid_payload" }, - "name": "categoryId", - "in": "path", - "required": true, - "description": "Unique category ID assigned by Voucherify." - } - ], - "get": { - "operationId": "get-category", - "tags": [ - "CATEGORIES API" - ], - "summary": "Get Category", - "description": "Retrieve a category by the category ID.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a category object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/20_obj_category_object" - }, - "examples": { - "Example": { - "value": { - "id": "cat_0b5f49fb31c3bf6ab0", - "name": "Sixth", - "hierarchy": 6, - "created_at": "2022-07-13T06:21:36.852Z", - "object": "category" - } - } - } + "examples": { + "Missing name": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Payload should have required property 'name'", + "request_id": "v-0b8b5b960990210b25" + } + }, + "Missing hierarchy": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Payload should have required property 'hierarchy'", + "request_id": "v-0b8b5bf9d9c6824a2f" } } } } - }, - "delete": { - "operationId": "delete-category", - "tags": [ - "CATEGORIES API" - ], - "summary": "Delete Category", - "description": "Delete a category by the category ID.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "204": { - "description": "No content is returned." - }, - "404": { - "description": "Returns an error indicating that the category with given ID was not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find category with id example_category", - "request_id": "v-0b8b49205f902176c9", - "resource_id": "example_category", - "resource_type": "category" - } - } - } + } + } + } + } + }, + "/v1/categories/{categoryId}": { + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "categoryId", + "in": "path", + "required": true, + "description": "Unique category ID assigned by Voucherify." + } + ], + "get": { + "operationId": "get-category", + "tags": [ + "CATEGORIES API" + ], + "summary": "Get Category", + "description": "Retrieve a category by the category ID.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a category object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/20_obj_category_object" + }, + "examples": { + "Example": { + "value": { + "id": "cat_0b5f49fb31c3bf6ab0", + "name": "Sixth", + "hierarchy": 6, + "created_at": "2022-07-13T06:21:36.852Z", + "object": "category" } } } } - }, - "put": { - "operationId": "update-category", - "tags": [ - "CATEGORIES API" - ], - "summary": "Update Category", - "description": "Update category using the category ID.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Specify the details of the category that you would like to update.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/20_req_update_categories_categoryId" - }, - "examples": { - "Example": { - "value": { - "name": "Summer", - "hierarchy": 1 - } - } + } + } + } + }, + "delete": { + "operationId": "delete-category", + "tags": [ + "CATEGORIES API" + ], + "summary": "Delete Category", + "description": "Delete a category by the category ID.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "204": { + "description": "No content is returned." + }, + "404": { + "description": "Returns an error indicating that the category with given ID was not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find category with id example_category", + "request_id": "v-0b8b49205f902176c9", + "resource_id": "example_category", + "resource_type": "category" } } } + } + } + } + } + }, + "put": { + "operationId": "update-category", + "tags": [ + "CATEGORIES API" + ], + "summary": "Update Category", + "description": "Update category using the category ID.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Specify the details of the category that you would like to update.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/20_req_update_categories_categoryId" }, - "responses": { - "200": { - "description": "Returns a category object with a refreshed `updated_at` property.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/20_obj_category_object" - }, - "examples": { - "Example": { - "value": { - "id": "cat_0b60cfe7d0d7ddbb55", - "name": "Update", - "hierarchy": 1, - "created_at": "2022-07-14T10:45:13.156Z", - "updated_at": "2022-08-16T11:03:54.727Z", - "object": "category" - } - } - } - } + "examples": { + "Example": { + "value": { + "name": "Summer", + "hierarchy": 1 } + } + } + } + } + }, + "responses": { + "200": { + "description": "Returns a category object with a refreshed `updated_at` property.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/20_obj_category_object" }, - "400": { - "description": "Returns an error indicating an invalid payload if the required request body parameters were not included in the request.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_400_invalid_payload" - }, - "examples": { - "Missing hierarchy": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Payload should have required property 'hierarchy'", - "request_id": "v-0b8b4e6b6210217c93" - } - }, - "Missing name": { - "value": { - "code": 400, - "key": "invalid_payload", - "message": "Invalid payload", - "details": "Payload should have required property 'name'", - "request_id": "v-0b8b4f418390217d82" - } - } - } + "examples": { + "Example": { + "value": { + "id": "cat_0b60cfe7d0d7ddbb55", + "name": "Update", + "hierarchy": 1, + "created_at": "2022-07-14T10:45:13.156Z", + "updated_at": "2022-08-16T11:03:54.727Z", + "object": "category" } } } } } }, - "/v1/metadata-schema-object": { - "get": { - "operationId": "metadata-schema-object", - "tags": [ - "METADATA SCHEMAS API" - ], - "summary": "Metadata Schema Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Metadata Schema Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/21_obj_metadata_schema_object" - } + "400": { + "description": "Returns an error indicating an invalid payload if the required request body parameters were not included in the request.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_400_invalid_payload" + }, + "examples": { + "Missing hierarchy": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Payload should have required property 'hierarchy'", + "request_id": "v-0b8b4e6b6210217c93" + } + }, + "Missing name": { + "value": { + "code": 400, + "key": "invalid_payload", + "message": "Invalid payload", + "details": "Payload should have required property 'name'", + "request_id": "v-0b8b4f418390217d82" } } } } } - }, - "/v1/metadata-schemas": { - "get": { - "operationId": "list-metadata-schemas", - "tags": [ - "METADATA SCHEMAS API" - ], - "summary": "List Metadata Schemas", - "description": "Retrieve metadata schema definitions.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] + } + } + } + }, + "/v1/metadata-schema-object": { + "get": { + "operationId": "metadata-schema-object", + "tags": [ + "METADATA SCHEMAS API" + ], + "summary": "Metadata Schema Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Metadata Schema Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/21_obj_metadata_schema_object" } - ], - "responses": { - "200": { - "description": "Returns an array of metadata schema definitions. The response does not include unknown metadata properties in the response, i.e. those that have been defined outside of the **Project Settings** > **Metadata Schema** definitions. For example, an unknown metadata property can be defined in the campaign manager while creating a campaign.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/21_res_list_metadata_shemas" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "schemas", - "schemas": [ - { - "id": "ms_yqMHRHH6S1KYIHPmQHealNf4", - "related_object": "Payment", - "properties": { - "payment_tax": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "payment_method": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": true, - "created_at": "2022-03-07T11:01:01.747Z", - "updated_at": "2022-03-07T11:01:44.785Z", - "object": "metadata_schema" - }, - { - "id": "ms_DwUjpX32sY3fJEoQELpS7bN3", - "related_object": "campaign", - "properties": { - "Store": { - "type": "string", - "array": false, - "deleted": true, - "optional": true, - "objectType": null - }, - "locale": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "date_tag": { - "type": "date", - "array": false, - "optional": true, - "objectType": null - }, - "store_names": { - "eq": [ - "Store 1 - New York - Broadway", - "Store 2 - Florida - Miami", - "Store 3 - London - Heathrow", - "Store 4 - Berlin - Alexanderplatz" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "date_time_tag": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - }, - "favorite_brands": { - "type": "string", - "array": true, - "deleted": true, - "optional": true, - "objectType": null - }, - "height_customer_number": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "location_country_string": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2021-12-03T13:33:44.556Z", - "updated_at": "2022-07-26T13:57:42.288Z", - "object": "metadata_schema" - }, - { - "id": "ms_f0r4hm3ta6a4a5ch3ma", - "related_object": "customer", - "properties": { - "birth_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - }, - "CRM_created_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - }, - "customer_location": { - "type": "geopoint", - "array": false, - "optional": true, - "objectType": null - }, - "acquisition_channel": { - "eq": [ - "Facebook", - "Twitter", - "Website" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "customer_life_time_value": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2021-12-03T06:33:45.894Z", - "updated_at": "2022-07-14T15:15:34.928Z", - "object": "metadata_schema" - }, - { - "id": "ms_7X7krsG84H6MeNuIaKkb4LXN", - "related_object": "earning_rule", - "properties": { - "Type": { - "type": "string", - "array": false, - "optional": true, - "minLength": 6, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-07-27T08:54:07.980Z", - "updated_at": null, - "object": "metadata_schema" - }, - { - "id": "ms_OF36L2rk4EqhdxvZs56IW9iE", - "related_object": "loyalty_tier", - "properties": { - "has_funds": { - "type": "boolean", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-03-30T06:22:16.685Z", - "updated_at": "2022-07-27T08:55:01.628Z", - "object": "metadata_schema" - }, - { - "id": "ms_f1r5Tm3ta6a4a5ch3ma", - "related_object": "order", - "properties": { - "Payment": { - "type": "object", - "array": false, - "deleted": true, - "optional": true, - "objectType": "Payment" - }, - "day_of_week": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "location_id": { - "eq": [ - "L1", - "L2", - "L3" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "payment_mean": { - "eq": [ - "credit-card", - "wire-transfer", - "paypal" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "booking_end_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - }, - "booking_start_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - }, - "number_of_store_visits": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2021-12-03T06:33:45.798Z", - "updated_at": "2022-04-20T06:47:10.350Z", - "object": "metadata_schema" - }, - { - "id": "ms_0qgIlxP7bYb8H59DqpnWBCUN", - "related_object": "order_item", - "properties": { - "Size": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "Color": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "Thickness": { - "eq": [ - "Thin", - "Medium", - "Thick" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-03-11T13:32:55.029Z", - "updated_at": "2022-05-23T13:46:01.463Z", - "object": "metadata_schema" - }, - { - "id": "ms_s3c0N6m3ta6a4a5ch3ma", - "related_object": "product", - "properties": { - "color": { - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "origin": { - "type": "string", - "array": false, - "optional": true, - "minLength": 1, - "objectType": null - }, - "product_location": { - "type": "geopoint", - "array": false, - "optional": true, - "objectType": null - }, - "metadata_attribute_name_with_date_property": { - "type": "date", - "array": false, - "optional": true, - "objectType": null - }, - "metadata_attribute_name_with_number_property": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "metadata_attribute_name_with_boolean_property": { - "type": "boolean", - "array": false, - "optional": true, - "objectType": null - }, - "metadata_attribute_name_with_datetime_property": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2021-12-03T06:33:45.880Z", - "updated_at": "2022-07-14T15:46:47.994Z", - "object": "metadata_schema" - }, - { - "id": "ms_th8YHt9yFYY1yAA99XOasT5W", - "related_object": "promotion_tier", - "properties": { - "has_budget": { - "type": "boolean", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-01-24T07:22:21.523Z", - "updated_at": "2022-07-27T08:54:42.909Z", - "object": "metadata_schema" - }, - { - "id": "ms_Z7niydc0OpGjDRL4yB40niXn", - "related_object": "publication", - "properties": { - "year": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-03-30T06:23:49.715Z", - "updated_at": "2022-04-19T10:28:24.568Z", - "object": "metadata_schema" - }, - { - "id": "ms_t4ir0Dm3ta6a4a5ch3ma", - "related_object": "redemption", - "properties": { - "location_id": { - "eq": [ - "L1", - "L2", - "L3" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "store_names": { - "eq": [ - "Store 1 - New York - Broadway", - "Store 2 - Florida - Miami", - "Store 3 - London - Heathrow", - "Store 4 - Berlin - Alexanderplatz" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2021-12-03T06:33:45.890Z", - "updated_at": "2022-07-26T14:58:24.546Z", - "object": "metadata_schema" - }, - { - "id": "ms_EnSASZVEIDsZAYa8Z0nG8Rlg", - "related_object": "reward", - "properties": { - "Type": { - "type": "string", - "array": false, - "optional": true, - "objectType": null, - "exactLength": 4 - } - }, - "allow_defined_only": false, - "created_at": "2022-07-27T08:53:32.257Z", - "updated_at": "2022-07-27T08:53:48.542Z", - "object": "metadata_schema" - }, - { - "id": "ms_xUHvkRBPvVJAlWcTkVzufKx4", - "related_object": "voucher", - "properties": { - "unit": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "Region": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "Season": { - "eq": [ - "Spring", - "Summer", - "Fall", - "Winter" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "CATEGORY": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "active_on_calendar_month": { - "eq": [ - 1, - 2, - 3, - 5, - 7, - 9, - 10, - 11, - 12 - ], - "type": "number", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-01-24T07:22:01.281Z", - "updated_at": "2022-06-22T07:22:09.577Z", - "object": "metadata_schema" - } - ], - "total": 13 - } + } + } + } + } + } + }, + "/v1/metadata-schemas": { + "get": { + "operationId": "list-metadata-schemas", + "tags": [ + "METADATA SCHEMAS API" + ], + "summary": "List Metadata Schemas", + "description": "Retrieve metadata schema definitions.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns an array of metadata schema definitions. The response does not include unknown metadata properties in the response, i.e. those that have been defined outside of the **Project Settings** > **Metadata Schema** definitions. For example, an unknown metadata property can be defined in the campaign manager while creating a campaign.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/21_res_list_metadata_shemas" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "schemas", + "schemas": [ + { + "id": "ms_yqMHRHH6S1KYIHPmQHealNf4", + "related_object": "Payment", + "properties": { + "payment_tax": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "payment_method": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": true, + "created_at": "2022-03-07T11:01:01.747Z", + "updated_at": "2022-03-07T11:01:44.785Z", + "object": "metadata_schema" + }, + { + "id": "ms_DwUjpX32sY3fJEoQELpS7bN3", + "related_object": "campaign", + "properties": { + "Store": { + "type": "string", + "array": false, + "deleted": true, + "optional": true, + "objectType": null + }, + "locale": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "date_tag": { + "type": "date", + "array": false, + "optional": true, + "objectType": null + }, + "store_names": { + "eq": [ + "Store 1 - New York - Broadway", + "Store 2 - Florida - Miami", + "Store 3 - London - Heathrow", + "Store 4 - Berlin - Alexanderplatz" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "date_time_tag": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + }, + "favorite_brands": { + "type": "string", + "array": true, + "deleted": true, + "optional": true, + "objectType": null + }, + "height_customer_number": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "location_country_string": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2021-12-03T13:33:44.556Z", + "updated_at": "2022-07-26T13:57:42.288Z", + "object": "metadata_schema" + }, + { + "id": "ms_f0r4hm3ta6a4a5ch3ma", + "related_object": "customer", + "properties": { + "birth_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + }, + "CRM_created_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + }, + "customer_location": { + "type": "geopoint", + "array": false, + "optional": true, + "objectType": null + }, + "acquisition_channel": { + "eq": [ + "Facebook", + "Twitter", + "Website" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "customer_life_time_value": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2021-12-03T06:33:45.894Z", + "updated_at": "2022-07-14T15:15:34.928Z", + "object": "metadata_schema" + }, + { + "id": "ms_7X7krsG84H6MeNuIaKkb4LXN", + "related_object": "earning_rule", + "properties": { + "Type": { + "type": "string", + "array": false, + "optional": true, + "minLength": 6, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-07-27T08:54:07.980Z", + "updated_at": null, + "object": "metadata_schema" + }, + { + "id": "ms_OF36L2rk4EqhdxvZs56IW9iE", + "related_object": "loyalty_tier", + "properties": { + "has_funds": { + "type": "boolean", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-03-30T06:22:16.685Z", + "updated_at": "2022-07-27T08:55:01.628Z", + "object": "metadata_schema" + }, + { + "id": "ms_f1r5Tm3ta6a4a5ch3ma", + "related_object": "order", + "properties": { + "Payment": { + "type": "object", + "array": false, + "deleted": true, + "optional": true, + "objectType": "Payment" + }, + "day_of_week": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "location_id": { + "eq": [ + "L1", + "L2", + "L3" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "payment_mean": { + "eq": [ + "credit-card", + "wire-transfer", + "paypal" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "booking_end_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + }, + "booking_start_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + }, + "number_of_store_visits": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2021-12-03T06:33:45.798Z", + "updated_at": "2022-04-20T06:47:10.350Z", + "object": "metadata_schema" + }, + { + "id": "ms_0qgIlxP7bYb8H59DqpnWBCUN", + "related_object": "order_item", + "properties": { + "Size": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "Color": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "Thickness": { + "eq": [ + "Thin", + "Medium", + "Thick" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-03-11T13:32:55.029Z", + "updated_at": "2022-05-23T13:46:01.463Z", + "object": "metadata_schema" + }, + { + "id": "ms_s3c0N6m3ta6a4a5ch3ma", + "related_object": "product", + "properties": { + "color": { + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "origin": { + "type": "string", + "array": false, + "optional": true, + "minLength": 1, + "objectType": null + }, + "product_location": { + "type": "geopoint", + "array": false, + "optional": true, + "objectType": null + }, + "metadata_attribute_name_with_date_property": { + "type": "date", + "array": false, + "optional": true, + "objectType": null + }, + "metadata_attribute_name_with_number_property": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "metadata_attribute_name_with_boolean_property": { + "type": "boolean", + "array": false, + "optional": true, + "objectType": null + }, + "metadata_attribute_name_with_datetime_property": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2021-12-03T06:33:45.880Z", + "updated_at": "2022-07-14T15:46:47.994Z", + "object": "metadata_schema" + }, + { + "id": "ms_th8YHt9yFYY1yAA99XOasT5W", + "related_object": "promotion_tier", + "properties": { + "has_budget": { + "type": "boolean", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-01-24T07:22:21.523Z", + "updated_at": "2022-07-27T08:54:42.909Z", + "object": "metadata_schema" + }, + { + "id": "ms_Z7niydc0OpGjDRL4yB40niXn", + "related_object": "publication", + "properties": { + "year": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-03-30T06:23:49.715Z", + "updated_at": "2022-04-19T10:28:24.568Z", + "object": "metadata_schema" + }, + { + "id": "ms_t4ir0Dm3ta6a4a5ch3ma", + "related_object": "redemption", + "properties": { + "location_id": { + "eq": [ + "L1", + "L2", + "L3" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "store_names": { + "eq": [ + "Store 1 - New York - Broadway", + "Store 2 - Florida - Miami", + "Store 3 - London - Heathrow", + "Store 4 - Berlin - Alexanderplatz" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2021-12-03T06:33:45.890Z", + "updated_at": "2022-07-26T14:58:24.546Z", + "object": "metadata_schema" + }, + { + "id": "ms_EnSASZVEIDsZAYa8Z0nG8Rlg", + "related_object": "reward", + "properties": { + "Type": { + "type": "string", + "array": false, + "optional": true, + "objectType": null, + "exactLength": 4 + } + }, + "allow_defined_only": false, + "created_at": "2022-07-27T08:53:32.257Z", + "updated_at": "2022-07-27T08:53:48.542Z", + "object": "metadata_schema" + }, + { + "id": "ms_xUHvkRBPvVJAlWcTkVzufKx4", + "related_object": "voucher", + "properties": { + "unit": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "Region": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "Season": { + "eq": [ + "Spring", + "Summer", + "Fall", + "Winter" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "CATEGORY": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "active_on_calendar_month": { + "eq": [ + 1, + 2, + 3, + 5, + 7, + 9, + 10, + 11, + 12 + ], + "type": "number", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-01-24T07:22:01.281Z", + "updated_at": "2022-06-22T07:22:09.577Z", + "object": "metadata_schema" } - } + ], + "total": 13 } } } } } + } + } + } + }, + "/v1/metadata-schemas/{resource}": { + "parameters": [ + { + "schema": { + "type": "string" }, - "/v1/metadata-schemas/{resource}": { - "parameters": [ - { + "name": "resource", + "in": "path", + "required": true, + "description": "There is an infinite number of possibilities for retrieving metadata schemas by the resource type because you can define custom metadata schemas." + } + ], + "get": { + "operationId": "get-metadata-schema", + "tags": [ + "METADATA SCHEMAS API" + ], + "summary": "Get Metadata Schema", + "description": "Retrieve metadata schema per resource type.\n\n## Resource types\n\n### Standard\n\nYou can retrieve metadata schemas for the standard metadata schema definitions listed below. Add one of these types as the resource path parameter.\n\n- `campaign`\n- `customer`\n- `earning_rule`\n- `loyalty_tier`\n- `order`\n- `order_item`\n- `product`\n- `promotion_tier`\n- `publication`\n- `redemption`\n- `reward`\n- `voucher`\n\n### Custom\n\nThere is an infinite number of possibilities for retrieving metadata schemas by the resource type because you can define custom metadata schemas. Provide one of the resource types that you have defined as a resource type. [Read more](https://support.voucherify.io/article/99-schema-validation-metadata#add-metadata).", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "The response does not include unknown metadata properties in the response, i.e. those that have been defined outside of the **Project Settings** > **Metadata Schema** definitions. For example, an unknown metadata property can be defined in the campaign manager.", + "content": { + "application/json": { "schema": { - "type": "string" + "$ref": "#/components/schemas/21_obj_metadata_schema_object" }, - "name": "resource", - "in": "path", - "required": true, - "description": "There is an infinite number of possibilities for retrieving metadata schemas by the resource type because you can define custom metadata schemas." - } - ], - "get": { - "operationId": "get-metadata-schema", - "tags": [ - "METADATA SCHEMAS API" - ], - "summary": "Get Metadata Schema", - "description": "Retrieve metadata schema per resource type.\n\n## Resource types\n\n### Standard\n\nYou can retrieve metadata schemas for the standard metadata schema definitions listed below. Add one of these types as the resource path parameter.\n\n- `campaign`\n- `customer`\n- `earning_rule`\n- `loyalty_tier`\n- `order`\n- `order_item`\n- `product`\n- `promotion_tier`\n- `publication`\n- `redemption`\n- `reward`\n- `voucher`\n\n### Custom\n\nThere is an infinite number of possibilities for retrieving metadata schemas by the resource type because you can define custom metadata schemas. Provide one of the resource types that you have defined as a resource type. [Read more](https://support.voucherify.io/article/99-schema-validation-metadata#add-metadata).", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "The response does not include unknown metadata properties in the response, i.e. those that have been defined outside of the **Project Settings** > **Metadata Schema** definitions. For example, an unknown metadata property can be defined in the campaign manager.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/21_obj_metadata_schema_object" - }, - "examples": { - "earning_rule": { - "value": { - "id": "ms_27vMXZqBAkkqBoOuw8EYTRLn", - "related_object": "earning_rule", - "properties": { - "channel_id": { - "type": "string", - "array": true, - "optional": true, - "objectType": null, - "exactLength": 5 - }, - "channel_name": { - "eq": [ - "instagram", - "facebook", - "google", - "twitter", - "linkedin", - "website" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-08-25T13:09:59.970Z", - "updated_at": "2022-08-25T13:11:15.704Z", - "object": "metadata_schema" - } + "examples": { + "earning_rule": { + "value": { + "id": "ms_27vMXZqBAkkqBoOuw8EYTRLn", + "related_object": "earning_rule", + "properties": { + "channel_id": { + "type": "string", + "array": true, + "optional": true, + "objectType": null, + "exactLength": 5 }, - "campaign": { - "value": { - "id": "ms_psGSDpVl6JcPilPA7toZ83Kj", - "related_object": "campaign", - "properties": { - "region": { - "eq": [ - "EMEA", - "AMER", - "APAC" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-08-25T13:12:58.447Z", - "updated_at": null, - "object": "metadata_schema" - } + "channel_name": { + "eq": [ + "instagram", + "facebook", + "google", + "twitter", + "linkedin", + "website" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-08-25T13:09:59.970Z", + "updated_at": "2022-08-25T13:11:15.704Z", + "object": "metadata_schema" + } + }, + "campaign": { + "value": { + "id": "ms_psGSDpVl6JcPilPA7toZ83Kj", + "related_object": "campaign", + "properties": { + "region": { + "eq": [ + "EMEA", + "AMER", + "APAC" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-08-25T13:12:58.447Z", + "updated_at": null, + "object": "metadata_schema" + } + }, + "customer": { + "value": { + "id": "ms_f0r4hm3ta6a4a5ch3ma", + "related_object": "customer", + "properties": { + "age": { + "type": "number", + "array": false, + "optional": true, + "objectType": null }, - "customer": { - "value": { - "id": "ms_f0r4hm3ta6a4a5ch3ma", - "related_object": "customer", - "properties": { - "age": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "city_id": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "location": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "favorite_brands": { - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "acquisition_channel": { - "eq": [ - "Facebook", - "Twitter", - "Website" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "customer_life_time_value": { - "type": "number", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2021-12-01T08:00:48.889Z", - "updated_at": "2022-09-12T07:34:49.163Z", - "object": "metadata_schema" - } + "city_id": { + "type": "number", + "array": false, + "optional": true, + "objectType": null }, - "loyalty_tier": { - "value": { - "id": "ms_jHUoFlgepKVEftxK1pKPGZlO", - "related_object": "loyalty_tier", - "properties": { - "level_name": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "audience_restricted": { - "type": "boolean", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-08-25T13:14:54.954Z", - "updated_at": "2022-08-25T13:15:24.436Z", - "object": "metadata_schema" - } + "location": { + "type": "string", + "array": false, + "optional": true, + "objectType": null }, - "order": { - "value": { - "id": "ms_f1r5Tm3ta6a4a5ch3ma", - "related_object": "order", - "properties": { - "card": { - "eq": [ - "Visa", - "MasterCard", - "Other" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "currency": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "location": { - "ne": [ - 1, - 2, - 18, - 22 - ], - "type": "number", - "array": false, - "optional": true, - "objectType": null - }, - "store_city": { - "eq": [ - "Hampden", - "San Francisco", - "Warsaw" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "location_id": { - "eq": [ - "L1", - "L2", - "L3" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "payment_mean": { - "eq": [ - "credit-card", - "wire-transfer", - "paypal" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "booking_end_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - }, - "booking_start_date": { - "type": "datetime", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2021-12-01T08:00:47.575Z", - "updated_at": "2022-10-25T10:05:18.978Z", - "object": "metadata_schema" - } + "favorite_brands": { + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "acquisition_channel": { + "eq": [ + "Facebook", + "Twitter", + "Website" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "customer_life_time_value": { + "type": "number", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2021-12-01T08:00:48.889Z", + "updated_at": "2022-09-12T07:34:49.163Z", + "object": "metadata_schema" + } + }, + "loyalty_tier": { + "value": { + "id": "ms_jHUoFlgepKVEftxK1pKPGZlO", + "related_object": "loyalty_tier", + "properties": { + "level_name": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "audience_restricted": { + "type": "boolean", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-08-25T13:14:54.954Z", + "updated_at": "2022-08-25T13:15:24.436Z", + "object": "metadata_schema" + } + }, + "order": { + "value": { + "id": "ms_f1r5Tm3ta6a4a5ch3ma", + "related_object": "order", + "properties": { + "card": { + "eq": [ + "Visa", + "MasterCard", + "Other" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "currency": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "location": { + "ne": [ + 1, + 2, + 18, + 22 + ], + "type": "number", + "array": false, + "optional": true, + "objectType": null + }, + "store_city": { + "eq": [ + "Hampden", + "San Francisco", + "Warsaw" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null }, - "order_item": { - "value": { - "id": "ms_7ux44AEnt82bqo8ww5V1SXzV", - "related_object": "order_item", - "properties": { - "manufacturer_id": { - "gte": 15, - "type": "number", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-08-25T13:16:03.167Z", - "updated_at": null, - "object": "metadata_schema" - } + "location_id": { + "eq": [ + "L1", + "L2", + "L3" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null }, - "product": { - "value": { - "id": "ms_s3c0N6m3ta6a4a5ch3ma", - "related_object": "product", - "properties": { - "vendor": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "category": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "location": { - "type": "geopoint", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2021-12-01T08:00:48.298Z", - "updated_at": "2022-07-14T15:53:29.226Z", - "object": "metadata_schema" - } + "payment_mean": { + "eq": [ + "credit-card", + "wire-transfer", + "paypal" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null }, - "promotion_tier": { - "value": { - "id": "ms_dNb5aLMzU0VBCiRuxLOeMNwn", - "related_object": "promotion_tier", - "properties": { - "level": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-01-24T10:42:04.937Z", - "updated_at": "2022-09-23T08:51:46.266Z", - "object": "metadata_schema" - } + "booking_end_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null }, - "publication": { - "value": { - "id": "ms_fzvWNh7sU4LeykEQ2Abpg6jG", - "related_object": "publication", - "properties": { - "file_uploaded": { - "type": "image_url", - "array": false, - "optional": true, - "objectType": null - }, - "publication_method": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-08-25T13:16:35.534Z", - "updated_at": "2022-09-12T10:26:31.135Z", - "object": "metadata_schema" - } + "booking_start_date": { + "type": "datetime", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2021-12-01T08:00:47.575Z", + "updated_at": "2022-10-25T10:05:18.978Z", + "object": "metadata_schema" + } + }, + "order_item": { + "value": { + "id": "ms_7ux44AEnt82bqo8ww5V1SXzV", + "related_object": "order_item", + "properties": { + "manufacturer_id": { + "gte": 15, + "type": "number", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-08-25T13:16:03.167Z", + "updated_at": null, + "object": "metadata_schema" + } + }, + "product": { + "value": { + "id": "ms_s3c0N6m3ta6a4a5ch3ma", + "related_object": "product", + "properties": { + "vendor": { + "type": "string", + "array": false, + "optional": true, + "objectType": null }, - "redemption": { - "value": { - "id": "ms_t4ir0Dm3ta6a4a5ch3ma", - "related_object": "redemption", - "properties": { - "location_id": { - "eq": [ - "L1", - "L2", - "L3" - ], - "type": "string", - "array": true, - "optional": true, - "objectType": null - }, - "redemption_location": { - "type": "object", - "array": false, - "optional": true, - "objectType": "Location" - } - }, - "allow_defined_only": false, - "created_at": "2021-12-01T08:00:48.794Z", - "updated_at": "2022-08-25T13:19:50.497Z", - "object": "metadata_schema" - } + "category": { + "type": "string", + "array": false, + "optional": true, + "objectType": null }, - "reward": { - "value": { - "id": "ms_PwrAtwqCFXeH4Qix22gEkqhl", - "related_object": "reward", - "properties": { - "reward_type": { - "eq": [ - "MATERIAL", - "PAY-WITH-POINTS", - "DISCOUNT-COUPON", - "GIFT-CARD-CREDITS", - "LOYALTY POINTS" - ], - "type": "string", - "array": false, - "optional": false, - "objectType": null - } - }, - "allow_defined_only": true, - "created_at": "2022-08-25T13:07:13.689Z", - "updated_at": "2022-08-25T13:08:26.696Z", - "object": "metadata_schema" - } + "location": { + "type": "geopoint", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2021-12-01T08:00:48.298Z", + "updated_at": "2022-07-14T15:53:29.226Z", + "object": "metadata_schema" + } + }, + "promotion_tier": { + "value": { + "id": "ms_dNb5aLMzU0VBCiRuxLOeMNwn", + "related_object": "promotion_tier", + "properties": { + "level": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-01-24T10:42:04.937Z", + "updated_at": "2022-09-23T08:51:46.266Z", + "object": "metadata_schema" + } + }, + "publication": { + "value": { + "id": "ms_fzvWNh7sU4LeykEQ2Abpg6jG", + "related_object": "publication", + "properties": { + "file_uploaded": { + "type": "image_url", + "array": false, + "optional": true, + "objectType": null }, - "voucher": { - "value": { - "id": "ms_9uE6eP17Jvoxl46mCqL6Q3Ut", - "related_object": "voucher", - "properties": { - "lang": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "Season": { - "eq": [ - "Spring", - "Summer", - "Fall", - "Winter" - ], - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "marketing_text": { - "type": "string", - "array": false, - "optional": true, - "objectType": null - }, - "ProductionVoucherCodeMetaData": { - "type": "string", - "array": false, - "deleted": true, - "optional": true, - "objectType": null - } - }, - "allow_defined_only": false, - "created_at": "2022-01-24T10:42:23.994Z", - "updated_at": "2022-09-19T14:13:30.590Z", - "object": "metadata_schema" - } + "publication_method": { + "type": "string", + "array": false, + "optional": true, + "objectType": null } - } + }, + "allow_defined_only": false, + "created_at": "2022-08-25T13:16:35.534Z", + "updated_at": "2022-09-12T10:26:31.135Z", + "object": "metadata_schema" } - } - }, - "404": { - "description": "Returns an error if the resource provided in the path is not found.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/e_404_not_found" - }, - "examples": { - "Not Found": { - "value": { - "code": 404, - "key": "not_found", - "message": "Resource not found", - "details": "Cannot find metadata schema with id earning_rules", - "request_id": "v-0c1b9ce0098a391421", - "resource_id": "earning_rules", - "resource_type": "metadata schema" - } + }, + "redemption": { + "value": { + "id": "ms_t4ir0Dm3ta6a4a5ch3ma", + "related_object": "redemption", + "properties": { + "location_id": { + "eq": [ + "L1", + "L2", + "L3" + ], + "type": "string", + "array": true, + "optional": true, + "objectType": null + }, + "redemption_location": { + "type": "object", + "array": false, + "optional": true, + "objectType": "Location" } - } + }, + "allow_defined_only": false, + "created_at": "2021-12-01T08:00:48.794Z", + "updated_at": "2022-08-25T13:19:50.497Z", + "object": "metadata_schema" + } + }, + "reward": { + "value": { + "id": "ms_PwrAtwqCFXeH4Qix22gEkqhl", + "related_object": "reward", + "properties": { + "reward_type": { + "eq": [ + "MATERIAL", + "PAY-WITH-POINTS", + "DISCOUNT-COUPON", + "GIFT-CARD-CREDITS", + "LOYALTY POINTS" + ], + "type": "string", + "array": false, + "optional": false, + "objectType": null + } + }, + "allow_defined_only": true, + "created_at": "2022-08-25T13:07:13.689Z", + "updated_at": "2022-08-25T13:08:26.696Z", + "object": "metadata_schema" + } + }, + "voucher": { + "value": { + "id": "ms_9uE6eP17Jvoxl46mCqL6Q3Ut", + "related_object": "voucher", + "properties": { + "lang": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "Season": { + "eq": [ + "Spring", + "Summer", + "Fall", + "Winter" + ], + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "marketing_text": { + "type": "string", + "array": false, + "optional": true, + "objectType": null + }, + "ProductionVoucherCodeMetaData": { + "type": "string", + "array": false, + "deleted": true, + "optional": true, + "objectType": null + } + }, + "allow_defined_only": false, + "created_at": "2022-01-24T10:42:23.994Z", + "updated_at": "2022-09-19T14:13:30.590Z", + "object": "metadata_schema" } } } } } }, - "/v1/location-object": { - "get": { - "operationId": "location-object", - "tags": [ - "LOCATIONS API" - ], - "summary": "Location Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Location Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/22_obj_location_object" - } + "404": { + "description": "Returns an error if the resource provided in the path is not found.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/e_404_not_found" + }, + "examples": { + "Not Found": { + "value": { + "code": 404, + "key": "not_found", + "message": "Resource not found", + "details": "Cannot find metadata schema with id earning_rules", + "request_id": "v-0c1b9ce0098a391421", + "resource_id": "earning_rules", + "resource_type": "metadata schema" } } } } } + } + } + } + }, + "/v1/location-object": { + "get": { + "operationId": "location-object", + "tags": [ + "LOCATIONS API" + ], + "summary": "Location Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Location Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/22_obj_location_object" + } + } + } + } + } + } + }, + "/v1/locations": { + "get": { + "operationId": "list-locations", + "tags": [ + "LOCATIONS API" + ], + "summary": "List Locations", + "description": "Returns a list of your locations.", + "parameters": [ + { + "$ref": "#/components/parameters/limit" }, - "/v1/locations": { - "get": { - "operationId": "list-locations", - "tags": [ - "LOCATIONS API" - ], - "summary": "List Locations", - "description": "Returns a list of your locations.", - "parameters": [ + { + "name": "order", + "in": "query", + "required": false, + "schema": { + "type": "string", + "enum": [ + "created_at", + "-created_at", + "updated_at", + "-updated_at" + ] + }, + "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." + }, + { + "name": "filters", + "in": "query", + "required": false, + "schema": { + "anyOf": [ { - "$ref": "#/components/parameters/limit" + "$ref": "#/components/schemas/22_filter_updated_at" }, { - "name": "order", - "in": "query", - "required": false, - "schema": { - "type": "string", - "enum": [ - "created_at", - "-created_at", - "updated_at", - "-updated_at" - ] - }, - "description": "Sorts the results using one of the filtering options, where the dash `-` preceding a sorting option means sorting in a descending order." + "$ref": "#/components/schemas/22_filter_created_at" }, { - "name": "filters", - "in": "query", - "required": false, - "schema": { - "anyOf": [ - { - "$ref": "#/components/schemas/22_filter_updated_at" - }, - { - "$ref": "#/components/schemas/22_filter_created_at" - }, - { - "$ref": "#/components/schemas/22_filter_name" - }, - { - "$ref": "#/components/schemas/22_filter_id" - } - ] - }, - "description": "Filter the locations using one of the available filters.", - "style": "deepObject", - "explode": true + "$ref": "#/components/schemas/22_filter_name" }, { - "name": "end_date", - "in": "query", - "required": false, - "schema": { - "type": "string", - "format": "date-time" - }, - "description": "A filter on the list based on the end date. This will filter out all locations who's end date falls before the specified date and time. A date value must be presented in ISO 8601 format (`2016-11-16T14:14:31Z` or `2016-11-16`)." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a dictionary that contains an array of locations. Each entry in the array is a separate location object. If no more locations are available, the resulting array will be empty. The result can be narrowed down according to specified (or default) filters.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/22_res_list_locations" - }, - "examples": { - "Example": { - "value": { - "object": "list", - "data_ref": "data", - "data": [ - { - "id": "loc_NoMGXmHO9OUs7iz9mGWpamma", - "object": "location", - "name": "Belleville", - "shape": { - "type": "circle", - "format": "distance", - "distance": { - "center": "geo:40.79372699823857,-74.15092132694554", - "radius": "1.54 km" - } - }, - "created_at": "2022-07-15T06:04:36.924Z", - "updated_at": null - }, - { - "id": "loc_ae2gKWpAFMsuRhyMqGx2FZFF", - "object": "location", - "name": "New York", - "shape": { - "type": "polygon", - "format": "geojson", - "geojson": { - "type": "Polygon", - "coordinates": [ - [ - [ - -74.016167, - 40.703186 - ], - [ - -74.008687, - 40.750656 - ], - [ - -73.943597, - 40.851838 - ], - [ - -73.928559, - 40.845285 - ], - [ - -73.936152, - 40.8356 - ], - [ - -73.934298, - 40.810015 - ], - [ - -73.92711, - 40.795145 - ], - [ - -73.978623, - 40.710432 - ], - [ - -74.013201, - 40.701619 - ], - [ - -74.016167, - 40.703186 - ] - ] - ] - } - }, - "created_at": "2022-07-15T05:37:45.299Z", - "updated_at": null - }, - { - "id": "loc_f5HqjVaiq7g9ISlmivpytxSf", - "object": "location", - "name": "Germany", - "shape": { - "type": "circle", - "format": "distance", - "distance": { - "center": "geo:51.303908897065064,10.222253628401518", - "radius": "192.37 km" - } - }, - "created_at": "2022-07-14T15:51:39.265Z", - "updated_at": null - }, - { - "id": "loc_RcYz537sV07e1t5aG5tIH9FD", - "object": "location", - "name": "Poland", - "shape": { - "type": "polygon", - "format": "geojson", - "geojson": { - "type": "Polygon", - "coordinates": [ - [ - [ - 18.553923, - 50.559107 - ], - [ - 18.528805, - 51.087437 - ], - [ - 19.591667, - 50.832424 - ], - [ - 19.425109, - 50.497984 - ], - [ - 19.375814, - 50.330652 - ], - [ - 19.398107, - 50.111652 - ], - [ - 18.73906, - 49.981498 - ], - [ - 18.272477, - 50.088707 - ], - [ - 18.553923, - 50.559107 - ] - ] - ] - } - }, - "created_at": "2022-07-14T15:21:55.085Z", - "updated_at": null - } - ], - "total": 4, - "has_more": false - } - } - } - } - } + "$ref": "#/components/schemas/22_filter_id" } - } - } + ] + }, + "description": "Filter the locations using one of the available filters.", + "style": "deepObject", + "explode": true }, - "/v1/locations/{locationId}": { - "get": { - "operationId": "get-location", - "tags": [ - "LOCATIONS API" - ], - "summary": "Get Location", - "description": "Returns a location object.", - "parameters": [ - { - "schema": { - "type": "string" - }, - "name": "locationId", - "in": "path", - "required": true, - "description": "The unique location ID." - } - ], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "responses": { - "200": { - "description": "Returns a location object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/22_obj_location_object" - }, - "examples": { - "Circle Example": { - "value": { - "id": "loc_NoMGXmHO9OUs7iz9mGWpamma", - "object": "location", - "name": "Belleville", - "shape": { - "type": "circle", - "format": "distance", - "distance": { - "center": "geo:40.79372699823857,-74.15092132694554", - "radius": "1.54 km" - } - }, - "created_at": "2022-07-15T06:04:36.924Z", - "updated_at": null - } + { + "name": "end_date", + "in": "query", + "required": false, + "schema": { + "type": "string", + "format": "date-time" + }, + "description": "A filter on the list based on the end date. This will filter out all locations who's end date falls before the specified date and time. A date value must be presented in ISO 8601 format (`2016-11-16T14:14:31Z` or `2016-11-16`)." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a dictionary that contains an array of locations. Each entry in the array is a separate location object. If no more locations are available, the resulting array will be empty. The result can be narrowed down according to specified (or default) filters.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/22_res_list_locations" + }, + "examples": { + "Example": { + "value": { + "object": "list", + "data_ref": "data", + "data": [ + { + "id": "loc_NoMGXmHO9OUs7iz9mGWpamma", + "object": "location", + "name": "Belleville", + "shape": { + "type": "circle", + "format": "distance", + "distance": { + "center": "geo:40.79372699823857,-74.15092132694554", + "radius": "1.54 km" + } + }, + "created_at": "2022-07-15T06:04:36.924Z", + "updated_at": null + }, + { + "id": "loc_ae2gKWpAFMsuRhyMqGx2FZFF", + "object": "location", + "name": "New York", + "shape": { + "type": "polygon", + "format": "geojson", + "geojson": { + "type": "Polygon", + "coordinates": [ + [ + [ + -74.016167, + 40.703186 + ], + [ + -74.008687, + 40.750656 + ], + [ + -73.943597, + 40.851838 + ], + [ + -73.928559, + 40.845285 + ], + [ + -73.936152, + 40.8356 + ], + [ + -73.934298, + 40.810015 + ], + [ + -73.92711, + 40.795145 + ], + [ + -73.978623, + 40.710432 + ], + [ + -74.013201, + 40.701619 + ], + [ + -74.016167, + 40.703186 + ] + ] + ] + } + }, + "created_at": "2022-07-15T05:37:45.299Z", + "updated_at": null + }, + { + "id": "loc_f5HqjVaiq7g9ISlmivpytxSf", + "object": "location", + "name": "Germany", + "shape": { + "type": "circle", + "format": "distance", + "distance": { + "center": "geo:51.303908897065064,10.222253628401518", + "radius": "192.37 km" + } + }, + "created_at": "2022-07-14T15:51:39.265Z", + "updated_at": null }, - "Polygon Example": { - "value": { - "id": "loc_RcYz537sV07e1t5aG5tIH9FD", - "object": "location", - "name": "Poland", - "shape": { - "type": "polygon", - "format": "geojson", - "geojson": { - "type": "Polygon", - "coordinates": [ + { + "id": "loc_RcYz537sV07e1t5aG5tIH9FD", + "object": "location", + "name": "Poland", + "shape": { + "type": "polygon", + "format": "geojson", + "geojson": { + "type": "Polygon", + "coordinates": [ + [ + [ + 18.553923, + 50.559107 + ], + [ + 18.528805, + 51.087437 + ], + [ + 19.591667, + 50.832424 + ], [ - [ - 18.553923, - 50.559107 - ], - [ - 18.528805, - 51.087437 - ], - [ - 19.591667, - 50.832424 - ], - [ - 19.425109, - 50.497984 - ], - [ - 19.375814, - 50.330652 - ], - [ - 19.398107, - 50.111652 - ], - [ - 18.73906, - 49.981498 - ], - [ - 18.272477, - 50.088707 - ], - [ - 18.553923, - 50.559107 - ] + 19.425109, + 50.497984 + ], + [ + 19.375814, + 50.330652 + ], + [ + 19.398107, + 50.111652 + ], + [ + 18.73906, + 49.981498 + ], + [ + 18.272477, + 50.088707 + ], + [ + 18.553923, + 50.559107 ] ] - } - }, - "created_at": "2022-07-14T15:21:55.085Z", - "updated_at": null - } + ] + } + }, + "created_at": "2022-07-14T15:21:55.085Z", + "updated_at": null } - } + ], + "total": 4, + "has_more": false } } } } } - }, - "/v1/qualification-object": { - "get": { - "operationId": "qualification-object", - "tags": [ - "QUALIFICATIONS API" - ], - "summary": "Qualification Object", - "description": "Data model description", - "responses": { - "200": { - "description": "Qualification Object", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/23_obj_qualification_object" - } + } + } + } + }, + "/v1/locations/{locationId}": { + "get": { + "operationId": "get-location", + "tags": [ + "LOCATIONS API" + ], + "summary": "Get Location", + "description": "Returns a location object.", + "parameters": [ + { + "schema": { + "type": "string" + }, + "name": "locationId", + "in": "path", + "required": true, + "description": "The unique location ID." + } + ], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "responses": { + "200": { + "description": "Returns a location object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/22_obj_location_object" + }, + "examples": { + "Circle Example": { + "value": { + "id": "loc_NoMGXmHO9OUs7iz9mGWpamma", + "object": "location", + "name": "Belleville", + "shape": { + "type": "circle", + "format": "distance", + "distance": { + "center": "geo:40.79372699823857,-74.15092132694554", + "radius": "1.54 km" + } + }, + "created_at": "2022-07-15T06:04:36.924Z", + "updated_at": null + } + }, + "Polygon Example": { + "value": { + "id": "loc_RcYz537sV07e1t5aG5tIH9FD", + "object": "location", + "name": "Poland", + "shape": { + "type": "polygon", + "format": "geojson", + "geojson": { + "type": "Polygon", + "coordinates": [ + [ + [ + 18.553923, + 50.559107 + ], + [ + 18.528805, + 51.087437 + ], + [ + 19.591667, + 50.832424 + ], + [ + 19.425109, + 50.497984 + ], + [ + 19.375814, + 50.330652 + ], + [ + 19.398107, + 50.111652 + ], + [ + 18.73906, + 49.981498 + ], + [ + 18.272477, + 50.088707 + ], + [ + 18.553923, + 50.559107 + ] + ] + ] + } + }, + "created_at": "2022-07-14T15:21:55.085Z", + "updated_at": null } } } } } - }, - "/v1/qualifications": { - "post": { - "operationId": "check-eligibility", - "tags": [ - "QUALIFICATIONS API" - ], - "summary": "Check Eligibility", - "description": "Generate a list of redeemables that are applicable in the context of the customer and order.\n\nThe new qualifications method is an improved version of [Campaign Qualifications](ref:examine-campaigns-qualification), [Voucher Qualifications](ref:examine-vouchers-qualification), and [Promotions Validation](ref:validate-promotions) API requests. The new qualification method introduces the following improvements:\n\n- Qualification results are returned faster\n- No limit on the number of returned redeemables\n- Introduces new qualification scenarios, not available in the previous version\n\n> 👍 Scenario Guide\n>\n> Read our dedicated guide to learn about some use cases this endpoint can cover [here](doc:checking-eligibility).\n\n## Paging \n\nThe 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.\n\nTo process of paging the redeemables works in the following manner:\n\n- You send the first API request for Qualifications without the `starting_after` parameter.\n- The response will contain a parameter named `has_more`. If the parameter's value is set to `true`, then more redeemables are available.\n- 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.\n- 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.\n- Voucherify will return the next page of redeemables.\n- If the `has_more` parameter is set to `true`, apply steps 3-5 to get the next page of redeemables.", - "parameters": [], - "security": [ - { - "X-App-Id-1": [], - "X-App-Token-1": [] - } - ], - "requestBody": { - "description": "Define order and customer context.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/23_req_create_qualification" - } - } - } - }, - "responses": { - "200": { - "description": "Returns a qualifications object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/23_obj_qualification_object" - } - } - } + } + } + } + }, + "/v1/qualification-object": { + "get": { + "operationId": "qualification-object", + "tags": [ + "QUALIFICATIONS API" + ], + "summary": "Qualification Object", + "description": "Data model description", + "responses": { + "200": { + "description": "Qualification Object", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/23_obj_qualification_object" } } } - }, - "/client/v1/qualifications": { - "post": { - "operationId": "check-eligibility-client-side", - "tags": [ - "QUALIFICATIONS API" - ], - "summary": "Check Eligibility (client-side)", - "description": "Generate a list of redeemables that are applicable in the context of the customer and order.\n\nThe new qualifications method is an improved version of [Campaign Qualifications](ref:examine-campaigns-qualification), [Voucher Qualifications](ref:examine-vouchers-qualification), and [Promotions Validation](ref:validate-promotions) API requests. The new qualification method introduces the following improvements:\n\n- Qualification results are returned faster\n- No limit on the number of returned redeemables\n- Introduces new qualification scenarios, not available in the previous version\n\n> 👍 Scenario Guide\n>\n> Read our dedicated guide to learn about some use cases this endpoint can cover [here](doc:checking-eligibility).\n\n## Paging \n\nThe 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.\n\nTo process of paging the redeemables works in the following manner:\n\n- You send the first API request for Qualifications without the `starting_after` parameter.\n- The response will contain a parameter named `has_more`. If the parameter's value is set to `true`, then more redeemables are available.\n- 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.\n- 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.\n- Voucherify will return the next page of redeemables.\n- If the `has_more` parameter is set to `true`, apply steps 3-5 to get the next page of redeemables.", - "parameters": [], - "security": [ - { - "X-Client-Application-Id-1": [], - "X-Client-Token-1": [] - } - ], - "requestBody": { - "description": "Define order and customer context.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/23_req_create_qualification" - } - } + } + } + } + }, + "/v1/qualifications": { + "post": { + "operationId": "check-eligibility", + "tags": [ + "QUALIFICATIONS API" + ], + "summary": "Check Eligibility", + "description": "Generate a list of redeemables that are applicable in the context of the customer and order.\n\nThe new qualifications method is an improved version of [Campaign Qualifications](ref:examine-campaigns-qualification), [Voucher Qualifications](ref:examine-vouchers-qualification), and [Promotions Validation](ref:validate-promotions) API requests. The new qualification method introduces the following improvements:\n\n- Qualification results are returned faster\n- No limit on the number of returned redeemables\n- Introduces new qualification scenarios, not available in the previous version\n\n> 👍 Scenario Guide\n>\n> Read our dedicated guide to learn about some use cases this endpoint can cover [here](doc:checking-eligibility).\n\n## Paging \n\nThe 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.\n\nTo process of paging the redeemables works in the following manner:\n\n- You send the first API request for Qualifications without the `starting_after` parameter.\n- The response will contain a parameter named `has_more`. If the parameter's value is set to `true`, then more redeemables are available.\n- 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.\n- 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.\n- Voucherify will return the next page of redeemables.\n- If the `has_more` parameter is set to `true`, apply steps 3-5 to get the next page of redeemables.", + "parameters": [], + "security": [ + { + "X-App-Id-1": [], + "X-App-Token-1": [] + } + ], + "requestBody": { + "description": "Define order and customer context.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/23_req_create_qualification" + } + } + } + }, + "responses": { + "200": { + "description": "Returns a qualifications object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/23_obj_qualification_object" } - }, - "responses": { - "200": { - "description": "Returns a qualifications object.", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/23_obj_qualification_object" - } - } - } + } + } + } + } + } + }, + "/client/v1/qualifications": { + "post": { + "operationId": "check-eligibility-client-side", + "tags": [ + "QUALIFICATIONS API" + ], + "summary": "Check Eligibility (client-side)", + "description": "Generate a list of redeemables that are applicable in the context of the customer and order.\n\nThe new qualifications method is an improved version of [Campaign Qualifications](ref:examine-campaigns-qualification), [Voucher Qualifications](ref:examine-vouchers-qualification), and [Promotions Validation](ref:validate-promotions) API requests. The new qualification method introduces the following improvements:\n\n- Qualification results are returned faster\n- No limit on the number of returned redeemables\n- Introduces new qualification scenarios, not available in the previous version\n\n> 👍 Scenario Guide\n>\n> Read our dedicated guide to learn about some use cases this endpoint can cover [here](doc:checking-eligibility).\n\n## Paging \n\nThe 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.\n\nTo process of paging the redeemables works in the following manner:\n\n- You send the first API request for Qualifications without the `starting_after` parameter.\n- The response will contain a parameter named `has_more`. If the parameter's value is set to `true`, then more redeemables are available.\n- 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.\n- 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.\n- Voucherify will return the next page of redeemables.\n- If the `has_more` parameter is set to `true`, apply steps 3-5 to get the next page of redeemables.", + "parameters": [], + "security": [ + { + "X-Client-Application-Id-1": [], + "X-Client-Token-1": [] + } + ], + "requestBody": { + "description": "Define order and customer context.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/23_req_create_qualification" + } + } + } + }, + "responses": { + "200": { + "description": "Returns a qualifications object.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/23_obj_qualification_object" } } } From 1b142142905c8daebec4b234c64daba422284f74 Mon Sep 17 00:00:00 2001 From: weronika-kurczyna <117282008+weronika-kurczyna@users.noreply.github.com> Date: Tue, 17 Oct 2023 13:28:58 +0200 Subject: [PATCH 03/21] list voucher transactions --- Changelog.md | 3 + ...VOUCHERS-API-List-Voucher-Transactions.md} | 4 +- reference/OpenAPI.json | 117 +++++------------- 3 files changed, 37 insertions(+), 87 deletions(-) rename docs/reference-docs/{VOUCHERS-API-List-Gift-Card-Transactions.md => VOUCHERS-API-List-Voucher-Transactions.md} (85%) diff --git a/Changelog.md b/Changelog.md index da4deaaf3..0bb8efb1f 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,5 +1,8 @@ # Changelog +# 20231017 + +- Vouchers - List Gift Card Transactions (**GET** `/vouchers/{code}/transactions`) renamed to List Voucher Transactions ## 20231012 - Product Collections diff --git a/docs/reference-docs/VOUCHERS-API-List-Gift-Card-Transactions.md b/docs/reference-docs/VOUCHERS-API-List-Voucher-Transactions.md similarity index 85% rename from docs/reference-docs/VOUCHERS-API-List-Gift-Card-Transactions.md rename to docs/reference-docs/VOUCHERS-API-List-Voucher-Transactions.md index 0c0946408..d9c3268fd 100644 --- a/docs/reference-docs/VOUCHERS-API-List-Gift-Card-Transactions.md +++ b/docs/reference-docs/VOUCHERS-API-List-Voucher-Transactions.md @@ -1,8 +1,8 @@ --- -title: List Gift Card Transactions +title: List Voucher Transactions type: endpoint categorySlug: voucherify-api -slug: list-gift-card-transactions +slug: list-voucher-transactions parentDocSlug: vouchers-api hidden: false order: 11 diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index dae42e817..68439c889 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -3890,8 +3890,8 @@ } } }, - "1_res_vouchers_code_transactions": { - "title": "Get Gift Card Transactions Response Body", + "vouchers_list_vouchers_transactions_response_body": { + "title": "List Voucher Transactions Response Body", "type": "object", "description": "List of voucher transactions", "properties": { @@ -3909,7 +3909,7 @@ "type": "array", "description": "A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object.", "items": { - "$ref": "#/components/schemas/1_obj_gift_card_transaction_object" + "$ref": "#/components/schemas/gift_card_transaction" } }, "has_more": { @@ -3918,25 +3918,37 @@ } } }, - "1_obj_gift_card_transaction_object": { + "voucher_transaction": { + "title": "Voucher Transaction Object", + "description": "List of voucher transactions", + "anyOf": [ + { + "$ref": "#/components/schemas/gift_card_transaction" + }, + { + "$ref": "#/components/schemas/LoyaltyCardTransaction" + } + ] + }, + "gift_card_transaction": { "title": "Gift Card Transaction Object", - "description": "Gift card transaction object", + "description": "List of gift card transactions", "anyOf": [ { - "$ref": "#/components/schemas/1_obj_gift_card_transaction_object_redemption" + "$ref": "#/components/schemas/gift_card_transaction_redemption_details" }, { - "$ref": "#/components/schemas/1_obj_gift_card_transaction_object_refund" + "$ref": "#/components/schemas/gift_card_transaction_refund_details" }, { - "$ref": "#/components/schemas/1_obj_gift_card_transaction_object_addition" + "$ref": "#/components/schemas/gift_card_transaction_addition_details" }, { - "$ref": "#/components/schemas/1_obj_gift_card_transaction_object_removal" + "$ref": "#/components/schemas/gift_card_transaction_removal_details" } ] }, - "1_obj_gift_card_transaction_object_redemption": { + "gift_card_transaction_redemption_details": { "title": "Redemption", "description": "When credits are used to pay for an order.", "type": "object", @@ -4068,7 +4080,7 @@ } } }, - "1_obj_gift_card_transaction_object_refund": { + "gift_card_transaction_refund_details": { "title": "Refund", "description": "When funds are credited back to a card through a redemption rollback.", "type": "object", @@ -4211,7 +4223,7 @@ } } }, - "1_obj_gift_card_transaction_object_addition": { + "gift_card_transaction_addition_details": { "title": "Addition", "description": "When funds are deposited to a gift card.", "type": "object", @@ -4317,7 +4329,7 @@ } } }, - "1_obj_gift_card_transaction_object_removal": { + "gift_card_transaction_removal_details": { "title": "Removal", "description": "When funds are removed from a gift card.", "type": "object", @@ -39540,9 +39552,6 @@ }, "EarningRuleBase": { "title": "EarningRuleBase", - "x-stoplight": { - "id": "w4ci1ljqva0r1" - }, "type": "object", "properties": { "id": { @@ -39680,9 +39689,6 @@ }, "EarningRuleEvent": { "title": "EarningRuleEvent", - "x-stoplight": { - "id": "6vxql7fnzg2zp" - }, "type": "string", "enum": [ "order.paid", @@ -39697,9 +39703,6 @@ }, "EarningRuleFixed": { "title": "Define fixed amount of points", - "x-stoplight": { - "id": "r5o8m0sdli7fq" - }, "type": "object", "properties": { "type": { @@ -39731,9 +39734,6 @@ }, "EarningRuleProportionalOrderAmount": { "title": "Order Amount", - "x-stoplight": { - "id": "1z7lk7z1lp5af" - }, "type": "object", "properties": { "type": { @@ -39785,9 +39785,6 @@ }, "EarningRuleProportionalOrderTotalAmount": { "title": "Order Total Amount", - "x-stoplight": { - "id": "ekudxr430edgk" - }, "type": "object", "properties": { "type": { @@ -39839,9 +39836,6 @@ }, "EarningRuleProportionalOrderMetadata": { "title": "Order Metadata", - "x-stoplight": { - "id": "4ccw4gz8b47u5" - }, "type": "object", "properties": { "type": { @@ -39899,9 +39893,6 @@ }, "EarningRuleProportionalOrderItemsQuantity": { "title": "Order Items Quantity", - "x-stoplight": { - "id": "pqsn9otpzyot9" - }, "type": "object", "properties": { "type": { @@ -39968,9 +39959,6 @@ }, "EarningRuleProportionalOrderItemsAmount": { "title": "Order Items Amount", - "x-stoplight": { - "id": "8pg4o23daepkb" - }, "type": "object", "properties": { "type": { @@ -40037,9 +40025,6 @@ }, "EarningRuleProportionalOrderItemsSubtotalAmount": { "title": "Order Items Subtotal Amount", - "x-stoplight": { - "id": "duxy5qw36h5ph" - }, "type": "object", "properties": { "type": { @@ -43373,9 +43358,6 @@ }, "LoyaltiesCreateTiersRequestBody": { "title": "Loyalties Create Tiers Request Body", - "x-stoplight": { - "id": "i1emmwlaqp7lt" - }, "type": "array", "items": { "allOf": [ @@ -43396,31 +43378,19 @@ }, "LoyaltiesCreateTiersResponseBody": { "title": "Loyalties Create Tiers Response Body", - "x-stoplight": { - "id": "ix7g5mnuwqsp6" - }, "type": "array", "items": { "$ref": "#/components/schemas/LoyaltyTier" } }, "LoyaltiesGetRewardAssignmentResponseBody": { - "$ref": "#/components/schemas/RewardAssignment", - "x-stoplight": { - "id": "fnbbaq9l1l9it" - } + "$ref": "#/components/schemas/RewardAssignment" }, "LoyaltiesGetRewardDetailsResponseBody": { - "$ref": "#/components/schemas/Reward", - "x-stoplight": { - "id": "44hds9u0hhukf" - } + "$ref": "#/components/schemas/Reward" }, "LoyaltiesListTiersRequestQuery": { "title": "Loyalties List Tiers Request Query", - "x-stoplight": { - "id": "d5sluzqkxu8km" - }, "type": "object", "properties": { "limit": { @@ -43447,9 +43417,6 @@ }, "LoyaltiesListLoyaltyTierEarningRulesRequestQuery": { "title": "LoyaltiesListLoyaltyTierEarningRulesRequestQuery", - "x-stoplight": { - "id": "zs0z1cyyzac9u" - }, "type": "object", "properties": { "limit": { @@ -43465,16 +43432,10 @@ } }, "LoyaltiesGetTierResponseBody": { - "$ref": "#/components/schemas/LoyaltyTier", - "x-stoplight": { - "id": "hzcsijl2b4d5o" - } + "$ref": "#/components/schemas/LoyaltyTier" }, "LoyaltiesListTiersResponseBody": { "title": "Loyalties List Tiers Response Body", - "x-stoplight": { - "id": "kw06g2szvv479" - }, "type": "object", "properties": { "object": { @@ -43512,9 +43473,6 @@ }, "LoyaltiesListMemberLoyaltyTiersResponseBody": { "title": "Loyalties List Member Loyalty Tiers Response Body", - "x-stoplight": { - "id": "s3zpgud510xl6" - }, "type": "object", "properties": { "object": { @@ -43587,9 +43545,6 @@ }, "LoyaltiesListLoyaltyTierEarningRulesResponseBody": { "title": "Loyalties List Loyalty Tier Earning Rules ResponseBody", - "x-stoplight": { - "id": "i180zbh3ffwaa" - }, "type": "object", "properties": { "object": { @@ -43627,9 +43582,6 @@ }, "LoyaltyTierBase": { "title": "Loyalty Tier Base", - "x-stoplight": { - "id": "3af9422223696" - }, "type": "object", "properties": { "name": { @@ -43787,9 +43739,6 @@ }, "MappingMultiply": { "title": "MappingMultiply", - "x-stoplight": { - "id": "7zrwgr2oqh4tj" - }, "type": "object", "properties": { "type": { @@ -43807,9 +43756,6 @@ }, "MappingFixed": { "title": "MappingFixed", - "x-stoplight": { - "id": "86eksegayxcxa" - }, "type": "object", "properties": { "type": { @@ -44846,7 +44792,8 @@ "name", "filter" ] - } + }, + "v": {} }, "examples": { "req_vouchers_metadata_1": { @@ -47716,8 +47663,8 @@ "X-App-Token-1": [] } ], - "summary": "List Gift Card Transactions", - "description": "List transactions that are associated with credit movements on a gift card.", + "summary": "List Voucher Transactions", + "description": "List transactions that are associated with credit movements on a gift card or loyalty card.", "responses": { "200": { "description": "Returns a dictionary of transaction objects", From 17d84433fba73c77595b0ced58ca28bd57e0c92e Mon Sep 17 00:00:00 2001 From: weronika-kurczyna <117282008+weronika-kurczyna@users.noreply.github.com> Date: Tue, 17 Oct 2023 13:38:52 +0200 Subject: [PATCH 04/21] list gift card transactions --- reference/OpenAPI.json | 196 ++++++++++++++--------------------------- 1 file changed, 66 insertions(+), 130 deletions(-) diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index 68439c889..d5385b05e 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -3906,17 +3906,20 @@ "description": "Identifies the name of the attribute that contains the array of transaction objects." }, "data": { - "type": "array", - "description": "A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object.", - "items": { - "$ref": "#/components/schemas/gift_card_transaction" - } + "$ref": "#/components/schemas/voucher_transaction", + "description": "A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object." }, "has_more": { "type": "boolean", "description": "As query results are always limited (by the limit parameter), the `has_more` flag indicates whether there are more records for given filter parameters. This let's you know if you are able to run another request (with a different page or a different start date filter) to get more records returned in the results." } - } + }, + "required": [ + "object", + "data_ref", + "data", + "has_more" + ] }, "voucher_transaction": { "title": "Voucher Transaction Object", @@ -3931,26 +3934,24 @@ ] }, "gift_card_transaction": { - "title": "Gift Card Transaction Object", + "title": "Gift Card Transaction", "description": "List of gift card transactions", - "anyOf": [ + "allOf": [ { - "$ref": "#/components/schemas/gift_card_transaction_redemption_details" + "$ref": "#/components/schemas/gift_card_transaction_identity" }, { - "$ref": "#/components/schemas/gift_card_transaction_refund_details" + "$ref": "#/components/schemas/gift_card_transaction_base" }, { - "$ref": "#/components/schemas/gift_card_transaction_addition_details" + "$ref": "#/components/schemas/gift_card_transaction_response_data" }, { - "$ref": "#/components/schemas/gift_card_transaction_removal_details" + "$ref": "#/components/schemas/gift_card_transaction_details" } ] }, - "gift_card_transaction_redemption_details": { - "title": "Redemption", - "description": "When credits are used to pay for an order.", + "gift_card_transaction_identity": { "type": "object", "properties": { "id": { @@ -3961,7 +3962,12 @@ "source_id": { "type": "string", "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is `null`." - }, + } + } + }, + "gift_card_transaction_base": { + "type": "object", + "properties": { "voucher_id": { "type": "string", "description": "Unique voucher ID.", @@ -3972,6 +3978,49 @@ "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaing that generates bulk codes.", "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" }, + "reason": { + "type": "string", + "description": "Reason why the transaction occurred. In case of a redemption, this value is `null`." + }, + "related_transaction_id": { + "type": "string", + "description": "This field is `null` in the case of gift voucher transactions." + } + } + }, + "gift_card_transaction_response_data": { + "type": "object", + "properties": { + "created_at": { + "type": "string", + "format": "date-time", + "example": "2022-02-25T13:32:08.734Z", + "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." + } + } + }, + "gift_card_transaction_details": { + "type": "object", + "anyOf": [ + { + "$ref": "#/components/schemas/gift_card_transaction_redemption_details" + }, + { + "$ref": "#/components/schemas/gift_card_transaction_refund_details" + }, + { + "$ref": "#/components/schemas/gift_card_transaction_addition_details" + }, + { + "$ref": "#/components/schemas/gift_card_transaction_removal_details" + } + ] + }, + "gift_card_transaction_redemption_details": { + "title": "Redemption", + "description": "When credits are used to pay for an order.", + "type": "object", + "properties": { "source": { "type": "string", "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is `null`.", @@ -3980,10 +4029,6 @@ "API" ] }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred. In case of a redemption, this value is `null`." - }, "type": { "type": "string", "description": "Type of transaction.", @@ -4067,16 +4112,6 @@ } } } - }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of gift voucher transactions." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." } } }, @@ -4085,25 +4120,6 @@ "description": "When funds are credited back to a card through a redemption rollback.", "type": "object", "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption rollback, this value is `null`." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaing that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, "source": { "type": "string", "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption rollback, this value is `null`.", @@ -4112,10 +4128,6 @@ "API" ] }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred. In case of a redemption rollback, this value is `null`." - }, "type": { "type": "string", "description": "Type of transaction.", @@ -4210,16 +4222,6 @@ } } } - }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of gift voucher transactions." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." } } }, @@ -4228,25 +4230,6 @@ "description": "When funds are deposited to a gift card.", "type": "object", "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaing that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, "source": { "type": "string", "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", @@ -4255,10 +4238,6 @@ "API" ] }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred." - }, "type": { "type": "string", "description": "Type of transaction.", @@ -4316,16 +4295,6 @@ } } } - }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of gift voucher transactions." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." } } }, @@ -4334,25 +4303,6 @@ "description": "When funds are removed from a gift card.", "type": "object", "properties": { - "id": { - "type": "string", - "description": "Unique transaction ID.", - "example": "vtx_0c9dccc4d5813e71bd" - }, - "source_id": { - "type": "string", - "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service." - }, - "voucher_id": { - "type": "string", - "description": "Unique voucher ID.", - "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" - }, - "campaign_id": { - "type": "string", - "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaing that generates bulk codes.", - "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" - }, "source": { "type": "string", "description": "The channel through which the transaction took place, whether through the API or the the Dashboard.", @@ -4361,10 +4311,6 @@ "API" ] }, - "reason": { - "type": "string", - "description": "Reason why the transaction occurred." - }, "type": { "type": "string", "description": "Type of transaction.", @@ -4422,16 +4368,6 @@ } } } - }, - "related_transaction_id": { - "type": "string", - "description": "This field is `null` in the case of gift voucher transactions." - }, - "created_at": { - "type": "string", - "format": "date-time", - "example": "2022-02-25T13:32:08.734Z", - "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." } } }, @@ -47671,7 +47607,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/1_res_vouchers_code_transactions" + "$ref": "#/components/schemas/vouchers_list_vouchers_transactions_response_body" }, "examples": { "Example": { From 3aaa83e4f9df83649419d2c54b6da65d2329bd7f Mon Sep 17 00:00:00 2001 From: weronika-kurczyna <117282008+weronika-kurczyna@users.noreply.github.com> Date: Tue, 17 Oct 2023 13:55:03 +0200 Subject: [PATCH 05/21] update gift card --- reference/OpenAPI.json | 269 +++++++++++++++++++++++++++++++++-------- 1 file changed, 221 insertions(+), 48 deletions(-) diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index d5385b05e..79939955c 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -3960,13 +3960,22 @@ "example": "vtx_0c9dccc4d5813e71bd" }, "source_id": { - "type": "string", + "type": [ + "string", + "null" + ], "description": "The merchant’s transaction ID if it is different from the Voucherify transaction ID. It is really useful in case of an integration between multiple systems. It can be a transaction ID from a CRM system, database or 3rd-party service. In case of a redemption, this value is `null`." } - } + }, + "required": [ + "id", + "source_id" + ], + "title": "Gift Card Transaction Identity" }, "gift_card_transaction_base": { "type": "object", + "title": "Gift Card Transaction Base", "properties": { "voucher_id": { "type": "string", @@ -3974,22 +3983,38 @@ "example": "v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp" }, "campaign_id": { - "type": "string", + "type": [ + "string", + "null" + ], "description": "Unqiue campaign ID of the voucher's parent campaign if it is part of campaing that generates bulk codes.", "example": "camp_FNYR4jhqZBM9xTptxDGgeNBV" }, "reason": { - "type": "string", + "type": [ + "string", + "null" + ], "description": "Reason why the transaction occurred. In case of a redemption, this value is `null`." }, "related_transaction_id": { - "type": "string", + "type": [ + "string", + "null" + ], "description": "This field is `null` in the case of gift voucher transactions." } - } + }, + "required": [ + "voucher_id", + "campaign_id", + "reason", + "related_transaction_id" + ] }, "gift_card_transaction_response_data": { "type": "object", + "title": "Gift Card Transaction Response Data", "properties": { "created_at": { "type": "string", @@ -3997,7 +4022,10 @@ "example": "2022-02-25T13:32:08.734Z", "description": "Timestamp representing the date and time when the transaction was created in ISO 8601 format." } - } + }, + "required": [ + "created_at" + ] }, "gift_card_transaction_details": { "type": "object", @@ -4014,7 +4042,8 @@ { "$ref": "#/components/schemas/gift_card_transaction_removal_details" } - ] + ], + "title": "Gift Card Transaction Details" }, "gift_card_transaction_redemption_details": { "title": "Redemption", @@ -4022,11 +4051,10 @@ "type": "object", "properties": { "source": { - "type": "string", "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption, this value is `null`.", - "enum": [ - "voucherify-web-ui", - "API" + "type": [ + "string", + "null" ] }, "type": { @@ -4040,15 +4068,30 @@ "details": { "type": "object", "description": "Contains the detailed information about the transaction.", + "required": [ + "balance", + "order", + "redemption" + ], "properties": { "balance": { "type": "object", "description": "Contains information on how the balance was affected by the transaction.", + "required": [ + "type", + "total", + "amount", + "object", + "balance", + "related_object" + ], "properties": { "type": { - "type": "string", "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "gift_voucher" + "default": "gift_voucher", + "enum": [ + "gift_voucher" + ] }, "total": { "type": "integer", @@ -4059,9 +4102,11 @@ "description": "The amount being used up by the redemption. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." }, "object": { - "type": "string", "description": "The type of object represented by the JSON.", - "default": "balance" + "default": "balance", + "enum": [ + "balance" + ] }, "balance": { "type": "integer", @@ -4070,6 +4115,10 @@ "related_object": { "type": "object", "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "required": [ + "id", + "type" + ], "properties": { "id": { "type": "string", @@ -4077,9 +4126,11 @@ "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" }, "type": { - "type": "string", "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" + "default": "voucher", + "enum": [ + "voucher" + ] } } } @@ -4088,6 +4139,10 @@ "order": { "type": "object", "description": "Contains information about the original order.", + "required": [ + "id", + "source_id" + ], "properties": { "id": { "type": "string", @@ -4095,7 +4150,10 @@ "example": "ord_jj5EzDxDOd2xFPsAJJ18IaZK" }, "source_id": { - "type": "string", + "type": [ + "string", + "null" + ], "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." } } @@ -4103,6 +4161,9 @@ "redemption": { "type": "object", "description": "Contains information about the original redemption.", + "required": [ + "id" + ], "properties": { "id": { "type": "string", @@ -4113,7 +4174,12 @@ } } } - } + }, + "required": [ + "source", + "type", + "details" + ] }, "gift_card_transaction_refund_details": { "title": "Refund", @@ -4121,12 +4187,11 @@ "type": "object", "properties": { "source": { - "type": "string", - "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption rollback, this value is `null`.", - "enum": [ - "voucherify-web-ui", - "API" - ] + "type": [ + "string", + "null" + ], + "description": "The channel through which the transaction took place, whether through the API or the the Dashboard. In case of a redemption rollback, this value is `null`." }, "type": { "type": "string", @@ -4139,15 +4204,31 @@ "details": { "type": "object", "description": "Contains the detailed information about the transaction.", + "required": [ + "balance", + "order", + "redemption", + "rollback" + ], "properties": { "balance": { "type": "object", "description": "Contains information on how the balance was affected by the transaction.", + "required": [ + "type", + "total", + "amount", + "object", + "balance", + "related_object" + ], "properties": { "type": { - "type": "string", "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "gift_voucher" + "default": "gift_voucher", + "enum": [ + "gift_voucher" + ] }, "total": { "type": "integer", @@ -4158,9 +4239,11 @@ "description": "The amount being returned. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." }, "object": { - "type": "string", "description": "The type of object represented by the JSON.", - "default": "balance" + "default": "balance", + "enum": [ + "balance" + ] }, "balance": { "type": "integer", @@ -4169,6 +4252,10 @@ "related_object": { "type": "object", "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "required": [ + "id", + "type" + ], "properties": { "id": { "type": "string", @@ -4176,9 +4263,11 @@ "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" }, "type": { - "type": "string", "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" + "default": "voucher", + "enum": [ + "voucher" + ] } } } @@ -4187,6 +4276,10 @@ "order": { "type": "object", "description": "Contains information about the original order.", + "required": [ + "id", + "source_id" + ], "properties": { "id": { "type": "string", @@ -4194,7 +4287,10 @@ "example": "ord_jj5EzDxDOd2xFPsAJJ18IaZK" }, "source_id": { - "type": "string", + "type": [ + "string", + "null" + ], "description": "The merchant’s order ID if it is different from the Voucherify order ID. It is really useful in case of integration between multiple systems. It can be an order ID from CRM, database or 3rd party service." } } @@ -4202,6 +4298,9 @@ "redemption": { "type": "object", "description": "Contains information about the original redemption.", + "required": [ + "id" + ], "properties": { "id": { "type": "string", @@ -4213,6 +4312,9 @@ "rollback": { "type": "object", "description": "Contains information about the redemption rollback.", + "required": [ + "id" + ], "properties": { "id": { "type": "string", @@ -4223,7 +4325,12 @@ } } } - } + }, + "required": [ + "source", + "type", + "details" + ] }, "gift_card_transaction_addition_details": { "title": "Addition", @@ -4249,15 +4356,29 @@ "details": { "type": "object", "description": "Contains the detailed information about the transaction.", + "required": [ + "balance" + ], "properties": { "balance": { "type": "object", "description": "Contains information on how the balance was affected by the transaction.", + "required": [ + "type", + "total", + "amount", + "object", + "balance", + "related_object", + "operation_type" + ], "properties": { "type": { - "type": "string", "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "gift_voucher" + "default": "gift_voucher", + "enum": [ + "gift_voucher" + ] }, "total": { "type": "integer", @@ -4268,9 +4389,11 @@ "description": "The amount being added. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." }, "object": { - "type": "string", "description": "The type of object represented by the JSON.", - "default": "balance" + "default": "balance", + "enum": [ + "balance" + ] }, "balance": { "type": "integer", @@ -4279,6 +4402,10 @@ "related_object": { "type": "object", "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "required": [ + "id", + "type" + ], "properties": { "id": { "type": "string", @@ -4286,17 +4413,30 @@ "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" }, "type": { - "type": "string", "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" + "default": "voucher", + "enum": [ + "voucher" + ] } } + }, + "operation_type": { + "enum": [ + "MANUAL", + "AUTOMATIC" + ] } } } } } - } + }, + "required": [ + "source", + "type", + "details" + ] }, "gift_card_transaction_removal_details": { "title": "Removal", @@ -4322,15 +4462,29 @@ "details": { "type": "object", "description": "Contains the detailed information about the transaction.", + "required": [ + "balance" + ], "properties": { "balance": { "type": "object", "description": "Contains information on how the balance was affected by the transaction.", + "required": [ + "type", + "total", + "amount", + "object", + "balance", + "related_object", + "operation_type" + ], "properties": { "type": { - "type": "string", "description": "The type of voucher whose balance is being adjusted due to the transaction.", - "default": "gift_voucher" + "default": "gift_voucher", + "enum": [ + "gift_voucher" + ] }, "total": { "type": "integer", @@ -4341,9 +4495,11 @@ "description": "The amount being subtracted. Value is multiplied by 100 to precisely represent 2 decimal places. For example, $100 amount is written as 10000." }, "object": { - "type": "string", "description": "The type of object represented by the JSON.", - "default": "balance" + "default": "balance", + "enum": [ + "balance" + ] }, "balance": { "type": "integer", @@ -4352,6 +4508,10 @@ "related_object": { "type": "object", "description": "Defines the resource that is being modified with the values that are returned in the balance object.", + "required": [ + "id", + "type" + ], "properties": { "id": { "type": "string", @@ -4359,17 +4519,30 @@ "example": "v_4Bd3aX7eXjHbe7Ef7on8YsLWBynsT4jq" }, "type": { - "type": "string", "description": "The object being modified, i.e. `voucher`.", - "default": "voucher" + "default": "voucher", + "enum": [ + "voucher" + ] } } + }, + "operation_type": { + "enum": [ + "MANUAL", + "AUTOMATIC" + ] } } } } } - } + }, + "required": [ + "source", + "type", + "details" + ] }, "1_req_create_gift_card_transactions_export": { "type": "object", From df3c7fde7a5dc6ebf7d104d7876629c2b5cc6e98 Mon Sep 17 00:00:00 2001 From: weronika-kurczyna <117282008+weronika-kurczyna@users.noreply.github.com> Date: Wed, 18 Oct 2023 08:45:17 +0200 Subject: [PATCH 06/21] export voucher transactions --- Changelog.md | 1 + ...UCHERS-API-Export-Voucher-Transactions.md} | 4 +- reference/OpenAPI.json | 107 +++++++++--------- 3 files changed, 58 insertions(+), 54 deletions(-) rename docs/reference-docs/{VOUCHERS-API-Export-Gift-Card-Transactions.md => VOUCHERS-API-Export-Voucher-Transactions.md} (84%) diff --git a/Changelog.md b/Changelog.md index 0bb8efb1f..198087fb4 100644 --- a/Changelog.md +++ b/Changelog.md @@ -3,6 +3,7 @@ # 20231017 - Vouchers - List Gift Card Transactions (**GET** `/vouchers/{code}/transactions`) renamed to List Voucher Transactions +- Vouchers - Export Gift Card Transactions (**GET** `/vouchers/{code}/transactions/export`) renamed to Export Voucher Transactions ## 20231012 - Product Collections diff --git a/docs/reference-docs/VOUCHERS-API-Export-Gift-Card-Transactions.md b/docs/reference-docs/VOUCHERS-API-Export-Voucher-Transactions.md similarity index 84% rename from docs/reference-docs/VOUCHERS-API-Export-Gift-Card-Transactions.md rename to docs/reference-docs/VOUCHERS-API-Export-Voucher-Transactions.md index a8ae97057..d5c9a8d9e 100644 --- a/docs/reference-docs/VOUCHERS-API-Export-Gift-Card-Transactions.md +++ b/docs/reference-docs/VOUCHERS-API-Export-Voucher-Transactions.md @@ -1,8 +1,8 @@ --- -title: Export Gift Card Transactions +title: Export Voucher Transactions type: endpoint categorySlug: voucherify-api -slug: export-gift-card-transactions +slug: export-voucher-transactions parentDocSlug: vouchers-api hidden: false order: 12 diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index 79939955c..cad605e16 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -4544,18 +4544,18 @@ "details" ] }, - "1_req_create_gift_card_transactions_export": { + "vouchers_export_transactions_request_body": { "type": "object", "title": "Create Gift Card Transactions Export Request Body", "description": "Request body schema for **POST** `/vouchers/transactions/export`.", "properties": { "parameters": { - "$ref": "#/components/schemas/1_obj_export_gift_card_transactions", + "$ref": "#/components/schemas/voucher_transactions_export", "description": "Contains the parameters that define the data to be exported." } } }, - "1_obj_export_gift_card_transactions": { + "voucher_transactions_export_parameters": { "description": "List of available fields and filters that can be exported with a gift card transactions export along with the sorting order of the returned data.", "title": "Export Transactions", "type": "object", @@ -4571,19 +4571,7 @@ "fields": { "type": "array", "enum": [ - [ - "id", - "type", - "source_id", - "reason", - "balance", - "amount", - "created_at", - "voucher_id", - "campaign_id", - "source", - "details" - ] + "id,type,source_id,reason,balance,amount,created_at,voucher_id,campaign_id,source,details,related_transaction_id" ], "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
                                  - `CREDITS_ADDITION`
                                  - `CREDITS_REFUND`
                                  - `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |", "items": { @@ -4592,7 +4580,7 @@ } } }, - "1_obj_export_transactions_object": { + "voucher_transactions_export": { "title": "Export Object", "type": "object", "description": "This is an object representing an export. \n\n Using this endpoint, you can export [gift card transactions](ref:list-gift-card-transactions) as a CSV file. This functionality works asynchronously and comes down to the following steps: \n* create an export object and return its `id` so you can track its `status`\n* trigger a CSV file generation, change the status to `SCHEDULED`\n* when the generation is over, store the file in S3 and change the `status` to `DONE`\n* now you can (ref:download-export) it\n\nWith `parameters` you can select which `fields` will be exported. An export request will almost always result in a single file being generated by the system. However, when your volume of data is large, the system may split the results into multiple chunks.", @@ -4603,9 +4591,11 @@ "example": "exp_FFfp9o7daWuJqJCKp5xqqli4" }, "object": { - "type": "string", "default": "export", - "description": "The type of object being represented. This object stores information about the `export`." + "description": "The type of object being represented. This object stores information about the `export`.", + "enum": [ + "export" + ] }, "created_at": { "type": "string", @@ -4617,10 +4607,7 @@ "type": "string", "description": "Status of the export. Informs you whether the export has already been completed, i.e. indicates whether the file containing the exported data has been generated.", "enum": [ - "SCHEDULED", - "IN_PROGRESS", - "DONE", - "ERROR" + "SCHEDULED" ] }, "channel": { @@ -4629,16 +4616,24 @@ "default": "API" }, "exported_object": { - "type": "string", "description": "The type of exported object.", - "default": "voucher_transactions" + "default": "voucher_transactions", + "enum": [ + "voucher_transactions" + ] }, "parameters": { "$ref": "#/components/schemas/16_obj_export_gift_card_transactions" }, "result": { - "type": "object", + "type": [ + "object", + "null" + ], "description": "Contains the URL of the CSV file.", + "required": [ + "url" + ], "properties": { "url": { "type": "string", @@ -4647,11 +4642,25 @@ } }, "user_id": { - "type": "string", + "type": [ + "string", + "null" + ], "description": "Identifies the specific user who initiated the export through the Voucherify Dashboard; returned when the `channel` value is `WEBSITE`.", "example": "user_g24UoRO3Caxu7FCT4n5tpYEa3zUG0FrH" } - } + }, + "required": [ + "id", + "object", + "created_at", + "status", + "channel", + "exported_object", + "parameters", + "result", + "user_id" + ] }, "1_req_vouchers_import": { "title": "Import Vouchers Request Body", @@ -35763,8 +35772,8 @@ } }, "16_obj_export_gift_card_transactions": { - "description": "List of available fields and filters that can be exported with gift card transactions along with the sorting order of the returned data.", - "title": "gift card transactions", + "description": "List of available fields and filters that can be exported with gift card or loyalty card transactions along with the sorting order of the returned data.", + "title": "Voucher Transactions", "type": "object", "properties": { "order": { @@ -35778,19 +35787,7 @@ "fields": { "type": "array", "enum": [ - [ - "id", - "type", - "source_id", - "reason", - "balance", - "amount", - "created_at", - "voucher_id", - "campaign_id", - "source", - "details" - ] + "id,type,source_id,reason,balance,amount,created_at,voucher_id,campaign_id,source,details,related_transaction_id" ], "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
                                  - `CREDITS_ADDITION`
                                  - `CREDITS_REFUND`
                                  - `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |", "items": { @@ -35798,9 +35795,12 @@ } }, "filters": { - "$ref": "#/components/schemas/16_obj_filter_gift_card_transactions_voucher_id" + "$ref": "#/components/schemas/voucher_transactions_export_filter_conditions" } - } + }, + "required": [ + "filters" + ] }, "16_obj_export_loyalty_card_transactions": { "description": "List of available fields and filters that can be exported with loyalty card transactions along with the sorting order of the returned data.", @@ -36076,7 +36076,7 @@ } } }, - "16_obj_filter_gift_card_transactions_voucher_id": { + "voucher_transactions_export_filter_conditions": { "description": "Filter conditions set on`the `voucher_id`.", "title": "Filter by voucher ID", "type": "object", @@ -36087,7 +36087,10 @@ "junction": { "$ref": "#/components/schemas/16_filter_junction" } - } + }, + "required": [ + "voucher_id" + ] }, "16_obj_filter_loyalty_card_transactions_voucher_id": { "description": "Filter conditions set on`the `voucher_id`.", @@ -48052,7 +48055,7 @@ } ], "post": { - "operationId": "export-gift-card-transactions", + "operationId": "export-voucher-transactions", "tags": [ "VOUCHERS API" ], @@ -48063,14 +48066,14 @@ "X-App-Token-1": [] } ], - "summary": "Export Gift Card Transactions", - "description": "Export transactions that are associated with credit movements on a gift card.\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
                                  - `CREDITS_ADDITION`
                                  - `CREDITS_REFUND`
                                  - `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |", + "summary": "Export Voucher Transactions", + "description": "Export transactions that are associated with credit movements on a gift card or loyalty card.\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
                                  - `CREDITS_ADDITION`
                                  - `CREDITS_REFUND`
                                  - `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |", "requestBody": { "description": "Specify the parameters for the transaction export.", "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/1_req_create_gift_card_transactions_export" + "$ref": "#/components/schemas/vouchers_export_transactions_request_body" }, "examples": { "Example": { @@ -48103,7 +48106,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/1_obj_export_transactions_object" + "$ref": "#/components/schemas/voucher_transactions_export" }, "examples": { "Example": { From cbea76c1b3efe8ac7ed7b3709389d5f029fcd951 Mon Sep 17 00:00:00 2001 From: weronika-kurczyna <117282008+weronika-kurczyna@users.noreply.github.com> Date: Wed, 18 Oct 2023 08:56:49 +0200 Subject: [PATCH 07/21] Update OpenAPI.json --- reference/OpenAPI.json | 50 +++++------------------------------------- 1 file changed, 6 insertions(+), 44 deletions(-) diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index cad605e16..9a80e9f5d 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -4556,7 +4556,7 @@ } }, "voucher_transactions_export_parameters": { - "description": "List of available fields and filters that can be exported with a gift card transactions export along with the sorting order of the returned data.", + "description": "List of available fields and filters that can be exported with a gift card or loyalty card transactions export along with the sorting order of the returned data.", "title": "Export Transactions", "type": "object", "properties": { @@ -4623,7 +4623,7 @@ ] }, "parameters": { - "$ref": "#/components/schemas/16_obj_export_gift_card_transactions" + "$ref": "#/components/schemas/voucher_transactions_filters" }, "result": { "type": [ @@ -24603,49 +24603,11 @@ "description": "Request body schema for **POST** `/loyalties/members/{memberId}/transactions/export`.", "properties": { "parameters": { - "$ref": "#/components/schemas/8_obj_export_loyalty_card_transactions", + "$ref": "#/components/schemas/voucher_transactions_export_parameters", "description": "Contains the parameters that define the data to be exported." } } }, - "8_obj_export_loyalty_card_transactions": { - "description": "List of available fields and filters that can be exported with a loyalty card transactions export along with the sorting order of the returned data.", - "title": "Export Transactions", - "type": "object", - "properties": { - "order": { - "type": "string", - "description": "How the export is filtered, where the dash `-` preceding a sorting option means sorting in a descending order.", - "enum": [ - "-created_at", - "created_at" - ] - }, - "fields": { - "type": "array", - "enum": [ - [ - "id", - "type", - "source_id", - "reason", - "balance", - "amount", - "created_at", - "voucher_id", - "campaign_id", - "source", - "details", - "related_transaction_id" - ] - ], - "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID assigned by Voucherify. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `POINTS_EXPIRATION`
                                  - `POINTS_ADDITION`
                                  - `POINTS_REMOVAL`
                                  - `POINTS_TRANSFER_OUT`
                                  - `POINTS_ACCRUAL`
                                  - `POINTS_REFUND`
                                  - `POINTS_REDEMPTION` |\n| source_id | Custom source ID of the transaction if one was included originally. | source_id_custom |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The loyalty card balance after the transaction. | |\n| amount | The amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | - `API`
                                  - `voucherify-web-ui`
                                  - `Automation` |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n| related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |", - "items": { - "type": "string" - } - } - } - }, "8_obj_export_transactions_object": { "title": "Export Object", "type": "object", @@ -35294,7 +35256,7 @@ "$ref": "#/components/schemas/16_obj_export_points_expiration" }, { - "$ref": "#/components/schemas/16_obj_export_gift_card_transactions" + "$ref": "#/components/schemas/voucher_transactions_filters" }, { "$ref": "#/components/schemas/16_obj_export_loyalty_card_transactions" @@ -35386,7 +35348,7 @@ "$ref": "#/components/schemas/16_obj_export_points_expiration" }, { - "$ref": "#/components/schemas/16_obj_export_gift_card_transactions" + "$ref": "#/components/schemas/voucher_transactions_filters" }, { "$ref": "#/components/schemas/16_obj_export_loyalty_card_transactions" @@ -35771,7 +35733,7 @@ } } }, - "16_obj_export_gift_card_transactions": { + "voucher_transactions_filters": { "description": "List of available fields and filters that can be exported with gift card or loyalty card transactions along with the sorting order of the returned data.", "title": "Voucher Transactions", "type": "object", From 11030962aa842237e9b04afe45f6909eb8752dd5 Mon Sep 17 00:00:00 2001 From: weronika-kurczyna <117282008+weronika-kurczyna@users.noreply.github.com> Date: Wed, 18 Oct 2023 09:34:11 +0200 Subject: [PATCH 08/21] validation rules assignments --- reference/OpenAPI.json | 42 +++++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index 9a80e9f5d..da6f58dc7 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -9198,7 +9198,7 @@ "description": "The type of object represented by JSON. This object stores information about the promotion tier." }, "validation_rule_assignments": { - "$ref": "#/components/schemas/13_res_validation-rules_validationRuleId_assignments" + "$ref": "#/components/schemas/validation_rules_list_rules_assignments_response_body" }, "category_id": { "type": "string", @@ -34760,8 +34760,8 @@ } } }, - "13_obj_validation_rule_assignment_object": { - "title": "Validation Rule Assignment Object", + "validation_rule_assignment": { + "title": "Validation Rule Assignment", "type": "object", "description": "This is an object representing a validation rule assignment. \n\nThis object stores an assignment of a: \n- [voucher](ref:get-voucher)\n- [campaign](ref:get-campaign)\n- [earning rule](ref:get-earning-rule)\n- [reward assignment](ref:get-reward-assignment)\n- [promotion tier](ref:list-promotion-tiers)\n- [publication](ref:list-publications)", "x-tags": [ @@ -34802,13 +34802,23 @@ "format": "date-time" }, "object": { - "type": "string", "default": "validation_rules_assignment", - "description": "The type of object represented by the ID." + "description": "The type of object represented by the ID.", + "enum": [ + "validation_rules_assignment" + ] } - } + }, + "required": [ + "id", + "rule_id", + "related_object_id", + "related_object_type", + "created_at", + "object" + ] }, - "13_res_validation-rules_validationRuleId_assignments": { + "validation_rules_list_rules_assignments_response_body": { "type": "object", "description": "Validation Rule Assignments", "title": "Validation Rule Assignments", @@ -34827,14 +34837,20 @@ "type": "array", "description": "A dictionary that contains an array of validation rule assignments.", "items": { - "$ref": "#/components/schemas/13_obj_validation_rule_assignment_object" + "$ref": "#/components/schemas/validation_rule_assignment" } }, "total": { "type": "integer", "description": "Total number of validation rule assignments." } - } + }, + "required": [ + "object", + "data_ref", + "data", + "total" + ] }, "13_req_create_validation_rule_assignments": { "description": "Respone body schema for **POST** `/validation-rules/{validationRuleId}/assignments`.", @@ -81031,7 +81047,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/13_obj_validation_rule_assignment_object" + "$ref": "#/components/schemas/validation_rule_assignment" } } } @@ -81858,7 +81874,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/13_res_validation-rules_validationRuleId_assignments" + "$ref": "#/components/schemas/validation_rules_list_rules_assignments_response_body" }, "examples": { "Example": { @@ -81984,7 +82000,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/13_res_validation-rules_validationRuleId_assignments" + "$ref": "#/components/schemas/validation_rules_list_rules_assignments_response_body" }, "examples": { "Example": { @@ -82081,7 +82097,7 @@ "content": { "application/json": { "schema": { - "$ref": "#/components/schemas/13_obj_validation_rule_assignment_object" + "$ref": "#/components/schemas/validation_rule_assignment" }, "examples": { "Example": { From c18db1129209d64f6f1569c03cc4c22e6cfecb2d Mon Sep 17 00:00:00 2001 From: weronika-kurczyna <117282008+weronika-kurczyna@users.noreply.github.com> Date: Wed, 18 Oct 2023 09:50:47 +0200 Subject: [PATCH 09/21] update md-tables --- docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md | 6 +++--- docs/reference-docs/PROMOTIONS-API-Promotion-Tier-Object.md | 6 +++--- .../STACKABLE-DISCOUNTS-API-Stackable-Redemptions-Object.md | 6 +++--- ...ALIDATION-RULES-API-Validation-Rule-Assignment-Object.md | 4 ++-- reference/OpenAPI.json | 2 +- scripts/md-tables.ts | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md b/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md index aad809190..d909455cb 100644 --- a/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md +++ b/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md @@ -194,7 +194,7 @@ order: 1 |:-----|:--------| | object
                                  `string` |

                                  The type of object represented by JSON. This object stores information about validation rule assignments.

                                  | | data_ref
                                  `string` |

                                  Identifies the name of the JSON property that contains the array of validation rule assignments.

                                  | -| data
                                  `array` |

                                  A dictionary that contains an array of validation rule assignments.

                                  Array of [Validation Rule Assignment Object](#validation-rule-assignment-object) | +| data
                                  `array` |

                                  A dictionary that contains an array of validation rule assignments.

                                  Array of [Validation Rule Assignment](#validation-rule-assignment) | | total
                                  `integer` |

                                  Total number of validation rule assignments.

                                  | ## Calendar Periods @@ -211,7 +211,7 @@ order: 1 | unit
                                  `string` |

                                  Defines the type of unit of time in which the rounding period is counted.

                                  Available values: `MONTH` | | value
                                  `integer` |

                                  Value for the unit of time that the rounding applies to. Units for this parameter are defined by the rounding.unit parameter.

                                  • 0: January
                                  • 1: February
                                  • 2: March
                                  • 3: April
                                  • 4: May
                                  • 5: June
                                  • 6: July
                                  • 7: August
                                  • 8: September
                                  • 9: October
                                  • 10: November
                                  • 11: December
                                  | -## Validation Rule Assignment Object +## Validation Rule Assignment | Attributes | Description | |:-----|:--------| | id
                                  `string` |

                                  Validation rule assignment ID.

                                  **Example:**

                                  asgm_74F7QZoYbUoljwQO

                                  | @@ -219,7 +219,7 @@ order: 1 | related_object_id
                                  `string` |

                                  The resource ID to which the validation rule was assigned.

                                  **Example:**

                                  v_JtWunK6jUo7X2qOFj0SyRHq4p9tgENlT

                                  | | related_object_type
                                  `string` |

                                  The type of resource to which the validation rule was assigned.

                                  Available values: `voucher`, `campaign`, `earning_rule`, `reward_assignment`, `promotion_tier`, `distribution` | | created_at
                                  `string` |

                                  Timestamp representing the date and time when the validation rule assignment was created in ISO 8601 format.

                                  **Example:**

                                  2022-02-17T08:18:15.085Z

                                  | -| object
                                  `string` |

                                  The type of object represented by the ID.

                                  | +| object |

                                  The type of object represented by the ID.

                                  Available values: `validation_rules_assignment` | [block:html] { diff --git a/docs/reference-docs/PROMOTIONS-API-Promotion-Tier-Object.md b/docs/reference-docs/PROMOTIONS-API-Promotion-Tier-Object.md index 747fe1737..c60c6e87e 100644 --- a/docs/reference-docs/PROMOTIONS-API-Promotion-Tier-Object.md +++ b/docs/reference-docs/PROMOTIONS-API-Promotion-Tier-Object.md @@ -88,7 +88,7 @@ order: 1 |:-----|:--------| | object
                                  `string` |

                                  The type of object represented by JSON. This object stores information about validation rule assignments.

                                  | | data_ref
                                  `string` |

                                  Identifies the name of the JSON property that contains the array of validation rule assignments.

                                  | -| data
                                  `array` |

                                  A dictionary that contains an array of validation rule assignments.

                                  Array of [Validation Rule Assignment Object](#validation-rule-assignment-object) | +| data
                                  `array` |

                                  A dictionary that contains an array of validation rule assignments.

                                  Array of [Validation Rule Assignment](#validation-rule-assignment) | | total
                                  `integer` |

                                  Total number of validation rule assignments.

                                  | ## Category Object @@ -101,7 +101,7 @@ order: 1 | updated_at
                                  `string` |

                                  Timestamp representing the date and time when the category was updated in ISO 8601 format.

                                  **Example:**

                                  2022-08-16T10:52:08.094Z

                                  | | object
                                  `string` |

                                  The type of object represented by the JSON. This object stores information about the category.

                                  | -## Validation Rule Assignment Object +## Validation Rule Assignment | Attributes | Description | |:-----|:--------| | id
                                  `string` |

                                  Validation rule assignment ID.

                                  **Example:**

                                  asgm_74F7QZoYbUoljwQO

                                  | @@ -109,7 +109,7 @@ order: 1 | related_object_id
                                  `string` |

                                  The resource ID to which the validation rule was assigned.

                                  **Example:**

                                  v_JtWunK6jUo7X2qOFj0SyRHq4p9tgENlT

                                  | | related_object_type
                                  `string` |

                                  The type of resource to which the validation rule was assigned.

                                  Available values: `voucher`, `campaign`, `earning_rule`, `reward_assignment`, `promotion_tier`, `distribution` | | created_at
                                  `string` |

                                  Timestamp representing the date and time when the validation rule assignment was created in ISO 8601 format.

                                  **Example:**

                                  2022-02-17T08:18:15.085Z

                                  | -| object
                                  `string` |

                                  The type of object represented by the ID.

                                  | +| object |

                                  The type of object represented by the ID.

                                  Available values: `validation_rules_assignment` | [block:html] { diff --git a/docs/reference-docs/STACKABLE-DISCOUNTS-API-Stackable-Redemptions-Object.md b/docs/reference-docs/STACKABLE-DISCOUNTS-API-Stackable-Redemptions-Object.md index 30b3ff6b7..99e03545e 100644 --- a/docs/reference-docs/STACKABLE-DISCOUNTS-API-Stackable-Redemptions-Object.md +++ b/docs/reference-docs/STACKABLE-DISCOUNTS-API-Stackable-Redemptions-Object.md @@ -403,7 +403,7 @@ One of: |:-----|:--------| | object
                                  `string` |

                                  The type of object represented by JSON. This object stores information about validation rule assignments.

                                  | | data_ref
                                  `string` |

                                  Identifies the name of the JSON property that contains the array of validation rule assignments.

                                  | -| data
                                  `array` |

                                  A dictionary that contains an array of validation rule assignments.

                                  Array of [Validation Rule Assignment Object](#validation-rule-assignment-object) | +| data
                                  `array` |

                                  A dictionary that contains an array of validation rule assignments.

                                  Array of [Validation Rule Assignment](#validation-rule-assignment) | | total
                                  `integer` |

                                  Total number of validation rule assignments.

                                  | ## Unstacked Redemption @@ -411,7 +411,7 @@ One of: |:-----|:--------| | redemption_ID
                                  `object` |

                                  The property name is the unique redemption ID; i.e. r_0ba186c4824e4881e1. This object contains information about the redemption of an incentive.

                                  AttributesDescription
                                  date
                                  string

                                  Timestamp representing the date and time when the redemption was created in ISO 8601 format.

                                  Example:

                                  2022-09-02T17:06:56.649Z

                                  related_object_type
                                  string

                                  The source of the incentive.

                                  Available values: voucher, promotion_tier
                                  related_object_id
                                  string

                                  Unique ID of the related object that defines the incentive.

                                  related_object_parent_id
                                  string

                                  Represent's the campaign ID of the voucher if the redemption was based on a voucher that was part of bulk codes generated within a campaign. In case of a promotion tier, this represents the campaign ID of the promotion tier's parent campaign.

                                  | -## Validation Rule Assignment Object +## Validation Rule Assignment | Attributes | Description | |:-----|:--------| | id
                                  `string` |

                                  Validation rule assignment ID.

                                  **Example:**

                                  asgm_74F7QZoYbUoljwQO

                                  | @@ -419,7 +419,7 @@ One of: | related_object_id
                                  `string` |

                                  The resource ID to which the validation rule was assigned.

                                  **Example:**

                                  v_JtWunK6jUo7X2qOFj0SyRHq4p9tgENlT

                                  | | related_object_type
                                  `string` |

                                  The type of resource to which the validation rule was assigned.

                                  Available values: `voucher`, `campaign`, `earning_rule`, `reward_assignment`, `promotion_tier`, `distribution` | | created_at
                                  `string` |

                                  Timestamp representing the date and time when the validation rule assignment was created in ISO 8601 format.

                                  **Example:**

                                  2022-02-17T08:18:15.085Z

                                  | -| object
                                  `string` |

                                  The type of object represented by the ID.

                                  | +| object |

                                  The type of object represented by the ID.

                                  Available values: `validation_rules_assignment` | [block:html] { diff --git a/docs/reference-docs/VALIDATION-RULES-API-Validation-Rule-Assignment-Object.md b/docs/reference-docs/VALIDATION-RULES-API-Validation-Rule-Assignment-Object.md index 64c763d7b..239083436 100644 --- a/docs/reference-docs/VALIDATION-RULES-API-Validation-Rule-Assignment-Object.md +++ b/docs/reference-docs/VALIDATION-RULES-API-Validation-Rule-Assignment-Object.md @@ -8,7 +8,7 @@ hidden: false order: 2 --- -## Validation Rule Assignment Object +## Validation Rule Assignment | Attributes | Description | |:-----|:--------| | id
                                  `string` |

                                  Validation rule assignment ID.

                                  **Example:**

                                  asgm_74F7QZoYbUoljwQO

                                  | @@ -16,7 +16,7 @@ order: 2 | related_object_id
                                  `string` |

                                  The resource ID to which the validation rule was assigned.

                                  **Example:**

                                  v_JtWunK6jUo7X2qOFj0SyRHq4p9tgENlT

                                  | | related_object_type
                                  `string` |

                                  The type of resource to which the validation rule was assigned.

                                  Available values: `voucher`, `campaign`, `earning_rule`, `reward_assignment`, `promotion_tier`, `distribution` | | created_at
                                  `string` |

                                  Timestamp representing the date and time when the validation rule assignment was created in ISO 8601 format.

                                  **Example:**

                                  2022-02-17T08:18:15.085Z

                                  | -| object
                                  `string` |

                                  The type of object represented by the ID.

                                  | +| object |

                                  The type of object represented by the ID.

                                  Available values: `validation_rules_assignment` | [block:html] { diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index da6f58dc7..e626c3ae6 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -4581,7 +4581,7 @@ } }, "voucher_transactions_export": { - "title": "Export Object", + "title": "Export", "type": "object", "description": "This is an object representing an export. \n\n Using this endpoint, you can export [gift card transactions](ref:list-gift-card-transactions) as a CSV file. This functionality works asynchronously and comes down to the following steps: \n* create an export object and return its `id` so you can track its `status`\n* trigger a CSV file generation, change the status to `SCHEDULED`\n* when the generation is over, store the file in S3 and change the `status` to `DONE`\n* now you can (ref:download-export) it\n\nWith `parameters` you can select which `fields` will be exported. An export request will almost always result in a single file being generated by the system. However, when your volume of data is large, the system may split the results into multiple chunks.", "properties": { diff --git a/scripts/md-tables.ts b/scripts/md-tables.ts index 48f4506f1..ae788b855 100644 --- a/scripts/md-tables.ts +++ b/scripts/md-tables.ts @@ -20,7 +20,7 @@ export const mdTables: [string, string?][] = [ ['11_obj_sku_object', 'PRODUCTS-API-SKU-Object.md'], ['product_collections_collection_item', 'PRODUCT-COLLECTIONS-API-Product-Collection-Object.md'], ['13_obj_validation_rule_object', 'VALIDATION-RULES-API-Validation-Rule-Object.md'], - ['13_obj_validation_rule_assignment_object', 'VALIDATION-RULES-API-Validation-Rule-Assignment-Object.md'], + ['validation_rule_assignment', 'VALIDATION-RULES-API-Validation-Rule-Assignment-Object.md'], ['14_obj_segment_object', 'SEGMENTS-API-Customer-Segment-Object.md'], ['15_req_track_custom_event', 'EVENTS-API-Custom-Event-Object.md'], ['18_res_list_consents_GET', 'CONSENTS-API-Consents-Object.md'], From 9b85e6866fb42206f6e475b0d699c46558d8d3e9 Mon Sep 17 00:00:00 2001 From: weronika-kurczyna <117282008+weronika-kurczyna@users.noreply.github.com> Date: Thu, 19 Oct 2023 12:29:55 +0200 Subject: [PATCH 10/21] update changelog --- Changelog.md | 42 +++++++++++++++++++++++++++++++++++++++++- reference/OpenAPI.json | 4 ++-- 2 files changed, 43 insertions(+), 3 deletions(-) diff --git a/Changelog.md b/Changelog.md index 198087fb4..cbfd27d67 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,10 +1,50 @@ # Changelog -# 20231017 +# 20231019 - Vouchers - List Gift Card Transactions (**GET** `/vouchers/{code}/transactions`) renamed to List Voucher Transactions - Vouchers - Export Gift Card Transactions (**GET** `/vouchers/{code}/transactions/export`) renamed to Export Voucher Transactions +**New models** +- vouchers_list_vouchers_transactions_response_body (old `1_res_vouchers_code_transactions`) +- voucher_transaction (old `1_obj_gift_card_transaction_object`) +- gift_card_transaction +- gift_card_transaction_identity +- gift_card_transaction_base +- gift_card_transaction_created +- gift_card_transaction_details +- gift_card_transaction_redemption_details (old `1_obj_gift_card_transaction_object_redemption`) +- gift_card_transaction_refund_details (old `1_obj_gift_card_transaction_object_refund`) +- gift_card_transaction_addition_details (old `1_obj_gift_card_transaction_object_addition`) +- gift_card_transaction_removal_details (old `1_obj_gift_card_transaction_object_removal`) + +- vouchers_export_transactions_request_body (old `1_req_create_gift_card_transactions_export` +- voucher_transactions_export (old `1_obj_export_transactions_object`) +- voucher_transactions_export_parameters (old `1_obj_export_gift_card_transactions`) +- voucher_transactions_filters (old `16_obj_export_gift_card_transactions`) +- voucher_transactions_export_filter_conditions (old `16_obj_filter_gift_card_transactions_voucher_id`) + +- validation_rules_list_rules_assignments_response_body (old `13_res_validation-rules_validationRuleId_assignments`) +- validation_rule_assignment (old `13_obj_validation_rule_assignment_object`) + +**Removed models** +- `8_obj_export_loyalty_card_transactions` - used only in one place, replaced with: `voucher_transactions_export_parameters` in `8_req_create_loyalty_card_transactions_export` schema + +**Endpoint changes** + +GET /vouchers/{code}/transactions (client.vouchers.listTransactions(code, query)) +POST /vouchers/{code}/transactions/export (client.vouchers.exportTransactions(code, body)) +GET /validation-rules-assignments (client.client.validationRules.listRulesAssignments(validationRuleId)) + +- Added missing method for endpoint: GET `/vouchers/{code}/transactions (client.vouchers.listTransactions(code, query))` + - Response body schema: `vouchers_list_vouchers_transactions_response_body` + +- Added missing method for endpoint: POST `/vouchers/{code}/transactions/export (client.vouchers.exportTransactions(code, body))` + - Request body schema: `vouchers_export_transactions_request_body` + +- Added missing method for endpoint: GET `/validation-rules-assignments (client.client.validationRules.listRulesAssignments(validationRuleId))` + - Request body schema: `validation_rules_list_rules_assignments_response_body` + ## 20231012 - Product Collections **New models** diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index e626c3ae6..1a2a5921d 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -3944,7 +3944,7 @@ "$ref": "#/components/schemas/gift_card_transaction_base" }, { - "$ref": "#/components/schemas/gift_card_transaction_response_data" + "$ref": "#/components/schemas/gift_card_transaction_created" }, { "$ref": "#/components/schemas/gift_card_transaction_details" @@ -4012,7 +4012,7 @@ "related_transaction_id" ] }, - "gift_card_transaction_response_data": { + "gift_card_transaction_created": { "type": "object", "title": "Gift Card Transaction Response Data", "properties": { From f5e044572366f22edb2ce5e1f925a81ebcfb4cea Mon Sep 17 00:00:00 2001 From: weronika-kurczyna <117282008+weronika-kurczyna@users.noreply.github.com> Date: Thu, 19 Oct 2023 12:31:00 +0200 Subject: [PATCH 11/21] Update Changelog.md --- Changelog.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Changelog.md b/Changelog.md index cbfd27d67..66fe5d037 100644 --- a/Changelog.md +++ b/Changelog.md @@ -32,10 +32,6 @@ **Endpoint changes** -GET /vouchers/{code}/transactions (client.vouchers.listTransactions(code, query)) -POST /vouchers/{code}/transactions/export (client.vouchers.exportTransactions(code, body)) -GET /validation-rules-assignments (client.client.validationRules.listRulesAssignments(validationRuleId)) - - Added missing method for endpoint: GET `/vouchers/{code}/transactions (client.vouchers.listTransactions(code, query))` - Response body schema: `vouchers_list_vouchers_transactions_response_body` From ad6f4cfcbe3024d5b6db96a1919e9c5ea0c5b343 Mon Sep 17 00:00:00 2001 From: weronika-kurczyna <117282008+weronika-kurczyna@users.noreply.github.com> Date: Thu, 19 Oct 2023 14:02:17 +0200 Subject: [PATCH 12/21] fix typo --- reference/OpenAPI.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index 1a2a5921d..517a367a7 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -81828,7 +81828,7 @@ "VALIDATION RULES API" ], "summary": "List Validation Rules' Assignment(s)", - "description": "List all validation rules' assignments or filter the results using the related object ID or the validation rule ID query parameters. \n\n## How to retrieve specific validaiton rule assignments(s)\n\n### Related object ID\n\nTo find an assignment for a particular resource, you can use the ID of the object to which the validation rule was assigned. This could be, for example, an ID of a: voucher, campaign, distribution, reward assignment, earning rule, promotion tier. \n\n\n\n```curl\ncurl -X GET \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\" \\\n -H \"Content-Type: application/json\" \\\n https://api.voucherify.io/v1/validation-rules-assignments?related_object_id=promo_kJliy076IuJYtuYWSHE9fSuT\n```\n\n```json\n{\n \"object\": \"list\",\n \"data_ref\": \"data\",\n \"data\": [\n {\n \"id\": \"asgm_tZaqxeO8gP4q91jG\",\n \"rule_id\": \"val_WB6ETAiFztw5\",\n \"related_object_id\": \"promo_kJliy076IuJYtuYWSHE9fSuT\",\n \"related_object_type\": \"promotion_tier\",\n \"created_at\": \"2022-08-10T10:30:39.986Z\",\n \"object\": \"validation_rules_assignment\"\n }\n ],\n \"total\": 1\n}\n```\n\n### Validation rule ID\n\nYou can use the validation rule ID to find assignment(s) for a specific validation rule.\n\n\n\n```curl\ncurl -X GET \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\" \\\n -H \"Content-Type: application/json\" \\\n https://api.voucherify.io/v1/validation-rules-assignments?rule=val_ZEZmA9oit8aU\n```\n\n```json\n{\n \"object\": \"list\",\n \"data_ref\": \"data\",\n \"data\": [\n {\n \"id\": \"asgm_vef0G6d9Al0rABxq\",\n \"rule_id\": \"val_ZEZmA9oit8aU\",\n \"related_object_id\": \"camp_rRsfatlwN7unSeUIJDCYedal\",\n \"related_object_type\": \"campaign\",\n \"created_at\": \"2022-06-29T11:43:52.953Z\",\n \"object\": \"validation_rules_assignment\"\n },\n {\n \"id\": \"asgm_sFV4wEFvldwIvgfb\",\n \"rule_id\": \"val_ZEZmA9oit8aU\",\n \"related_object_id\": \"distr_9QKI02wqgjWyvZXeQkFEPmkkYe\",\n \"related_object_type\": \"distribution\",\n \"created_at\": \"2022-06-29T11:41:07.680Z\",\n \"object\": \"validation_rules_assignment\"\n },\n {\n \"id\": \"asgm_69Qifyv6UZynFIIQ\",\n \"rule_id\": \"val_ZEZmA9oit8aU\",\n \"related_object_id\": \"promo_g83qUzYZpfX0OMAFOVoQuOYG\",\n \"related_object_type\": \"promotion_tier\",\n \"created_at\": \"2022-06-29T11:29:41.906Z\",\n \"object\": \"validation_rules_assignment\"\n }\n ],\n \"total\": 3\n}\n```\n", + "description": "List all validation rules' assignments or filter the results using the related object ID or the validation rule ID query parameters. \n\n## How to retrieve specific validation rule assignments(s)\n\n### Related object ID\n\nTo find an assignment for a particular resource, you can use the ID of the object to which the validation rule was assigned. This could be, for example, an ID of a: voucher, campaign, distribution, reward assignment, earning rule, promotion tier. \n\n\n\n```curl\ncurl -X GET \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\" \\\n -H \"Content-Type: application/json\" \\\n https://api.voucherify.io/v1/validation-rules-assignments?related_object_id=promo_kJliy076IuJYtuYWSHE9fSuT\n```\n\n```json\n{\n \"object\": \"list\",\n \"data_ref\": \"data\",\n \"data\": [\n {\n \"id\": \"asgm_tZaqxeO8gP4q91jG\",\n \"rule_id\": \"val_WB6ETAiFztw5\",\n \"related_object_id\": \"promo_kJliy076IuJYtuYWSHE9fSuT\",\n \"related_object_type\": \"promotion_tier\",\n \"created_at\": \"2022-08-10T10:30:39.986Z\",\n \"object\": \"validation_rules_assignment\"\n }\n ],\n \"total\": 1\n}\n```\n\n### Validation rule ID\n\nYou can use the validation rule ID to find assignment(s) for a specific validation rule.\n\n\n\n```curl\ncurl -X GET \\\n -H \"X-App-Id: c70a6f00-cf91-4756-9df5-47628850002b\" \\\n -H \"X-App-Token: 3266b9f8-e246-4f79-bdf0-833929b1380c\" \\\n -H \"Content-Type: application/json\" \\\n https://api.voucherify.io/v1/validation-rules-assignments?rule=val_ZEZmA9oit8aU\n```\n\n```json\n{\n \"object\": \"list\",\n \"data_ref\": \"data\",\n \"data\": [\n {\n \"id\": \"asgm_vef0G6d9Al0rABxq\",\n \"rule_id\": \"val_ZEZmA9oit8aU\",\n \"related_object_id\": \"camp_rRsfatlwN7unSeUIJDCYedal\",\n \"related_object_type\": \"campaign\",\n \"created_at\": \"2022-06-29T11:43:52.953Z\",\n \"object\": \"validation_rules_assignment\"\n },\n {\n \"id\": \"asgm_sFV4wEFvldwIvgfb\",\n \"rule_id\": \"val_ZEZmA9oit8aU\",\n \"related_object_id\": \"distr_9QKI02wqgjWyvZXeQkFEPmkkYe\",\n \"related_object_type\": \"distribution\",\n \"created_at\": \"2022-06-29T11:41:07.680Z\",\n \"object\": \"validation_rules_assignment\"\n },\n {\n \"id\": \"asgm_69Qifyv6UZynFIIQ\",\n \"rule_id\": \"val_ZEZmA9oit8aU\",\n \"related_object_id\": \"promo_g83qUzYZpfX0OMAFOVoQuOYG\",\n \"related_object_type\": \"promotion_tier\",\n \"created_at\": \"2022-06-29T11:29:41.906Z\",\n \"object\": \"validation_rules_assignment\"\n }\n ],\n \"total\": 3\n}\n```\n", "parameters": [ { "schema": { From 7f3112caff20bfc3eca0b2ca3694af43e9878ada Mon Sep 17 00:00:00 2001 From: weronika-kurczyna <117282008+weronika-kurczyna@users.noreply.github.com> Date: Thu, 19 Oct 2023 14:34:29 +0200 Subject: [PATCH 13/21] update scripts --- scripts/manage-project.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/manage-project.ts b/scripts/manage-project.ts index 4002e5099..50c6493b1 100644 --- a/scripts/manage-project.ts +++ b/scripts/manage-project.ts @@ -80,11 +80,11 @@ const isVersionExists = async (version: string) => { const uploadReferenceDocsWithMaxNumberOfAttempts = async ( version, - maxNumberOfUploadingAttempts = 6 + maxNumberOfUploadingAttempts = 3 ) => { console.log(colors.green("UPLOADING REFERENCE DOC FILES...")); for (let i = 1; i <= maxNumberOfUploadingAttempts; i++) { - await new Promise((r) => setTimeout(r, 5000)); + await new Promise((r) => setTimeout(r, 10000)); const success = await runCliProcess({ command: `rdme docs ./docs/reference-docs --version=${version}`, stdoutIncludes: "successfully created", @@ -122,12 +122,12 @@ const runCliProcess = async ({ ) { return resolve(true); } + if (stderr) { + console.log("Error: \n", stderr) + } if (resolveErrorAsFalse) { return resolve(false); } - if (stderr) { - console.log(stderr); - } throw error; }); }); @@ -230,7 +230,7 @@ const cleanProject = async (version) => { ); console.log(colors.green(`REFERENCE CATEGORIES UPDATED!`)); const allApiSpecifications = await getAllApiSpecifications(version); - await asyncMap(allApiSpecifications, deleteSpecification); + await asyncMap(allApiSpecifications, (apiSpecification) => deleteSpecification(apiSpecification.id)); console.log(colors.green(`API SPECIFICATIONS DELETED!`)); console.log(colors.green(`VERSION "${version}" IS CLEANED UP!`)); return; From 97c6ce8c8c7f7110d319e93e550d6a0866599ab0 Mon Sep 17 00:00:00 2001 From: weronika-kurczyna <117282008+weronika-kurczyna@users.noreply.github.com> Date: Thu, 19 Oct 2023 14:34:42 +0200 Subject: [PATCH 14/21] fix operationId --- reference/OpenAPI.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index 517a367a7..e5be0bdc3 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -47735,7 +47735,7 @@ } ], "get": { - "operationId": "list-gift-card-transactions", + "operationId": "list-voucher-transactions", "tags": [ "VOUCHERS API" ], From dc3f2106a1969df858b896a817ad609d66b77a34 Mon Sep 17 00:00:00 2001 From: weronika-kurczyna <117282008+weronika-kurczyna@users.noreply.github.com> Date: Thu, 19 Oct 2023 17:13:59 +0200 Subject: [PATCH 15/21] update descriptions --- reference/OpenAPI.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index e5be0bdc3..fd25b7729 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -4573,7 +4573,7 @@ "enum": [ "id,type,source_id,reason,balance,amount,created_at,voucher_id,campaign_id,source,details,related_transaction_id" ], - "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
                                  - `CREDITS_ADDITION`
                                  - `CREDITS_REFUND`
                                  - `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |", + "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
                                  - `CREDITS_ADDITION`
                                  - `CREDITS_REFUND`
                                  - `CREDITS_REDEMPTION`
                                  - `POINTS_ACCRUAL`
                                  - `POINTS_CANCELLATION`
                                  - `POINTS_REDEMPTION`
                                  - `POINTS_REFUND`
                                  - `POINTS_ADDITION`
                                  - `POINTS_REMOVAL`
                                  - `POINTS_EXPIRATION`
                                  - `POINTS_TRANSFER_IN`
                                  - `POINTS_TRANSFER_OUT` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card or loyalty card balance after the transaction. | |\n| amount | The amount of gift card or loyalty card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |", "items": { "type": "string" } @@ -4583,7 +4583,7 @@ "voucher_transactions_export": { "title": "Export", "type": "object", - "description": "This is an object representing an export. \n\n Using this endpoint, you can export [gift card transactions](ref:list-gift-card-transactions) as a CSV file. This functionality works asynchronously and comes down to the following steps: \n* create an export object and return its `id` so you can track its `status`\n* trigger a CSV file generation, change the status to `SCHEDULED`\n* when the generation is over, store the file in S3 and change the `status` to `DONE`\n* now you can (ref:download-export) it\n\nWith `parameters` you can select which `fields` will be exported. An export request will almost always result in a single file being generated by the system. However, when your volume of data is large, the system may split the results into multiple chunks.", + "description": "This is an object representing an export. \n\n Using this endpoint, you can export voucher transactions as a CSV file. This functionality works asynchronously and comes down to the following steps: create an export object and return its id so you can track its status, trigger a CSV file generation, change the status to SCHEDULED when the generation is over, store the file in S3 and change the status to DONE. Now you can download it.\n\nWith parameters you can select which fields will be exported. An export request will almost always result in a single file being generated by the system. However, when your volume of data is large, the system may split the results into multiple chunks.", "properties": { "id": { "type": "string", @@ -34763,7 +34763,7 @@ "validation_rule_assignment": { "title": "Validation Rule Assignment", "type": "object", - "description": "This is an object representing a validation rule assignment. \n\nThis object stores an assignment of a: \n- [voucher](ref:get-voucher)\n- [campaign](ref:get-campaign)\n- [earning rule](ref:get-earning-rule)\n- [reward assignment](ref:get-reward-assignment)\n- [promotion tier](ref:list-promotion-tiers)\n- [publication](ref:list-publications)", + "description": "This is an object representing a validation rule assignment.", "x-tags": [ "VALIDATION RULES API" ], @@ -35767,7 +35767,7 @@ "enum": [ "id,type,source_id,reason,balance,amount,created_at,voucher_id,campaign_id,source,details,related_transaction_id" ], - "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
                                  - `CREDITS_ADDITION`
                                  - `CREDITS_REFUND`
                                  - `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |", + "description": "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:\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
                                  - `CREDITS_ADDITION`
                                  - `CREDITS_REFUND`
                                  - `CREDITS_REDEMPTION`
                                  - `POINTS_ACCRUAL`
                                  - `POINTS_CANCELLATION`
                                  - `POINTS_REDEMPTION`
                                  - `POINTS_REFUND`
                                  - `POINTS_ADDITION`
                                  - `POINTS_REMOVAL`
                                  - `POINTS_EXPIRATION`
                                  - `POINTS_TRANSFER_IN`
                                  - `POINTS_TRANSFER_OUT` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card or loyalty card balance after the transaction. | |\n| amount | The amount of gift card or loyalty card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |", "items": { "type": "string" } @@ -48045,7 +48045,7 @@ } ], "summary": "Export Voucher Transactions", - "description": "Export transactions that are associated with credit movements on a gift card or loyalty card.\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
                                  - `CREDITS_ADDITION`
                                  - `CREDITS_REFUND`
                                  - `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |", + "description": "Export transactions that are associated with credit movements on a gift card or loyalty card.\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
                                  - `CREDITS_ADDITION`
                                  - `CREDITS_REFUND`
                                  - `CREDITS_REDEMPTION`
                                  - `POINTS_ACCRUAL`
                                  - `POINTS_CANCELLATION`
                                  - `POINTS_REDEMPTION`
                                  - `POINTS_REFUND`
                                  - `POINTS_ADDITION`
                                  - `POINTS_REMOVAL`
                                  - `POINTS_EXPIRATION`
                                  - `POINTS_TRANSFER_IN`
                                  - `POINTS_TRANSFER_OUT` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card or loyalty card balance after the transaction. | |\n| amount | The amount of gift card or loyalty card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |", "requestBody": { "description": "Specify the parameters for the transaction export.", "content": { @@ -83675,7 +83675,7 @@ "EXPORTS API" ], "summary": "Create Export", - "description": "Create export object. The export can be any of the following types: `voucher`, `redemption`, `publication`, `customer`, `order`, `points_expiration`, or `voucher_transactions`. \n\n## Defaults\n\nIf you only specify the object type in the request body without specifying the fields, the API will return the following fields per export object:\n\n| **Export Object** | **Default fields returned** |\n|:---|:---|\n| order | `id`, `source_id`, `status` |\n| voucher | `code`, `voucher_type`, `value`, `discount_type` |\n| publication | `code`, `customer_id`, `date`, `channel` |\n| redemption | `id`, `object`, `voucher_code`, `customer_id`, `date`, `result` |\n| customer | `name`, `source_id` |\n| points_expiration | `id`, `campaign_id`, `voucher_id`, `status`, `expires_at`, `points` |\n| voucher_transactions | `id`, `type`, `source_id`, `status`, `reason`, `source`, `balance`, `amount`, `created_at` |\n\n\n## Fetching particular data sets\n\nUsing the `parameters` body parameter, you can narrow down which fields to export and how to filter the results. The fields are an array of strings containing the data that you would like to export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:\n\n## Orders \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique order ID. | ord_A69RIxEdRsPuC6i8gFGVHUft |\n| source_id | Unique order source ID. | 8638 |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the order was created. | 2022-03-09T09:16:32.521Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the order was last updated. | 2022-03-09T09:16:33.331Z |\n| status | Order status. | `PAID`, `CREATED`, `FULFILLED`, `CANCELED` |\n| amount | Total amount of order items. | 7700 |\n| discount_amount | Represents total amount of the discount applied to whole cart. | 500 |\n| items_discount_amount | Represents total amount of the discount applied to order line items. | 100 |\n| total_discount_amount | All discounts applied to the order including discounts applied to particular order line items and discounts applied to the whole cart. | 600 |\n| total_amount | Total order amount after applying all discounts. | 7100 |\n| customer_id | Customer unique ID. | cust_2G4fUQdCXUqp35nXNleav7bO |\n| referrer_id | Referrer unique ID. | cust_IkrTR674vvQvr9a4rDMiqglY |\n| metadata | Order metadata; expressed as metadata.X, where X is the name of the custom metadata property. | 1 |\n\n## Vouchers \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique voucher ID. | v_HSnGD2vNIHYighTQxwcB4dtVAv8VOmZD |\n| code | Unique voucher code. | WELCOME100 |\n| voucher_type | Type of voucher. | `DISCOUNT_VOUCHER`, `GIFT_VOUCHER`, `LOYALTY_CARD` |\n| value | Value of voucher. | `DISCOUNT_VOUCHER` : amount, percent, unit
                                  `GIFT_VOUCHER`: amount left to spend
                                  `LOYALTY_CARD`: available usable points |\n| discount_type | The type of discount for a `DISCOUNT_VOUCHER`. | `AMOUNT`, `PERCENT`, `UNIT`, `FIXED` |\n| campaign | Unique campaign name. | Summer Discounts 20% off |\n| category | Tag defining the category that this voucher belongs to. | |\n| start_date | Start date defines when the code starts to be active. Activation timestamp in ISO 8601 format. Voucher is _inactive_ before this date. | 2020-12-10T23:00:00.000Z |\n| expiration_date | Expiration date defines when the code expires. Expiration timestamp in ISO 8601 format. Voucher is _inactive_ after this date. | 2023-12-31T23:00:00.000Z |\n| gift_balance | Amount left to spend. | 1000 |\n| loyalty_balance | Available usable points. | 2000 |\n| redemption_quantity | Maximum number of times a voucher can be redeemed. | 2 |\n| redemption_count | Total redemptions. | 59 |\n| active | Boolean indicating whether the voucher is available for use. | `true`, `false` |\n| qr_code | URL to QR representation of encrypted code. | |\n| bar_code | URL to barcode representation of encrypted code. | |\n| metadata | Custom voucher metadata. | |\n| is_referral_code | Boolean indicating whether the voucher is a referral code. | `true`, `false` |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the voucher was created. | 2022-04-14T09:55:46.814Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the voucher was last updated. | 2022-04-14T10:02:18.036Z |\n| validity_timeframe_interval | Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an interval of `P2D` will be active every other day. | P2D |\n| validity_timeframe_duration | Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a duration of `PT1H` will be valid for a duration of one hour. | PT1H |\n| validity_day_of_week | Array corresponding to the particular days of the week in which the voucher is valid. | \"1,2,3,4,5\" |\n| discount_amount_limit | For `PERCENT` discount type, this is the maximum threshold allowed to be deducted. | 50 |\n| campaign_id | Parent campaign ID. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| additional_info | An optional field to keep any extra textual information about the code such as a code description and details. | |\n| customer_id | Unique customer ID of the assigned owner to whom the voucher was published. | cust_7iUa6ICKyU6gH40dBU25kQU1 |\n| discount_unit_type | For `UNIT` discount type, either a shipping or product ID for a `UNIT` discount with one product. | prod_5h1pp1ng, prod_0a9f9aeddb019a42db |\n| discount_unit_effect | `UNIT` discount effect. | `ADD_MANY_ITEMS`, `ADD_MISSING_ITEMS`,`ADD_NEW_ITEMS` |\n| customer_source_id | Unique customer source id of the assigned owner to whom the voucher was published. | name.lastname@email.com |\n\n\n## Publications\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| voucher_code | Unique voucher code. | WELCOME100 |\n| customer_id | Customer unique ID. | cust_7iUa6ICKyU6gH40dBU25kQU1 |\n| customer_source_id | Unique customer source id of the assigned owner to whom the voucher was published. | name.lastname@email.com |\n| date | Timestamp in ISO 8601 format representing the date and time when the voucher was published. | 2022-04-28T10:19:30.792Z |\n| channel | Publication channel. | voucherify-website |\n| campaign | Unique campaign name. | Summer Discounts 20% off |\n| is_winner | | |\n| metadata | Custom publication metadata. | |\n\n## Redemptions\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique redemption ID. | r_0acf3a6dae00e679c8, rf_0acf3a495740e679b8 |\n| object | Object being exported; by default `redemption`. | redemption |\n| date | Timestamp in ISO 8601 format representing the date and time when the voucher was redeemed. | 2022-03-23T08:52:24.867Z |\n| voucher_code | Unique voucher code redeemed. | WELCOME100 |\n| campaign | Parent campaign name of voucher if applicable. | Summer Discounts 20% off |\n| promotion_tier_id | | promo_Mwy9XpA0TLctSGriM5kum0qp |\n| customer_id | Unique customer ID of redeeming customer. | cust_nk0N1uNQ1YnupAoJGOgvsODC |\n| customer_source_id | Unique source ID of redeeming customer. | name.lastname@email.com |\n| customer_name | Customer name. | John Smith |\n| tracking_id | | track_Pw6r3ejnml43kIwNS4Zj09KZ67xOfLUy |\n| order_amount | Total order amount before applying all discounts. | 1000 |\n| gift_amount | Gift credits used for redemption. | 10 |\n| loyalty_points | | 12 |\n| result | Tells you whether the redemption succeeded. | `SUCCESS`, `FAILURE` |\n| failure_code | Internal Voucherify code for reason why redemption failed. | invalid_customer |\n| failure_message | A human-readable message providing a short description explaining why the redemption failed. | Customer must be a holder of a loyalty card. |\n| metadata | Custom redemption metadata. | |\n\n## Customers\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| name | Customer name. | John Smith |\n| id | Unique customer ID. | cust_J1CDUdbqn5Exva8ASWk1Fq0j |\n| description | An arbitrary string that you can attach to a customer object. | Customer requesting to be added to VIP tier. |\n| email | Customer's email. | name.lastname@email.com |\n| source_id | Unique custom customer identifier. | name.lastname@email.com |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the customer was created. | 2022-02-03T13:10:11.928Z |\n| address_city | City | Houston |\n| address_state | State | TX |\n| address_line_1 | First line of customer's address. | 72738 Main St |\n| address_line_2 | Second line of customer's address. | Bld 2, Apt 4 |\n| address_country | Country | United States of America |\n| address_postal_code | Postal code (ZIP code) | 77042-4143 |\n| redemptions_total_redeemed | Total customer redemptions. | 5 |\n| redemptions_total_failed | Total customer failed redemptions. | 2 |\n| redemptions_total_succeeded | Total customer succeeded redemptions. | 3 |\n| redemptions_total_rolled_back | Total customer redemptions that were rolled back. | 3 |\n| redemptions_total_rollback_failed | Total customer redemptions that were unsuccessfully rolled back. | 2 |\n| redemptions_total_rollback_succeeded | Total customer redemptions that were successfully rolled back. | 1 |\n| orders_total_amount | Total sum of order amounts over customer lifetime. Value is multiplied by 100 to precisely represent 2 decimal places. | 10000 (represents $100) |\n| orders_total_count | Total number of customer orders. | 2 |\n| orders_average_amount | Average amount spent on orders. Value is multiplied by 100 to precisely represent 2 decimal places. | 5000 (represents $50) |\n| orders_last_order_amount | How much did the customer spend on their last order. Value is multiplied by 100 to precisely represent 2 decimal places. | 5000 (represents $50) |\n| orders_last_order_date | When was the last customer order; timestamp in ISO 8601 format representing the date and time. | 2022-02-03T13:17:30.630Z |\n| loyalty_points | Sum of customer's loyalty points to go across all loyalty cards. | 2000 |\n| loyalty_referred_customers | How many customers were referred by this customer. | 3 |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the customer was updated. | 2022-02-14T14:10:14.305Z |\n| phone | Customer's phone number. | +1 (294) 752-1846 |\n| birthday | Customer's birthday. | 2022-01-01 |\n| metadata | Customer metadata. | All metadata fields defined in Metadata Schema for the Customer object. |\n| birthdate | Customer's birthdate. | 2022-01-01 |\n\n## Points Expirations\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n |\n| campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 |\n| status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` |\n| expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 |\n| points | Number of points. | 1000 |\n\n ## Gift Card Transactions\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
                                  - `CREDITS_ADDITION`
                                  - `CREDITS_REFUND`
                                  - `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card balance after the transaction. | |\n| amount | The amount of gift card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n\n ## Loyalty Card Transactions\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID assigned by Voucherify. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `POINTS_EXPIRATION`
                                  - `POINTS_ADDITION`
                                  - `POINTS_REMOVAL`
                                  - `POINTS_TRANSFER_OUT`
                                  - `POINTS_ACCRUAL`
                                  - `POINTS_REFUND`
                                  - `POINTS_REDEMPTION` |\n| source_id | Custom source ID of the transaction if one was included originally. | source_id_custom |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The loyalty card balance after the transaction. | |\n| amount | The amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | - `API`
                                  - `voucherify-web-ui`
                                  - `Automation` |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n| related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |", + "description": "Create export object. The export can be any of the following types: `voucher`, `redemption`, `publication`, `customer`, `order`, `points_expiration`, or `voucher_transactions`. \n\n## Defaults\n\nIf you only specify the object type in the request body without specifying the fields, the API will return the following fields per export object:\n\n| **Export Object** | **Default fields returned** |\n|:---|:---|\n| order | `id`, `source_id`, `status` |\n| voucher | `code`, `voucher_type`, `value`, `discount_type` |\n| publication | `code`, `customer_id`, `date`, `channel` |\n| redemption | `id`, `object`, `voucher_code`, `customer_id`, `date`, `result` |\n| customer | `name`, `source_id` |\n| points_expiration | `id`, `campaign_id`, `voucher_id`, `status`, `expires_at`, `points` |\n| voucher_transactions | `id`, `type`, `source_id`, `status`, `reason`, `source`, `balance`, `amount`, `created_at` |\n\n\n## Fetching particular data sets\n\nUsing the `parameters` body parameter, you can narrow down which fields to export and how to filter the results. The fields are an array of strings containing the data that you would like to export. These fields define the headers in the CSV file. The array can be a combintation of any of the following available fields:\n\n## Orders \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique order ID. | ord_A69RIxEdRsPuC6i8gFGVHUft |\n| source_id | Unique order source ID. | 8638 |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the order was created. | 2022-03-09T09:16:32.521Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the order was last updated. | 2022-03-09T09:16:33.331Z |\n| status | Order status. | `PAID`, `CREATED`, `FULFILLED`, `CANCELED` |\n| amount | Total amount of order items. | 7700 |\n| discount_amount | Represents total amount of the discount applied to whole cart. | 500 |\n| items_discount_amount | Represents total amount of the discount applied to order line items. | 100 |\n| total_discount_amount | All discounts applied to the order including discounts applied to particular order line items and discounts applied to the whole cart. | 600 |\n| total_amount | Total order amount after applying all discounts. | 7100 |\n| customer_id | Customer unique ID. | cust_2G4fUQdCXUqp35nXNleav7bO |\n| referrer_id | Referrer unique ID. | cust_IkrTR674vvQvr9a4rDMiqglY |\n| metadata | Order metadata; expressed as metadata.X, where X is the name of the custom metadata property. | 1 |\n\n## Vouchers \n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique voucher ID. | v_HSnGD2vNIHYighTQxwcB4dtVAv8VOmZD |\n| code | Unique voucher code. | WELCOME100 |\n| voucher_type | Type of voucher. | `DISCOUNT_VOUCHER`, `GIFT_VOUCHER`, `LOYALTY_CARD` |\n| value | Value of voucher. | `DISCOUNT_VOUCHER` : amount, percent, unit
                                  `GIFT_VOUCHER`: amount left to spend
                                  `LOYALTY_CARD`: available usable points |\n| discount_type | The type of discount for a `DISCOUNT_VOUCHER`. | `AMOUNT`, `PERCENT`, `UNIT`, `FIXED` |\n| campaign | Unique campaign name. | Summer Discounts 20% off |\n| category | Tag defining the category that this voucher belongs to. | |\n| start_date | Start date defines when the code starts to be active. Activation timestamp in ISO 8601 format. Voucher is _inactive_ before this date. | 2020-12-10T23:00:00.000Z |\n| expiration_date | Expiration date defines when the code expires. Expiration timestamp in ISO 8601 format. Voucher is _inactive_ after this date. | 2023-12-31T23:00:00.000Z |\n| gift_balance | Amount left to spend. | 1000 |\n| loyalty_balance | Available usable points. | 2000 |\n| redemption_quantity | Maximum number of times a voucher can be redeemed. | 2 |\n| redemption_count | Total redemptions. | 59 |\n| active | Boolean indicating whether the voucher is available for use. | `true`, `false` |\n| qr_code | URL to QR representation of encrypted code. | |\n| bar_code | URL to barcode representation of encrypted code. | |\n| metadata | Custom voucher metadata. | |\n| is_referral_code | Boolean indicating whether the voucher is a referral code. | `true`, `false` |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the voucher was created. | 2022-04-14T09:55:46.814Z |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the voucher was last updated. | 2022-04-14T10:02:18.036Z |\n| validity_timeframe_interval | Defines the intervening time between two time points in ISO 8601 format, expressed as a duration. For example, a voucher with an interval of `P2D` will be active every other day. | P2D |\n| validity_timeframe_duration | Defines the amount of time the voucher will be active in ISO 8601 format. For example, a voucher with a duration of `PT1H` will be valid for a duration of one hour. | PT1H |\n| validity_day_of_week | Array corresponding to the particular days of the week in which the voucher is valid. | \"1,2,3,4,5\" |\n| discount_amount_limit | For `PERCENT` discount type, this is the maximum threshold allowed to be deducted. | 50 |\n| campaign_id | Parent campaign ID. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| additional_info | An optional field to keep any extra textual information about the code such as a code description and details. | |\n| customer_id | Unique customer ID of the assigned owner to whom the voucher was published. | cust_7iUa6ICKyU6gH40dBU25kQU1 |\n| discount_unit_type | For `UNIT` discount type, either a shipping or product ID for a `UNIT` discount with one product. | prod_5h1pp1ng, prod_0a9f9aeddb019a42db |\n| discount_unit_effect | `UNIT` discount effect. | `ADD_MANY_ITEMS`, `ADD_MISSING_ITEMS`,`ADD_NEW_ITEMS` |\n| customer_source_id | Unique customer source id of the assigned owner to whom the voucher was published. | name.lastname@email.com |\n\n\n## Publications\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| voucher_code | Unique voucher code. | WELCOME100 |\n| customer_id | Customer unique ID. | cust_7iUa6ICKyU6gH40dBU25kQU1 |\n| customer_source_id | Unique customer source id of the assigned owner to whom the voucher was published. | name.lastname@email.com |\n| date | Timestamp in ISO 8601 format representing the date and time when the voucher was published. | 2022-04-28T10:19:30.792Z |\n| channel | Publication channel. | voucherify-website |\n| campaign | Unique campaign name. | Summer Discounts 20% off |\n| is_winner | | |\n| metadata | Custom publication metadata. | |\n\n## Redemptions\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique redemption ID. | r_0acf3a6dae00e679c8, rf_0acf3a495740e679b8 |\n| object | Object being exported; by default `redemption`. | redemption |\n| date | Timestamp in ISO 8601 format representing the date and time when the voucher was redeemed. | 2022-03-23T08:52:24.867Z |\n| voucher_code | Unique voucher code redeemed. | WELCOME100 |\n| campaign | Parent campaign name of voucher if applicable. | Summer Discounts 20% off |\n| promotion_tier_id | | promo_Mwy9XpA0TLctSGriM5kum0qp |\n| customer_id | Unique customer ID of redeeming customer. | cust_nk0N1uNQ1YnupAoJGOgvsODC |\n| customer_source_id | Unique source ID of redeeming customer. | name.lastname@email.com |\n| customer_name | Customer name. | John Smith |\n| tracking_id | | track_Pw6r3ejnml43kIwNS4Zj09KZ67xOfLUy |\n| order_amount | Total order amount before applying all discounts. | 1000 |\n| gift_amount | Gift credits used for redemption. | 10 |\n| loyalty_points | | 12 |\n| result | Tells you whether the redemption succeeded. | `SUCCESS`, `FAILURE` |\n| failure_code | Internal Voucherify code for reason why redemption failed. | invalid_customer |\n| failure_message | A human-readable message providing a short description explaining why the redemption failed. | Customer must be a holder of a loyalty card. |\n| metadata | Custom redemption metadata. | |\n\n## Customers\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| name | Customer name. | John Smith |\n| id | Unique customer ID. | cust_J1CDUdbqn5Exva8ASWk1Fq0j |\n| description | An arbitrary string that you can attach to a customer object. | Customer requesting to be added to VIP tier. |\n| email | Customer's email. | name.lastname@email.com |\n| source_id | Unique custom customer identifier. | name.lastname@email.com |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the customer was created. | 2022-02-03T13:10:11.928Z |\n| address_city | City | Houston |\n| address_state | State | TX |\n| address_line_1 | First line of customer's address. | 72738 Main St |\n| address_line_2 | Second line of customer's address. | Bld 2, Apt 4 |\n| address_country | Country | United States of America |\n| address_postal_code | Postal code (ZIP code) | 77042-4143 |\n| redemptions_total_redeemed | Total customer redemptions. | 5 |\n| redemptions_total_failed | Total customer failed redemptions. | 2 |\n| redemptions_total_succeeded | Total customer succeeded redemptions. | 3 |\n| redemptions_total_rolled_back | Total customer redemptions that were rolled back. | 3 |\n| redemptions_total_rollback_failed | Total customer redemptions that were unsuccessfully rolled back. | 2 |\n| redemptions_total_rollback_succeeded | Total customer redemptions that were successfully rolled back. | 1 |\n| orders_total_amount | Total sum of order amounts over customer lifetime. Value is multiplied by 100 to precisely represent 2 decimal places. | 10000 (represents $100) |\n| orders_total_count | Total number of customer orders. | 2 |\n| orders_average_amount | Average amount spent on orders. Value is multiplied by 100 to precisely represent 2 decimal places. | 5000 (represents $50) |\n| orders_last_order_amount | How much did the customer spend on their last order. Value is multiplied by 100 to precisely represent 2 decimal places. | 5000 (represents $50) |\n| orders_last_order_date | When was the last customer order; timestamp in ISO 8601 format representing the date and time. | 2022-02-03T13:17:30.630Z |\n| loyalty_points | Sum of customer's loyalty points to go across all loyalty cards. | 2000 |\n| loyalty_referred_customers | How many customers were referred by this customer. | 3 |\n| updated_at | Timestamp in ISO 8601 format representing the date and time when the customer was updated. | 2022-02-14T14:10:14.305Z |\n| phone | Customer's phone number. | +1 (294) 752-1846 |\n| birthday | Customer's birthday. | 2022-01-01 |\n| metadata | Customer metadata. | All metadata fields defined in Metadata Schema for the Customer object. |\n| birthdate | Customer's birthdate. | 2022-01-01 |\n\n## Points Expirations\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Loyalty points bucket ID. | lopb_Wl1o3EjJIHSNjvO5BDLy4z1n |\n| campaign_id | Campaign ID of the parent loyalty campaign. | camp_7s3uXI44aKfIk5IhmeOPr6ic |\n| voucher_id | Voucher ID of the parent loyalty card. | v_YLn0WVWXSXbUfDvxgrgUbtfJ3SQIY655 |\n| status | Status of the loyalty points bucket. | `ACTIVE` or `INACTIVE` |\n| expires_at | Timestamp in ISO 8601 format representing the date when the points expire. | 2022-06-30 |\n| points | Number of points. | 1000 |\n\n ## Gift Card Transactions\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `CREDITS_REMOVAL`
                                  - `CREDITS_ADDITION`
                                  - `CREDITS_REFUND`
                                  - `CREDITS_REDEMPTION` |\n| source_id | Unique transaction source ID. | 8638 |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The gift card or loyalty card balance after the transaction. | |\n| amount | The amount of gift card or loyalty card credits being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | API |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n\n ## Loyalty Card Transactions\n\n| **Field** | **Definition** | **Example Export** |\n|:---|:---|:---|\n| id | Unique transaction ID assigned by Voucherify. | vtx_0cb7811f1c07765800 |\n| type | Transaction type. | - `POINTS_EXPIRATION`
                                  - `POINTS_ADDITION`
                                  - `POINTS_REMOVAL`
                                  - `POINTS_TRANSFER_OUT`
                                  - `POINTS_ACCRUAL`
                                  - `POINTS_REFUND`
                                  - `POINTS_REDEMPTION` |\n| source_id | Custom source ID of the transaction if one was included originally. | source_id_custom |\n| reason | Contains the reason for the transaction if one was included originally. | |\n| balance | The loyalty card balance after the transaction. | |\n| amount | The amount of loyalty points being allocated during the transaction. This value can either be negative or positive depending on the nature of the transaction. | |\n| created_at | Timestamp in ISO 8601 format representing the date and time when the transaction was created. | 2022-03-09T09:16:32.521Z |\n| voucher_id | Unique Voucher ID. | v_dky7ksKfPX50Wb2Bxvcoeb1xT20b6tcp |\n| campaign_id | Parent campaign ID. | camp_FNYR4jhqZBM9xTptxDGgeNBV |\n| source| Channel through which the transaction was initiated. | - `API`
                                  - `voucherify-web-ui`
                                  - `Automation` |\n| details | More detailed information stored in the form of a JSON. | Provides more details related to the transaction in the form of an object. |\n| related_transaction_id | Unique transaction ID related to a receiver/donor card in the case of a points transfer from/to another card. | vtx_0c9afe802593b34b80 |", "parameters": [], "security": [ { From c916ae2c2a92603dcd8b8379be0fac1e30aa545f Mon Sep 17 00:00:00 2001 From: weronika-kurczyna <117282008+weronika-kurczyna@users.noreply.github.com> Date: Fri, 20 Oct 2023 09:12:56 +0200 Subject: [PATCH 16/21] fix wrong request body for export --- reference/OpenAPI.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index fd25b7729..8fda84970 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -4550,7 +4550,7 @@ "description": "Request body schema for **POST** `/vouchers/transactions/export`.", "properties": { "parameters": { - "$ref": "#/components/schemas/voucher_transactions_export", + "$ref": "#/components/schemas/voucher_transactions_export_parameters", "description": "Contains the parameters that define the data to be exported." } } From c9334d65c2cc1ae257d524873a13c5964afced42 Mon Sep 17 00:00:00 2001 From: weronika-kurczyna <117282008+weronika-kurczyna@users.noreply.github.com> Date: Fri, 20 Oct 2023 09:16:31 +0200 Subject: [PATCH 17/21] fix typos --- reference/OpenAPI.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index 8fda84970..5b48d9776 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -36042,7 +36042,7 @@ } }, "16_obj_filter_points_expiration_voucher_id": { - "description": "Filter conditions set on`the `voucher_id`.", + "description": "Filter conditions set on the `voucher_id`.", "title": "Filter by voucher ID", "type": "object", "properties": { @@ -36055,7 +36055,7 @@ } }, "voucher_transactions_export_filter_conditions": { - "description": "Filter conditions set on`the `voucher_id`.", + "description": "Filter conditions set on the `voucher_id`.", "title": "Filter by voucher ID", "type": "object", "properties": { @@ -36071,7 +36071,7 @@ ] }, "16_obj_filter_loyalty_card_transactions_voucher_id": { - "description": "Filter conditions set on`the `voucher_id`.", + "description": "Filter conditions set on the `voucher_id`.", "title": "Filter by voucher ID", "type": "object", "properties": { From 996f9b640f4351daf95ed433d7f56238f1c77081 Mon Sep 17 00:00:00 2001 From: weronika-kurczyna <117282008+weronika-kurczyna@users.noreply.github.com> Date: Fri, 20 Oct 2023 09:34:15 +0200 Subject: [PATCH 18/21] add type array to data --- reference/OpenAPI.json | 1 + 1 file changed, 1 insertion(+) diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index 5b48d9776..0259e825d 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -3906,6 +3906,7 @@ "description": "Identifies the name of the attribute that contains the array of transaction objects." }, "data": { + "type": "array", "$ref": "#/components/schemas/voucher_transaction", "description": "A dictionary that contains an array of transactions. Each entry in the array is a separate transaction object." }, From 4c6a443a857653a0707f960a1b8c5c275cdc1b5f Mon Sep 17 00:00:00 2001 From: weronika-kurczyna <117282008+weronika-kurczyna@users.noreply.github.com> Date: Fri, 20 Oct 2023 10:22:01 +0200 Subject: [PATCH 19/21] update gift card transactions --- reference/OpenAPI.json | 102 ++++++++++++++++++++++++++++------------- 1 file changed, 70 insertions(+), 32 deletions(-) diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index 0259e825d..3f9d64e16 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -3937,20 +3937,76 @@ "gift_card_transaction": { "title": "Gift Card Transaction", "description": "List of gift card transactions", - "allOf": [ - { - "$ref": "#/components/schemas/gift_card_transaction_identity" - }, - { - "$ref": "#/components/schemas/gift_card_transaction_base" - }, - { - "$ref": "#/components/schemas/gift_card_transaction_created" - }, - { - "$ref": "#/components/schemas/gift_card_transaction_details" - } - ] + "anyOf": [ + { + "title": "Redemption", + "allOf": [ + { + "$ref": "#/components/schemas/gift_card_transaction_identity" + }, + { + "$ref": "#/components/schemas/gift_card_transaction_base" + }, + { + "$ref": "#/components/schemas/gift_card_transaction_created" + }, + { + "$ref": "#/components/schemas/gift_card_transaction_redemption_details" + } + ] + }, + { + "title": "Refund", + "allOf": [ + { + "$ref": "#/components/schemas/gift_card_transaction_identity" + }, + { + "$ref": "#/components/schemas/gift_card_transaction_base" + }, + { + "$ref": "#/components/schemas/gift_card_transaction_created" + }, + { + "$ref": "#/components/schemas/gift_card_transaction_refund_details" + } + ] + }, + { + "title": "Addition", + "allOf": [ + { + "$ref": "#/components/schemas/gift_card_transaction_identity" + }, + { + "$ref": "#/components/schemas/gift_card_transaction_base" + }, + { + "$ref": "#/components/schemas/gift_card_transaction_created" + }, + { + "$ref": "#/components/schemas/gift_card_transaction_addition_details" + } + ] + }, + { + "title": "Removal", + "allOf": [ + { + "$ref": "#/components/schemas/gift_card_transaction_identity" + }, + { + "$ref": "#/components/schemas/gift_card_transaction_base" + }, + { + "$ref": "#/components/schemas/gift_card_transaction_created" + }, + { + "$ref": "#/components/schemas/gift_card_transaction_removal_details" + } + ] + } + ] }, "gift_card_transaction_identity": { "type": "object", @@ -4028,24 +4084,6 @@ "created_at" ] }, - "gift_card_transaction_details": { - "type": "object", - "anyOf": [ - { - "$ref": "#/components/schemas/gift_card_transaction_redemption_details" - }, - { - "$ref": "#/components/schemas/gift_card_transaction_refund_details" - }, - { - "$ref": "#/components/schemas/gift_card_transaction_addition_details" - }, - { - "$ref": "#/components/schemas/gift_card_transaction_removal_details" - } - ], - "title": "Gift Card Transaction Details" - }, "gift_card_transaction_redemption_details": { "title": "Redemption", "description": "When credits are used to pay for an order.", From c9e95c563502137b5fe6186b1314b640ebc334b8 Mon Sep 17 00:00:00 2001 From: weronika-kurczyna <117282008+weronika-kurczyna@users.noreply.github.com> Date: Fri, 20 Oct 2023 11:45:14 +0200 Subject: [PATCH 20/21] update type of object --- reference/OpenAPI.json | 1 + 1 file changed, 1 insertion(+) diff --git a/reference/OpenAPI.json b/reference/OpenAPI.json index 1fb53e633..55e56823e 100644 --- a/reference/OpenAPI.json +++ b/reference/OpenAPI.json @@ -35043,6 +35043,7 @@ "format": "date-time" }, "object": { + "type": "string", "default": "validation_rules_assignment", "description": "The type of object represented by the ID.", "enum": [ From 683f3f16a487030c61bbe40a61489a38246072a8 Mon Sep 17 00:00:00 2001 From: weronika-kurczyna <117282008+weronika-kurczyna@users.noreply.github.com> Date: Fri, 20 Oct 2023 11:46:25 +0200 Subject: [PATCH 21/21] object: type - string update reference-docs --- docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md | 2 +- docs/reference-docs/PROMOTIONS-API-Promotion-Tier-Object.md | 2 +- .../STACKABLE-DISCOUNTS-API-Stackable-Redemptions-Object.md | 2 +- .../VALIDATION-RULES-API-Validation-Rule-Assignment-Object.md | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md b/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md index d909455cb..76c0acee2 100644 --- a/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md +++ b/docs/reference-docs/CAMPAIGNS-API-Campaign-Object.md @@ -219,7 +219,7 @@ order: 1 | related_object_id
                                  `string` |

                                  The resource ID to which the validation rule was assigned.

                                  **Example:**

                                  v_JtWunK6jUo7X2qOFj0SyRHq4p9tgENlT

                                  | | related_object_type
                                  `string` |

                                  The type of resource to which the validation rule was assigned.

                                  Available values: `voucher`, `campaign`, `earning_rule`, `reward_assignment`, `promotion_tier`, `distribution` | | created_at
                                  `string` |

                                  Timestamp representing the date and time when the validation rule assignment was created in ISO 8601 format.

                                  **Example:**

                                  2022-02-17T08:18:15.085Z

                                  | -| object |

                                  The type of object represented by the ID.

                                  Available values: `validation_rules_assignment` | +| object
                                  `string` |

                                  The type of object represented by the ID.

                                  Available values: `validation_rules_assignment` | [block:html] { diff --git a/docs/reference-docs/PROMOTIONS-API-Promotion-Tier-Object.md b/docs/reference-docs/PROMOTIONS-API-Promotion-Tier-Object.md index c60c6e87e..70f2bd04c 100644 --- a/docs/reference-docs/PROMOTIONS-API-Promotion-Tier-Object.md +++ b/docs/reference-docs/PROMOTIONS-API-Promotion-Tier-Object.md @@ -109,7 +109,7 @@ order: 1 | related_object_id
                                  `string` |

                                  The resource ID to which the validation rule was assigned.

                                  **Example:**

                                  v_JtWunK6jUo7X2qOFj0SyRHq4p9tgENlT

                                  | | related_object_type
                                  `string` |

                                  The type of resource to which the validation rule was assigned.

                                  Available values: `voucher`, `campaign`, `earning_rule`, `reward_assignment`, `promotion_tier`, `distribution` | | created_at
                                  `string` |

                                  Timestamp representing the date and time when the validation rule assignment was created in ISO 8601 format.

                                  **Example:**

                                  2022-02-17T08:18:15.085Z

                                  | -| object |

                                  The type of object represented by the ID.

                                  Available values: `validation_rules_assignment` | +| object
                                  `string` |

                                  The type of object represented by the ID.

                                  Available values: `validation_rules_assignment` | [block:html] { diff --git a/docs/reference-docs/STACKABLE-DISCOUNTS-API-Stackable-Redemptions-Object.md b/docs/reference-docs/STACKABLE-DISCOUNTS-API-Stackable-Redemptions-Object.md index 99e03545e..16286956c 100644 --- a/docs/reference-docs/STACKABLE-DISCOUNTS-API-Stackable-Redemptions-Object.md +++ b/docs/reference-docs/STACKABLE-DISCOUNTS-API-Stackable-Redemptions-Object.md @@ -419,7 +419,7 @@ One of: | related_object_id
                                  `string` |

                                  The resource ID to which the validation rule was assigned.

                                  **Example:**

                                  v_JtWunK6jUo7X2qOFj0SyRHq4p9tgENlT

                                  | | related_object_type
                                  `string` |

                                  The type of resource to which the validation rule was assigned.

                                  Available values: `voucher`, `campaign`, `earning_rule`, `reward_assignment`, `promotion_tier`, `distribution` | | created_at
                                  `string` |

                                  Timestamp representing the date and time when the validation rule assignment was created in ISO 8601 format.

                                  **Example:**

                                  2022-02-17T08:18:15.085Z

                                  | -| object |

                                  The type of object represented by the ID.

                                  Available values: `validation_rules_assignment` | +| object
                                  `string` |

                                  The type of object represented by the ID.

                                  Available values: `validation_rules_assignment` | [block:html] { diff --git a/docs/reference-docs/VALIDATION-RULES-API-Validation-Rule-Assignment-Object.md b/docs/reference-docs/VALIDATION-RULES-API-Validation-Rule-Assignment-Object.md index 239083436..e1f42bf89 100644 --- a/docs/reference-docs/VALIDATION-RULES-API-Validation-Rule-Assignment-Object.md +++ b/docs/reference-docs/VALIDATION-RULES-API-Validation-Rule-Assignment-Object.md @@ -16,7 +16,7 @@ order: 2 | related_object_id
                                  `string` |

                                  The resource ID to which the validation rule was assigned.

                                  **Example:**

                                  v_JtWunK6jUo7X2qOFj0SyRHq4p9tgENlT

                                  | | related_object_type
                                  `string` |

                                  The type of resource to which the validation rule was assigned.

                                  Available values: `voucher`, `campaign`, `earning_rule`, `reward_assignment`, `promotion_tier`, `distribution` | | created_at
                                  `string` |

                                  Timestamp representing the date and time when the validation rule assignment was created in ISO 8601 format.

                                  **Example:**

                                  2022-02-17T08:18:15.085Z

                                  | -| object |

                                  The type of object represented by the ID.

                                  Available values: `validation_rules_assignment` | +| object
                                  `string` |

                                  The type of object represented by the ID.

                                  Available values: `validation_rules_assignment` | [block:html] {